From 8623f5cff698819b86292c6c914f32b1687871e4 Mon Sep 17 00:00:00 2001 From: Madeleine Filloux Date: Mon, 28 Oct 2024 15:02:05 -0700 Subject: [PATCH 1/2] fix: prefer user-defined tickMinStep to defaultTickMinStep --- src/compile/axis/properties.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/compile/axis/properties.ts b/src/compile/axis/properties.ts index 5d9b5c4e9f..04ab898359 100644 --- a/src/compile/axis/properties.ts +++ b/src/compile/axis/properties.ts @@ -84,7 +84,7 @@ export const axisRules: { return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values}); }, - tickMinStep: defaultTickMinStep, + tickMinStep: ({axis, format, fieldOrDatumDef}) => axis.tickMinStep ?? defaultTickMinStep({format, fieldOrDatumDef}), title: ({axis, model, channel}) => { if (axis.title !== undefined) { From 80a2efc83928dec27a66db1663200c113341c363 Mon Sep 17 00:00:00 2001 From: Madeleine Filloux Date: Tue, 29 Oct 2024 14:23:05 -0700 Subject: [PATCH 2/2] chore: include built files --- .gitignore | 1 - build/package.json | 147 + build/src/aggregate.d.ts | 28 + build/src/aggregate.d.ts.map | 1 + build/src/aggregate.js | 74 + build/src/aggregate.js.map | 1 + build/src/axis.d.ts | 304 + build/src/axis.d.ts.map | 1 + build/src/axis.js | 281 + build/src/axis.js.map | 1 + build/src/bin.d.ts | 85 + build/src/bin.d.ts.map | 1 + build/src/bin.js | 57 + build/src/bin.js.map | 1 + build/src/channel.d.ts | 153 + build/src/channel.d.ts.map | 1 + build/src/channel.js | 504 + build/src/channel.js.map | 1 + build/src/channeldef.d.ts | 938 + build/src/channeldef.d.ts.map | 1 + build/src/channeldef.js | 723 + build/src/channeldef.js.map | 1 + build/src/compile/axis/assemble.d.ts | 14 + build/src/compile/axis/assemble.d.ts.map | 1 + build/src/compile/axis/assemble.js | 192 + build/src/compile/axis/assemble.js.map | 1 + build/src/compile/axis/component.d.ts | 28 + build/src/compile/axis/component.d.ts.map | 1 + build/src/compile/axis/component.js | 43 + build/src/compile/axis/component.js.map | 1 + build/src/compile/axis/config.d.ts | 16 + build/src/compile/axis/config.d.ts.map | 1 + build/src/compile/axis/config.js | 83 + build/src/compile/axis/config.js.map | 1 + build/src/compile/axis/encode.d.ts | 4 + build/src/compile/axis/encode.d.ts.map | 1 + build/src/compile/axis/encode.js | 68 + build/src/compile/axis/encode.js.map | 1 + build/src/compile/axis/parse.d.ts | 6 + build/src/compile/axis/parse.d.ts.map | 1 + build/src/compile/axis/parse.js | 265 + build/src/compile/axis/parse.js.map | 1 + build/src/compile/axis/properties.d.ts | 61 + build/src/compile/axis/properties.d.ts.map | 1 + build/src/compile/axis/properties.js | 254 + build/src/compile/axis/properties.js.map | 1 + build/src/compile/buildmodel.d.ts | 6 + build/src/compile/buildmodel.d.ts.map | 1 + build/src/compile/buildmodel.js | 22 + build/src/compile/buildmodel.js.map | 1 + build/src/compile/common.d.ts | 52 + build/src/compile/common.d.ts.map | 1 + build/src/compile/common.js | 185 + build/src/compile/common.js.map | 1 + build/src/compile/compile.d.ts | 54 + build/src/compile/compile.d.ts.map | 1 + build/src/compile/compile.js | 180 + build/src/compile/compile.js.map | 1 + build/src/compile/concat.d.ts | 24 + build/src/compile/concat.d.ts.map | 1 + build/src/compile/concat.js | 109 + build/src/compile/concat.js.map | 1 + build/src/compile/data/aggregate.d.ts | 27 + build/src/compile/data/aggregate.d.ts.map | 1 + build/src/compile/data/aggregate.js | 198 + build/src/compile/data/aggregate.js.map | 1 + build/src/compile/data/assemble.d.ts | 18 + build/src/compile/data/assemble.d.ts.map | 1 + build/src/compile/data/assemble.js | 239 + build/src/compile/data/assemble.js.map | 1 + build/src/compile/data/bin.d.ts | 40 + build/src/compile/data/bin.d.ts.map | 1 + build/src/compile/data/bin.js | 178 + build/src/compile/data/bin.js.map | 1 + build/src/compile/data/calculate.d.ts | 19 + build/src/compile/data/calculate.d.ts.map | 1 + build/src/compile/data/calculate.js | 59 + build/src/compile/data/calculate.js.map | 1 + build/src/compile/data/dataflow.d.ts | 75 + build/src/compile/data/dataflow.d.ts.map | 1 + build/src/compile/data/dataflow.js | 151 + build/src/compile/data/dataflow.js.map | 1 + build/src/compile/data/density.d.ts | 16 + build/src/compile/data/density.d.ts.map | 1 + build/src/compile/data/density.js | 39 + build/src/compile/data/density.js.map | 1 + build/src/compile/data/expressions.d.ts | 2 + build/src/compile/data/expressions.d.ts.map | 1 + build/src/compile/data/expressions.js | 33 + build/src/compile/data/expressions.js.map | 1 + build/src/compile/data/extent.d.ts | 16 + build/src/compile/data/extent.d.ts.map | 1 + build/src/compile/data/extent.js | 34 + build/src/compile/data/extent.js.map | 1 + build/src/compile/data/facet.d.ts | 34 + build/src/compile/data/facet.d.ts.map | 1 + build/src/compile/data/facet.js | 237 + build/src/compile/data/facet.js.map | 1 + build/src/compile/data/filter.d.ts | 18 + build/src/compile/data/filter.d.ts.map | 1 + build/src/compile/data/filter.js | 34 + build/src/compile/data/filter.js.map | 1 + build/src/compile/data/filterinvalid.d.ts | 19 + build/src/compile/data/filterinvalid.d.ts.map | 1 + build/src/compile/data/filterinvalid.js | 78 + build/src/compile/data/filterinvalid.js.map | 1 + build/src/compile/data/flatten.d.ts | 16 + build/src/compile/data/flatten.d.ts.map | 1 + build/src/compile/data/flatten.js | 36 + build/src/compile/data/flatten.js.map | 1 + build/src/compile/data/fold.d.ts | 16 + build/src/compile/data/fold.d.ts.map | 1 + build/src/compile/data/fold.js | 36 + build/src/compile/data/fold.js.map | 1 + build/src/compile/data/formatparse.d.ts | 40 + build/src/compile/data/formatparse.d.ts.map | 1 + build/src/compile/data/formatparse.js | 302 + build/src/compile/data/formatparse.js.map | 1 + build/src/compile/data/geojson.d.ts | 17 + build/src/compile/data/geojson.d.ts.map | 1 + build/src/compile/data/geojson.js | 77 + build/src/compile/data/geojson.js.map | 1 + build/src/compile/data/geopoint.d.ts | 17 + build/src/compile/data/geopoint.d.ts.map | 1 + build/src/compile/data/geopoint.js | 62 + build/src/compile/data/geopoint.js.map | 1 + build/src/compile/data/graticule.d.ts | 13 + build/src/compile/data/graticule.d.ts.map | 1 + build/src/compile/data/graticule.js | 27 + build/src/compile/data/graticule.js.map | 1 + build/src/compile/data/identifier.d.ts | 11 + build/src/compile/data/identifier.d.ts.map | 1 + build/src/compile/data/identifier.js | 23 + build/src/compile/data/identifier.js.map | 1 + build/src/compile/data/impute.d.ts | 17 + build/src/compile/data/impute.d.ts.map | 1 + build/src/compile/data/impute.js | 88 + build/src/compile/data/impute.js.map | 1 + build/src/compile/data/index.d.ts | 56 + build/src/compile/data/index.d.ts.map | 1 + build/src/compile/data/index.js | 20 + build/src/compile/data/index.js.map | 1 + build/src/compile/data/joinaggregate.d.ts | 18 + build/src/compile/data/joinaggregate.d.ts.map | 1 + build/src/compile/data/joinaggregate.js | 58 + build/src/compile/data/joinaggregate.js.map | 1 + .../src/compile/data/joinaggregatefacet.d.ts | 5 + .../compile/data/joinaggregatefacet.d.ts.map | 1 + build/src/compile/data/joinaggregatefacet.js | 29 + .../compile/data/joinaggregatefacet.js.map | 1 + build/src/compile/data/loess.d.ts | 16 + build/src/compile/data/loess.d.ts.map | 1 + build/src/compile/data/loess.js | 37 + build/src/compile/data/loess.js.map | 1 + build/src/compile/data/lookup.d.ts | 16 + build/src/compile/data/lookup.d.ts.map | 1 + build/src/compile/data/lookup.js | 88 + build/src/compile/data/lookup.js.map | 1 + build/src/compile/data/optimize.d.ts | 14 + build/src/compile/data/optimize.d.ts.map | 1 + build/src/compile/data/optimize.js | 88 + build/src/compile/data/optimize.js.map | 1 + build/src/compile/data/optimizer.d.ts | 51 + build/src/compile/data/optimizer.d.ts.map | 1 + build/src/compile/data/optimizer.js | 82 + build/src/compile/data/optimizer.js.map | 1 + build/src/compile/data/optimizers.d.ts | 87 + build/src/compile/data/optimizers.d.ts.map | 1 + build/src/compile/data/optimizers.js | 355 + build/src/compile/data/optimizers.js.map | 1 + build/src/compile/data/parse.d.ts | 12 + build/src/compile/data/parse.d.ts.map | 1 + build/src/compile/data/parse.js | 374 + build/src/compile/data/parse.js.map | 1 + build/src/compile/data/pivot.d.ts | 17 + build/src/compile/data/pivot.d.ts.map | 1 + build/src/compile/data/pivot.js | 38 + build/src/compile/data/pivot.js.map | 1 + build/src/compile/data/quantile.d.ts | 16 + build/src/compile/data/quantile.d.ts.map | 1 + build/src/compile/data/quantile.js | 36 + build/src/compile/data/quantile.js.map | 1 + build/src/compile/data/regression.d.ts | 16 + build/src/compile/data/regression.d.ts.map | 1 + build/src/compile/data/regression.js | 37 + build/src/compile/data/regression.js.map | 1 + build/src/compile/data/sample.d.ts | 16 + build/src/compile/data/sample.d.ts.map | 1 + build/src/compile/data/sample.js | 30 + build/src/compile/data/sample.js.map | 1 + build/src/compile/data/sequence.d.ts | 13 + build/src/compile/data/sequence.d.ts.map | 1 + build/src/compile/data/sequence.js | 27 + build/src/compile/data/sequence.js.map | 1 + build/src/compile/data/source.d.ts | 21 + build/src/compile/data/source.d.ts.map | 1 + build/src/compile/data/source.js | 83 + build/src/compile/data/source.js.map | 1 + build/src/compile/data/stack.d.ts | 58 + build/src/compile/data/stack.d.ts.map | 1 + build/src/compile/data/stack.js | 187 + build/src/compile/data/stack.js.map | 1 + build/src/compile/data/subtree.d.ts | 7 + build/src/compile/data/subtree.d.ts.map | 1 + build/src/compile/data/subtree.js | 81 + build/src/compile/data/subtree.js.map | 1 + build/src/compile/data/timeunit.d.ts | 38 + build/src/compile/data/timeunit.d.ts.map | 1 + build/src/compile/data/timeunit.js | 196 + build/src/compile/data/timeunit.js.map | 1 + build/src/compile/data/window.d.ts | 19 + build/src/compile/data/window.d.ts.map | 1 + build/src/compile/data/window.js | 88 + build/src/compile/data/window.js.map | 1 + build/src/compile/facet.d.ts | 45 + build/src/compile/facet.d.ts.map | 1 + build/src/compile/facet.js | 367 + build/src/compile/facet.js.map | 1 + build/src/compile/format.d.ts | 67 + build/src/compile/format.d.ts.map | 1 + build/src/compile/format.js | 223 + build/src/compile/format.js.map | 1 + build/src/compile/guide.d.ts | 4 + build/src/compile/guide.d.ts.map | 1 + build/src/compile/guide.js | 13 + build/src/compile/guide.js.map | 1 + build/src/compile/header/assemble.d.ts | 1027 + build/src/compile/header/assemble.d.ts.map | 1 + build/src/compile/header/assemble.js | 205 + build/src/compile/header/assemble.js.map | 1 + build/src/compile/header/common.d.ts | 12 + build/src/compile/header/common.d.ts.map | 1 + build/src/compile/header/common.js | 28 + build/src/compile/header/common.js.map | 1 + build/src/compile/header/component.d.ts | 44 + build/src/compile/header/component.d.ts.map | 1 + build/src/compile/header/component.js | 3 + build/src/compile/header/component.js.map | 1 + build/src/compile/header/parse.d.ts | 5 + build/src/compile/header/parse.d.ts.map | 1 + build/src/compile/header/parse.js | 83 + build/src/compile/header/parse.js.map | 1 + build/src/compile/layer.d.ts | 24 + build/src/compile/layer.d.ts.map | 1 + build/src/compile/layer.js | 116 + build/src/compile/layer.js.map | 1 + build/src/compile/layoutsize/assemble.d.ts | 8 + .../src/compile/layoutsize/assemble.d.ts.map | 1 + build/src/compile/layoutsize/assemble.js | 92 + build/src/compile/layoutsize/assemble.js.map | 1 + build/src/compile/layoutsize/component.d.ts | 12 + .../src/compile/layoutsize/component.d.ts.map | 1 + build/src/compile/layoutsize/component.js | 4 + build/src/compile/layoutsize/component.js.map | 1 + build/src/compile/layoutsize/init.d.ts | 7 + build/src/compile/layoutsize/init.d.ts.map | 1 + build/src/compile/layoutsize/init.js | 17 + build/src/compile/layoutsize/init.js.map | 1 + build/src/compile/layoutsize/parse.d.ts | 8 + build/src/compile/layoutsize/parse.d.ts.map | 1 + build/src/compile/layoutsize/parse.js | 126 + build/src/compile/layoutsize/parse.js.map | 1 + build/src/compile/legend/assemble.d.ts | 81 + build/src/compile/legend/assemble.d.ts.map | 1 + build/src/compile/legend/assemble.js | 72 + build/src/compile/legend/assemble.js.map | 1 + build/src/compile/legend/component.d.ts | 15 + build/src/compile/legend/component.d.ts.map | 1 + build/src/compile/legend/component.js | 23 + build/src/compile/legend/component.js.map | 1 + build/src/compile/legend/encode.d.ts | 22 + build/src/compile/legend/encode.d.ts.map | 1 + build/src/compile/legend/encode.js | 180 + build/src/compile/legend/encode.js.map | 1 + build/src/compile/legend/parse.d.ts | 8 + build/src/compile/legend/parse.d.ts.map | 1 + build/src/compile/legend/parse.js | 219 + build/src/compile/legend/parse.js.map | 1 + build/src/compile/legend/properties.d.ts | 63 + build/src/compile/legend/properties.d.ts.map | 1 + build/src/compile/legend/properties.js | 148 + build/src/compile/legend/properties.js.map | 1 + build/src/compile/mark/arc.d.ts | 3 + build/src/compile/mark/arc.d.ts.map | 1 + build/src/compile/mark/arc.js | 22 + build/src/compile/mark/arc.js.map | 1 + build/src/compile/mark/area.d.ts | 3 + build/src/compile/mark/area.d.ts.map | 1 + build/src/compile/mark/area.js | 28 + build/src/compile/mark/area.js.map | 1 + build/src/compile/mark/bar.d.ts | 3 + build/src/compile/mark/bar.d.ts.map | 1 + build/src/compile/mark/bar.js | 19 + build/src/compile/mark/bar.js.map | 1 + build/src/compile/mark/base.d.ts | 18 + build/src/compile/mark/base.d.ts.map | 1 + build/src/compile/mark/base.js | 2 + build/src/compile/mark/base.js.map | 1 + build/src/compile/mark/encode/aria.d.ts | 386 + build/src/compile/mark/encode/aria.d.ts.map | 1 + build/src/compile/mark/encode/aria.js | 61 + build/src/compile/mark/encode/aria.js.map | 1 + build/src/compile/mark/encode/base.d.ts | 1481 + build/src/compile/mark/encode/base.d.ts.map | 1 + build/src/compile/mark/encode/base.js | 90 + build/src/compile/mark/encode/base.js.map | 1 + build/src/compile/mark/encode/color.d.ts | 6 + build/src/compile/mark/encode/color.d.ts.map | 1 + build/src/compile/mark/encode/color.js | 46 + build/src/compile/mark/encode/color.js.map | 1 + .../src/compile/mark/encode/conditional.d.ts | 10 + .../compile/mark/encode/conditional.d.ts.map | 1 + build/src/compile/mark/encode/conditional.js | 34 + .../compile/mark/encode/conditional.js.map | 1 + build/src/compile/mark/encode/defined.d.ts | 6 + .../src/compile/mark/encode/defined.d.ts.map | 1 + build/src/compile/mark/encode/defined.js | 43 + build/src/compile/mark/encode/defined.js.map | 1 + build/src/compile/mark/encode/index.d.ts | 12 + build/src/compile/mark/encode/index.d.ts.map | 1 + build/src/compile/mark/encode/index.js | 12 + build/src/compile/mark/encode/index.js.map | 1 + .../src/compile/mark/encode/nonposition.d.ts | 14 + .../compile/mark/encode/nonposition.d.ts.map | 1 + build/src/compile/mark/encode/nonposition.js | 32 + .../compile/mark/encode/nonposition.js.map | 1 + build/src/compile/mark/encode/offset.d.ts | 21 + build/src/compile/mark/encode/offset.d.ts.map | 1 + build/src/compile/mark/encode/offset.js | 27 + build/src/compile/mark/encode/offset.js.map | 1 + .../compile/mark/encode/position-align.d.ts | 5 + .../mark/encode/position-align.d.ts.map | 1 + .../src/compile/mark/encode/position-align.js | 36 + .../compile/mark/encode/position-align.js.map | 1 + .../compile/mark/encode/position-point.d.ts | 28 + .../mark/encode/position-point.d.ts.map | 1 + .../src/compile/mark/encode/position-point.js | 139 + .../compile/mark/encode/position-point.js.map | 1 + .../compile/mark/encode/position-range.d.ts | 24 + .../mark/encode/position-range.d.ts.map | 1 + .../src/compile/mark/encode/position-range.js | 137 + .../compile/mark/encode/position-range.js.map | 1 + .../compile/mark/encode/position-rect.d.ts | 4 + .../mark/encode/position-rect.d.ts.map | 1 + .../src/compile/mark/encode/position-rect.js | 310 + .../compile/mark/encode/position-rect.js.map | 1 + build/src/compile/mark/encode/text.d.ts | 9 + build/src/compile/mark/encode/text.d.ts.map | 1 + build/src/compile/mark/encode/text.js | 22 + build/src/compile/mark/encode/text.js.map | 1 + build/src/compile/mark/encode/tooltip.d.ts | 22 + .../src/compile/mark/encode/tooltip.d.ts.map | 1 + build/src/compile/mark/encode/tooltip.js | 118 + build/src/compile/mark/encode/tooltip.js.map | 1 + build/src/compile/mark/encode/valueref.d.ts | 82 + .../src/compile/mark/encode/valueref.d.ts.map | 1 + build/src/compile/mark/encode/valueref.js | 222 + build/src/compile/mark/encode/valueref.js.map | 1 + build/src/compile/mark/encode/zindex.d.ts | 5 + build/src/compile/mark/encode/zindex.d.ts.map | 1 + build/src/compile/mark/encode/zindex.js | 13 + build/src/compile/mark/encode/zindex.js.map | 1 + build/src/compile/mark/geoshape.d.ts | 3 + build/src/compile/mark/geoshape.d.ts.map | 1 + build/src/compile/mark/geoshape.js | 32 + build/src/compile/mark/geoshape.js.map | 1 + build/src/compile/mark/image.d.ts | 3 + build/src/compile/mark/image.d.ts.map | 1 + build/src/compile/mark/image.js | 20 + build/src/compile/mark/image.js.map | 1 + build/src/compile/mark/init.d.ts | 9 + build/src/compile/mark/init.d.ts.map | 1 + build/src/compile/mark/init.js | 181 + build/src/compile/mark/init.js.map | 1 + build/src/compile/mark/line.d.ts | 4 + build/src/compile/mark/line.d.ts.map | 1 + build/src/compile/mark/line.js | 42 + build/src/compile/mark/line.js.map | 1 + build/src/compile/mark/mark.d.ts | 5 + build/src/compile/mark/mark.d.ts.map | 1 + build/src/compile/mark/mark.js | 358 + build/src/compile/mark/mark.js.map | 1 + build/src/compile/mark/point.d.ts | 9 + build/src/compile/mark/point.d.ts.map | 1 + build/src/compile/mark/point.js | 44 + build/src/compile/mark/point.js.map | 1 + build/src/compile/mark/rect.d.ts | 3 + build/src/compile/mark/rect.d.ts.map | 1 + build/src/compile/mark/rect.js | 19 + build/src/compile/mark/rect.js.map | 1 + build/src/compile/mark/rule.d.ts | 3 + build/src/compile/mark/rule.d.ts.map | 1 + build/src/compile/mark/rule.js | 36 + build/src/compile/mark/rule.js.map | 1 + build/src/compile/mark/text.d.ts | 3 + build/src/compile/mark/text.d.ts.map | 1 + build/src/compile/mark/text.js | 46 + build/src/compile/mark/text.js.map | 1 + build/src/compile/mark/tick.d.ts | 3 + build/src/compile/mark/tick.d.ts.map | 1 + build/src/compile/mark/tick.js | 51 + build/src/compile/mark/tick.js.map | 1 + build/src/compile/model.d.ts | 176 + build/src/compile/model.d.ts.map | 1 + build/src/compile/model.js | 465 + build/src/compile/model.js.map | 1 + build/src/compile/predicate.d.ts | 9 + build/src/compile/predicate.d.ts.map | 1 + build/src/compile/predicate.js | 23 + build/src/compile/predicate.js.map | 1 + build/src/compile/projection/assemble.d.ts | 6 + .../src/compile/projection/assemble.d.ts.map | 1 + build/src/compile/projection/assemble.js | 64 + build/src/compile/projection/assemble.js.map | 1 + build/src/compile/projection/component.d.ts | 15 + .../src/compile/projection/component.d.ts.map | 1 + build/src/compile/projection/component.js | 19 + build/src/compile/projection/component.js.map | 1 + build/src/compile/projection/parse.d.ts | 3 + build/src/compile/projection/parse.d.ts.map | 1 + build/src/compile/projection/parse.js | 134 + build/src/compile/projection/parse.js.map | 1 + build/src/compile/resolve.d.ts | 6 + build/src/compile/resolve.d.ts.map | 1 + build/src/compile/resolve.js | 28 + build/src/compile/resolve.js.map | 1 + build/src/compile/scale/assemble.d.ts | 7 + build/src/compile/scale/assemble.d.ts.map | 1 + build/src/compile/scale/assemble.js | 65 + build/src/compile/scale/assemble.js.map | 1 + build/src/compile/scale/component.d.ts | 27 + build/src/compile/scale/component.d.ts.map | 1 + build/src/compile/scale/component.js | 22 + build/src/compile/scale/component.js.map | 1 + build/src/compile/scale/domain.d.ts | 33 + build/src/compile/scale/domain.d.ts.map | 1 + build/src/compile/scale/domain.js | 553 + build/src/compile/scale/domain.js.map | 1 + build/src/compile/scale/parse.d.ts | 6 + build/src/compile/scale/parse.d.ts.map | 1 + build/src/compile/scale/parse.js | 110 + build/src/compile/scale/parse.js.map | 1 + build/src/compile/scale/properties.d.ts | 43 + build/src/compile/scale/properties.d.ts.map | 1 + build/src/compile/scale/properties.js | 313 + build/src/compile/scale/properties.js.map | 1 + build/src/compile/scale/range.d.ts | 24 + build/src/compile/scale/range.d.ts.map | 1 + build/src/compile/scale/range.js | 484 + build/src/compile/scale/range.js.map | 1 + build/src/compile/scale/type.d.ts | 11 + build/src/compile/scale/type.d.ts.map | 1 + build/src/compile/scale/type.js | 107 + build/src/compile/scale/type.js.map | 1 + build/src/compile/selection/assemble.d.ts | 24 + build/src/compile/selection/assemble.d.ts.map | 1 + build/src/compile/selection/assemble.js | 157 + build/src/compile/selection/assemble.js.map | 1 + build/src/compile/selection/clear.d.ts | 4 + build/src/compile/selection/clear.d.ts.map | 1 + build/src/compile/selection/clear.js | 56 + build/src/compile/selection/clear.js.map | 1 + build/src/compile/selection/index.d.ts | 46 + build/src/compile/selection/index.d.ts.map | 1 + build/src/compile/selection/index.js | 74 + build/src/compile/selection/index.js.map | 1 + build/src/compile/selection/inputs.d.ts | 4 + build/src/compile/selection/inputs.d.ts.map | 1 + build/src/compile/selection/inputs.js | 60 + build/src/compile/selection/inputs.js.map | 1 + build/src/compile/selection/interval.d.ts | 12 + build/src/compile/selection/interval.d.ts.map | 1 + build/src/compile/selection/interval.js | 302 + build/src/compile/selection/interval.js.map | 1 + build/src/compile/selection/legends.d.ts | 8 + build/src/compile/selection/legends.d.ts.map | 1 + build/src/compile/selection/legends.js | 118 + build/src/compile/selection/legends.js.map | 1 + build/src/compile/selection/nearest.d.ts | 4 + build/src/compile/selection/nearest.d.ts.map | 1 + build/src/compile/selection/nearest.js | 66 + build/src/compile/selection/nearest.js.map | 1 + build/src/compile/selection/parse.d.ts | 12 + build/src/compile/selection/parse.d.ts.map | 1 + build/src/compile/selection/parse.js | 120 + build/src/compile/selection/parse.js.map | 1 + build/src/compile/selection/point.d.ts | 4 + build/src/compile/selection/point.d.ts.map | 1 + build/src/compile/selection/point.js | 63 + build/src/compile/selection/point.js.map | 1 + build/src/compile/selection/project.d.ts | 31 + build/src/compile/selection/project.d.ts.map | 1 + build/src/compile/selection/project.js | 166 + build/src/compile/selection/project.js.map | 1 + build/src/compile/selection/scales.d.ts | 7 + build/src/compile/selection/scales.d.ts.map | 1 + build/src/compile/selection/scales.js | 81 + build/src/compile/selection/scales.js.map | 1 + build/src/compile/selection/toggle.d.ts | 5 + build/src/compile/selection/toggle.d.ts.map | 1 + build/src/compile/selection/toggle.js | 23 + build/src/compile/selection/toggle.js.map | 1 + build/src/compile/selection/translate.d.ts | 4 + .../src/compile/selection/translate.d.ts.map | 1 + build/src/compile/selection/translate.js | 88 + build/src/compile/selection/translate.js.map | 1 + build/src/compile/selection/zoom.d.ts | 4 + build/src/compile/selection/zoom.d.ts.map | 1 + build/src/compile/selection/zoom.js | 90 + build/src/compile/selection/zoom.js.map | 1 + build/src/compile/signal.d.ts | 12 + build/src/compile/signal.d.ts.map | 1 + build/src/compile/signal.js | 16 + build/src/compile/signal.js.map | 1 + build/src/compile/split.d.ts | 35 + build/src/compile/split.d.ts.map | 1 + build/src/compile/split.js | 123 + build/src/compile/split.js.map | 1 + build/src/compile/unit.d.ts | 65 + build/src/compile/unit.d.ts.map | 1 + build/src/compile/unit.js | 220 + build/src/compile/unit.js.map | 1 + build/src/compositemark/base.d.ts | 15 + build/src/compositemark/base.d.ts.map | 1 + build/src/compositemark/base.js | 15 + build/src/compositemark/base.js.map | 1 + build/src/compositemark/boxplot.d.ts | 48 + build/src/compositemark/boxplot.d.ts.map | 1 + build/src/compositemark/boxplot.js | 299 + build/src/compositemark/boxplot.js.map | 1 + build/src/compositemark/common.d.ts | 54 + build/src/compositemark/common.d.ts.map | 1 + build/src/compositemark/common.js | 189 + build/src/compositemark/common.js.map | 1 + build/src/compositemark/errorband.d.ts | 75 + build/src/compositemark/errorband.d.ts.map | 1 + build/src/compositemark/errorband.js | 69 + build/src/compositemark/errorband.js.map | 1 + build/src/compositemark/errorbar.d.ts | 102 + build/src/compositemark/errorbar.d.ts.map | 1 + build/src/compositemark/errorbar.js | 324 + build/src/compositemark/errorbar.js.map | 1 + build/src/compositemark/index.d.ts | 28 + build/src/compositemark/index.d.ts.map | 1 + build/src/compositemark/index.js | 23 + build/src/compositemark/index.js.map | 1 + build/src/config.d.ts | 262 + build/src/config.d.ts.map | 1 + build/src/config.js | 459 + build/src/config.js.map | 1 + build/src/data.d.ts | 200 + build/src/data.d.ts.map | 1 + build/src/data.js | 30 + build/src/data.js.map | 1 + build/src/datetime.d.ts | 129 + build/src/datetime.d.ts.map | 1 + build/src/datetime.js | 194 + build/src/datetime.js.map | 1 + build/src/encoding.d.ts | 223 + build/src/encoding.d.ts.map | 1 + build/src/encoding.js | 424 + build/src/encoding.js.map | 1 + build/src/expr.d.ts | 11 + build/src/expr.d.ts.map | 1 + build/src/expr.js | 14 + build/src/expr.js.map | 1 + build/src/guide.d.ts | 30 + build/src/guide.d.ts.map | 1 + build/src/guide.js | 8 + build/src/guide.js.map | 1 + build/src/header.d.ts | 193 + build/src/header.d.ts.map | 1 + build/src/header.js | 41 + build/src/header.js.map | 1 + build/src/impute.d.ts | 31 + build/src/impute.d.ts.map | 1 + build/src/impute.js | 2 + build/src/impute.js.map | 1 + build/src/index.d.ts | 7 + build/src/index.d.ts.map | 1 + build/src/index.js | 6 + build/src/index.js.map | 1 + build/src/legend.d.ts | 150 + build/src/legend.d.ts.map | 1 + build/src/legend.js | 86 + build/src/legend.js.map | 1 + build/src/log/index.d.ts | 34 + build/src/log/index.d.ts.map | 1 + build/src/log/index.js | 95 + build/src/log/index.js.map | 1 + build/src/log/message.d.ts | 106 + build/src/log/message.d.ts.map | 1 + build/src/log/message.js | 237 + build/src/log/message.js.map | 1 + build/src/logical.d.ts | 16 + build/src/logical.d.ts.map | 1 + build/src/logical.js | 42 + build/src/logical.js.map | 1 + build/src/mark.d.ts | 476 + build/src/mark.d.ts.map | 1 + build/src/mark.js | 130 + build/src/mark.js.map | 1 + build/src/normalize/base.d.ts | 35 + build/src/normalize/base.d.ts.map | 1 + build/src/normalize/base.js | 2 + build/src/normalize/base.js.map | 1 + build/src/normalize/core.d.ts | 24 + build/src/normalize/core.d.ts.map | 1 + build/src/normalize/core.js | 293 + build/src/normalize/core.js.map | 1 + build/src/normalize/index.d.ts | 14 + build/src/normalize/index.d.ts.map | 1 + build/src/normalize/index.js | 90 + build/src/normalize/index.js.map | 1 + build/src/normalize/pathoverlay.d.ts | 13 + build/src/normalize/pathoverlay.d.ts.map | 1 + build/src/normalize/pathoverlay.js | 162 + build/src/normalize/pathoverlay.js.map | 1 + build/src/normalize/repeater.d.ts | 12 + build/src/normalize/repeater.d.ts.map | 1 + build/src/normalize/repeater.js | 119 + build/src/normalize/repeater.js.map | 1 + build/src/normalize/ruleforrangedline.d.ts | 21 + .../src/normalize/ruleforrangedline.d.ts.map | 1 + build/src/normalize/ruleforrangedline.js | 38 + build/src/normalize/ruleforrangedline.js.map | 1 + build/src/normalize/selectioncompat.d.ts | 10 + build/src/normalize/selectioncompat.d.ts.map | 1 + build/src/normalize/selectioncompat.js | 132 + build/src/normalize/selectioncompat.js.map | 1 + build/src/normalize/toplevelselection.d.ts | 9 + .../src/normalize/toplevelselection.d.ts.map | 1 + build/src/normalize/toplevelselection.js | 66 + build/src/normalize/toplevelselection.js.map | 1 + build/src/parameter.d.ts | 25 + build/src/parameter.d.ts.map | 1 + build/src/parameter.js | 30 + build/src/parameter.js.map | 1 + build/src/predicate.d.ts | 96 + build/src/predicate.d.ts.map | 1 + build/src/predicate.js | 130 + build/src/predicate.js.map | 1 + build/src/projection.d.ts | 25 + build/src/projection.d.ts.map | 1 + build/src/projection.js | 20 + build/src/projection.js.map | 1 + build/src/resolve.d.ts | 14 + build/src/resolve.d.ts.map | 1 + build/src/resolve.js | 2 + build/src/resolve.js.map | 1 + build/src/scale.d.ts | 497 + build/src/scale.d.ts.map | 1 + build/src/scale.js | 344 + build/src/scale.js.map | 1 + build/src/selection.d.ts | 258 + build/src/selection.d.ts.map | 1 + build/src/selection.js | 30 + build/src/selection.js.map | 1 + build/src/sort.d.ts | 82 + build/src/sort.d.ts.map | 1 + build/src/sort.js | 29 + build/src/sort.js.map | 1 + build/src/spec/base.d.ts | 216 + build/src/spec/base.d.ts.map | 1 + build/src/spec/base.js | 63 + build/src/spec/base.js.map | 1 + build/src/spec/concat.d.ts | 53 + build/src/spec/concat.d.ts.map | 1 + build/src/spec/concat.js | 13 + build/src/spec/concat.js.map | 1 + build/src/spec/facet.d.ts | 102 + build/src/spec/facet.d.ts.map | 1 + build/src/spec/facet.js | 10 + build/src/spec/facet.js.map | 1 + build/src/spec/index.d.ts | 44 + build/src/spec/index.d.ts.map | 1 + build/src/spec/index.js | 6 + build/src/spec/index.js.map | 1 + build/src/spec/layer.d.ts | 42 + build/src/spec/layer.d.ts.map | 1 + build/src/spec/layer.js | 4 + build/src/spec/layer.js.map | 1 + build/src/spec/map.d.ts | 19 + build/src/spec/map.d.ts.map | 1 + build/src/spec/map.js | 78 + build/src/spec/map.js.map | 1 + build/src/spec/repeat.d.ts | 51 + build/src/spec/repeat.d.ts.map | 1 + build/src/spec/repeat.js | 8 + build/src/spec/repeat.js.map | 1 + build/src/spec/toplevel.d.ts | 95 + build/src/spec/toplevel.d.ts.map | 1 + build/src/spec/toplevel.js | 26 + build/src/spec/toplevel.js.map | 1 + build/src/spec/unit.d.ts | 49 + build/src/spec/unit.d.ts.map | 1 + build/src/spec/unit.js | 4 + build/src/spec/unit.js.map | 1 + build/src/stack.d.ts | 37 + build/src/stack.d.ts.map | 1 + build/src/stack.js | 186 + build/src/stack.js.map | 1 + build/src/timeunit.d.ts | 238 + build/src/timeunit.d.ts.map | 1 + build/src/timeunit.js | 324 + build/src/timeunit.js.map | 1 + build/src/title.d.ts | 57 + build/src/title.d.ts.map | 1 + build/src/title.js | 42 + build/src/title.js.map | 1 + build/src/transform.d.ts | 522 + build/src/transform.d.ts.map | 1 + build/src/transform.js | 79 + build/src/transform.js.map | 1 + build/src/type.d.ts | 28 + build/src/type.d.ts.map | 1 + build/src/type.js | 55 + build/src/type.js.map | 1 + build/src/util.d.ts | 154 + build/src/util.d.ts.map | 1 + build/src/util.js | 464 + build/src/util.js.map | 1 + build/src/vega.schema.d.ts | 117 + build/src/vega.schema.d.ts.map | 1 + build/src/vega.schema.js | 118 + build/src/vega.schema.js.map | 1 + build/vega-lite.js | 22870 ++++++++++++++++ build/vega-lite.js.map | 1 + build/vega-lite.min.js | 2 + build/vega-lite.min.js.map | 1 + 730 files changed, 56448 insertions(+), 1 deletion(-) create mode 100644 build/package.json create mode 100644 build/src/aggregate.d.ts create mode 100644 build/src/aggregate.d.ts.map create mode 100644 build/src/aggregate.js create mode 100644 build/src/aggregate.js.map create mode 100644 build/src/axis.d.ts create mode 100644 build/src/axis.d.ts.map create mode 100644 build/src/axis.js create mode 100644 build/src/axis.js.map create mode 100644 build/src/bin.d.ts create mode 100644 build/src/bin.d.ts.map create mode 100644 build/src/bin.js create mode 100644 build/src/bin.js.map create mode 100644 build/src/channel.d.ts create mode 100644 build/src/channel.d.ts.map create mode 100644 build/src/channel.js create mode 100644 build/src/channel.js.map create mode 100644 build/src/channeldef.d.ts create mode 100644 build/src/channeldef.d.ts.map create mode 100644 build/src/channeldef.js create mode 100644 build/src/channeldef.js.map create mode 100644 build/src/compile/axis/assemble.d.ts create mode 100644 build/src/compile/axis/assemble.d.ts.map create mode 100644 build/src/compile/axis/assemble.js create mode 100644 build/src/compile/axis/assemble.js.map create mode 100644 build/src/compile/axis/component.d.ts create mode 100644 build/src/compile/axis/component.d.ts.map create mode 100644 build/src/compile/axis/component.js create mode 100644 build/src/compile/axis/component.js.map create mode 100644 build/src/compile/axis/config.d.ts create mode 100644 build/src/compile/axis/config.d.ts.map create mode 100644 build/src/compile/axis/config.js create mode 100644 build/src/compile/axis/config.js.map create mode 100644 build/src/compile/axis/encode.d.ts create mode 100644 build/src/compile/axis/encode.d.ts.map create mode 100644 build/src/compile/axis/encode.js create mode 100644 build/src/compile/axis/encode.js.map create mode 100644 build/src/compile/axis/parse.d.ts create mode 100644 build/src/compile/axis/parse.d.ts.map create mode 100644 build/src/compile/axis/parse.js create mode 100644 build/src/compile/axis/parse.js.map create mode 100644 build/src/compile/axis/properties.d.ts create mode 100644 build/src/compile/axis/properties.d.ts.map create mode 100644 build/src/compile/axis/properties.js create mode 100644 build/src/compile/axis/properties.js.map create mode 100644 build/src/compile/buildmodel.d.ts create mode 100644 build/src/compile/buildmodel.d.ts.map create mode 100644 build/src/compile/buildmodel.js create mode 100644 build/src/compile/buildmodel.js.map create mode 100644 build/src/compile/common.d.ts create mode 100644 build/src/compile/common.d.ts.map create mode 100644 build/src/compile/common.js create mode 100644 build/src/compile/common.js.map create mode 100644 build/src/compile/compile.d.ts create mode 100644 build/src/compile/compile.d.ts.map create mode 100644 build/src/compile/compile.js create mode 100644 build/src/compile/compile.js.map create mode 100644 build/src/compile/concat.d.ts create mode 100644 build/src/compile/concat.d.ts.map create mode 100644 build/src/compile/concat.js create mode 100644 build/src/compile/concat.js.map create mode 100644 build/src/compile/data/aggregate.d.ts create mode 100644 build/src/compile/data/aggregate.d.ts.map create mode 100644 build/src/compile/data/aggregate.js create mode 100644 build/src/compile/data/aggregate.js.map create mode 100644 build/src/compile/data/assemble.d.ts create mode 100644 build/src/compile/data/assemble.d.ts.map create mode 100644 build/src/compile/data/assemble.js create mode 100644 build/src/compile/data/assemble.js.map create mode 100644 build/src/compile/data/bin.d.ts create mode 100644 build/src/compile/data/bin.d.ts.map create mode 100644 build/src/compile/data/bin.js create mode 100644 build/src/compile/data/bin.js.map create mode 100644 build/src/compile/data/calculate.d.ts create mode 100644 build/src/compile/data/calculate.d.ts.map create mode 100644 build/src/compile/data/calculate.js create mode 100644 build/src/compile/data/calculate.js.map create mode 100644 build/src/compile/data/dataflow.d.ts create mode 100644 build/src/compile/data/dataflow.d.ts.map create mode 100644 build/src/compile/data/dataflow.js create mode 100644 build/src/compile/data/dataflow.js.map create mode 100644 build/src/compile/data/density.d.ts create mode 100644 build/src/compile/data/density.d.ts.map create mode 100644 build/src/compile/data/density.js create mode 100644 build/src/compile/data/density.js.map create mode 100644 build/src/compile/data/expressions.d.ts create mode 100644 build/src/compile/data/expressions.d.ts.map create mode 100644 build/src/compile/data/expressions.js create mode 100644 build/src/compile/data/expressions.js.map create mode 100644 build/src/compile/data/extent.d.ts create mode 100644 build/src/compile/data/extent.d.ts.map create mode 100644 build/src/compile/data/extent.js create mode 100644 build/src/compile/data/extent.js.map create mode 100644 build/src/compile/data/facet.d.ts create mode 100644 build/src/compile/data/facet.d.ts.map create mode 100644 build/src/compile/data/facet.js create mode 100644 build/src/compile/data/facet.js.map create mode 100644 build/src/compile/data/filter.d.ts create mode 100644 build/src/compile/data/filter.d.ts.map create mode 100644 build/src/compile/data/filter.js create mode 100644 build/src/compile/data/filter.js.map create mode 100644 build/src/compile/data/filterinvalid.d.ts create mode 100644 build/src/compile/data/filterinvalid.d.ts.map create mode 100644 build/src/compile/data/filterinvalid.js create mode 100644 build/src/compile/data/filterinvalid.js.map create mode 100644 build/src/compile/data/flatten.d.ts create mode 100644 build/src/compile/data/flatten.d.ts.map create mode 100644 build/src/compile/data/flatten.js create mode 100644 build/src/compile/data/flatten.js.map create mode 100644 build/src/compile/data/fold.d.ts create mode 100644 build/src/compile/data/fold.d.ts.map create mode 100644 build/src/compile/data/fold.js create mode 100644 build/src/compile/data/fold.js.map create mode 100644 build/src/compile/data/formatparse.d.ts create mode 100644 build/src/compile/data/formatparse.d.ts.map create mode 100644 build/src/compile/data/formatparse.js create mode 100644 build/src/compile/data/formatparse.js.map create mode 100644 build/src/compile/data/geojson.d.ts create mode 100644 build/src/compile/data/geojson.d.ts.map create mode 100644 build/src/compile/data/geojson.js create mode 100644 build/src/compile/data/geojson.js.map create mode 100644 build/src/compile/data/geopoint.d.ts create mode 100644 build/src/compile/data/geopoint.d.ts.map create mode 100644 build/src/compile/data/geopoint.js create mode 100644 build/src/compile/data/geopoint.js.map create mode 100644 build/src/compile/data/graticule.d.ts create mode 100644 build/src/compile/data/graticule.d.ts.map create mode 100644 build/src/compile/data/graticule.js create mode 100644 build/src/compile/data/graticule.js.map create mode 100644 build/src/compile/data/identifier.d.ts create mode 100644 build/src/compile/data/identifier.d.ts.map create mode 100644 build/src/compile/data/identifier.js create mode 100644 build/src/compile/data/identifier.js.map create mode 100644 build/src/compile/data/impute.d.ts create mode 100644 build/src/compile/data/impute.d.ts.map create mode 100644 build/src/compile/data/impute.js create mode 100644 build/src/compile/data/impute.js.map create mode 100644 build/src/compile/data/index.d.ts create mode 100644 build/src/compile/data/index.d.ts.map create mode 100644 build/src/compile/data/index.js create mode 100644 build/src/compile/data/index.js.map create mode 100644 build/src/compile/data/joinaggregate.d.ts create mode 100644 build/src/compile/data/joinaggregate.d.ts.map create mode 100644 build/src/compile/data/joinaggregate.js create mode 100644 build/src/compile/data/joinaggregate.js.map create mode 100644 build/src/compile/data/joinaggregatefacet.d.ts create mode 100644 build/src/compile/data/joinaggregatefacet.d.ts.map create mode 100644 build/src/compile/data/joinaggregatefacet.js create mode 100644 build/src/compile/data/joinaggregatefacet.js.map create mode 100644 build/src/compile/data/loess.d.ts create mode 100644 build/src/compile/data/loess.d.ts.map create mode 100644 build/src/compile/data/loess.js create mode 100644 build/src/compile/data/loess.js.map create mode 100644 build/src/compile/data/lookup.d.ts create mode 100644 build/src/compile/data/lookup.d.ts.map create mode 100644 build/src/compile/data/lookup.js create mode 100644 build/src/compile/data/lookup.js.map create mode 100644 build/src/compile/data/optimize.d.ts create mode 100644 build/src/compile/data/optimize.d.ts.map create mode 100644 build/src/compile/data/optimize.js create mode 100644 build/src/compile/data/optimize.js.map create mode 100644 build/src/compile/data/optimizer.d.ts create mode 100644 build/src/compile/data/optimizer.d.ts.map create mode 100644 build/src/compile/data/optimizer.js create mode 100644 build/src/compile/data/optimizer.js.map create mode 100644 build/src/compile/data/optimizers.d.ts create mode 100644 build/src/compile/data/optimizers.d.ts.map create mode 100644 build/src/compile/data/optimizers.js create mode 100644 build/src/compile/data/optimizers.js.map create mode 100644 build/src/compile/data/parse.d.ts create mode 100644 build/src/compile/data/parse.d.ts.map create mode 100644 build/src/compile/data/parse.js create mode 100644 build/src/compile/data/parse.js.map create mode 100644 build/src/compile/data/pivot.d.ts create mode 100644 build/src/compile/data/pivot.d.ts.map create mode 100644 build/src/compile/data/pivot.js create mode 100644 build/src/compile/data/pivot.js.map create mode 100644 build/src/compile/data/quantile.d.ts create mode 100644 build/src/compile/data/quantile.d.ts.map create mode 100644 build/src/compile/data/quantile.js create mode 100644 build/src/compile/data/quantile.js.map create mode 100644 build/src/compile/data/regression.d.ts create mode 100644 build/src/compile/data/regression.d.ts.map create mode 100644 build/src/compile/data/regression.js create mode 100644 build/src/compile/data/regression.js.map create mode 100644 build/src/compile/data/sample.d.ts create mode 100644 build/src/compile/data/sample.d.ts.map create mode 100644 build/src/compile/data/sample.js create mode 100644 build/src/compile/data/sample.js.map create mode 100644 build/src/compile/data/sequence.d.ts create mode 100644 build/src/compile/data/sequence.d.ts.map create mode 100644 build/src/compile/data/sequence.js create mode 100644 build/src/compile/data/sequence.js.map create mode 100644 build/src/compile/data/source.d.ts create mode 100644 build/src/compile/data/source.d.ts.map create mode 100644 build/src/compile/data/source.js create mode 100644 build/src/compile/data/source.js.map create mode 100644 build/src/compile/data/stack.d.ts create mode 100644 build/src/compile/data/stack.d.ts.map create mode 100644 build/src/compile/data/stack.js create mode 100644 build/src/compile/data/stack.js.map create mode 100644 build/src/compile/data/subtree.d.ts create mode 100644 build/src/compile/data/subtree.d.ts.map create mode 100644 build/src/compile/data/subtree.js create mode 100644 build/src/compile/data/subtree.js.map create mode 100644 build/src/compile/data/timeunit.d.ts create mode 100644 build/src/compile/data/timeunit.d.ts.map create mode 100644 build/src/compile/data/timeunit.js create mode 100644 build/src/compile/data/timeunit.js.map create mode 100644 build/src/compile/data/window.d.ts create mode 100644 build/src/compile/data/window.d.ts.map create mode 100644 build/src/compile/data/window.js create mode 100644 build/src/compile/data/window.js.map create mode 100644 build/src/compile/facet.d.ts create mode 100644 build/src/compile/facet.d.ts.map create mode 100644 build/src/compile/facet.js create mode 100644 build/src/compile/facet.js.map create mode 100644 build/src/compile/format.d.ts create mode 100644 build/src/compile/format.d.ts.map create mode 100644 build/src/compile/format.js create mode 100644 build/src/compile/format.js.map create mode 100644 build/src/compile/guide.d.ts create mode 100644 build/src/compile/guide.d.ts.map create mode 100644 build/src/compile/guide.js create mode 100644 build/src/compile/guide.js.map create mode 100644 build/src/compile/header/assemble.d.ts create mode 100644 build/src/compile/header/assemble.d.ts.map create mode 100644 build/src/compile/header/assemble.js create mode 100644 build/src/compile/header/assemble.js.map create mode 100644 build/src/compile/header/common.d.ts create mode 100644 build/src/compile/header/common.d.ts.map create mode 100644 build/src/compile/header/common.js create mode 100644 build/src/compile/header/common.js.map create mode 100644 build/src/compile/header/component.d.ts create mode 100644 build/src/compile/header/component.d.ts.map create mode 100644 build/src/compile/header/component.js create mode 100644 build/src/compile/header/component.js.map create mode 100644 build/src/compile/header/parse.d.ts create mode 100644 build/src/compile/header/parse.d.ts.map create mode 100644 build/src/compile/header/parse.js create mode 100644 build/src/compile/header/parse.js.map create mode 100644 build/src/compile/layer.d.ts create mode 100644 build/src/compile/layer.d.ts.map create mode 100644 build/src/compile/layer.js create mode 100644 build/src/compile/layer.js.map create mode 100644 build/src/compile/layoutsize/assemble.d.ts create mode 100644 build/src/compile/layoutsize/assemble.d.ts.map create mode 100644 build/src/compile/layoutsize/assemble.js create mode 100644 build/src/compile/layoutsize/assemble.js.map create mode 100644 build/src/compile/layoutsize/component.d.ts create mode 100644 build/src/compile/layoutsize/component.d.ts.map create mode 100644 build/src/compile/layoutsize/component.js create mode 100644 build/src/compile/layoutsize/component.js.map create mode 100644 build/src/compile/layoutsize/init.d.ts create mode 100644 build/src/compile/layoutsize/init.d.ts.map create mode 100644 build/src/compile/layoutsize/init.js create mode 100644 build/src/compile/layoutsize/init.js.map create mode 100644 build/src/compile/layoutsize/parse.d.ts create mode 100644 build/src/compile/layoutsize/parse.d.ts.map create mode 100644 build/src/compile/layoutsize/parse.js create mode 100644 build/src/compile/layoutsize/parse.js.map create mode 100644 build/src/compile/legend/assemble.d.ts create mode 100644 build/src/compile/legend/assemble.d.ts.map create mode 100644 build/src/compile/legend/assemble.js create mode 100644 build/src/compile/legend/assemble.js.map create mode 100644 build/src/compile/legend/component.d.ts create mode 100644 build/src/compile/legend/component.d.ts.map create mode 100644 build/src/compile/legend/component.js create mode 100644 build/src/compile/legend/component.js.map create mode 100644 build/src/compile/legend/encode.d.ts create mode 100644 build/src/compile/legend/encode.d.ts.map create mode 100644 build/src/compile/legend/encode.js create mode 100644 build/src/compile/legend/encode.js.map create mode 100644 build/src/compile/legend/parse.d.ts create mode 100644 build/src/compile/legend/parse.d.ts.map create mode 100644 build/src/compile/legend/parse.js create mode 100644 build/src/compile/legend/parse.js.map create mode 100644 build/src/compile/legend/properties.d.ts create mode 100644 build/src/compile/legend/properties.d.ts.map create mode 100644 build/src/compile/legend/properties.js create mode 100644 build/src/compile/legend/properties.js.map create mode 100644 build/src/compile/mark/arc.d.ts create mode 100644 build/src/compile/mark/arc.d.ts.map create mode 100644 build/src/compile/mark/arc.js create mode 100644 build/src/compile/mark/arc.js.map create mode 100644 build/src/compile/mark/area.d.ts create mode 100644 build/src/compile/mark/area.d.ts.map create mode 100644 build/src/compile/mark/area.js create mode 100644 build/src/compile/mark/area.js.map create mode 100644 build/src/compile/mark/bar.d.ts create mode 100644 build/src/compile/mark/bar.d.ts.map create mode 100644 build/src/compile/mark/bar.js create mode 100644 build/src/compile/mark/bar.js.map create mode 100644 build/src/compile/mark/base.d.ts create mode 100644 build/src/compile/mark/base.d.ts.map create mode 100644 build/src/compile/mark/base.js create mode 100644 build/src/compile/mark/base.js.map create mode 100644 build/src/compile/mark/encode/aria.d.ts create mode 100644 build/src/compile/mark/encode/aria.d.ts.map create mode 100644 build/src/compile/mark/encode/aria.js create mode 100644 build/src/compile/mark/encode/aria.js.map create mode 100644 build/src/compile/mark/encode/base.d.ts create mode 100644 build/src/compile/mark/encode/base.d.ts.map create mode 100644 build/src/compile/mark/encode/base.js create mode 100644 build/src/compile/mark/encode/base.js.map create mode 100644 build/src/compile/mark/encode/color.d.ts create mode 100644 build/src/compile/mark/encode/color.d.ts.map create mode 100644 build/src/compile/mark/encode/color.js create mode 100644 build/src/compile/mark/encode/color.js.map create mode 100644 build/src/compile/mark/encode/conditional.d.ts create mode 100644 build/src/compile/mark/encode/conditional.d.ts.map create mode 100644 build/src/compile/mark/encode/conditional.js create mode 100644 build/src/compile/mark/encode/conditional.js.map create mode 100644 build/src/compile/mark/encode/defined.d.ts create mode 100644 build/src/compile/mark/encode/defined.d.ts.map create mode 100644 build/src/compile/mark/encode/defined.js create mode 100644 build/src/compile/mark/encode/defined.js.map create mode 100644 build/src/compile/mark/encode/index.d.ts create mode 100644 build/src/compile/mark/encode/index.d.ts.map create mode 100644 build/src/compile/mark/encode/index.js create mode 100644 build/src/compile/mark/encode/index.js.map create mode 100644 build/src/compile/mark/encode/nonposition.d.ts create mode 100644 build/src/compile/mark/encode/nonposition.d.ts.map create mode 100644 build/src/compile/mark/encode/nonposition.js create mode 100644 build/src/compile/mark/encode/nonposition.js.map create mode 100644 build/src/compile/mark/encode/offset.d.ts create mode 100644 build/src/compile/mark/encode/offset.d.ts.map create mode 100644 build/src/compile/mark/encode/offset.js create mode 100644 build/src/compile/mark/encode/offset.js.map create mode 100644 build/src/compile/mark/encode/position-align.d.ts create mode 100644 build/src/compile/mark/encode/position-align.d.ts.map create mode 100644 build/src/compile/mark/encode/position-align.js create mode 100644 build/src/compile/mark/encode/position-align.js.map create mode 100644 build/src/compile/mark/encode/position-point.d.ts create mode 100644 build/src/compile/mark/encode/position-point.d.ts.map create mode 100644 build/src/compile/mark/encode/position-point.js create mode 100644 build/src/compile/mark/encode/position-point.js.map create mode 100644 build/src/compile/mark/encode/position-range.d.ts create mode 100644 build/src/compile/mark/encode/position-range.d.ts.map create mode 100644 build/src/compile/mark/encode/position-range.js create mode 100644 build/src/compile/mark/encode/position-range.js.map create mode 100644 build/src/compile/mark/encode/position-rect.d.ts create mode 100644 build/src/compile/mark/encode/position-rect.d.ts.map create mode 100644 build/src/compile/mark/encode/position-rect.js create mode 100644 build/src/compile/mark/encode/position-rect.js.map create mode 100644 build/src/compile/mark/encode/text.d.ts create mode 100644 build/src/compile/mark/encode/text.d.ts.map create mode 100644 build/src/compile/mark/encode/text.js create mode 100644 build/src/compile/mark/encode/text.js.map create mode 100644 build/src/compile/mark/encode/tooltip.d.ts create mode 100644 build/src/compile/mark/encode/tooltip.d.ts.map create mode 100644 build/src/compile/mark/encode/tooltip.js create mode 100644 build/src/compile/mark/encode/tooltip.js.map create mode 100644 build/src/compile/mark/encode/valueref.d.ts create mode 100644 build/src/compile/mark/encode/valueref.d.ts.map create mode 100644 build/src/compile/mark/encode/valueref.js create mode 100644 build/src/compile/mark/encode/valueref.js.map create mode 100644 build/src/compile/mark/encode/zindex.d.ts create mode 100644 build/src/compile/mark/encode/zindex.d.ts.map create mode 100644 build/src/compile/mark/encode/zindex.js create mode 100644 build/src/compile/mark/encode/zindex.js.map create mode 100644 build/src/compile/mark/geoshape.d.ts create mode 100644 build/src/compile/mark/geoshape.d.ts.map create mode 100644 build/src/compile/mark/geoshape.js create mode 100644 build/src/compile/mark/geoshape.js.map create mode 100644 build/src/compile/mark/image.d.ts create mode 100644 build/src/compile/mark/image.d.ts.map create mode 100644 build/src/compile/mark/image.js create mode 100644 build/src/compile/mark/image.js.map create mode 100644 build/src/compile/mark/init.d.ts create mode 100644 build/src/compile/mark/init.d.ts.map create mode 100644 build/src/compile/mark/init.js create mode 100644 build/src/compile/mark/init.js.map create mode 100644 build/src/compile/mark/line.d.ts create mode 100644 build/src/compile/mark/line.d.ts.map create mode 100644 build/src/compile/mark/line.js create mode 100644 build/src/compile/mark/line.js.map create mode 100644 build/src/compile/mark/mark.d.ts create mode 100644 build/src/compile/mark/mark.d.ts.map create mode 100644 build/src/compile/mark/mark.js create mode 100644 build/src/compile/mark/mark.js.map create mode 100644 build/src/compile/mark/point.d.ts create mode 100644 build/src/compile/mark/point.d.ts.map create mode 100644 build/src/compile/mark/point.js create mode 100644 build/src/compile/mark/point.js.map create mode 100644 build/src/compile/mark/rect.d.ts create mode 100644 build/src/compile/mark/rect.d.ts.map create mode 100644 build/src/compile/mark/rect.js create mode 100644 build/src/compile/mark/rect.js.map create mode 100644 build/src/compile/mark/rule.d.ts create mode 100644 build/src/compile/mark/rule.d.ts.map create mode 100644 build/src/compile/mark/rule.js create mode 100644 build/src/compile/mark/rule.js.map create mode 100644 build/src/compile/mark/text.d.ts create mode 100644 build/src/compile/mark/text.d.ts.map create mode 100644 build/src/compile/mark/text.js create mode 100644 build/src/compile/mark/text.js.map create mode 100644 build/src/compile/mark/tick.d.ts create mode 100644 build/src/compile/mark/tick.d.ts.map create mode 100644 build/src/compile/mark/tick.js create mode 100644 build/src/compile/mark/tick.js.map create mode 100644 build/src/compile/model.d.ts create mode 100644 build/src/compile/model.d.ts.map create mode 100644 build/src/compile/model.js create mode 100644 build/src/compile/model.js.map create mode 100644 build/src/compile/predicate.d.ts create mode 100644 build/src/compile/predicate.d.ts.map create mode 100644 build/src/compile/predicate.js create mode 100644 build/src/compile/predicate.js.map create mode 100644 build/src/compile/projection/assemble.d.ts create mode 100644 build/src/compile/projection/assemble.d.ts.map create mode 100644 build/src/compile/projection/assemble.js create mode 100644 build/src/compile/projection/assemble.js.map create mode 100644 build/src/compile/projection/component.d.ts create mode 100644 build/src/compile/projection/component.d.ts.map create mode 100644 build/src/compile/projection/component.js create mode 100644 build/src/compile/projection/component.js.map create mode 100644 build/src/compile/projection/parse.d.ts create mode 100644 build/src/compile/projection/parse.d.ts.map create mode 100644 build/src/compile/projection/parse.js create mode 100644 build/src/compile/projection/parse.js.map create mode 100644 build/src/compile/resolve.d.ts create mode 100644 build/src/compile/resolve.d.ts.map create mode 100644 build/src/compile/resolve.js create mode 100644 build/src/compile/resolve.js.map create mode 100644 build/src/compile/scale/assemble.d.ts create mode 100644 build/src/compile/scale/assemble.d.ts.map create mode 100644 build/src/compile/scale/assemble.js create mode 100644 build/src/compile/scale/assemble.js.map create mode 100644 build/src/compile/scale/component.d.ts create mode 100644 build/src/compile/scale/component.d.ts.map create mode 100644 build/src/compile/scale/component.js create mode 100644 build/src/compile/scale/component.js.map create mode 100644 build/src/compile/scale/domain.d.ts create mode 100644 build/src/compile/scale/domain.d.ts.map create mode 100644 build/src/compile/scale/domain.js create mode 100644 build/src/compile/scale/domain.js.map create mode 100644 build/src/compile/scale/parse.d.ts create mode 100644 build/src/compile/scale/parse.d.ts.map create mode 100644 build/src/compile/scale/parse.js create mode 100644 build/src/compile/scale/parse.js.map create mode 100644 build/src/compile/scale/properties.d.ts create mode 100644 build/src/compile/scale/properties.d.ts.map create mode 100644 build/src/compile/scale/properties.js create mode 100644 build/src/compile/scale/properties.js.map create mode 100644 build/src/compile/scale/range.d.ts create mode 100644 build/src/compile/scale/range.d.ts.map create mode 100644 build/src/compile/scale/range.js create mode 100644 build/src/compile/scale/range.js.map create mode 100644 build/src/compile/scale/type.d.ts create mode 100644 build/src/compile/scale/type.d.ts.map create mode 100644 build/src/compile/scale/type.js create mode 100644 build/src/compile/scale/type.js.map create mode 100644 build/src/compile/selection/assemble.d.ts create mode 100644 build/src/compile/selection/assemble.d.ts.map create mode 100644 build/src/compile/selection/assemble.js create mode 100644 build/src/compile/selection/assemble.js.map create mode 100644 build/src/compile/selection/clear.d.ts create mode 100644 build/src/compile/selection/clear.d.ts.map create mode 100644 build/src/compile/selection/clear.js create mode 100644 build/src/compile/selection/clear.js.map create mode 100644 build/src/compile/selection/index.d.ts create mode 100644 build/src/compile/selection/index.d.ts.map create mode 100644 build/src/compile/selection/index.js create mode 100644 build/src/compile/selection/index.js.map create mode 100644 build/src/compile/selection/inputs.d.ts create mode 100644 build/src/compile/selection/inputs.d.ts.map create mode 100644 build/src/compile/selection/inputs.js create mode 100644 build/src/compile/selection/inputs.js.map create mode 100644 build/src/compile/selection/interval.d.ts create mode 100644 build/src/compile/selection/interval.d.ts.map create mode 100644 build/src/compile/selection/interval.js create mode 100644 build/src/compile/selection/interval.js.map create mode 100644 build/src/compile/selection/legends.d.ts create mode 100644 build/src/compile/selection/legends.d.ts.map create mode 100644 build/src/compile/selection/legends.js create mode 100644 build/src/compile/selection/legends.js.map create mode 100644 build/src/compile/selection/nearest.d.ts create mode 100644 build/src/compile/selection/nearest.d.ts.map create mode 100644 build/src/compile/selection/nearest.js create mode 100644 build/src/compile/selection/nearest.js.map create mode 100644 build/src/compile/selection/parse.d.ts create mode 100644 build/src/compile/selection/parse.d.ts.map create mode 100644 build/src/compile/selection/parse.js create mode 100644 build/src/compile/selection/parse.js.map create mode 100644 build/src/compile/selection/point.d.ts create mode 100644 build/src/compile/selection/point.d.ts.map create mode 100644 build/src/compile/selection/point.js create mode 100644 build/src/compile/selection/point.js.map create mode 100644 build/src/compile/selection/project.d.ts create mode 100644 build/src/compile/selection/project.d.ts.map create mode 100644 build/src/compile/selection/project.js create mode 100644 build/src/compile/selection/project.js.map create mode 100644 build/src/compile/selection/scales.d.ts create mode 100644 build/src/compile/selection/scales.d.ts.map create mode 100644 build/src/compile/selection/scales.js create mode 100644 build/src/compile/selection/scales.js.map create mode 100644 build/src/compile/selection/toggle.d.ts create mode 100644 build/src/compile/selection/toggle.d.ts.map create mode 100644 build/src/compile/selection/toggle.js create mode 100644 build/src/compile/selection/toggle.js.map create mode 100644 build/src/compile/selection/translate.d.ts create mode 100644 build/src/compile/selection/translate.d.ts.map create mode 100644 build/src/compile/selection/translate.js create mode 100644 build/src/compile/selection/translate.js.map create mode 100644 build/src/compile/selection/zoom.d.ts create mode 100644 build/src/compile/selection/zoom.d.ts.map create mode 100644 build/src/compile/selection/zoom.js create mode 100644 build/src/compile/selection/zoom.js.map create mode 100644 build/src/compile/signal.d.ts create mode 100644 build/src/compile/signal.d.ts.map create mode 100644 build/src/compile/signal.js create mode 100644 build/src/compile/signal.js.map create mode 100644 build/src/compile/split.d.ts create mode 100644 build/src/compile/split.d.ts.map create mode 100644 build/src/compile/split.js create mode 100644 build/src/compile/split.js.map create mode 100644 build/src/compile/unit.d.ts create mode 100644 build/src/compile/unit.d.ts.map create mode 100644 build/src/compile/unit.js create mode 100644 build/src/compile/unit.js.map create mode 100644 build/src/compositemark/base.d.ts create mode 100644 build/src/compositemark/base.d.ts.map create mode 100644 build/src/compositemark/base.js create mode 100644 build/src/compositemark/base.js.map create mode 100644 build/src/compositemark/boxplot.d.ts create mode 100644 build/src/compositemark/boxplot.d.ts.map create mode 100644 build/src/compositemark/boxplot.js create mode 100644 build/src/compositemark/boxplot.js.map create mode 100644 build/src/compositemark/common.d.ts create mode 100644 build/src/compositemark/common.d.ts.map create mode 100644 build/src/compositemark/common.js create mode 100644 build/src/compositemark/common.js.map create mode 100644 build/src/compositemark/errorband.d.ts create mode 100644 build/src/compositemark/errorband.d.ts.map create mode 100644 build/src/compositemark/errorband.js create mode 100644 build/src/compositemark/errorband.js.map create mode 100644 build/src/compositemark/errorbar.d.ts create mode 100644 build/src/compositemark/errorbar.d.ts.map create mode 100644 build/src/compositemark/errorbar.js create mode 100644 build/src/compositemark/errorbar.js.map create mode 100644 build/src/compositemark/index.d.ts create mode 100644 build/src/compositemark/index.d.ts.map create mode 100644 build/src/compositemark/index.js create mode 100644 build/src/compositemark/index.js.map create mode 100644 build/src/config.d.ts create mode 100644 build/src/config.d.ts.map create mode 100644 build/src/config.js create mode 100644 build/src/config.js.map create mode 100644 build/src/data.d.ts create mode 100644 build/src/data.d.ts.map create mode 100644 build/src/data.js create mode 100644 build/src/data.js.map create mode 100644 build/src/datetime.d.ts create mode 100644 build/src/datetime.d.ts.map create mode 100644 build/src/datetime.js create mode 100644 build/src/datetime.js.map create mode 100644 build/src/encoding.d.ts create mode 100644 build/src/encoding.d.ts.map create mode 100644 build/src/encoding.js create mode 100644 build/src/encoding.js.map create mode 100644 build/src/expr.d.ts create mode 100644 build/src/expr.d.ts.map create mode 100644 build/src/expr.js create mode 100644 build/src/expr.js.map create mode 100644 build/src/guide.d.ts create mode 100644 build/src/guide.d.ts.map create mode 100644 build/src/guide.js create mode 100644 build/src/guide.js.map create mode 100644 build/src/header.d.ts create mode 100644 build/src/header.d.ts.map create mode 100644 build/src/header.js create mode 100644 build/src/header.js.map create mode 100644 build/src/impute.d.ts create mode 100644 build/src/impute.d.ts.map create mode 100644 build/src/impute.js create mode 100644 build/src/impute.js.map create mode 100644 build/src/index.d.ts create mode 100644 build/src/index.d.ts.map create mode 100644 build/src/index.js create mode 100644 build/src/index.js.map create mode 100644 build/src/legend.d.ts create mode 100644 build/src/legend.d.ts.map create mode 100644 build/src/legend.js create mode 100644 build/src/legend.js.map create mode 100644 build/src/log/index.d.ts create mode 100644 build/src/log/index.d.ts.map create mode 100644 build/src/log/index.js create mode 100644 build/src/log/index.js.map create mode 100644 build/src/log/message.d.ts create mode 100644 build/src/log/message.d.ts.map create mode 100644 build/src/log/message.js create mode 100644 build/src/log/message.js.map create mode 100644 build/src/logical.d.ts create mode 100644 build/src/logical.d.ts.map create mode 100644 build/src/logical.js create mode 100644 build/src/logical.js.map create mode 100644 build/src/mark.d.ts create mode 100644 build/src/mark.d.ts.map create mode 100644 build/src/mark.js create mode 100644 build/src/mark.js.map create mode 100644 build/src/normalize/base.d.ts create mode 100644 build/src/normalize/base.d.ts.map create mode 100644 build/src/normalize/base.js create mode 100644 build/src/normalize/base.js.map create mode 100644 build/src/normalize/core.d.ts create mode 100644 build/src/normalize/core.d.ts.map create mode 100644 build/src/normalize/core.js create mode 100644 build/src/normalize/core.js.map create mode 100644 build/src/normalize/index.d.ts create mode 100644 build/src/normalize/index.d.ts.map create mode 100644 build/src/normalize/index.js create mode 100644 build/src/normalize/index.js.map create mode 100644 build/src/normalize/pathoverlay.d.ts create mode 100644 build/src/normalize/pathoverlay.d.ts.map create mode 100644 build/src/normalize/pathoverlay.js create mode 100644 build/src/normalize/pathoverlay.js.map create mode 100644 build/src/normalize/repeater.d.ts create mode 100644 build/src/normalize/repeater.d.ts.map create mode 100644 build/src/normalize/repeater.js create mode 100644 build/src/normalize/repeater.js.map create mode 100644 build/src/normalize/ruleforrangedline.d.ts create mode 100644 build/src/normalize/ruleforrangedline.d.ts.map create mode 100644 build/src/normalize/ruleforrangedline.js create mode 100644 build/src/normalize/ruleforrangedline.js.map create mode 100644 build/src/normalize/selectioncompat.d.ts create mode 100644 build/src/normalize/selectioncompat.d.ts.map create mode 100644 build/src/normalize/selectioncompat.js create mode 100644 build/src/normalize/selectioncompat.js.map create mode 100644 build/src/normalize/toplevelselection.d.ts create mode 100644 build/src/normalize/toplevelselection.d.ts.map create mode 100644 build/src/normalize/toplevelselection.js create mode 100644 build/src/normalize/toplevelselection.js.map create mode 100644 build/src/parameter.d.ts create mode 100644 build/src/parameter.d.ts.map create mode 100644 build/src/parameter.js create mode 100644 build/src/parameter.js.map create mode 100644 build/src/predicate.d.ts create mode 100644 build/src/predicate.d.ts.map create mode 100644 build/src/predicate.js create mode 100644 build/src/predicate.js.map create mode 100644 build/src/projection.d.ts create mode 100644 build/src/projection.d.ts.map create mode 100644 build/src/projection.js create mode 100644 build/src/projection.js.map create mode 100644 build/src/resolve.d.ts create mode 100644 build/src/resolve.d.ts.map create mode 100644 build/src/resolve.js create mode 100644 build/src/resolve.js.map create mode 100644 build/src/scale.d.ts create mode 100644 build/src/scale.d.ts.map create mode 100644 build/src/scale.js create mode 100644 build/src/scale.js.map create mode 100644 build/src/selection.d.ts create mode 100644 build/src/selection.d.ts.map create mode 100644 build/src/selection.js create mode 100644 build/src/selection.js.map create mode 100644 build/src/sort.d.ts create mode 100644 build/src/sort.d.ts.map create mode 100644 build/src/sort.js create mode 100644 build/src/sort.js.map create mode 100644 build/src/spec/base.d.ts create mode 100644 build/src/spec/base.d.ts.map create mode 100644 build/src/spec/base.js create mode 100644 build/src/spec/base.js.map create mode 100644 build/src/spec/concat.d.ts create mode 100644 build/src/spec/concat.d.ts.map create mode 100644 build/src/spec/concat.js create mode 100644 build/src/spec/concat.js.map create mode 100644 build/src/spec/facet.d.ts create mode 100644 build/src/spec/facet.d.ts.map create mode 100644 build/src/spec/facet.js create mode 100644 build/src/spec/facet.js.map create mode 100644 build/src/spec/index.d.ts create mode 100644 build/src/spec/index.d.ts.map create mode 100644 build/src/spec/index.js create mode 100644 build/src/spec/index.js.map create mode 100644 build/src/spec/layer.d.ts create mode 100644 build/src/spec/layer.d.ts.map create mode 100644 build/src/spec/layer.js create mode 100644 build/src/spec/layer.js.map create mode 100644 build/src/spec/map.d.ts create mode 100644 build/src/spec/map.d.ts.map create mode 100644 build/src/spec/map.js create mode 100644 build/src/spec/map.js.map create mode 100644 build/src/spec/repeat.d.ts create mode 100644 build/src/spec/repeat.d.ts.map create mode 100644 build/src/spec/repeat.js create mode 100644 build/src/spec/repeat.js.map create mode 100644 build/src/spec/toplevel.d.ts create mode 100644 build/src/spec/toplevel.d.ts.map create mode 100644 build/src/spec/toplevel.js create mode 100644 build/src/spec/toplevel.js.map create mode 100644 build/src/spec/unit.d.ts create mode 100644 build/src/spec/unit.d.ts.map create mode 100644 build/src/spec/unit.js create mode 100644 build/src/spec/unit.js.map create mode 100644 build/src/stack.d.ts create mode 100644 build/src/stack.d.ts.map create mode 100644 build/src/stack.js create mode 100644 build/src/stack.js.map create mode 100644 build/src/timeunit.d.ts create mode 100644 build/src/timeunit.d.ts.map create mode 100644 build/src/timeunit.js create mode 100644 build/src/timeunit.js.map create mode 100644 build/src/title.d.ts create mode 100644 build/src/title.d.ts.map create mode 100644 build/src/title.js create mode 100644 build/src/title.js.map create mode 100644 build/src/transform.d.ts create mode 100644 build/src/transform.d.ts.map create mode 100644 build/src/transform.js create mode 100644 build/src/transform.js.map create mode 100644 build/src/type.d.ts create mode 100644 build/src/type.d.ts.map create mode 100644 build/src/type.js create mode 100644 build/src/type.js.map create mode 100644 build/src/util.d.ts create mode 100644 build/src/util.d.ts.map create mode 100644 build/src/util.js create mode 100644 build/src/util.js.map create mode 100644 build/src/vega.schema.d.ts create mode 100644 build/src/vega.schema.d.ts.map create mode 100644 build/src/vega.schema.js create mode 100644 build/src/vega.schema.js.map create mode 100644 build/vega-lite.js create mode 100644 build/vega-lite.js.map create mode 100644 build/vega-lite.min.js create mode 100644 build/vega-lite.min.js.map diff --git a/.gitignore b/.gitignore index 334ae706cc..ceadc4fc80 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,6 @@ _site/ .DS_Store .jekyll-metadata .yarnclean -build/* coverage examples/all-examples.json node_modules diff --git a/build/package.json b/build/package.json new file mode 100644 index 0000000000..e3b16b7b1c --- /dev/null +++ b/build/package.json @@ -0,0 +1,147 @@ +{ + "name": "vega-lite", + "author": "Dominik Moritz, Kanit \"Ham\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer", + "version": "5.16.1", + "collaborators": [ + "Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)", + "Dominik Moritz (https://www.domoritz.de)", + "Arvind Satyanarayan (https://arvindsatya.com)", + "Jeffrey Heer (https://jheer.org)" + ], + "homepage": "https://vega.github.io/vega-lite/", + "description": "Vega-Lite is a concise high-level language for interactive visualization.", + "keywords": [ + "vega", + "chart", + "visualization" + ], + "main": "build/vega-lite.js", + "unpkg": "build/vega-lite.min.js", + "jsdelivr": "build/vega-lite.min.js", + "module": "build/src/index", + "types": "build/src/index.d.ts", + "bin": { + "vl2pdf": "./bin/vl2pdf", + "vl2png": "./bin/vl2png", + "vl2svg": "./bin/vl2svg", + "vl2vg": "./bin/vl2vg" + }, + "files": [ + "bin", + "build", + "src", + "vega-lite*", + "tsconfig.json" + ], + "scripts": { + "changelog": "conventional-changelog -p angular -r 2", + "prebuild": "yarn clean:build", + "build": "yarn build:only", + "build:only": "tsc -p tsconfig.build.json && rollup -c", + "prebuild:examples": "yarn build:only", + "build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh", + "prebuild:examples-full": "yarn build:only", + "build:examples-full": "TZ=America/Los_Angeles scripts/build-examples.sh 1", + "build:example": "TZ=America/Los_Angeles scripts/build-example.sh", + "build:toc": "yarn build:jekyll && scripts/generate-toc", + "build:site": "rollup -c site/rollup.config.mjs", + "build:jekyll": "pushd site && bundle exec jekyll build -q && popd", + "build:versions": "scripts/update-version.sh", + "clean": "yarn clean:build && del-cli 'site/data/*' 'examples/compiled/*.png' && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete", + "clean:build": "del-cli 'build/*' !build/vega-lite-schema.json", + "data": "rsync -r node_modules/vega-datasets/data/* site/data", + "schema": "mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/", + "renameschema": "scripts/rename-schema.sh", + "presite": "yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh", + "site": "yarn site:only", + "site:only": "pushd site && bundle exec jekyll serve -I -l && popd", + "prettierbase": "prettier '**/*.{md,css,yml}'", + "format": "eslint . --fix && yarn prettierbase --write", + "lint": "eslint . && yarn prettierbase --check", + "jest": "NODE_OPTIONS=--experimental-vm-modules npx jest", + "test": "yarn jest test/ && yarn lint && yarn schema && yarn jest examples/ && yarn test:runtime", + "test:cover": "yarn jest --collectCoverage test/", + "test:inspect": "node --inspect-brk --experimental-vm-modules ./node_modules/.bin/jest --runInBand test", + "test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest test-runtime/ --config test-runtime/jest-config.json", + "test:runtime:generate": "yarn build:only && del-cli test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime", + "watch": "tsc -p tsconfig.build.json -w", + "watch:site": "yarn build:site -w", + "watch:test": "yarn jest --watch test/", + "watch:test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest --watch test-runtime/ --config test-runtime/jest-config.json", + "release": "release-it" + }, + "repository": { + "type": "git", + "url": "https://github.com/vega/vega-lite.git" + }, + "license": "BSD-3-Clause", + "bugs": { + "url": "https://github.com/vega/vega-lite/issues" + }, + "devDependencies": { + "@babel/core": "^7.22.10", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/preset-env": "^7.22.10", + "@babel/preset-typescript": "^7.22.5", + "@release-it/conventional-changelog": "^7.0.0", + "@rollup/plugin-alias": "^5.0.0", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^25.0.4", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.2.1", + "@rollup/plugin-terser": "^0.4.3", + "@types/chai": "^4.3.5", + "@types/d3": "^7.4.0", + "@types/jest": "^29.5.4", + "@types/pako": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.1", + "ajv": "^8.12.0", + "ajv-formats": "^2.1.1", + "chai": "^4.3.7", + "cheerio": "^1.0.0-rc.12", + "conventional-changelog-cli": "^4.0.0", + "d3": "^7.8.5", + "del-cli": "^5.0.0", + "eslint": "^8.47.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-jest": "^27.2.3", + "eslint-plugin-prettier": "^5.0.0", + "fast-json-stable-stringify": "~2.1.0", + "highlight.js": "^11.8.0", + "jest": "^29.6.3", + "jest-dev-server": "^9.0.0", + "mkdirp": "^3.0.1", + "pako": "^2.1.0", + "prettier": "^3.0.2", + "puppeteer": "^15.0.0", + "release-it": "^16.1.5", + "rollup": "^3.28.1", + "rollup-plugin-bundle-size": "^1.0.3", + "rollup-plugin-sourcemaps": "^0.6.3", + "serve": "^14.2.1", + "terser": "^5.19.2", + "ts-jest": "^29.1.1", + "ts-json-schema-generator": "^1.3.0", + "typescript": "~5.2.2", + "vega-cli": "^5.25.0", + "vega-datasets": "^2.7.0", + "vega-embed": "^6.22.2", + "vega-tooltip": "^0.33.0", + "yaml-front-matter": "^4.1.1" + }, + "dependencies": { + "json-stringify-pretty-compact": "~3.0.0", + "tslib": "~2.6.2", + "vega-event-selector": "~3.0.1", + "vega-expression": "~5.1.0", + "vega-util": "~1.17.2", + "yargs": "~17.7.2" + }, + "peerDependencies": { + "vega": "^5.24.0" + }, + "engines": { + "node": ">=18" + } +} diff --git a/build/src/aggregate.d.ts b/build/src/aggregate.d.ts new file mode 100644 index 0000000000..918306deca --- /dev/null +++ b/build/src/aggregate.d.ts @@ -0,0 +1,28 @@ +import { AggregateOp } from 'vega'; +import { FieldName } from './channeldef'; +export declare const MULTIDOMAIN_SORT_OP_INDEX: { + count: number; + min: number; + max: number; +}; +export interface ArgminDef { + argmin: FieldName; +} +export interface ArgmaxDef { + argmax: FieldName; +} +export type NonArgAggregateOp = Exclude; +export type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef; +export declare function isArgminDef(a: Aggregate | string): a is ArgminDef; +export declare function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef; +export declare function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp; +export declare const COUNTING_OPS: ReadonlySet; +export declare function isCountingAggregateOp(aggregate?: string | Aggregate): boolean; +export declare function isMinMaxOp(aggregate?: Aggregate | string): boolean; +/** Additive-based aggregation operations. These can be applied to stack. */ +export declare const SUM_OPS: ReadonlySet; +/** + * Aggregation operators that always produce values within the range [domainMin, domainMax]. + */ +export declare const SHARED_DOMAIN_OPS: ReadonlySet; +//# sourceMappingURL=aggregate.d.ts.map \ No newline at end of file diff --git a/build/src/aggregate.d.ts.map b/build/src/aggregate.d.ts.map new file mode 100644 index 0000000000..5d12e714c8 --- /dev/null +++ b/build/src/aggregate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../src/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AAEjC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AA6BvC,eAAO,MAAM,yBAAyB;;;;CAIrC,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,MAAM,iBAAiB,GAAG,OAAO,CAAC,WAAW,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC;AAE1E,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,SAAS,GAAG,SAAS,CAAC;AAElE,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,SAAS,CAEjE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,CAAC,IAAI,SAAS,CAEjE;AAED,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,CAAC,IAAI,WAAW,CAEjF;AAED,eAAO,MAAM,YAAY,gCAKW,CAAC;AAErC,wBAAgB,qBAAqB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAE7E;AAED,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,GAAG,MAAM,GAAG,OAAO,CAElE;AAED,4EAA4E;AAC5E,eAAO,MAAM,OAAO,gCAMgB,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,iBAAiB,0BAQA,CAAC"} \ No newline at end of file diff --git a/build/src/aggregate.js b/build/src/aggregate.js new file mode 100644 index 0000000000..3202591f93 --- /dev/null +++ b/build/src/aggregate.js @@ -0,0 +1,74 @@ +import { isString } from 'vega-util'; +import { contains } from './util'; +const AGGREGATE_OP_INDEX = { + argmax: 1, + argmin: 1, + average: 1, + count: 1, + distinct: 1, + product: 1, + max: 1, + mean: 1, + median: 1, + min: 1, + missing: 1, + q1: 1, + q3: 1, + ci0: 1, + ci1: 1, + stderr: 1, + stdev: 1, + stdevp: 1, + sum: 1, + valid: 1, + values: 1, + variance: 1, + variancep: 1 +}; +export const MULTIDOMAIN_SORT_OP_INDEX = { + count: 1, + min: 1, + max: 1 +}; +export function isArgminDef(a) { + return !!a && !!a['argmin']; +} +export function isArgmaxDef(a) { + return !!a && !!a['argmax']; +} +export function isAggregateOp(a) { + return isString(a) && !!AGGREGATE_OP_INDEX[a]; +} +export const COUNTING_OPS = new Set([ + 'count', + 'valid', + 'missing', + 'distinct' +]); +export function isCountingAggregateOp(aggregate) { + return isString(aggregate) && COUNTING_OPS.has(aggregate); +} +export function isMinMaxOp(aggregate) { + return isString(aggregate) && contains(['min', 'max'], aggregate); +} +/** Additive-based aggregation operations. These can be applied to stack. */ +export const SUM_OPS = new Set([ + 'count', + 'sum', + 'distinct', + 'valid', + 'missing' +]); +/** + * Aggregation operators that always produce values within the range [domainMin, domainMax]. + */ +export const SHARED_DOMAIN_OPS = new Set([ + 'mean', + 'average', + 'median', + 'q1', + 'q3', + 'min', + 'max' +]); +//# sourceMappingURL=aggregate.js.map \ No newline at end of file diff --git a/build/src/aggregate.js.map b/build/src/aggregate.js.map new file mode 100644 index 0000000000..e51805d0d0 --- /dev/null +++ b/build/src/aggregate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../src/aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAC,QAAQ,EAAO,MAAM,QAAQ,CAAC;AAEtC,MAAM,kBAAkB,GAAsB;IAC5C,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,QAAQ,EAAE,CAAC;IACX,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,OAAO,EAAE,CAAC;IACV,EAAE,EAAE,CAAC;IACL,EAAE,EAAE,CAAC;IACL,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,yBAAyB,GAAG;IACvC,KAAK,EAAE,CAAC;IACR,GAAG,EAAE,CAAC;IACN,GAAG,EAAE,CAAC;CACP,CAAC;AAcF,MAAM,UAAU,WAAW,CAAC,CAAqB;IAC/C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,CAAqB;IAC/C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,CAAiC;IAC7D,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,kBAAkB,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,GAAG,CAAoB;IACrD,OAAO;IACP,OAAO;IACP,SAAS;IACT,UAAU;CACX,CAAmC,CAAC;AAErC,MAAM,UAAU,qBAAqB,CAAC,SAA8B;IAClE,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,YAAY,CAAC,GAAG,CAAC,SAAgB,CAAC,CAAC;AACnE,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,SAA8B;IACvD,OAAO,QAAQ,CAAC,SAAS,CAAC,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,KAAK,CAAC,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,GAAG,CAAoB;IAChD,OAAO;IACP,KAAK;IACL,UAAU;IACV,OAAO;IACP,SAAS;CACV,CAAmC,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAc;IACpD,MAAM;IACN,SAAS;IACT,QAAQ;IACR,IAAI;IACJ,IAAI;IACJ,KAAK;IACL,KAAK;CACN,CAA6B,CAAC"} \ No newline at end of file diff --git a/build/src/axis.d.ts b/build/src/axis.d.ts new file mode 100644 index 0000000000..7c13c3bced --- /dev/null +++ b/build/src/axis.d.ts @@ -0,0 +1,304 @@ +import { Align, Axis as VgAxis, AxisEncode, AxisOrient, BaseAxis, Color, FontStyle, FontWeight, LabelOverlap, SignalRef, TextBaseline, TimeInterval, TimeIntervalStep } from 'vega'; +import { ConditionalPredicate, Value, ValueDef } from './channeldef'; +import { DateTime } from './datetime'; +import { ExprRef } from './expr'; +import { Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig } from './guide'; +import { Flag } from './util'; +import { MapExcludeValueRefAndReplaceSignalWith, VgEncodeChannel } from './vega.schema'; +export type BaseAxisNoValueRefs = AxisOverrideMixins & VLOnlyAxisMixins & Omit, 'labelOverlap'>; +interface AxisOverrideMixins { + /** + * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate. + * + * __Default value__: `0` + */ + position?: number | ES; + /** + * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. + */ + tickMinStep?: number | ES; + /** + * A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis. + * + * __Default value:__ `true` + */ + domain?: boolean; + /** + * A boolean flag indicating if grid lines should be included as part of the axis + * + * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`. + */ + grid?: boolean; + /** + * A boolean flag indicating if labels should be included as part of the axis. + * + * __Default value:__ `true`. + */ + labels?: boolean; + /** + * Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `"bandPosition": 1` and an axis `"padding"` value of `0`. + */ + tickExtra?: boolean; + /** + * Boolean flag indicating if pixel position values should be rounded to the nearest integer. + * + * __Default value:__ `true` + */ + tickRound?: boolean; + /** + * Boolean value that determines whether the axis should include ticks. + * + * __Default value:__ `true` + */ + ticks?: boolean; + /** + * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks. + * + * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`. + */ + labelFlush?: boolean | number; + /** + * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `"greedy"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes). + * + * __Default value:__ `true` for non-nominal fields with non-log scales; `"greedy"` for log scales; otherwise `false`. + */ + labelOverlap?: LabelOverlap | ES; + /** + * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle. + * + * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default) + */ + offset?: number | ES; + /** + * The orientation of the axis. One of `"top"`, `"bottom"`, `"left"` or `"right"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart). + * + * __Default value:__ `"bottom"` for x-axes and `"left"` for y-axes. + */ + orient?: AxisOrient | ES; + /** + * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are "nice" (multiples of 2, 5, 10) and lie within the underlying scale's range. + * + * For scales of type `"time"` or `"utc"`, the tick count can instead be a time interval specifier. Legal string values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. Alternatively, an object-valued interval specifier of the form `{"interval": "month", "step": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary. + * + * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y. + * + * @minimum 0 + */ + tickCount?: number | TimeInterval | TimeIntervalStep | ES; + /** + * Explicitly set the visible axis tick values. + */ + values?: number[] | string[] | boolean[] | DateTime[] | ES; + /** + * A non-negative integer indicating the z-index of the axis. + * If zindex is 0, axes should be drawn behind all chart elements. + * To put them in front, set `zindex` to `1` or more. + * + * __Default value:__ `0` (behind the marks). + * + * @TJS-type integer + * @minimum 0 + */ + zindex?: number; +} +interface VLOnlyAxisMixins { + /** + * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. + * + * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object. + */ + labelExpr?: string; + /** + * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. + * + * __Default value:__ (none) + * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `"style": "foo"` will use `config.axisX` and `config.style.foo` (the specified style `"foo"` has higher precedence). + */ + style?: string | string[]; +} +export type ConditionalAxisProp = 'labelAlign' | 'labelBaseline' | 'labelColor' | 'labelFont' | 'labelFontSize' | 'labelFontStyle' | 'labelFontWeight' | 'labelOpacity' | 'labelOffset' | 'labelPadding' | 'gridColor' | 'gridDash' | 'gridDashOffset' | 'gridOpacity' | 'gridWidth' | 'tickColor' | 'tickDash' | 'tickDashOffset' | 'tickOpacity' | 'tickSize' | 'tickWidth'; +export declare const CONDITIONAL_AXIS_PROP_INDEX: Record; +export type ConditionalAxisProperty = (ValueDef | ES) & { + condition: ConditionalPredicate | ES> | ConditionalPredicate | ES>[]; +}; +export declare function isConditionalAxisValue(v: any): v is ConditionalAxisProperty; +export type ConditionalAxisNumber = ConditionalAxisProperty; +export type ConditionalAxisLabelAlign = ConditionalAxisProperty; +export type ConditionalAxisLabelBaseline = ConditionalAxisProperty; +export type ConditionalAxisColor = ConditionalAxisProperty; +export type ConditionalAxisString = ConditionalAxisProperty; +export type ConditionalAxisLabelFontStyle = ConditionalAxisProperty; +export type ConditionalAxisLabelFontWeight = ConditionalAxisProperty; +export type ConditionalAxisNumberArray = ConditionalAxisProperty; +export type AxisConfigBaseWithConditionalAndSignal = Omit, ConditionalAxisProp | 'title'> & AxisPropsWithCondition; +export interface AxisPropsWithCondition { + labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign; + labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline; + labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor; + labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString; + labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber; + labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle; + labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight; + labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber; + labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber; + labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber; + labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber; + gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor; + gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray; + gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber; + gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber; + gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber; + tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor; + tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray; + tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber; + tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber; + tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber; + tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber; + title?: TitleMixins['title']; +} +export type AxisConfig = Guide & VlOnlyGuideConfig & AxisConfigBaseWithConditionalAndSignal & { + /** + * Disable axis by default. + */ + disable?: boolean; +}; +export interface Axis extends AxisConfigBaseWithConditionalAndSignal, Guide { + /** + * Mark definitions for custom axis encoding. + * + * @hidden + */ + encoding?: AxisEncoding; +} +export type AxisInternal = Axis; +export type AxisPart = keyof AxisEncoding; +export declare const AXIS_PARTS: AxisPart[]; +/** + * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. + */ +export declare const AXIS_PROPERTY_TYPE: Record; +export interface AxisEncoding { + /** + * Custom encoding for the axis container. + */ + axis?: GuideEncodingEntry; + /** + * Custom encoding for the axis domain rule mark. + */ + domain?: GuideEncodingEntry; + /** + * Custom encoding for axis gridline rule marks. + */ + grid?: GuideEncodingEntry; + /** + * Custom encoding for axis label text marks. + */ + labels?: GuideEncodingEntry; + /** + * Custom encoding for axis tick rule marks. + */ + ticks?: GuideEncodingEntry; + /** + * Custom encoding for the axis title text mark. + */ + title?: GuideEncodingEntry; +} +export declare const COMMON_AXIS_PROPERTIES_INDEX: Flag)>; +export declare function isAxisProperty(prop: string): prop is keyof Axis; +export declare const AXIS_PROPERTIES: (keyof Axis)[]; +export interface AxisConfigMixins { + /** + * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config). + */ + axis?: AxisConfig; + /** + * X-axis specific config. + */ + axisX?: AxisConfig; + /** + * Y-axis specific config. + */ + axisY?: AxisConfig; + /** + * Config for y-axis along the left edge of the chart. + */ + axisLeft?: AxisConfig; + /** + * Config for y-axis along the right edge of the chart. + */ + axisRight?: AxisConfig; + /** + * Config for x-axis along the top edge of the chart. + */ + axisTop?: AxisConfig; + /** + * Config for x-axis along the bottom edge of the chart. + */ + axisBottom?: AxisConfig; + /** + * Config for axes with "band" scales. + */ + axisBand?: AxisConfig; + /** + * Config for axes with "point" scales. + */ + axisPoint?: AxisConfig; + /** + * Config for axes with "point" or "band" scales. + */ + axisDiscrete?: AxisConfig; + /** + * Config for quantitative axes. + */ + axisQuantitative?: AxisConfig; + /** + * Config for temporal axes. + */ + axisTemporal?: AxisConfig; + /** + * Config for x-axes with "band" scales. + */ + axisXBand?: AxisConfig; + /** + * Config for x-axes with "point" scales. + */ + axisXPoint?: AxisConfig; + /** + * Config for x-axes with "point" or "band" scales. + */ + axisXDiscrete?: AxisConfig; + /** + * Config for x-quantitative axes. + */ + axisXQuantitative?: AxisConfig; + /** + * Config for x-temporal axes. + */ + axisXTemporal?: AxisConfig; + /** + * Config for y-axes with "band" scales. + */ + axisYBand?: AxisConfig; + /** + * Config for y-axes with "point" scales. + */ + axisYPoint?: AxisConfig; + /** + * Config for y-axes with "point" or "band" scales. + */ + axisYDiscrete?: AxisConfig; + /** + * Config for y-quantitative axes. + */ + axisYQuantitative?: AxisConfig; + /** + * Config for y-temporal axes. + */ + axisYTemporal?: AxisConfig; +} +export declare const AXIS_CONFIGS: (keyof AxisConfigMixins)[]; +export {}; +//# sourceMappingURL=axis.d.ts.map \ No newline at end of file diff --git a/build/src/axis.d.ts.map b/build/src/axis.d.ts.map new file mode 100644 index 0000000000..c57decd22e --- /dev/null +++ b/build/src/axis.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"axis.d.ts","sourceRoot":"","sources":["../../src/axis.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,EACL,IAAI,IAAI,MAAM,EACd,UAAU,EACV,UAAU,EACV,QAAQ,EACR,KAAK,EACL,SAAS,EACT,UAAU,EACV,YAAY,EACZ,SAAS,EACT,YAAY,EACZ,YAAY,EACZ,gBAAgB,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,oBAAoB,EAAE,KAAK,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,EAAC,QAAQ,EA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E9B;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAEnC;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE3B;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE5B;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAE/B;;OAEG;IACH,iBAAiB,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;IAEnC;;OAEG;IACH,aAAa,CAAC,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;CAChC;AA2BD,eAAO,MAAM,YAAY,iCAA2B,CAAC"} \ No newline at end of file diff --git a/build/src/axis.js b/build/src/axis.js new file mode 100644 index 0000000000..48e5b49855 --- /dev/null +++ b/build/src/axis.js @@ -0,0 +1,281 @@ +import { keys } from './util'; +export const CONDITIONAL_AXIS_PROP_INDEX = { + labelAlign: { + part: 'labels', + vgProp: 'align' + }, + labelBaseline: { + part: 'labels', + vgProp: 'baseline' + }, + labelColor: { + part: 'labels', + vgProp: 'fill' + }, + labelFont: { + part: 'labels', + vgProp: 'font' + }, + labelFontSize: { + part: 'labels', + vgProp: 'fontSize' + }, + labelFontStyle: { + part: 'labels', + vgProp: 'fontStyle' + }, + labelFontWeight: { + part: 'labels', + vgProp: 'fontWeight' + }, + labelOpacity: { + part: 'labels', + vgProp: 'opacity' + }, + labelOffset: null, + labelPadding: null, + gridColor: { + part: 'grid', + vgProp: 'stroke' + }, + gridDash: { + part: 'grid', + vgProp: 'strokeDash' + }, + gridDashOffset: { + part: 'grid', + vgProp: 'strokeDashOffset' + }, + gridOpacity: { + part: 'grid', + vgProp: 'opacity' + }, + gridWidth: { + part: 'grid', + vgProp: 'strokeWidth' + }, + tickColor: { + part: 'ticks', + vgProp: 'stroke' + }, + tickDash: { + part: 'ticks', + vgProp: 'strokeDash' + }, + tickDashOffset: { + part: 'ticks', + vgProp: 'strokeDashOffset' + }, + tickOpacity: { + part: 'ticks', + vgProp: 'opacity' + }, + tickSize: null, + tickWidth: { + part: 'ticks', + vgProp: 'strokeWidth' + } +}; +export function isConditionalAxisValue(v) { + return v?.condition; +} +export const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title']; +/** + * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. + */ +export const AXIS_PROPERTY_TYPE = { + grid: 'grid', + gridCap: 'grid', + gridColor: 'grid', + gridDash: 'grid', + gridDashOffset: 'grid', + gridOpacity: 'grid', + gridScale: 'grid', + gridWidth: 'grid', + orient: 'main', + bandPosition: 'both', + aria: 'main', + description: 'main', + domain: 'main', + domainCap: 'main', + domainColor: 'main', + domainDash: 'main', + domainDashOffset: 'main', + domainOpacity: 'main', + domainWidth: 'main', + format: 'main', + formatType: 'main', + labelAlign: 'main', + labelAngle: 'main', + labelBaseline: 'main', + labelBound: 'main', + labelColor: 'main', + labelFlush: 'main', + labelFlushOffset: 'main', + labelFont: 'main', + labelFontSize: 'main', + labelFontStyle: 'main', + labelFontWeight: 'main', + labelLimit: 'main', + labelLineHeight: 'main', + labelOffset: 'main', + labelOpacity: 'main', + labelOverlap: 'main', + labelPadding: 'main', + labels: 'main', + labelSeparation: 'main', + maxExtent: 'main', + minExtent: 'main', + offset: 'both', + position: 'main', + tickCap: 'main', + tickColor: 'main', + tickDash: 'main', + tickDashOffset: 'main', + tickMinStep: 'both', + tickOffset: 'both', + tickOpacity: 'main', + tickRound: 'both', + ticks: 'main', + tickSize: 'main', + tickWidth: 'both', + title: 'main', + titleAlign: 'main', + titleAnchor: 'main', + titleAngle: 'main', + titleBaseline: 'main', + titleColor: 'main', + titleFont: 'main', + titleFontSize: 'main', + titleFontStyle: 'main', + titleFontWeight: 'main', + titleLimit: 'main', + titleLineHeight: 'main', + titleOpacity: 'main', + titlePadding: 'main', + titleX: 'main', + titleY: 'main', + encode: 'both', + scale: 'both', + tickBand: 'both', + tickCount: 'both', + tickExtra: 'both', + translate: 'both', + values: 'both', + zindex: 'both' // this is actually set afterward, so it doesn't matter +}; +export const COMMON_AXIS_PROPERTIES_INDEX = { + orient: 1, + aria: 1, + bandPosition: 1, + description: 1, + domain: 1, + domainCap: 1, + domainColor: 1, + domainDash: 1, + domainDashOffset: 1, + domainOpacity: 1, + domainWidth: 1, + format: 1, + formatType: 1, + grid: 1, + gridCap: 1, + gridColor: 1, + gridDash: 1, + gridDashOffset: 1, + gridOpacity: 1, + gridWidth: 1, + labelAlign: 1, + labelAngle: 1, + labelBaseline: 1, + labelBound: 1, + labelColor: 1, + labelFlush: 1, + labelFlushOffset: 1, + labelFont: 1, + labelFontSize: 1, + labelFontStyle: 1, + labelFontWeight: 1, + labelLimit: 1, + labelLineHeight: 1, + labelOffset: 1, + labelOpacity: 1, + labelOverlap: 1, + labelPadding: 1, + labels: 1, + labelSeparation: 1, + maxExtent: 1, + minExtent: 1, + offset: 1, + position: 1, + tickBand: 1, + tickCap: 1, + tickColor: 1, + tickCount: 1, + tickDash: 1, + tickDashOffset: 1, + tickExtra: 1, + tickMinStep: 1, + tickOffset: 1, + tickOpacity: 1, + tickRound: 1, + ticks: 1, + tickSize: 1, + tickWidth: 1, + title: 1, + titleAlign: 1, + titleAnchor: 1, + titleAngle: 1, + titleBaseline: 1, + titleColor: 1, + titleFont: 1, + titleFontSize: 1, + titleFontStyle: 1, + titleFontWeight: 1, + titleLimit: 1, + titleLineHeight: 1, + titleOpacity: 1, + titlePadding: 1, + titleX: 1, + titleY: 1, + translate: 1, + values: 1, + zindex: 1 +}; +const AXIS_PROPERTIES_INDEX = { + ...COMMON_AXIS_PROPERTIES_INDEX, + style: 1, + labelExpr: 1, + encoding: 1 +}; +export function isAxisProperty(prop) { + return !!AXIS_PROPERTIES_INDEX[prop]; +} +// Export for dependent projects +export const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX); +const AXIS_CONFIGS_INDEX = { + axis: 1, + axisBand: 1, + axisBottom: 1, + axisDiscrete: 1, + axisLeft: 1, + axisPoint: 1, + axisQuantitative: 1, + axisRight: 1, + axisTemporal: 1, + axisTop: 1, + axisX: 1, + axisXBand: 1, + axisXDiscrete: 1, + axisXPoint: 1, + axisXQuantitative: 1, + axisXTemporal: 1, + axisY: 1, + axisYBand: 1, + axisYDiscrete: 1, + axisYPoint: 1, + axisYQuantitative: 1, + axisYTemporal: 1 +}; +export const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX); +//# sourceMappingURL=axis.js.map \ No newline at end of file diff --git a/build/src/axis.js.map b/build/src/axis.js.map new file mode 100644 index 0000000000..4c33b80637 --- /dev/null +++ b/build/src/axis.js.map @@ -0,0 +1 @@ +{"version":3,"file":"axis.js","sourceRoot":"","sources":["../../src/axis.ts"],"names":[],"mappings":"AAmBA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAkKlC,MAAM,CAAC,MAAM,2BAA2B,GAMpC;IACF,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,OAAO;KAChB;IACD,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,UAAU;KACnB;IACD,UAAU,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;KACf;IACD,SAAS,EAAE;QACT,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,MAAM;KACf;IACD,aAAa,EAAE;QACb,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,UAAU;KACnB;IACD,cAAc,EAAE;QACd,IAAI,EAAE,Q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M,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,qBAAqB,GAA0B;IACnD,GAAG,4BAA4B;IAC/B,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,QAAQ,EAAE,CAAC;CACZ,CAAC;AAEF,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,CAAC,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACvC,CAAC;AAED,gCAAgC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC;AAkH3D,MAAM,kBAAkB,GAAsC;IAC5D,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;IACX,UAAU,EAAE,CAAC;IACb,YAAY,EAAE,CAAC;IACf,QAAQ,EAAE,CAAC;IACX,SAAS,EAAE,CAAC;IACZ,gBAAgB,EAAE,CAAC;IACnB,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;IACf,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;IAChB,KAAK,EAAE,CAAC;IACR,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC;IACpB,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,kBAAkB,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/bin.d.ts b/build/src/bin.d.ts new file mode 100644 index 0000000000..4bf45333c1 --- /dev/null +++ b/build/src/bin.d.ts @@ -0,0 +1,85 @@ +import { ExtendedChannel } from './channel'; +import { ParameterExtent } from './selection'; +export interface BaseBin { + /** + * The number base to use for automatic bin determination (default is base 10). + * + * __Default value:__ `10` + * + */ + base?: number; + /** + * An exact step size to use between bins. + * + * __Note:__ If provided, options such as maxbins will be ignored. + */ + step?: number; + /** + * An array of allowable step sizes to choose from. + * @minItems 1 + */ + steps?: number[]; + /** + * A minimum allowable step size (particularly useful for integer values). + */ + minstep?: number; + /** + * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints. + * + * __Default value:__ `[5, 2]` + * + * @minItems 1 + */ + divide?: [number, number]; + /** + * Maximum number of bins. + * + * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels + * + * @minimum 2 + */ + maxbins?: number; + /** + * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value. + * + * __Default value:__ the minimum bin extent value + */ + anchor?: number; + /** + * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten. + * + * __Default value:__ `true` + */ + nice?: boolean; +} +/** + * Binning properties or boolean flag for determining whether to bin data or not. + */ +export interface BinParams extends BaseBin { + /** + * A two-element (`[min, max]`) array indicating the range of desired bin values. + */ + extent?: BinExtent; + /** + * When set to `true`, Vega-Lite treats the input data as already binned. + */ + binned?: boolean; +} +export type Bin = boolean | BinParams | 'binned' | null; +export type BinExtent = [number, number] | ParameterExtent; +/** + * Create a key for the bin configuration. Not for prebinned bin. + */ +export declare function binToString(bin: BinParams | true): string; +/** + * Vega-Lite should bin the data. + */ +export declare function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true; +/** + * The data is already binned and so Vega-Lite should not bin it again. + */ +export declare function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams; +export declare function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams; +export declare function isParameterExtent(extent: BinExtent): extent is ParameterExtent; +export declare function autoMaxBins(channel?: ExtendedChannel): number; +//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/build/src/bin.d.ts.map b/build/src/bin.d.ts.map new file mode 100644 index 0000000000..2513395f93 --- /dev/null +++ b/build/src/bin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,eAAe,EAWhB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAG5C,MAAM,WAAW,OAAO;IACtB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,OAAO;IACxC;;OAEG;IACH,MAAM,CAAC,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,MAAM,GAAG,GAAG,OAAO,GAAG,SAAS,GAAG,QAAQ,GAAG,IAAI,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,eAAe,CAAC;AAE3D;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,IAAI,UAUhD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,GAAG,IAAI,SAAS,GAAG,IAAI,CAEtF;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,GAAG,IAAI,QAAQ,GAAG,SAAS,CAEzF;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,GAAG,IAAI,SAAS,CAEjF;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,IAAI,eAAe,CAE9E;AAED,wBAAgB,WAAW,CAAC,OAAO,CAAC,EAAE,eAAe,GAAG,MAAM,CAqB7D"} \ No newline at end of file diff --git a/build/src/bin.js b/build/src/bin.js new file mode 100644 index 0000000000..fb5f397713 --- /dev/null +++ b/build/src/bin.js @@ -0,0 +1,57 @@ +import { isBoolean, isObject } from 'vega-util'; +import { COLOR, COLUMN, FILL, FILLOPACITY, OPACITY, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH } from './channel'; +import { normalizeBin } from './channeldef'; +import { entries, keys, varName } from './util'; +/** + * Create a key for the bin configuration. Not for prebinned bin. + */ +export function binToString(bin) { + if (isBoolean(bin)) { + bin = normalizeBin(bin, undefined); + } + return ('bin' + + keys(bin) + .map(p => (isParameterExtent(bin[p]) ? varName(`_${p}_${entries(bin[p])}`) : varName(`_${p}_${bin[p]}`))) + .join('')); +} +/** + * Vega-Lite should bin the data. + */ +export function isBinning(bin) { + return bin === true || (isBinParams(bin) && !bin.binned); +} +/** + * The data is already binned and so Vega-Lite should not bin it again. + */ +export function isBinned(bin) { + return bin === 'binned' || (isBinParams(bin) && bin.binned === true); +} +export function isBinParams(bin) { + return isObject(bin); +} +export function isParameterExtent(extent) { + return extent?.['param']; +} +export function autoMaxBins(channel) { + switch (channel) { + case ROW: + case COLUMN: + case SIZE: + case COLOR: + case FILL: + case STROKE: + case STROKEWIDTH: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + // Facets and Size shouldn't have too many bins + // We choose 6 like shape to simplify the rule [falls through] + case SHAPE: + return 6; // Vega's "shape" has 6 distinct values + case STROKEDASH: + return 4; // We only provide 5 different stroke dash values (but 4 is more effective) + default: + return 10; + } +} +//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/build/src/bin.js.map b/build/src/bin.js.map new file mode 100644 index 0000000000..8bcce608bb --- /dev/null +++ b/build/src/bin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../src/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,KAAK,EACL,MAAM,EAEN,IAAI,EACJ,WAAW,EACX,OAAO,EACP,GAAG,EACH,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AA0E9C;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,GAAqB;IAC/C,IAAI,SAAS,CAAC,GAAG,CAAC,EAAE;QAClB,GAAG,GAAG,YAAY,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;KACpC;IACD,OAAO,CACL,KAAK;QACL,IAAI,CAAC,GAAG,CAAC;aACN,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;aACxG,IAAI,CAAC,EAAE,CAAC,CACZ,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,GAAmC;IAC3D,OAAO,GAAG,KAAK,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAC3D,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAmC;IAC1D,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAmC;IAC7D,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,MAAiB;IACjD,OAAO,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAyB;IACnD,QAAQ,OAAO,EAAE;QACf,KAAK,GAAG,CAAC;QACT,KAAK,MAAM,CAAC;QACZ,KAAK,IAAI,CAAC;QACV,KAAK,KAAK,CAAC;QACX,KAAK,IAAI,CAAC;QACV,KAAK,MAAM,CAAC;QACZ,KAAK,WAAW,CAAC;QACjB,KAAK,OAAO,CAAC;QACb,KAAK,WAAW,CAAC;QACjB,KAAK,aAAa,CAAC;QACnB,+CAA+C;QAC/C,8DAA8D;QAC9D,KAAK,KAAK;YACR,OAAO,CAAC,CAAC,CAAC,uCAAuC;QACnD,KAAK,UAAU;YACb,OAAO,CAAC,CAAC,CAAC,2EAA2E;QACvF;YACE,OAAO,EAAE,CAAC;KACb;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/channel.d.ts b/build/src/channel.d.ts new file mode 100644 index 0000000000..f8be2b0b82 --- /dev/null +++ b/build/src/channel.d.ts @@ -0,0 +1,153 @@ +import { RangeType } from './compile/scale/type'; +import { Encoding } from './encoding'; +import { Mark } from './mark'; +import { EncodingFacetMapping } from './spec/facet'; +export type Channel = keyof Encoding; +export type ExtendedChannel = Channel | FacetChannel; +export declare const ROW: "row"; +export declare const COLUMN: "column"; +export declare const FACET: "facet"; +export declare const X: "x"; +export declare const Y: "y"; +export declare const X2: "x2"; +export declare const Y2: "y2"; +export declare const XOFFSET: "xOffset"; +export declare const YOFFSET: "yOffset"; +export declare const RADIUS: "radius"; +export declare const RADIUS2: "radius2"; +export declare const THETA: "theta"; +export declare const THETA2: "theta2"; +export declare const LATITUDE: "latitude"; +export declare const LONGITUDE: "longitude"; +export declare const LATITUDE2: "latitude2"; +export declare const LONGITUDE2: "longitude2"; +export declare const COLOR: "color"; +export declare const FILL: "fill"; +export declare const STROKE: "stroke"; +export declare const SHAPE: "shape"; +export declare const SIZE: "size"; +export declare const ANGLE: "angle"; +export declare const OPACITY: "opacity"; +export declare const FILLOPACITY: "fillOpacity"; +export declare const STROKEOPACITY: "strokeOpacity"; +export declare const STROKEWIDTH: "strokeWidth"; +export declare const STROKEDASH: "strokeDash"; +export declare const TEXT: "text"; +export declare const ORDER: "order"; +export declare const DETAIL: "detail"; +export declare const KEY: "key"; +export declare const TOOLTIP: "tooltip"; +export declare const HREF: "href"; +export declare const URL: "url"; +export declare const DESCRIPTION: "description"; +declare const POSITION_CHANNEL_INDEX: { + readonly x: 1; + readonly y: 1; + readonly x2: 1; + readonly y2: 1; +}; +export type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX; +declare const POLAR_POSITION_CHANNEL_INDEX: { + readonly theta: 1; + readonly theta2: 1; + readonly radius: 1; + readonly radius2: 1; +}; +export type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX; +export declare function isPolarPositionChannel(c: Channel): c is PolarPositionChannel; +declare const GEO_POSIITON_CHANNEL_INDEX: { + readonly longitude: 1; + readonly longitude2: 1; + readonly latitude: 1; + readonly latitude2: 1; +}; +export type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX; +export declare function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel; +export declare function isGeoPositionChannel(c: Channel): c is GeoPositionChannel; +export declare const GEOPOSITION_CHANNELS: ("longitude" | "latitude" | "longitude2" | "latitude2")[]; +export type ColorChannel = 'color' | 'fill' | 'stroke'; +export declare function isColorChannel(channel: Channel): channel is ColorChannel; +export type FacetChannel = keyof EncodingFacetMapping; +export declare const FACET_CHANNELS: (keyof EncodingFacetMapping)[]; +export declare const CHANNELS: ("fill" | "stroke" | "angle" | "detail" | "key" | "url" | "color" | "fillOpacity" | "opacity" | "order" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "description" | "x" | "x2" | "y" | "y2" | "strokeDash" | "tooltip" | "shape" | "radius" | "theta" | "facet" | "href" | "theta2" | "radius2" | "xOffset" | "yOffset" | "longitude" | "latitude" | "longitude2" | "latitude2" | "row" | "column")[]; +/** + * Channels that cannot have an array of channelDef. + * model.fieldDef, getFieldDef only work for these channels. + * + * (The only two channels that can have an array of channelDefs are "detail" and "order". + * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef + * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".) + */ +export declare const SINGLE_DEF_CHANNELS: ("fill" | "stroke" | "angle" | "key" | "url" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "description" | "x" | "x2" | "y" | "y2" | "strokeDash" | "shape" | "radius" | "theta" | "facet" | "href" | "theta2" | "radius2" | "xOffset" | "yOffset" | "longitude" | "latitude" | "longitude2" | "latitude2" | "row" | "column")[]; +export type SingleDefChannel = (typeof SINGLE_DEF_CHANNELS)[number]; +export declare const SINGLE_DEF_UNIT_CHANNELS: ("fill" | "stroke" | "angle" | "key" | "url" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "description" | "x" | "x2" | "y" | "y2" | "strokeDash" | "shape" | "radius" | "theta" | "href" | "theta2" | "radius2" | "xOffset" | "yOffset" | "longitude" | "latitude" | "longitude2" | "latitude2")[]; +export type SingleDefUnitChannel = (typeof SINGLE_DEF_UNIT_CHANNELS)[number]; +export declare function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel; +export declare function isChannel(str: string): str is Channel; +export type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2'; +export declare const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[]; +export declare function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel; +export type MainChannelOf = C extends 'x2' ? 'x' : C extends 'y2' ? 'y' : C extends 'latitude2' ? 'latitude' : C extends 'longitude2' ? 'longitude' : C extends 'theta2' ? 'theta' : C extends 'radius2' ? 'radius' : C; +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export declare function getMainRangeChannel(channel: C): MainChannelOf; +export type SecondaryChannelOf = C extends 'x' ? 'x2' : C extends 'y' ? 'y2' : C extends 'latitude' ? 'latitude2' : C extends 'longitude' ? 'longitude2' : C extends 'theta' ? 'theta2' : C extends 'radius' ? 'radius2' : undefined; +export declare function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel): "x" | "x2" | "y" | "y2" | "innerRadius" | "outerRadius" | "startAngle" | "endAngle"; +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export declare function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined; +export declare function getSizeChannel(channel: PositionChannel): 'width' | 'height'; +export declare function getSizeChannel(channel: Channel): 'width' | 'height' | undefined; +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export declare function getOffsetChannel(channel: Channel): "xOffset" | "yOffset" | "x2Offset" | "y2Offset" | "thetaOffset" | "radiusOffset" | "theta2Offset" | "radius2Offset"; +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export declare function getOffsetScaleChannel(channel: Channel): OffsetScaleChannel; +export declare function getMainChannelFromOffsetChannel(channel: OffsetScaleChannel): PositionScaleChannel; +export declare const UNIT_CHANNELS: (keyof Encoding)[]; +export declare const NONPOSITION_CHANNELS: ("fill" | "stroke" | "angle" | "detail" | "key" | "url" | "color" | "fillOpacity" | "opacity" | "order" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "description" | "strokeDash" | "tooltip" | "shape" | "href")[]; +export type NonPositionChannel = (typeof NONPOSITION_CHANNELS)[number]; +declare const POSITION_SCALE_CHANNEL_INDEX: { + readonly x: 1; + readonly y: 1; +}; +export declare const POSITION_SCALE_CHANNELS: ("x" | "y")[]; +export type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX; +export declare function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel; +export declare const POLAR_POSITION_SCALE_CHANNEL_INDEX: { + readonly theta: 1; + readonly radius: 1; +}; +export declare const POLAR_POSITION_SCALE_CHANNELS: ("radius" | "theta")[]; +export type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX; +export declare function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel; +export declare const OFFSET_SCALE_CHANNELS: ("xOffset" | "yOffset")[]; +export type OffsetScaleChannel = (typeof OFFSET_SCALE_CHANNELS)[0]; +export declare function isXorYOffset(channel: Channel): channel is OffsetScaleChannel; +export declare const NONPOSITION_SCALE_CHANNELS: ("fill" | "stroke" | "angle" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "size" | "strokeDash" | "shape")[]; +export type NonPositionScaleChannel = (typeof NONPOSITION_SCALE_CHANNELS)[number]; +export declare function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel; +/** + * @returns whether Vega supports legends for a particular channel + */ +export declare function supportLegend(channel: NonPositionScaleChannel): boolean; +/** List of channels with scales */ +export declare const SCALE_CHANNELS: ("fill" | "stroke" | "angle" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "size" | "x" | "y" | "strokeDash" | "shape" | "radius" | "theta" | "xOffset" | "yOffset")[]; +export type ScaleChannel = (typeof SCALE_CHANNELS)[number]; +export declare function isScaleChannel(channel: Channel): channel is ScaleChannel; +export type SupportedMark = Partial>; +/** + * Return whether a channel supports a particular mark type. + * @param channel channel name + * @param mark the mark type + * @return whether the mark supports the channel + */ +export declare function supportMark(channel: ExtendedChannel, mark: Mark): "always" | "binned"; +export declare function rangeType(channel: ExtendedChannel): RangeType; +export {}; +//# sourceMappingURL=channel.d.ts.map \ No newline at end of file diff --git a/build/src/channel.d.ts.map b/build/src/channel.d.ts.map new file mode 100644 index 0000000000..0a58d7d425 --- /dev/null +++ b/build/src/channel.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAGlD,MAAM,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,GAAG,CAAC,CAAC;AAC1C,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,YAAY,CAAC;AAGrD,eAAO,MAAM,GAAG,OAAiB,CAAC;AAClC,eAAO,MAAM,MAAM,UAAoB,CAAC;AAExC,eAAO,MAAM,KAAK,SAAmB,CAAC;AAGtC,eAAO,MAAM,CAAC,KAAe,CAAC;AAC9B,eAAO,MAAM,CAAC,KAAe,CAAC;AAC9B,eAAO,MAAM,EAAE,MAAgB,CAAC;AAChC,eAAO,MAAM,EAAE,MAAgB,CAAC;AAGhC,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,eAAO,MAAM,OAAO,WAAqB,CAAC;AAG1C,eAAO,MAAM,MAAM,UAAoB,CAAC;AACxC,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,eAAO,MAAM,KAAK,SAAmB,CAAC;AACtC,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,CAAC,CAAC;AAE3D,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,IAAI,YAAY,CAExE;AAED,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,eAAe,EAAE,IAAI,EAAE,IAAI,uBAE/D;AAqHD,wBAAgB,SAAS,CAAC,OAAO,EAAE,eAAe,GAAG,SAAS,CAoD7D"} \ No newline at end of file diff --git a/build/src/channel.js b/build/src/channel.js new file mode 100644 index 0000000000..e2304d1d3f --- /dev/null +++ b/build/src/channel.js @@ -0,0 +1,504 @@ +/* + * Constants and utilities for encoding channels (Visual variables) + * such as 'x', 'y', 'color'. + */ +import { keys } from './util'; +// Facet +export const ROW = 'row'; +export const COLUMN = 'column'; +export const FACET = 'facet'; +// Position +export const X = 'x'; +export const Y = 'y'; +export const X2 = 'x2'; +export const Y2 = 'y2'; +// Position Offset +export const XOFFSET = 'xOffset'; +export const YOFFSET = 'yOffset'; +// Arc-Position +export const RADIUS = 'radius'; +export const RADIUS2 = 'radius2'; +export const THETA = 'theta'; +export const THETA2 = 'theta2'; +// Geo Position +export const LATITUDE = 'latitude'; +export const LONGITUDE = 'longitude'; +export const LATITUDE2 = 'latitude2'; +export const LONGITUDE2 = 'longitude2'; +// Mark property with scale +export const COLOR = 'color'; +export const FILL = 'fill'; +export const STROKE = 'stroke'; +export const SHAPE = 'shape'; +export const SIZE = 'size'; +export const ANGLE = 'angle'; +export const OPACITY = 'opacity'; +export const FILLOPACITY = 'fillOpacity'; +export const STROKEOPACITY = 'strokeOpacity'; +export const STROKEWIDTH = 'strokeWidth'; +export const STROKEDASH = 'strokeDash'; +// Non-scale channel +export const TEXT = 'text'; +export const ORDER = 'order'; +export const DETAIL = 'detail'; +export const KEY = 'key'; +export const TOOLTIP = 'tooltip'; +export const HREF = 'href'; +export const URL = 'url'; +export const DESCRIPTION = 'description'; +const POSITION_CHANNEL_INDEX = { + x: 1, + y: 1, + x2: 1, + y2: 1 +}; +const POLAR_POSITION_CHANNEL_INDEX = { + theta: 1, + theta2: 1, + radius: 1, + radius2: 1 +}; +export function isPolarPositionChannel(c) { + return c in POLAR_POSITION_CHANNEL_INDEX; +} +const GEO_POSIITON_CHANNEL_INDEX = { + longitude: 1, + longitude2: 1, + latitude: 1, + latitude2: 1 +}; +export function getPositionChannelFromLatLong(channel) { + switch (channel) { + case LATITUDE: + return 'y'; + case LATITUDE2: + return 'y2'; + case LONGITUDE: + return 'x'; + case LONGITUDE2: + return 'x2'; + } +} +export function isGeoPositionChannel(c) { + return c in GEO_POSIITON_CHANNEL_INDEX; +} +export const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); +const UNIT_CHANNEL_INDEX = { + ...POSITION_CHANNEL_INDEX, + ...POLAR_POSITION_CHANNEL_INDEX, + ...GEO_POSIITON_CHANNEL_INDEX, + xOffset: 1, + yOffset: 1, + // color + color: 1, + fill: 1, + stroke: 1, + // other non-position with scale + opacity: 1, + fillOpacity: 1, + strokeOpacity: 1, + strokeWidth: 1, + strokeDash: 1, + size: 1, + angle: 1, + shape: 1, + // channels without scales + order: 1, + text: 1, + detail: 1, + key: 1, + tooltip: 1, + href: 1, + url: 1, + description: 1 +}; +export function isColorChannel(channel) { + return channel === COLOR || channel === FILL || channel === STROKE; +} +const FACET_CHANNEL_INDEX = { + row: 1, + column: 1, + facet: 1 +}; +export const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); +const CHANNEL_INDEX = { + ...UNIT_CHANNEL_INDEX, + ...FACET_CHANNEL_INDEX +}; +export const CHANNELS = keys(CHANNEL_INDEX); +const { order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX } = CHANNEL_INDEX; +const { row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX } = SINGLE_DEF_CHANNEL_INDEX; +/** + * Channels that cannot have an array of channelDef. + * model.fieldDef, getFieldDef only work for these channels. + * + * (The only two channels that can have an array of channelDefs are "detail" and "order". + * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef + * are not applicable for them. Similarly, selection projection won't work with "detail" and "order".) + */ +export const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX); +export const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX); +export function isSingleDefUnitChannel(str) { + return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; +} +export function isChannel(str) { + return !!CHANNEL_INDEX[str]; +} +export const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; +export function isSecondaryRangeChannel(c) { + const main = getMainRangeChannel(c); + return main !== c; +} +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export function getMainRangeChannel(channel) { + switch (channel) { + case X2: + return X; + case Y2: + return Y; + case LATITUDE2: + return LATITUDE; + case LONGITUDE2: + return LONGITUDE; + case THETA2: + return THETA; + case RADIUS2: + return RADIUS; + } + return channel; +} +export function getVgPositionChannel(channel) { + if (isPolarPositionChannel(channel)) { + switch (channel) { + case THETA: + return 'startAngle'; + case THETA2: + return 'endAngle'; + case RADIUS: + return 'outerRadius'; + case RADIUS2: + return 'innerRadius'; + } + } + return channel; +} +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export function getSecondaryRangeChannel(channel) { + switch (channel) { + case X: + return X2; + case Y: + return Y2; + case LATITUDE: + return LATITUDE2; + case LONGITUDE: + return LONGITUDE2; + case THETA: + return THETA2; + case RADIUS: + return RADIUS2; + } + return undefined; +} +export function getSizeChannel(channel) { + switch (channel) { + case X: + case X2: + return 'width'; + case Y: + case Y2: + return 'height'; + } + return undefined; +} +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export function getOffsetChannel(channel) { + switch (channel) { + case X: + return 'xOffset'; + case Y: + return 'yOffset'; + case X2: + return 'x2Offset'; + case Y2: + return 'y2Offset'; + case THETA: + return 'thetaOffset'; + case RADIUS: + return 'radiusOffset'; + case THETA2: + return 'theta2Offset'; + case RADIUS2: + return 'radius2Offset'; + } + return undefined; +} +/** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ +export function getOffsetScaleChannel(channel) { + switch (channel) { + case X: + return 'xOffset'; + case Y: + return 'yOffset'; + } + return undefined; +} +export function getMainChannelFromOffsetChannel(channel) { + switch (channel) { + case 'xOffset': + return 'x'; + case 'yOffset': + return 'y'; + } +} +// CHANNELS without COLUMN, ROW +export const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX); +// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; +const { x: _x, y: _y, +// x2 and y2 share the same scale as x and y +x2: _x2, y2: _y2, +// +xOffset: _xo, yOffset: _yo, latitude: _latitude, longitude: _longitude, latitude2: _latitude2, longitude2: _longitude2, theta: _theta, theta2: _theta2, radius: _radius, radius2: _radius2, +// The rest of unit channels then have scale +...NONPOSITION_CHANNEL_INDEX } = UNIT_CHANNEL_INDEX; +export const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); +const POSITION_SCALE_CHANNEL_INDEX = { + x: 1, + y: 1 +}; +export const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); +export function isXorY(channel) { + return channel in POSITION_SCALE_CHANNEL_INDEX; +} +export const POLAR_POSITION_SCALE_CHANNEL_INDEX = { + theta: 1, + radius: 1 +}; +export const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); +export function getPositionScaleChannel(sizeType) { + return sizeType === 'width' ? X : Y; +} +const OFFSET_SCALE_CHANNEL_INDEX = { xOffset: 1, yOffset: 1 }; +export const OFFSET_SCALE_CHANNELS = keys(OFFSET_SCALE_CHANNEL_INDEX); +export function isXorYOffset(channel) { + return channel in OFFSET_SCALE_CHANNEL_INDEX; +} +// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset +const { +// x2 and y2 share the same scale as x and y +// text and tooltip have format instead of scale, +// href has neither format, nor scale +text: _t, tooltip: _tt, href: _hr, url: _u, description: _al, +// detail and order have no scale +detail: _dd, key: _k, order: _oo, ...NONPOSITION_SCALE_CHANNEL_INDEX } = NONPOSITION_CHANNEL_INDEX; +export const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); +export function isNonPositionScaleChannel(channel) { + return !!NONPOSITION_CHANNEL_INDEX[channel]; +} +/** + * @returns whether Vega supports legends for a particular channel + */ +export function supportLegend(channel) { + switch (channel) { + case COLOR: + case FILL: + case STROKE: + case SIZE: + case SHAPE: + case OPACITY: + case STROKEWIDTH: + case STROKEDASH: + return true; + case FILLOPACITY: + case STROKEOPACITY: + case ANGLE: + return false; + } +} +// Declare SCALE_CHANNEL_INDEX +const SCALE_CHANNEL_INDEX = { + ...POSITION_SCALE_CHANNEL_INDEX, + ...POLAR_POSITION_SCALE_CHANNEL_INDEX, + ...OFFSET_SCALE_CHANNEL_INDEX, + ...NONPOSITION_SCALE_CHANNEL_INDEX +}; +/** List of channels with scales */ +export const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); +export function isScaleChannel(channel) { + return !!SCALE_CHANNEL_INDEX[channel]; +} +/** + * Return whether a channel supports a particular mark type. + * @param channel channel name + * @param mark the mark type + * @return whether the mark supports the channel + */ +export function supportMark(channel, mark) { + return getSupportedMark(channel)[mark]; +} +const ALL_MARKS = { + // all marks + arc: 'always', + area: 'always', + bar: 'always', + circle: 'always', + geoshape: 'always', + image: 'always', + line: 'always', + rule: 'always', + point: 'always', + rect: 'always', + square: 'always', + trail: 'always', + text: 'always', + tick: 'always' +}; +const { geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE } = ALL_MARKS; +/** + * Return a dictionary showing whether a channel supports mark type. + * @param channel + * @return A dictionary mapping mark types to 'always', 'binned', or undefined + */ +function getSupportedMark(channel) { + switch (channel) { + case COLOR: + case FILL: + case STROKE: + // falls through + case DESCRIPTION: + case DETAIL: + case KEY: + case TOOLTIP: + case HREF: + case ORDER: // TODO: revise (order might not support rect, which is not stackable?) + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEWIDTH: + // falls through + case FACET: + case ROW: // falls through + case COLUMN: + return ALL_MARKS; + case X: + case Y: + case XOFFSET: + case YOFFSET: + case LATITUDE: + case LONGITUDE: + // all marks except geoshape. geoshape does not use X, Y -- it uses a projection + return ALL_MARKS_EXCEPT_GEOSHAPE; + case X2: + case Y2: + case LATITUDE2: + case LONGITUDE2: + return { + area: 'always', + bar: 'always', + image: 'always', + rect: 'always', + rule: 'always', + circle: 'binned', + point: 'binned', + square: 'binned', + tick: 'binned', + line: 'binned', + trail: 'binned' + }; + case SIZE: + return { + point: 'always', + tick: 'always', + rule: 'always', + circle: 'always', + square: 'always', + bar: 'always', + text: 'always', + line: 'always', + trail: 'always' + }; + case STROKEDASH: + return { + line: 'always', + point: 'always', + tick: 'always', + rule: 'always', + circle: 'always', + square: 'always', + bar: 'always', + geoshape: 'always' + }; + case SHAPE: + return { point: 'always', geoshape: 'always' }; + case TEXT: + return { text: 'always' }; + case ANGLE: + return { point: 'always', square: 'always', text: 'always' }; + case URL: + return { image: 'always' }; + case THETA: + return { text: 'always', arc: 'always' }; + case RADIUS: + return { text: 'always', arc: 'always' }; + case THETA2: + case RADIUS2: + return { arc: 'always' }; + } +} +export function rangeType(channel) { + switch (channel) { + case X: + case Y: + case THETA: + case RADIUS: + case XOFFSET: + case YOFFSET: + case SIZE: + case ANGLE: + case STROKEWIDTH: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] + case X2: + case Y2: + case THETA2: + case RADIUS2: + return undefined; + case FACET: + case ROW: + case COLUMN: + case SHAPE: + case STROKEDASH: + // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] + case TEXT: + case TOOLTIP: + case HREF: + case URL: + case DESCRIPTION: + return 'discrete'; + // Color can be either continuous or discrete, depending on scale type. + case COLOR: + case FILL: + case STROKE: + return 'flexible'; + // No scale, no range type. + case LATITUDE: + case LONGITUDE: + case LATITUDE2: + case LONGITUDE2: + case DETAIL: + case KEY: + case ORDER: + return undefined; + } +} +//# sourceMappingURL=channel.js.map \ No newline at end of file diff --git a/build/src/channel.js.map b/build/src/channel.js.map new file mode 100644 index 0000000000..3640b9ba68 --- /dev/null +++ b/build/src/channel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"channel.js","sourceRoot":"","sources":["../../src/channel.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAKlC,QAAQ;AACR,MAAM,CAAC,MAAM,GAAG,GAAG,KAAc,CAAC;AAClC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAiB,CAAC;AAExC,MAAM,CAAC,MAAM,KAAK,GAAG,OAAgB,CAAC;AAEtC,WAAW;AACX,MAAM,CAAC,MAAM,CAAC,GAAG,GAAY,CAAC;AAC9B,MAAM,CAAC,MAAM,CAAC,GAAG,GAAY,CAAC;AAC9B,MAAM,CAAC,MAAM,EAAE,GAAG,IAAa,CAAC;AAChC,MAAM,CAAC,MAAM,EAAE,GAAG,IAAa,CAAC;AAEhC,kBAAkB;AAClB,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAC1C,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAE1C,eAAe;AACf,MAAM,CAAC,MAAM,MAAM,GAAG,QAAiB,CAAC;AACxC,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAC1C,MAAM,CAAC,MAAM,KAAK,GAAG,OAAgB,CAAC;AACtC,MAAM,CAAC,MAAM,MAAM,GAAG,QAAiB,CAAC;AAExC,eAAe;AACf,MAAM,CAAC,MAAM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,WAAW;YACd,OAAO,UAAU,CAAC;QAEpB,uEAAuE;QACvE,KAAK,KAAK,CAAC;QACX,KAAK,IAAI,CAAC;QACV,KAAK,MAAM;YACT,OAAO,UAAU,CAAC;QAEpB,2BAA2B;QAE3B,KAAK,QAAQ,CAAC;QACd,KAAK,SAAS,CAAC;QACf,KAAK,SAAS,CAAC;QACf,KAAK,UAAU,CAAC;QAChB,KAAK,MAAM,CAAC;QACZ,KAAK,GAAG,CAAC;QACT,KAAK,KAAK;YACR,OAAO,SAAS,CAAC;KACpB;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/channeldef.d.ts b/build/src/channeldef.d.ts new file mode 100644 index 0000000000..687494e8f6 --- /dev/null +++ b/build/src/channeldef.d.ts @@ -0,0 +1,938 @@ +import { Gradient, ScaleType, SignalRef, Text } from 'vega'; +import { Aggregate } from './aggregate'; +import { Axis } from './axis'; +import { Bin, BinParams } from './bin'; +import { Channel, ExtendedChannel, PolarPositionScaleChannel, PositionScaleChannel } from './channel'; +import { CompositeAggregate } from './compositemark'; +import { Config } from './config'; +import { DateTime } from './datetime'; +import { Encoding } from './encoding'; +import { ExprRef } from './expr'; +import { Guide, GuideEncodingConditionalValueDef, TitleMixins } from './guide'; +import { ImputeParams } from './impute'; +import { Legend } from './legend'; +import { LogicalComposition } from './logical'; +import { Mark, MarkDef, RelativeBandSize } from './mark'; +import { ParameterPredicate, Predicate } from './predicate'; +import { Scale } from './scale'; +import { Sort, SortOrder } from './sort'; +import { StackOffset } from './stack'; +import { BinnedTimeUnit, TimeUnit, TimeUnitParams } from './timeunit'; +import { AggregatedFieldDef, WindowFieldDef } from './transform'; +import { StandardType, Type } from './type'; +import { Dict } from './util'; +export type PrimitiveValue = number | string | boolean | null; +export type Value = PrimitiveValue | number[] | Gradient | Text | ES; +/** + * Definition object for a constant value (primitive value or gradient definition) of an encoding channel. + */ +export interface ValueDef { + /** + * A constant value in visual domain (e.g., `"red"` / `"#0099ff"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity). + */ + value: V; +} +export type PositionValueDef = ValueDef; +export type NumericValueDef = ValueDef; +/** + * A ValueDef with Condition where either the condition or the value are optional. + * { + * condition: {field: ...} | {value: ...}, + * value: ..., + * } + */ +/** + * @minProperties 1 + */ +export type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial> & { + /** + * A field definition or one or more value definition(s) with a parameter predicate. + */ + condition?: Conditional | Conditional> | Conditional>[]; +}; +export type StringValueDefWithCondition = ValueDefWithCondition, string | null>; +export type TypeForShape = 'nominal' | 'ordinal' | 'geojson'; +export type ConditionalTemplate = FieldDef | DatumDef | ValueDef | ExprRef | SignalRef; +export type Conditional = ConditionalPredicate | ConditionalParameter; +export type ConditionalPredicate = { + /** + * Predicate for triggering the condition + */ + test: LogicalComposition; +} & CD; +export type ConditionalParameter = ParameterPredicate & CD; +export declare function isConditionalParameter(c: Conditional): c is ConditionalParameter; +export interface ConditionValueDefMixins { + /** + * One or more value definition(s) with [a parameter or a test predicate](https://vega.github.io/vega-lite/docs/condition.html). + * + * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value) + * since Vega-Lite only allows at most one encoded field per encoding channel. + */ + condition?: Conditional> | Conditional>[]; +} +/** + * A FieldDef with Condition + * { + * condition: {value: ...}, + * field: ..., + * ... + * } + */ +export type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F & ConditionValueDefMixins; +export type MarkPropDef = FieldOrDatumDefWithCondition, V> | FieldOrDatumDefWithCondition, V> | ValueDefWithCondition, V>; +export type ColorDef = MarkPropDef; +export type NumericMarkPropDef = MarkPropDef; +export type NumericArrayMarkPropDef = MarkPropDef; +export type ShapeDef = MarkPropDef; +export type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>; +export type TextDef = FieldOrDatumDefWithCondition, Text> | FieldOrDatumDefWithCondition, Text> | ValueDefWithCondition, Text>; +/** + * A ValueDef with optional Condition + * { + * condition: {field: ...} | {value: ...}, + * value: ..., + * } + */ +/** + * Reference to a repeated value. + */ +export interface RepeatRef { + repeat: 'row' | 'column' | 'repeat' | 'layer'; +} +export type FieldName = string; +export type Field = FieldName | RepeatRef; +export declare function isRepeatRef(field: Field | any): field is RepeatRef; +/** @@hidden */ +export type HiddenCompositeAggregate = CompositeAggregate; +export interface FieldDefBase extends BandMixins { + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: F; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | HiddenCompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: B; +} +export declare function toFieldDefBase(fieldDef: FieldDef): FieldDefBase; +export interface TypeMixins { + /** + * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). + * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). + * + * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: + * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` + * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. + * + * __Default value:__ + * + * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: + * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). + * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale + * - `"ordinal"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`. + * + * 2) For a constant value in data domain (`datum`): + * - `"quantitative"` if the datum is a number + * - `"nominal"` if the datum is a string + * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) + * + * __Note:__ + * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. + * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). + * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. + * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). + * + * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. + */ + type?: T; +} +/** + * Definition object for a data field, its type and transformation of an encoding channel. + */ +export type TypedFieldDef = FieldDefBase & TitleMixins & TypeMixins; +export interface SortableFieldDef extends TypedFieldDef { + /** + * Sort order for the encoded field. + * + * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. + * + * For discrete fields, `sort` can be one of the following: + * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. + * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `"x"` or `"y"`) with an optional minus prefix for descending sort (e.g., `"-x"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `"sort": "-x"` is equivalent to `"sort": {"encoding": "x", "order": "descending"}`. + * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. + * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). + * - `null` indicating no sort. + * + * __Default value:__ `"ascending"` + * + * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`. + * + * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation. + */ + sort?: Sort; +} +export declare function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef; +export type ScaleFieldDef = SortableFieldDef & ScaleMixins; +export interface ScaleMixins { + /** + * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels. + * + * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable). + * + * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied. + * + * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation. + */ + scale?: Scale | null; +} +export type OffsetDef = ScaleFieldDef | ScaleDatumDef | ValueDef; +export interface DatumDef extends Partial>, BandMixins, TitleMixins { + /** + * A constant value in data domain. + */ + datum?: F extends RepeatRef ? V | RepeatRef : V; +} +export interface FormatMixins { + /** + * When used with the default `"number"` and `"time"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks. + * + * - If the format type is `"number"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format). + * - If the format type is `"time"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format). + * + * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples. + * + * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function. + * + * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format. + */ + format?: string | Dict; + /** + * The format type for labels. One of `"number"`, `"time"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type). + * + * __Default value:__ + * - `"time"` for temporal fields and ordinal and nominal fields with `timeUnit`. + * - `"number"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`. + */ + formatType?: 'number' | 'time' | string; +} +export type StringDatumDef = DatumDef & FormatMixins; +export type ScaleDatumDef = ScaleMixins & DatumDef; +/** + * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`. + */ +export type SecondaryFieldDef = FieldDefBase & TitleMixins; +export type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef; +export type SecondaryChannelDef = Encoding['x2' | 'y2']; +/** + * Field Def without scale (and without bin: "binned" support). + */ +export type FieldDefWithoutScale = TypedFieldDef; +export type LatLongFieldDef = FieldDefBase & TitleMixins & Partial>; +export type LatLongDef = LatLongFieldDef | DatumDef; +export type PositionFieldDefBase = ScaleFieldDef & PositionBaseMixins; +export type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins; +export interface PositionBaseMixins { + /** + * Type of stacking offset if the field should be stacked. + * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains. + * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart. + * + * `stack` can be one of the following values: + * - `"zero"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart). + * - `"normalize"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized) and pie charts [with percentage tooltip](https://vega.github.io/vega-lite/docs/arc.html#tooltip)).
+ * -`"center"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)). + * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart. + * + * __Default value:__ `zero` for plots with all of the following conditions are true: + * (1) the mark is `bar`, `area`, or `arc`; + * (2) the stacked measure channel (x or y) has a linear scale; + * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default. + * + * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation. + */ + stack?: StackOffset | null | boolean; +} +export interface BandMixins { + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; +} +export type PositionFieldDef = PositionFieldDefBase & PositionMixins; +export type PositionDatumDef = PositionDatumDefBase & PositionMixins; +export type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef; +export interface PositionMixins { + /** + * An object defining properties of axis's gridlines, ticks and labels. + * If `null`, the axis for the encoding channel will be removed. + * + * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied. + * + * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation. + */ + axis?: Axis | null; + /** + * An object defining the properties of the Impute Operation to be applied. + * The field value of the other positional channel is taken as `key` of the `Impute` Operation. + * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation. + * + * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation. + */ + impute?: ImputeParams | null; +} +export type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef; +export declare function getBandPosition({ fieldDef, fieldDef2, markDef: mark, config }: { + fieldDef: FieldDef | DatumDef; + fieldDef2?: SecondaryChannelDef; + markDef: MarkDef; + config: Config; +}): number; +export declare function getBandSize({ channel, fieldDef, fieldDef2, markDef: mark, config, scaleType, useVlSizeChannel }: { + channel: PositionScaleChannel | PolarPositionScaleChannel; + fieldDef: ChannelDef; + fieldDef2?: SecondaryChannelDef; + markDef: MarkDef; + config: Config; + scaleType: ScaleType; + useVlSizeChannel?: boolean; +}): number | RelativeBandSize | SignalRef; +export declare function hasBandEnd(fieldDef: FieldDef, fieldDef2: SecondaryChannelDef, markDef: MarkDef, config: Config): boolean; +/** + * Field definition of a mark property, which can contain a legend. + */ +export type MarkPropFieldDef = ScaleFieldDef & LegendMixins; +export type MarkPropDatumDef = LegendMixins & ScaleDatumDef; +export type MarkPropFieldOrDatumDef = MarkPropFieldDef | MarkPropDatumDef; +export interface LegendMixins { + /** + * An object defining properties of the legend. + * If `null`, the legend for the encoding channel will be removed. + * + * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied. + * + * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation. + */ + legend?: Legend | null; +} +export type OrderFieldDef = FieldDefWithoutScale & OrderOnlyDef; +export interface OrderOnlyDef { + /** + * The sort order. One of `"ascending"` (default) or `"descending"`. + */ + sort?: SortOrder; +} +export declare function isOrderOnlyDef(orderDef: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef): orderDef is OrderOnlyDef; +export type OrderValueDef = ConditionValueDefMixins & NumericValueDef; +export interface StringFieldDef extends FieldDefWithoutScale, FormatMixins { +} +export type FieldDef = SecondaryFieldDef | TypedFieldDef; +export type ChannelDef = Encoding[keyof Encoding]; +export declare function isConditionalDef | GuideEncodingConditionalValueDef | ExprRef | SignalRef>(channelDef: CD): channelDef is CD & { + condition: Conditional; +}; +/** + * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef + */ +export declare function hasConditionalFieldDef(channelDef: Partial>): channelDef is { + condition: Conditional>; +}; +export declare function hasConditionalFieldOrDatumDef(channelDef: ChannelDef): channelDef is { + condition: Conditional>; +}; +export declare function hasConditionalValueDef(channelDef: ChannelDef): channelDef is ValueDef & { + condition: Conditional> | Conditional>[]; +}; +export declare function isFieldDef(channelDef: Partial> | FieldDefBase | DatumDef): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef; +export declare function channelDefType(channelDef: ChannelDef): Type | undefined; +export declare function isDatumDef(channelDef: Partial> | FieldDefBase | DatumDef): channelDef is DatumDef; +export declare function isContinuousFieldOrDatumDef(cd: ChannelDef): cd is TypedFieldDef | DatumDef; +export declare function isUnbinnedQuantitativeFieldOrDatumDef(cd: ChannelDef): boolean; +export declare function isNumericDataDef(cd: ChannelDef): cd is DatumDef; +export declare function isFieldOrDatumDef(channelDef: Partial>): channelDef is FieldDef | DatumDef; +export declare function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef; +export declare function isValueDef(channelDef: Partial>): channelDef is ValueDef; +export declare function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef; +export declare function isPositionFieldOrDatumDef(channelDef: ChannelDef): channelDef is PositionFieldDef | PositionDatumDef; +export declare function isMarkPropFieldOrDatumDef(channelDef: ChannelDef): channelDef is MarkPropFieldDef | MarkPropDatumDef; +export declare function isStringFieldOrDatumDef(channelDef: ChannelDef): channelDef is StringFieldDef | StringDatumDef; +export declare function toStringFieldDef(fieldDef: FieldDef): StringFieldDef; +export interface FieldRefOption { + /** Exclude bin, aggregate, timeUnit */ + nofn?: boolean; + /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */ + expr?: 'datum' | 'parent' | 'datum.datum'; + /** Prepend fn with custom function prefix */ + prefix?: string; + /** Append suffix to the field ref for bin (default='start') */ + binSuffix?: 'end' | 'range' | 'mid'; + /** Append suffix to the field ref (general) */ + suffix?: string; + /** + * Use the field name for `as` in a transform. + * We will not escape nested accesses because Vega transform outputs cannot be nested. + */ + forAs?: boolean; +} +/** + * Get a Vega field reference from a Vega-Lite field def. + */ +export declare function vgField(fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef, opt?: FieldRefOption): string; +export declare function isDiscrete(def: TypedFieldDef | DatumDef): boolean; +export declare function isDiscretizing(def: TypedFieldDef | DatumDef): boolean; +export declare function isCount(fieldDef: FieldDefBase): boolean; +export type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string; +export declare function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config): string; +export declare function functionalTitleFormatter(fieldDef: FieldDefBase): string; +export declare const defaultTitleFormatter: FieldTitleFormatter; +export declare function setTitleFormatter(formatter: FieldTitleFormatter): void; +export declare function resetTitleFormatter(): void; +export declare function title(fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef, config: Config, { allowDisabling, includeDefault }: { + allowDisabling: boolean; + includeDefault?: boolean; +}): SignalRef | Text; +export declare function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide; +export declare function defaultTitle(fieldDef: FieldDefBase, config: Config): string; +export declare function getFormatMixins(fieldDef: TypedFieldDef | DatumDef): { + format: string | Dict; + formatType: string; +}; +export declare function defaultType>(fieldDef: T, channel: ExtendedChannel): Type; +/** + * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. + * @param channelDef + */ +export declare function getFieldDef(channelDef: ChannelDef): FieldDef; +export declare function getFieldOrDatumDef = ChannelDef>(channelDef: CD): FieldDef | DatumDef; +/** + * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. + */ +export declare function initChannelDef(channelDef: ChannelDef, channel: ExtendedChannel, config: Config, opt?: { + compositeMark?: boolean; +}): ChannelDef; +export declare function initFieldOrDatumDef(fd: FieldDef | DatumDef, channel: ExtendedChannel, config: Config, opt: { + compositeMark?: boolean; +}): FieldDef | DatumDef; +export declare function initFieldDef(fd: FieldDef, channel: ExtendedChannel, { compositeMark }?: { + compositeMark?: boolean; +}): { + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: string; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: BinnedTimeUnit | TimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | CompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: null; + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; + title?: SignalRef | Text; +} | { + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: string; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: BinnedTimeUnit | TimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | CompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: boolean | BinParams | "binned"; + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; + title?: SignalRef | Text; + /** + * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). + * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). + * + * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: + * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` + * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. + * + * __Default value:__ + * + * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: + * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). + * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale + * - `"ordinal"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`. + * + * 2) For a constant value in data domain (`datum`): + * - `"quantitative"` if the datum is a number + * - `"nominal"` if the datum is a string + * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) + * + * __Note:__ + * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. + * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). + * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. + * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). + * + * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. + */ + type?: any; +} | { + sort: { + encoding: "fill" | "stroke" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "x" | "y" | "shape"; + order?: undefined; + }; + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: string; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: BinnedTimeUnit | TimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | CompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: boolean | BinParams; + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; + title?: SignalRef | Text; + /** + * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). + * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). + * + * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: + * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` + * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. + * + * __Default value:__ + * + * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: + * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). + * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale + * - `"ordinal"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`. + * + * 2) For a constant value in data domain (`datum`): + * - `"quantitative"` if the datum is a number + * - `"nominal"` if the datum is a string + * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) + * + * __Note:__ + * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. + * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). + * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. + * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). + * + * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. + */ + type?: StandardType; +} | { + sort: { + encoding: "fill" | "stroke" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "x" | "y" | "shape"; + order: string; + }; + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: string; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: BinnedTimeUnit | TimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | CompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: boolean | BinParams; + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; + title?: SignalRef | Text; + /** + * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). + * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). + * + * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: + * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` + * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. + * + * __Default value:__ + * + * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: + * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). + * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale + * - `"ordinal"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`. + * + * 2) For a constant value in data domain (`datum`): + * - `"quantitative"` if the datum is a number + * - `"nominal"` if the datum is a string + * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) + * + * __Note:__ + * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. + * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). + * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. + * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). + * + * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. + */ + type?: StandardType; +} | { + header: { + labelOrient: import("vega").Orient; + titleOrient: import("vega").Orient; + titleAnchor?: import("vega").TitleAnchor; + titleAlign?: any; + titleAngle?: number; + titleBaseline?: any; + titleColor?: any; + titleFont?: any; + titleFontSize?: any; + titleFontStyle?: any; + titleFontWeight?: any; + titleLimit?: any; + titleLineHeight?: any; + titlePadding?: any; + labels?: boolean; + labelAlign?: any; + labelBaseline?: any; + labelAnchor?: import("vega").TitleAnchor; + labelExpr?: string; + labelAngle?: number; + labelColor?: any; + labelFont?: any; + labelFontSize?: any; + labelFontStyle?: any; + labelFontWeight?: any; + labelLimit?: any; + labelLineHeight?: any; + labelPadding?: any; + /** + * When used with the default `"number"` and `"time"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks. + * + * - If the format type is `"number"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format). + * - If the format type is `"time"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format). + * + * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples. + * + * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function. + * + * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format. + */ + format?: string | Dict; + /** + * The format type for labels. One of `"number"`, `"time"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type). + * + * __Default value:__ + * - `"time"` for temporal fields and ordinal and nominal fields with `timeUnit`. + * - `"number"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`. + */ + formatType?: string; + title?: SignalRef | Text; + }; + sort?: SortOrder | import("./sort").SortArray | import("./sort").EncodingSortField; + /** + * __Required.__ A string defining the name of the field from which to pull a data value + * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator. + * + * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation. + * + * __Notes:__ + * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `"field": "foo.bar"` and `"field": "foo['bar']"`). + * If field names contain dots or brackets but are not nested, you can use `\\` to escape dots and brackets (e.g., `"a\\.b"` and `"a\\[0\\]"`). + * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html). + * 2) `field` is not required if `aggregate` is `count`. + */ + field?: string; + /** + * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field. + * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation. + */ + timeUnit?: BinnedTimeUnit | TimeUnit | TimeUnitParams; + /** + * Aggregation function for the field + * (e.g., `"mean"`, `"sum"`, `"median"`, `"min"`, `"max"`, `"count"`). + * + * __Default value:__ `undefined` (None) + * + * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation. + */ + aggregate?: Aggregate | CompositeAggregate; + /** + * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`"binned"`). + * + * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied. + * + * - If `"binned"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property. + * + * __Default value:__ `false` + * + * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation. + */ + bin?: boolean | BinParams; + /** + * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`. + * + * @minimum 0 + * @maximum 1 + */ + bandPosition?: number; + title?: SignalRef | Text; + /** + * The type of measurement (`"quantitative"`, `"temporal"`, `"ordinal"`, or `"nominal"`) for the encoded field or constant value (`datum`). + * It can also be a `"geojson"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html). + * + * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if: + * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit` + * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`. + * + * __Default value:__ + * + * 1) For a data `field`, `"nominal"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria: + * - `"quantitative"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `"argmin"` and `"argmax"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type). + * - `"temporal"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale + * - `"ordinal"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`. + * + * 2) For a constant value in data domain (`datum`): + * - `"quantitative"` if the datum is a number + * - `"nominal"` if the datum is a string + * - `"temporal"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html) + * + * __Note:__ + * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data. + * - Data values for a temporal field can be either a date-time string (e.g., `"2015-03-07 12:32:17"`, `"17:01"`, `"2015-03-16"`. `"2015"`) or a timestamp number (e.g., `1552199579097`). + * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `"quantitative"` (for using a linear bin scale) or [`"ordinal"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `"temporal"` (default, for using a temporal scale) or [`"ordinal"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin). + * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `"cat"` using `{"aggregate": "distinct", "field": "cat"}`. The `"type"` of the aggregate output is `"quantitative"`. + * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`). + * + * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation. + */ + type?: StandardType; +}; +export declare function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel): BinParams; +export declare function channelCompatibility(fieldDef: TypedFieldDef, channel: ExtendedChannel): { + compatible: boolean; + warning?: string; +}; +/** + * Check if the field def uses a time format or does not use any format but is temporal + * (this does not cover field defs that are temporal but use a number format). + */ +export declare function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean; +/** + * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. + */ +export declare function isTimeFieldDef(def: FieldDef | DatumDef): boolean; +/** + * Getting a value associated with a fielddef. + * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) + */ +export declare function valueExpr(v: number | string | boolean | DateTime | ExprRef | SignalRef | number[], { timeUnit, type, wrapTime, undefinedIfExprNotRequired }: { + timeUnit: TimeUnit | TimeUnitParams; + type?: Type; + wrapTime?: boolean; + undefinedIfExprNotRequired?: boolean; +}): string; +/** + * Standardize value array -- convert each value to Vega expression if applicable + */ +export declare function valueArray(fieldOrDatumDef: TypedFieldDef | DatumDef, values: (number | string | boolean | DateTime)[]): (string | number | boolean | DateTime | { + signal: string; +})[]; +/** + * Checks whether a fieldDef for a particular channel requires a computed bin range. + */ +export declare function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean; +//# sourceMappingURL=channeldef.d.ts.map \ No newline at end of file diff --git a/build/src/channeldef.d.ts.map b/build/src/channeldef.d.ts.map new file mode 100644 index 0000000000..8199c95467 --- /dev/null +++ b/build/src/channeldef.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"channeldef.d.ts","s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,wBAAgB,8BAA8B,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,GAAG,OAAO,CAGpG;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,QAAQ,GAAG,OAAO,CAErE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CACvB,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,EAAE,EACxE,EACE,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,0BAA0B,EAC3B,EAAE;IACD,QAAQ,EAAE,QAAQ,GAAG,cAAc,CAAC;IACpC,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0BAA0B,CAAC,EAAE,OAAO,CAAC;CACtC,GACA,MAAM,CA6BR;AAED;;GAEG;AACH,wBAAgB,UAAU,CACxB,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,EACjD,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC,EAAE;;KAkBjD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAStF"} \ No newline at end of file diff --git a/build/src/channeldef.js b/build/src/channeldef.js new file mode 100644 index 0000000000..ef56b67466 --- /dev/null +++ b/build/src/channeldef.js @@ -0,0 +1,723 @@ +import { isArray, isBoolean, isNumber, isString } from 'vega-util'; +import { isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp } from './aggregate'; +import { autoMaxBins, binToString, isBinned, isBinning } from './bin'; +import { ANGLE, COLOR, COLUMN, DESCRIPTION, DETAIL, FACET, FILL, FILLOPACITY, getSizeChannel, HREF, isScaleChannel, isSecondaryRangeChannel, isXorY, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, ROW, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, TEXT, THETA, THETA2, TOOLTIP, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel'; +import { getMarkConfig, getMarkPropOrConfig } from './compile/common'; +import { isCustomFormatType } from './compile/format'; +import { dateTimeToExpr, isDateTime } from './datetime'; +import { isExprRef } from './expr'; +import * as log from './log'; +import { isRectBasedMark } from './mark'; +import { hasDiscreteDomain, isContinuousToDiscrete, SCALE_CATEGORY_INDEX } from './scale'; +import { isSortByChannel } from './sort'; +import { isFacetFieldDef } from './spec/facet'; +import { getTimeUnitParts, isBinnedTimeUnit, isLocalSingleTimeUnit, normalizeTimeUnit, timeUnitToString } from './timeunit'; +import { getFullName, QUANTITATIVE } from './type'; +import { flatAccessWithDatum, getFirstDefined, internalField, omit, removePathFromField, replacePathInField, stringify, titleCase } from './util'; +import { isSignalRef } from './vega.schema'; +export function isConditionalParameter(c) { + return c['param']; +} +export function isRepeatRef(field) { + return field && !isString(field) && 'repeat' in field; +} +export function toFieldDefBase(fieldDef) { + const { field, timeUnit, bin, aggregate } = fieldDef; + return { + ...(timeUnit ? { timeUnit } : {}), + ...(bin ? { bin } : {}), + ...(aggregate ? { aggregate } : {}), + field + }; +} +export function isSortableFieldDef(fieldDef) { + return 'sort' in fieldDef; +} +export function getBandPosition({ fieldDef, fieldDef2, markDef: mark, config }) { + if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) { + return fieldDef.bandPosition; + } + if (isFieldDef(fieldDef)) { + const { timeUnit, bin } = fieldDef; + if (timeUnit && !fieldDef2) { + return getMarkConfig('timeUnitBandPosition', mark, config); + } + else if (isBinning(bin)) { + return 0.5; + } + } + return undefined; +} +export function getBandSize({ channel, fieldDef, fieldDef2, markDef: mark, config, scaleType, useVlSizeChannel }) { + const sizeChannel = getSizeChannel(channel); + const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, { + vgChannel: sizeChannel + }); + if (size !== undefined) { + return size; + } + if (isFieldDef(fieldDef)) { + const { timeUnit, bin } = fieldDef; + if (timeUnit && !fieldDef2) { + return { band: getMarkConfig('timeUnitBandSize', mark, config) }; + } + else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) { + return { band: 1 }; + } + } + if (isRectBasedMark(mark.type)) { + if (scaleType) { + if (hasDiscreteDomain(scaleType)) { + return config[mark.type]?.discreteBandSize || { band: 1 }; + } + else { + return config[mark.type]?.continuousBandSize; + } + } + return config[mark.type]?.discreteBandSize; + } + return undefined; +} +export function hasBandEnd(fieldDef, fieldDef2, markDef, config) { + if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) { + // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit + // doesn't have to use bandEnd if there is no bandPosition. + return getBandPosition({ fieldDef, fieldDef2, markDef, config }) !== undefined; + } + return false; +} +export function isOrderOnlyDef(orderDef) { + return orderDef && !!orderDef.sort && !orderDef['field']; +} +export function isConditionalDef(channelDef) { + return channelDef && 'condition' in channelDef; +} +/** + * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef + */ +export function hasConditionalFieldDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && !isArray(condition) && isFieldDef(condition); +} +export function hasConditionalFieldOrDatumDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && !isArray(condition) && isFieldOrDatumDef(condition); +} +export function hasConditionalValueDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && (isArray(condition) || isValueDef(condition)); +} +export function isFieldDef(channelDef) { + // TODO: we can't use field in channelDef here as it's somehow failing runtime test + return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); +} +export function channelDefType(channelDef) { + return channelDef?.['type']; +} +export function isDatumDef(channelDef) { + return channelDef && 'datum' in channelDef; +} +export function isContinuousFieldOrDatumDef(cd) { + // TODO: make datum support DateTime object + return (isTypedFieldDef(cd) && !isDiscrete(cd)) || isNumericDataDef(cd); +} +export function isUnbinnedQuantitativeFieldOrDatumDef(cd) { + // TODO: make datum support DateTime object + return (isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin) || isNumericDataDef(cd); +} +export function isNumericDataDef(cd) { + return isDatumDef(cd) && isNumber(cd.datum); +} +export function isFieldOrDatumDef(channelDef) { + return isFieldDef(channelDef) || isDatumDef(channelDef); +} +export function isTypedFieldDef(channelDef) { + return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; +} +export function isValueDef(channelDef) { + return channelDef && 'value' in channelDef && 'value' in channelDef; +} +export function isScaleFieldDef(channelDef) { + return channelDef && ('scale' in channelDef || 'sort' in channelDef); +} +export function isPositionFieldOrDatumDef(channelDef) { + return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); +} +export function isMarkPropFieldOrDatumDef(channelDef) { + return channelDef && 'legend' in channelDef; +} +export function isStringFieldOrDatumDef(channelDef) { + return channelDef && ('format' in channelDef || 'formatType' in channelDef); +} +export function toStringFieldDef(fieldDef) { + // omit properties that don't exist in string field defs + return omit(fieldDef, ['legend', 'axis', 'header', 'scale']); +} +function isOpFieldDef(fieldDef) { + return 'op' in fieldDef; +} +/** + * Get a Vega field reference from a Vega-Lite field def. + */ +export function vgField(fieldDef, opt = {}) { + let field = fieldDef.field; + const prefix = opt.prefix; + let suffix = opt.suffix; + let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped + if (isCount(fieldDef)) { + field = internalField('count'); + } + else { + let fn; + if (!opt.nofn) { + if (isOpFieldDef(fieldDef)) { + fn = fieldDef.op; + } + else { + const { bin, aggregate, timeUnit } = fieldDef; + if (isBinning(bin)) { + fn = binToString(bin); + suffix = (opt.binSuffix ?? '') + (opt.suffix ?? ''); + } + else if (aggregate) { + if (isArgmaxDef(aggregate)) { + argAccessor = `["${field}"]`; + field = `argmax_${aggregate.argmax}`; + } + else if (isArgminDef(aggregate)) { + argAccessor = `["${field}"]`; + field = `argmin_${aggregate.argmin}`; + } + else { + fn = String(aggregate); + } + } + else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + fn = timeUnitToString(timeUnit); + suffix = ((!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? ''); + } + } + } + if (fn) { + field = field ? `${fn}_${field}` : fn; + } + } + if (suffix) { + field = `${field}_${suffix}`; + } + if (prefix) { + field = `${prefix}_${field}`; + } + if (opt.forAs) { + return removePathFromField(field); + } + else if (opt.expr) { + // Expression to access flattened field. No need to escape dots. + return flatAccessWithDatum(field, opt.expr) + argAccessor; + } + else { + // We flattened all fields so paths should have become dot. + return replacePathInField(field) + argAccessor; + } +} +export function isDiscrete(def) { + switch (def.type) { + case 'nominal': + case 'ordinal': + case 'geojson': + return true; + case 'quantitative': + return isFieldDef(def) && !!def.bin; + case 'temporal': + return false; + } + throw new Error(log.message.invalidFieldType(def.type)); +} +export function isDiscretizing(def) { + return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type); +} +export function isCount(fieldDef) { + return fieldDef.aggregate === 'count'; +} +export function verbalTitleFormatter(fieldDef, config) { + const { field, bin, timeUnit, aggregate } = fieldDef; + if (aggregate === 'count') { + return config.countTitle; + } + else if (isBinning(bin)) { + return `${field} (binned)`; + } + else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + const unit = normalizeTimeUnit(timeUnit)?.unit; + if (unit) { + return `${field} (${getTimeUnitParts(unit).join('-')})`; + } + } + else if (aggregate) { + if (isArgmaxDef(aggregate)) { + return `${field} for max ${aggregate.argmax}`; + } + else if (isArgminDef(aggregate)) { + return `${field} for min ${aggregate.argmin}`; + } + else { + return `${titleCase(aggregate)} of ${field}`; + } + } + return field; +} +export function functionalTitleFormatter(fieldDef) { + const { aggregate, bin, timeUnit, field } = fieldDef; + if (isArgmaxDef(aggregate)) { + return `${field} for argmax(${aggregate.argmax})`; + } + else if (isArgminDef(aggregate)) { + return `${field} for argmin(${aggregate.argmin})`; + } + const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined; + const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin'); + if (fn) { + return `${fn.toUpperCase()}(${field})`; + } + else { + return field; + } +} +export const defaultTitleFormatter = (fieldDef, config) => { + switch (config.fieldTitle) { + case 'plain': + return fieldDef.field; + case 'functional': + return functionalTitleFormatter(fieldDef); + default: + return verbalTitleFormatter(fieldDef, config); + } +}; +let titleFormatter = defaultTitleFormatter; +export function setTitleFormatter(formatter) { + titleFormatter = formatter; +} +export function resetTitleFormatter() { + setTitleFormatter(defaultTitleFormatter); +} +export function title(fieldOrDatumDef, config, { allowDisabling, includeDefault = true }) { + const guideTitle = getGuide(fieldOrDatumDef)?.title; + if (!isFieldDef(fieldOrDatumDef)) { + return guideTitle ?? fieldOrDatumDef.title; + } + const fieldDef = fieldOrDatumDef; + const def = includeDefault ? defaultTitle(fieldDef, config) : undefined; + if (allowDisabling) { + return getFirstDefined(guideTitle, fieldDef.title, def); + } + else { + return guideTitle ?? fieldDef.title ?? def; + } +} +export function getGuide(fieldDef) { + if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { + return fieldDef.axis; + } + else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { + return fieldDef.legend; + } + else if (isFacetFieldDef(fieldDef) && fieldDef.header) { + return fieldDef.header; + } + return undefined; +} +export function defaultTitle(fieldDef, config) { + return titleFormatter(fieldDef, config); +} +export function getFormatMixins(fieldDef) { + if (isStringFieldOrDatumDef(fieldDef)) { + const { format, formatType } = fieldDef; + return { format, formatType }; + } + else { + const guide = getGuide(fieldDef) ?? {}; + const { format, formatType } = guide; + return { format, formatType }; + } +} +export function defaultType(fieldDef, channel) { + switch (channel) { + case 'latitude': + case 'longitude': + return 'quantitative'; + case 'row': + case 'column': + case 'facet': + case 'shape': + case 'strokeDash': + return 'nominal'; + case 'order': + return 'ordinal'; + } + if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) { + return 'ordinal'; + } + const { aggregate, bin, timeUnit } = fieldDef; + if (timeUnit) { + return 'temporal'; + } + if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) { + return 'quantitative'; + } + if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) { + switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { + case 'numeric': + case 'discretizing': + return 'quantitative'; + case 'time': + return 'temporal'; + } + } + return 'nominal'; +} +/** + * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. + * @param channelDef + */ +export function getFieldDef(channelDef) { + if (isFieldDef(channelDef)) { + return channelDef; + } + else if (hasConditionalFieldDef(channelDef)) { + return channelDef.condition; + } + return undefined; +} +export function getFieldOrDatumDef(channelDef) { + if (isFieldOrDatumDef(channelDef)) { + return channelDef; + } + else if (hasConditionalFieldOrDatumDef(channelDef)) { + return channelDef.condition; + } + return undefined; +} +/** + * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. + */ +export function initChannelDef(channelDef, channel, config, opt = {}) { + if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) { + const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean'; + log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef)); + return { value: channelDef }; + } + // If a fieldDef contains a field, we need type. + if (isFieldOrDatumDef(channelDef)) { + return initFieldOrDatumDef(channelDef, channel, config, opt); + } + else if (hasConditionalFieldOrDatumDef(channelDef)) { + return { + ...channelDef, + // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition + condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) + }; + } + return channelDef; +} +export function initFieldOrDatumDef(fd, channel, config, opt) { + if (isStringFieldOrDatumDef(fd)) { + const { format, formatType, ...rest } = fd; + if (isCustomFormatType(formatType) && !config.customFormatTypes) { + log.warn(log.message.customFormatTypeNotAllowed(channel)); + return initFieldOrDatumDef(rest, channel, config, opt); + } + } + else { + const guideType = isPositionFieldOrDatumDef(fd) + ? 'axis' + : isMarkPropFieldOrDatumDef(fd) + ? 'legend' + : isFacetFieldDef(fd) + ? 'header' + : null; + if (guideType && fd[guideType]) { + const { format, formatType, ...newGuide } = fd[guideType]; + if (isCustomFormatType(formatType) && !config.customFormatTypes) { + log.warn(log.message.customFormatTypeNotAllowed(channel)); + return initFieldOrDatumDef({ ...fd, [guideType]: newGuide }, channel, config, opt); + } + } + } + if (isFieldDef(fd)) { + return initFieldDef(fd, channel, opt); + } + return initDatumDef(fd); +} +function initDatumDef(datumDef) { + let type = datumDef['type']; + if (type) { + return datumDef; + } + const { datum } = datumDef; + type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; + return { ...datumDef, type }; +} +export function initFieldDef(fd, channel, { compositeMark = false } = {}) { + const { aggregate, timeUnit, bin, field } = fd; + const fieldDef = { ...fd }; + // Drop invalid aggregate + if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { + log.warn(log.message.invalidAggregate(aggregate)); + delete fieldDef.aggregate; + } + // Normalize Time Unit + if (timeUnit) { + fieldDef.timeUnit = normalizeTimeUnit(timeUnit); + } + if (field) { + fieldDef.field = `${field}`; + } + // Normalize bin + if (isBinning(bin)) { + fieldDef.bin = normalizeBin(bin, channel); + } + if (isBinned(bin) && !isXorY(channel)) { + log.warn(log.message.channelShouldNotBeUsedForBinned(channel)); + } + // Normalize Type + if (isTypedFieldDef(fieldDef)) { + const { type } = fieldDef; + const fullType = getFullName(type); + if (type !== fullType) { + // convert short type to full type + fieldDef.type = fullType; + } + if (type !== 'quantitative') { + if (isCountingAggregateOp(aggregate)) { + log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate)); + fieldDef.type = 'quantitative'; + } + } + } + else if (!isSecondaryRangeChannel(channel)) { + // If type is empty / invalid, then augment with default type + const newType = defaultType(fieldDef, channel); + fieldDef['type'] = newType; + } + if (isTypedFieldDef(fieldDef)) { + const { compatible, warning } = channelCompatibility(fieldDef, channel) || {}; + if (compatible === false) { + log.warn(warning); + } + } + if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) { + const { sort } = fieldDef; + if (isSortByChannel(sort)) { + return { + ...fieldDef, + sort: { encoding: sort } + }; + } + const sub = sort.substr(1); + if (sort.charAt(0) === '-' && isSortByChannel(sub)) { + return { + ...fieldDef, + sort: { encoding: sub, order: 'descending' } + }; + } + } + if (isFacetFieldDef(fieldDef)) { + const { header } = fieldDef; + if (header) { + const { orient, ...rest } = header; + if (orient) { + return { + ...fieldDef, + header: { + ...rest, + labelOrient: header.labelOrient || orient, + titleOrient: header.titleOrient || orient + } + }; + } + } + } + return fieldDef; +} +export function normalizeBin(bin, channel) { + if (isBoolean(bin)) { + return { maxbins: autoMaxBins(channel) }; + } + else if (bin === 'binned') { + return { + binned: true + }; + } + else if (!bin.maxbins && !bin.step) { + return { ...bin, maxbins: autoMaxBins(channel) }; + } + else { + return bin; + } +} +const COMPATIBLE = { compatible: true }; +export function channelCompatibility(fieldDef, channel) { + const type = fieldDef.type; + if (type === 'geojson' && channel !== 'shape') { + return { + compatible: false, + warning: `Channel ${channel} should not be used with a geojson data.` + }; + } + switch (channel) { + case ROW: + case COLUMN: + case FACET: + if (!isDiscrete(fieldDef)) { + return { + compatible: false, + warning: log.message.channelShouldBeDiscrete(channel) + }; + } + return COMPATIBLE; + case X: + case Y: + case XOFFSET: + case YOFFSET: + case COLOR: + case FILL: + case STROKE: + case TEXT: + case DETAIL: + case KEY: + case TOOLTIP: + case HREF: + case URL: + case ANGLE: + case THETA: + case RADIUS: + case DESCRIPTION: + return COMPATIBLE; + case LONGITUDE: + case LONGITUDE2: + case LATITUDE: + case LATITUDE2: + if (type !== QUANTITATIVE) { + return { + compatible: false, + warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.` + }; + } + return COMPATIBLE; + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEWIDTH: + case SIZE: + case THETA2: + case RADIUS2: + case X2: + case Y2: + if (type === 'nominal' && !fieldDef['sort']) { + return { + compatible: false, + warning: `Channel ${channel} should not be used with an unsorted discrete field.` + }; + } + return COMPATIBLE; + case SHAPE: + case STROKEDASH: + if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) { + return { + compatible: false, + warning: log.message.channelShouldBeDiscreteOrDiscretizing(channel) + }; + } + return COMPATIBLE; + case ORDER: + if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { + return { + compatible: false, + warning: `Channel order is inappropriate for nominal field, which has no inherent order.` + }; + } + return COMPATIBLE; + } +} +/** + * Check if the field def uses a time format or does not use any format but is temporal + * (this does not cover field defs that are temporal but use a number format). + */ +export function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) { + const { formatType } = getFormatMixins(fieldOrDatumDef); + return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef)); +} +/** + * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. + */ +export function isTimeFieldDef(def) { + return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit)); +} +/** + * Getting a value associated with a fielddef. + * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) + */ +export function valueExpr(v, { timeUnit, type, wrapTime, undefinedIfExprNotRequired }) { + const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit; + let isTime = unit || type === 'temporal'; + let expr; + if (isExprRef(v)) { + expr = v.expr; + } + else if (isSignalRef(v)) { + expr = v.signal; + } + else if (isDateTime(v)) { + isTime = true; + expr = dateTimeToExpr(v); + } + else if (isString(v) || isNumber(v)) { + if (isTime) { + expr = `datetime(${stringify(v)})`; + if (isLocalSingleTimeUnit(unit)) { + // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit + if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) { + expr = dateTimeToExpr({ [unit]: v }); + } + } + } + } + if (expr) { + return wrapTime && isTime ? `time(${expr})` : expr; + } + // number or boolean or normal string + return undefinedIfExprNotRequired ? undefined : stringify(v); +} +/** + * Standardize value array -- convert each value to Vega expression if applicable + */ +export function valueArray(fieldOrDatumDef, values) { + const { type } = fieldOrDatumDef; + return values.map(v => { + const timeUnit = isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined; + const expr = valueExpr(v, { + timeUnit, + type, + undefinedIfExprNotRequired: true + }); + // return signal for the expression if we need an expression + if (expr !== undefined) { + return { signal: expr }; + } + // otherwise just return the original value + return v; + }); +} +/** + * Checks whether a fieldDef for a particular channel requires a computed bin range. + */ +export function binRequiresRange(fieldDef, channel) { + if (!isBinning(fieldDef.bin)) { + console.warn('Only call this method for binned field defs.'); + return false; + } + // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. + // We could check whether the axis or legend exists (not disabled) but that seems overkill. + return isScaleChannel(channel) && ['ordinal', 'nominal'].includes(fieldDef.type); +} +//# sourceMappingURL=channeldef.js.map \ No newline at end of file diff --git a/build/src/channeldef.js.map b/build/src/channeldef.js.map new file mode 100644 index 0000000000..995c426a0c --- /dev/null +++ b/build/src/channeldef.js.map @@ -0,0 +1 @@ +{"version":3,"file":"channeldef.js","sourceRoot":"","sources":["../../src/channeldef.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AACjE,OAAO,EAAY,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,qBAAqB,EAAC,MAAM,aAAa,CAAC;AAEtG,OAAO,EAAC,WAAW,EAAkB,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAC,MAAM,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,GAAG,eAAe,CAAC;IAC/B,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACpB,MAAM,QAAQ,GACZ,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,gBAAgB,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;QACpH,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,EAAE;YACxB,QAAQ;YACR,IAAI;YACJ,0BAA0B,EAAE,IAAI;SACjC,CAAC,CAAC;QACH,4DAA4D;QAC5D,IAAI,IAAI,KAAK,SAAS,EAAE;YACtB,OAAO,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC;SACvB;QACD,2CAA2C;QAC3C,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAA0B,EAAE,OAAgB;IAC3E,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;QAC5B,OAAO,CAAC,IAAI,CAAC,8CAA8C,CAAC,CAAC;QAC7D,OAAO,KAAK,CAAC;KACd;IAED,6JAA6J;IAC7J,2FAA2F;IAC3F,OAAO,cAAc,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,QAAQ,CAAE,QAAkC,CAAC,IAAI,CAAC,CAAC;AAC9G,CAAC"} \ No newline at end of file diff --git a/build/src/compile/axis/assemble.d.ts b/build/src/compile/axis/assemble.d.ts new file mode 100644 index 0000000000..22e5b4222a --- /dev/null +++ b/build/src/compile/axis/assemble.d.ts @@ -0,0 +1,14 @@ +import { Axis as VgAxis, NewSignal, SignalRef } from 'vega'; +import { Config } from '../../config'; +import { Model } from '../model'; +import { AxisComponent, AxisComponentIndex } from './component'; +export declare function assembleAxis(axisCmpt: AxisComponent, kind: 'main' | 'grid', config: Config, opt?: { + header: boolean; +}): VgAxis; +/** + * Add axis signals so grid line works correctly + * (Fix https://github.com/vega/vega-lite/issues/4226) + */ +export declare function assembleAxisSignals(model: Model): NewSignal[]; +export declare function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[]; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/assemble.d.ts.map b/build/src/compile/axis/assemble.d.ts.map new file mode 100644 index 0000000000..4735251ead --- /dev/null +++ b/build/src/compile/axis/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,IAAI,MAAM,EAAc,SAAS,EAAE,SAAS,EAAO,MAAM,MAAM,CAAC;AAK5E,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAKpC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,aAAa,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAyB9D,wBAAgB,YAAY,CAC1B,QAAQ,EAAE,aAAa,EACvB,IAAI,EAAE,MAAM,GAAG,MAAM,EACrB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,GAAG,GAAE;IACH,MAAM,EAAE,OAAO,CAAC;CACC,GAClB,MAAM,CAgJR;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAwB7D;AAED,wBAAgB,YAAY,CAAC,cAAc,EAAE,kBAAkB,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,MAAM,EAAE,CAQpG"} \ No newline at end of file diff --git a/build/src/compile/axis/assemble.js b/build/src/compile/axis/assemble.js new file mode 100644 index 0000000000..3de8e9ea2a --- /dev/null +++ b/build/src/compile/axis/assemble.js @@ -0,0 +1,192 @@ +import { array, isArray } from 'vega-util'; +import { AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue } from '../../axis'; +import { POSITION_SCALE_CHANNELS } from '../../channel'; +import { defaultTitle } from '../../channeldef'; +import { isText } from '../../title'; +import { contains, getFirstDefined, isEmpty, replaceAll } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { exprFromValueRefOrSignalRef } from '../common'; +import { expression } from '../predicate'; +function assembleTitle(title, config) { + if (!title) { + return undefined; + } + if (isArray(title) && !isText(title)) { + return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', '); + } + return title; +} +function setAxisEncode(axis, part, vgProp, vgRef) { + var _a, _b; + axis.encode ?? (axis.encode = {}); + (_a = axis.encode)[part] ?? (_a[part] = {}); + (_b = axis.encode[part]).update ?? (_b.update = {}); + // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 + axis.encode[part].update[vgProp] = vgRef; +} +export function assembleAxis(axisCmpt, kind, config, opt = { header: false }) { + const { disable, orient, scale, labelExpr, title, zindex, ...axis } = axisCmpt.combine(); + if (disable) { + return undefined; + } + for (const prop in axis) { + const propType = AXIS_PROPERTY_TYPE[prop]; + const propValue = axis[prop]; + if (propType && propType !== kind && propType !== 'both') { + // Remove properties that are not valid for this kind of axis + delete axis[prop]; + } + else if (isConditionalAxisValue(propValue)) { + // deal with conditional axis value + const { condition, ...valueOrSignalRef } = propValue; + const conditions = array(condition); + const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; + if (propIndex) { + const { vgProp, part } = propIndex; + // If there is a corresponding Vega property for the channel, + // use Vega's custom axis encoding and delete the original axis property to avoid conflicts + const vgRef = [ + ...conditions.map(c => { + const { test, ...valueOrSignalCRef } = c; + return { + test: expression(null, test), + ...valueOrSignalCRef + }; + }), + valueOrSignalRef + ]; + setAxisEncode(axis, part, vgProp, vgRef); + delete axis[prop]; + } + else if (propIndex === null) { + // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. + const signalRef = { + signal: conditions + .map(c => { + const { test, ...valueOrSignalCRef } = c; + return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `; + }) + .join('') + exprFromValueRefOrSignalRef(valueOrSignalRef) + }; + axis[prop] = signalRef; + } + } + else if (isSignalRef(propValue)) { + const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; + if (propIndex) { + const { vgProp, part } = propIndex; + setAxisEncode(axis, part, vgProp, propValue); + delete axis[prop]; + } // else do nothing since the property already supports signal + } + // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema + // Note that we need to use null so the default labelAlign is preserved. + if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) { + delete axis[prop]; + } + } + if (kind === 'grid') { + if (!axis.grid) { + return undefined; + } + // Remove unnecessary encode block + if (axis.encode) { + // Only need to keep encode block for grid + const { grid } = axis.encode; + axis.encode = { + ...(grid ? { grid } : {}) + }; + if (isEmpty(axis.encode)) { + delete axis.encode; + } + } + return { + scale, + orient, + ...axis, + domain: false, + labels: false, + aria: false, + // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` + // would not affect gridAxis + maxExtent: 0, + minExtent: 0, + ticks: false, + zindex: getFirstDefined(zindex, 0) // put grid behind marks by default + }; + } + else { + // kind === 'main' + if (!opt.header && axisCmpt.mainExtracted) { + // if mainExtracted has been extracted to a separate facet + return undefined; + } + if (labelExpr !== undefined) { + let expr = labelExpr; + if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) { + expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); + } + setAxisEncode(axis, 'labels', 'text', { signal: expr }); + } + if (axis.labelAlign === null) { + delete axis.labelAlign; + } + // Remove unnecessary encode block + if (axis.encode) { + for (const part of AXIS_PARTS) { + if (!axisCmpt.hasAxisPart(part)) { + delete axis.encode[part]; + } + } + if (isEmpty(axis.encode)) { + delete axis.encode; + } + } + const titleString = assembleTitle(title, config); + return { + scale, + orient, + grid: false, + ...(titleString ? { title: titleString } : {}), + ...axis, + ...(config.aria === false ? { aria: false } : {}), + zindex: getFirstDefined(zindex, 0) // put axis line above marks by default + }; + } +} +/** + * Add axis signals so grid line works correctly + * (Fix https://github.com/vega/vega-lite/issues/4226) + */ +export function assembleAxisSignals(model) { + const { axes } = model.component; + const signals = []; + for (const channel of POSITION_SCALE_CHANNELS) { + if (axes[channel]) { + for (const axis of axes[channel]) { + if (!axis.get('disable') && !axis.get('gridScale')) { + // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. + const sizeType = channel === 'x' ? 'height' : 'width'; + const update = model.getSizeSignalRef(sizeType).signal; + if (sizeType !== update) { + signals.push({ + name: sizeType, + update + }); + } + } + } + } + } + return signals; +} +export function assembleAxes(axisComponents, config) { + const { x = [], y = [] } = axisComponents; + return [ + ...x.map(a => assembleAxis(a, 'grid', config)), + ...y.map(a => assembleAxis(a, 'grid', config)), + ...x.map(a => assembleAxis(a, 'main', config)), + ...y.map(a => assembleAxis(a, 'main', config)) + ].filter(a => a); // filter undefined +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/axis/assemble.js.map b/build/src/compile/axis/assemble.js.map new file mode 100644 index 0000000000..70a0f4a262 --- /dev/null +++ b/build/src/compile/axis/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/axis/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,UAAU,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC/G,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAAC,YAAY,EAAe,MAAM,kBAAkB,CAAC;AAE5D,OAAO,EAAC,MAAM,EAAC,MAAM,aAAa,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,OA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AAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC;oBAEvD,IAAI,QAAQ,KAAK,MAAM,EAAE;wBACvB,OAAO,CAAC,IAAI,CAAC;4BACX,IAAI,EAAE,QAAQ;4BACd,MAAM;yBACP,CAAC,CAAC;qBACJ;iBACF;aACF;SACF;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,cAAkC,EAAE,MAAyB;IACxF,MAAM,EAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,EAAC,GAAG,cAAc,CAAC;IACxC,OAAO;QACL,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QAC9C,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;KAC/C,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,mBAAmB;AACvC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/axis/component.d.ts b/build/src/compile/axis/component.d.ts new file mode 100644 index 0000000000..e76e1a221d --- /dev/null +++ b/build/src/compile/axis/component.d.ts @@ -0,0 +1,28 @@ +import { Axis as VgAxis, SignalRef, Text } from 'vega'; +import { AxisInternal, AxisPart, AxisPropsWithCondition, ConditionalAxisProp } from '../../axis'; +import { FieldDefBase } from '../../channeldef'; +import { Split } from '../split'; +export type AxisComponentProps = Omit & Omit, 'title'> & { + title: Text | FieldDefBase[] | SignalRef; + labelExpr: string; + disable: boolean; +}; +export declare const AXIS_COMPONENT_PROPERTIES: ("values" | "offset" | "grid" | "position" | "scale" | "translate" | "title" | "labels" | "description" | "encode" | "zindex" | "aria" | "orient" | "gridScale" | "format" | "formatType" | "tickCount" | "tickMinStep" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titlePadding" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation" | "domain" | "ticks" | "gridColor" | "gridDash" | "gridDashOffset" | "gridOpacity" | "gridWidth" | "tickColor" | "tickDash" | "tickDashOffset" | "tickOpacity" | "tickSize" | "tickWidth" | "minExtent" | "maxExtent" | "bandPosition" | "titleAngle" | "titleX" | "titleY" | "domainCap" | "domainDash" | "domainDashOffset" | "domainColor" | "domainOpacity" | "domainWidth" | "tickBand" | "tickCap" | "tickExtra" | "tickOffset" | "tickRound" | "gridCap" | "labelBound" | "labelFlush" | "labelFlushOffset" | "labelLineHeight" | "labelAngle" | "labelExpr" | "disable")[]; +export declare class AxisComponent extends Split { + readonly explicit: Partial; + readonly implicit: Partial; + mainExtracted: boolean; + constructor(explicit?: Partial, implicit?: Partial, mainExtracted?: boolean); + clone(): AxisComponent; + hasAxisPart(part: AxisPart): boolean; + hasOrientSignalRef(): boolean; +} +export interface AxisComponentIndex { + x?: AxisComponent[]; + y?: AxisComponent[]; +} +export interface AxisInternalIndex { + x?: AxisInternal; + y?: AxisInternal; +} +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/component.d.ts.map b/build/src/compile/axis/component.d.ts.map new file mode 100644 index 0000000000..7139dd82dc --- /dev/null +++ b/build/src/compile/axis/component.d.ts.map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;IACjB,CAAC,CAAC,EAAE,YAAY,CAAC;CAClB"} \ No newline at end of file diff --git a/build/src/compile/axis/component.js b/build/src/compile/axis/component.js new file mode 100644 index 0000000000..874c488a17 --- /dev/null +++ b/build/src/compile/axis/component.js @@ -0,0 +1,43 @@ +import { COMMON_AXIS_PROPERTIES_INDEX } from '../../axis'; +import { duplicate, keys } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { Split } from '../split'; +function isFalseOrNull(v) { + return v === false || v === null; +} +const AXIS_COMPONENT_PROPERTIES_INDEX = { + disable: 1, + gridScale: 1, + scale: 1, + ...COMMON_AXIS_PROPERTIES_INDEX, + labelExpr: 1, + encode: 1 +}; +export const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); +export class AxisComponent extends Split { + constructor(explicit = {}, implicit = {}, mainExtracted = false) { + super(); + this.explicit = explicit; + this.implicit = implicit; + this.mainExtracted = mainExtracted; + } + clone() { + return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); + } + hasAxisPart(part) { + // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. + if (part === 'axis') { + // always has the axis container part + return true; + } + if (part === 'grid' || part === 'title') { + return !!this.get(part); + } + // Other parts are enabled by default, so they should not be false or null. + return !isFalseOrNull(this.get(part)); + } + hasOrientSignalRef() { + return isSignalRef(this.explicit.orient); + } +} +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/axis/component.js.map b/build/src/compile/axis/component.js.map new file mode 100644 index 0000000000..1d3f55d3a1 --- /dev/null +++ b/build/src/compile/axis/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/axis/component.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,4BAA4B,EAE7B,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,SAAS,EAAQ,IAAI,EAAC,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,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O,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC3C,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/axis/config.d.ts b/build/src/compile/axis/config.d.ts new file mode 100644 index 0000000000..34d1361779 --- /dev/null +++ b/build/src/compile/axis/config.d.ts @@ -0,0 +1,16 @@ +import { ScaleType, SignalRef } from 'vega'; +import { AxisConfig } from '../../axis'; +import { PositionScaleChannel } from '../../channel'; +import { Config, StyleConfigIndex } from '../../config'; +export type AxisConfigs = ReturnType; +export declare function getAxisConfigs(channel: PositionScaleChannel, scaleType: ScaleType, orient: string | SignalRef, config: Config): { + vlOnlyAxisConfig: any; + vgAxisConfig: any; + axisConfigStyle: any; +}; +export declare function getAxisConfigStyle(axisConfigTypes: string[], config: Config): any; +export declare function getAxisConfig(property: keyof AxisConfig, styleConfigIndex: StyleConfigIndex, style: string | string[], axisConfigs?: Partial): { + configFrom?: string; + configValue?: any; +}; +//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/config.d.ts.map b/build/src/compile/axis/config.d.ts.map new file mode 100644 index 0000000000..4f3ba9ebd0 --- /dev/null +++ b/build/src/compile/axis/config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAE1C,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAyCtD,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAE5D,wBAAgB,cAAc,CAC5B,OAAO,EAAE,oBAAoB,EAC7B,SAAS,EAAE,SAAS,EACpB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM;;;;EA8Bf;AAED,wBAAgB,kBAAkB,CAAC,eAAe,EAAE,MAAM,EAAE,EAAE,MAAM,EAAE,MAAM,OAa3E;AACD,wBAAgB,aAAa,CAC3B,QAAQ,EAAE,MAAM,UAAU,CAAC,SAAS,CAAC,EACrC,gBAAgB,EAAE,gBAAgB,CAAC,SAAS,CAAC,EAC7C,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,WAAW,GAAE,OAAO,CAAC,WAAW,CAAM,GACrC;IAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,GAAG,CAAA;CAAC,CAgB1C"} \ No newline at end of file diff --git a/build/src/compile/axis/config.js b/build/src/compile/axis/config.js new file mode 100644 index 0000000000..8f4aafb8fe --- /dev/null +++ b/build/src/compile/axis/config.js @@ -0,0 +1,83 @@ +import { array } from 'vega-util'; +import { isQuantitative } from '../../scale'; +import { keys, titleCase } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { getStyleConfig, signalOrStringValue } from '../common'; +function getAxisConfigFromConfigTypes(configTypes, config, channel, orient) { + // TODO: add special casing to add conditional value based on orient signal + return Object.assign.apply(null, [ + {}, + ...configTypes.map(configType => { + if (configType === 'axisOrient') { + const orient1 = channel === 'x' ? 'bottom' : 'left'; + const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; + const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; + const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]); + const conditionalOrientAxisConfig = {}; + for (const prop of props.values()) { + conditionalOrientAxisConfig[prop] = { + // orient is surely signal in this case + signal: `${orient['signal']} === "${orient1}" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}` + }; + } + return conditionalOrientAxisConfig; + } + return config[configType]; + }) + ]); +} +export function getAxisConfigs(channel, scaleType, orient, config) { + const typeBasedConfigTypes = scaleType === 'band' + ? ['axisDiscrete', 'axisBand'] + : scaleType === 'point' + ? ['axisDiscrete', 'axisPoint'] + : isQuantitative(scaleType) + ? ['axisQuantitative'] + : scaleType === 'time' || scaleType === 'utc' + ? ['axisTemporal'] + : []; + const axisChannel = channel === 'x' ? 'axisX' : 'axisY'; + const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ... + const vlOnlyConfigTypes = [ + // technically Vega does have axisBand, but if we make another separation here, + // it will further introduce complexity in the code + ...typeBasedConfigTypes, + ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4)) + ]; + const vgConfigTypes = ['axis', axisOrient, axisChannel]; + return { + vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), + vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), + axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config) + }; +} +export function getAxisConfigStyle(axisConfigTypes, config) { + const toMerge = [{}]; + for (const configType of axisConfigTypes) { + // TODO: add special casing to add conditional value based on orient signal + let style = config[configType]?.style; + if (style) { + style = array(style); + for (const s of style) { + toMerge.push(config.style[s]); + } + } + } + return Object.assign.apply(null, toMerge); +} +export function getAxisConfig(property, styleConfigIndex, style, axisConfigs = {}) { + const styleConfig = getStyleConfig(property, style, styleConfigIndex); + if (styleConfig !== undefined) { + return { + configFrom: 'style', + configValue: styleConfig + }; + } + for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) { + if (axisConfigs[configFrom]?.[property] !== undefined) { + return { configFrom, configValue: axisConfigs[configFrom][property] }; + } + } + return {}; +} +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/build/src/compile/axis/config.js.map b/build/src/compile/axis/config.js.map new file mode 100644 index 0000000000..ac2c2ef780 --- /dev/null +++ b/build/src/compile/axis/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot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,EAAE;QAChF,IAAI,WAAW,CAAC,UAAU,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACrD,OAAO,EAAC,UAAU,EAAE,WAAW,EAAE,WAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAC,CAAC;SACrE;KACF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/axis/encode.d.ts b/build/src/compile/axis/encode.d.ts new file mode 100644 index 0000000000..3af137cf87 --- /dev/null +++ b/build/src/compile/axis/encode.d.ts @@ -0,0 +1,4 @@ +import { PositionScaleChannel } from '../../channel'; +import { UnitModel } from '../unit'; +export declare function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any): any; +//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/encode.d.ts.map b/build/src/compile/axis/encode.d.ts.map new file mode 100644 index 0000000000..455aa6fd7e --- /dev/null +++ b/build/src/compile/axis/encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAG7E,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,GAAG,OAoE/F"} \ No newline at end of file diff --git a/build/src/compile/axis/encode.js b/build/src/compile/axis/encode.js new file mode 100644 index 0000000000..545c312a36 --- /dev/null +++ b/build/src/compile/axis/encode.js @@ -0,0 +1,68 @@ +import { getSecondaryRangeChannel } from '../../channel'; +import { channelDefType, getFieldOrDatumDef, isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef'; +import { formatCustomType, isCustomFormatType } from '../format'; +export function labels(model, channel, specifiedLabelsSpec) { + const { encoding, config } = model; + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); + const axis = model.axis(channel) || {}; + const { format, formatType } = axis; + if (isCustomFormatType(formatType)) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format, + formatType, + config + }), + ...specifiedLabelsSpec + }; + } + else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (channelDefType(fieldOrDatumDef) === 'quantitative') { + if (isPositionFieldOrDatumDef(fieldOrDatumDef) && + fieldOrDatumDef.stack === 'normalize' && + config.normalizedNumberFormatType) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.normalizedNumberFormat, + formatType: config.normalizedNumberFormatType, + config + }), + ...specifiedLabelsSpec + }; + } + else if (config.numberFormatType) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.numberFormat, + formatType: config.numberFormatType, + config + }), + ...specifiedLabelsSpec + }; + } + } + if (channelDefType(fieldOrDatumDef) === 'temporal' && + config.timeFormatType && + isFieldDef(fieldOrDatumDef) && + !fieldOrDatumDef.timeUnit) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.timeFormat, + formatType: config.timeFormatType, + config + }), + ...specifiedLabelsSpec + }; + } + } + return specifiedLabelsSpec; +} +//# sourceMappingURL=encode.js.map \ No newline at end of file diff --git a/build/src/compile/axis/encode.js.map b/build/src/compile/axis/encode.js.map new file mode 100644 index 0000000000..e6179d7565 --- /dev/null +++ b/build/src/compile/axis/encode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../../src/compile/axis/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,wBAAwB,EAAuB,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,cAAc,EAAE,kBAAkB,EAAE,UAAU,EAAE,yBAAyB,EAAC,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAC,gBAAgB,EAAE,kBAA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f,KAAK,EAAE,aAAa;wBACpB,MAAM,EAAE,MAAM,CAAC,YAAY;wBAC3B,UAAU,EAAE,MAAM,CAAC,gBAAgB;wBACnC,MAAM;qBACP,CAAC;oBACF,GAAG,mBAAmB;iBACvB,CAAC;aACH;SACF;QACD,IACE,cAAc,CAAC,eAAe,CAAC,KAAK,UAAU;YAC9C,MAAM,CAAC,cAAc;YACrB,UAAU,CAAC,eAAe,CAAC;YAC3B,CAAC,eAAe,CAAC,QAAQ,EACzB;YACA,OAAO;gBACL,IAAI,EAAE,gBAAgB,CAAC;oBACrB,eAAe;oBACf,KAAK,EAAE,aAAa;oBACpB,MAAM,EAAE,MAAM,CAAC,UAAU;oBACzB,UAAU,EAAE,MAAM,CAAC,cAAc;oBACjC,MAAM;iBACP,CAAC;gBACF,GAAG,mBAAmB;aACvB,CAAC;SACH;KACF;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/build/src/compile/axis/parse.d.ts b/build/src/compile/axis/parse.d.ts new file mode 100644 index 0000000000..03b12ba093 --- /dev/null +++ b/build/src/compile/axis/parse.d.ts @@ -0,0 +1,6 @@ +import { LayerModel } from '../layer'; +import { UnitModel } from '../unit'; +import { AxisComponentIndex } from './component'; +export declare function parseUnitAxes(model: UnitModel): AxisComponentIndex; +export declare function parseLayerAxes(model: LayerModel): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/parse.d.ts.map b/build/src/compile/axis/parse.d.ts.map new file mode 100644 index 0000000000..ce14547629 --- /dev/null +++ b/build/src/compile/axis/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/parse.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGpC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAgB,kBAAkB,EAAgD,MAAM,aAAa,CAAC;AAM7G,wBAAgB,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,kBAAkB,CAOlE;AASD,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,QAsE/C"} \ No newline at end of file diff --git a/build/src/compile/axis/parse.js b/build/src/compile/axis/parse.js new file mode 100644 index 0000000000..31dd7c840a --- /dev/null +++ b/build/src/compile/axis/parse.js @@ -0,0 +1,265 @@ +import { AXIS_PARTS, isAxisProperty, isConditionalAxisValue } from '../../axis'; +import { POSITION_SCALE_CHANNELS } from '../../channel'; +import { getFieldOrDatumDef } from '../../channeldef'; +import { getFirstDefined, isEmpty, keys, normalizeAngle } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { mergeTitleComponent } from '../common'; +import { guideEncodeEntry } from '../guide'; +import { parseGuideResolve } from '../resolve'; +import { defaultTieBreaker, mergeValuesWithExplicit } from '../split'; +import { AxisComponent, AXIS_COMPONENT_PROPERTIES } from './component'; +import { getAxisConfig, getAxisConfigs } from './config'; +import * as encode from './encode'; +import { axisRules, defaultOrient, getFieldDefTitle, getLabelAngle } from './properties'; +import { guideFormat, guideFormatType } from '../format'; +export function parseUnitAxes(model) { + return POSITION_SCALE_CHANNELS.reduce((axis, channel) => { + if (model.component.scales[channel]) { + axis[channel] = [parseAxis(channel, model)]; + } + return axis; + }, {}); +} +const OPPOSITE_ORIENT = { + bottom: 'top', + top: 'bottom', + left: 'right', + right: 'left' +}; +export function parseLayerAxes(model) { + const { axes, resolve } = model.component; + const axisCount = { top: 0, bottom: 0, right: 0, left: 0 }; + for (const child of model.children) { + child.parseAxesAndHeaders(); + for (const channel of keys(child.component.axes)) { + resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); + if (resolve.axis[channel] === 'shared') { + // If the resolve says shared (and has not been overridden) + // We will try to merge and see if there is a conflict + axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); + if (!axes[channel]) { + // If merge returns nothing, there is a conflict so we cannot make the axis shared. + // Thus, mark axis as independent and remove the axis component. + resolve.axis[channel] = 'independent'; + delete axes[channel]; + } + } + } + } + // Move axes to layer's axis component and merge shared axes + for (const channel of POSITION_SCALE_CHANNELS) { + for (const child of model.children) { + if (!child.component.axes[channel]) { + // skip if the child does not have a particular axis + continue; + } + if (resolve.axis[channel] === 'independent') { + // If axes are independent, concat the axisComponent array. + axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]); + // Automatically adjust orient + for (const axisComponent of child.component.axes[channel]) { + const { value: orient, explicit } = axisComponent.getWithExplicit('orient'); + if (isSignalRef(orient)) { + continue; + } + if (axisCount[orient] > 0 && !explicit) { + // Change axis orient if the number do not match + const oppositeOrient = OPPOSITE_ORIENT[orient]; + if (axisCount[orient] > axisCount[oppositeOrient]) { + axisComponent.set('orient', oppositeOrient, false); + } + } + axisCount[orient]++; + // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? + } + } + // After merging, make sure to remove axes from child + delete child.component.axes[channel]; + } + // Show gridlines for first axis only for dual-axis chart + if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) { + for (const [index, axisCmpt] of (axes[channel] || []).entries()) { + if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { + axisCmpt.implicit.grid = false; + } + } + } + } +} +function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) { + if (mergedAxisCmpts) { + // FIXME: this is a bit wrong once we support multiple axes + if (mergedAxisCmpts.length !== childAxisCmpts.length) { + return undefined; // Cannot merge axis component with different number of axes. + } + const length = mergedAxisCmpts.length; + for (let i = 0; i < length; i++) { + const merged = mergedAxisCmpts[i]; + const child = childAxisCmpts[i]; + if (!!merged !== !!child) { + return undefined; + } + else if (merged && child) { + const mergedOrient = merged.getWithExplicit('orient'); + const childOrient = child.getWithExplicit('orient'); + if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { + // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) + // Cannot merge due to inconsistent orient + return undefined; + } + else { + mergedAxisCmpts[i] = mergeAxisComponent(merged, child); + } + } + } + } + else { + // For first one, return a copy of the child + return childAxisCmpts.map(axisComponent => axisComponent.clone()); + } + return mergedAxisCmpts; +} +function mergeAxisComponent(merged, child) { + for (const prop of AXIS_COMPONENT_PROPERTIES) { + const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', + // Tie breaker function + (v1, v2) => { + switch (prop) { + case 'title': + return mergeTitleComponent(v1, v2); + case 'gridScale': + return { + explicit: v1.explicit, + value: getFirstDefined(v1.value, v2.value) + }; + } + return defaultTieBreaker(v1, v2, prop, 'axis'); + }); + merged.setWithExplicit(prop, mergedValueWithExplicit); + } + return merged; +} +function isExplicit(value, property, axis, model, channel) { + if (property === 'disable') { + return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit + } + axis = axis || {}; + switch (property) { + case 'titleAngle': + case 'labelAngle': + return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); + case 'values': + return !!axis.values; + // specified axis.values is already respected, but may get transformed. + case 'encode': + // both VL axis.encoding and axis.labelAngle affect VG axis.encode + return !!axis.encoding || !!axis.labelAngle; + case 'title': + // title can be explicit if fieldDef.title is set + if (value === getFieldDefTitle(model, channel)) { + return true; + } + } + // Otherwise, things are explicit if the returned value matches the specified property + return value === axis[property]; +} +/** + * Properties to always include values from config + */ +const propsToAlwaysIncludeConfig = new Set([ + 'grid', + 'translate', + // the rest are not axis configs in Vega, but are in VL, so we need to set too. + 'format', + 'formatType', + 'orient', + 'labelExpr', + 'tickCount', + 'position', + 'tickMinStep' +]); +function parseAxis(channel, model) { + let axis = model.axis(channel); + const axisComponent = new AxisComponent(); + const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]); + const { mark, config } = model; + const orient = axis?.orient || + config[channel === 'x' ? 'axisX' : 'axisY']?.orient || + config.axis?.orient || + defaultOrient(channel); + const scaleType = model.getScaleComponent(channel).get('type'); + const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); + const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue; + axisComponent.set('disable', disable, axis !== undefined); + if (disable) { + return axisComponent; + } + axis = axis || {}; + const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); + const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType); + const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true); + const ruleParams = { + fieldOrDatumDef, + axis, + channel, + model, + scaleType, + orient, + labelAngle, + format, + formatType, + mark, + config + }; + // 1.2. Add properties + for (const property of AXIS_COMPONENT_PROPERTIES) { + const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; + const hasValue = value !== undefined; + const explicit = isExplicit(value, property, axis, model, channel); + if (hasValue && explicit) { + axisComponent.set(property, value, explicit); + } + else { + const { configValue = undefined, configFrom = undefined } = isAxisProperty(property) && property !== 'values' + ? getAxisConfig(property, config.style, axis.style, axisConfigs) + : {}; + const hasConfigValue = configValue !== undefined; + if (hasValue && !hasConfigValue) { + // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) + axisComponent.set(property, value, explicit); + } + else if ( + // Cases need implicit values + // 1. Axis config that aren't available in Vega + !(configFrom === 'vgAxisConfig') || + // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) + (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) || + // 3. Conditional axis values and signals + isConditionalAxisValue(configValue) || + isSignalRef(configValue)) { + // If a config is specified and is conditional, copy conditional value from axis config + axisComponent.set(property, configValue, false); + } + } + } + // 2) Add guide encode definition groups + const axisEncoding = axis.encoding ?? {}; + const axisEncode = AXIS_PARTS.reduce((e, part) => { + if (!axisComponent.hasAxisPart(part)) { + // No need to create encode for a disabled part. + return e; + } + const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model); + const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart; + if (value !== undefined && !isEmpty(value)) { + e[part] = { update: value }; + } + return e; + }, {}); + // FIXME: By having encode as one property, we won't have fine grained encode merging. + if (!isEmpty(axisEncode)) { + axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); + } + return axisComponent; +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/axis/parse.js.map b/build/src/compile/axis/parse.js.map new file mode 100644 index 0000000000..fae446aa45 --- /dev/null +++ b/build/src/compile/axis/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/axis/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,UAAU,EAAE,cAAc,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AACpF,OAAO,EAAuB,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC5E,OAAO,EAAC,kBAAkB,EAAqC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAY,uBAAuB,EAAC,MAAM,UAAU,CAAC;AAE9E,OAAO,EAAC,aAAa,EAA0C,yBAAyB,EAAC,MAAM,aAAa,CAAC;AAC7G,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AACvD,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAAO,EAAiB,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,aAAa,EAAC,MAAM,cAAc,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AAC,GAAG,EAAC,MAAM,EAAE,KAAK,EAAC,CAAC;SAC3B;QACD,OAAO,CAAC,CAAC;IACX,CAAC,EAAE,EAAkB,CAAC,CAAC;IAEvB,sFAAsF;IACtF,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACxB,aAAa,CAAC,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,QAAQ,IAAI,IAAI,CAAC,UAAU,KAAK,SAAS,CAAC,CAAC;KAC3F;IAED,OAAO,aAAa,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/axis/properties.d.ts b/build/src/compile/axis/properties.d.ts new file mode 100644 index 0000000000..0d1194ecac --- /dev/null +++ b/build/src/compile/axis/properties.d.ts @@ -0,0 +1,61 @@ +import { Align, AxisOrient, Orient, SignalRef } from 'vega'; +import { AxisInternal } from '../../axis'; +import { PositionScaleChannel } from '../../channel'; +import { DatumDef, PositionDatumDef, PositionFieldDef, TypedFieldDef } from '../../channeldef'; +import { Config, StyleConfigIndex } from '../../config'; +import { Mark } from '../../mark'; +import { Sort } from '../../sort'; +import { Type } from '../../type'; +import { guideFormatType } from '../format'; +import { UnitModel } from '../unit'; +import { ScaleType } from './../../scale'; +import { AxisComponentProps } from './component'; +import { AxisConfigs } from './config'; +export interface AxisRuleParams { + fieldOrDatumDef: PositionFieldDef | PositionDatumDef; + axis: AxisInternal; + channel: PositionScaleChannel; + model: UnitModel; + mark: Mark; + scaleType: ScaleType; + orient: Orient | SignalRef; + labelAngle: number | SignalRef; + format: string | SignalRef; + formatType: ReturnType; + config: Config; +} +export declare const axisRules: { + [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k]; +}; +/** + * Default rules for whether to show a grid should be shown for a channel. + * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned + */ +export declare function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef): boolean; +export declare function gridScale(model: UnitModel, channel: PositionScaleChannel): string; +export declare function getLabelAngle(fieldOrDatumDef: PositionFieldDef | PositionDatumDef, axis: AxisInternal, channel: PositionScaleChannel, styleConfig: StyleConfigIndex, axisConfigs?: AxisConfigs): number | SignalRef; +export declare function normalizeAngleExpr(angle: SignalRef): string; +export declare function defaultLabelBaseline(angle: number | SignalRef, orient: AxisOrient | SignalRef, channel: 'x' | 'y', alwaysIncludeMiddle?: boolean): "bottom" | "middle" | "top" | { + signal: string; +}; +export declare function defaultLabelAlign(angle: number | SignalRef, orient: AxisOrient | SignalRef, channel: 'x' | 'y'): Align | SignalRef; +export declare function defaultLabelFlush(type: Type, channel: PositionScaleChannel): boolean; +export declare function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort): true | "greedy"; +export declare function defaultOrient(channel: PositionScaleChannel): "left" | "bottom"; +export declare function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }: { + fieldOrDatumDef: TypedFieldDef | DatumDef; + scaleType: ScaleType; + size?: SignalRef; + values?: AxisInternal['values']; +}): { + signal: string; +}; +export declare function defaultTickMinStep({ format, fieldOrDatumDef }: Pick): 1 | { + signal: string; +}; +export declare function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y'): SignalRef | import("vega").Text; +export declare function values(axis: AxisInternal, fieldOrDatumDef: TypedFieldDef | DatumDef): SignalRef | (string | number | boolean | import("../../datetime").DateTime | { + signal: string; +})[]; +export declare function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef): 0 | 1; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/build/src/compile/axis/properties.d.ts.map b/build/src/compile/axis/properties.d.ts.map new file mode 100644 index 0000000000..eda40bec26 --- /dev/null +++ b/build/src/compile/axis/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/compile/axis/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EA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AAe,EACf,SAAS,EACT,IAAI,EACJ,MAAM,EAAE,IAAI,EACb,EAAE;IACD,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IAClD,SAAS,EAAE,SAAS,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,MAAM,CAAC,EAAE,YAAY,CAAC,QAAQ,CAAC,CAAC;CACjC;;EAoBA;AAED,wBAAgB,kBAAkB,CAAC,EAAC,MAAM,EAAE,eAAe,EAAC,EAAE,IAAI,CAAC,cAAc,EAAE,QAAQ,GAAG,iBAAiB,CAAC;;EAe/G;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,GAAG,mCAuBpE;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,YAAY,EAAE,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ;;KAU3F;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,SAKnF"} \ No newline at end of file diff --git a/build/src/compile/axis/properties.js b/build/src/compile/axis/properties.js new file mode 100644 index 0000000000..a68f5fcc2d --- /dev/null +++ b/build/src/compile/axis/properties.js @@ -0,0 +1,254 @@ +import { isArray, isObject } from 'vega-util'; +import { isBinned, isBinning } from '../../bin'; +import { X } from '../../channel'; +import { isDiscrete, isFieldDef, toFieldDefBase, valueArray } from '../../channeldef'; +import { hasDiscreteDomain } from '../../scale'; +import { durationExpr, normalizeTimeUnit } from '../../timeunit'; +import { NOMINAL, ORDINAL } from '../../type'; +import { contains, normalizeAngle } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { mergeTitle, mergeTitleFieldDefs } from '../common'; +import { getAxisConfig } from './config'; +export const axisRules = { + scale: ({ model, channel }) => model.scaleName(channel), + format: ({ format }) => format, + formatType: ({ formatType }) => formatType, + grid: ({ fieldOrDatumDef, axis, scaleType }) => axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef), + gridScale: ({ model, channel }) => gridScale(model, channel), + labelAlign: ({ axis, labelAngle, orient, channel }) => axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel), + labelAngle: ({ labelAngle }) => labelAngle, + labelBaseline: ({ axis, labelAngle, orient, channel }) => axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel), + labelFlush: ({ axis, fieldOrDatumDef, channel }) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel), + labelOverlap: ({ axis, fieldOrDatumDef, scaleType }) => axis.labelOverlap ?? + defaultLabelOverlap(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined), + // we already calculate orient in parse + orient: ({ orient }) => orient, + tickCount: ({ channel, model, axis, fieldOrDatumDef, scaleType }) => { + const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; + const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; + return axis.tickCount ?? defaultTickCount({ fieldOrDatumDef, scaleType, size, values: axis.values }); + }, + tickMinStep: ({ axis, format, fieldOrDatumDef }) => axis.tickMinStep ?? defaultTickMinStep({ format, fieldOrDatumDef }), + title: ({ axis, model, channel }) => { + if (axis.title !== undefined) { + return axis.title; + } + const fieldDefTitle = getFieldDefTitle(model, channel); + if (fieldDefTitle !== undefined) { + return fieldDefTitle; + } + const fieldDef = model.typedFieldDef(channel); + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef2 = model.fieldDef(channel2); + // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) + return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []); + }, + values: ({ axis, fieldOrDatumDef }) => values(axis, fieldOrDatumDef), + zindex: ({ axis, fieldOrDatumDef, mark }) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef) +}; +// TODO: we need to refactor this method after we take care of config refactoring +/** + * Default rules for whether to show a grid should be shown for a channel. + * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned + */ +export function defaultGrid(scaleType, fieldDef) { + return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin); +} +export function gridScale(model, channel) { + const gridChannel = channel === 'x' ? 'y' : 'x'; + if (model.getScaleComponent(gridChannel)) { + return model.scaleName(gridChannel); + } + return undefined; +} +export function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) { + const labelAngle = axis?.labelAngle; + // try axis value + if (labelAngle !== undefined) { + return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); + } + else { + // try axis config value + const { configValue: angle } = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs); + if (angle !== undefined) { + return normalizeAngle(angle); + } + else { + // get default value + if (channel === X && + contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && + !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) { + return 270; + } + // no default + return undefined; + } + } +} +export function normalizeAngleExpr(angle) { + return `(((${angle.signal} % 360) + 360) % 360)`; +} +export function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) { + if (angle !== undefined) { + if (channel === 'x') { + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === "top")` : orient === 'top'; + return { + signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? "middle" :` + + `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? "bottom" : "top"` + }; + } + if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) { + return 'middle'; + } + if (isSignalRef(orient)) { + const op = angle <= 45 || 315 <= angle ? '===' : '!=='; + return { signal: `${orient.signal} ${op} "top" ? "bottom" : "top"` }; + } + return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; + } + else { + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === "left")` : orient === 'left'; + const middle = alwaysIncludeMiddle ? '"middle"' : 'null'; + return { + signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? "top" : "bottom"` + }; + } + if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) { + return alwaysIncludeMiddle ? 'middle' : null; + } + if (isSignalRef(orient)) { + const op = 45 <= angle && angle <= 135 ? '===' : '!=='; + return { signal: `${orient.signal} ${op} "left" ? "top" : "bottom"` }; + } + return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; + } + } + return undefined; +} +export function defaultLabelAlign(angle, orient, channel) { + if (angle === undefined) { + return undefined; + } + const isX = channel === 'x'; + const startAngle = isX ? 0 : 90; + const mainOrient = isX ? 'bottom' : 'left'; + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === "${mainOrient}")` : orient === mainOrient; + return { + signal: `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '"center"'} :` + + `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? "left" : "right"` + }; + } + if ((angle + startAngle) % 180 === 0) { + // For bottom, use default label align so label flush still works + return isX ? null : 'center'; + } + if (isSignalRef(orient)) { + const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; + const orientIsMain = `${orient.signal} ${op} "${mainOrient}"`; + return { + signal: `${orientIsMain} ? "left" : "right"` + }; + } + if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { + return 'left'; + } + return 'right'; +} +export function defaultLabelFlush(type, channel) { + if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { + return true; + } + return undefined; +} +export function defaultLabelOverlap(type, scaleType, hasTimeUnit, sort) { + // do not prevent overlap for nominal data because there is no way to infer what the missing labels are + if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) { + if (scaleType === 'log' || scaleType === 'symlog') { + return 'greedy'; + } + return true; + } + return undefined; +} +export function defaultOrient(channel) { + return channel === 'x' ? 'bottom' : 'left'; +} +export function defaultTickCount({ fieldOrDatumDef, scaleType, size, values: vals }) { + if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { + if (isFieldDef(fieldOrDatumDef)) { + if (isBinning(fieldOrDatumDef.bin)) { + // for binned data, we don't want more ticks than maxbins + return { signal: `ceil(${size.signal}/10)` }; + } + if (fieldOrDatumDef.timeUnit && + contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)) { + return undefined; + } + } + return { signal: `ceil(${size.signal}/40)` }; + } + return undefined; +} +export function defaultTickMinStep({ format, fieldOrDatumDef }) { + if (format === 'd') { + return 1; + } + if (isFieldDef(fieldOrDatumDef)) { + const { timeUnit } = fieldOrDatumDef; + if (timeUnit) { + const signal = durationExpr(timeUnit); + if (signal) { + return { signal }; + } + } + } + return undefined; +} +export function getFieldDefTitle(model, channel) { + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef = model.fieldDef(channel); + const fieldDef2 = model.fieldDef(channel2); + const title1 = fieldDef ? fieldDef.title : undefined; + const title2 = fieldDef2 ? fieldDef2.title : undefined; + if (title1 && title2) { + return mergeTitle(title1, title2); + } + else if (title1) { + return title1; + } + else if (title2) { + return title2; + } + else if (title1 !== undefined) { + // falsy value to disable config + return title1; + } + else if (title2 !== undefined) { + // falsy value to disable config + return title2; + } + return undefined; +} +export function values(axis, fieldOrDatumDef) { + const vals = axis.values; + if (isArray(vals)) { + return valueArray(fieldOrDatumDef, vals); + } + else if (isSignalRef(vals)) { + return vals; + } + return undefined; +} +export function defaultZindex(mark, fieldDef) { + if (mark === 'rect' && isDiscrete(fieldDef)) { + return 1; + } + return 0; +} +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/build/src/compile/axis/properties.js.map b/build/src/compile/axis/properties.js.map new file mode 100644 index 0000000000..16673cce00 --- /dev/null +++ b/build/src/compile/axis/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/axis/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAE5C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAuB,CAAC,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAEL,UAAU,EACV,UAAU,EAGV,cAAc,EAEd,UAAU,EACX,MAAM,kBAAkB,CAAC;AAG1B,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAC,OAAO,EAAE,OAAO,EAAO,MAAM,YAAY,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAK1D,OAAO,EAAc,aAAa,EAAC,MAAM,UAAU,CAAC;AAiBpD,MAAM,CAAC,MAAM,SAAS,GAElB;IACF,KAAK,EAAE,CAAC,EAAC,KAAK,EAAE,OAAO,EAAC,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;IAErD,MAAM,EAAE,CAAC,EAAC,MAAM,EAAC,EAAE,EAAE,CAAC,MAAM;IAE5B,UAAU,EAAE,CAAC,EAAC,UAAU,EAAC,EAAE,EAAE,CAAC,UAAU;IAExC,IAAI,EAAE,CAAC,EAAC,e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;IAC1F,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC;IAEzB,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,UAAU,CAAC,eAAe,EAAE,IAAI,CAAC,CAAC;KAC1C;SAAM,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,CAAC;KACb;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAU,EAAE,QAA0C;IAClF,IAAI,IAAI,KAAK,MAAM,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;QAC3C,OAAO,CAAC,CAAC;KACV;IACD,OAAO,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/build/src/compile/buildmodel.d.ts b/build/src/compile/buildmodel.d.ts new file mode 100644 index 0000000000..edcfa17ef0 --- /dev/null +++ b/build/src/compile/buildmodel.d.ts @@ -0,0 +1,6 @@ +import type { SignalRef } from 'vega'; +import { Config } from '../config'; +import { LayoutSizeMixins, NormalizedSpec } from '../spec'; +import { Model } from './model'; +export declare function buildModel(spec: NormalizedSpec, parent: Model, parentGivenName: string, unitSize: LayoutSizeMixins, config: Config): Model; +//# sourceMappingURL=buildmodel.d.ts.map \ No newline at end of file diff --git a/build/src/compile/buildmodel.d.ts.map b/build/src/compile/buildmodel.d.ts.map new file mode 100644 index 0000000000..7314fd34e1 --- /dev/null +++ b/build/src/compile/buildmodel.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"buildmodel.d.ts","sourceRoot":"","sources":["../../../src/compile/buildmodel.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAwD,gBAAgB,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AAIhH,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAG9B,wBAAgB,UAAU,CACxB,IAAI,EAAE,cAAc,EACpB,MAAM,EAAE,KAAK,EACb,eAAe,EAAE,MAAM,EACvB,QAAQ,EAAE,gBAAgB,EAC1B,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,GACxB,KAAK,CAWP"} \ No newline at end of file diff --git a/build/src/compile/buildmodel.js b/build/src/compile/buildmodel.js new file mode 100644 index 0000000000..eb18905c57 --- /dev/null +++ b/build/src/compile/buildmodel.js @@ -0,0 +1,22 @@ +import * as log from '../log'; +import { isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec } from '../spec'; +import { ConcatModel } from './concat'; +import { FacetModel } from './facet'; +import { LayerModel } from './layer'; +import { UnitModel } from './unit'; +export function buildModel(spec, parent, parentGivenName, unitSize, config) { + if (isFacetSpec(spec)) { + return new FacetModel(spec, parent, parentGivenName, config); + } + else if (isLayerSpec(spec)) { + return new LayerModel(spec, parent, parentGivenName, unitSize, config); + } + else if (isUnitSpec(spec)) { + return new UnitModel(spec, parent, parentGivenName, unitSize, config); + } + else if (isAnyConcatSpec(spec)) { + return new ConcatModel(spec, parent, parentGivenName, config); + } + throw new Error(log.message.invalidSpec(spec)); +} +//# sourceMappingURL=buildmodel.js.map \ No newline at end of file diff --git a/build/src/compile/buildmodel.js.map b/build/src/compile/buildmodel.js.map new file mode 100644 index 0000000000..b85b352001 --- /dev/null +++ b/build/src/compile/buildmodel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"buildmodel.js","sourceRoot":"","sources":["../../../src/compile/buildmodel.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAAmC,MAAM,SAAS,CAAC;AAChH,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,MAAM,UAAU,UAAU,CACxB,IAAoB,EACpB,MAAa,EACb,eAAuB,EACvB,QAA0B,EAC1B,MAAyB;IAEzB,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QACrB,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC9D;SAAM,IAAI,WAAW,CAAC,IAAI,CAAC,EAAE;QAC5B,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACxE;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;QAC3B,OAAO,IAAI,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;KACvE;SAAM,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;QAChC,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,CAAC,CAAC;KAC/D;IACD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACjD,CAAC"} \ No newline at end of file diff --git a/build/src/compile/common.d.ts b/build/src/compile/common.d.ts new file mode 100644 index 0000000000..893cf0d976 --- /dev/null +++ b/build/src/compile/common.d.ts @@ -0,0 +1,52 @@ +import { ExprRef, SignalRef, Text } from 'vega'; +import { AxisConfig, ConditionalAxisProperty } from '../axis'; +import { ConditionalPredicate, DatumDef, FieldDef, FieldDefBase, FieldRefOption, OrderFieldDef, Value, ValueDef } from '../channeldef'; +import { Config, StyleConfigIndex } from '../config'; +import { Mark, MarkConfig, MarkDef } from '../mark'; +import { SortFields } from '../sort'; +import { VgEncodeChannel, VgEncodeEntry, VgValueRef } from '../vega.schema'; +import { AxisComponentProps } from './axis/component'; +import { Explicit } from './split'; +import { UnitModel } from './unit'; +export declare const BIN_RANGE_DELIMITER = " \u2013 "; +export declare function signalOrValueRefWithCondition(val: ConditionalAxisProperty): ConditionalAxisProperty; +export declare function signalRefOrValue(value: T | SignalRef | ExprRef): T | SignalRef; +export declare function conditionalSignalRefOrValue | DatumDef | ValueDef>(value: ConditionalPredicate): ConditionalPredicate; +export declare function signalOrValueRef(value: T | SignalRef | ExprRef): { + value: T; +} | SignalRef; +export declare function exprFromSignalRefOrValue(ref: Value | SignalRef): string; +export declare function exprFromValueRefOrSignalRef(ref: VgValueRef | SignalRef): string; +export declare function signalOrStringValue(v: SignalRef | any): string; +export declare function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]): Partial>; +export declare function getStyles(mark: MarkDef): string[]; +export declare function getMarkPropOrConfig

(channel: P, mark: MarkDef, config: Config, opt?: { + vgChannel?: VgEncodeChannel; + ignoreVgConfig?: boolean; +}): MarkDef[P]; +/** + * Return property value from style or mark specific config property if exists. + * Otherwise, return general mark specific config. + */ +export declare function getMarkConfig

(channel: P, mark: MarkDef, config: Config, { vgChannel }?: { + vgChannel?: VgEncodeChannel; +}): MarkDef[P]; +export declare function getMarkStyleConfig

(prop: P, mark: MarkDef, styleConfigIndex: StyleConfigIndex): any; +export declare function getStyleConfig

>(p: P, styles: string | string[], styleConfigIndex: StyleConfigIndex): any; +/** + * Return Vega sort parameters (tuple of field and order). + */ +export declare function sortParams(orderDef: OrderFieldDef | OrderFieldDef[], fieldRefOption?: FieldRefOption): SortFields; +export type AxisTitleComponent = AxisComponentProps['title']; +export declare function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]): FieldDefBase[]; +export declare function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef): SignalRef | Text; +export declare function mergeTitleComponent(v1: Explicit, v2: Explicit): { + explicit: boolean; + value: SignalRef | Text; +} | { + explicit: boolean; + value: FieldDefBase[]; +}; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/build/src/compile/common.d.ts.map b/build/src/compile/common.d.ts.map new file mode 100644 index 0000000000..a2d4b94668 --- /dev/null +++ b/build/src/compile/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/compile/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAE,uBAAuB,EAAC,MAAM,SAAS,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,QAAQ,EACR,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,aAAa,EACb,KAAK,EACL,QAAQ,EAET,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAEnD,OAAO,EAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAc,eAAe,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,gBAAgB,CAAC;AACvF,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,SAAS,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,wBAAgB,6BAA6B,CAAC,CAAC,SAAS,KAAK,GAAG,MAAM,EAAE,EACtE,GAAG,EAAE,uBAAuB,CAAC,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC,GACnD,uBAAuB,CAAC,CAAC,EAAE,SAAS,CAAC,CASvC;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,GAAG,OAAO,GAAG,CAAC,GAAG,SAAS,CAMjF;AAED,wB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B,mBAAmB,CAAC,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC,EAAE,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC;;;;;;EAgCrG"} \ No newline at end of file diff --git a/build/src/compile/common.js b/build/src/compile/common.js new file mode 100644 index 0000000000..239c5b985a --- /dev/null +++ b/build/src/compile/common.js @@ -0,0 +1,185 @@ +import { array, isArray, stringValue } from 'vega-util'; +import { vgField } from '../channeldef'; +import { isExprRef } from '../expr'; +import { isText } from '../title'; +import { deepEqual, getFirstDefined } from '../util'; +import { isSignalRef } from '../vega.schema'; +export const BIN_RANGE_DELIMITER = ' \u2013 '; +export function signalOrValueRefWithCondition(val) { + const condition = isArray(val.condition) + ? val.condition.map(conditionalSignalRefOrValue) + : conditionalSignalRefOrValue(val.condition); + return { + ...signalRefOrValue(val), + condition + }; +} +export function signalRefOrValue(value) { + if (isExprRef(value)) { + const { expr, ...rest } = value; + return { signal: expr, ...rest }; + } + return value; +} +export function conditionalSignalRefOrValue(value) { + if (isExprRef(value)) { + const { expr, ...rest } = value; + return { signal: expr, ...rest }; + } + return value; +} +export function signalOrValueRef(value) { + if (isExprRef(value)) { + const { expr, ...rest } = value; + return { signal: expr, ...rest }; + } + if (isSignalRef(value)) { + return value; + } + return value !== undefined ? { value } : undefined; +} +export function exprFromSignalRefOrValue(ref) { + if (isSignalRef(ref)) { + return ref.signal; + } + return stringValue(ref); +} +export function exprFromValueRefOrSignalRef(ref) { + if (isSignalRef(ref)) { + return ref.signal; + } + return stringValue(ref.value); +} +export function signalOrStringValue(v) { + if (isSignalRef(v)) { + return v.signal; + } + return v == null ? null : stringValue(v); +} +export function applyMarkConfig(e, model, propsList) { + for (const property of propsList) { + const value = getMarkConfig(property, model.markDef, model.config); + if (value !== undefined) { + e[property] = signalOrValueRef(value); + } + } + return e; +} +export function getStyles(mark) { + return [].concat(mark.type, mark.style ?? []); +} +export function getMarkPropOrConfig(channel, mark, config, opt = {}) { + const { vgChannel, ignoreVgConfig } = opt; + if (vgChannel && mark[vgChannel] !== undefined) { + return mark[vgChannel]; + } + else if (mark[channel] !== undefined) { + return mark[channel]; + } + else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { + return undefined; + } + return getMarkConfig(channel, mark, config, opt); +} +/** + * Return property value from style or mark specific config property if exists. + * Otherwise, return general mark specific config. + */ +export function getMarkConfig(channel, mark, config, { vgChannel } = {}) { + return getFirstDefined( + // style config has highest precedence + vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), + // then mark-specific config + vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine + // If there is vgChannel, skip vl channel. + // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. + vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above + ); +} +export function getMarkStyleConfig(prop, mark, styleConfigIndex) { + return getStyleConfig(prop, getStyles(mark), styleConfigIndex); +} +export function getStyleConfig(p, styles, styleConfigIndex) { + styles = array(styles); + let value; + for (const style of styles) { + const styleConfig = styleConfigIndex[style]; + if (styleConfig && styleConfig[p] !== undefined) { + value = styleConfig[p]; + } + } + return value; +} +/** + * Return Vega sort parameters (tuple of field and order). + */ +export function sortParams(orderDef, fieldRefOption) { + return array(orderDef).reduce((s, orderChannelDef) => { + s.field.push(vgField(orderChannelDef, fieldRefOption)); + s.order.push(orderChannelDef.sort ?? 'ascending'); + return s; + }, { field: [], order: [] }); +} +export function mergeTitleFieldDefs(f1, f2) { + const merged = [...f1]; + f2.forEach(fdToMerge => { + for (const fieldDef1 of merged) { + // If already exists, no need to append to merged array + if (deepEqual(fieldDef1, fdToMerge)) { + return; + } + } + merged.push(fdToMerge); + }); + return merged; +} +export function mergeTitle(title1, title2) { + if (deepEqual(title1, title2) || !title2) { + // if titles are the same or title2 is falsy + return title1; + } + else if (!title1) { + // if title1 is falsy + return title2; + } + else { + return [...array(title1), ...array(title2)].join(', '); + } +} +export function mergeTitleComponent(v1, v2) { + const v1Val = v1.value; + const v2Val = v2.value; + if (v1Val == null || v2Val === null) { + return { + explicit: v1.explicit, + value: null + }; + } + else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { + return { + explicit: v1.explicit, + value: mergeTitle(v1Val, v2Val) + }; + } + else if (isText(v1Val) || isSignalRef(v1Val)) { + return { + explicit: v1.explicit, + value: v1Val + }; + } + else if (isText(v2Val) || isSignalRef(v2Val)) { + return { + explicit: v1.explicit, + value: v2Val + }; + } + else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { + return { + explicit: v1.explicit, + value: mergeTitleFieldDefs(v1Val, v2Val) + }; + } + /* istanbul ignore next: Condition should not happen -- only for warning in development. */ + throw new Error('It should never reach here'); +} +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/build/src/compile/common.js.map b/build/src/compile/common.js.map new file mode 100644 index 0000000000..1ba2c8f18c --- /dev/null +++ b/build/src/compile/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/compile/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtD,OAAO,EASL,OAAO,EACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAChC,OAAO,EAAC,SAAS,EAAE,eAAe,EAAC,MAAM,SAAS,CAAC;AACnD,OAAO,EAAC,WAAW,EAA6C,MAAM,gBAAgB,CAAC;AAKvF,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9C,MAAM,UAAU,6BAA6B,CAC3C,GAAoD;IAEpD,MAAM,SAAS,GAAG,OAAO,CAAC,GAAG,CA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,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,KAAK;SACb,CAAC;KACH;SAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;QACzF,OAAO;YACL,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,KAAK,EAAE,mBAAmB,CAAC,KAAK,EAAE,KAAK,CAAC;SACzC,CAAC;KACH;IACD,2FAA2F;IAC3F,MAAM,IAAI,KAAK,CAAC,4BAA4B,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/build/src/compile/compile.d.ts b/build/src/compile/compile.d.ts new file mode 100644 index 0000000000..bb5953200d --- /dev/null +++ b/build/src/compile/compile.d.ts @@ -0,0 +1,54 @@ +import { LoggerInterface, Spec as VgSpec } from 'vega'; +import * as vlFieldDef from '../channeldef'; +import { Config } from '../config'; +import { LayoutSizeMixins, TopLevel, TopLevelSpec } from '../spec'; +export interface CompileOptions { + /** + * Sets a Vega-Lite configuration. + */ + config?: Config; + /** + * Sets a custom logger. + */ + logger?: LoggerInterface; + /** + * Sets a field title formatter. + */ + fieldTitle?: vlFieldDef.FieldTitleFormatter; +} +/** + * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. + * + * At a high-level, we make the following transformations in different phases: + * + * Input spec + * | + * | (Normalization) + * v + * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) + * | + * | (Build Model) + * v + * A model tree of the spec + * | + * | (Parse) + * v + * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) + * | + * | (Optimize) + * v + * A model tree with parsed components with the data component optimized + * | + * | (Assemble) + * v + * Vega spec + * + * @param inputSpec The Vega-Lite specification. + * @param opt Optional arguments passed to the Vega-Lite compiler. + * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. + */ +export declare function compile(inputSpec: TopLevelSpec, opt?: CompileOptions): { + spec: VgSpec; + normalized: TopLevel & LayoutSizeMixins; +}; +//# sourceMappingURL=compile.d.ts.map \ No newline at end of file diff --git a/build/src/compile/compile.d.ts.map b/build/src/compile/compile.d.ts.map new file mode 100644 index 0000000000..8966d50928 --- /dev/null +++ b/build/src/compile/compile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.d.ts","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,eAAe,EAAE,IAAI,IAAI,MAAM,EAAC,MAAM,MAAM,CAAC;AAGnE,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAqC,MAAM,WAAW,CAAC;AAIrE,OAAO,EAAC,gBAAgB,EAAE,QAAQ,EAAE,YAAY,EAAC,MAAM,SAAS,CAAC;AAejE,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IAEzB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,mBAAmB,CAAC;CAC7C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,YAAY,EAAE,GAAG,GAAE,cAAmB;;;EAuExE"} \ No newline at end of file diff --git a/build/src/compile/compile.js b/build/src/compile/compile.js new file mode 100644 index 0000000000..d022768a87 --- /dev/null +++ b/build/src/compile/compile.js @@ -0,0 +1,180 @@ +import { isString, mergeConfig } from 'vega-util'; +import { getPositionScaleChannel } from '../channel'; +import * as vlFieldDef from '../channeldef'; +import { initConfig, stripAndRedirectConfig } from '../config'; +import * as log from '../log'; +import { normalize } from '../normalize'; +import { assembleParameterSignals } from '../parameter'; +import { extractTopLevelProperties, getFitType, isFitType } from '../spec/toplevel'; +import { keys } from '../util'; +import { buildModel } from './buildmodel'; +import { assembleRootData } from './data/assemble'; +import { optimizeDataflow } from './data/optimize'; +/** + * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. + * + * At a high-level, we make the following transformations in different phases: + * + * Input spec + * | + * | (Normalization) + * v + * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) + * | + * | (Build Model) + * v + * A model tree of the spec + * | + * | (Parse) + * v + * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) + * | + * | (Optimize) + * v + * A model tree with parsed components with the data component optimized + * | + * | (Assemble) + * v + * Vega spec + * + * @param inputSpec The Vega-Lite specification. + * @param opt Optional arguments passed to the Vega-Lite compiler. + * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. + */ +export function compile(inputSpec, opt = {}) { + // 0. Augment opt with default opts + if (opt.logger) { + // set the singleton logger to the provided logger + log.set(opt.logger); + } + if (opt.fieldTitle) { + // set the singleton field title formatter + vlFieldDef.setTitleFormatter(opt.fieldTitle); + } + try { + // 1. Initialize config by deep merging default config with the config provided via option and the input spec. + const config = initConfig(mergeConfig(opt.config, inputSpec.config)); + // 2. Normalize: Convert input spec -> normalized spec + // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. + // - Normalize autosize and width or height spec + const spec = normalize(inputSpec, config); + // 3. Build Model: normalized spec -> Model (a tree structure) + // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. + // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. + const model = buildModel(spec, null, '', undefined, config); + // 4 Parse: Model --> Model with components + // Note that components = intermediate representations that are equivalent to Vega specs. + // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. + // We will later convert these components into actual Vega specs in the assemble phase. + // In this phase, we do a bottom-up traversal over the whole tree to + // parse for each type of components once (e.g., data, layout, mark, scale). + // By doing bottom-up traversal, we start parsing components of unit specs and + // then merge child components of parent composite specs. + // + // Please see inside model.parse() for order of different components parsed. + model.parse(); + // drawDataflow(model.component.data.sources); + // 5. Optimize the dataflow. This will modify the data component of the model. + optimizeDataflow(model.component.data, model); + // drawDataflow(model.component.data.sources); + // 6. Assemble: convert model components --> Vega Spec. + const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta); + return { + spec: vgSpec, + normalized: spec + }; + } + finally { + // Reset the singleton logger if a logger is provided + if (opt.logger) { + log.reset(); + } + // Reset the singleton field title formatter if provided + if (opt.fieldTitle) { + vlFieldDef.resetTitleFormatter(); + } + } +} +function getTopLevelProperties(inputSpec, autosize, config, model) { + const width = model.component.layoutSize.get('width'); + const height = model.component.layoutSize.get('height'); + if (autosize === undefined) { + autosize = { type: 'pad' }; + if (model.hasAxisOrientSignalRef()) { + autosize.resize = true; + } + } + else if (isString(autosize)) { + autosize = { type: autosize }; + } + if (width && height && isFitType(autosize.type)) { + if (width === 'step' && height === 'step') { + log.warn(log.message.droppingFit()); + autosize.type = 'pad'; + } + else if (width === 'step' || height === 'step') { + // effectively XOR, because else if + // get step dimension + const sizeType = width === 'step' ? 'width' : 'height'; + // log that we're dropping fit for respective channel + log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType))); + // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) + const inverseSizeType = sizeType === 'width' ? 'height' : 'width'; + autosize.type = getFitType(inverseSizeType); + } + } + return { + ...(keys(autosize).length === 1 && autosize.type + ? autosize.type === 'pad' + ? {} + : { autosize: autosize.type } + : { autosize }), + ...extractTopLevelProperties(config, false), + ...extractTopLevelProperties(inputSpec, true) + }; +} +/* + * Assemble the top-level model to a Vega spec. + * + * Note: this couldn't be `model.assemble()` since the top-level model + * needs some special treatment to generate top-level properties. + */ +function assembleTopLevelModel(model, topLevelProperties, datasets = {}, usermeta) { + // Config with Vega-Lite only config removed. + const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; + const data = [].concat(model.assembleSelectionData([]), + // only assemble data in the root + assembleRootData(model.component.data, datasets)); + const projections = model.assembleProjections(); + const title = model.assembleTitle(); + const style = model.assembleGroupStyle(); + const encodeEntry = model.assembleGroupEncodeEntry(true); + let layoutSignals = model.assembleLayoutSignals(); + // move width and height signals with values to top level + layoutSignals = layoutSignals.filter(signal => { + if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { + topLevelProperties[signal.name] = +signal.value; + return false; + } + return true; + }); + const { params, ...otherTopLevelProps } = topLevelProperties; + return { + $schema: 'https://vega.github.io/schema/vega/v5.json', + ...(model.description ? { description: model.description } : {}), + ...otherTopLevelProps, + ...(title ? { title } : {}), + ...(style ? { style } : {}), + ...(encodeEntry ? { encode: { update: encodeEntry } } : {}), + data, + ...(projections.length > 0 ? { projections } : {}), + ...model.assembleGroup([ + ...layoutSignals, + ...model.assembleSelectionTopLevelSignals([]), + ...assembleParameterSignals(params) + ]), + ...(vgConfig ? { config: vgConfig } : {}), + ...(usermeta ? { usermeta } : {}) + }; +} +//# sourceMappingURL=compile.js.map \ No newline at end of file diff --git a/build/src/compile/compile.js.map b/build/src/compile/compile.js.map new file mode 100644 index 0000000000..1dddb2ee67 --- /dev/null +++ b/build/src/compile/compile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/compile/compile.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAChD,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,UAAU,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAS,UAAU,EAAE,sBAAsB,EAAC,MAAM,WAAW,CAAC;AACrE,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,wBAAwB,EAAC,MAAM,cAAc,CAAC;AAEtD,OAAO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CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,IAAI;QACJ,GAAG,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAChD,GAAG,KAAK,CAAC,aAAa,CAAC;YACrB,GAAG,aAAa;YAChB,GAAG,KAAK,CAAC,gCAAgC,CAAC,EAAE,CAAC;YAC7C,GAAG,wBAAwB,CAAC,MAAM,CAAC;SACpC,CAAC;QACF,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAC,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/concat.d.ts b/build/src/compile/concat.d.ts new file mode 100644 index 0000000000..72df926b1b --- /dev/null +++ b/build/src/compile/concat.d.ts @@ -0,0 +1,24 @@ +import { NewSignal, SignalRef } from 'vega'; +import { Config } from '../config'; +import { NormalizedConcatSpec } from '../spec'; +import { VgData, VgLayout } from '../vega.schema'; +import { Model } from './model'; +export declare class ConcatModel extends Model { + readonly children: Model[]; + constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config); + parseData(): void; + parseSelections(): void; + parseMarkGroup(): void; + parseAxesAndHeaders(): void; + private getChildren; + parseLayoutSize(): void; + parseAxisGroup(): void; + assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; + assembleSignals(): NewSignal[]; + assembleLayoutSignals(): NewSignal[]; + assembleSelectionData(data: readonly VgData[]): readonly VgData[]; + assembleMarks(): any[]; + assembleGroupStyle(): string | string[]; + protected assembleDefaultLayout(): VgLayout; +} +//# sourceMappingURL=concat.d.ts.map \ No newline at end of file diff --git a/build/src/compile/concat.d.ts.map b/build/src/compile/concat.d.ts.map new file mode 100644 index 0000000000..cd8ed678e6 --- /dev/null +++ b/build/src/compile/concat.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/compile/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAC1C,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAA+B,oBAAoB,EAAiB,MAAM,SAAS,CAAC;AAE3F,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAKhD,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,qBAAa,WAAY,SAAQ,KAAK;IACpC,SAAgB,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAEtB,IAAI,EAAE,oBAAoB,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC;IAYlG,SAAS;IAOT,eAAe;IAaf,cAAc;IAMd,mBAAmB;IAQ1B,OAAO,CAAC,WAAW;IASZ,eAAe;IAIf,cAAc,IAAI,IAAI;IAItB,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAInE,eAAe,IAAI,SAAS,EAAE;IAK9B,qBAAqB,IAAI,SAAS,EAAE;IAUpC,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAIjE,aAAa,IAAI,GAAG,EAAE;IAkBtB,kBAAkB,IAAI,MAAM,GAAG,MAAM,EAAE;IAI9C,SAAS,CAAC,qBAAqB,IAAI,QAAQ;CAS5C"} \ No newline at end of file diff --git a/build/src/compile/concat.js b/build/src/compile/concat.js new file mode 100644 index 0000000000..ca9ac16aa9 --- /dev/null +++ b/build/src/compile/concat.js @@ -0,0 +1,109 @@ +import * as log from '../log'; +import { isHConcatSpec, isVConcatSpec } from '../spec'; +import { keys } from '../util'; +import { buildModel } from './buildmodel'; +import { parseData } from './data/parse'; +import { assembleLayoutSignals } from './layoutsize/assemble'; +import { parseConcatLayoutSize } from './layoutsize/parse'; +import { Model } from './model'; +export class ConcatModel extends Model { + constructor(spec, parent, parentGivenName, config) { + super(spec, 'concat', parent, parentGivenName, config, spec.resolve); + if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') { + log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS); + } + this.children = this.getChildren(spec).map((child, i) => { + return buildModel(child, this, this.getName(`concat_${i}`), undefined, config); + }); + } + parseData() { + this.component.data = parseData(this); + for (const child of this.children) { + child.parseData(); + } + } + parseSelections() { + // Merge selections up the hierarchy so that they may be referenced + // across unit specs. Persist their definitions within each child + // to assemble signals which remain within output Vega unit groups. + this.component.selection = {}; + for (const child of this.children) { + child.parseSelections(); + for (const key of keys(child.component.selection)) { + this.component.selection[key] = child.component.selection[key]; + } + } + } + parseMarkGroup() { + for (const child of this.children) { + child.parseMarkGroup(); + } + } + parseAxesAndHeaders() { + for (const child of this.children) { + child.parseAxesAndHeaders(); + } + // TODO(#2415): support shared axes + } + getChildren(spec) { + if (isVConcatSpec(spec)) { + return spec.vconcat; + } + else if (isHConcatSpec(spec)) { + return spec.hconcat; + } + return spec.concat; + } + parseLayoutSize() { + parseConcatLayoutSize(this); + } + parseAxisGroup() { + return null; + } + assembleSelectionTopLevelSignals(signals) { + return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); + } + assembleSignals() { + this.children.forEach(child => child.assembleSignals()); + return []; + } + assembleLayoutSignals() { + const layoutSignals = assembleLayoutSignals(this); + for (const child of this.children) { + layoutSignals.push(...child.assembleLayoutSignals()); + } + return layoutSignals; + } + assembleSelectionData(data) { + return this.children.reduce((db, child) => child.assembleSelectionData(db), data); + } + assembleMarks() { + // only children have marks + return this.children.map(child => { + const title = child.assembleTitle(); + const style = child.assembleGroupStyle(); + const encodeEntry = child.assembleGroupEncodeEntry(false); + return { + type: 'group', + name: child.getName('group'), + ...(title ? { title } : {}), + ...(style ? { style } : {}), + ...(encodeEntry ? { encode: { update: encodeEntry } } : {}), + ...child.assembleGroup() + }; + }); + } + assembleGroupStyle() { + return undefined; + } + assembleDefaultLayout() { + const columns = this.layout.columns; + return { + ...(columns != null ? { columns } : {}), + bounds: 'full', + // Use align each so it can work with multiple plots with different size + align: 'each' + }; + } +} +//# sourceMappingURL=concat.js.map \ No newline at end of file diff --git a/build/src/compile/concat.js.map b/build/src/compile/concat.js.map new file mode 100644 index 0000000000..aa79fe90e4 --- /dev/null +++ b/build/src/compile/concat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/compile/concat.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAE,aAAa,EAAuC,MAAM,SAAS,CAAC;AAC3F,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,qBAAqB,EAAC,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAE9B,MAAM,OAAO,WAAY,SAAQ,KAAK;IAGpC,YAAY,IAA0B,EAAE,MAAa,EAAE,eAAuB,EAAE,MAAyB;QACvG,KA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,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/aggregate.d.ts b/build/src/compile/data/aggregate.d.ts new file mode 100644 index 0000000000..a3d74d3387 --- /dev/null +++ b/build/src/compile/data/aggregate.d.ts @@ -0,0 +1,27 @@ +import { AggregateOp, AggregateTransform as VgAggregateTransform } from 'vega'; +import { AggregateTransform } from '../../transform'; +import { Dict } from '../../util'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +type Measures = Dict>>>; +export declare class AggregateNode extends DataFlowNode { + private dimensions; + private measures; + clone(): AggregateNode; + /** + * @param dimensions string set for dimensions + * @param measures dictionary mapping field name => dict of aggregation functions and names to use + */ + constructor(parent: DataFlowNode, dimensions: Set, measures: Measures); + get groupBy(): Set; + static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode; + static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode; + merge(other: AggregateNode): boolean; + addDimensions(fields: readonly string[]): void; + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgAggregateTransform; +} +export {}; +//# sourceMappingURL=aggregate.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/aggregate.d.ts.map b/build/src/compile/data/aggregate.d.ts.map new file mode 100644 index 0000000000..e10b939151 --- /dev/null +++ b/build/src/compile/data/aggregate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"aggregate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/aggregate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,kBAAkB,IAAI,oBAAoB,EAAC,MAAM,MAAM,CAAC;AAqB7E,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAC,IAAI,EAAsD,MAAM,YAAY,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAIxC,KAAK,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAoDhE,qBAAa,aAAc,SAAQ,YAAY;IAW3C,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,QAAQ;IAXX,KAAK;IAIZ;;;OAGG;gBAED,MAAM,EAAE,YAAY,EACZ,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,EACvB,QAAQ,EAAE,QAAQ;IAK5B,IAAI,OAAO,gBAEV;WAEa,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,aAAa;WAoDvE,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,kBAAkB,GAAG,aAAa;IA4BpF,KAAK,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO;IASpC,aAAa,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAIvC,eAAe;IAIf,cAAc;IAiBd,IAAI;IAIJ,QAAQ,IAAI,oBAAoB;CAyBxC"} \ No newline at end of file diff --git a/build/src/compile/data/aggregate.js b/build/src/compile/data/aggregate.js new file mode 100644 index 0000000000..8df11a8080 --- /dev/null +++ b/build/src/compile/data/aggregate.js @@ -0,0 +1,198 @@ +import { isArgmaxDef, isArgminDef } from '../../aggregate'; +import { getPositionChannelFromLatLong, getSecondaryRangeChannel, isGeoPositionChannel, isScaleChannel, isXorY } from '../../channel'; +import { binRequiresRange, getBandPosition, hasBandEnd, isScaleFieldDef, isTypedFieldDef, vgField } from '../../channeldef'; +import * as log from '../../log'; +import { isFieldRange } from '../../scale'; +import { duplicate, hash, keys, replacePathInField, setEqual } from '../../util'; +import { isUnitModel } from '../model'; +import { DataFlowNode } from './dataflow'; +import { isRectBasedMark } from '../../mark'; +import { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from './timeunit'; +function addDimension(dims, channel, fieldDef, model) { + const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; + if (isTypedFieldDef(fieldDef) && + isUnitModel(model) && + hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)) { + dims.add(vgField(fieldDef, {})); + dims.add(vgField(fieldDef, { suffix: 'end' })); + const { mark, markDef, config } = model; + const bandPosition = getBandPosition({ fieldDef, markDef, config }); + if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) { + dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_START_SUFFIX })); + dims.add(vgField(fieldDef, { suffix: OFFSETTED_RECT_END_SUFFIX })); + } + if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { + dims.add(vgField(fieldDef, { binSuffix: 'range' })); + } + } + else if (isGeoPositionChannel(channel)) { + const posChannel = getPositionChannelFromLatLong(channel); + dims.add(model.getName(posChannel)); + } + else { + dims.add(vgField(fieldDef)); + } + if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) { + dims.add(fieldDef.scale.range.field); + } + return dims; +} +function mergeMeasures(parentMeasures, childMeasures) { + for (const field of keys(childMeasures)) { + // when we merge a measure, we either have to add an aggregation operator or even a new field + const ops = childMeasures[field]; + for (const op of keys(ops)) { + if (field in parentMeasures) { + // add operator to existing measure field + parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]); + } + else { + parentMeasures[field] = { [op]: ops[op] }; + } + } + } +} +export class AggregateNode extends DataFlowNode { + clone() { + return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); + } + /** + * @param dimensions string set for dimensions + * @param measures dictionary mapping field name => dict of aggregation functions and names to use + */ + constructor(parent, dimensions, measures) { + super(parent); + this.dimensions = dimensions; + this.measures = measures; + } + get groupBy() { + return this.dimensions; + } + static makeFromEncoding(parent, model) { + let isAggregate = false; + model.forEachFieldDef(fd => { + if (fd.aggregate) { + isAggregate = true; + } + }); + const meas = {}; + const dims = new Set(); + if (!isAggregate) { + // no need to create this node if the model has no aggregation + return null; + } + model.forEachFieldDef((fieldDef, channel) => { + const { aggregate, field } = fieldDef; + if (aggregate) { + if (aggregate === 'count') { + meas['*'] ?? (meas['*'] = {}); + meas['*']['count'] = new Set([vgField(fieldDef, { forAs: true })]); + } + else { + if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { + const op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; + const argField = aggregate[op]; + meas[argField] ?? (meas[argField] = {}); + meas[argField][op] = new Set([vgField({ op, field: argField }, { forAs: true })]); + } + else { + meas[field] ?? (meas[field] = {}); + meas[field][aggregate] = new Set([vgField(fieldDef, { forAs: true })]); + } + // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain + if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { + meas[field] ?? (meas[field] = {}); + meas[field]['min'] = new Set([vgField({ field, aggregate: 'min' }, { forAs: true })]); + meas[field]['max'] = new Set([vgField({ field, aggregate: 'max' }, { forAs: true })]); + } + } + } + else { + addDimension(dims, channel, fieldDef, model); + } + }); + if (dims.size + keys(meas).length === 0) { + return null; + } + return new AggregateNode(parent, dims, meas); + } + static makeFromTransform(parent, t) { + const dims = new Set(); + const meas = {}; + for (const s of t.aggregate) { + const { op, field, as } = s; + if (op) { + if (op === 'count') { + meas['*'] ?? (meas['*'] = {}); + meas['*']['count'] = new Set([as ? as : vgField(s, { forAs: true })]); + } + else { + meas[field] ?? (meas[field] = {}); + meas[field][op] = new Set([as ? as : vgField(s, { forAs: true })]); + } + } + } + for (const s of t.groupby ?? []) { + dims.add(s); + } + if (dims.size + keys(meas).length === 0) { + return null; + } + return new AggregateNode(parent, dims, meas); + } + merge(other) { + if (setEqual(this.dimensions, other.dimensions)) { + mergeMeasures(this.measures, other.measures); + return true; + } + log.debug('different dimensions, cannot merge'); + return false; + } + addDimensions(fields) { + fields.forEach(this.dimensions.add, this.dimensions); + } + dependentFields() { + return new Set([...this.dimensions, ...keys(this.measures)]); + } + producedFields() { + const out = new Set(); + for (const field of keys(this.measures)) { + for (const op of keys(this.measures[field])) { + const m = this.measures[field][op]; + if (m.size === 0) { + out.add(`${op}_${field}`); + } + else { + m.forEach(out.add, out); + } + } + } + return out; + } + hash() { + return `Aggregate ${hash({ dimensions: this.dimensions, measures: this.measures })}`; + } + assemble() { + const ops = []; + const fields = []; + const as = []; + for (const field of keys(this.measures)) { + for (const op of keys(this.measures[field])) { + for (const alias of this.measures[field][op]) { + as.push(alias); + ops.push(op); + fields.push(field === '*' ? null : replacePathInField(field)); + } + } + } + const result = { + type: 'aggregate', + groupby: [...this.dimensions].map(replacePathInField), + ops, + fields, + as + }; + return result; + } +} +//# sourceMappingURL=aggregate.js.map \ No newline at end of file diff --git a/build/src/compile/data/aggregate.js.map b/build/src/compile/data/aggregate.js.map new file mode 100644 index 0000000000..1286a95dd2 --- /dev/null +++ b/build/src/compile/data/aggregate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aggregate.js","sourceRoot":"","sources":["../../../../src/compile/data/aggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAEL,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,cAAc,EACd,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,gBAAgB,EAEhB,eAAe,EACf,UAAU,EACV,eAAe,EACf,eAAe,EACf,OAAO,EACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAEzC,OAAO,EAAO,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,kBAAkB,EAAE,QAAQ,EAAC,MAAM,YAAY,CAAC;AACrF,OAAO,EAAC,WAAW,EAAiB,MAAM,UAAU,CAAC;AAErD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAC3C,OAA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AkB,CAAC;YACrD,GAAG;YACH,MAAM;YACN,EAAE;SACH,CAAC;QAEF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/assemble.d.ts b/build/src/compile/data/assemble.d.ts new file mode 100644 index 0000000000..ddb5955c00 --- /dev/null +++ b/build/src/compile/data/assemble.d.ts @@ -0,0 +1,18 @@ +import { InlineDataset } from '../../data'; +import { Dict } from '../../util'; +import { VgData } from '../../vega.schema'; +import { DataComponent } from './'; +import { FacetNode } from './facet'; +/** + * Assemble data sources that are derived from faceted data. + */ +export declare function assembleFacetData(root: FacetNode): VgData[]; +/** + * Create Vega data array from a given compiled model and append all of them to the given array + * + * @param model + * @param data array + * @return modified data array + */ +export declare function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[]; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/assemble.d.ts.map b/build/src/compile/data/assemble.d.ts.map new file mode 100644 index 0000000000..a9c1ead94b --- /dev/null +++ b/build/src/compile/data/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAY,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,aAAa,EAAC,MAAM,IAAI,CAAC;AAOjC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAuLlC;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,CAa3D;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,MAAM,EAAE,CAqDtG"} \ No newline at end of file diff --git a/build/src/compile/data/assemble.js b/build/src/compile/data/assemble.js new file mode 100644 index 0000000000..4f41018bf6 --- /dev/null +++ b/build/src/compile/data/assemble.js @@ -0,0 +1,239 @@ +import { isUrlData } from '../../data'; +import { AggregateNode } from './aggregate'; +import { BinNode } from './bin'; +import { CalculateNode } from './calculate'; +import { OutputNode } from './dataflow'; +import { DensityTransformNode } from './density'; +import { ExtentTransformNode } from './extent'; +import { FacetNode } from './facet'; +import { FilterNode } from './filter'; +import { FilterInvalidNode } from './filterinvalid'; +import { FlattenTransformNode } from './flatten'; +import { FoldTransformNode } from './fold'; +import { ParseNode } from './formatparse'; +import { GeoJSONNode } from './geojson'; +import { GeoPointNode } from './geopoint'; +import { GraticuleNode } from './graticule'; +import { IdentifierNode } from './identifier'; +import { ImputeNode } from './impute'; +import { JoinAggregateTransformNode } from './joinaggregate'; +import { LoessTransformNode } from './loess'; +import { LookupNode } from './lookup'; +import { QuantileTransformNode } from './quantile'; +import { RegressionTransformNode } from './regression'; +import { PivotTransformNode } from './pivot'; +import { SampleTransformNode } from './sample'; +import { SequenceNode } from './sequence'; +import { SourceNode } from './source'; +import { StackNode } from './stack'; +import { TimeUnitNode } from './timeunit'; +import { WindowTransformNode } from './window'; +function makeWalkTree(data) { + // to name datasources + let datasetIndex = 0; + /** + * Recursively walk down the tree. + */ + function walkTree(node, dataSource) { + if (node instanceof SourceNode) { + // If the source is a named data source or a data source with values, we need + // to put it in a different data source. Otherwise, Vega may override the data. + if (!node.isGenerator && !isUrlData(node.data)) { + data.push(dataSource); + const newData = { + name: null, + source: dataSource.name, + transform: [] + }; + dataSource = newData; + } + } + if (node instanceof ParseNode) { + if (node.parent instanceof SourceNode && !dataSource.source) { + // If node's parent is a root source and the data source does not refer to another data source, use normal format parse + dataSource.format = { + ...(dataSource.format ?? {}), + parse: node.assembleFormatParse() + }; + // add calculates for all nested fields + dataSource.transform.push(...node.assembleTransforms(true)); + } + else { + // Otherwise use Vega expression to parse + dataSource.transform.push(...node.assembleTransforms()); + } + } + if (node instanceof FacetNode) { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + if (!dataSource.source || dataSource.transform.length > 0) { + data.push(dataSource); + node.data = dataSource.name; + } + else { + node.data = dataSource.source; + } + data.push(...node.assemble()); + // break here because the rest of the tree has to be taken care of by the facet. + return; + } + if (node instanceof GraticuleNode || + node instanceof SequenceNode || + node instanceof FilterInvalidNode || + node instanceof FilterNode || + node instanceof CalculateNode || + node instanceof GeoPointNode || + node instanceof AggregateNode || + node instanceof LookupNode || + node instanceof WindowTransformNode || + node instanceof JoinAggregateTransformNode || + node instanceof FoldTransformNode || + node instanceof FlattenTransformNode || + node instanceof DensityTransformNode || + node instanceof LoessTransformNode || + node instanceof QuantileTransformNode || + node instanceof RegressionTransformNode || + node instanceof IdentifierNode || + node instanceof SampleTransformNode || + node instanceof PivotTransformNode || + node instanceof ExtentTransformNode) { + dataSource.transform.push(node.assemble()); + } + if (node instanceof BinNode || + node instanceof TimeUnitNode || + node instanceof ImputeNode || + node instanceof StackNode || + node instanceof GeoJSONNode) { + dataSource.transform.push(...node.assemble()); + } + if (node instanceof OutputNode) { + if (dataSource.source && dataSource.transform.length === 0) { + node.setSource(dataSource.source); + } + else if (node.parent instanceof OutputNode) { + // Note that an output node may be required but we still do not assemble a + // separate data source for it. + node.setSource(dataSource.name); + } + else { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + // Here we set the name of the datasource we generated. From now on + // other assemblers can use it. + node.setSource(dataSource.name); + // if this node has more than one child, we will add a datasource automatically + if (node.numChildren() === 1) { + data.push(dataSource); + const newData = { + name: null, + source: dataSource.name, + transform: [] + }; + dataSource = newData; + } + } + } + switch (node.numChildren()) { + case 0: + // done + if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { + // do not push empty datasources that are simply references + data.push(dataSource); + } + break; + case 1: + walkTree(node.children[0], dataSource); + break; + default: { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + let source = dataSource.name; + if (!dataSource.source || dataSource.transform.length > 0) { + data.push(dataSource); + } + else { + source = dataSource.source; + } + for (const child of node.children) { + const newData = { + name: null, + source, + transform: [] + }; + walkTree(child, newData); + } + break; + } + } + } + return walkTree; +} +/** + * Assemble data sources that are derived from faceted data. + */ +export function assembleFacetData(root) { + const data = []; + const walkTree = makeWalkTree(data); + for (const child of root.children) { + walkTree(child, { + source: root.name, + name: null, + transform: [] + }); + } + return data; +} +/** + * Create Vega data array from a given compiled model and append all of them to the given array + * + * @param model + * @param data array + * @return modified data array + */ +export function assembleRootData(dataComponent, datasets) { + const data = []; + // dataComponent.sources.forEach(debug); + // draw(dataComponent.sources); + const walkTree = makeWalkTree(data); + let sourceIndex = 0; + for (const root of dataComponent.sources) { + // assign a name if the source does not have a name yet + if (!root.hasName()) { + root.dataName = `source_${sourceIndex++}`; + } + const newData = root.assemble(); + walkTree(root, newData); + } + // remove empty transform arrays for cleaner output + for (const d of data) { + if (d.transform.length === 0) { + delete d.transform; + } + } + // move sources without transforms (the ones that are potentially used in lookups) to the beginning + let whereTo = 0; + for (const [i, d] of data.entries()) { + if ((d.transform ?? []).length === 0 && !d.source) { + data.splice(whereTo++, 0, data.splice(i, 1)[0]); + } + } + // now fix the from references in lookup transforms + for (const d of data) { + for (const t of d.transform ?? []) { + if (t.type === 'lookup') { + t.from = dataComponent.outputNodes[t.from].getSource(); + } + } + } + // inline values for datasets that are in the datastore + for (const d of data) { + if (d.name in datasets) { + d.values = datasets[d.name]; + } + } + return data; +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/data/assemble.js.map b/build/src/compile/data/assemble.js.map new file mode 100644 index 0000000000..8acc7a7f59 --- /dev/null +++ b/build/src/compile/data/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/data/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,SAAS,EAAC,MAAM,YAAY,CAAC;AAIpD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AC,CAAC,IAAI,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,CAAC;aACxD;SACF;KACF;IAED,uDAAuD;IACvD,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;QACpB,IAAI,CAAC,CAAC,IAAI,IAAI,QAAQ,EAAE;YACtB,CAAC,CAAC,MAAM,GAAG,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SAC7B;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/bin.d.ts b/build/src/compile/data/bin.d.ts new file mode 100644 index 0000000000..cc030adb36 --- /dev/null +++ b/build/src/compile/data/bin.d.ts @@ -0,0 +1,40 @@ +import { Transforms as VgTransform } from 'vega'; +import { BinParams } from '../../bin'; +import { FieldName } from '../../channeldef'; +import { BinTransform } from '../../transform'; +import { Dict } from '../../util'; +import { Model, ModelWithField } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare function getBinSignalName(model: Model, field: string, bin: boolean | BinParams): string; +export interface BinComponent { + bin: BinParams; + field: FieldName; + extentSignal?: string; + signal?: string; + span?: string; + /** Pairs of strings of the names of start and end signals */ + as: [string, string][]; + formula?: string; + formulaAs?: string; +} +export declare class BinNode extends DataFlowNode { + private bins; + clone(): BinNode; + constructor(parent: DataFlowNode, bins: Dict); + static makeFromEncoding(parent: DataFlowNode, model: ModelWithField): BinNode; + /** + * Creates a bin node from BinTransform. + * The optional parameter should provide + */ + static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model): BinNode; + /** + * Merge bin nodes. This method either integrates the bin config from the other node + * or if this node already has a bin config, renames the corresponding signal in the model. + */ + merge(other: BinNode, renameSignal: (s1: string, s2: string) => void): void; + producedFields(): Set; + dependentFields(): Set; + hash(): string; + assemble(): VgTransform[]; +} +//# sourceMappingURL=bin.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/bin.d.ts.map b/build/src/compile/data/bin.d.ts.map new file mode 100644 index 0000000000..87c2301a06 --- /dev/null +++ b/build/src/compile/data/bin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/bin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,UAAU,IAAI,WAAW,EAAC,MAAM,MAAM,CAAC;AAE/E,OAAO,EAAC,SAAS,EAA4C,MAAM,WAAW,CAAC;AAE/E,OAAO,EAAmB,SAAS,EAAwD,MAAM,kBAAkB,CAAC;AAEpH,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAmE,MAAM,YAAY,CAAC;AAElG,OAAO,EAAc,KAAK,EAAE,cAAc,EAAC,MAAM,UAAU,CAAC;AAG5D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAgCxC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,GAAG,SAAS,UAIrF;AAsCD,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,SAAS,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,6DAA6D;IAC7D,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IAIvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,qBAAa,OAAQ,SAAQ,YAAY;IAOrC,OAAO,CAAC,IAAI;IANP,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC;WAKpB,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;IAoB1E;;;OAGG;WACW,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK;IAOnF;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,KAAK,IAAI;IAkBpE,cAAc;IAQd,eAAe;IAIf,IAAI;IAIJ,QAAQ,IAAI,WAAW,EAAE;CA+CjC"} \ No newline at end of file diff --git a/build/src/compile/data/bin.js b/build/src/compile/data/bin.js new file mode 100644 index 0000000000..4c9b6ed7b7 --- /dev/null +++ b/build/src/compile/data/bin.js @@ -0,0 +1,178 @@ +import { isString } from 'vega-util'; +import { binToString, isBinning, isParameterExtent } from '../../bin'; +import { binRequiresRange, isTypedFieldDef, normalizeBin, vgField } from '../../channeldef'; +import { duplicate, hash, isEmpty, keys, replacePathInField, unique, vals } from '../../util'; +import { binFormatExpression } from '../format'; +import { isUnitModel } from '../model'; +import { parseSelectionExtent } from '../selection/parse'; +import { DataFlowNode } from './dataflow'; +function rangeFormula(model, fieldDef, channel, config) { + if (binRequiresRange(fieldDef, channel)) { + // read format from axis or legend, if there is no format then use config.numberFormat + const guide = isUnitModel(model) + ? model.axis(channel) ?? model.legend(channel) ?? {} + : {}; + const startField = vgField(fieldDef, { expr: 'datum' }); + const endField = vgField(fieldDef, { expr: 'datum', binSuffix: 'end' }); + return { + formulaAs: vgField(fieldDef, { binSuffix: 'range', forAs: true }), + formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) + }; + } + return {}; +} +function binKey(bin, field) { + return `${binToString(bin)}_${field}`; +} +function getSignalsFromModel(model, key) { + return { + signal: model.getName(`${key}_bins`), + extentSignal: model.getName(`${key}_extent`) + }; +} +export function getBinSignalName(model, field, bin) { + const normalizedBin = normalizeBin(bin, undefined) ?? {}; + const key = binKey(normalizedBin, field); + return model.getName(`${key}_bins`); +} +function isBinTransform(t) { + return 'as' in t; +} +function createBinComponent(t, bin, model) { + let as; + let span; + if (isBinTransform(t)) { + as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]]; + } + else { + as = [vgField(t, { forAs: true }), vgField(t, { binSuffix: 'end', forAs: true })]; + } + const normalizedBin = { ...normalizeBin(bin, undefined) }; + const key = binKey(normalizedBin, t.field); + const { signal, extentSignal } = getSignalsFromModel(model, key); + if (isParameterExtent(normalizedBin.extent)) { + const ext = normalizedBin.extent; + span = parseSelectionExtent(model, ext.param, ext); + delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. + } + const binComponent = { + bin: normalizedBin, + field: t.field, + as: [as], + ...(signal ? { signal } : {}), + ...(extentSignal ? { extentSignal } : {}), + ...(span ? { span } : {}) + }; + return { key, binComponent }; +} +export class BinNode extends DataFlowNode { + clone() { + return new BinNode(null, duplicate(this.bins)); + } + constructor(parent, bins) { + super(parent); + this.bins = bins; + } + static makeFromEncoding(parent, model) { + const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => { + if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { + const { key, binComponent } = createBinComponent(fieldDef, fieldDef.bin, model); + binComponentIndex[key] = { + ...binComponent, + ...binComponentIndex[key], + ...rangeFormula(model, fieldDef, channel, model.config) + }; + } + return binComponentIndex; + }, {}); + if (isEmpty(bins)) { + return null; + } + return new BinNode(parent, bins); + } + /** + * Creates a bin node from BinTransform. + * The optional parameter should provide + */ + static makeFromTransform(parent, t, model) { + const { key, binComponent } = createBinComponent(t, t.bin, model); + return new BinNode(parent, { + [key]: binComponent + }); + } + /** + * Merge bin nodes. This method either integrates the bin config from the other node + * or if this node already has a bin config, renames the corresponding signal in the model. + */ + merge(other, renameSignal) { + for (const key of keys(other.bins)) { + if (key in this.bins) { + renameSignal(other.bins[key].signal, this.bins[key].signal); + // Ensure that we don't have duplicate names for signal pairs + this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash); + } + else { + this.bins[key] = other.bins[key]; + } + } + for (const child of other.children) { + other.removeChild(child); + child.parent = this; + } + other.remove(); + } + producedFields() { + return new Set(vals(this.bins) + .map(c => c.as) + .flat(2)); + } + dependentFields() { + return new Set(vals(this.bins).map(c => c.field)); + } + hash() { + return `Bin ${hash(this.bins)}`; + } + assemble() { + return vals(this.bins).flatMap(bin => { + const transform = []; + const [binAs, ...remainingAs] = bin.as; + const { extent, ...params } = bin.bin; + const binTrans = { + type: 'bin', + field: replacePathInField(bin.field), + as: binAs, + signal: bin.signal, + ...(!isParameterExtent(extent) ? { extent } : { extent: null }), + ...(bin.span ? { span: { signal: `span(${bin.span})` } } : {}), + ...params + }; + if (!extent && bin.extentSignal) { + transform.push({ + type: 'extent', + field: replacePathInField(bin.field), + signal: bin.extentSignal + }); + binTrans.extent = { signal: bin.extentSignal }; + } + transform.push(binTrans); + for (const as of remainingAs) { + for (let i = 0; i < 2; i++) { + transform.push({ + type: 'formula', + expr: vgField({ field: binAs[i] }, { expr: 'datum' }), + as: as[i] + }); + } + } + if (bin.formula) { + transform.push({ + type: 'formula', + expr: bin.formula, + as: bin.formulaAs + }); + } + return transform; + }); + } +} +//# sourceMappingURL=bin.js.map \ No newline at end of file diff --git a/build/src/compile/data/bin.js.map b/build/src/compile/data/bin.js.map new file mode 100644 index 0000000000..e003608d94 --- /dev/null +++ b/build/src/compile/data/bin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bin.js","sourceRoot":"","sources":["../../../../src/compile/data/bin.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAY,WAAW,EAAE,SAAS,EAAE,iBAAiB,EAAC,MAAM,WAAW,CAAC;AAE/E,OAAO,EAAC,gBAAgB,EAAa,eAAe,EAAE,YAAY,EAAiB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAGpH,OAAO,EAAO,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,kBAAkB,EAAE,MAAM,EAAE,IAAI,EAAC,MAAM,YAAY,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EAAC,IAAI,EAAE,OAAO,EAAC,CAAC;wBACjD,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;qBACV,CAAC,CAAC;iBACJ;aACF;YAED,IAAI,GAAG,CAAC,OAAO,EAAE;gBACf,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,GAAG,CAAC,OAAO;oBACjB,EAAE,EAAE,GAAG,CAAC,SAAS;iBAClB,CAAC,CAAC;aACJ;YACD,OAAO,SAAS,CAAC;QACnB,CAAC,CAAC,CAAC;IACL,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/calculate.d.ts b/build/src/compile/data/calculate.d.ts new file mode 100644 index 0000000000..7d5cea1e86 --- /dev/null +++ b/build/src/compile/data/calculate.d.ts @@ -0,0 +1,19 @@ +import { FormulaTransform as VgFormulaTransform } from 'vega'; +import { SingleDefChannel } from '../../channel'; +import { FieldRefOption, TypedFieldDef } from '../../channeldef'; +import { CalculateTransform } from '../../transform'; +import { ModelWithField } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare class CalculateNode extends DataFlowNode { + private readonly transform; + private _dependentFields; + clone(): CalculateNode; + constructor(parent: DataFlowNode, transform: CalculateTransform); + static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField): DataFlowNode; + producedFields(): Set; + dependentFields(): Set; + assemble(): VgFormulaTransform; + hash(): string; +} +export declare function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption): string; +//# sourceMappingURL=calculate.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/calculate.d.ts.map b/build/src/compile/data/calculate.d.ts.map new file mode 100644 index 0000000000..1dd9cb29ea --- /dev/null +++ b/build/src/compile/data/calculate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"calculate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/calculate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAmB,aAAa,EAAU,MAAM,kBAAkB,CAAC;AAIzF,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAGxC,qBAAa,aAAc,SAAQ,YAAY;IAS3C,OAAO,CAAC,QAAQ,CAAC,SAAS;IAR5B,OAAO,CAAC,gBAAgB,CAAc;IAE/B,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,SAAS,EAAE,kBAAkB;WAOlC,oBAAoB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;IA0BvE,cAAc;IAId,eAAe;IAIf,QAAQ,IAAI,kBAAkB;IAQ9B,IAAI;CAGZ;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,GAAG,CAAC,EAAE,cAAc,UAEnH"} \ No newline at end of file diff --git a/build/src/compile/data/calculate.js b/build/src/compile/data/calculate.js new file mode 100644 index 0000000000..a2f6c5977a --- /dev/null +++ b/build/src/compile/data/calculate.js @@ -0,0 +1,59 @@ +import { isScaleFieldDef, vgField } from '../../channeldef'; +import { fieldFilterExpression } from '../../predicate'; +import { isSortArray } from '../../sort'; +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +import { getDependentFields } from './expressions'; +export class CalculateNode extends DataFlowNode { + clone() { + return new CalculateNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this._dependentFields = getDependentFields(this.transform.calculate); + } + static parseAllForSortIndex(parent, model) { + // get all the encoding with sort fields from model + model.forEachFieldDef((fieldDef, channel) => { + if (!isScaleFieldDef(fieldDef)) { + return; + } + if (isSortArray(fieldDef.sort)) { + const { field, timeUnit } = fieldDef; + const sort = fieldDef.sort; + // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate + const calculate = sort + .map((sortValue, i) => { + return `${fieldFilterExpression({ field, timeUnit, equal: sortValue })} ? ${i} : `; + }) + .join('') + sort.length; + parent = new CalculateNode(parent, { + calculate, + as: sortArrayIndexField(fieldDef, channel, { forAs: true }) + }); + } + }); + return parent; + } + producedFields() { + return new Set([this.transform.as]); + } + dependentFields() { + return this._dependentFields; + } + assemble() { + return { + type: 'formula', + expr: this.transform.calculate, + as: this.transform.as + }; + } + hash() { + return `Calculate ${hash(this.transform)}`; + } +} +export function sortArrayIndexField(fieldDef, channel, opt) { + return vgField(fieldDef, { prefix: channel, suffix: 'sort_index', ...(opt ?? {}) }); +} +//# sourceMappingURL=calculate.js.map \ No newline at end of file diff --git a/build/src/compile/data/calculate.js.map b/build/src/compile/data/calculate.js.map new file mode 100644 index 0000000000..8fafc0e8cb --- /dev/null +++ b/build/src/compile/data/calculate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"calculate.js","sourceRoot":"","sources":["../../../../src/compile/data/calculate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,eAAe,EAAiB,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzF,OAAO,EAAC,qBAAqB,EAAC,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AAEvC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,aAAc,SAAQ,YAAY;IAGtC,KAAK;QACV,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC5D,CAAC;IAED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;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,SAAS;YACf,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS;YAC9B,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE;SACtB,CAAC;IACJ,CAAC;IAEM,IAAI;QACT,OAAO,aAAa,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAC7C,CAAC;CACF;AAED,MAAM,UAAU,mBAAmB,CAAC,QAA+B,EAAE,OAAyB,EAAE,GAAoB;IAClH,OAAO,OAAO,CAAC,QAAQ,EAAE,EAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,GAAG,IAAI,EAAE,CAAC,EAAC,CAAC,CAAC;AACpF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/dataflow.d.ts b/build/src/compile/data/dataflow.d.ts new file mode 100644 index 0000000000..48072683fe --- /dev/null +++ b/build/src/compile/data/dataflow.d.ts @@ -0,0 +1,75 @@ +import { DataSourceType } from '../../data'; +import { Dict } from '../../util'; +/** + * A node in the dataflow tree. + */ +export declare abstract class DataFlowNode { + readonly debugName?: string; + private _children; + private _parent; + protected _hash: string | number; + constructor(parent: DataFlowNode, debugName?: string); + /** + * Clone this node with a deep copy but don't clone links to children or parents. + */ + clone(): DataFlowNode; + /** + * Return a hash of the node. + */ + abstract hash(): string | number; + /** + * Set of fields that this node depends on. + */ + abstract dependentFields(): Set; + /** + * Set of fields that are being created by this node. + */ + abstract producedFields(): Set; + get parent(): DataFlowNode; + /** + * Set the parent of the node and also add this node to the parent's children. + */ + set parent(parent: DataFlowNode); + get children(): DataFlowNode[]; + numChildren(): number; + addChild(child: DataFlowNode, loc?: number): void; + removeChild(oldChild: DataFlowNode): number; + /** + * Remove node from the dataflow. + */ + remove(): void; + /** + * Insert another node as a parent of this node. + */ + insertAsParentOf(other: DataFlowNode): void; + swapWithParent(): void; +} +export declare class OutputNode extends DataFlowNode { + readonly type: DataSourceType; + private readonly refCounts; + private _source; + private _name; + clone(): this; + /** + * @param source The name of the source. Will change in assemble. + * @param type The type of the output node. + * @param refCounts A global ref counter map. + */ + constructor(parent: DataFlowNode, source: string, type: DataSourceType, refCounts: Dict); + dependentFields(): Set; + producedFields(): Set; + hash(): string | number; + /** + * Request the datasource name and increase the ref counter. + * + * During the parsing phase, this will return the simple name such as 'main' or 'raw'. + * It is crucial to request the name from an output node to mark it as a required node. + * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. + * + * In the assemble phase, this will return the correct name. + */ + getSource(): string; + isRequired(): boolean; + setSource(source: string): void; +} +//# sourceMappingURL=dataflow.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/dataflow.d.ts.map b/build/src/compile/data/dataflow.d.ts.map new file mode 100644 index 0000000000..806449c3d8 --- /dev/null +++ b/build/src/compile/data/dataflow.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"dataflow.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/dataflow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,IAAI,EAAW,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,8BAAsB,YAAY;aASd,SAAS,CAAC,EAAE,MAAM;IARpC,OAAO,CAAC,SAAS,CAAsB;IAEvC,OAAO,CAAC,OAAO,CAAsB;IAErC,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;gBAG/B,MAAM,EAAE,YAAY,EACJ,SAAS,CAAC,EAAE,MAAM;IAOpC;;OAEG;IACI,KAAK,IAAI,YAAY;IAI5B;;OAEG;aACa,IAAI,IAAI,MAAM,GAAG,MAAM;IAEvC;;OAEG;aACa,eAAe,IAAI,GAAG,CAAC,MAAM,CAAC;IAE9C;;OAEG;aACa,cAAc,IAAI,GAAG,CAAC,MAAM,CAAC;IAE7C,IAAI,MAAM,IAOS,YAAY,CAL9B;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAK9B;IAED,IAAI,QAAQ,mBAEX;IAEM,WAAW;IAIX,QAAQ,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,CAAC,EAAE,MAAM;IAc1C,WAAW,CAAC,QAAQ,EAAE,YAAY;IAMzC;;OAEG;IACI,MAAM;IASb;;OAEG;IACI,gBAAgB,CAAC,KAAK,EAAE,YAAY;IAOpC,cAAc;CAoBtB;AAED,qBAAa,UAAW,SAAQ,YAAY;aAwBxB,IAAI,EAAE,cAAc;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;IAxB5B,OAAO,CAAC,OAAO,CAAS;IAExB,OAAO,CAAC,KAAK,CAAS;IAEf,KAAK,IAAI,IAAI;IAWpB;;;;OAIG;gBAED,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,MAAM,EACE,IAAI,EAAE,cAAc,EACnB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;IAWnC,eAAe;IAIf,cAAc;IAId,IAAI;IAOX;;;;;;;;OAQG;IACI,SAAS;IAKT,UAAU,IAAI,OAAO;IAIrB,SAAS,CAAC,MAAM,EAAE,MAAM;CAGhC"} \ No newline at end of file diff --git a/build/src/compile/data/dataflow.js b/build/src/compile/data/dataflow.js new file mode 100644 index 0000000000..c188128c7b --- /dev/null +++ b/build/src/compile/data/dataflow.js @@ -0,0 +1,151 @@ +import * as log from '../../log'; +import { uniqueId } from '../../util'; +/** + * A node in the dataflow tree. + */ +export class DataFlowNode { + constructor(parent, debugName) { + this.debugName = debugName; + this._children = []; + this._parent = null; + if (parent) { + this.parent = parent; + } + } + /** + * Clone this node with a deep copy but don't clone links to children or parents. + */ + clone() { + throw new Error('Cannot clone node'); + } + get parent() { + return this._parent; + } + /** + * Set the parent of the node and also add this node to the parent's children. + */ + set parent(parent) { + this._parent = parent; + if (parent) { + parent.addChild(this); + } + } + get children() { + return this._children; + } + numChildren() { + return this._children.length; + } + addChild(child, loc) { + // do not add the same child twice + if (this._children.includes(child)) { + log.warn(log.message.ADD_SAME_CHILD_TWICE); + return; + } + if (loc !== undefined) { + this._children.splice(loc, 0, child); + } + else { + this._children.push(child); + } + } + removeChild(oldChild) { + const loc = this._children.indexOf(oldChild); + this._children.splice(loc, 1); + return loc; + } + /** + * Remove node from the dataflow. + */ + remove() { + let loc = this._parent.removeChild(this); + for (const child of this._children) { + // do not use the set method because we want to insert at a particular location + child._parent = this._parent; + this._parent.addChild(child, loc++); + } + } + /** + * Insert another node as a parent of this node. + */ + insertAsParentOf(other) { + const parent = other.parent; + parent.removeChild(this); + this.parent = parent; + other.parent = this; + } + swapWithParent() { + const parent = this._parent; + const newParent = parent.parent; + // reconnect the children + for (const child of this._children) { + child.parent = parent; + } + // remove old links + this._children = []; // equivalent to removing every child link one by one + parent.removeChild(this); + const loc = parent.parent.removeChild(parent); + // swap two nodes but maintain order in children + this._parent = newParent; + newParent.addChild(this, loc); + parent.parent = this; + } +} +export class OutputNode extends DataFlowNode { + clone() { + const cloneObj = new this.constructor(); + cloneObj.debugName = `clone_${this.debugName}`; + cloneObj._source = this._source; + cloneObj._name = `clone_${this._name}`; + cloneObj.type = this.type; + cloneObj.refCounts = this.refCounts; + cloneObj.refCounts[cloneObj._name] = 0; + return cloneObj; + } + /** + * @param source The name of the source. Will change in assemble. + * @param type The type of the output node. + * @param refCounts A global ref counter map. + */ + constructor(parent, source, type, refCounts) { + super(parent, source); + this.type = type; + this.refCounts = refCounts; + this._source = this._name = source; + if (this.refCounts && !(this._name in this.refCounts)) { + this.refCounts[this._name] = 0; + } + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set(); + } + hash() { + if (this._hash === undefined) { + this._hash = `Output ${uniqueId()}`; + } + return this._hash; + } + /** + * Request the datasource name and increase the ref counter. + * + * During the parsing phase, this will return the simple name such as 'main' or 'raw'. + * It is crucial to request the name from an output node to mark it as a required node. + * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. + * + * In the assemble phase, this will return the correct name. + */ + getSource() { + this.refCounts[this._name]++; + return this._source; + } + isRequired() { + return !!this.refCounts[this._name]; + } + setSource(source) { + this._source = source; + } +} +//# sourceMappingURL=dataflow.js.map \ No newline at end of file diff --git a/build/src/compile/data/dataflow.js.map b/build/src/compile/data/dataflow.js.map new file mode 100644 index 0000000000..473409fb3f --- /dev/null +++ b/build/src/compile/data/dataflow.js.map @@ -0,0 +1 @@ +{"version":3,"file":"dataflow.js","sourceRoot":"","sources":["../../../../src/compile/data/dataflow.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAO,QAAQ,EAAC,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,MAAM,OAAgB,YAAY;IAOhC,YACE,MAAoB,EACJ,SAAkB;QAAlB,cAAS,GAAT,SAAS,CAAS;QAR5B,cAAS,GAAmB,EAAE,CAAC;QAE/B,YAAO,GAAiB,IAAI,CAAC;QAQnC,IAAI,MAAM,EAAE;YACV,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;SACtB;IACH,CAAC;IAED;;OAEG;IACI,KAAK;QACV,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;IACvC,CAAC;IAiBD,IAAI,MAAM;QACR,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,IAAI,MAAM,CAAC,MAAoB;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,MAAM,EAAE;YACV,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;SACvB;IACH,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAEM,WAAW;QAChB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;IAC/B,CAAC;IAEM,QAAQ,CAAC,KAAmB,EAAE,GAAY;QAC/C,kCAAkC;QAClC,IAAI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,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC;QAEnC,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,EAAE;YACrD,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;SAChC;IACH,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,IAAI;QACT,IAAI,IAAI,CAAC,KAAK,KAAK,SAAS,EAAE;YAC5B,IAAI,CAAC,KAAK,GAAG,UAAU,QAAQ,EAAE,EAAE,CAAC;SACrC;QACD,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED;;;;;;;;OAQG;IACI,SAAS;QACd,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;QAC7B,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;IAEM,UAAU;QACf,OAAO,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;IAEM,SAAS,CAAC,MAAc;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/density.d.ts b/build/src/compile/data/density.d.ts new file mode 100644 index 0000000000..d534b5ea8c --- /dev/null +++ b/build/src/compile/data/density.d.ts @@ -0,0 +1,16 @@ +import { KDETransform as VgKDETransform } from 'vega'; +import { DensityTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for density transform nodes + */ +export declare class DensityTransformNode extends DataFlowNode { + private transform; + clone(): DensityTransformNode; + constructor(parent: DataFlowNode, transform: DensityTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgKDETransform; +} +//# sourceMappingURL=density.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/density.d.ts.map b/build/src/compile/data/density.d.ts.map new file mode 100644 index 0000000000..8b83f13be1 --- /dev/null +++ b/build/src/compile/data/density.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"density.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/density.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,IAAI,cAAc,EAAC,MAAM,MAAM,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAOlD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,gBAAgB;IAQ9B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,cAAc;CAYlC"} \ No newline at end of file diff --git a/build/src/compile/data/density.js b/build/src/compile/data/density.js new file mode 100644 index 0000000000..ef318a5d69 --- /dev/null +++ b/build/src/compile/data/density.js @@ -0,0 +1,39 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for density transform nodes + */ +export class DensityTransformNode extends DataFlowNode { + clone() { + return new DensityTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density']; + } + dependentFields() { + return new Set([this.transform.density, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `DensityTransform ${hash(this.transform)}`; + } + assemble() { + const { density, ...rest } = this.transform; + const result = { + type: 'kde', + field: density, + ...rest + }; + if (this.transform.groupby) { + result.resolve = 'shared'; + } + return result; + } +} +//# sourceMappingURL=density.js.map \ No newline at end of file diff --git a/build/src/compile/data/density.js.map b/build/src/compile/data/density.js.map new file mode 100644 index 0000000000..81ca79d612 --- /dev/null +++ b/build/src/compile/data/density.js.map @@ -0,0 +1 @@ +{"version":3,"file":"density.js","sourceRoot":"","sources":["../../../../src/compile/data/density.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAC7C,KAAK;QACV,OAAO,IAAI,oBAAoB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACnE,CAAC;IAED,YACE,MAAoB,EACZ,SAA2B;QAEnC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAkB;QAGnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC;IAC/E,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9E,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,oBAAoB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACpD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,OAAO,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1C,MAAM,MAAM,GAAmB;YAC7B,IAAI,EAAE,KAAK;YACX,KAAK,EAAE,OAAO;YACd,GAAG,IAAI;SACR,CAAC;QACF,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YAC1B,MAAM,CAAC,OAAO,GAAG,QAAQ,CAAC;SAC3B;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/expressions.d.ts b/build/src/compile/data/expressions.d.ts new file mode 100644 index 0000000000..b01f6e844e --- /dev/null +++ b/build/src/compile/data/expressions.d.ts @@ -0,0 +1,2 @@ +export declare function getDependentFields(expression: string): Set; +//# sourceMappingURL=expressions.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/expressions.d.ts.map b/build/src/compile/data/expressions.d.ts.map new file mode 100644 index 0000000000..4130b58ffe --- /dev/null +++ b/build/src/compile/data/expressions.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"expressions.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/expressions.ts"],"names":[],"mappings":"AA4BA,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,eAWpD"} \ No newline at end of file diff --git a/build/src/compile/data/expressions.js b/build/src/compile/data/expressions.js new file mode 100644 index 0000000000..ed636e665f --- /dev/null +++ b/build/src/compile/data/expressions.js @@ -0,0 +1,33 @@ +import { parseExpression } from 'vega-expression'; +function getName(node) { + const name = []; + if (node.type === 'Identifier') { + return [node.name]; + } + if (node.type === 'Literal') { + return [node.value]; + } + if (node.type === 'MemberExpression') { + name.push(...getName(node.object)); + name.push(...getName(node.property)); + } + return name; +} +function startsWithDatum(node) { + if (node.object.type === 'MemberExpression') { + return startsWithDatum(node.object); + } + return node.object.name === 'datum'; +} +export function getDependentFields(expression) { + const ast = parseExpression(expression); + const dependents = new Set(); + // visit is missing in types https://github.com/vega/vega/issues/3298 + ast.visit((node) => { + if (node.type === 'MemberExpression' && startsWithDatum(node)) { + dependents.add(getName(node).slice(1).join('.')); + } + }); + return dependents; +} +//# sourceMappingURL=expressions.js.map \ No newline at end of file diff --git a/build/src/compile/data/expressions.js.map b/build/src/compile/data/expressions.js.map new file mode 100644 index 0000000000..8ebaec3366 --- /dev/null +++ b/build/src/compile/data/expressions.js.map @@ -0,0 +1 @@ +{"version":3,"file":"expressions.js","sourceRoot":"","sources":["../../../../src/compile/data/expressions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,SAAS,OAAO,CAAC,IAAS;IACxB,MAAM,IAAI,GAAa,EAAE,CAAC;IAE1B,IAAI,IAAI,CAAC,IAAI,KAAK,YAAY,EAAE;QAC9B,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;KACpB;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,SAAS,EAAE;QAC3B,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;KACrB;IAED,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,EAAE;QACpC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;QACnC,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;KACtC;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAS,eAAe,CAAC,IAAS;IAChC,IAAI,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,kBAAkB,EAAE;QAC3C,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;KACrC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,KAAK,OAAO,CAAC;AACtC,CAAC;AAED,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,MAAM,GAAG,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IACxC,MAAM,UAAU,GAAG,IAAI,GAAG,EAAU,CAAC;IACrC,qEAAqE;IACpE,GAAW,CAAC,KAAK,CAAC,CAAC,IAAS,EAAE,EAAE;QAC/B,IAAI,IAAI,CAAC,IAAI,KAAK,kBAAkB,IAAI,eAAe,CAAC,IAAI,CAAC,EAAE;YAC7D,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;SAClD;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/extent.d.ts b/build/src/compile/data/extent.d.ts new file mode 100644 index 0000000000..52dc8f19a9 --- /dev/null +++ b/build/src/compile/data/extent.d.ts @@ -0,0 +1,16 @@ +import { ExtentTransform as VgExtentTransform } from 'vega'; +import { ExtentTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export declare class ExtentTransformNode extends DataFlowNode { + private transform; + clone(): ExtentTransformNode; + constructor(parent: DataFlowNode, transform: ExtentTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgExtentTransform; +} +//# sourceMappingURL=extent.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/extent.d.ts.map b/build/src/compile/data/extent.d.ts.map new file mode 100644 index 0000000000..86f8225711 --- /dev/null +++ b/build/src/compile/data/extent.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"extent.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/extent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAOjD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,eAAe;IAM7B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,iBAAiB;CASrC"} \ No newline at end of file diff --git a/build/src/compile/data/extent.js b/build/src/compile/data/extent.js new file mode 100644 index 0000000000..2f1314988c --- /dev/null +++ b/build/src/compile/data/extent.js @@ -0,0 +1,34 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export class ExtentTransformNode extends DataFlowNode { + clone() { + return new ExtentTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); + } + dependentFields() { + return new Set([this.transform.extent]); + } + producedFields() { + return new Set([]); + } + hash() { + return `ExtentTransform ${hash(this.transform)}`; + } + assemble() { + const { extent, param } = this.transform; + const result = { + type: 'extent', + field: extent, + signal: param + }; + return result; + } +} +//# sourceMappingURL=extent.js.map \ No newline at end of file diff --git a/build/src/compile/data/extent.js.map b/build/src/compile/data/extent.js.map new file mode 100644 index 0000000000..7f851ffaa2 --- /dev/null +++ b/build/src/compile/data/extent.js.map @@ -0,0 +1 @@ +{"version":3,"file":"extent.js","sourceRoot":"","sources":["../../../../src/compile/data/extent.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAC5C,KAAK;QACV,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,YACE,MAAoB,EACZ,SAA0B;QAElC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAiB;QAGlC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC;IAEM,IAAI;QACT,OAAO,mBAAmB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACnD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,MAAM,EAAE,KAAK,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACvC,MAAM,MAAM,GAAsB;YAChC,IAAI,EAAE,QAAQ;YACd,KAAK,EAAE,MAAM;YACb,MAAM,EAAE,KAAK;SACd,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/facet.d.ts b/build/src/compile/data/facet.d.ts new file mode 100644 index 0000000000..08c652d14c --- /dev/null +++ b/build/src/compile/data/facet.d.ts @@ -0,0 +1,34 @@ +import { VgData } from '../../vega.schema'; +import { FacetModel } from '../facet'; +import { DataFlowNode } from './dataflow'; +/** + * A node that helps us track what fields we are faceting by. + */ +export declare class FacetNode extends DataFlowNode { + readonly model: FacetModel; + readonly name: string; + data: string; + private readonly column; + private readonly row; + private readonly facet; + private readonly childModel; + /** + * @param model The facet model. + * @param name The name that this facet source will have. + * @param data The source data for this facet data. + */ + constructor(parent: DataFlowNode, model: FacetModel, name: string, data: string); + hash(): string; + get fields(): string[]; + dependentFields(): Set; + producedFields(): Set; + /** + * The name to reference this source is its name. + */ + getSource(): string; + private getChildIndependentFieldsWithStep; + private assembleRowColumnHeaderData; + private assembleFacetHeaderData; + assemble(): VgData[]; +} +//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/facet.d.ts.map b/build/src/compile/data/facet.d.ts.map new file mode 100644 index 0000000000..4b87e0c2fe --- /dev/null +++ b/build/src/compile/data/facet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/facet.ts"],"names":[],"mappings":"AASA,OAAO,EAAgB,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACxD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAexC;;GAEG;AACH,qBAAa,SAAU,SAAQ,YAAY;aAgBvB,KAAK,EAAE,UAAU;aACjB,IAAI,EAAE,MAAM;IACrB,IAAI,EAAE,MAAM;IAjBrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAE1C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAmB;IAEvC,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAmB;IAEzC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAQ;IAEnC;;;;OAIG;gBAED,MAAM,EAAE,YAAY,EACJ,KAAK,EAAE,UAAU,EACjB,IAAI,EAAE,MAAM,EACrB,IAAI,EAAE,MAAM;IAsBd,IAAI;IAYX,IAAI,MAAM,aAST;IAEM,eAAe;IAiBf,cAAc;IAIrB;;OAEG;IACI,SAAS;IAIhB,OAAO,CAAC,iCAAiC;IAyBzC,OAAO,CAAC,2BAA2B;IA0DnC,OAAO,CAAC,uBAAuB;IAmDxB,QAAQ;CA8ChB"} \ No newline at end of file diff --git a/build/src/compile/data/facet.js b/build/src/compile/data/facet.js new file mode 100644 index 0000000000..ac940469f7 --- /dev/null +++ b/build/src/compile/data/facet.js @@ -0,0 +1,237 @@ +import { isArray } from 'vega-util'; +import { isBinning } from '../../bin'; +import { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../../channel'; +import { vgField } from '../../channeldef'; +import * as log from '../../log'; +import { hasDiscreteDomain } from '../../scale'; +import { DEFAULT_SORT_OP, isSortField } from '../../sort'; +import { hash } from '../../util'; +import { isVgRangeStep } from '../../vega.schema'; +import { HEADER_CHANNELS, HEADER_TYPES } from '../header/component'; +import { assembleDomain, getFieldFromDomain } from '../scale/domain'; +import { sortArrayIndexField } from './calculate'; +import { DataFlowNode } from './dataflow'; +/** + * A node that helps us track what fields we are faceting by. + */ +export class FacetNode extends DataFlowNode { + /** + * @param model The facet model. + * @param name The name that this facet source will have. + * @param data The source data for this facet data. + */ + constructor(parent, model, name, data) { + super(parent); + this.model = model; + this.name = name; + this.data = data; + for (const channel of FACET_CHANNELS) { + const fieldDef = model.facet[channel]; + if (fieldDef) { + const { bin, sort } = fieldDef; + this[channel] = { + name: model.getName(`${channel}_domain`), + fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { binSuffix: 'end' })] : [])], + ...(isSortField(sort) + ? { sortField: sort } + : isArray(sort) + ? { sortIndexField: sortArrayIndexField(fieldDef, channel) } + : {}) + }; + } + } + this.childModel = model.child; + } + hash() { + let out = `Facet`; + for (const channel of FACET_CHANNELS) { + if (this[channel]) { + out += ` ${channel.charAt(0)}:${hash(this[channel])}`; + } + } + return out; + } + get fields() { + const f = []; + for (const channel of FACET_CHANNELS) { + if (this[channel]?.fields) { + f.push(...this[channel].fields); + } + } + return f; + } + dependentFields() { + const depFields = new Set(this.fields); + for (const channel of FACET_CHANNELS) { + if (this[channel]) { + if (this[channel].sortField) { + depFields.add(this[channel].sortField.field); + } + if (this[channel].sortIndexField) { + depFields.add(this[channel].sortIndexField); + } + } + } + return depFields; + } + producedFields() { + return new Set(); // facet does not produce any new fields + } + /** + * The name to reference this source is its name. + */ + getSource() { + return this.name; + } + getChildIndependentFieldsWithStep() { + const childIndependentFieldsWithStep = {}; + for (const channel of POSITION_SCALE_CHANNELS) { + const childScaleComponent = this.childModel.component.scales[channel]; + if (childScaleComponent && !childScaleComponent.merged) { + // independent scale + const type = childScaleComponent.get('type'); + const range = childScaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const domain = assembleDomain(this.childModel, channel); + const field = getFieldFromDomain(domain); + if (field) { + childIndependentFieldsWithStep[channel] = field; + } + else { + log.warn(log.message.unknownField(channel)); + } + } + } + } + return childIndependentFieldsWithStep; + } + assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) { + const childChannel = { row: 'y', column: 'x', facet: undefined }[channel]; + const fields = []; + const ops = []; + const as = []; + if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { + if (crossedDataName) { + // If there is a crossed data, calculate max + fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); + ops.push('max'); + } + else { + // If there is no crossed data, just calculate distinct + fields.push(childIndependentFieldsWithStep[childChannel]); + ops.push('distinct'); + } + // Although it is technically a max, just name it distinct so it's easier to refer to it + as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); + } + const { sortField, sortIndexField } = this[channel]; + if (sortField) { + const { op = DEFAULT_SORT_OP, field } = sortField; + fields.push(field); + ops.push(op); + as.push(vgField(sortField, { forAs: true })); + } + else if (sortIndexField) { + fields.push(sortIndexField); + ops.push('max'); + as.push(sortIndexField); + } + return { + name: this[channel].name, + // Use data from the crossed one if it exist + source: crossedDataName ?? this.data, + transform: [ + { + type: 'aggregate', + groupby: this[channel].fields, + ...(fields.length + ? { + fields, + ops, + as + } + : {}) + } + ] + }; + } + assembleFacetHeaderData(childIndependentFieldsWithStep) { + const { columns } = this.model.layout; + const { layoutHeaders } = this.model.component; + const data = []; + const hasSharedAxis = {}; + for (const headerChannel of HEADER_CHANNELS) { + for (const headerType of HEADER_TYPES) { + const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? []; + for (const header of headers) { + if (header.axes?.length > 0) { + hasSharedAxis[headerChannel] = true; + break; + } + } + } + if (hasSharedAxis[headerChannel]) { + const cardinality = `length(data("${this.facet.name}"))`; + const stop = headerChannel === 'row' + ? columns + ? { signal: `ceil(${cardinality} / ${columns})` } + : 1 + : columns + ? { signal: `min(${cardinality}, ${columns})` } + : { signal: cardinality }; + data.push({ + name: `${this.facet.name}_${headerChannel}`, + transform: [ + { + type: 'sequence', + start: 0, + stop + } + ] + }); + } + } + const { row, column } = hasSharedAxis; + if (row || column) { + data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); + } + return data; + } + assemble() { + const data = []; + let crossedDataName = null; + const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); + const { column, row, facet } = this; + if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { + // Need to create a cross dataset to correctly calculate cardinality + crossedDataName = `cross_${this.column.name}_${this.row.name}`; + const fields = [].concat(childIndependentFieldsWithStep.x ?? [], childIndependentFieldsWithStep.y ?? []); + const ops = fields.map(() => 'distinct'); + data.push({ + name: crossedDataName, + source: this.data, + transform: [ + { + type: 'aggregate', + groupby: this.fields, + fields, + ops + } + ] + }); + } + for (const channel of [COLUMN, ROW]) { + if (this[channel]) { + data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); + } + } + if (facet) { + const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); + if (facetData) { + data.push(...facetData); + } + } + return data; + } +} +//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/build/src/compile/data/facet.js.map b/build/src/compile/data/facet.js.map new file mode 100644 index 0000000000..d2f5999387 --- /dev/null +++ b/build/src/compile/data/facet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../../src/compile/data/facet.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EAAC,MAAM,EAAE,cAAc,EAAE,uBAAuB,EAAE,GAAG,EAAC,MAAM,eAAe,CAAC;AACnF,OAAO,EAAC,OAAO,EAAC,MA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AC,IAAI,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;YAE/D,MAAM,MAAM,GAAa,EAAE,CAAC,MAAM,CAChC,8BAA8B,CAAC,CAAC,IAAI,EAAE,EACtC,8BAA8B,CAAC,CAAC,IAAI,EAAE,CACvC,CAAC;YACF,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC,GAAgB,EAAE,CAAC,UAAU,CAAC,CAAC;YAEtD,IAAI,CAAC,IAAI,CAAC;gBACR,IAAI,EAAE,eAAe;gBACrB,MAAM,EAAE,IAAI,CAAC,IAAI;gBACjB,SAAS,EAAE;oBACT;wBACE,IAAI,EAAE,WAAW;wBACjB,OAAO,EAAE,IAAI,CAAC,MAAM;wBACpB,MAAM;wBACN,GAAG;qBACJ;iBACF;aACF,CAAC,CAAC;SACJ;QAED,KAAK,MAAM,OAAO,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE;YACnC,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE;gBACjB,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,OAAO,EAAE,eAAe,EAAE,8BAA8B,CAAC,CAAC,CAAC;aACvG;SACF;QAED,IAAI,KAAK,EAAE;YACT,MAAM,SAAS,GAAG,IAAI,CAAC,uBAAuB,CAAC,8BAA8B,CAAC,CAAC;YAC/E,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,IAAI,CAAC,GAAG,SAAS,CAAC,CAAC;aACzB;SACF;QAED,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/filter.d.ts b/build/src/compile/data/filter.d.ts new file mode 100644 index 0000000000..e68432ca1e --- /dev/null +++ b/build/src/compile/data/filter.d.ts @@ -0,0 +1,18 @@ +import { FilterTransform as VgFilterTransform } from 'vega'; +import { LogicalComposition } from '../../logical'; +import { Predicate } from '../../predicate'; +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare class FilterNode extends DataFlowNode { + private readonly model; + private readonly filter; + private expr; + private _dependentFields; + clone(): FilterNode; + constructor(parent: DataFlowNode, model: Model, filter: LogicalComposition); + dependentFields(): Set; + producedFields(): Set; + assemble(): VgFilterTransform; + hash(): string; +} +//# sourceMappingURL=filter.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/filter.d.ts.map b/build/src/compile/data/filter.d.ts.map new file mode 100644 index 0000000000..93bf568552 --- /dev/null +++ b/build/src/compile/data/filter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"filter.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/filter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,iBAAiB,CAAC;AAE1C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAGxC,qBAAa,UAAW,SAAQ,YAAY;IASxC,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IATzB,OAAO,CAAC,IAAI,CAAS;IACrB,OAAO,CAAC,gBAAgB,CAAc;IAC/B,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,KAAK,EAAE,KAAK,EACZ,MAAM,EAAE,kBAAkB,CAAC,SAAS,CAAC;IAWjD,eAAe;IAIf,cAAc;IAId,QAAQ,IAAI,iBAAiB;IAO7B,IAAI;CAGZ"} \ No newline at end of file diff --git a/build/src/compile/data/filter.js b/build/src/compile/data/filter.js new file mode 100644 index 0000000000..44c5b885c4 --- /dev/null +++ b/build/src/compile/data/filter.js @@ -0,0 +1,34 @@ +import { duplicate } from '../../util'; +import { expression } from '../predicate'; +import { DataFlowNode } from './dataflow'; +import { getDependentFields } from './expressions'; +export class FilterNode extends DataFlowNode { + clone() { + return new FilterNode(null, this.model, duplicate(this.filter)); + } + constructor(parent, model, filter) { + super(parent); + this.model = model; + this.filter = filter; + // TODO: refactor this to not take a node and + // then add a static function makeFromOperand and make the constructor take only an expression + this.expr = expression(this.model, this.filter, this); + this._dependentFields = getDependentFields(this.expr); + } + dependentFields() { + return this._dependentFields; + } + producedFields() { + return new Set(); // filter does not produce any new fields + } + assemble() { + return { + type: 'filter', + expr: this.expr + }; + } + hash() { + return `Filter ${this.expr}`; + } +} +//# sourceMappingURL=filter.js.map \ No newline at end of file diff --git a/build/src/compile/data/filter.js.map b/build/src/compile/data/filter.js.map new file mode 100644 index 0000000000..51c3ec9e5a --- /dev/null +++ b/build/src/compile/data/filter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filter.js","sourceRoot":"","sources":["../../../../src/compile/data/filter.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAEjD,MAAM,OAAO,UAAW,SAAQ,YAAY;IAGnC,KAAK;QACV,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,YACE,MAAoB,EACH,KAAY,EACZ,MAAqC;QAEtD,KAAK,CAAC,MAAM,CAAC,CAAC;QAHG,UAAK,GAAL,KAAK,CAAO;QACZ,WAAM,GAAN,MAAM,CAA+B;QAItD,6CAA6C;QAC7C,8FAA8F;QAC9F,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAEtD,IAAI,CAAC,gBAAgB,GAAG,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxD,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,gBAAgB,CAAC;IAC/B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC,CAAC,yCAAyC;IACrE,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,IAAI;SAChB,CAAC;IACJ,CAAC;IAEM,IAAI;QACT,OAAO,UAAU,IAAI,CAAC,IAAI,EAAE,CAAC;IAC/B,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/filterinvalid.d.ts b/build/src/compile/data/filterinvalid.d.ts new file mode 100644 index 0000000000..0a05aad245 --- /dev/null +++ b/build/src/compile/data/filterinvalid.d.ts @@ -0,0 +1,19 @@ +import { FilterTransform as VgFilterTransform } from 'vega'; +import { TypedFieldDef } from '../../channeldef'; +import { Dict } from '../../util'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +export declare class FilterInvalidNode extends DataFlowNode { + readonly filter: Dict>; + clone(): FilterInvalidNode; + constructor(parent: DataFlowNode, filter: Dict>); + static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode; + dependentFields(): Set; + producedFields(): Set; + hash(): string; + /** + * Create the VgTransforms for each of the filtered fields. + */ + assemble(): VgFilterTransform; +} +//# sourceMappingURL=filterinvalid.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/filterinvalid.d.ts.map b/build/src/compile/data/filterinvalid.d.ts.map new file mode 100644 index 0000000000..36b769e82f --- /dev/null +++ b/build/src/compile/data/filterinvalid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"filterinvalid.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/filterinvalid.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAE1D,OAAO,EAAC,aAAa,EAAsB,MAAM,kBAAkB,CAAC;AAGpE,OAAO,EAAC,IAAI,EAAa,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,iBAAkB,SAAQ,YAAY;aAO/B,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAN9C,KAAK;gBAKV,MAAM,EAAE,YAAY,EACJ,MAAM,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;WAKvC,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,iBAAiB;IAiCtE,eAAe;IAIf,cAAc;IAId,IAAI;IAIX;;OAEG;IACI,QAAQ,IAAI,iBAAiB;CAyBrC"} \ No newline at end of file diff --git a/build/src/compile/data/filterinvalid.js b/build/src/compile/data/filterinvalid.js new file mode 100644 index 0000000000..d9bbb16ece --- /dev/null +++ b/build/src/compile/data/filterinvalid.js @@ -0,0 +1,78 @@ +import { isScaleChannel } from '../../channel'; +import { vgField as fieldRef } from '../../channeldef'; +import { isPathMark } from '../../mark'; +import { hasContinuousDomain } from '../../scale'; +import { hash, keys } from '../../util'; +import { getMarkPropOrConfig } from '../common'; +import { DataFlowNode } from './dataflow'; +export class FilterInvalidNode extends DataFlowNode { + clone() { + return new FilterInvalidNode(null, { ...this.filter }); + } + constructor(parent, filter) { + super(parent); + this.filter = filter; + } + static make(parent, model) { + const { config, mark, markDef } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid !== 'filter') { + return null; + } + const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => { + const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + // While discrete domain scales can handle invalid values, continuous scales can't. + // Thus, for non-path marks, we have to filter null for scales with continuous domains. + // (For path marks, we will use "defined" property and skip these values instead.) + if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { + aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def + } + } + return aggregator; + }, {}); + if (!keys(filter).length) { + return null; + } + return new FilterInvalidNode(parent, filter); + } + dependentFields() { + return new Set(keys(this.filter)); + } + producedFields() { + return new Set(); // filter does not produce any new fields + } + hash() { + return `FilterInvalid ${hash(this.filter)}`; + } + /** + * Create the VgTransforms for each of the filtered fields. + */ + assemble() { + const filters = keys(this.filter).reduce((vegaFilters, field) => { + const fieldDef = this.filter[field]; + const ref = fieldRef(fieldDef, { expr: 'datum' }); + if (fieldDef !== null) { + if (fieldDef.type === 'temporal') { + vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`); + } + else if (fieldDef.type === 'quantitative') { + vegaFilters.push(`isValid(${ref})`); + vegaFilters.push(`isFinite(+${ref})`); + } + else { + // should never get here + } + } + return vegaFilters; + }, []); + return filters.length > 0 + ? { + type: 'filter', + expr: filters.join(' && ') + } + : null; + } +} +//# sourceMappingURL=filterinvalid.js.map \ No newline at end of file diff --git a/build/src/compile/data/filterinvalid.js.map b/build/src/compile/data/filterinvalid.js.map new file mode 100644 index 0000000000..02d8d54a4c --- /dev/null +++ b/build/src/compile/data/filterinvalid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"filterinvalid.js","sourceRoot":"","sources":["../../../../src/compile/data/filterinvalid.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAgB,OAAO,IAAI,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AACpE,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAO,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC5C,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAE9C,OAAO,EAAC,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EAAE,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;aAC3B;YACH,CAAC,CAAC,IAAI,CAAC;IACX,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/flatten.d.ts b/build/src/compile/data/flatten.d.ts new file mode 100644 index 0000000000..621bcf523b --- /dev/null +++ b/build/src/compile/data/flatten.d.ts @@ -0,0 +1,16 @@ +import { FlattenTransform as VgFlattenTransform } from 'vega'; +import { FlattenTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export declare class FlattenTransformNode extends DataFlowNode { + private transform; + clone(): FlattenTransformNode; + constructor(parent: DataFlowNode, transform: FlattenTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgFlattenTransform; +} +//# sourceMappingURL=flatten.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/flatten.d.ts.map b/build/src/compile/data/flatten.d.ts.map new file mode 100644 index 0000000000..32545ac5e6 --- /dev/null +++ b/build/src/compile/data/flatten.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"flatten.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/flatten.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,YAAY;IAOlD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,gBAAgB;IAQ9B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,kBAAkB;CAUtC"} \ No newline at end of file diff --git a/build/src/compile/data/flatten.js b/build/src/compile/data/flatten.js new file mode 100644 index 0000000000..6a09037fb8 --- /dev/null +++ b/build/src/compile/data/flatten.js @@ -0,0 +1,36 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export class FlattenTransformNode extends DataFlowNode { + clone() { + return new FlattenTransformNode(this.parent, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const { flatten, as = [] } = this.transform; + this.transform.as = flatten.map((f, i) => as[i] ?? f); + } + dependentFields() { + return new Set(this.transform.flatten); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `FlattenTransform ${hash(this.transform)}`; + } + assemble() { + const { flatten: fields, as } = this.transform; + const result = { + type: 'flatten', + fields, + as + }; + return result; + } +} +//# sourceMappingURL=flatten.js.map \ No newline at end of file diff --git a/build/src/compile/data/flatten.js.map b/build/src/compile/data/flatten.js.map new file mode 100644 index 0000000000..4b0d545d19 --- /dev/null +++ b/build/src/compile/data/flatten.js.map @@ -0,0 +1 @@ +{"version":3,"file":"flatten.js","sourceRoot":"","sources":["../../../../src/compile/data/flatten.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,oBAAqB,SAAQ,YAAY;IAC7C,KAAK;QACV,OAAO,IAAI,oBAAoB,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAC1E,CAAC;IAED,YACE,MAAoB,EACZ,SAA2B;QAEnC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAkB;QAGnC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,EAAC,OAAO,EAAE,EAAE,GAAG,EAAE,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC1C,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,oBAAoB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACpD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,OAAO,EAAE,MAAM,EAAE,EAAE,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAE7C,MAAM,MAAM,GAAuB;YACjC,IAAI,EAAE,SAAS;YACf,MAAM;YACN,EAAE;SACH,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/fold.d.ts b/build/src/compile/data/fold.d.ts new file mode 100644 index 0000000000..0e70c40534 --- /dev/null +++ b/build/src/compile/data/fold.d.ts @@ -0,0 +1,16 @@ +import { FoldTransform as VgFoldTransform } from 'vega'; +import { FoldTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export declare class FoldTransformNode extends DataFlowNode { + private transform; + clone(): FoldTransformNode; + constructor(parent: DataFlowNode, transform: FoldTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgFoldTransform; +} +//# sourceMappingURL=fold.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/fold.d.ts.map b/build/src/compile/data/fold.d.ts.map new file mode 100644 index 0000000000..74d8700dd3 --- /dev/null +++ b/build/src/compile/data/fold.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fold.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/fold.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,IAAI,eAAe,EAAC,MAAM,MAAM,CAAC;AACtD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,YAAY;IAO/C,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,aAAa;IAQ3B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,eAAe;CASnC"} \ No newline at end of file diff --git a/build/src/compile/data/fold.js b/build/src/compile/data/fold.js new file mode 100644 index 0000000000..cdaadcf965 --- /dev/null +++ b/build/src/compile/data/fold.js @@ -0,0 +1,36 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for flatten transform nodes + */ +export class FoldTransformNode extends DataFlowNode { + clone() { + return new FoldTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value']; + } + dependentFields() { + return new Set(this.transform.fold); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `FoldTransform ${hash(this.transform)}`; + } + assemble() { + const { fold, as } = this.transform; + const result = { + type: 'fold', + fields: fold, + as + }; + return result; + } +} +//# sourceMappingURL=fold.js.map \ No newline at end of file diff --git a/build/src/compile/data/fold.js.map b/build/src/compile/data/fold.js.map new file mode 100644 index 0000000000..76d0d19b9b --- /dev/null +++ b/build/src/compile/data/fold.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fold.js","sourceRoot":"","sources":["../../../../src/compile/data/fold.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,M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 100644 index 0000000000..3c7a5520d2 --- /dev/null +++ b/build/src/compile/data/formatparse.d.ts @@ -0,0 +1,40 @@ +import { FormulaTransform as VgFormulaTransform } from 'vega'; +import { AncestorParse } from '.'; +import { Parse } from '../../data'; +import { FilterTransform } from '../../transform'; +import { Dict } from '../../util'; +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare function getImplicitFromFilterTransform(transform: FilterTransform): Dict; +/** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ +export declare function getImplicitFromEncoding(model: Model): Dict; +/** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ +export declare function getImplicitFromSelection(model: Model): Dict; +export declare class ParseNode extends DataFlowNode { + private _parse; + clone(): ParseNode; + constructor(parent: DataFlowNode, parse: Parse); + hash(): string; + /** + * Creates a parse node from a data.format.parse and updates ancestorParse. + */ + static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse): ParseNode; + /** + * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. + */ + static makeWithAncestors(parent: DataFlowNode, explicit: Parse, implicit: Parse, ancestorParse: AncestorParse): ParseNode; + get parse(): Parse; + merge(other: ParseNode): void; + /** + * Assemble an object for Vega's format.parse property. + */ + assembleFormatParse(): Dict; + producedFields(): Set; + dependentFields(): Set; + assembleTransforms(onlyNested?: boolean): VgFormulaTransform[]; +} +//# sourceMappingURL=formatparse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/formatparse.d.ts.map b/build/src/compile/data/formatparse.d.ts.map new file mode 100644 index 0000000000..065df55873 --- /dev/null +++ b/build/src/compile/data/formatparse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"formatparse.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/formatparse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAY,MAAM,MAAM,CAAC;AAEvE,OAAO,EAAC,aAAa,EAAC,MAAM,GAAG,CAAC;AAUhC,OAAO,EAAc,KAAK,EAAC,MAAM,YAAY,CAAC;AAgB9C,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAuC,IAAI,EAA6C,MAAM,YAAY,CAAC;AAElH,OAAO,EAA4B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAwCxC,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,eAAe,gBA2CxE;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,gBA8DnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,KAAK,gBAepD;AAED,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,MAAM,CAAQ;IAEf,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK;IAMvC,IAAI;IAIX;;OAEG;WACW,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa;IAW3F;;OAEG;WACW,iBAAiB,CAC7B,MAAM,EAAE,YAAY,EACpB,QAAQ,EAAE,KAAK,EACf,QAAQ,EAAE,KAAK,EACf,aAAa,EAAE,aAAa;IAqD9B,IAAW,KAAK,UAEf;IAEM,KAAK,CAAC,KAAK,EAAE,SAAS;IAK7B;;OAEG;IACI,mBAAmB;IAYnB,cAAc;IAId,eAAe;IAIf,kBAAkB,CAAC,UAAU,UAAQ,GAAG,kBAAkB,EAAE;CAkBpE"} \ No newline at end of file diff --git a/build/src/compile/data/formatparse.js b/build/src/compile/data/formatparse.js new file mode 100644 index 0000000000..2a842d53d2 --- /dev/null +++ b/build/src/compile/data/formatparse.js @@ -0,0 +1,302 @@ +import { isNumber, isString } from 'vega-util'; +import { isMinMaxOp } from '../../aggregate'; +import { getMainRangeChannel } from '../../channel'; +import { isFieldDef, isFieldOrDatumDefForTimeFormat, isScaleFieldDef, isTypedFieldDef } from '../../channeldef'; +import { isGenerator } from '../../data'; +import { isDateTime } from '../../datetime'; +import * as log from '../../log'; +import { forEachLeaf } from '../../logical'; +import { isPathMark } from '../../mark'; +import { isFieldEqualPredicate, isFieldGTEPredicate, isFieldGTPredicate, isFieldLTEPredicate, isFieldLTPredicate, isFieldOneOfPredicate, isFieldPredicate, isFieldRangePredicate } from '../../predicate'; +import { isSortField } from '../../sort'; +import { accessPathDepth, accessPathWithDatum, duplicate, hash, keys, removePathFromField } from '../../util'; +import { signalRefOrValue } from '../common'; +import { isFacetModel, isUnitModel } from '../model'; +import { Split } from '../split'; +import { DataFlowNode } from './dataflow'; +/** + * Remove quotes from a string. + */ +function unquote(pattern) { + if ((pattern.startsWith("'") && pattern.endsWith("'")) || (pattern.startsWith('"') && pattern.endsWith('"'))) { + return pattern.slice(1, -1); + } + return pattern; +} +/** + * @param field The field. + * @param parse What to parse the field as. + */ +function parseExpression(field, parse) { + const f = accessPathWithDatum(field); + if (parse === 'number') { + return `toNumber(${f})`; + } + else if (parse === 'boolean') { + return `toBoolean(${f})`; + } + else if (parse === 'string') { + return `toString(${f})`; + } + else if (parse === 'date') { + return `toDate(${f})`; + } + else if (parse === 'flatten') { + return f; + } + else if (parse.startsWith('date:')) { + const specifier = unquote(parse.slice(5, parse.length)); + return `timeParse(${f},'${specifier}')`; + } + else if (parse.startsWith('utc:')) { + const specifier = unquote(parse.slice(4, parse.length)); + return `utcParse(${f},'${specifier}')`; + } + else { + log.warn(log.message.unrecognizedParse(parse)); + return null; + } +} +export function getImplicitFromFilterTransform(transform) { + const implicit = {}; + forEachLeaf(transform.filter, filter => { + if (isFieldPredicate(filter)) { + // Automatically add a parse node for filters with filter objects + let val = null; + // For EqualFilter, just use the equal property. + // For RangeFilter and OneOfFilter, all array members should have + // the same type, so we only use the first one. + if (isFieldEqualPredicate(filter)) { + val = signalRefOrValue(filter.equal); + } + else if (isFieldLTEPredicate(filter)) { + val = signalRefOrValue(filter.lte); + } + else if (isFieldLTPredicate(filter)) { + val = signalRefOrValue(filter.lt); + } + else if (isFieldGTPredicate(filter)) { + val = signalRefOrValue(filter.gt); + } + else if (isFieldGTEPredicate(filter)) { + val = signalRefOrValue(filter.gte); + } + else if (isFieldRangePredicate(filter)) { + val = filter.range[0]; + } + else if (isFieldOneOfPredicate(filter)) { + val = (filter.oneOf ?? filter['in'])[0]; + } // else -- for filter expression, we can't infer anything + if (val) { + if (isDateTime(val)) { + implicit[filter.field] = 'date'; + } + else if (isNumber(val)) { + implicit[filter.field] = 'number'; + } + else if (isString(val)) { + implicit[filter.field] = 'string'; + } + } + if (filter.timeUnit) { + implicit[filter.field] = 'date'; + } + } + }); + return implicit; +} +/** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ +export function getImplicitFromEncoding(model) { + const implicit = {}; + function add(fieldDef) { + if (isFieldOrDatumDefForTimeFormat(fieldDef)) { + implicit[fieldDef.field] = 'date'; + } + else if (fieldDef.type === 'quantitative' && + isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max + ) { + implicit[fieldDef.field] = 'number'; + } + else if (accessPathDepth(fieldDef.field) > 1) { + // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. + // (Parsing numbers / dates already flattens numeric and temporal fields.) + if (!(fieldDef.field in implicit)) { + implicit[fieldDef.field] = 'flatten'; + } + } + else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { + // Flatten fields that we sort by but that are not otherwise flattened. + if (!(fieldDef.sort.field in implicit)) { + implicit[fieldDef.sort.field] = 'flatten'; + } + } + } + if (isUnitModel(model) || isFacetModel(model)) { + // Parse encoded fields + model.forEachFieldDef((fieldDef, channel) => { + if (isTypedFieldDef(fieldDef)) { + add(fieldDef); + } + else { + const mainChannel = getMainRangeChannel(channel); + const mainFieldDef = model.fieldDef(mainChannel); + add({ + ...fieldDef, + type: mainFieldDef.type + }); + } + }); + } + // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. + if (isUnitModel(model)) { + const { mark, markDef, encoding } = model; + if (isPathMark(mark) && + // No need to sort by dimension if we have a connected scatterplot (order channel is present) + !model.encoding.order) { + const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; + const dimensionChannelDef = encoding[dimensionChannel]; + if (isFieldDef(dimensionChannelDef) && + dimensionChannelDef.type === 'quantitative' && + !(dimensionChannelDef.field in implicit)) { + implicit[dimensionChannelDef.field] = 'number'; + } + } + } + return implicit; +} +/** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ +export function getImplicitFromSelection(model) { + const implicit = {}; + if (isUnitModel(model) && model.component.selection) { + for (const name of keys(model.component.selection)) { + const selCmpt = model.component.selection[name]; + for (const proj of selCmpt.project.items) { + if (!proj.channel && accessPathDepth(proj.field) > 1) { + implicit[proj.field] = 'flatten'; + } + } + } + } + return implicit; +} +export class ParseNode extends DataFlowNode { + clone() { + return new ParseNode(null, duplicate(this._parse)); + } + constructor(parent, parse) { + super(parent); + this._parse = parse; + } + hash() { + return `Parse ${hash(this._parse)}`; + } + /** + * Creates a parse node from a data.format.parse and updates ancestorParse. + */ + static makeExplicit(parent, model, ancestorParse) { + // Custom parse + let explicit = {}; + const data = model.data; + if (!isGenerator(data) && data?.format?.parse) { + explicit = data.format.parse; + } + return this.makeWithAncestors(parent, explicit, {}, ancestorParse); + } + /** + * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. + */ + static makeWithAncestors(parent, explicit, implicit, ancestorParse) { + // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. + for (const field of keys(implicit)) { + const parsedAs = ancestorParse.getWithExplicit(field); + if (parsedAs.value !== undefined) { + // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. + if (parsedAs.explicit || + parsedAs.value === implicit[field] || + parsedAs.value === 'derived' || + implicit[field] === 'flatten') { + delete implicit[field]; + } + else { + log.warn(log.message.differentParse(field, implicit[field], parsedAs.value)); + } + } + } + for (const field of keys(explicit)) { + const parsedAs = ancestorParse.get(field); + if (parsedAs !== undefined) { + // Don't parse a field again if it has been parsed with the same type already. + if (parsedAs === explicit[field]) { + delete explicit[field]; + } + else { + log.warn(log.message.differentParse(field, explicit[field], parsedAs)); + } + } + } + const parse = new Split(explicit, implicit); + // add the format parse from this model so that children don't parse the same field again + ancestorParse.copyAll(parse); + // copy only non-null parses + const p = {}; + for (const key of keys(parse.combine())) { + const val = parse.get(key); + if (val !== null) { + p[key] = val; + } + } + if (keys(p).length === 0 || ancestorParse.parseNothing) { + return null; + } + return new ParseNode(parent, p); + } + get parse() { + return this._parse; + } + merge(other) { + this._parse = { ...this._parse, ...other.parse }; + other.remove(); + } + /** + * Assemble an object for Vega's format.parse property. + */ + assembleFormatParse() { + const formatParse = {}; + for (const field of keys(this._parse)) { + const p = this._parse[field]; + if (accessPathDepth(field) === 1) { + formatParse[field] = p; + } + } + return formatParse; + } + // format parse depends and produces all fields in its parse + producedFields() { + return new Set(keys(this._parse)); + } + dependentFields() { + return new Set(keys(this._parse)); + } + assembleTransforms(onlyNested = false) { + return keys(this._parse) + .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true)) + .map(field => { + const expr = parseExpression(field, this._parse[field]); + if (!expr) { + return null; + } + const formula = { + type: 'formula', + expr, + as: removePathFromField(field) // Vega output is always flattened + }; + return formula; + }) + .filter(t => t !== null); + } +} +//# sourceMappingURL=formatparse.js.map \ No newline at end of file diff --git a/build/src/compile/data/formatparse.js.map b/build/src/compile/data/formatparse.js.map new file mode 100644 index 0000000000..08a94ee278 --- /dev/null +++ b/build/src/compile/data/formatparse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatparse.js","sourceRoot":"","sources":["../../../../src/compile/data/formatparse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,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AChC,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;aACxB;SACF;QACD,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,4DAA4D;IACrD,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACpC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC;IACpC,CAAC;IAEM,kBAAkB,CAAC,UAAU,GAAG,KAAK;QAC1C,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC;aACrB,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;aACjE,GAAG,CAAC,KAAK,CAAC,EAAE;YACX,MAAM,IAAI,GAAG,eAAe,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;YACxD,IAAI,CAAC,IAAI,EAAE;gBACT,OAAO,IAAI,CAAC;aACb;YAED,MAAM,OAAO,GAAuB;gBAClC,IAAI,EAAE,SAAS;gBACf,IAAI;gBACJ,EAAE,EAAE,mBAAmB,CAAC,KAAK,CAAC,CAAC,kCAAkC;aAClE,CAAC;YACF,OAAO,OAAO,CAAC;QACjB,CAAC,CAAC;aACD,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/geojson.d.ts b/build/src/compile/data/geojson.d.ts new file mode 100644 index 0000000000..b01b782a3b --- /dev/null +++ b/build/src/compile/data/geojson.d.ts @@ -0,0 +1,17 @@ +import { Transforms as VgTransform, Vector2 } from 'vega'; +import { VgExprRef } from '../../vega.schema'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +export declare class GeoJSONNode extends DataFlowNode { + private fields?; + private geojson?; + private signal?; + clone(): GeoJSONNode; + static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode; + constructor(parent: DataFlowNode, fields?: Vector2, geojson?: string, signal?: string); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgTransform[]; +} +//# sourceMappingURL=geojson.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/geojson.d.ts.map b/build/src/compile/data/geojson.d.ts.map new file mode 100644 index 0000000000..74d74bcffb --- /dev/null +++ b/build/src/compile/data/geojson.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geojson.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/geojson.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,WAAW,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AAMxD,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,WAAY,SAAQ,YAAY;IA4CzC,OAAO,CAAC,MAAM,CAAC;IACf,OAAO,CAAC,OAAO,CAAC;IAChB,OAAO,CAAC,MAAM,CAAC;IA7CV,KAAK;WAIE,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;gBAsC1E,MAAM,EAAE,YAAY,EACZ,MAAM,CAAC,EAAE,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,EACpC,OAAO,CAAC,EAAE,MAAM,EAChB,MAAM,CAAC,EAAE,MAAM;IAKlB,eAAe;IAKf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,WAAW,EAAE;CAkBjC"} \ No newline at end of file diff --git a/build/src/compile/data/geojson.js b/build/src/compile/data/geojson.js new file mode 100644 index 0000000000..e05e0e0988 --- /dev/null +++ b/build/src/compile/data/geojson.js @@ -0,0 +1,77 @@ +import { isString } from 'vega-util'; +import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel'; +import { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef'; +import { GEOJSON } from '../../type'; +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class GeoJSONNode extends DataFlowNode { + clone() { + return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); + } + static parseAll(parent, model) { + if (model.component.projection && !model.component.projection.isFit) { + return parent; + } + let geoJsonCounter = 0; + for (const coordinates of [ + [LONGITUDE, LATITUDE], + [LONGITUDE2, LATITUDE2] + ]) { + const pair = coordinates.map(channel => { + const def = getFieldOrDatumDef(model.encoding[channel]); + return isFieldDef(def) + ? def.field + : isDatumDef(def) + ? { expr: `${def.datum}` } + : isValueDef(def) + ? { expr: `${def['value']}` } + : undefined; + }); + if (pair[0] || pair[1]) { + parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`)); + } + } + if (model.channelHasField(SHAPE)) { + const fieldDef = model.typedFieldDef(SHAPE); + if (fieldDef.type === GEOJSON) { + parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`)); + } + } + return parent; + } + constructor(parent, fields, geojson, signal) { + super(parent); + this.fields = fields; + this.geojson = geojson; + this.signal = signal; + } + dependentFields() { + const fields = (this.fields ?? []).filter(isString); + return new Set([...(this.geojson ? [this.geojson] : []), ...fields]); + } + producedFields() { + return new Set(); + } + hash() { + return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`; + } + assemble() { + return [ + ...(this.geojson + ? [ + { + type: 'filter', + expr: `isValid(datum["${this.geojson}"])` + } + ] + : []), + { + type: 'geojson', + ...(this.fields ? { fields: this.fields } : {}), + ...(this.geojson ? { geojson: this.geojson } : {}), + signal: this.signal + } + ]; + } +} +//# sourceMappingURL=geojson.js.map \ No newline at end of file diff --git a/build/src/compile/data/geojson.js.map b/build/src/compile/data/geojson.js.map new file mode 100644 index 0000000000..320b05a197 --- /dev/null +++ b/build/src/compile/data/geojson.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geojson.js","sourceRoot":"","sources":["../../../../src/compile/data/geojson.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAqB,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AACpG,OAAO,EAAC,kBAAkB,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AACxF,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,WAAY,SAAQ,YAAY;IACpC,KAAK;QACV,OAAO,IAAI,WAAW,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAClF,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,MAAoB,EAAE,KAAgB;QAC3D,IAAI,KAAK,CAAC,SAAS,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE;YACnE,OAAO,MAAM,CAAC;SACf;QAED,IAAI,cAAc,GAAG,CAAC,CAAC;QAEvB,KAAK,MAAM,WAAW,IAAI;YACxB,CAAC,SAAS,EAAE,QAAQ,CAAC;YACrB,CAAC,UAAU,EAAE,SAAS,CAAC;SACS,EAAE;YAClC,MAAM,IAAI,GAAG,WAAW,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;gBACrC,MAAM,GAAG,GAAG,kBAAkB,CAAC,KAAK,CAAC,QAAQ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CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAa,CAAC;QAChE,OAAO,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,MAAM,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,IAAI;QACT,OAAO,WAAW,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACvE,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,GAAG,CAAC,IAAI,CAAC,OAAO;gBACd,CAAC,CAAC;oBACE;wBACE,IAAI,EAAE,QAAQ;wBACd,IAAI,EAAE,kBAAkB,IAAI,CAAC,OAAO,KAAK;qBACjC;iBACX;gBACH,CAAC,CAAC,EAAE,CAAC;YACP;gBACE,IAAI,EAAE,SAAS;gBACf,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC7C,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAChD,MAAM,EAAE,IAAI,CAAC,MAAM;aACpB;SACF,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/geopoint.d.ts b/build/src/compile/data/geopoint.d.ts new file mode 100644 index 0000000000..02409c1ae7 --- /dev/null +++ b/build/src/compile/data/geopoint.d.ts @@ -0,0 +1,17 @@ +import { GeoPointTransform as VgGeoPointTransform } from 'vega'; +import { VgExprRef } from '../../vega.schema'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +export declare class GeoPointNode extends DataFlowNode { + private projection; + private fields; + private as; + clone(): GeoPointNode; + constructor(parent: DataFlowNode, projection: string, fields: [string | VgExprRef, string | VgExprRef], as: [string, string]); + static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode; + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgGeoPointTransform; +} +//# sourceMappingURL=geopoint.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/geopoint.d.ts.map b/build/src/compile/data/geopoint.d.ts.map new file mode 100644 index 0000000000..3ba3350bbb --- /dev/null +++ b/build/src/compile/data/geopoint.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geopoint.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/geopoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAU,MAAM,MAAM,CAAC;AAKvE,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,YAAa,SAAQ,YAAY;IAO1C,OAAO,CAAC,UAAU;IAClB,OAAO,CAAC,MAAM;IACd,OAAO,CAAC,EAAE;IARL,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,CAAC,MAAM,GAAG,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC,EAChD,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC;WAKhB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,YAAY;IAiCrE,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CAQvC"} \ No newline at end of file diff --git a/build/src/compile/data/geopoint.js b/build/src/compile/data/geopoint.js new file mode 100644 index 0000000000..0dc76cd0ac --- /dev/null +++ b/build/src/compile/data/geopoint.js @@ -0,0 +1,62 @@ +import { isString } from 'vega-util'; +import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2 } from '../../channel'; +import { getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef } from '../../channeldef'; +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class GeoPointNode extends DataFlowNode { + clone() { + return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); + } + constructor(parent, projection, fields, as) { + super(parent); + this.projection = projection; + this.fields = fields; + this.as = as; + } + static parseAll(parent, model) { + if (!model.projectionName()) { + return parent; + } + for (const coordinates of [ + [LONGITUDE, LATITUDE], + [LONGITUDE2, LATITUDE2] + ]) { + const pair = coordinates.map(channel => { + const def = getFieldOrDatumDef(model.encoding[channel]); + return isFieldDef(def) + ? def.field + : isDatumDef(def) + ? { expr: `${def.datum}` } + : isValueDef(def) + ? { expr: `${def['value']}` } + : undefined; + }); + const suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; + if (pair[0] || pair[1]) { + parent = new GeoPointNode(parent, model.projectionName(), pair, [ + model.getName(`x${suffix}`), + model.getName(`y${suffix}`) + ]); + } + } + return parent; + } + dependentFields() { + return new Set(this.fields.filter(isString)); + } + producedFields() { + return new Set(this.as); + } + hash() { + return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`; + } + assemble() { + return { + type: 'geopoint', + projection: this.projection, + fields: this.fields, + as: this.as + }; + } +} +//# sourceMappingURL=geopoint.js.map \ No newline at end of file diff --git a/build/src/compile/data/geopoint.js.map b/build/src/compile/data/geopoint.js.map new file mode 100644 index 0000000000..87dd1c5962 --- /dev/null +++ b/build/src/compile/data/geopoint.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geopoint.js","sourceRoot":"","sources":["../../../../src/compile/data/geopoint.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,C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;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/graticule.d.ts b/build/src/compile/data/graticule.d.ts new file mode 100644 index 0000000000..148dfef668 --- /dev/null +++ b/build/src/compile/data/graticule.d.ts @@ -0,0 +1,13 @@ +import { GraticuleTransform as VgGraticuleTransform } from 'vega'; +import { GraticuleParams } from '../../data'; +import { DataFlowNode } from './dataflow'; +export declare class GraticuleNode extends DataFlowNode { + private params; + clone(): GraticuleNode; + constructor(parent: DataFlowNode, params: true | GraticuleParams); + dependentFields(): Set; + producedFields(): undefined; + hash(): string; + assemble(): VgGraticuleTransform; +} +//# sourceMappingURL=graticule.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/graticule.d.ts.map b/build/src/compile/data/graticule.d.ts.map new file mode 100644 index 0000000000..daa31722e2 --- /dev/null +++ b/build/src/compile/data/graticule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"graticule.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/graticule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,IAAI,oBAAoB,EAAC,MAAM,MAAM,CAAC;AAChE,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,aAAc,SAAQ,YAAY;IAO3C,OAAO,CAAC,MAAM;IANT,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,MAAM,EAAE,IAAI,GAAG,eAAe;IAKjC,eAAe;IAIf,cAAc,IAAI,SAAS;IAI3B,IAAI;IAIJ,QAAQ,IAAI,oBAAoB;CAMxC"} \ No newline at end of file diff --git a/build/src/compile/data/graticule.js b/build/src/compile/data/graticule.js new file mode 100644 index 0000000000..d540e367d0 --- /dev/null +++ b/build/src/compile/data/graticule.js @@ -0,0 +1,27 @@ +import { hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class GraticuleNode extends DataFlowNode { + clone() { + return new GraticuleNode(null, this.params); + } + constructor(parent, params) { + super(parent); + this.params = params; + } + dependentFields() { + return new Set(); + } + producedFields() { + return undefined; // there should never be a node before graticule + } + hash() { + return `Graticule ${hash(this.params)}`; + } + assemble() { + return { + type: 'graticule', + ...(this.params === true ? {} : this.params) + }; + } +} +//# sourceMappingURL=graticule.js.map \ No newline at end of file diff --git a/build/src/compile/data/graticule.js.map b/build/src/compile/data/graticule.js.map new file mode 100644 index 0000000000..d27a03a1ee --- /dev/null +++ b/build/src/compile/data/graticule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"graticule.js","sourceRoot":"","sources":["../../../../src/compile/data/graticule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,aAAc,SAAQ,YAAY;IACtC,KAAK;QACV,OAAO,IAAI,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC9C,CAAC;IAED,YACE,MAAoB,EACZ,MAA8B;QAEtC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,WAAM,GAAN,MAAM,CAAwB;IAGxC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,SAAS,CAAC,CAAC,gDAAgD;IACpE,CAAC;IAEM,IAAI;QACT,OAAO,aAAa,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1C,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,GAAG,CAAC,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC;SAC7C,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/identifier.d.ts b/build/src/compile/data/identifier.d.ts new file mode 100644 index 0000000000..779357cd69 --- /dev/null +++ b/build/src/compile/data/identifier.d.ts @@ -0,0 +1,11 @@ +import { IdentifierTransform as VgIdentifierTransform } from 'vega'; +import { DataFlowNode } from './dataflow'; +export declare class IdentifierNode extends DataFlowNode { + clone(): IdentifierNode; + constructor(parent: DataFlowNode); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgIdentifierTransform; +} +//# sourceMappingURL=identifier.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/identifier.d.ts.map b/build/src/compile/data/identifier.d.ts.map new file mode 100644 index 0000000000..702f80de63 --- /dev/null +++ b/build/src/compile/data/identifier.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/identifier.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,IAAI,qBAAqB,EAAC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,cAAe,SAAQ,YAAY;IACvC,KAAK;gBAIA,MAAM,EAAE,YAAY;IAIzB,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,qBAAqB;CAGzC"} \ No newline at end of file diff --git a/build/src/compile/data/identifier.js b/build/src/compile/data/identifier.js new file mode 100644 index 0000000000..4eee644d0a --- /dev/null +++ b/build/src/compile/data/identifier.js @@ -0,0 +1,23 @@ +import { SELECTION_ID } from '../../selection'; +import { DataFlowNode } from './dataflow'; +export class IdentifierNode extends DataFlowNode { + clone() { + return new IdentifierNode(null); + } + constructor(parent) { + super(parent); + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set([SELECTION_ID]); + } + hash() { + return 'Identifier'; + } + assemble() { + return { type: 'identifier', as: SELECTION_ID }; + } +} +//# sourceMappingURL=identifier.js.map \ No newline at end of file diff --git a/build/src/compile/data/identifier.js.map b/build/src/compile/data/identifier.js.map new file mode 100644 index 0000000000..25df3a5505 --- /dev/null +++ b/build/src/compile/data/identifier.js.map @@ -0,0 +1 @@ +{"version":3,"file":"identifier.js","sourceRoot":"","sources":["../../../../src/compile/data/identifier.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,cAAe,SAAQ,YAAY;IACvC,KAAK;QACV,OAAO,IAAI,cAAc,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,YAAY,MAAoB;QAC9B,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACjC,CAAC;IAEM,IAAI;QACT,OAAO,YAAY,CAAC;IACtB,CAAC;IAEM,QAAQ;QACb,OAAO,EAAC,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,YAAY,EAAC,CAAC;IAChD,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/impute.d.ts b/build/src/compile/data/impute.d.ts new file mode 100644 index 0000000000..be131c7bd0 --- /dev/null +++ b/build/src/compile/data/impute.d.ts @@ -0,0 +1,17 @@ +import { FormulaTransform as VgFormulaTransform, ImputeTransform as VgImputeTransform, WindowTransform as VgWindowTransform } from 'vega'; +import { ImputeTransform } from '../../transform'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +export declare class ImputeNode extends DataFlowNode { + private readonly transform; + clone(): ImputeNode; + constructor(parent: DataFlowNode, transform: ImputeTransform); + dependentFields(): Set; + producedFields(): Set; + private processSequence; + static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode; + static makeFromEncoding(parent: DataFlowNode, model: UnitModel): ImputeNode; + hash(): string; + assemble(): (VgFormulaTransform | VgImputeTransform | VgWindowTransform)[]; +} +//# sourceMappingURL=impute.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/impute.d.ts.map b/build/src/compile/data/impute.d.ts.map new file mode 100644 index 0000000000..5e859490fd --- /dev/null +++ b/build/src/compile/data/impute.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"impute.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/impute.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,IAAI,kBAAkB,EACtC,eAAe,IAAI,iBAAiB,EAEpC,eAAe,IAAI,iBAAiB,EACrC,MAAM,MAAM,CAAC;AAGd,OAAO,EAAiB,eAAe,EAAmB,MAAM,iBAAiB,CAAC;AAElF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,UAAW,SAAQ,YAAY;IAOxC,OAAO,CAAC,QAAQ,CAAC,SAAS;IANrB,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,SAAS,EAAE,eAAe;IAKtC,eAAe;IAIf,cAAc;IAIrB,OAAO,CAAC,eAAe;WAOT,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,GAAG,UAAU;WAIrF,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IA2B9D,IAAI;IAIJ,QAAQ;CAiChB"} \ No newline at end of file diff --git a/build/src/compile/data/impute.js b/build/src/compile/data/impute.js new file mode 100644 index 0000000000..735747b9e7 --- /dev/null +++ b/build/src/compile/data/impute.js @@ -0,0 +1,88 @@ +import { isFieldDef } from '../../channeldef'; +import { pathGroupingFields } from '../../encoding'; +import { isImputeSequence } from '../../transform'; +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class ImputeNode extends DataFlowNode { + clone() { + return new ImputeNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + dependentFields() { + return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set([this.transform.impute]); + } + processSequence(keyvals) { + const { start = 0, stop, step } = keyvals; + const result = [start, stop, ...(step ? [step] : [])].join(','); + return { signal: `sequence(${result})` }; + } + static makeFromTransform(parent, imputeTransform) { + return new ImputeNode(parent, imputeTransform); + } + static makeFromEncoding(parent, model) { + const encoding = model.encoding; + const xDef = encoding.x; + const yDef = encoding.y; + if (isFieldDef(xDef) && isFieldDef(yDef)) { + const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; + if (imputedChannel === undefined) { + return undefined; + } + const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; + const { method, value, frame, keyvals } = imputedChannel.impute; + const groupbyFields = pathGroupingFields(model.mark, encoding); + return new ImputeNode(parent, { + impute: imputedChannel.field, + key: keyChannel.field, + ...(method ? { method } : {}), + ...(value !== undefined ? { value } : {}), + ...(frame ? { frame } : {}), + ...(keyvals !== undefined ? { keyvals } : {}), + ...(groupbyFields.length ? { groupby: groupbyFields } : {}) + }); + } + return null; + } + hash() { + return `Impute ${hash(this.transform)}`; + } + assemble() { + const { impute, key, keyvals, method, groupby, value, frame = [null, null] } = this.transform; + const imputeTransform = { + type: 'impute', + field: impute, + key, + ...(keyvals ? { keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals } : {}), + method: 'value', + ...(groupby ? { groupby } : {}), + value: !method || method === 'value' ? value : null + }; + if (method && method !== 'value') { + const deriveNewField = { + type: 'window', + as: [`imputed_${impute}_value`], + ops: [method], + fields: [impute], + frame, + ignorePeers: false, + ...(groupby ? { groupby } : {}) + }; + const replaceOriginal = { + type: 'formula', + expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`, + as: impute + }; + return [imputeTransform, deriveNewField, replaceOriginal]; + } + else { + return [imputeTransform]; + } + } +} +//# sourceMappingURL=impute.js.map \ No newline at end of file diff --git a/build/src/compile/data/impute.js.map b/build/src/compile/data/impute.js.map new file mode 100644 index 0000000000..d11a52e416 --- /dev/null +++ b/build/src/compile/data/impute.js.map @@ -0,0 +1 @@ +{"version":3,"file":"impute.js","sourceRoot":"","sources":["../../../../src/compile/data/impute.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAkC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAClF,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,UAAW,SAAQ,YAAY;IACnC,KAAK;QACV,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzD,CAAC;IAED,YACE,MAAoB,EACH,SAA0B;QAE3C,KAAK,CAAC,MAAM,CAAC,CAAC;QAFG,cAAS,GAAT,SAAS,CAAiB;IAG7C,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACjG,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC;IAEO,eAAe,CAAC,OAAuB;QAC7C,MAAM,EAAC,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,IAAI,EAAC,GAAG,OAAO,CAAC;QACxC,MAAM,MAAM,GAAG,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI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OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI;SACpD,CAAC;QAEF,IAAI,MAAM,IAAI,MAAM,KAAK,OAAO,EAAE;YAChC,MAAM,cAAc,GAAsB;gBACxC,IAAI,EAAE,QAAQ;gBACd,EAAE,EAAE,CAAC,WAAW,MAAM,QAAQ,CAAC;gBAC/B,GAAG,EAAE,CAAC,MAAM,CAAC;gBACb,MAAM,EAAE,CAAC,MAAM,CAAC;gBAChB,KAAK;gBACL,WAAW,EAAE,KAAK;gBAClB,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aAC9B,CAAC;YACF,MAAM,eAAe,GAAuB;gBAC1C,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,SAAS,MAAM,6BAA6B,MAAM,kBAAkB,MAAM,EAAE;gBAClF,EAAE,EAAE,MAAM;aACX,CAAC;YACF,OAAO,CAAC,eAAe,EAAE,cAAc,EAAE,eAAe,CAAC,CAAC;SAC3D;aAAM;YACL,OAAO,CAAC,eAAe,CAAC,CAAC;SAC1B;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/index.d.ts b/build/src/compile/data/index.d.ts new file mode 100644 index 0000000000..35f95dda35 --- /dev/null +++ b/build/src/compile/data/index.d.ts @@ -0,0 +1,56 @@ +import { Parse } from '../../data'; +import { Dict } from '../../util'; +import { Split } from '../split'; +import { OutputNode } from './dataflow'; +import { FacetNode } from './facet'; +import { SourceNode } from './source'; +export interface DataComponent { + /** + * A list of unique sources. + */ + sources: SourceNode[]; + /** + * Registry of output nodes. + */ + outputNodes: Dict; + /** + * How often is an output node used. If it is not used, we don't need to + * instantiate it in the assemble step. + */ + outputNodeRefCounts: Dict; + /** + * The output node before aggregation. + */ + raw?: OutputNode; + /** + * The main output node. + */ + main?: OutputNode; + /** + * For facets, we store the reference to the root node. + */ + facetRoot?: FacetNode; + /** + * True if the data for this model is faceted. + * A dataset is faceted if a parent model is a facet and no new dataset is + * defined (which would make the data unfaceted again). + */ + isFaceted: boolean; + /** + * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived. + */ + ancestorParse?: AncestorParse; +} +/** + * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) + * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the + * same field again (or differently). + */ +export declare class AncestorParse extends Split { + readonly explicit: Partial; + readonly implicit: Partial; + parseNothing: boolean; + constructor(explicit?: Partial, implicit?: Partial, parseNothing?: boolean); + clone(): AncestorParse; +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/index.d.ts.map b/build/src/compile/data/index.d.ts.map new file mode 100644 index 0000000000..449f4f543c --- /dev/null +++ b/build/src/compile/data/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,UAAU,EAAE,CAAC;IAEtB;;OAEG;IACH,WAAW,EAAE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC,CAAC;IAE1C;;;OAGG;IACH,mBAAmB,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAElC;;OAEG;IACH,GAAG,CAAC,EAAE,UAAU,CAAC;IAEjB;;OAEG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;IAElB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,aAAa,CAAC,EAAE,aAAa,CAAC;CAC/B;AAED;;;;GAIG;AACH,qBAAa,aAAc,SAAQ,KAAK,CAAC,KAAK,CAAC;aAE3B,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;aACxB,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC;IACjC,YAAY;gBAFH,QAAQ,GAAE,OAAO,CAAC,KAAK,CAAM,EAC7B,QAAQ,GAAE,OAAO,CAAC,KAAK,CAAM,EACtC,YAAY,UAAQ;IAKtB,KAAK,IAAI,aAAa;CAK9B"} \ No newline at end of file diff --git a/build/src/compile/data/index.js b/build/src/compile/data/index.js new file mode 100644 index 0000000000..136bb34dc8 --- /dev/null +++ b/build/src/compile/data/index.js @@ -0,0 +1,20 @@ +import { Split } from '../split'; +/** + * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) + * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the + * same field again (or differently). + */ +export class AncestorParse extends Split { + constructor(explicit = {}, implicit = {}, parseNothing = false) { + super(explicit, implicit); + this.explicit = explicit; + this.implicit = implicit; + this.parseNothing = parseNothing; + } + clone() { + const clone = super.clone(); + clone.parseNothing = this.parseNothing; + return clone; + } +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/compile/data/index.js.map b/build/src/compile/data/index.js.map new file mode 100644 index 0000000000..477217a3bf --- /dev/null +++ b/build/src/compile/data/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/compile/data/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAkD/B;;;;GAIG;AACH,MAAM,OAAO,aAAc,SAAQ,KAAY;IAC7C,YACkB,WAA2B,EAAE,EAC7B,WAA2B,EAAE,EACtC,eAAe,KAAK;QAE3B,KAAK,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QAJV,aAAQ,GAAR,QAAQ,CAAqB;QAC7B,aAAQ,GAAR,QAAQ,CAAqB;QACtC,iBAAY,GAAZ,YAAY,CAAQ;IAG7B,CAAC;IAEM,KAAK;QACV,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,EAAmB,CAAC;QAC7C,KAAK,CAAC,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;QACvC,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/joinaggregate.d.ts b/build/src/compile/data/joinaggregate.d.ts new file mode 100644 index 0000000000..f116dc8923 --- /dev/null +++ b/build/src/compile/data/joinaggregate.d.ts @@ -0,0 +1,18 @@ +import { JoinAggregateTransform } from '../../transform'; +import { VgJoinAggregateTransform } from '../../vega.schema'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the join aggregate transform nodes. + */ +export declare class JoinAggregateTransformNode extends DataFlowNode { + private readonly transform; + clone(): JoinAggregateTransformNode; + constructor(parent: DataFlowNode, transform: JoinAggregateTransform); + addDimensions(fields: string[]): void; + dependentFields(): Set; + producedFields(): Set; + private getDefaultName; + hash(): string; + assemble(): VgJoinAggregateTransform; +} +//# sourceMappingURL=joinaggregate.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/joinaggregate.d.ts.map b/build/src/compile/data/joinaggregate.d.ts.map new file mode 100644 index 0000000000..ed39bcc78c --- /dev/null +++ b/build/src/compile/data/joinaggregate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"joinaggregate.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregate.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,sBAAsB,EAAC,MAAM,iBAAiB,CAAC;AAEvD,OAAO,EAAC,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAG3D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,0BAA2B,SAAQ,YAAY;IAOxD,OAAO,CAAC,QAAQ,CAAC,SAAS;IANrB,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,SAAS,EAAE,sBAAsB;IAK7C,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAcf,cAAc;IAIrB,OAAO,CAAC,cAAc;IAIf,IAAI;IAIJ,QAAQ,IAAI,wBAAwB;CAoB5C"} \ No newline at end of file diff --git a/build/src/compile/data/joinaggregate.js b/build/src/compile/data/joinaggregate.js new file mode 100644 index 0000000000..6efe39406d --- /dev/null +++ b/build/src/compile/data/joinaggregate.js @@ -0,0 +1,58 @@ +import { vgField } from '../../channeldef'; +import { duplicate, hash } from '../../util'; +import { unique } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the join aggregate transform nodes. + */ +export class JoinAggregateTransformNode extends DataFlowNode { + clone() { + return new JoinAggregateTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); + } + dependentFields() { + const out = new Set(); + if (this.transform.groupby) { + this.transform.groupby.forEach(out.add, out); + } + this.transform.joinaggregate + .map(w => w.field) + .filter(f => f !== undefined) + .forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this.transform.joinaggregate.map(this.getDefaultName)); + } + getDefaultName(joinAggregateFieldDef) { + return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef); + } + hash() { + return `JoinAggregateTransform ${hash(this.transform)}`; + } + assemble() { + const fields = []; + const ops = []; + const as = []; + for (const joinaggregate of this.transform.joinaggregate) { + ops.push(joinaggregate.op); + as.push(this.getDefaultName(joinaggregate)); + fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); + } + const groupby = this.transform.groupby; + return { + type: 'joinaggregate', + as, + ops, + fields, + ...(groupby !== undefined ? { groupby } : {}) + }; + } +} +//# sourceMappingURL=joinaggregate.js.map \ No newline at end of file diff --git a/build/src/compile/data/joinaggregate.js.map b/build/src/compile/data/joinaggregate.js.map new file mode 100644 index 0000000000..094d396184 --- /dev/null +++ b/build/src/compile/data/joinaggregate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"joinaggregate.js","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAG3C,OAAO,EAAC,MAAM,EAAC,MAAM,YAAY,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,0BAA2B,SAAQ,YAAY;IACnD,KAAK;QACV,OAAO,IAAI,0BAA0B,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACzE,CAAC;IAED,YACE,MAAoB,EACH,SAAiC;QAElD,KAAK,CAAC,MAAM,CAAC,CAAC;QAFG,cAAS,GAAT,SAAS,CAAwB;IAGpD,CAAC;IAEM,aAAa,CAAC,MAAgB;QACnC,IAAI,CAAC,SAAS,CAAC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IACjF,CAAC;IAEM,eAAe;QACpB,MAAM,GAAG,GAAG,IAAI,GAAG,EAAU,CAAC;QAE9B,IAAI,IAAI,CAAC,SAAS,CAAC,OAAO,EAAE;YAC1B,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;SAC9C;QACD,IAAI,CAAC,SAAS,CAAC,aAAa;aACzB,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;aACjB,MAAM,C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file diff --git a/build/src/compile/data/joinaggregatefacet.d.ts b/build/src/compile/data/joinaggregatefacet.d.ts new file mode 100644 index 0000000000..43d63e1da6 --- /dev/null +++ b/build/src/compile/data/joinaggregatefacet.d.ts @@ -0,0 +1,5 @@ +import { FacetMapping } from '../../spec/facet'; +import { DataFlowNode } from './dataflow'; +import { JoinAggregateTransformNode } from './joinaggregate'; +export declare function makeJoinAggregateFromFacet(parent: DataFlowNode, facet: FacetMapping): JoinAggregateTransformNode; +//# sourceMappingURL=joinaggregatefacet.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/joinaggregatefacet.d.ts.map b/build/src/compile/data/joinaggregatefacet.d.ts.map new file mode 100644 index 0000000000..484073ae21 --- /dev/null +++ b/build/src/compile/data/joinaggregatefacet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"joinaggregatefacet.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregatefacet.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAE3D,wBAAgB,0BAA0B,CACxC,MAAM,EAAE,YAAY,EACpB,KAAK,EAAE,YAAY,CAAC,MAAM,CAAC,GAC1B,0BAA0B,CAuB5B"} \ No newline at end of file diff --git a/build/src/compile/data/joinaggregatefacet.js b/build/src/compile/data/joinaggregatefacet.js new file mode 100644 index 0000000000..17795ee993 --- /dev/null +++ b/build/src/compile/data/joinaggregatefacet.js @@ -0,0 +1,29 @@ +import { vgField } from '../../channeldef'; +import { DEFAULT_SORT_OP, isSortField } from '../../sort'; +import { facetSortFieldName } from '../facet'; +import { JoinAggregateTransformNode } from './joinaggregate'; +export function makeJoinAggregateFromFacet(parent, facet) { + const { row, column } = facet; + if (row && column) { + let newParent = null; + // only need to make one for crossed facet + for (const fieldDef of [row, column]) { + if (isSortField(fieldDef.sort)) { + const { field, op = DEFAULT_SORT_OP } = fieldDef.sort; + parent = newParent = new JoinAggregateTransformNode(parent, { + joinaggregate: [ + { + op, + field, + as: facetSortFieldName(fieldDef, fieldDef.sort, { forAs: true }) + } + ], + groupby: [vgField(fieldDef)] + }); + } + } + return newParent; + } + return null; +} +//# sourceMappingURL=joinaggregatefacet.js.map \ No newline at end of file diff --git a/build/src/compile/data/joinaggregatefacet.js.map b/build/src/compile/data/joinaggregatefacet.js.map new file mode 100644 index 0000000000..dd0bb92e89 --- /dev/null +++ b/build/src/compile/data/joinaggregatefacet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"joinaggregatefacet.js","sourceRoot":"","sources":["../../../../src/compile/data/joinaggregatefacet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAC,eAAe,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAExD,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAE5C,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAE3D,MAAM,UAAU,0BAA0B,CACxC,MAAoB,EACpB,KAA2B;IAE3B,MAAM,EAAC,GAAG,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC5B,IAAI,GAAG,IAAI,MAAM,EAAE;QACjB,IAAI,SAAS,GAAG,IAAI,CAAC;QACrB,0CAA0C;QAC1C,KAAK,MAAM,QAAQ,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE;YACpC,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;gBAC9B,MAAM,EAAC,KAAK,EAAE,EAAE,GAAG,eAAe,EAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;gBACpD,MAAM,GAAG,SAAS,GAAG,IAAI,0BAA0B,CAAC,MAAM,EAAE;oBAC1D,aAAa,EAAE;wBACb;4BACE,EAAE;4BACF,KAAK;4BACL,EAAE,EAAE,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,EAAC,KAAK,EAAE,IAAI,EAAC,CAAC;yBAC/D;qBACF;oBACD,OAAO,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;iBAC7B,CAAC,CAAC;aACJ;SACF;QACD,OAAO,SAAS,CAAC;KAClB;IACD,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/loess.d.ts b/build/src/compile/data/loess.d.ts new file mode 100644 index 0000000000..a19771d942 --- /dev/null +++ b/build/src/compile/data/loess.d.ts @@ -0,0 +1,16 @@ +import { LoessTransform as VgLoessTransform } from 'vega'; +import { LoessTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for loess transform nodes + */ +export declare class LoessTransformNode extends DataFlowNode { + private transform; + clone(): LoessTransformNode; + constructor(parent: DataFlowNode, transform: LoessTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgLoessTransform; +} +//# sourceMappingURL=loess.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/loess.d.ts.map b/build/src/compile/data/loess.d.ts.map new file mode 100644 index 0000000000..266139df43 --- /dev/null +++ b/build/src/compile/data/loess.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"loess.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/loess.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,IAAI,gBAAgB,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAOhD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,cAAc;IAQ5B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,gBAAgB;CAUpC"} \ No newline at end of file diff --git a/build/src/compile/data/loess.js b/build/src/compile/data/loess.js new file mode 100644 index 0000000000..830625a9ab --- /dev/null +++ b/build/src/compile/data/loess.js @@ -0,0 +1,37 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for loess transform nodes + */ +export class LoessTransformNode extends DataFlowNode { + clone() { + return new LoessTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess]; + } + dependentFields() { + return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `LoessTransform ${hash(this.transform)}`; + } + assemble() { + const { loess, on, ...rest } = this.transform; + const result = { + type: 'loess', + x: on, + y: loess, + ...rest + }; + return result; + } +} +//# sourceMappingURL=loess.js.map \ No newline at end of file diff --git a/build/src/compile/data/loess.js.map b/build/src/compile/data/loess.js.map new file mode 100644 index 0000000000..eb6b7d2665 --- /dev/null +++ b/build/src/compile/data/loess.js.map @@ -0,0 +1 @@ +{"version":3,"file":"loess.js","sourceRoot":"","sources":["../../../../src/compile/data/loess.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAC3C,KAAK;QACV,OAAO,IAAI,kBAAkB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACjE,CAAC;IAED,YACE,MAAoB,EACZ,SAAyB;QAEjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAgB;QAGjC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,CAAC;IAC1F,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/F,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,kBAAkB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IAClD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,KAAK,EAAE,EAAE,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC5C,MAAM,MAAM,GAAqB;YAC/B,IAAI,EAAE,OAAO;YACb,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,KAAK;YACR,GAAG,IAAI;SACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/lookup.d.ts b/build/src/compile/data/lookup.d.ts new file mode 100644 index 0000000000..28fadd3a27 --- /dev/null +++ b/build/src/compile/data/lookup.d.ts @@ -0,0 +1,16 @@ +import { LookupTransform as VgLookupTransform } from 'vega'; +import { LookupTransform } from '../../transform'; +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare class LookupNode extends DataFlowNode { + readonly transform: LookupTransform; + readonly secondary: string; + clone(): LookupNode; + constructor(parent: DataFlowNode, transform: LookupTransform, secondary: string); + static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number): LookupNode; + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgLookupTransform; +} +//# sourceMappingURL=lookup.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/lookup.d.ts.map b/build/src/compile/data/lookup.d.ts.map new file mode 100644 index 0000000000..88426ba76d --- /dev/null +++ b/build/src/compile/data/lookup.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lookup.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/lookup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAG1D,OAAO,EAAkC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEjF,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAKpD,qBAAa,UAAW,SAAQ,YAAY;aAOxB,SAAS,EAAE,eAAe;aAC1B,SAAS,EAAE,MAAM;IAP5B,KAAK;gBAKV,MAAM,EAAE,YAAY,EACJ,SAAS,EAAE,eAAe,EAC1B,SAAS,EAAE,MAAM;WAKrB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM;IAyC3F,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,iBAAiB;CA+BrC"} \ No newline at end of file diff --git a/build/src/compile/data/lookup.js b/build/src/compile/data/lookup.js new file mode 100644 index 0000000000..694db0d7ae --- /dev/null +++ b/build/src/compile/data/lookup.js @@ -0,0 +1,88 @@ +import { array, isString } from 'vega-util'; +import * as log from '../../log'; +import { isLookupData, isLookupSelection } from '../../transform'; +import { duplicate, hash, varName } from '../../util'; +import { DataFlowNode, OutputNode } from './dataflow'; +import { findSource } from './parse'; +import { SourceNode } from './source'; +import { DataSourceType } from '../../data'; +export class LookupNode extends DataFlowNode { + clone() { + return new LookupNode(null, duplicate(this.transform), this.secondary); + } + constructor(parent, transform, secondary) { + super(parent); + this.transform = transform; + this.secondary = secondary; + } + static make(parent, model, transform, counter) { + const sources = model.component.data.sources; + const { from } = transform; + let fromOutputNode = null; + if (isLookupData(from)) { + let fromSource = findSource(from.data, sources); + if (!fromSource) { + fromSource = new SourceNode(from.data); + sources.push(fromSource); + } + const fromOutputName = model.getName(`lookup_${counter}`); + fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); + model.component.data.outputNodes[fromOutputName] = fromOutputNode; + } + else if (isLookupSelection(from)) { + const selName = from.param; + transform = { as: selName, ...transform }; + let selCmpt; + try { + selCmpt = model.getSelectionComponent(varName(selName), selName); + } + catch (e) { + throw new Error(log.message.cannotLookupVariableParameter(selName)); + } + fromOutputNode = selCmpt.materialized; + if (!fromOutputNode) { + throw new Error(log.message.noSameUnitLookup(selName)); + } + } + return new LookupNode(parent, transform, fromOutputNode.getSource()); + } + dependentFields() { + return new Set([this.transform.lookup]); + } + producedFields() { + return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields); + } + hash() { + return `Lookup ${hash({ transform: this.transform, secondary: this.secondary })}`; + } + assemble() { + let foreign; + if (this.transform.from.fields) { + // lookup a few fields and add create a flat output + foreign = { + values: this.transform.from.fields, + ...(this.transform.as ? { as: array(this.transform.as) } : {}) + }; + } + else { + // lookup full record and nest it + let asName = this.transform.as; + if (!isString(asName)) { + log.warn(log.message.NO_FIELDS_NEEDS_AS); + asName = '_lookup'; + } + foreign = { + as: [asName] + }; + } + return { + type: 'lookup', + from: this.secondary, + key: this.transform.from.key, + fields: [this.transform.lookup], + ...foreign, + ...(this.transform.default ? { default: this.transform.default } : {}) + }; + } +} +//# sourceMappingURL=lookup.js.map \ No newline at end of file diff --git a/build/src/compile/data/lookup.js.map b/build/src/compile/data/lookup.js.map new file mode 100644 index 0000000000..f39d5dc204 --- /dev/null +++ b/build/src/compile/data/lookup.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lookup.js","sourceRoot":"","sources":["../../../../src/compile/data/lookup.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,YAAY,EAAE,iBAAiB,EAAkB,MAAM,iBAAiB,CAAC;AACjF,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,MAAM,OAAO,UAAW,SAAQ,YAAY;IACnC,KAAK;QACV,OAAO,IAAI,UAAU,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC;IACzE,CAAC;IAED,YACE,MAAoB,EACJ,SAA0B,EAC1B,SAAiB;QAEjC,KAAK,CAAC,MAAM,CAAC,CAAC;QAHE,cAAS,GAAT,SAAS,CAAiB;QAC1B,cAAS,GAAT,SAAS,CAAQ;IAGnC,CAAC;IAEM,MAAM,CAAC,IAAI,CAAC,MAAoB,EAAE,KAAY,EAAE,SAA0B,EAAE,OAAe;QAChG,MAAM,OAAO,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC;QAC7C,MAAM,EAAC,IAAI,EAAC,GAAG,SAAS,CAAC;QACzB,IAAI,cAAc,GAAG,IAAI,CAA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OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,SAAS;YACpB,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG;YAC5B,MAAM,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC;YAC/B,GAAG,OAAO;YACV,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SACrE,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/optimize.d.ts b/build/src/compile/data/optimize.d.ts new file mode 100644 index 0000000000..fa0db34f22 --- /dev/null +++ b/build/src/compile/data/optimize.d.ts @@ -0,0 +1,14 @@ +import { DataComponent } from '.'; +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +export declare const FACET_SCALE_PREFIX = "scale_"; +export declare const MAX_OPTIMIZATION_RUNS = 5; +/** + * Iterates over a dataflow graph and checks whether all links are consistent. + */ +export declare function checkLinks(nodes: readonly DataFlowNode[]): boolean; +/** + * Optimizes the dataflow of the passed in data component. + */ +export declare function optimizeDataflow(data: DataComponent, model: Model): void; +//# sourceMappingURL=optimize.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/optimize.d.ts.map b/build/src/compile/data/optimize.d.ts.map new file mode 100644 index 0000000000..7d702f4bdf --- /dev/null +++ b/build/src/compile/data/optimize.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"optimize.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimize.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,GAAG,CAAC;AAEhC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAKxC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,qBAAqB,IAAI,CAAC;AAEvC;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,YAAY,EAAE,GAAG,OAAO,CAelE;AAkDD;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,aAAa,EAAE,KAAK,EAAE,KAAK,QA8BjE"} \ No newline at end of file diff --git a/build/src/compile/data/optimize.js b/build/src/compile/data/optimize.js new file mode 100644 index 0000000000..ce8711fb95 --- /dev/null +++ b/build/src/compile/data/optimize.js @@ -0,0 +1,88 @@ +import * as log from '../../log'; +import * as optimizers from './optimizers'; +import { moveFacetDown } from './subtree'; +export const FACET_SCALE_PREFIX = 'scale_'; +export const MAX_OPTIMIZATION_RUNS = 5; +/** + * Iterates over a dataflow graph and checks whether all links are consistent. + */ +export function checkLinks(nodes) { + for (const node of nodes) { + for (const child of node.children) { + if (child.parent !== node) { + // log.error('Dataflow graph is inconsistent.', node, child); + return false; + } + } + if (!checkLinks(node.children)) { + return false; + } + } + return true; +} +/** + * Run the specified optimizer on the provided nodes. + * + * @param optimizer The optimizer instance to run. + * @param nodes A set of nodes to optimize. + */ +function runOptimizer(optimizer, nodes) { + let modified = false; + for (const node of nodes) { + modified = optimizer.optimize(node) || modified; + } + return modified; +} +function optimizationDataflowHelper(dataComponent, model, firstPass) { + let roots = dataComponent.sources; + let modified = false; + modified = runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots) || modified; + modified = runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots) || modified; + // remove source nodes that don't have any children because they also don't have output nodes + roots = roots.filter(r => r.numChildren() > 0); + modified = runOptimizer(new optimizers.RemoveUnusedSubtrees(), roots) || modified; + roots = roots.filter(r => r.numChildren() > 0); + if (!firstPass) { + // Only run these optimizations after the optimizer has moved down the facet node. + // With this change, we can be more aggressive in the optimizations. + modified = runOptimizer(new optimizers.MoveParseUp(), roots) || modified; + modified = runOptimizer(new optimizers.MergeBins(model), roots) || modified; + modified = runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), roots) || modified; + modified = runOptimizer(new optimizers.MergeParse(), roots) || modified; + modified = runOptimizer(new optimizers.MergeAggregates(), roots) || modified; + modified = runOptimizer(new optimizers.MergeTimeUnits(), roots) || modified; + modified = runOptimizer(new optimizers.MergeIdenticalNodes(), roots) || modified; + modified = runOptimizer(new optimizers.MergeOutputs(), roots) || modified; + } + dataComponent.sources = roots; + return modified; +} +/** + * Optimizes the dataflow of the passed in data component. + */ +export function optimizeDataflow(data, model) { + // check before optimizations + checkLinks(data.sources); + let firstPassCounter = 0; + let secondPassCounter = 0; + for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { + if (!optimizationDataflowHelper(data, model, true)) { + break; + } + firstPassCounter++; + } + // move facets down and make a copy of the subtree so that we can have scales at the top level + data.sources.map(moveFacetDown); + for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { + if (!optimizationDataflowHelper(data, model, false)) { + break; + } + secondPassCounter++; + } + // check after optimizations + checkLinks(data.sources); + if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { + log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`); + } +} +//# sourceMappingURL=optimize.js.map \ No newline at end of file diff --git a/build/src/compile/data/optimize.js.map b/build/src/compile/data/optimize.js.map new file mode 100644 index 0000000000..701f81392f --- /dev/null +++ b/build/src/compile/data/optimize.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optimize.js","sourceRoot":"","sources":["../../../../src/compile/data/optimize.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAIjC,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,aAAa,EAAC,MAAM,WAAW,CAAC;AAExC,MAAM,CAAC,MAAM,kBAAkB,GAAG,QAAQ,CAAC;AAC3C,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC;AAEvC;;GAEG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AiB,GAAG,CAAC,CAAC;IAE1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,qBAAqB,EAAE,CAAC,EAAE,EAAE;QAC9C,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,EAAE;YAClD,MAAM;SACP;QACD,gBAAgB,EAAE,CAAC;KACpB;IAED,8FAA8F;IAC9F,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;IAEhC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,qBAAqB,EAAE,CAAC,EAAE,EAAE;QAC9C,IAAI,CAAC,0BAA0B,CAAC,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE;YACnD,MAAM;SACP;QACD,iBAAiB,EAAE,CAAC;KACrB;IAED,4BAA4B;IAC5B,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAEzB,IAAI,IAAI,CAAC,GAAG,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,KAAK,qBAAqB,EAAE;QAC3E,GAAG,CAAC,IAAI,CAAC,6BAA6B,qBAAqB,YAAY,CAAC,CAAC;KAC1E;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/optimizer.d.ts b/build/src/compile/data/optimizer.d.ts new file mode 100644 index 0000000000..a03c15be04 --- /dev/null +++ b/build/src/compile/data/optimizer.d.ts @@ -0,0 +1,51 @@ +import { DataFlowNode } from './dataflow'; +/** + * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. + */ +export declare function isDataSourceNode(node: DataFlowNode): boolean; +/** + * Abstract base class for Dataflow optimizers. + * Contains only mutation handling logic. Subclasses need to implement iteration logic. + */ +export declare abstract class Optimizer { + #private; + constructor(); + setModified(): void; + get modifiedFlag(): boolean; + /** + * Run the optimization for the tree with the provided root. + */ + abstract optimize(root: DataFlowNode): boolean; +} +/** + * Starts from a node and runs the optimization function (the "run" method) upwards to the root, + * depending on the continue and modified flag values returned by the optimization function. + */ +export declare abstract class BottomUpOptimizer extends Optimizer { + /** + * Run the optimizer at the node. This method should not change the parent of the passed in node (it should only affect children). + */ + abstract run(node: DataFlowNode): void; + /** + * Compute a map of node depths that we can use to determine a topological sort order. + */ + private getNodeDepths; + /** + * Run the optimizer on all nodes starting from the leaves. + */ + optimize(node: DataFlowNode): boolean; +} +/** + * The optimizer function (the "run" method), is invoked on the given node and then continues recursively. + */ +export declare abstract class TopDownOptimizer extends Optimizer { + /** + * Run the optimizer at the node. + */ + abstract run(node: DataFlowNode): void; + /** + * Run the optimizer depth first on all nodes starting from the roots. + */ + optimize(node: DataFlowNode): boolean; +} +//# sourceMappingURL=optimizer.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/optimizer.d.ts.map b/build/src/compile/data/optimizer.d.ts.map new file mode 100644 index 0000000000..f48c5dabd9 --- /dev/null +++ b/build/src/compile/data/optimizer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"optimizer.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimizer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAKxC;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,YAAY,WAElD;AAED;;;GAGG;AACH,8BAAsB,SAAS;;;IAQtB,WAAW;IAIlB,IAAI,YAAY,YAEf;IAED;;OAEG;aACa,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CACtD;AAED;;;GAGG;AACH,8BAAsB,iBAAkB,SAAQ,SAAS;IACvD;;OAEG;aACa,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAE7C;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAU7C;AAED;;GAEG;AACH,8BAAsB,gBAAiB,SAAQ,SAAS;IACtD;;OAEG;aACa,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAE7C;;OAEG;IACI,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;CAS7C"} \ No newline at end of file diff --git a/build/src/compile/data/optimizer.js b/build/src/compile/data/optimizer.js new file mode 100644 index 0000000000..a6ab7e5b39 --- /dev/null +++ b/build/src/compile/data/optimizer.js @@ -0,0 +1,82 @@ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Optimizer_modified; +import { GraticuleNode } from './graticule'; +import { SequenceNode } from './sequence'; +import { SourceNode } from './source'; +/** + * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. + */ +export function isDataSourceNode(node) { + return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; +} +/** + * Abstract base class for Dataflow optimizers. + * Contains only mutation handling logic. Subclasses need to implement iteration logic. + */ +export class Optimizer { + constructor() { + _Optimizer_modified.set(this, void 0); + __classPrivateFieldSet(this, _Optimizer_modified, false, "f"); + } + // Once true, #modified is never set to false + setModified() { + __classPrivateFieldSet(this, _Optimizer_modified, true, "f"); + } + get modifiedFlag() { + return __classPrivateFieldGet(this, _Optimizer_modified, "f"); + } +} +_Optimizer_modified = new WeakMap(); +/** + * Starts from a node and runs the optimization function (the "run" method) upwards to the root, + * depending on the continue and modified flag values returned by the optimization function. + */ +export class BottomUpOptimizer extends Optimizer { + /** + * Compute a map of node depths that we can use to determine a topological sort order. + */ + getNodeDepths(node, depth, depths) { + depths.set(node, depth); + for (const child of node.children) { + this.getNodeDepths(child, depth + 1, depths); + } + return depths; + } + /** + * Run the optimizer on all nodes starting from the leaves. + */ + optimize(node) { + const depths = this.getNodeDepths(node, 0, new Map()); + const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]); + for (const tuple of topologicalSort) { + this.run(tuple[0]); + } + return this.modifiedFlag; + } +} +/** + * The optimizer function (the "run" method), is invoked on the given node and then continues recursively. + */ +export class TopDownOptimizer extends Optimizer { + /** + * Run the optimizer depth first on all nodes starting from the roots. + */ + optimize(node) { + this.run(node); + for (const child of node.children) { + this.optimize(child); + } + return this.modifiedFlag; + } +} +//# sourceMappingURL=optimizer.js.map \ No newline at end of file diff --git a/build/src/compile/data/optimizer.js.map b/build/src/compile/data/optimizer.js.map new file mode 100644 index 0000000000..75a27fd3e4 --- /dev/null +++ b/build/src/compile/data/optimizer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optimizer.js","sourceRoot":"","sources":["../../../../src/compile/data/optimizer.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEpC;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAkB;IACjD,OAAO,IAAI,YAAY,UAAU,IAAI,IAAI,YAAY,aAAa,IAAI,IAAI,YAAY,YAAY,CAAC;AACrG,CAAC;AAED;;;GAGG;AACH,MAAM,OAAgB,SAAS;IAG7B;QAFA,sCAAmB;QAGjB,uBAAA,IAAI,uBAAa,KAAK,MAAA,CAAC;IACzB,CAAC;IAED,6CAA6C;IACtC,WAAW;QAChB,uBAAA,IAAI,uBA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,CAAC,YAAY,CAAC;IAC3B,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/optimizers.d.ts b/build/src/compile/data/optimizers.d.ts new file mode 100644 index 0000000000..4e2d8fefa2 --- /dev/null +++ b/build/src/compile/data/optimizers.d.ts @@ -0,0 +1,87 @@ +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +import { BottomUpOptimizer, Optimizer, TopDownOptimizer } from './optimizer'; +/** + * Merge identical nodes at forks by comparing hashes. + * + * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. + */ +export declare class MergeIdenticalNodes extends TopDownOptimizer { + mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]): void; + run(node: DataFlowNode): void; +} +/** + * Optimizer that removes identifier nodes that are not needed for selections. + */ +export declare class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { + private requiresSelectionId; + constructor(model: Model); + run(node: DataFlowNode): void; +} +/** + * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to + * selections projected over time units. Only keeps the first time unit in any branch. + * + * This optimizer is a custom top down optimizer that keep track of produced fields in a branch. + */ +export declare class RemoveDuplicateTimeUnits extends Optimizer { + optimize(node: DataFlowNode): boolean; + run(node: DataFlowNode, timeUnitFields: Set): void; +} +/** + * Remove output nodes that are not required. + */ +export declare class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { + constructor(); + run(node: DataFlowNode): void; +} +/** + * Move parse nodes up to forks and merges them if possible. + */ +export declare class MoveParseUp extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +/** + * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. + * + * We assume that dependent paths that do not have a parse node can be just merged. + */ +export declare class MergeParse extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +/** + * Repeatedly remove leaf nodes that are not output or facet nodes. + * The reason is that we don't need subtrees that don't have any output nodes. + * Facet nodes are needed for the row or column domains. + */ +export declare class RemoveUnusedSubtrees extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +/** + * Merge adjacent time unit nodes. + */ +export declare class MergeTimeUnits extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +export declare class MergeAggregates extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +/** + * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. + */ +export declare class MergeBins extends BottomUpOptimizer { + private model; + constructor(model: Model); + run(node: DataFlowNode): void; +} +/** + * This optimizer takes output nodes that are at a fork and moves them before the fork. + * + * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. + * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) + * are inserted after the main output node. + */ +export declare class MergeOutputs extends BottomUpOptimizer { + run(node: DataFlowNode): void; +} +//# sourceMappingURL=optimizers.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/optimizers.d.ts.map b/build/src/compile/data/optimizers.d.ts.map new file mode 100644 index 0000000000..812de05e09 --- /dev/null +++ b/build/src/compile/data/optimizers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"optimizers.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/optimizers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAI/B,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAKpD,OAAO,EAAC,iBAAiB,EAAoB,SAAS,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAI7F;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,gBAAgB;IAChD,UAAU,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE;IAStD,GAAG,CAAC,IAAI,EAAE,YAAY;CAmB9B;AAED;;GAEG;AACH,qBAAa,gCAAiC,SAAQ,gBAAgB;IACpE,OAAO,CAAC,mBAAmB,CAAU;gBAEzB,KAAK,EAAE,KAAK;IAKjB,GAAG,CAAC,IAAI,EAAE,YAAY;CAe9B;AAED;;;;;GAKG;AACH,qBAAa,wBAAyB,SAAQ,SAAS;IAC9C,QAAQ,CAAC,IAAI,EAAE,YAAY,GAAG,OAAO;IAMrC,GAAG,CAAC,IAAI,EAAE,YAAY,EAAE,cAAc,EAAE,GAAG,CAAC,MAAM,CAAC;CAkB3D;AAED;;GAEG;AACH,qBAAa,4BAA6B,SAAQ,gBAAgB;;IAKzD,GAAG,CAAC,IAAI,EAAE,YAAY;CAM9B;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;IACzC,GAAG,CAAC,IAAI,EAAE,YAAY;CA4B9B;AAED;;;;GAIG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;IACxC,GAAG,CAAC,IAAI,EAAE,YAAY;CA2C9B;AAED;;;;GAIG;AACH,qBAAa,oBAAqB,SAAQ,iBAAiB;IAClD,GAAG,CAAC,IAAI,EAAE,YAAY;CAU9B;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,iBAAiB;IAC5C,GAAG,CAAC,IAAI,EAAE,YAAY;CAQ9B;AAED,qBAAa,eAAgB,SAAQ,iBAAiB;IAC7C,GAAG,CAAC,IAAI,EAAE,YAAY;CAkC9B;AAED;;GAEG;AACH,qBAAa,SAAU,SAAQ,iBAAiB;IAClC,OAAO,CAAC,KAAK;gBAAL,KAAK,EAAE,KAAK;IAIzB,GAAG,CAAC,IAAI,EAAE,YAAY;CAyC9B;AAED;;;;;;GAMG;AACH,qBAAa,YAAa,SAAQ,iBAAiB;IAC1C,GAAG,CAAC,IAAI,EAAE,YAAY;CA0D9B"} \ No newline at end of file diff --git a/build/src/compile/data/optimizers.js b/build/src/compile/data/optimizers.js new file mode 100644 index 0000000000..0c66b6c039 --- /dev/null +++ b/build/src/compile/data/optimizers.js @@ -0,0 +1,355 @@ +import { fieldIntersection, hash, hasIntersection, isEmpty, keys, some } from '../../util'; +import { requiresSelectionId } from '../selection'; +import { AggregateNode } from './aggregate'; +import { BinNode } from './bin'; +import { OutputNode } from './dataflow'; +import { FacetNode } from './facet'; +import { FilterNode } from './filter'; +import { ParseNode } from './formatparse'; +import { IdentifierNode } from './identifier'; +import { BottomUpOptimizer, isDataSourceNode, Optimizer, TopDownOptimizer } from './optimizer'; +import { SourceNode } from './source'; +import { TimeUnitNode } from './timeunit'; +/** + * Merge identical nodes at forks by comparing hashes. + * + * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. + */ +export class MergeIdenticalNodes extends TopDownOptimizer { + mergeNodes(parent, nodes) { + const mergedNode = nodes.shift(); + for (const node of nodes) { + parent.removeChild(node); + node.parent = mergedNode; + node.remove(); + } + } + run(node) { + const hashes = node.children.map(x => x.hash()); + const buckets = {}; + for (let i = 0; i < hashes.length; i++) { + if (buckets[hashes[i]] === undefined) { + buckets[hashes[i]] = [node.children[i]]; + } + else { + buckets[hashes[i]].push(node.children[i]); + } + } + for (const k of keys(buckets)) { + if (buckets[k].length > 1) { + this.setModified(); + this.mergeNodes(node, buckets[k]); + } + } + } +} +/** + * Optimizer that removes identifier nodes that are not needed for selections. + */ +export class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { + constructor(model) { + super(); + this.requiresSelectionId = model && requiresSelectionId(model); + } + run(node) { + if (node instanceof IdentifierNode) { + // Only preserve IdentifierNodes if we have default discrete selections + // in our model tree, and if the nodes come after tuple producing nodes. + if (!(this.requiresSelectionId && + (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) { + this.setModified(); + node.remove(); + } + } + } +} +/** + * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to + * selections projected over time units. Only keeps the first time unit in any branch. + * + * This optimizer is a custom top down optimizer that keep track of produced fields in a branch. + */ +export class RemoveDuplicateTimeUnits extends Optimizer { + optimize(node) { + this.run(node, new Set()); + return this.modifiedFlag; + } + run(node, timeUnitFields) { + let producedFields = new Set(); + if (node instanceof TimeUnitNode) { + producedFields = node.producedFields(); + if (hasIntersection(producedFields, timeUnitFields)) { + this.setModified(); + node.removeFormulas(timeUnitFields); + if (node.producedFields.length === 0) { + node.remove(); + } + } + } + for (const child of node.children) { + this.run(child, new Set([...timeUnitFields, ...producedFields])); + } + } +} +/** + * Remove output nodes that are not required. + */ +export class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { + constructor() { + super(); + } + run(node) { + if (node instanceof OutputNode && !node.isRequired()) { + this.setModified(); + node.remove(); + } + } +} +/** + * Move parse nodes up to forks and merges them if possible. + */ +export class MoveParseUp extends BottomUpOptimizer { + run(node) { + if (isDataSourceNode(node)) { + return; + } + if (node.numChildren() > 1) { + // Don't move parse further up but continue with parent. + return; + } + for (const child of node.children) { + if (child instanceof ParseNode) { + if (node instanceof ParseNode) { + this.setModified(); + node.merge(child); + } + else { + // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). + if (fieldIntersection(node.producedFields(), child.dependentFields())) { + continue; + } + this.setModified(); + child.swapWithParent(); + } + } + } + return; + } +} +/** + * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. + * + * We assume that dependent paths that do not have a parse node can be just merged. + */ +export class MergeParse extends BottomUpOptimizer { + run(node) { + const originalChildren = [...node.children]; + const parseChildren = node.children.filter((child) => child instanceof ParseNode); + if (node.numChildren() > 1 && parseChildren.length >= 1) { + const commonParse = {}; + const conflictingParse = new Set(); + for (const parseNode of parseChildren) { + const parse = parseNode.parse; + for (const k of keys(parse)) { + if (!(k in commonParse)) { + commonParse[k] = parse[k]; + } + else if (commonParse[k] !== parse[k]) { + conflictingParse.add(k); + } + } + } + for (const field of conflictingParse) { + delete commonParse[field]; + } + if (!isEmpty(commonParse)) { + this.setModified(); + const mergedParseNode = new ParseNode(node, commonParse); + for (const childNode of originalChildren) { + if (childNode instanceof ParseNode) { + for (const key of keys(commonParse)) { + delete childNode.parse[key]; + } + } + node.removeChild(childNode); + childNode.parent = mergedParseNode; + // remove empty parse nodes + if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { + childNode.remove(); + } + } + } + } + } +} +/** + * Repeatedly remove leaf nodes that are not output or facet nodes. + * The reason is that we don't need subtrees that don't have any output nodes. + * Facet nodes are needed for the row or column domains. + */ +export class RemoveUnusedSubtrees extends BottomUpOptimizer { + run(node) { + if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) { + // no need to continue with parent because it is output node or will have children (there was a fork) + } + else if (node instanceof SourceNode) { + // ignore empty unused sources as they will be removed in optimizationDataflowHelper + } + else { + this.setModified(); + node.remove(); + } + } +} +/** + * Merge adjacent time unit nodes. + */ +export class MergeTimeUnits extends BottomUpOptimizer { + run(node) { + const timeUnitChildren = node.children.filter((x) => x instanceof TimeUnitNode); + const combination = timeUnitChildren.pop(); + for (const timeUnit of timeUnitChildren) { + this.setModified(); + combination.merge(timeUnit); + } + } +} +export class MergeAggregates extends BottomUpOptimizer { + run(node) { + const aggChildren = node.children.filter((child) => child instanceof AggregateNode); + // Object which we'll use to map the fields which an aggregate is grouped by to + // the set of aggregates with that grouping. This is useful as only aggregates + // with the same group by can be merged + const groupedAggregates = {}; + // Build groupedAggregates + for (const agg of aggChildren) { + const groupBys = hash(agg.groupBy); + if (!(groupBys in groupedAggregates)) { + groupedAggregates[groupBys] = []; + } + groupedAggregates[groupBys].push(agg); + } + // Merge aggregateNodes with same key in groupedAggregates + for (const group of keys(groupedAggregates)) { + const mergeableAggs = groupedAggregates[group]; + if (mergeableAggs.length > 1) { + const mergedAggs = mergeableAggs.pop(); + for (const agg of mergeableAggs) { + if (mergedAggs.merge(agg)) { + node.removeChild(agg); + agg.parent = mergedAggs; + agg.remove(); + this.setModified(); + } + } + } + } + } +} +/** + * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. + */ +export class MergeBins extends BottomUpOptimizer { + constructor(model) { + super(); + this.model = model; + } + run(node) { + const moveBinsUp = !(isDataSourceNode(node) || + node instanceof FilterNode || + node instanceof ParseNode || + node instanceof IdentifierNode); + const promotableBins = []; + const remainingBins = []; + for (const child of node.children) { + if (child instanceof BinNode) { + if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) { + promotableBins.push(child); + } + else { + remainingBins.push(child); + } + } + } + if (promotableBins.length > 0) { + const promotedBin = promotableBins.pop(); + for (const bin of promotableBins) { + promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); + } + this.setModified(); + if (node instanceof BinNode) { + node.merge(promotedBin, this.model.renameSignal.bind(this.model)); + } + else { + promotedBin.swapWithParent(); + } + } + if (remainingBins.length > 1) { + const remainingBin = remainingBins.pop(); + for (const bin of remainingBins) { + remainingBin.merge(bin, this.model.renameSignal.bind(this.model)); + } + this.setModified(); + } + } +} +/** + * This optimizer takes output nodes that are at a fork and moves them before the fork. + * + * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. + * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) + * are inserted after the main output node. + */ +export class MergeOutputs extends BottomUpOptimizer { + run(node) { + const children = [...node.children]; + const hasOutputChild = some(children, child => child instanceof OutputNode); + if (!hasOutputChild || node.numChildren() <= 1) { + return; + } + const otherChildren = []; + // The output node we will connect all other nodes to. + // Output nodes will be added before the new node, other nodes after. + let mainOutput; + for (const child of children) { + if (child instanceof OutputNode) { + let lastOutput = child; + while (lastOutput.numChildren() === 1) { + const [theChild] = lastOutput.children; + if (theChild instanceof OutputNode) { + lastOutput = theChild; + } + else { + break; + } + } + otherChildren.push(...lastOutput.children); + if (mainOutput) { + // Move the output nodes before the mainOutput. We do this by setting + // the parent of the first not to the parent of the main output and + // the main output's parent to the last output. + // note: the child is the first output + node.removeChild(child); + child.parent = mainOutput.parent; + mainOutput.parent.removeChild(mainOutput); + mainOutput.parent = lastOutput; + this.setModified(); + } + else { + mainOutput = lastOutput; + } + } + else { + otherChildren.push(child); + } + } + if (otherChildren.length) { + this.setModified(); + for (const child of otherChildren) { + child.parent.removeChild(child); + child.parent = mainOutput; + } + } + } +} +//# sourceMappingURL=optimizers.js.map \ No newline at end of file diff --git a/build/src/compile/data/optimizers.js.map b/build/src/compile/data/optimizers.js.map new file mode 100644 index 0000000000..0edf11cc71 --- /dev/null +++ b/build/src/compile/data/optimizers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"optimizers.js","sourceRoot":"","sources":["../../../../src/compile/data/optimizers.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,iBAAiB,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAE/F,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,gBAAgB;IAChD,UAAU,CAAC,MAAoB,EAAE,KAAqB;QAC3D,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;QACjC,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACxB,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACzB,IAAI,CAAC,MAAM,GAAG,UAAU,CAAC;YACzB,IAAI,CAAC,MAAM,EAAE,CAAC;SACf;IACH,CAAC;IAEM,GAAG,CAAC,IAAkB;QAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC,GA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;aAC3B;SACF;IACH,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/parse.d.ts b/build/src/compile/data/parse.d.ts new file mode 100644 index 0000000000..89d5ee7c90 --- /dev/null +++ b/build/src/compile/data/parse.d.ts @@ -0,0 +1,12 @@ +import { AncestorParse, DataComponent } from '.'; +import { Data } from '../../data'; +import { Model } from '../model'; +import { DataFlowNode } from './dataflow'; +import { SourceNode } from './source'; +export declare function findSource(data: Data, sources: SourceNode[]): SourceNode; +/** + * Parses a transform array into a chain of connected dataflow nodes. + */ +export declare function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode; +export declare function parseData(model: Model): DataComponent; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/parse.d.ts.map b/build/src/compile/data/parse.d.ts.map new file mode 100644 index 0000000000..401f16c8b0 --- /dev/null +++ b/build/src/compile/data/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,aAAa,EAAC,MAAM,GAAG,CAAC;AAC/C,OAAO,EACL,IAAI,EASL,MAAM,YAAY,CAAC;AAwBpB,OAAO,EAA0C,KAAK,EAAC,MAAM,UAAU,CAAC;AAMxE,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AA4BpD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,EAAE,cA2C3D;AAuCD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,GAAG,YAAY,CAuFhH;AAyDD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,GAAG,aAAa,CA0HrD"} \ No newline at end of file diff --git a/build/src/compile/data/parse.js b/build/src/compile/data/parse.js new file mode 100644 index 0000000000..ccbee6c0cc --- /dev/null +++ b/build/src/compile/data/parse.js @@ -0,0 +1,374 @@ +import { AncestorParse } from '.'; +import { isGenerator, isGraticuleGenerator, isInlineData, isNamedData, isSequenceGenerator, isUrlData, DataSourceType } from '../../data'; +import * as log from '../../log'; +import { isAggregate, isBin, isCalculate, isDensity, isExtent, isFilter, isFlatten, isFold, isImpute, isJoinAggregate, isLoess, isLookup, isPivot, isQuantile, isRegression, isSample, isStack, isTimeUnit, isWindow } from '../../transform'; +import { deepEqual, mergeDeep } from '../../util'; +import { isFacetModel, isLayerModel, isUnitModel } from '../model'; +import { requiresSelectionId } from '../selection'; +import { materializeSelections } from '../selection/parse'; +import { AggregateNode } from './aggregate'; +import { BinNode } from './bin'; +import { CalculateNode } from './calculate'; +import { OutputNode } from './dataflow'; +import { DensityTransformNode } from './density'; +import { ExtentTransformNode } from './extent'; +import { FacetNode } from './facet'; +import { FilterNode } from './filter'; +import { FilterInvalidNode } from './filterinvalid'; +import { FlattenTransformNode } from './flatten'; +import { FoldTransformNode } from './fold'; +import { getImplicitFromEncoding, getImplicitFromFilterTransform, getImplicitFromSelection, ParseNode } from './formatparse'; +import { GeoJSONNode } from './geojson'; +import { GeoPointNode } from './geopoint'; +import { GraticuleNode } from './graticule'; +import { IdentifierNode } from './identifier'; +import { ImputeNode } from './impute'; +import { JoinAggregateTransformNode } from './joinaggregate'; +import { makeJoinAggregateFromFacet } from './joinaggregatefacet'; +import { LoessTransformNode } from './loess'; +import { LookupNode } from './lookup'; +import { PivotTransformNode } from './pivot'; +import { QuantileTransformNode } from './quantile'; +import { RegressionTransformNode } from './regression'; +import { SampleTransformNode } from './sample'; +import { SequenceNode } from './sequence'; +import { SourceNode } from './source'; +import { StackNode } from './stack'; +import { TimeUnitNode } from './timeunit'; +import { WindowTransformNode } from './window'; +export function findSource(data, sources) { + for (const other of sources) { + const otherData = other.data; + // if both datasets have a name defined, we cannot merge + if (data.name && other.hasName() && data.name !== other.dataName) { + continue; + } + const formatMesh = data['format']?.mesh; + const otherFeature = otherData.format?.feature; + // feature and mesh are mutually exclusive + if (formatMesh && otherFeature) { + continue; + } + // we have to extract the same feature or mesh + const formatFeature = data['format']?.feature; + if ((formatFeature || otherFeature) && formatFeature !== otherFeature) { + continue; + } + const otherMesh = otherData.format?.mesh; + if ((formatMesh || otherMesh) && formatMesh !== otherMesh) { + continue; + } + if (isInlineData(data) && isInlineData(otherData)) { + if (deepEqual(data.values, otherData.values)) { + return other; + } + } + else if (isUrlData(data) && isUrlData(otherData)) { + if (data.url === otherData.url) { + return other; + } + } + else if (isNamedData(data)) { + if (data.name === other.dataName) { + return other; + } + } + } + return null; +} +function parseRoot(model, sources) { + if (model.data || !model.parent) { + // if the model defines a data source or is the root, create a source node + if (model.data === null) { + // data: null means we should ignore the parent's data so we just create a new data source + const source = new SourceNode({ values: [] }); + sources.push(source); + return source; + } + const existingSource = findSource(model.data, sources); + if (existingSource) { + if (!isGenerator(model.data)) { + existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); + } + // if the new source has a name but the existing one does not, we can set it + if (!existingSource.hasName() && model.data.name) { + existingSource.dataName = model.data.name; + } + return existingSource; + } + else { + const source = new SourceNode(model.data); + sources.push(source); + return source; + } + } + else { + // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. + return model.parent.component.data.facetRoot + ? model.parent.component.data.facetRoot + : model.parent.component.data.main; + } +} +/** + * Parses a transform array into a chain of connected dataflow nodes. + */ +export function parseTransformArray(head, model, ancestorParse) { + let lookupCounter = 0; + for (const t of model.transforms) { + let derivedType = undefined; + let transformNode; + if (isCalculate(t)) { + transformNode = head = new CalculateNode(head, t); + derivedType = 'derived'; + } + else if (isFilter(t)) { + const implicit = getImplicitFromFilterTransform(t); + transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head; + head = new FilterNode(head, model, t.filter); + } + else if (isBin(t)) { + transformNode = head = BinNode.makeFromTransform(head, t, model); + derivedType = 'number'; + } + else if (isTimeUnit(t)) { + derivedType = 'date'; + const parsedAs = ancestorParse.getWithExplicit(t.field); + // Create parse node because the input to time unit is always date. + if (parsedAs.value === undefined) { + head = new ParseNode(head, { [t.field]: derivedType }); + ancestorParse.set(t.field, derivedType, false); + } + transformNode = head = TimeUnitNode.makeFromTransform(head, t); + } + else if (isAggregate(t)) { + transformNode = head = AggregateNode.makeFromTransform(head, t); + derivedType = 'number'; + if (requiresSelectionId(model)) { + head = new IdentifierNode(head); + } + } + else if (isLookup(t)) { + transformNode = head = LookupNode.make(head, model, t, lookupCounter++); + derivedType = 'derived'; + } + else if (isWindow(t)) { + transformNode = head = new WindowTransformNode(head, t); + derivedType = 'number'; + } + else if (isJoinAggregate(t)) { + transformNode = head = new JoinAggregateTransformNode(head, t); + derivedType = 'number'; + } + else if (isStack(t)) { + transformNode = head = StackNode.makeFromTransform(head, t); + derivedType = 'derived'; + } + else if (isFold(t)) { + transformNode = head = new FoldTransformNode(head, t); + derivedType = 'derived'; + } + else if (isExtent(t)) { + transformNode = head = new ExtentTransformNode(head, t); + derivedType = 'derived'; + } + else if (isFlatten(t)) { + transformNode = head = new FlattenTransformNode(head, t); + derivedType = 'derived'; + } + else if (isPivot(t)) { + transformNode = head = new PivotTransformNode(head, t); + derivedType = 'derived'; + } + else if (isSample(t)) { + head = new SampleTransformNode(head, t); + } + else if (isImpute(t)) { + transformNode = head = ImputeNode.makeFromTransform(head, t); + derivedType = 'derived'; + } + else if (isDensity(t)) { + transformNode = head = new DensityTransformNode(head, t); + derivedType = 'derived'; + } + else if (isQuantile(t)) { + transformNode = head = new QuantileTransformNode(head, t); + derivedType = 'derived'; + } + else if (isRegression(t)) { + transformNode = head = new RegressionTransformNode(head, t); + derivedType = 'derived'; + } + else if (isLoess(t)) { + transformNode = head = new LoessTransformNode(head, t); + derivedType = 'derived'; + } + else { + log.warn(log.message.invalidTransformIgnored(t)); + continue; + } + if (transformNode && derivedType !== undefined) { + for (const field of transformNode.producedFields() ?? []) { + ancestorParse.set(field, derivedType, false); + } + } + } + return head; +} +/* +Description of the dataflow (http://asciiflow.com/): + +--------+ + | Source | + +---+----+ + | + v + FormatParse + (explicit) + | + v + Transforms +(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) + | + v + FormatParse + (implicit) + | + v + Binning (in `encoding`) + | + v + Timeunit (in `encoding`) + | + v +Formula From Sort Array + | + v + +--+--+ + | Raw | + +-----+ + | + v + Aggregate (in `encoding`) + | + v + Stack (in `encoding`) + | + v + Invalid Filter + | + v + +----------+ + | Main | + +----------+ + | + v + +-------+ + | Facet |----> "column", "column-layout", and "row" + +-------+ + | + v + ...Child data... +*/ +export function parseData(model) { + let head = parseRoot(model, model.component.data.sources); + const { outputNodes, outputNodeRefCounts } = model.component.data; + const data = model.data; + const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data)); + const ancestorParse = !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); + if (isGenerator(data)) { + // insert generator transform + if (isSequenceGenerator(data)) { + head = new SequenceNode(head, data.sequence); + } + else if (isGraticuleGenerator(data)) { + head = new GraticuleNode(head, data.graticule); + } + // no parsing necessary for generator + ancestorParse.parseNothing = true; + } + else if (data?.format?.parse === null) { + // format.parse: null means disable parsing + ancestorParse.parseNothing = true; + } + head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head; + // Default discrete selections require an identifer transform to + // uniquely identify data points. Add this transform at the head of + // the pipeline such that the identifier field is available for all + // subsequent datasets. During optimization, we will remove this + // transform if it proves to be unnecessary. Additional identifier + // transforms will be necessary when new tuples are constructed + // (e.g., post-aggregation). + head = new IdentifierNode(head); + // HACK: This is equivalent for merging bin extent for union scale. + // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale + const parentIsLayer = model.parent && isLayerModel(model.parent); + if (isUnitModel(model) || isFacetModel(model)) { + if (parentIsLayer) { + head = BinNode.makeFromEncoding(head, model) ?? head; + } + } + if (model.transforms.length > 0) { + head = parseTransformArray(head, model, ancestorParse); + } + // create parse nodes for fields that need to be parsed (or flattened) implicitly + const implicitSelection = getImplicitFromSelection(model); + const implicitEncoding = getImplicitFromEncoding(model); + head = ParseNode.makeWithAncestors(head, {}, { ...implicitSelection, ...implicitEncoding }, ancestorParse) ?? head; + if (isUnitModel(model)) { + head = GeoJSONNode.parseAll(head, model); + head = GeoPointNode.parseAll(head, model); + } + if (isUnitModel(model) || isFacetModel(model)) { + if (!parentIsLayer) { + head = BinNode.makeFromEncoding(head, model) ?? head; + } + head = TimeUnitNode.makeFromEncoding(head, model) ?? head; + head = CalculateNode.parseAllForSortIndex(head, model); + } + // add an output node pre aggregation + const rawName = model.getDataName(DataSourceType.Raw); + const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); + outputNodes[rawName] = raw; + head = raw; + if (isUnitModel(model)) { + const agg = AggregateNode.makeFromEncoding(head, model); + if (agg) { + head = agg; + if (requiresSelectionId(model)) { + head = new IdentifierNode(head); + } + } + head = ImputeNode.makeFromEncoding(head, model) ?? head; + head = StackNode.makeFromEncoding(head, model) ?? head; + } + if (isUnitModel(model)) { + head = FilterInvalidNode.make(head, model) ?? head; + } + // output node for marks + const mainName = model.getDataName(DataSourceType.Main); + const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); + outputNodes[mainName] = main; + head = main; + if (isUnitModel(model)) { + materializeSelections(model, main); + } + // add facet marker + let facetRoot = null; + if (isFacetModel(model)) { + const facetName = model.getName('facet'); + // Derive new aggregate for facet's sort field + // augment data source with new fields for crossed facet + head = makeJoinAggregateFromFacet(head, model.facet) ?? head; + facetRoot = new FacetNode(head, model, facetName, main.getSource()); + outputNodes[facetName] = facetRoot; + } + return { + ...model.component.data, + outputNodes, + outputNodeRefCounts, + raw, + main, + facetRoot, + ancestorParse + }; +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/data/parse.js.map b/build/src/compile/data/parse.js.map new file mode 100644 index 0000000000..4301351c13 --- /dev/null +++ b/build/src/compile/data/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/data/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAgB,MAAM,GAAG,CAAC;AAC/C,OAAO,EAEL,WAAW,EACX,oBAAoB,EACpB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,SAAS,EACT,cAAc,EAEf,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,WAAW,EACX,KAAK,EACL,WAAW,EACX,SAAS,EACT,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,MAAM,EACN,QAAQ,EACR,eAAe,EACf,OAAO,EACP,QAAQ,EACR,OAAO,EACP,UAAU,EACV,YAAY,EACZ,QAAQ,EACR,OAAO,EACP,UAAU,EACV,QAAQ,EACT,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAQ,MAAM,UAAU,CAAC;AACxE,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,qBAAqB,EAAC,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,C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I,CAAC;QAE7D,SAAS,GAAG,IAAI,SAAS,CAAC,IAAI,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC;QACpE,WAAW,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC;KACpC;IAED,OAAO;QACL,GAAG,KAAK,CAAC,SAAS,CAAC,IAAI;QACvB,WAAW;QACX,mBAAmB;QACnB,GAAG;QACH,IAAI;QACJ,SAAS;QACT,aAAa;KACd,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/pivot.d.ts b/build/src/compile/data/pivot.d.ts new file mode 100644 index 0000000000..6605c0b96a --- /dev/null +++ b/build/src/compile/data/pivot.d.ts @@ -0,0 +1,17 @@ +import { PivotTransform } from '../../transform'; +import { PivotTransform as VgPivotTransform } from 'vega'; +import { DataFlowNode } from './dataflow'; +/** + * A class for pivot transform nodes. + */ +export declare class PivotTransformNode extends DataFlowNode { + private transform; + clone(): PivotTransformNode; + constructor(parent: DataFlowNode, transform: PivotTransform); + addDimensions(fields: readonly string[]): void; + producedFields(): undefined; + dependentFields(): Set; + hash(): string; + assemble(): VgPivotTransform; +} +//# sourceMappingURL=pivot.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/pivot.d.ts.map b/build/src/compile/data/pivot.d.ts.map new file mode 100644 index 0000000000..5e73578d4f --- /dev/null +++ b/build/src/compile/data/pivot.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pivot.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/pivot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EAAC,cAAc,IAAI,gBAAgB,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,YAAY;IAOhD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,cAAc;IAK5B,aAAa,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAIvC,cAAc,IAAI,SAAS;IAI3B,eAAe;IAIf,IAAI;IAIJ,QAAQ,IAAI,gBAAgB;CAWpC"} \ No newline at end of file diff --git a/build/src/compile/data/pivot.js b/build/src/compile/data/pivot.js new file mode 100644 index 0000000000..62660fb37b --- /dev/null +++ b/build/src/compile/data/pivot.js @@ -0,0 +1,38 @@ +import { duplicate, hash, unique } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for pivot transform nodes. + */ +export class PivotTransformNode extends DataFlowNode { + clone() { + return new PivotTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d); + } + producedFields() { + return undefined; // return undefined so that potentially everything can depend on the pivot + } + dependentFields() { + return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]); + } + hash() { + return `PivotTransform ${hash(this.transform)}`; + } + assemble() { + const { pivot, value, groupby, limit, op } = this.transform; + return { + type: 'pivot', + field: pivot, + value, + ...(limit !== undefined ? { limit } : {}), + ...(op !== undefined ? { op } : {}), + ...(groupby !== undefined ? { groupby } : {}) + }; + } +} +//# sourceMappingURL=pivot.js.map \ No newline at end of file diff --git a/build/src/compile/data/pivot.js.map b/build/src/compile/data/pivot.js.map new file mode 100644 index 0000000000..a33a3b08c5 --- /dev/null +++ b/build/src/compile/data/pivot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pivot.js","sourceRoot":"","sources":["../../../../src/compile/data/pivot.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,kBAAmB,SAAQ,YAAY;IAC3C,KAAK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SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;SAC5C,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/quantile.d.ts b/build/src/compile/data/quantile.d.ts new file mode 100644 index 0000000000..eb9874e331 --- /dev/null +++ b/build/src/compile/data/quantile.d.ts @@ -0,0 +1,16 @@ +import { QuantileTransform as VgQuantileTransform } from 'vega'; +import { QuantileTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for quantile transform nodes + */ +export declare class QuantileTransformNode extends DataFlowNode { + private transform; + clone(): QuantileTransformNode; + constructor(parent: DataFlowNode, transform: QuantileTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgQuantileTransform; +} +//# sourceMappingURL=quantile.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/quantile.d.ts.map b/build/src/compile/data/quantile.d.ts.map new file mode 100644 index 0000000000..98c89f3f16 --- /dev/null +++ b/build/src/compile/data/quantile.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"quantile.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/quantile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAElD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,qBAAsB,SAAQ,YAAY;IAOnD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,iBAAiB;IAQ/B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CASvC"} \ No newline at end of file diff --git a/build/src/compile/data/quantile.js b/build/src/compile/data/quantile.js new file mode 100644 index 0000000000..76e06d624c --- /dev/null +++ b/build/src/compile/data/quantile.js @@ -0,0 +1,36 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for quantile transform nodes + */ +export class QuantileTransformNode extends DataFlowNode { + clone() { + return new QuantileTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value']; + } + dependentFields() { + return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `QuantileTransform ${hash(this.transform)}`; + } + assemble() { + const { quantile, ...rest } = this.transform; + const result = { + type: 'quantile', + field: quantile, + ...rest + }; + return result; + } +} +//# sourceMappingURL=quantile.js.map \ No newline at end of file diff --git a/build/src/compile/data/quantile.js.map b/build/src/compile/data/quantile.js.map new file mode 100644 index 0000000000..d4509924a5 --- /dev/null +++ b/build/src/compile/data/quantile.js.map @@ -0,0 +1 @@ +{"version":3,"file":"quantile.js","sourceRoot":"","sources":["../../../../src/compile/data/quantile.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,qBAAsB,SAAQ,YAAY;IAC9C,KAAK;QACV,OAAO,IAAI,qBAAqB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACpE,CAAC;IAED,YACE,MAAoB,EACZ,SAA4B;QAEpC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAmB;QAGpC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,CAAC;IAC5E,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAC/E,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,qBAAqB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACrD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,QAAQ,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QAC3C,MAAM,MAAM,GAAwB;YAClC,IAAI,EAAE,UAAU;YAChB,KAAK,EAAE,QAAQ;YACf,GAAG,IAAI;SACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/regression.d.ts b/build/src/compile/data/regression.d.ts new file mode 100644 index 0000000000..fa7727167d --- /dev/null +++ b/build/src/compile/data/regression.d.ts @@ -0,0 +1,16 @@ +import { RegressionTransform as VgRegressionTransform } from 'vega'; +import { RegressionTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for regression transform nodes + */ +export declare class RegressionTransformNode extends DataFlowNode { + private transform; + clone(): RegressionTransformNode; + constructor(parent: DataFlowNode, transform: RegressionTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgRegressionTransform; +} +//# sourceMappingURL=regression.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/regression.d.ts.map b/build/src/compile/data/regression.d.ts.map new file mode 100644 index 0000000000..d079e21e5a --- /dev/null +++ b/build/src/compile/data/regression.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"regression.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/regression.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,IAAI,qBAAqB,EAAC,MAAM,MAAM,CAAC;AAClE,OAAO,EAAC,mBAAmB,EAAC,MAAM,iBAAiB,CAAC;AAEpD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,YAAY;IAOrD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,mBAAmB;IAQjC,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,qBAAqB;CAUzC"} \ No newline at end of file diff --git a/build/src/compile/data/regression.js b/build/src/compile/data/regression.js new file mode 100644 index 0000000000..0efcffe14b --- /dev/null +++ b/build/src/compile/data/regression.js @@ -0,0 +1,37 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for regression transform nodes + */ +export class RegressionTransformNode extends DataFlowNode { + clone() { + return new RegressionTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression]; + } + dependentFields() { + return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `RegressionTransform ${hash(this.transform)}`; + } + assemble() { + const { regression, on, ...rest } = this.transform; + const result = { + type: 'regression', + x: on, + y: regression, + ...rest + }; + return result; + } +} +//# sourceMappingURL=regression.js.map \ No newline at end of file diff --git a/build/src/compile/data/regression.js.map b/build/src/compile/data/regression.js.map new file mode 100644 index 0000000000..6fe560a3e3 --- /dev/null +++ b/build/src/compile/data/regression.js.map @@ -0,0 +1 @@ +{"version":3,"file":"regression.js","sourceRoot":"","sources":["../../../../src/compile/data/regression.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,uBAAwB,SAAQ,YAAY;IAChD,KAAK;QACV,OAAO,IAAI,uBAAuB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IACtE,CAAC;IAED,YACE,MAAoB,EACZ,SAA8B;QAEtC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAqB;QAGtC,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC,CAAC,oCAAoC;QAC3E,MAAM,WAAW,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;QAChE,IAAI,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,EAAE,EAAE,WAAW,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,UAAU,CAAC,CAAC;IAC/F,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACpG,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IACpC,CAAC;IAEM,IAAI;QACT,OAAO,uBAAuB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACvD,CAAC;IAEM,QAAQ;QACb,MAAM,EAAC,UAAU,EAAE,EAAE,EAAE,GAAG,IAAI,EAAC,GAAG,IAAI,CAAC,SAAS,CAAC;QACjD,MAAM,MAAM,GAA0B;YACpC,IAAI,EAAE,YAAY;YAClB,CAAC,EAAE,EAAE;YACL,CAAC,EAAE,UAAU;YACb,GAAG,IAAI;SACR,CAAC;QACF,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/sample.d.ts b/build/src/compile/data/sample.d.ts new file mode 100644 index 0000000000..7f472f9512 --- /dev/null +++ b/build/src/compile/data/sample.d.ts @@ -0,0 +1,16 @@ +import { SampleTransform as VgSampleTransform } from 'vega'; +import { SampleTransform } from '../../transform'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the sample transform nodes + */ +export declare class SampleTransformNode extends DataFlowNode { + private transform; + clone(): SampleTransformNode; + constructor(parent: DataFlowNode, transform: SampleTransform); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgSampleTransform; +} +//# sourceMappingURL=sample.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/sample.d.ts.map b/build/src/compile/data/sample.d.ts.map new file mode 100644 index 0000000000..5eddfbee5f --- /dev/null +++ b/build/src/compile/data/sample.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sample.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/sample.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAOjD,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,eAAe;IAK7B,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,iBAAiB;CAMrC"} \ No newline at end of file diff --git a/build/src/compile/data/sample.js b/build/src/compile/data/sample.js new file mode 100644 index 0000000000..37b7b14fa8 --- /dev/null +++ b/build/src/compile/data/sample.js @@ -0,0 +1,30 @@ +import { duplicate, hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the sample transform nodes + */ +export class SampleTransformNode extends DataFlowNode { + clone() { + return new SampleTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set(); + } + hash() { + return `SampleTransform ${hash(this.transform)}`; + } + assemble() { + return { + type: 'sample', + size: this.transform.sample + }; + } +} +//# sourceMappingURL=sample.js.map \ No newline at end of file diff --git a/build/src/compile/data/sample.js.map b/build/src/compile/data/sample.js.map new file mode 100644 index 0000000000..24cb7e7da7 --- /dev/null +++ b/build/src/compile/data/sample.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sample.js","sourceRoot":"","sources":["../../../../src/compile/data/sample.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,YAAY;IAC5C,KAAK;QACV,OAAO,IAAI,mBAAmB,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC;IAClE,CAAC;IAED,YACE,MAAoB,EACZ,SAA0B;QAElC,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,cAAS,GAAT,SAAS,CAAiB;IAGpC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,IAAI;QACT,OAAO,mBAAmB,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;IACnD,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM;SAC5B,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/sequence.d.ts b/build/src/compile/data/sequence.d.ts new file mode 100644 index 0000000000..d197eaaf4a --- /dev/null +++ b/build/src/compile/data/sequence.d.ts @@ -0,0 +1,13 @@ +import { SequenceParams } from '../../data'; +import { SequenceTransform as VgSequenceTransform } from 'vega'; +import { DataFlowNode } from './dataflow'; +export declare class SequenceNode extends DataFlowNode { + private params; + clone(): SequenceNode; + constructor(parent: DataFlowNode, params: SequenceParams); + dependentFields(): Set; + producedFields(): Set; + hash(): string; + assemble(): VgSequenceTransform; +} +//# sourceMappingURL=sequence.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/sequence.d.ts.map b/build/src/compile/data/sequence.d.ts.map new file mode 100644 index 0000000000..0479927fb8 --- /dev/null +++ b/build/src/compile/data/sequence.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sequence.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/sequence.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAE1C,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,YAAa,SAAQ,YAAY;IAO1C,OAAO,CAAC,MAAM;IANT,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,MAAM,EAAE,cAAc;IAKzB,eAAe;IAIf,cAAc;IAId,IAAI;IAIJ,QAAQ,IAAI,mBAAmB;CAMvC"} \ No newline at end of file diff --git a/build/src/compile/data/sequence.js b/build/src/compile/data/sequence.js new file mode 100644 index 0000000000..01e9d07618 --- /dev/null +++ b/build/src/compile/data/sequence.js @@ -0,0 +1,27 @@ +import { hash } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class SequenceNode extends DataFlowNode { + clone() { + return new SequenceNode(null, this.params); + } + constructor(parent, params) { + super(parent); + this.params = params; + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set([this.params.as ?? 'data']); + } + hash() { + return `Hash ${hash(this.params)}`; + } + assemble() { + return { + type: 'sequence', + ...this.params + }; + } +} +//# sourceMappingURL=sequence.js.map \ No newline at end of file diff --git a/build/src/compile/data/sequence.js.map b/build/src/compile/data/sequence.js.map new file mode 100644 index 0000000000..f3f9f006b9 --- /dev/null +++ b/build/src/compile/data/sequence.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sequence.js","sourceRoot":"","sources":["../../../../src/compile/data/sequence.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,YAAa,SAAQ,YAAY;IACrC,KAAK;QACV,OAAO,IAAI,YAAY,CAAC,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,YACE,MAAoB,EACZ,MAAsB;QAE9B,KAAK,CAAC,MAAM,CAAC,CAAC;QAFN,WAAM,GAAN,MAAM,CAAgB;IAGhC,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,GAAG,EAAU,CAAC;IAC3B,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC;IAC7C,CAAC;IAEM,IAAI;QACT,OAAO,QAAQ,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;IACrC,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,UAAU;YAChB,GAAG,IAAI,CAAC,MAAM;SACf,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/source.d.ts b/build/src/compile/data/source.d.ts new file mode 100644 index 0000000000..17f987d1fd --- /dev/null +++ b/build/src/compile/data/source.d.ts @@ -0,0 +1,21 @@ +import { Data } from '../../data'; +import { VgData } from '../../vega.schema'; +import { DataFlowNode } from './dataflow'; +export declare class SourceNode extends DataFlowNode { + private _data; + private _name; + private _generator; + constructor(data: Data); + dependentFields(): Set; + producedFields(): undefined; + get data(): Partial; + hasName(): boolean; + get isGenerator(): boolean; + get dataName(): string; + set dataName(name: string); + set parent(parent: DataFlowNode); + remove(): void; + hash(): string | number; + assemble(): VgData; +} +//# sourceMappingURL=source.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/source.d.ts.map b/build/src/compile/data/source.d.ts.map new file mode 100644 index 0000000000..9d26102c8c --- /dev/null +++ b/build/src/compile/data/source.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/source.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAQL,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,MAAM,EAAC,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,qBAAa,UAAW,SAAQ,YAAY;IAC1C,OAAO,CAAC,KAAK,CAAkB;IAE/B,OAAO,CAAC,KAAK,CAAS;IAEtB,OAAO,CAAC,UAAU,CAAU;gBAEhB,IAAI,EAAE,IAAI;IA8Cf,eAAe;IAIf,cAAc,IAAI,SAAS;IAIlC,IAAI,IAAI,oBAEP;IAEM,OAAO,IAAI,OAAO;IAIzB,IAAI,WAAW,YAEd;IAED,IAAI,QAAQ,IAIO,MAAM,CAFxB;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,MAAM,EAExB;IAED,IAAI,MAAM,CAAC,MAAM,EAAE,YAAY,EAE9B;IAEM,MAAM;IAIN,IAAI,IAAI,MAAM,GAAG,MAAM;IAIvB,QAAQ,IAAI,MAAM;CAO1B"} \ No newline at end of file diff --git a/build/src/compile/data/source.js b/build/src/compile/data/source.js new file mode 100644 index 0000000000..1005c67230 --- /dev/null +++ b/build/src/compile/data/source.js @@ -0,0 +1,83 @@ +import { isGenerator, isInlineData, isNamedData, isSphereGenerator, isUrlData } from '../../data'; +import { contains, isEmpty, omit } from '../../util'; +import { DataFlowNode } from './dataflow'; +export class SourceNode extends DataFlowNode { + constructor(data) { + super(null); // source cannot have parent + data ?? (data = { name: 'source' }); + let format; + if (!isGenerator(data)) { + format = data.format ? { ...omit(data.format, ['parse']) } : {}; + } + if (isInlineData(data)) { + this._data = { values: data.values }; + } + else if (isUrlData(data)) { + this._data = { url: data.url }; + if (!format.type) { + // Extract extension from URL using snippet from + // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript + let defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; + if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { + defaultExtension = 'json'; + } + // defaultExtension has type string but we ensure that it is DataFormatType above + format.type = defaultExtension; + } + } + else if (isSphereGenerator(data)) { + // hardwire GeoJSON sphere data into output specification + this._data = { values: [{ type: 'Sphere' }] }; + } + else if (isNamedData(data) || isGenerator(data)) { + this._data = {}; + } + // set flag to check if generator + this._generator = isGenerator(data); + // any dataset can be named + if (data.name) { + this._name = data.name; + } + if (format && !isEmpty(format)) { + this._data.format = format; + } + } + dependentFields() { + return new Set(); + } + producedFields() { + return undefined; // we don't know what this source produces + } + get data() { + return this._data; + } + hasName() { + return !!this._name; + } + get isGenerator() { + return this._generator; + } + get dataName() { + return this._name; + } + set dataName(name) { + this._name = name; + } + set parent(parent) { + throw new Error('Source nodes have to be roots.'); + } + remove() { + throw new Error('Source nodes are roots and cannot be removed.'); + } + hash() { + throw new Error('Cannot hash sources'); + } + assemble() { + return { + name: this._name, + ...this._data, + transform: [] + }; + } +} +//# sourceMappingURL=source.js.map \ No newline at end of file diff --git a/build/src/compile/data/source.js.map b/build/src/compile/data/source.js.map new file mode 100644 index 0000000000..40b485576b --- /dev/null +++ b/build/src/compile/data/source.js.map @@ -0,0 +1 @@ +{"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../src/compile/data/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,WAAW,EACX,YAAY,EACZ,WAAW,EACX,iBAAiB,EACjB,SAAS,EACV,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC,MAAM,OAAO,UAAW,SAAQ,YAAY;IAO1C,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,4BAA4B;QAEzC,IAAI,KAAJ,IAAI,GAAK,EAAC,IAAI,EAAE,QAAQ,EAAC,EAAC;QAC1B,IAAI,MAAM,CAAC;QAEX,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;YACtB,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,CAAC,EAAC,CAAC,CAAC,CAAE,EAAiB,CAAC;SAC/E;QAED,IAAI,YAAY,CAAC,IAAI,CAAC,EAAE;YACtB,IAAI,CAAC,KAAK,GAAG,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,EAAC,CAAC;SACpC;aAAM,IAAI,SAAS,CAAC,IAAI,CAAC,EAAE;YAC1B,IAAI,CAAC,KAAK,GAAG,EAAC,GAAG,EAAE,IAAI,CAAC,GAAG,EAAC,CAAC;YAE7B,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE;gBAChB,gDAAgD;gBAChD,wGAAwG;gBACxG,IAAI,gBAAgB,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CA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AI,CAAC,KAAK,CAAC;IACpB,CAAC;IAED,IAAI,QAAQ,CAAC,IAAY;QACvB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;IACpB,CAAC;IAED,IAAI,MAAM,CAAC,MAAoB;QAC7B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IAEM,MAAM;QACX,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IAEM,IAAI;QACT,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACzC,CAAC;IAEM,QAAQ;QACb,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,GAAG,IAAI,CAAC,KAAK;YACb,SAAS,EAAE,EAAE;SACd,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/stack.d.ts b/build/src/compile/data/stack.d.ts new file mode 100644 index 0000000000..53595b2c83 --- /dev/null +++ b/build/src/compile/data/stack.d.ts @@ -0,0 +1,58 @@ +import { Transforms as VgTransform } from 'vega'; +import { FieldDef, FieldName } from '../../channeldef'; +import { SortFields } from '../../sort'; +import { StackOffset } from '../../stack'; +import { StackTransform } from '../../transform'; +import { UnitModel } from '../unit'; +import { DataFlowNode } from './dataflow'; +export interface StackComponent { + /** + * Faceted field. + */ + facetby: string[]; + dimensionFieldDefs: FieldDef[]; + /** + * Stack measure's field. Used in makeFromEncoding. + */ + stackField: string; + /** + * Level of detail fields for each level in the stacked charts such as color or detail. + * Used in makeFromEncoding. + */ + stackby?: string[]; + /** + * Field that determines order of levels in the stacked charts. + * Used in both but optional in transform. + */ + sort: SortFields; + /** Mode for stacking marks. + */ + offset: StackOffset; + /** + * Whether to impute the data before stacking. Used only in makeFromEncoding. + */ + impute?: boolean; + /** + * The data fields to group by. + */ + groupby?: FieldName[]; + /** + * Output field names of each stack field. + */ + as: [FieldName, FieldName]; +} +export declare class StackNode extends DataFlowNode { + private _stack; + clone(): StackNode; + constructor(parent: DataFlowNode, stack: StackComponent); + static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform): StackNode; + static makeFromEncoding(parent: DataFlowNode, model: UnitModel): StackNode; + get stack(): StackComponent; + addDimensions(fields: string[]): void; + dependentFields(): Set; + producedFields(): Set; + hash(): string; + private getGroupbyFields; + assemble(): VgTransform[]; +} +//# sourceMappingURL=stack.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/stack.d.ts.map b/build/src/compile/data/stack.d.ts.map new file mode 100644 index 0000000000..11e55b786f --- /dev/null +++ b/build/src/compile/data/stack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,WAAW,EAAC,MAAM,MAAM,CAAC;AAE/C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAmD,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAC,UAAU,EAAY,MAAM,YAAY,CAAC;AACjD,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AACxC,OAAO,EAAC,cAAc,EAAC,MAAM,iBAAiB,CAAC;AAG/C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAcxC,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,MAAM,EAAE,CAAC;IAElB,kBAAkB,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;IAEvC;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IAEnB;;;OAGG;IACH,IAAI,EAAE,UAAU,CAAC;IAEjB;OACG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,EAAE,CAAC;IACtB;;OAEG;IACH,EAAE,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;CAC5B;AAMD,qBAAa,SAAU,SAAQ,YAAY;IACzC,OAAO,CAAC,MAAM,CAAiB;IAExB,KAAK;gBAIA,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;WAMzC,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,cAAc;WAmCtE,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS;IAoDrE,IAAI,KAAK,IAAI,cAAc,CAE1B;IAEM,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAYf,cAAc;IAId,IAAI;IAIX,OAAO,CAAC,gBAAgB;IAyBjB,QAAQ,IAAI,WAAW,EAAE;CA4CjC"} \ No newline at end of file diff --git a/build/src/compile/data/stack.js b/build/src/compile/data/stack.js new file mode 100644 index 0000000000..469a3d6c92 --- /dev/null +++ b/build/src/compile/data/stack.js @@ -0,0 +1,187 @@ +import { isArray, isString } from 'vega-util'; +import { getFieldDef, isFieldDef, isOrderOnlyDef, vgField } from '../../channeldef'; +import { duplicate, getFirstDefined, hash } from '../../util'; +import { sortParams } from '../common'; +import { DataFlowNode } from './dataflow'; +function getStackByFields(model) { + return model.stack.stackBy.reduce((fields, by) => { + const fieldDef = by.fieldDef; + const _field = vgField(fieldDef); + if (_field) { + fields.push(_field); + } + return fields; + }, []); +} +function isValidAsArray(as) { + return isArray(as) && as.every(s => isString(s)) && as.length > 1; +} +export class StackNode extends DataFlowNode { + clone() { + return new StackNode(null, duplicate(this._stack)); + } + constructor(parent, stack) { + super(parent); + this._stack = stack; + } + static makeFromTransform(parent, stackTransform) { + const { stack, groupby, as, offset = 'zero' } = stackTransform; + const sortFields = []; + const sortOrder = []; + if (stackTransform.sort !== undefined) { + for (const sortField of stackTransform.sort) { + sortFields.push(sortField.field); + sortOrder.push(getFirstDefined(sortField.order, 'ascending')); + } + } + const sort = { + field: sortFields, + order: sortOrder + }; + let normalizedAs; + if (isValidAsArray(as)) { + normalizedAs = as; + } + else if (isString(as)) { + normalizedAs = [as, `${as}_end`]; + } + else { + normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`]; + } + return new StackNode(parent, { + dimensionFieldDefs: [], + stackField: stack, + groupby, + offset, + sort, + facetby: [], + as: normalizedAs + }); + } + static makeFromEncoding(parent, model) { + const stackProperties = model.stack; + const { encoding } = model; + if (!stackProperties) { + return null; + } + const { groupbyChannels, fieldChannel, offset, impute } = stackProperties; + const dimensionFieldDefs = groupbyChannels + .map(groupbyChannel => { + const cDef = encoding[groupbyChannel]; + return getFieldDef(cDef); + }) + .filter(def => !!def); + const stackby = getStackByFields(model); + const orderDef = model.encoding.order; + let sort; + if (isArray(orderDef) || isFieldDef(orderDef)) { + sort = sortParams(orderDef); + } + else { + const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending'; + // default = descending by stackFields + // FIXME is the default here correct for binned fields? + sort = stackby.reduce((s, field) => { + s.field.push(field); + s.order.push(sortOrder); + return s; + }, { field: [], order: [] }); + } + return new StackNode(parent, { + dimensionFieldDefs, + stackField: model.vgField(fieldChannel), + facetby: [], + stackby, + sort, + offset, + impute, + as: [ + model.vgField(fieldChannel, { suffix: 'start', forAs: true }), + model.vgField(fieldChannel, { suffix: 'end', forAs: true }) + ] + }); + } + get stack() { + return this._stack; + } + addDimensions(fields) { + this._stack.facetby.push(...fields); + } + dependentFields() { + const out = new Set(); + out.add(this._stack.stackField); + this.getGroupbyFields().forEach(out.add, out); + this._stack.facetby.forEach(out.add, out); + this._stack.sort.field.forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this._stack.as); + } + hash() { + return `Stack ${hash(this._stack)}`; + } + getGroupbyFields() { + const { dimensionFieldDefs, impute, groupby } = this._stack; + if (dimensionFieldDefs.length > 0) { + return dimensionFieldDefs + .map(dimensionFieldDef => { + if (dimensionFieldDef.bin) { + if (impute) { + // For binned group by field with impute, we calculate bin_mid + // as we cannot impute two fields simultaneously + return [vgField(dimensionFieldDef, { binSuffix: 'mid' })]; + } + return [ + // For binned group by field without impute, we need both bin (start) and bin_end + vgField(dimensionFieldDef, {}), + vgField(dimensionFieldDef, { binSuffix: 'end' }) + ]; + } + return [vgField(dimensionFieldDef)]; + }) + .flat(); + } + return groupby ?? []; + } + assemble() { + const transform = []; + const { facetby, dimensionFieldDefs, stackField: field, stackby, sort, offset, impute, as } = this._stack; + // Impute + if (impute) { + for (const dimensionFieldDef of dimensionFieldDefs) { + const { bandPosition = 0.5, bin } = dimensionFieldDef; + if (bin) { + // As we can only impute one field at a time, we need to calculate + // mid point for a binned field + const binStart = vgField(dimensionFieldDef, { expr: 'datum' }); + const binEnd = vgField(dimensionFieldDef, { expr: 'datum', binSuffix: 'end' }); + transform.push({ + type: 'formula', + expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`, + as: vgField(dimensionFieldDef, { binSuffix: 'mid', forAs: true }) + }); + } + transform.push({ + type: 'impute', + field, + groupby: [...stackby, ...facetby], + key: vgField(dimensionFieldDef, { binSuffix: 'mid' }), + method: 'value', + value: 0 + }); + } + } + // Stack + transform.push({ + type: 'stack', + groupby: [...this.getGroupbyFields(), ...facetby], + field, + sort, + as, + offset + }); + return transform; + } +} +//# sourceMappingURL=stack.js.map \ No newline at end of file diff --git a/build/src/compile/data/stack.js.map b/build/src/compile/data/stack.js.map new file mode 100644 index 0000000000..a6c6b21112 --- /dev/null +++ b/build/src/compile/data/stack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../../../src/compile/data/stack.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAsB,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAIvG,O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,IAAI,EAAE,SAAS;wBACf,IAAI,EAAE,GAAG,YAAY,IAAI,QAAQ,IAAI,CAAC,GAAG,YAAY,IAAI,MAAM,EAAE;wBACjE,EAAE,EAAE,OAAO,CAAC,iBAAiB,EAAE,EAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAC,CAAC;qBAChE,CAAC,CAAC;iBACJ;gBAED,SAAS,CAAC,IAAI,CAAC;oBACb,IAAI,EAAE,QAAQ;oBACd,KAAK;oBACL,OAAO,EAAE,CAAC,GAAG,OAAO,EAAE,GAAG,OAAO,CAAC;oBACjC,GAAG,EAAE,OAAO,CAAC,iBAAiB,EAAE,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC;oBACnD,MAAM,EAAE,OAAO;oBACf,KAAK,EAAE,CAAC;iBACT,CAAC,CAAC;aACJ;SACF;QAED,QAAQ;QACR,SAAS,CAAC,IAAI,CAAC;YACb,IAAI,EAAE,OAAO;YACb,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,gBAAgB,EAAE,EAAE,GAAG,OAAO,CAAC;YACjD,KAAK;YACL,IAAI;YACJ,EAAE;YACF,MAAM;SACP,CAAC,CAAC;QAEH,OAAO,SAAS,CAAC;IACnB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/data/subtree.d.ts b/build/src/compile/data/subtree.d.ts new file mode 100644 index 0000000000..0e27010d2d --- /dev/null +++ b/build/src/compile/data/subtree.d.ts @@ -0,0 +1,7 @@ +import { DataFlowNode } from './dataflow'; +/** + * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. + * After moving down the facet node, make a copy of the subtree and make it a child of the main output. + */ +export declare function moveFacetDown(node: DataFlowNode): void; +//# sourceMappingURL=subtree.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/subtree.d.ts.map b/build/src/compile/data/subtree.d.ts.map new file mode 100644 index 0000000000..d4e6755fb3 --- /dev/null +++ b/build/src/compile/data/subtree.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subtree.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/subtree.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAa,MAAM,YAAY,CAAC;AAwCpD;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,YAAY,QAiC/C"} \ No newline at end of file diff --git a/build/src/compile/data/subtree.js b/build/src/compile/data/subtree.js new file mode 100644 index 0000000000..74fc516de6 --- /dev/null +++ b/build/src/compile/data/subtree.js @@ -0,0 +1,81 @@ +import { DataSourceType } from '../../data'; +import { AggregateNode } from './aggregate'; +import { OutputNode } from './dataflow'; +import { FacetNode } from './facet'; +import { JoinAggregateTransformNode } from './joinaggregate'; +import { FACET_SCALE_PREFIX } from './optimize'; +import { StackNode } from './stack'; +import { WindowTransformNode } from './window'; +/** + * Clones the subtree and ignores output nodes except for the leaves, which are renamed. + */ +function cloneSubtree(facet) { + function clone(node) { + if (!(node instanceof FacetNode)) { + const copy = node.clone(); + if (copy instanceof OutputNode) { + const newName = FACET_SCALE_PREFIX + copy.getSource(); + copy.setSource(newName); + facet.model.component.data.outputNodes[newName] = copy; + } + else if (copy instanceof AggregateNode || + copy instanceof StackNode || + copy instanceof WindowTransformNode || + copy instanceof JoinAggregateTransformNode) { + copy.addDimensions(facet.fields); + } + for (const n of node.children.flatMap(clone)) { + n.parent = copy; + } + return [copy]; + } + return node.children.flatMap(clone); + } + return clone; +} +/** + * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. + * After moving down the facet node, make a copy of the subtree and make it a child of the main output. + */ +export function moveFacetDown(node) { + if (node instanceof FacetNode) { + if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { + // move down until we hit a fork or output node + const child = node.children[0]; + if (child instanceof AggregateNode || + child instanceof StackNode || + child instanceof WindowTransformNode || + child instanceof JoinAggregateTransformNode) { + child.addDimensions(node.fields); + } + child.swapWithParent(); + moveFacetDown(node); + } + else { + // move main to facet + const facetMain = node.model.component.data.main; + moveMainDownToFacet(facetMain); + // replicate the subtree and place it before the facet's main node + const cloner = cloneSubtree(node); + const copy = node.children.map(cloner).flat(); + for (const c of copy) { + c.parent = facetMain; + } + } + } + else { + node.children.map(moveFacetDown); + } +} +function moveMainDownToFacet(node) { + if (node instanceof OutputNode && node.type === DataSourceType.Main) { + if (node.numChildren() === 1) { + const child = node.children[0]; + if (!(child instanceof FacetNode)) { + child.swapWithParent(); + moveMainDownToFacet(node); + } + } + } +} +//# sourceMappingURL=subtree.js.map \ No newline at end of file diff --git a/build/src/compile/data/subtree.js.map b/build/src/compile/data/subtree.js.map new file mode 100644 index 0000000000..efc2a9f494 --- /dev/null +++ b/build/src/compile/data/subtree.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subtree.js","sourceRoot":"","sources":["../../../../src/compile/data/subtree.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAe,UAAU,EAAC,MAAM,YAAY,CAAC;AACpD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,0BAA0B,EAAC,MAAM,iBAAiB,CAAC;AAC3D,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,mBAAmB,EAAC,MAAM,UAAU,CAAC;AAE7C;;GAEG;AACH,SAAS,YAAY,CAAC,KAAgB;IACpC,SAAS,KAAK,CAAC,IAAkB;QAC/B,IAAI,CAAC,CAAC,IAAI,YAAY,SAAS,CAAC,EAAE;YAChC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;YAE1B,IAAI,IAAI,YAAY,UAAU,EAAE;gBAC9B,MAAM,OAAO,GAAG,kBAAkB,GAAG,IAAI,CAAC,SAAS,EAAE,CAAC;gBACtD,IAAI,CAAC,SAAS,CAAC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AC,IAAI,CAAC,IAAI,CAAC;YACjD,mBAAmB,CAAC,SAAS,CAAC,CAAC;YAE/B,kEAAkE;YAClE,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;YAClC,MAAM,IAAI,GAAmB,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,CAAC;YAC9D,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE;gBACpB,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC;aACtB;SACF;KACF;SAAM;QACL,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC;KAClC;AACH,CAAC;AAED,SAAS,mBAAmB,CAAC,IAAkB;IAC7C,IAAI,IAAI,YAAY,UAAU,IAAI,IAAI,CAAC,IAAI,KAAK,cAAc,CAAC,IAAI,EAAE;QACnE,IAAI,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE;YAC5B,MAAM,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YAC/B,IAAI,CAAC,CAAC,KAAK,YAAY,SAAS,CAAC,EAAE;gBACjC,KAAK,CAAC,cAAc,EAAE,CAAC;gBACvB,mBAAmB,CAAC,IAAI,CAAC,CAAC;aAC3B;SACF;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/timeunit.d.ts b/build/src/compile/data/timeunit.d.ts new file mode 100644 index 0000000000..51feca8440 --- /dev/null +++ b/build/src/compile/data/timeunit.d.ts @@ -0,0 +1,38 @@ +import { TimeUnitTransform as VgTimeUnitTransform } from 'vega'; +import { FormulaTransform as VgFormulaTransform } from 'vega'; +import { FieldName } from '../../channeldef'; +import { TimeUnitParams } from '../../timeunit'; +import { TimeUnitTransform } from '../../transform'; +import { Dict } from '../../util'; +import { ModelWithField } from '../model'; +import { DataFlowNode } from './dataflow'; +export type TimeUnitComponent = (TimeUnitTransform | BinnedTimeUnitOffset) & { + rectBandPosition?: number; +}; +export interface BinnedTimeUnitOffset { + timeUnit: TimeUnitParams; + field: FieldName; +} +export declare class TimeUnitNode extends DataFlowNode { + private timeUnits; + clone(): TimeUnitNode; + constructor(parent: DataFlowNode, timeUnits: Dict); + static makeFromEncoding(parent: DataFlowNode, model: ModelWithField): TimeUnitNode; + static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform): TimeUnitNode; + /** + * Merge together TimeUnitNodes assigning the children of `other` to `this` + * and removing `other`. + */ + merge(other: TimeUnitNode): void; + /** + * Remove time units coming from the other node. + */ + removeFormulas(fields: Set): void; + producedFields(): Set; + dependentFields(): Set; + hash(): string; + assemble(): (VgFormulaTransform | VgTimeUnitTransform)[]; +} +export declare const OFFSETTED_RECT_START_SUFFIX = "offsetted_rect_start"; +export declare const OFFSETTED_RECT_END_SUFFIX = "offsetted_rect_end"; +//# sourceMappingURL=timeunit.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/timeunit.d.ts.map b/build/src/compile/data/timeunit.d.ts.map new file mode 100644 index 0000000000..67b482ecf9 --- /dev/null +++ b/build/src/compile/data/timeunit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"timeunit.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/timeunit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,iBAAiB,IAAI,mBAAmB,EAAC,MAAM,MAAM,CAAC;AAC9D,OAAO,EAAC,gBAAgB,IAAI,kBAAkB,EAAC,MAAM,MAAM,CAAC;AAC5D,OAAO,EAAC,SAAS,EAA2B,MAAM,kBAAkB,CAAC;AACrE,OAAO,EACL,cAAc,EAMf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAC,iBAAiB,EAAC,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAC,IAAI,EAA8D,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAC,cAAc,EAAc,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAIxC,MAAM,MAAM,iBAAiB,GAAG,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,GAAG;IAC3E,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAEF,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,cAAc,CAAC;IACzB,KAAK,EAAE,SAAS,CAAC;CAClB;AAUD,qBAAa,YAAa,SAAQ,YAAY;IAO1C,OAAO,CAAC,SAAS;IANZ,KAAK;gBAKV,MAAM,EAAE,YAAY,EACZ,SAAS,EAAE,IAAI,CAAC,iBAAiB,CAAC;WAK9B,gBAAgB,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,cAAc;WAkD5D,iBAAiB,CAAC,MAAM,EAAE,YAAY,EAAE,CAAC,EAAE,iBAAiB;IAe1E;;;OAGG;IACI,KAAK,CAAC,KAAK,EAAE,YAAY;IAmBhC;;OAEG;IACI,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC;IAelC,cAAc;IAQd,eAAe;IAIf,IAAI;IAIJ,QAAQ;CAyChB;AAED,eAAO,MAAM,2BAA2B,yBAAyB,CAAC;AAClE,eAAO,MAAM,yBAAyB,uBAAuB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/timeunit.js b/build/src/compile/data/timeunit.js new file mode 100644 index 0000000000..a51cc95375 --- /dev/null +++ b/build/src/compile/data/timeunit.js @@ -0,0 +1,196 @@ +import { getBandPosition, vgField } from '../../channeldef'; +import { getDateTimePartAndStep, getSmallestTimeUnitPart, getTimeUnitParts, isBinnedTimeUnit, normalizeTimeUnit } from '../../timeunit'; +import { duplicate, entries, hash, isEmpty, replacePathInField, vals } from '../../util'; +import { isUnitModel } from '../model'; +import { DataFlowNode } from './dataflow'; +import { isRectBasedMark } from '../../mark'; +import { isXorY } from '../../channel'; +function isTimeUnitTransformComponent(timeUnitComponent) { + return timeUnitComponent.as !== undefined; +} +function offsetAs(field) { + return `${field}_end`; +} +export class TimeUnitNode extends DataFlowNode { + clone() { + return new TimeUnitNode(null, duplicate(this.timeUnits)); + } + constructor(parent, timeUnits) { + super(parent); + this.timeUnits = timeUnits; + } + static makeFromEncoding(parent, model) { + const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => { + const { field, timeUnit } = fieldDef; + if (timeUnit) { + let component; + if (isBinnedTimeUnit(timeUnit)) { + // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs "range". + if (isUnitModel(model)) { + const { mark, markDef, config } = model; + const bandPosition = getBandPosition({ fieldDef, markDef, config }); + if (isRectBasedMark(mark) || !!bandPosition) { + component = { + timeUnit: normalizeTimeUnit(timeUnit), + field + }; + } + } + } + else { + component = { + as: vgField(fieldDef, { forAs: true }), + field, + timeUnit + }; + } + if (isUnitModel(model)) { + const { mark, markDef, config } = model; + const bandPosition = getBandPosition({ fieldDef, markDef, config }); + if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) { + component.rectBandPosition = bandPosition; + } + } + if (component) { + timeUnitComponent[hash(component)] = component; + } + } + return timeUnitComponent; + }, {}); + if (isEmpty(formula)) { + return null; + } + return new TimeUnitNode(parent, formula); + } + static makeFromTransform(parent, t) { + const { timeUnit, ...other } = { ...t }; + const normalizedTimeUnit = normalizeTimeUnit(timeUnit); + const component = { + ...other, + timeUnit: normalizedTimeUnit + }; + return new TimeUnitNode(parent, { + [hash(component)]: component + }); + } + /** + * Merge together TimeUnitNodes assigning the children of `other` to `this` + * and removing `other`. + */ + merge(other) { + this.timeUnits = { ...this.timeUnits }; + // if the same hash happen twice, merge + for (const key in other.timeUnits) { + if (!this.timeUnits[key]) { + // copy if it's not a duplicate + this.timeUnits[key] = other.timeUnits[key]; + } + } + for (const child of other.children) { + other.removeChild(child); + child.parent = this; + } + other.remove(); + } + /** + * Remove time units coming from the other node. + */ + removeFormulas(fields) { + const newFormula = {}; + for (const [key, timeUnitComponent] of entries(this.timeUnits)) { + const fieldAs = isTimeUnitTransformComponent(timeUnitComponent) + ? timeUnitComponent.as + : `${timeUnitComponent.field}_end`; + if (!fields.has(fieldAs)) { + newFormula[key] = timeUnitComponent; + } + } + this.timeUnits = newFormula; + } + producedFields() { + return new Set(vals(this.timeUnits).map(f => { + return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field); + })); + } + dependentFields() { + return new Set(vals(this.timeUnits).map(f => f.field)); + } + hash() { + return `TimeUnit ${hash(this.timeUnits)}`; + } + assemble() { + const transforms = []; + for (const f of vals(this.timeUnits)) { + const { rectBandPosition } = f; + const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit); + if (isTimeUnitTransformComponent(f)) { + const { field, as } = f; + const { unit, utc, ...params } = normalizedTimeUnit; + const startEnd = [as, `${as}_end`]; + transforms.push({ + field: replacePathInField(field), + type: 'timeunit', + ...(unit ? { units: getTimeUnitParts(unit) } : {}), + ...(utc ? { timezone: 'utc' } : {}), + ...params, + as: startEnd + }); + transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit)); + } + else if (f) { + const { field: escapedField } = f; + // since this is a expression, we want the unescaped field name + const field = escapedField.replaceAll('\\.', '.'); + const expr = offsetExpr({ timeUnit: normalizedTimeUnit, field }); + const endAs = offsetAs(field); + transforms.push({ + type: 'formula', + expr, + as: endAs + }); + transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit)); + } + } + return transforms; + } +} +export const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start'; +export const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end'; +function offsetExpr({ timeUnit, field, reverse }) { + const { unit, utc } = timeUnit; + const smallestUnit = getSmallestTimeUnitPart(unit); + const { part, step } = getDateTimePartAndStep(smallestUnit, timeUnit.step); + const offsetFn = utc ? 'utcOffset' : 'timeOffset'; + const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`; + return expr; +} +function offsetedRectFormulas([startField, endField], rectBandPosition, timeUnit) { + if (rectBandPosition !== undefined && rectBandPosition !== 0.5) { + const startExpr = `datum['${startField}']`; + const endExpr = `datum['${endField}']`; + return [ + { + type: 'formula', + expr: interpolateExpr([ + offsetExpr({ + timeUnit, + field: startField, + reverse: true + }), + startExpr + ], rectBandPosition + 0.5), + as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}` + }, + { + type: 'formula', + expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5), + as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}` + } + ]; + } + return []; +} +function interpolateExpr([start, end], fraction) { + return `${1 - fraction} * ${start} + ${fraction} * ${end}`; +} +//# sourceMappingURL=timeunit.js.map \ No newline at end of file diff --git a/build/src/compile/data/timeunit.js.map b/build/src/compile/data/timeunit.js.map new file mode 100644 index 0000000000..a3360af7ba --- /dev/null +++ b/build/src/compile/data/timeunit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timeunit.js","sourceRoot":"","sources":["../../../../src/compile/data/timeunit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAY,eAAe,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAEL,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,EAClB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAO,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,kBAAkB,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAiB,WAAW,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAWrC,SAAS,4BAA4B,CAAC,iBAAoC;IACxE,OAAQ,iBAAuC,CAAC,EAAE,KAAK,SAAS,CAAC;AACnE,CAAC;AAED,SAAS,QAAQ,CAAC,KAAgB;IAChC,OAAO,GAAG,KAAK,MAAM,CAAC;AACx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B,CAC3B,CAAC,UAAU,EAAE,QAAQ,CAAmB,EACxC,gBAAoC,EACpC,QAAwB;IAExB,IAAI,gBAAgB,KAAK,SAAS,IAAI,gBAAgB,KAAK,GAAG,EAAE;QAC9D,MAAM,SAAS,GAAG,UAAU,UAAU,IAAI,CAAC;QAC3C,MAAM,OAAO,GAAG,UAAU,QAAQ,IAAI,CAAC;QACvC,OAAO;YACL;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe,CACnB;oBACE,UAAU,CAAC;wBACT,QAAQ;wBACR,KAAK,EAAE,UAAU;wBACjB,OAAO,EAAE,IAAI;qBACd,CAAC;oBACF,SAAS;iBACV,EACD,gBAAgB,GAAG,GAAG,CACvB;gBACD,EAAE,EAAE,GAAG,UAAU,IAAI,2BAA2B,EAAE;aACnD;YACD;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,GAAG,CAAC;gBACnE,EAAE,EAAE,GAAG,UAAU,IAAI,yBAAyB,EAAE;aACjD;SACF,CAAC;KACH;IACD,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,eAAe,CAAC,CAAC,KAAK,EAAE,GAAG,CAAmB,EAAE,QAAgB;IACvE,OAAO,GAAG,CAAC,GAAG,QAAQ,MAAM,KAAK,MAAM,QAAQ,MAAM,GAAG,EAAE,CAAC;AAC7D,CAAC"} \ No newline at end of file diff --git a/build/src/compile/data/window.d.ts b/build/src/compile/data/window.d.ts new file mode 100644 index 0000000000..4bca09350c --- /dev/null +++ b/build/src/compile/data/window.d.ts @@ -0,0 +1,19 @@ +import { WindowTransform as VgWindowTransform } from 'vega'; +import { WindowTransform } from '../../transform'; +import { VgJoinAggregateTransform } from '../../vega.schema'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the window transform nodes + */ +export declare class WindowTransformNode extends DataFlowNode { + private readonly transform; + clone(): WindowTransformNode; + constructor(parent: DataFlowNode, transform: WindowTransform); + addDimensions(fields: string[]): void; + dependentFields(): Set; + producedFields(): Set; + private getDefaultName; + hash(): string; + assemble(): VgWindowTransform | VgJoinAggregateTransform; +} +//# sourceMappingURL=window.d.ts.map \ No newline at end of file diff --git a/build/src/compile/data/window.d.ts.map b/build/src/compile/data/window.d.ts.map new file mode 100644 index 0000000000..7264428841 --- /dev/null +++ b/build/src/compile/data/window.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"window.d.ts","sourceRoot":"","sources":["../../../../src/compile/data/window.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,eAAe,IAAI,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAIvE,OAAO,EAA+B,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAE9E,OAAO,EAAe,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AAExC;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,YAAY;IAOjD,OAAO,CAAC,QAAQ,CAAC,SAAS;IANrB,KAAK;gBAKV,MAAM,EAAE,YAAY,EACH,SAAS,EAAE,eAAe;IAKtC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE;IAI9B,eAAe;IAcf,cAAc;IAIrB,OAAO,CAAC,cAAc;IAIf,IAAI;IAIJ,QAAQ,IAAI,iBAAiB,GAAG,wBAAwB;CAqDhE"} \ No newline at end of file diff --git a/build/src/compile/data/window.js b/build/src/compile/data/window.js new file mode 100644 index 0000000000..f39c407f90 --- /dev/null +++ b/build/src/compile/data/window.js @@ -0,0 +1,88 @@ +import { isAggregateOp } from '../../aggregate'; +import { vgField } from '../../channeldef'; +import { duplicate, hash } from '../../util'; +import { unique } from '../../util'; +import { DataFlowNode } from './dataflow'; +/** + * A class for the window transform nodes + */ +export class WindowTransformNode extends DataFlowNode { + clone() { + return new WindowTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); + } + dependentFields() { + const out = new Set(); + (this.transform.groupby ?? []).forEach(out.add, out); + (this.transform.sort ?? []).forEach(m => out.add(m.field)); + this.transform.window + .map(w => w.field) + .filter(f => f !== undefined) + .forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this.transform.window.map(this.getDefaultName)); + } + getDefaultName(windowFieldDef) { + return windowFieldDef.as ?? vgField(windowFieldDef); + } + hash() { + return `WindowTransform ${hash(this.transform)}`; + } + assemble() { + const fields = []; + const ops = []; + const as = []; + const params = []; + for (const window of this.transform.window) { + ops.push(window.op); + as.push(this.getDefaultName(window)); + params.push(window.param === undefined ? null : window.param); + fields.push(window.field === undefined ? null : window.field); + } + const frame = this.transform.frame; + const groupby = this.transform.groupby; + if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) { + // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate + return { + type: 'joinaggregate', + as, + ops: ops, + fields, + ...(groupby !== undefined ? { groupby } : {}) + }; + } + const sortFields = []; + const sortOrder = []; + if (this.transform.sort !== undefined) { + for (const sortField of this.transform.sort) { + sortFields.push(sortField.field); + sortOrder.push(sortField.order ?? 'ascending'); + } + } + const sort = { + field: sortFields, + order: sortOrder + }; + const ignorePeers = this.transform.ignorePeers; + return { + type: 'window', + params, + as, + ops, + fields, + sort, + ...(ignorePeers !== undefined ? { ignorePeers } : {}), + ...(groupby !== undefined ? { groupby } : {}), + ...(frame !== undefined ? { frame } : {}) + }; + } +} +//# sourceMappingURL=window.js.map \ No newline at end of file diff --git a/build/src/compile/data/window.js.map b/build/src/compile/data/window.js.map new file mode 100644 index 0000000000..29c5dddefa --- /dev/null +++ b/build/src/compile/data/window.js.map @@ -0,0 +1 @@ +{"version":3,"file":"window.js","sourceRoot":"","sources":["../../../../src/compile/data/window.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAC9C,O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CAAC;IACzB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/facet.d.ts b/build/src/compile/facet.d.ts new file mode 100644 index 0000000000..6f4b05d852 --- /dev/null +++ b/build/src/compile/facet.d.ts @@ -0,0 +1,45 @@ +import { NewSignal, SignalRef } from 'vega'; +import { ExtendedChannel } from '../channel'; +import { FieldRefOption, TypedFieldDef } from '../channeldef'; +import { Config } from '../config'; +import { EncodingSortField } from '../sort'; +import { NormalizedFacetSpec } from '../spec'; +import { EncodingFacetMapping, FacetFieldDef } from '../spec/facet'; +import { VgData, VgLayout, VgMarkGroup } from '../vega.schema'; +import { Model, ModelWithField } from './model'; +export declare function facetSortFieldName(fieldDef: FacetFieldDef, sort: EncodingSortField, opt?: FieldRefOption): string; +export declare class FacetModel extends ModelWithField { + readonly facet: EncodingFacetMapping; + readonly child: Model; + readonly children: Model[]; + constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config); + private initFacet; + private initFacetFieldDef; + channelHasField(channel: ExtendedChannel): boolean; + fieldDef(channel: ExtendedChannel): TypedFieldDef; + parseData(): void; + parseLayoutSize(): void; + parseSelections(): void; + parseMarkGroup(): void; + parseAxesAndHeaders(): void; + assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; + assembleSignals(): NewSignal[]; + assembleSelectionData(data: readonly VgData[]): readonly VgData[]; + private getHeaderLayoutMixins; + protected assembleDefaultLayout(): VgLayout; + assembleLayoutSignals(): NewSignal[]; + private columnDistinctSignal; + assembleGroupStyle(): string | string[]; + assembleGroup(signals: NewSignal[]): any; + /** + * Aggregate cardinality for calculating size + */ + private getCardinalityAggregateForChild; + private assembleFacet; + private facetSortFields; + private facetSortOrder; + private assembleLabelTitle; + assembleMarks(): VgMarkGroup[]; + protected getMapping(): EncodingFacetMapping; +} +//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/build/src/compile/facet.d.ts.map b/build/src/compile/facet.d.ts.map new file mode 100644 index 0000000000..fbe6db3bf8 ---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AAO,EAAE,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC;IAIzD,SAAS;IAKT,eAAe;IAIf,eAAe;IAQf,cAAc;IAId,mBAAmB;IAMnB,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAInE,eAAe,IAAI,SAAS,EAAE;IAK9B,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAIxE,OAAO,CAAC,qBAAqB;IAuC7B,SAAS,CAAC,qBAAqB,IAAI,QAAQ;IAwBpC,qBAAqB,IAAI,SAAS,EAAE;IAK3C,OAAO,CAAC,oBAAoB;IAarB,kBAAkB,IAAI,MAAM,GAAG,MAAM,EAAE;IAIvC,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE;IAuBzC;;OAEG;IACH,OAAO,CAAC,+BAA+B;IAoCvC,OAAO,CAAC,aAAa;IA0DrB,OAAO,CAAC,eAAe;IAevB,OAAO,CAAC,cAAc;IAWtB,OAAO,CAAC,kBAAkB;IAwBnB,aAAa,IAAI,WAAW,EAAE;IAkCrC,SAAS,CAAC,UAAU;CAGrB"} \ No newline at end of file diff --git a/build/src/compile/facet.js b/build/src/compile/facet.js new file mode 100644 index 0000000000..2391c56265 --- /dev/null +++ b/build/src/compile/facet.js @@ -0,0 +1,367 @@ +import { isArray } from 'vega-util'; +import { isBinning } from '../bin'; +import { COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW } from '../channel'; +import { initFieldDef, vgField } from '../channeldef'; +import { replaceExprRef } from '../expr'; +import * as log from '../log'; +import { hasDiscreteDomain } from '../scale'; +import { DEFAULT_SORT_OP, isSortField } from '../sort'; +import { isFacetMapping } from '../spec/facet'; +import { keys } from '../util'; +import { isVgRangeStep } from '../vega.schema'; +import { buildModel } from './buildmodel'; +import { assembleFacetData } from './data/assemble'; +import { sortArrayIndexField } from './data/calculate'; +import { parseData } from './data/parse'; +import { assembleLabelTitle } from './header/assemble'; +import { getHeaderChannel, getHeaderProperty } from './header/common'; +import { HEADER_CHANNELS, HEADER_TYPES } from './header/component'; +import { parseFacetHeaders } from './header/parse'; +import { parseChildrenLayoutSize } from './layoutsize/parse'; +import { ModelWithField } from './model'; +import { assembleDomain, getFieldFromDomain } from './scale/domain'; +import { assembleFacetSignals } from './selection/assemble'; +export function facetSortFieldName(fieldDef, sort, opt) { + return vgField(sort, { suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {}) }); +} +export class FacetModel extends ModelWithField { + constructor(spec, parent, parentGivenName, config) { + super(spec, 'facet', parent, parentGivenName, config, spec.resolve); + this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config); + this.children = [this.child]; + this.facet = this.initFacet(spec.facet); + } + initFacet(facet) { + // clone to prevent side effect to the original spec + if (!isFacetMapping(facet)) { + return { facet: this.initFacetFieldDef(facet, 'facet') }; + } + const channels = keys(facet); + const normalizedFacet = {}; + for (const channel of channels) { + if (![ROW, COLUMN].includes(channel)) { + // Drop unsupported channel + log.warn(log.message.incompatibleChannel(channel, 'facet')); + break; + } + const fieldDef = facet[channel]; + if (fieldDef.field === undefined) { + log.warn(log.message.emptyFieldDef(fieldDef, channel)); + break; + } + normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel); + } + return normalizedFacet; + } + initFacetFieldDef(fieldDef, channel) { + // Cast because we call initFieldDef, which assumes general FieldDef. + // However, FacetFieldDef is a bit more constrained than the general FieldDef + const facetFieldDef = initFieldDef(fieldDef, channel); + if (facetFieldDef.header) { + facetFieldDef.header = replaceExprRef(facetFieldDef.header); + } + else if (facetFieldDef.header === null) { + facetFieldDef.header = null; + } + return facetFieldDef; + } + channelHasField(channel) { + return !!this.facet[channel]; + } + fieldDef(channel) { + return this.facet[channel]; + } + parseData() { + this.component.data = parseData(this); + this.child.parseData(); + } + parseLayoutSize() { + parseChildrenLayoutSize(this); + } + parseSelections() { + // As a facet has a single child, the selection components are the same. + // The child maintains its selections to assemble signals, which remain + // within its unit. + this.child.parseSelections(); + this.component.selection = this.child.component.selection; + } + parseMarkGroup() { + this.child.parseMarkGroup(); + } + parseAxesAndHeaders() { + this.child.parseAxesAndHeaders(); + parseFacetHeaders(this); + } + assembleSelectionTopLevelSignals(signals) { + return this.child.assembleSelectionTopLevelSignals(signals); + } + assembleSignals() { + this.child.assembleSignals(); + return []; + } + assembleSelectionData(data) { + return this.child.assembleSelectionData(data); + } + getHeaderLayoutMixins() { + const layoutMixins = {}; + for (const channel of FACET_CHANNELS) { + for (const headerType of HEADER_TYPES) { + const layoutHeaderComponent = this.component.layoutHeaders[channel]; + const headerComponent = layoutHeaderComponent[headerType]; + const { facetFieldDef } = layoutHeaderComponent; + if (facetFieldDef) { + const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel); + if (['right', 'bottom'].includes(titleOrient)) { + const headerChannel = getHeaderChannel(channel, titleOrient); + layoutMixins.titleAnchor ?? (layoutMixins.titleAnchor = {}); + layoutMixins.titleAnchor[headerChannel] = 'end'; + } + } + if (headerComponent?.[0]) { + // set header/footerBand + const sizeType = channel === 'row' ? 'height' : 'width'; + const bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; + if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { + // If facet child does not have size signal, then apply headerBand + layoutMixins[bandType] ?? (layoutMixins[bandType] = {}); + layoutMixins[bandType][channel] = 0.5; + } + if (layoutHeaderComponent.title) { + layoutMixins.offset ?? (layoutMixins.offset = {}); + layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; + } + } + } + } + return layoutMixins; + } + assembleDefaultLayout() { + const { column, row } = this.facet; + const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; + let align = 'all'; + // Do not align the cells if the scale corresponding to the direction is indepent. + // We always align when we facet into both row and column. + if (!row && this.component.resolve.scale.x === 'independent') { + align = 'none'; + } + else if (!column && this.component.resolve.scale.y === 'independent') { + align = 'none'; + } + return { + ...this.getHeaderLayoutMixins(), + ...(columns ? { columns } : {}), + bounds: 'full', + align + }; + } + assembleLayoutSignals() { + // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. + return this.child.assembleLayoutSignals(); + } + columnDistinctSignal() { + if (this.parent && this.parent instanceof FacetModel) { + // For nested facet, we will add columns to group mark instead + // See discussion in https://github.com/vega/vega/issues/952 + // and https://github.com/vega/vega-view/releases/tag/v1.2.6 + return undefined; + } + else { + // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. + const facetLayoutDataName = this.getName('column_domain'); + return { signal: `length(data('${facetLayoutDataName}'))` }; + } + } + assembleGroupStyle() { + return undefined; + } + assembleGroup(signals) { + if (this.parent && this.parent instanceof FacetModel) { + // Provide number of columns for layout. + // See discussion in https://github.com/vega/vega/issues/952 + // and https://github.com/vega/vega-view/releases/tag/v1.2.6 + return { + ...(this.channelHasField('column') + ? { + encode: { + update: { + // TODO(https://github.com/vega/vega-lite/issues/2759): + // Correct the signal for facet of concat of facet_column + columns: { field: vgField(this.facet.column, { prefix: 'distinct' }) } + } + } + } + : {}), + ...super.assembleGroup(signals) + }; + } + return super.assembleGroup(signals); + } + /** + * Aggregate cardinality for calculating size + */ + getCardinalityAggregateForChild() { + const fields = []; + const ops = []; + const as = []; + if (this.child instanceof FacetModel) { + if (this.child.channelHasField('column')) { + const field = vgField(this.child.facet.column); + fields.push(field); + ops.push('distinct'); + as.push(`distinct_${field}`); + } + } + else { + for (const channel of POSITION_SCALE_CHANNELS) { + const childScaleComponent = this.child.component.scales[channel]; + if (childScaleComponent && !childScaleComponent.merged) { + const type = childScaleComponent.get('type'); + const range = childScaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const domain = assembleDomain(this.child, channel); + const field = getFieldFromDomain(domain); + if (field) { + fields.push(field); + ops.push('distinct'); + as.push(`distinct_${field}`); + } + else { + log.warn(log.message.unknownField(channel)); + } + } + } + } + } + return { fields, ops, as }; + } + assembleFacet() { + const { name, data } = this.component.data.facetRoot; + const { row, column } = this.facet; + const { fields, ops, as } = this.getCardinalityAggregateForChild(); + const groupby = []; + for (const channel of FACET_CHANNELS) { + const fieldDef = this.facet[channel]; + if (fieldDef) { + groupby.push(vgField(fieldDef)); + const { bin, sort } = fieldDef; + if (isBinning(bin)) { + groupby.push(vgField(fieldDef, { binSuffix: 'end' })); + } + if (isSortField(sort)) { + const { field, op = DEFAULT_SORT_OP } = sort; + const outputName = facetSortFieldName(fieldDef, sort); + if (row && column) { + // For crossed facet, use pre-calculate field as it requires a different groupby + // For each calculated field, apply max and assign them to the same name as + // all values of the same group should be the same anyway. + fields.push(outputName); + ops.push('max'); + as.push(outputName); + } + else { + fields.push(field); + ops.push(op); + as.push(outputName); + } + } + else if (isArray(sort)) { + const outputName = sortArrayIndexField(fieldDef, channel); + fields.push(outputName); + ops.push('max'); + as.push(outputName); + } + } + } + const cross = !!row && !!column; + return { + name, + data, + groupby, + ...(cross || fields.length > 0 + ? { + aggregate: { + ...(cross ? { cross } : {}), + ...(fields.length ? { fields, ops, as } : {}) + } + } + : {}) + }; + } + facetSortFields(channel) { + const { facet } = this; + const fieldDef = facet[channel]; + if (fieldDef) { + if (isSortField(fieldDef.sort)) { + return [facetSortFieldName(fieldDef, fieldDef.sort, { expr: 'datum' })]; + } + else if (isArray(fieldDef.sort)) { + return [sortArrayIndexField(fieldDef, channel, { expr: 'datum' })]; + } + return [vgField(fieldDef, { expr: 'datum' })]; + } + return []; + } + facetSortOrder(channel) { + const { facet } = this; + const fieldDef = facet[channel]; + if (fieldDef) { + const { sort } = fieldDef; + const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending'; + return [order]; + } + return []; + } + assembleLabelTitle() { + const { facet, config } = this; + if (facet.facet) { + // Facet always uses title to display labels + return assembleLabelTitle(facet.facet, 'facet', config); + } + const ORTHOGONAL_ORIENT = { + row: ['top', 'bottom'], + column: ['left', 'right'] + }; + for (const channel of HEADER_CHANNELS) { + if (facet[channel]) { + const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel); + if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) { + // Row/Column with orthogonal labelOrient must use title to display labels + return assembleLabelTitle(facet[channel], channel, config); + } + } + } + return undefined; + } + assembleMarks() { + const { child } = this; + // If we facet by two dimensions, we need to add a cross operator to the aggregation + // so that we create all groups + const facetRoot = this.component.data.facetRoot; + const data = assembleFacetData(facetRoot); + const encodeEntry = child.assembleGroupEncodeEntry(false); + const title = this.assembleLabelTitle() || child.assembleTitle(); + const style = child.assembleGroupStyle(); + const markGroup = { + name: this.getName('cell'), + type: 'group', + ...(title ? { title } : {}), + ...(style ? { style } : {}), + from: { + facet: this.assembleFacet() + }, + // TODO: move this to after data + sort: { + field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(), + order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat() + }, + ...(data.length > 0 ? { data } : {}), + ...(encodeEntry ? { encode: { update: encodeEntry } } : {}), + ...child.assembleGroup(assembleFacetSignals(this, [])) + }; + return [markGroup]; + } + getMapping() { + return this.facet; + } +} +//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/build/src/compile/facet.js.map b/build/src/compile/facet.js.map new file mode 100644 index 0000000000..f8a31ce629 --- /dev/null +++ b/build/src/compile/facet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../src/compile/facet.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,MAAM,EAAiC,cAAc,EAAE,uBAAuB,EAAE,GAAG,EAAC,MAAM,YAAY,CAAC;AAC/G,OAAO,EAA4B,YAAY,EAAiB,OAAO,EAAC,MAAM,eAAe,CAAC;AAE9F,OAAO,EAAU,cAAc,EAAC,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,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CAAC;YAC1B,IAAI,EAAE,OAAO;YACb,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACzB,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACzB,IAAI,EAAE;gBACJ,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE;aAC5B;YACD,gCAAgC;YAChC,IAAI,EAAE;gBACJ,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBAC9D,KAAK,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;aAC9D;YACD,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAClC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,EAAC,MAAM,EAAE,WAAW,EAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YACvD,GAAG,KAAK,CAAC,aAAa,CAAC,oBAAoB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;SACvD,CAAC;QAEF,OAAO,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,KAAK,CAAC;IACpB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/format.d.ts b/build/src/compile/format.d.ts new file mode 100644 index 0000000000..5c3130a878 --- /dev/null +++ b/build/src/compile/format.d.ts @@ -0,0 +1,67 @@ +import type { SignalRef } from 'vega'; +import { DatumDef, FieldDef } from '../channeldef'; +import { Config } from '../config'; +import { ScaleType } from '../scale'; +import { Type } from '../type'; +import { Dict } from '../util'; +import { TimeUnit } from './../timeunit'; +export declare function isCustomFormatType(formatType: string): boolean; +export declare const BIN_RANGE_DELIMITER = " \u2013 "; +export declare function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }: { + fieldOrDatumDef: FieldDef | DatumDef; + format: string | Dict; + formatType: string; + expr?: 'datum' | 'parent' | 'datum.datum'; + normalizeStack?: boolean; + config: Config; +}): { + signal: string; +}; +export declare function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }: { + fieldOrDatumDef: FieldDef | DatumDef; + format: string | Dict; + formatType: string; + expr?: 'datum' | 'parent' | 'datum.datum'; + normalizeStack?: boolean; + config: Config; + field?: string; +}): { + signal: string; +}; +export declare function guideFormat(fieldOrDatumDef: FieldDef | DatumDef, type: Type, format: string | Dict, formatType: string | SignalRef, config: Config, omitTimeFormatConfig: boolean): string | { + signal: string; +}; +export declare function guideFormatType(formatType: string | SignalRef, fieldOrDatumDef: FieldDef | DatumDef, scaleType: ScaleType): "time" | "number" | SignalRef | "utc"; +/** + * Returns number format for a fieldDef. + */ +export declare function numberFormat({ type, specifiedFormat, config, normalizeStack }: { + type: Type; + specifiedFormat?: string | Dict; + config: Config; + normalizeStack?: boolean; +}): string; +/** + * Returns time format for a fieldDef for use in guides. + */ +export declare function timeFormat({ specifiedFormat, timeUnit, config, omitTimeFormatConfig }: { + specifiedFormat?: string; + timeUnit?: TimeUnit; + config: Config; + omitTimeFormatConfig?: boolean; +}): string | { + signal: string; +}; +export declare function binFormatExpression(startField: string, endField: string, format: string | Dict, formatType: string, config: Config): string; +/** + * Returns the time expression used for axis/legend labels or text mark for a temporal field + */ +export declare function timeFormatExpression({ field, timeUnit, format, formatType, rawTimeFormat, isUTCScale }: { + field: string; + timeUnit?: TimeUnit; + format?: string | Dict; + formatType?: string; + rawTimeFormat?: string; + isUTCScale?: boolean; +}): string; +//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/build/src/compile/format.d.ts.map b/build/src/compile/format.d.ts.map new file mode 100644 index 0000000000..a969c4ddfb --- /dev/null +++ b/build/src/compile/format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/compile/format.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAGpC,OAAO,EAEL,QAAQ,EACR,QAAQ,EAMT,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAe,IAAI,EAAC,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAY,MAAM,SAAS,CAAC;AAExC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAGvC,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,MAAM,WAEpD;AAMD,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAE9C,wBAAgB,eAAe,CAAC,EAC9B,eAAe,EACf,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,MAAM,EACP,EAAE;IACD,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,aAAa,CAAC;IAC1C,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;CAChB;;EA2EA;AAqBD,wBAAgB,gBAAgB,CAAC,EAC/B,eAAe,EACf,MAAM,EACN,UAAU,EACV,IAAI,EACJ,cAAc,EACd,MAAM,EACN,KAAK,EACN,EAAE;IACD,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,QAAQ,C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C;;EAYA;AAcD,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,EAC9B,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,MAAM,GACb,MAAM,CAOR;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,KAAK,EACL,QAAQ,EACR,MAAM,EACN,UAAU,EACV,aAAa,EACb,UAAU,EACX,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB,GAAG,MAAM,CAWT"} \ No newline at end of file diff --git a/build/src/compile/format.js b/build/src/compile/format.js new file mode 100644 index 0000000000..64314e89c0 --- /dev/null +++ b/build/src/compile/format.js @@ -0,0 +1,223 @@ +import { isString } from 'vega-util'; +import { isBinning } from '../bin'; +import { channelDefType, isFieldDef, isFieldOrDatumDefForTimeFormat, isPositionFieldOrDatumDef, isScaleFieldDef, vgField } from '../channeldef'; +import { fieldValidPredicate } from '../predicate'; +import { ScaleType } from '../scale'; +import { formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression } from '../timeunit'; +import { QUANTITATIVE } from '../type'; +import { stringify } from '../util'; +import { isSignalRef } from '../vega.schema'; +import { datumDefToExpr } from './mark/encode/valueref'; +export function isCustomFormatType(formatType) { + return formatType && formatType !== 'number' && formatType !== 'time'; +} +function customFormatExpr(formatType, field, format) { + return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`; +} +export const BIN_RANGE_DELIMITER = ' \u2013 '; +export function formatSignalRef({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config }) { + if (isCustomFormatType(formatType)) { + return formatCustomType({ + fieldOrDatumDef, + format, + formatType, + expr, + config + }); + } + const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); + const type = channelDefType(fieldOrDatumDef); + if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (type === 'quantitative') { + if (normalizeStack && config.normalizedNumberFormatType) + return formatCustomType({ + fieldOrDatumDef, + format: config.normalizedNumberFormat, + formatType: config.normalizedNumberFormatType, + expr, + config + }); + if (config.numberFormatType) { + return formatCustomType({ + fieldOrDatumDef, + format: config.numberFormat, + formatType: config.numberFormatType, + expr, + config + }); + } + } + if (type === 'temporal' && + config.timeFormatType && + isFieldDef(fieldOrDatumDef) && + fieldOrDatumDef.timeUnit === undefined) { + return formatCustomType({ + fieldOrDatumDef, + format: config.timeFormat, + formatType: config.timeFormatType, + expr, + config + }); + } + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { + const signal = timeFormatExpression({ + field, + timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined, + format, + formatType: config.timeFormatType, + rawTimeFormat: config.timeFormat, + isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC + }); + return signal ? { signal } : undefined; + } + format = numberFormat({ type, specifiedFormat: format, config, normalizeStack }); + if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { + const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); + return { + signal: binFormatExpression(field, endField, format, formatType, config) + }; + } + else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { + return { + signal: `${formatExpr(field, format)}` + }; + } + else { + return { signal: `isValid(${field}) ? ${field} : ""+${field}` }; + } +} +function fieldToFormat(fieldOrDatumDef, expr, normalizeStack) { + if (isFieldDef(fieldOrDatumDef)) { + if (normalizeStack) { + return `${vgField(fieldOrDatumDef, { expr, suffix: 'end' })}-${vgField(fieldOrDatumDef, { + expr, + suffix: 'start' + })}`; + } + else { + return vgField(fieldOrDatumDef, { expr }); + } + } + else { + return datumDefToExpr(fieldOrDatumDef); + } +} +export function formatCustomType({ fieldOrDatumDef, format, formatType, expr, normalizeStack, config, field }) { + field ?? (field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack)); + if (field !== 'datum.value' && // For axis/legend, we can't correctly know the end of the bin from `datum` + isFieldDef(fieldOrDatumDef) && + isBinning(fieldOrDatumDef.bin)) { + const endField = vgField(fieldOrDatumDef, { expr, binSuffix: 'end' }); + return { + signal: binFormatExpression(field, endField, format, formatType, config) + }; + } + return { signal: customFormatExpr(formatType, field, format) }; +} +export function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig // axis doesn't use config.timeFormat +) { + if (isString(formatType) && isCustomFormatType(formatType)) { + return undefined; // handled in encode block + } + else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (channelDefType(fieldOrDatumDef) === 'quantitative') { + if (config.normalizedNumberFormatType && + isPositionFieldOrDatumDef(fieldOrDatumDef) && + fieldOrDatumDef.stack === 'normalize') { + return undefined; // handled in encode block + } + if (config.numberFormatType) { + return undefined; // handled in encode block + } + } + } + if (isPositionFieldOrDatumDef(fieldOrDatumDef) && + fieldOrDatumDef.stack === 'normalize' && + config.normalizedNumberFormat) { + return numberFormat({ + type: 'quantitative', + config, + normalizeStack: true + }); + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { + const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; + if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) { + return undefined; // hanlded in encode block + } + return timeFormat({ specifiedFormat: format, timeUnit, config, omitTimeFormatConfig }); + } + return numberFormat({ type, specifiedFormat: format, config }); +} +export function guideFormatType(formatType, fieldOrDatumDef, scaleType) { + if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { + return formatType; + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { + return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time'; + } + return undefined; +} +/** + * Returns number format for a fieldDef. + */ +export function numberFormat({ type, specifiedFormat, config, normalizeStack }) { + // Specified format in axis/legend has higher precedence than fieldDef.format + if (isString(specifiedFormat)) { + return specifiedFormat; + } + if (type === QUANTITATIVE) { + // we only apply the default if the field is quantitative + return normalizeStack ? config.normalizedNumberFormat : config.numberFormat; + } + return undefined; +} +/** + * Returns time format for a fieldDef for use in guides. + */ +export function timeFormat({ specifiedFormat, timeUnit, config, omitTimeFormatConfig }) { + if (specifiedFormat) { + return specifiedFormat; + } + if (timeUnit) { + return { + signal: timeUnitSpecifierExpression(timeUnit) + }; + } + return omitTimeFormatConfig ? undefined : config.timeFormat; +} +function formatExpr(field, format) { + return `format(${field}, "${format || ''}")`; +} +function binNumberFormatExpr(field, format, formatType, config) { + if (isCustomFormatType(formatType)) { + return customFormatExpr(formatType, field, format); + } + return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat); +} +export function binFormatExpression(startField, endField, format, formatType, config) { + if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) { + return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config); + } + const start = binNumberFormatExpr(startField, format, formatType, config); + const end = binNumberFormatExpr(endField, format, formatType, config); + return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`; +} +/** + * Returns the time expression used for axis/legend labels or text mark for a temporal field + */ +export function timeFormatExpression({ field, timeUnit, format, formatType, rawTimeFormat, isUTCScale }) { + if (!timeUnit || format) { + // If there is no time unit, or if user explicitly specifies format for axis/legend/text. + if (!timeUnit && formatType) { + return `${formatType}(${field}, '${format}')`; + } + format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. + return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`; + } + else { + return formatExpression(timeUnit, field, isUTCScale); + } +} +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/build/src/compile/format.js.map b/build/src/compile/format.js.map new file mode 100644 index 0000000000..2de0b875dc --- /dev/null +++ b/build/src/compile/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/compile/format.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EACL,cAAc,EAGd,UAAU,EACV,8BAA8B,EAC9B,yBAAyB,EACzB,eAAe,EACf,OAAO,EACR,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AACjD,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,gBAAgB,EAAE,iBAAiB,EAAE,2BAA2B,EAAC,MAAM,aAAa,CAAC;AAC7F,OAAO,EAAC,YAAY,EAAO,MAAM,SAAS,CAAC;AAC3C,OAAO,EAAO,SAAS,EAAC,MAAM,SAAS,CAAC;AACxC,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,cAAc,EAAC,MAAM,wBAAwB,CAAC;AAEtD,MAAM,UAAU,kBAAkB,CAAC,UAAkB;IACnD,OAAO,UAAU,IAAI,UAAU,KAAK,QAAQ,IAAI,UAAU,KAAK,MAAM,CAAC;AACxE,CAAC;AAED,SAAS,gBAAgB,CAAC,UAAkB,EAAE,KAAa,EAAE,MAA8B;IACzF,OAAO,GAAG,UAAU,IAAI,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,KAAK,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC;AAC5E,CAAC;AAED,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC;AAE9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,IAAI,MAAM,EAAE;QACvB,yFAAyF;QACzF,IAAI,CAAC,QAAQ,IAAI,UAAU,EAAE;YAC3B,OAAO,GAAG,UAAU,IAAI,KAAK,MAAM,MAAM,IAAI,CAAC;SAC/C;QACD,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,wDAAwD;QAC5G,OAAO,GAAG,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,UAAU,KAAK,MAAM,MAAM,IAAI,CAAC;KACtE;SAAM;QACL,OAAO,gBAAgB,CAAC,QAAQ,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC;KACtD;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/guide.d.ts b/build/src/compile/guide.d.ts new file mode 100644 index 0000000000..155be9c8dc --- /dev/null +++ b/build/src/compile/guide.d.ts @@ -0,0 +1,4 @@ +import { GuideEncodingEntry } from '../guide'; +import { UnitModel } from './unit'; +export declare function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel): {}; +//# sourceMappingURL=guide.d.ts.map \ No newline at end of file diff --git a/build/src/compile/guide.d.ts.map b/build/src/compile/guide.d.ts.map new file mode 100644 index 0000000000..20433846c8 --- /dev/null +++ b/build/src/compile/guide.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../../src/compile/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,kBAAkB,EAAC,MAAM,UAAU,CAAC;AAK5C,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AAEjC,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,kBAAkB,EAAE,KAAK,EAAE,SAAS,MAQ9E"} \ No newline at end of file diff --git a/build/src/compile/guide.js b/build/src/compile/guide.js new file mode 100644 index 0000000000..627b45ba53 --- /dev/null +++ b/build/src/compile/guide.js @@ -0,0 +1,13 @@ +import { keys } from '../util'; +import { signalOrValueRef } from './common'; +import { wrapCondition } from './mark/encode'; +export function guideEncodeEntry(encoding, model) { + return keys(encoding).reduce((encode, channel) => { + const valueDef = encoding[channel]; + return { + ...encode, + ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value)) + }; + }, {}); +} +//# sourceMappingURL=guide.js.map \ No newline at end of file diff --git a/build/src/compile/guide.js.map b/build/src/compile/guide.js.map new file mode 100644 index 0000000000..4add06b3e8 --- /dev/null +++ b/build/src/compile/guide.js.map @@ -0,0 +1 @@ +{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../../src/compile/guide.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAG5C,MAAM,UAAU,gBAAgB,CAAC,QAA4B,EAAE,KAAgB;IAC7E,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,OAAwB,EAAE,EAAE;QAChE,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;QACnC,OAAO;YACL,GAAG,MAAM;YACT,GAAG,aAAa,CAAC,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC,gBAAgB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SAC/E,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"} \ No newline at end of file diff --git a/build/src/compile/header/assemble.d.ts b/build/src/compile/header/assemble.d.ts new file mode 100644 index 0000000000..b441c0c588 --- /dev/null +++ b/build/src/compile/header/assemble.d.ts @@ -0,0 +1,1027 @@ +/** + * Utility for generating row / column headers + */ +import { SignalRef, TitleAnchor, TitleConfig } from 'vega'; +import { FacetChannel } from '../../channel'; +import { Config } from '../../config'; +import { CoreHeader } from '../../header'; +import { FacetFieldDef } from '../../spec/facet'; +import { RowCol, VgComparator, VgMarkGroup, VgTitle } from '../../vega.schema'; +import { Model } from '../model'; +import { HeaderChannel, HeaderComponent, HeaderType, LayoutHeaderComponent, LayoutHeaderComponentIndex } from './component'; +export declare function assembleTitleGroup(model: Model, channel: FacetChannel): { + name: string; + type: string; + role: string; + title: { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: "center" | "left" | "right" | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: "center" | "left" | "right" | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame?: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + field: import("vega").Field; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + }; +}; +export declare function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor?: TitleAnchor): { + align: string; +} | { + align: SignalRef | import("vega").Align; +} | { + align?: undefined; +}; +export declare function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel): { + baseline: string | { + signal: string; + }; +} | { + baseline?: undefined; +}; +export declare function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[]; +export declare function assembleLabelTitle(facetFieldDef: FacetFieldDef, channel: FacetChannel, config: Config): { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +} | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: "center" | "left" | "right" | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +} | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +} | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +} | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: "center" | "left" | "right" | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +} | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; +}; +export declare function assembleHeaderGroup(model: Model, channel: HeaderChannel, headerType: HeaderType, layoutHeader: LayoutHeaderComponent, headerComponent: HeaderComponent): { + axes?: import("vega").Axis[]; + encode?: { + update: { + [x: string]: { + signal: string; + }; + }; + }; + title?: { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").TextBaseline; + }; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: import("vega").Align; + }; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + } | { + text: SignalRef | import("vega").Text; + subtitle?: SignalRef | import("vega").Text; + name?: string; + interactive?: boolean; + style: string | string[]; + encode?: import("vega").TitleEncode | Partial>; + anchor?: import("vega").AnchorValue; + frame: string | SignalRef | { + field: import("vega").Field; + } | { + scale: import("vega").Field; + value: string | number | boolean; + } | { + scale: import("vega").Field; + band: number | boolean; + } | { + scale: import("vega").Field; + range: number | boolean; + } | { + value: string; + }; + offset?: import("vega").NumberValue; + orient?: string | SignalRef; + aria?: boolean; + align?: import("vega").AlignValue; + angle?: import("vega").NumberValue; + baseline?: import("vega").TextBaselineValue; + dx?: import("vega").NumberValue; + dy?: import("vega").NumberValue; + limit?: import("vega").NumberValue; + color?: import("vega").ColorValue; + font?: import("vega").StringValue; + fontSize?: import("vega").NumberValue; + fontStyle?: import("vega").FontStyleValue; + fontWeight?: import("vega").FontWeightValue; + lineHeight?: import("vega").NumberValue; + subtitleColor?: import("vega").ColorValue; + subtitleFont?: import("vega").StringValue; + subtitleFontSize?: import("vega").NumberValue; + subtitleFontStyle?: import("vega").FontStyleValue; + subtitleFontWeight?: import("vega").FontWeightValue; + subtitleLineHeight?: import("vega").NumberValue; + subtitlePadding?: import("vega").NumberValue; + zindex?: number; + }; + from?: { + data: string; + }; + sort?: VgComparator; + name: string; + type: string; + role: string; +}; +export declare function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel): any; +export declare function assembleLayoutTitleBand(headerComponentIndex: LayoutHeaderComponentIndex, config: Config): RowCol; +export declare function assembleHeaderProperties(config: Config, facetFieldDef: FacetFieldDef, channel: FacetChannel, properties: (keyof CoreHeader)[], propertiesMap: Partial, keyof TitleConfig>>): Partial; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/header/assemble.d.ts.map b/build/src/compile/header/assemble.d.ts.map new file mode 100644 index 0000000000..2d7d9c1032 --- /dev/null +++ b/build/src/compile/header/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/assemble.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAC,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE3D,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EACL,UAAU,EAKX,MAAM,cAA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C,MAAM,EAAE,SAAS,CAAC,EAC/C,OAAO,EAAE,YAAY,EACrB,UAAU,EAAE,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,EAC3C,aAAa,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,WAAW,CAAC,CAAC,GAC7E,OAAO,CAAC,OAAO,CAAC,CAalB"} \ No newline at end of file diff --git a/build/src/compile/header/assemble.js b/build/src/compile/header/assemble.js new file mode 100644 index 0000000000..4a206dd21e --- /dev/null +++ b/build/src/compile/header/assemble.js @@ -0,0 +1,205 @@ +/** + * Utility for generating row / column headers + */ +import { isArray } from 'vega-util'; +import { FACET_CHANNELS } from '../../channel'; +import { vgField } from '../../channeldef'; +import { HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP } from '../../header'; +import { isSortField } from '../../sort'; +import { isFacetMapping } from '../../spec/facet'; +import { contains, isEmpty, normalizeAngle, replaceAll } from '../../util'; +import { defaultLabelAlign, defaultLabelBaseline } from '../axis/properties'; +import { sortArrayIndexField } from '../data/calculate'; +import { formatSignalRef } from '../format'; +import { isFacetModel } from '../model'; +import { getHeaderChannel, getHeaderProperties, getHeaderProperty } from './common'; +import { HEADER_TYPES } from './component'; +// TODO: rename to assembleHeaderTitleGroup +export function assembleTitleGroup(model, channel) { + const title = model.component.layoutHeaders[channel].title; + const config = model.config ? model.config : undefined; + const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef + ? model.component.layoutHeaders[channel].facetFieldDef + : undefined; + const { titleAnchor, titleAngle: ta, titleOrient } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel); + const headerChannel = getHeaderChannel(channel, titleOrient); + const titleAngle = normalizeAngle(ta); + return { + name: `${channel}-title`, + type: 'group', + role: `${headerChannel}-title`, + title: { + text: title, + ...(channel === 'row' ? { orient: 'left' } : {}), + style: 'guide-title', + ...defaultHeaderGuideBaseline(titleAngle, headerChannel), + ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor), + ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP) + } + }; +} +export function defaultHeaderGuideAlign(headerChannel, angle, anchor = 'middle') { + switch (anchor) { + case 'start': + return { align: 'left' }; + case 'end': + return { align: 'right' }; + } + const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); + return align ? { align } : {}; +} +export function defaultHeaderGuideBaseline(angle, channel) { + const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); + return baseline ? { baseline } : {}; +} +export function assembleHeaderGroups(model, channel) { + const layoutHeader = model.component.layoutHeaders[channel]; + const groups = []; + for (const headerType of HEADER_TYPES) { + if (layoutHeader[headerType]) { + for (const headerComponent of layoutHeader[headerType]) { + const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); + if (group != null) { + groups.push(group); + } + } + } + } + return groups; +} +function getSort(facetFieldDef, channel) { + const { sort } = facetFieldDef; + if (isSortField(sort)) { + return { + field: vgField(sort, { expr: 'datum' }), + order: sort.order ?? 'ascending' + }; + } + else if (isArray(sort)) { + return { + field: sortArrayIndexField(facetFieldDef, channel, { expr: 'datum' }), + order: 'ascending' + }; + } + else { + return { + field: vgField(facetFieldDef, { expr: 'datum' }), + order: sort ?? 'ascending' + }; + } +} +export function assembleLabelTitle(facetFieldDef, channel, config) { + const { format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef.header, config, channel); + const titleTextExpr = formatSignalRef({ + fieldOrDatumDef: facetFieldDef, + format, + formatType, + expr: 'parent', + config + }).signal; + const headerChannel = getHeaderChannel(channel, labelOrient); + return { + text: { + signal: labelExpr + ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { expr: 'parent' })) + : titleTextExpr + }, + ...(channel === 'row' ? { orient: 'left' } : {}), + style: 'guide-label', + frame: 'group', + ...defaultHeaderGuideBaseline(labelAngle, headerChannel), + ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor), + ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP) + }; +} +export function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) { + if (headerComponent) { + let title = null; + const { facetFieldDef } = layoutHeader; + const config = model.config ? model.config : undefined; + if (facetFieldDef && headerComponent.labels) { + const { labelOrient } = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel); + // Include label title in the header if orient aligns with the channel + if ((channel === 'row' && !contains(['top', 'bottom'], labelOrient)) || + (channel === 'column' && !contains(['left', 'right'], labelOrient))) { + title = assembleLabelTitle(facetFieldDef, channel, config); + } + } + const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); + const axes = headerComponent.axes; + const hasAxes = axes?.length > 0; + if (title || hasAxes) { + const sizeChannel = channel === 'row' ? 'height' : 'width'; + return { + name: model.getName(`${channel}_${headerType}`), + type: 'group', + role: `${channel}-${headerType}`, + ...(layoutHeader.facetFieldDef + ? { + from: { data: model.getName(`${channel}_domain`) }, + sort: getSort(facetFieldDef, channel) + } + : {}), + ...(hasAxes && isFacetWithoutRowCol + ? { + from: { data: model.getName(`facet_domain_${channel}`) } + } + : {}), + ...(title ? { title } : {}), + ...(headerComponent.sizeSignal + ? { + encode: { + update: { + [sizeChannel]: headerComponent.sizeSignal + } + } + } + : {}), + ...(hasAxes ? { axes } : {}) + }; + } + } + return null; +} +const LAYOUT_TITLE_BAND = { + column: { + start: 0, + end: 1 + }, + row: { + start: 1, + end: 0 + } +}; +export function getLayoutTitleBand(titleAnchor, headerChannel) { + return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; +} +export function assembleLayoutTitleBand(headerComponentIndex, config) { + const titleBand = {}; + for (const channel of FACET_CHANNELS) { + const headerComponent = headerComponentIndex[channel]; + if (headerComponent?.facetFieldDef) { + const { titleAnchor, titleOrient } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef.header, config, channel); + const headerChannel = getHeaderChannel(channel, titleOrient); + const band = getLayoutTitleBand(titleAnchor, headerChannel); + if (band !== undefined) { + titleBand[headerChannel] = band; + } + } + } + return isEmpty(titleBand) ? undefined : titleBand; +} +export function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) { + const props = {}; + for (const prop of properties) { + if (!propertiesMap[prop]) { + continue; + } + const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel); + if (value !== undefined) { + props[propertiesMap[prop]] = value; + } + } + return props; +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/header/assemble.js.map b/build/src/compile/header/assemble.js.map new file mode 100644 index 0000000000..3b3953864b --- /dev/null +++ b/build/src/compile/header/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/header/assemble.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAe,cAAc,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,OAAO,EAAC,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAEL,uBAAuB,EACvB,2BAA2B,EAC3B,uBAAuB,EACvB,2BAA2B,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,WAAW,EAAC,MAAM,YAAY,CAAC;AACvC,OAAO,EAAgB,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AAEzE,OAA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a/build/src/compile/header/common.d.ts b/build/src/compile/header/common.d.ts new file mode 100644 index 0000000000..5312ac2fe7 --- /dev/null +++ b/build/src/compile/header/common.d.ts @@ -0,0 +1,12 @@ +import { Orient, SignalRef } from 'vega'; +import { FacetChannel } from '../../channel'; +import { Config } from '../../config'; +import { Header } from '../../header'; +import { HeaderChannel } from './component'; +/** + * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. + */ +export declare function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel; +export declare function getHeaderProperty

>(prop: P, header: Header, config: Config, channel: FacetChannel): Header[P]; +export declare function getHeaderProperties(properties: (keyof Header)[], header: Header, config: Config, channel: FacetChannel): Header; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/build/src/compile/header/common.d.ts.map b/build/src/compile/header/common.d.ts.map new file mode 100644 index 0000000000..7c035ff6f8 --- /dev/null +++ b/build/src/compile/header/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAE1C;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,GAAG,aAAa,CAOrF;AAED,wBAAgB,iBAAiB,CAAC,CAAC,SAAS,MAAM,MAAM,CAAC,SAAS,CAAC,EACjE,IAAI,EAAE,CAAC,EACP,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,OAAO,EAAE,YAAY,GACpB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAKtB;AAED,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,CAAC,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,EACvC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,OAAO,EAAE,YAAY,GACpB,MAAM,CAAC,SAAS,CAAC,CASnB"} \ No newline at end of file diff --git a/build/src/compile/header/common.js b/build/src/compile/header/common.js new file mode 100644 index 0000000000..5437603442 --- /dev/null +++ b/build/src/compile/header/common.js @@ -0,0 +1,28 @@ +import { contains, getFirstDefined } from '../../util'; +/** + * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. + */ +export function getHeaderChannel(channel, orient) { + if (contains(['top', 'bottom'], orient)) { + return 'column'; + } + else if (contains(['left', 'right'], orient)) { + return 'row'; + } + return channel === 'row' ? 'row' : 'column'; +} +export function getHeaderProperty(prop, header, config, channel) { + const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; + return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]); +} +export function getHeaderProperties(properties, header, config, channel) { + const props = {}; + for (const prop of properties) { + const value = getHeaderProperty(prop, header || {}, config, channel); + if (value !== undefined) { + props[prop] = value; + } + } + return props; +} +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/build/src/compile/header/common.js.map b/build/src/compile/header/common.js.map new file mode 100644 index 0000000000..ef058df3d9 --- /dev/null +++ b/build/src/compile/header/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../../src/compile/header/common.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AAGrD;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,OAAqB,EAAE,MAAc;IACpE,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,EAAE;QACvC,OAAO,QAAQ,CAAC;KACjB;SAAM,IAAI,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,EAAE;QAC9C,OAAO,KAAK,CAAC;KACd;IACD,OAAO,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,IAAO,EACP,MAAyB,EACzB,MAAyB,EACzB,OAAqB;IAErB,MAAM,oBAAoB,GACxB,OAAO,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,WAAW,CAAC;IAEzG,OAAO,eAAe,CAAC,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC;AAChG,CAAC;AAED,MAAM,UAAU,mBAAmB,CACjC,UAAuC,EACvC,MAAyB,EACzB,MAAyB,EACzB,OAAqB;IAErB,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,KAAK,MAAM,IAAI,IAAI,UAAU,EAAE;QAC7B,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;QACrE,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;SACrB;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/build/src/compile/header/component.d.ts b/build/src/compile/header/component.d.ts new file mode 100644 index 0000000000..60646e0b41 --- /dev/null +++ b/build/src/compile/header/component.d.ts @@ -0,0 +1,44 @@ +/** + * Utility for generating row / column headers + */ +import { Axis as VgAxis, SignalRef, Text } from 'vega'; +import { FacetFieldDef } from '../../spec/facet'; +export type HeaderChannel = 'row' | 'column'; +export declare const HEADER_CHANNELS: HeaderChannel[]; +export type HeaderType = 'header' | 'footer'; +export declare const HEADER_TYPES: HeaderType[]; +export interface LayoutHeaderComponentIndex { + row?: LayoutHeaderComponent; + column?: LayoutHeaderComponent; + facet?: LayoutHeaderComponent; +} +/** + * A component that represents all header, footers and title of a Vega group with layout directive. + */ +export interface LayoutHeaderComponent { + title?: Text | SignalRef; + facetFieldDef?: FacetFieldDef; + /** + * An array of header components for headers. + * For facet, there should be only one header component, which is data-driven. + * For concat, there can be multiple header components that explicitly list different axes. + */ + header?: HeaderComponent[]; + /** + * An array of header components for footers. + * For facet, there should be only one header component, which is data-driven. + * For concat, there can be multiple header components that explicitly list different axes. + */ + footer?: HeaderComponent[]; +} +/** + * A component that represents one group of row/column-header/footer. + */ +export interface HeaderComponent { + labels: boolean; + sizeSignal: { + signal: string; + }; + axes: VgAxis[]; +} +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/header/component.d.ts.map b/build/src/compile/header/component.d.ts.map new file mode 100644 index 0000000000..679b439cfa --- /dev/null +++ b/build/src/compile/header/component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/component.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,IAAI,IAAI,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/C,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,QAAQ,CAAC;AAC7C,eAAO,MAAM,eAAe,EAAE,aAAa,EAAsB,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,QAAQ,CAAC;AAC7C,eAAO,MAAM,YAAY,EAAE,UAAU,EAAyB,CAAC;AAE/D,MAAM,WAAW,0BAA0B;IACzC,GAAG,CAAC,EAAE,qBAAqB,CAAC;IAC5B,MAAM,CAAC,EAAE,qBAAqB,CAAC;IAC/B,KAAK,CAAC,EAAE,qBAAqB,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;IAKzB,aAAa,CAAC,EAAE,aAAa,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;IAEjD;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;IAE3B;;;;OAIG;IACH,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,OAAO,CAAC;IAEhB,UAAU,EAAE;QAAC,MAAM,EAAE,MAAM,CAAA;KAAC,CAAC;IAE7B,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB"} \ No newline at end of file diff --git a/build/src/compile/header/component.js b/build/src/compile/header/component.js new file mode 100644 index 0000000000..61330523e0 --- /dev/null +++ b/build/src/compile/header/component.js @@ -0,0 +1,3 @@ +export const HEADER_CHANNELS = ['row', 'column']; +export const HEADER_TYPES = ['header', 'footer']; +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/header/component.js.map b/build/src/compile/header/component.js.map new file mode 100644 index 0000000000..1b340c8e94 --- /dev/null +++ b/build/src/compile/header/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/header/component.ts"],"names":[],"mappings":"AAOA,MAAM,CAAC,MAAM,eAAe,GAAoB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;AAGlE,MAAM,CAAC,MAAM,YAAY,GAAiB,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/header/parse.d.ts b/build/src/compile/header/parse.d.ts new file mode 100644 index 0000000000..c21e2c790f --- /dev/null +++ b/build/src/compile/header/parse.d.ts @@ -0,0 +1,5 @@ +import { AxisOrient, SignalRef } from 'vega'; +import { FacetModel } from '../facet'; +export declare function getHeaderType(orient: AxisOrient | SignalRef): "header" | "footer"; +export declare function parseFacetHeaders(model: FacetModel): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/header/parse.d.ts.map b/build/src/compile/header/parse.d.ts.map new file mode 100644 index 0000000000..04076d60be --- /dev/null +++ b/build/src/compile/header/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/header/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAO3C,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAKpC,wBAAgB,aAAa,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,uBAM3D;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,QAOlD"} \ No newline at end of file diff --git a/build/src/compile/header/parse.js b/build/src/compile/header/parse.js new file mode 100644 index 0000000000..37830cbb96 --- /dev/null +++ b/build/src/compile/header/parse.js @@ -0,0 +1,83 @@ +import { isArray } from 'vega-util'; +import { FACET_CHANNELS } from '../../channel'; +import { title as fieldDefTitle } from '../../channeldef'; +import { contains, getFirstDefined } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { assembleAxis } from '../axis/assemble'; +import { parseGuideResolve } from '../resolve'; +import { getHeaderProperty } from './common'; +export function getHeaderType(orient) { + if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { + // we always use header for orient signal since we can't dynamically make header becomes footer + return 'header'; + } + return 'footer'; +} +export function parseFacetHeaders(model) { + for (const channel of FACET_CHANNELS) { + parseFacetHeader(model, channel); + } + mergeChildAxis(model, 'x'); + mergeChildAxis(model, 'y'); +} +function parseFacetHeader(model, channel) { + const { facet, config, child, component } = model; + if (model.channelHasField(channel)) { + const fieldDef = facet[channel]; + const titleConfig = getHeaderProperty('title', null, config, channel); + let title = fieldDefTitle(fieldDef, config, { + allowDisabling: true, + includeDefault: titleConfig === undefined || !!titleConfig + }); + if (child.component.layoutHeaders[channel].title) { + // TODO: better handle multiline titles + title = isArray(title) ? title.join(', ') : title; + // merge title with child to produce "Title / Subtitle / Sub-subtitle" + title += ` / ${child.component.layoutHeaders[channel].title}`; + child.component.layoutHeaders[channel].title = null; + } + const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel); + const labels = fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false; + const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; + component.layoutHeaders[channel] = { + title: fieldDef.header !== null ? title : null, + facetFieldDef: fieldDef, + [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)] + }; + } +} +function makeHeaderComponent(model, channel, labels) { + const sizeType = channel === 'row' ? 'height' : 'width'; + return { + labels, + sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, + axes: [] + }; +} +function mergeChildAxis(model, channel) { + const { child } = model; + if (child.component.axes[channel]) { + const { layoutHeaders, resolve } = model.component; + resolve.axis[channel] = parseGuideResolve(resolve, channel); + if (resolve.axis[channel] === 'shared') { + // For shared axis, move the axes to facet's header or footer + const headerChannel = channel === 'x' ? 'column' : 'row'; + const layoutHeader = layoutHeaders[headerChannel]; + for (const axisComponent of child.component.axes[channel]) { + const headerType = getHeaderType(axisComponent.get('orient')); + layoutHeader[headerType] ?? (layoutHeader[headerType] = [makeHeaderComponent(model, headerChannel, false)]); + // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes + const mainAxis = assembleAxis(axisComponent, 'main', model.config, { header: true }); + if (mainAxis) { + // LayoutHeader no longer keep track of property precedence, thus let's combine. + layoutHeader[headerType][0].axes.push(mainAxis); + } + axisComponent.mainExtracted = true; + } + } + else { + // Otherwise do nothing for independent axes + } + } +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/header/parse.js.map b/build/src/compile/header/parse.js.map new file mode 100644 index 0000000000..cac44327ad --- /dev/null +++ b/build/src/compile/header/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/header/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAe,cAAc,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,KAAK,IAAI,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAC,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAC,iBAAiB,EAAC,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAG3C,MAAM,UAAU,aAAa,CAAC,MAA8B;IAC1D,IAAI,MAAM,KAAK,KAAK,IAAI,MAAM,KAAK,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,EAAE;QAChE,+FAA+F;QAC/F,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,KAAiB;IACjD,KAAK,MAAM,OAAO,IAAI,cAAc,EAAE;QACpC,gBAAgB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAClC;IAED,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC3B,cAAc,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAiB,EAAE,OAAqB;IAChE,MAAM,EAAC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YACtC,6DAA6D;YAC7D,MAAM,aAAa,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC;YAEzD,MAAM,YAAY,GAAG,aAAa,CAAC,aAAa,CAAC,CAAC;YAClD,KAAK,MAAM,aAAa,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE;gBACzD,MAAM,UAAU,GAAG,aAAa,CAAC,aAAa,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,CAAC;gBAC9D,YAAY,CAAC,UAAU,MAAvB,YAAY,CAAC,UAAU,IAAM,CAAC,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,KAAK,CAAC,CAAC,EAAC;gBAEhF,+GAA+G;gBAC/G,MAAM,QAAQ,GAAG,YAAY,CAAC,aAAa,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;gBACnF,IAAI,QAAQ,EAAE;oBACZ,gFAAgF;oBAChF,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;iBACjD;gBACD,aAAa,CAAC,aAAa,GAAG,IAAI,CAAC;aACpC;SACF;aAAM;YACL,4CAA4C;SAC7C;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/layer.d.ts b/build/src/compile/layer.d.ts new file mode 100644 index 0000000000..a2e199933d --- /dev/null +++ b/build/src/compile/layer.d.ts @@ -0,0 +1,24 @@ +import { Legend as VgLegend, NewSignal, SignalRef, Title as VgTitle } from 'vega'; +import { Config } from '../config'; +import { LayoutSizeMixins, NormalizedLayerSpec } from '../spec'; +import { VgData, VgLayout } from '../vega.schema'; +import { Model } from './model'; +export declare class LayerModel extends Model { + readonly children: Model[]; + constructor(spec: NormalizedLayerSpec, parent: Model, parentGivenName: string, parentGivenSize: LayoutSizeMixins, config: Config); + parseData(): void; + parseLayoutSize(): void; + parseSelections(): void; + parseMarkGroup(): void; + parseAxesAndHeaders(): void; + assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; + assembleSignals(): NewSignal[]; + assembleLayoutSignals(): NewSignal[]; + assembleSelectionData(data: readonly VgData[]): readonly VgData[]; + assembleGroupStyle(): string | string[]; + assembleTitle(): VgTitle; + assembleLayout(): VgLayout; + assembleMarks(): any[]; + assembleLegends(): VgLegend[]; +} +//# sourceMappingURL=layer.d.ts.map \ No newline at end of file diff --git a/build/src/compile/layer.d.ts.map b/build/src/compile/layer.d.ts.map new file mode 100644 index 0000000000..ba734083e1 --- /dev/null +++ b/build/src/compile/layer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/compile/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,IAAI,OAAO,EAAC,MAAM,MAAM,CAAC;AAEhF,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AAEjC,OAAO,EAA0B,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAEvF,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAOhD,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAI9B,qBAAa,UAAW,SAAQ,KAAK;IAGnC,SAAgB,QAAQ,EAAE,KAAK,EAAE,CAAC;gBAGhC,IAAI,EAAE,mBAAmB,EACzB,MAAM,EAAE,KAAK,EACb,eAAe,EAAE,MAAM,EACvB,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC;IAqBpB,SAAS;IAOT,eAAe;IAIf,eAAe;IAaf,cAAc;IAMd,mBAAmB;IAInB,gCAAgC,CAAC,OAAO,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE;IAKnE,eAAe,IAAI,SAAS,EAAE;IAM9B,qBAAqB,IAAI,SAAS,EAAE;IAMpC,qBAAqB,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,SAAS,MAAM,EAAE;IAIjE,kBAAkB,IAAI,MAAM,GAAG,MAAM,EAAE;IAWvC,aAAa,IAAI,OAAO;IAexB,cAAc,IAAI,QAAQ;IAI1B,aAAa,IAAI,GAAG,EAAE;IAStB,eAAe,IAAI,QAAQ,EAAE;CAKrC"} \ No newline at end of file diff --git a/build/src/compile/layer.js b/build/src/compile/layer.js new file mode 100644 index 0000000000..68131639a5 --- /dev/null +++ b/build/src/compile/layer.js @@ -0,0 +1,116 @@ +import { array } from 'vega-util'; +import * as log from '../log'; +import { isLayerSpec, isUnitSpec } from '../spec'; +import { keys } from '../util'; +import { assembleAxisSignals } from './axis/assemble'; +import { parseLayerAxes } from './axis/parse'; +import { parseData } from './data/parse'; +import { assembleLayoutSignals } from './layoutsize/assemble'; +import { parseLayerLayoutSize } from './layoutsize/parse'; +import { assembleLegends } from './legend/assemble'; +import { Model } from './model'; +import { assembleLayerSelectionMarks } from './selection/assemble'; +import { UnitModel } from './unit'; +export class LayerModel extends Model { + constructor(spec, parent, parentGivenName, parentGivenSize, config) { + super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); + const layoutSize = { + ...parentGivenSize, + ...(spec.width ? { width: spec.width } : {}), + ...(spec.height ? { height: spec.height } : {}) + }; + this.children = spec.layer.map((layer, i) => { + if (isLayerSpec(layer)) { + return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config); + } + else if (isUnitSpec(layer)) { + return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config); + } + throw new Error(log.message.invalidSpec(layer)); + }); + } + parseData() { + this.component.data = parseData(this); + for (const child of this.children) { + child.parseData(); + } + } + parseLayoutSize() { + parseLayerLayoutSize(this); + } + parseSelections() { + // Merge selections up the hierarchy so that they may be referenced + // across unit specs. Persist their definitions within each child + // to assemble signals which remain within output Vega unit groups. + this.component.selection = {}; + for (const child of this.children) { + child.parseSelections(); + for (const key of keys(child.component.selection)) { + this.component.selection[key] = child.component.selection[key]; + } + } + } + parseMarkGroup() { + for (const child of this.children) { + child.parseMarkGroup(); + } + } + parseAxesAndHeaders() { + parseLayerAxes(this); + } + assembleSelectionTopLevelSignals(signals) { + return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); + } + // TODO: Support same named selections across children. + assembleSignals() { + return this.children.reduce((signals, child) => { + return signals.concat(child.assembleSignals()); + }, assembleAxisSignals(this)); + } + assembleLayoutSignals() { + return this.children.reduce((signals, child) => { + return signals.concat(child.assembleLayoutSignals()); + }, assembleLayoutSignals(this)); + } + assembleSelectionData(data) { + return this.children.reduce((db, child) => child.assembleSelectionData(db), data); + } + assembleGroupStyle() { + const uniqueStyles = new Set(); + for (const child of this.children) { + for (const style of array(child.assembleGroupStyle())) { + uniqueStyles.add(style); + } + } + const styles = Array.from(uniqueStyles); + return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined; + } + assembleTitle() { + let title = super.assembleTitle(); + if (title) { + return title; + } + // If title does not provide layer, look into children + for (const child of this.children) { + title = child.assembleTitle(); + if (title) { + return title; + } + } + return undefined; + } + assembleLayout() { + return null; + } + assembleMarks() { + return assembleLayerSelectionMarks(this, this.children.flatMap(child => { + return child.assembleMarks(); + })); + } + assembleLegends() { + return this.children.reduce((legends, child) => { + return legends.concat(child.assembleLegends()); + }, assembleLegends(this)); + } +} +//# sourceMappingURL=layer.js.map \ No newline at end of file diff --git a/build/src/compile/layer.js.map b/build/src/compile/layer.js.map new file mode 100644 index 0000000000..85da9d4b20 --- /dev/null +++ b/build/src/compile/layer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"layer.js","sourceRoot":"","sources":["../../../src/compile/layer.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAEhC,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9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,CAAC,KAAK,CAAC,CAAC;aACzB;SACF;QACD,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;QACxC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IAClF,CAAC;IAEM,aAAa;QAClB,IAAI,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;QAClC,IAAI,KAAK,EAAE;YACT,OAAO,KAAK,CAAC;SACd;QACD,sDAAsD;QACtD,KAAK,MAAM,KAAK,IAAI,IAAI,CAAC,QAAQ,EAAE;YACjC,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;YAC9B,IAAI,KAAK,EAAE;gBACT,OAAO,KAAK,CAAC;aACd;SACF;QACD,OAAO,SAAS,CAAC;IACnB,CAAC;IAEM,cAAc;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAEM,aAAa;QAClB,OAAO,2BAA2B,CAChC,IAAI,EACJ,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;YAC5B,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;QAC/B,CAAC,CAAC,CACH,CAAC;IACJ,CAAC;IAEM,eAAe;QACpB,OAAO,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE;YAC7C,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,eAAe,EAAE,CAAC,CAAC;QACjD,CAAC,EAAE,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5B,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/assemble.d.ts b/build/src/compile/layoutsize/assemble.d.ts new file mode 100644 index 0000000000..eccde4ce17 --- /dev/null +++ b/build/src/compile/layoutsize/assemble.d.ts @@ -0,0 +1,8 @@ +import { InitSignal, NewSignal } from 'vega'; +import { Model } from '../model'; +import { ScaleComponent } from '../scale/component'; +import { LayoutSizeType } from './component'; +export declare function assembleLayoutSignals(model: Model): NewSignal[]; +export declare function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[]; +export declare function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string): string; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/assemble.d.ts.map b/build/src/compile/layoutsize/assemble.d.ts.map new file mode 100644 index 0000000000..5d5f25bae6 --- /dev/null +++ b/build/src/compile/layoutsize/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAM3C,OAAO,EAAe,KAAK,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,cAAc,EAAC,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAE3C,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,KAAK,GAAG,SAAS,EAAE,CAO/D;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,GAAG,CAAC,SAAS,GAAG,UAAU,CAAC,EAAE,CAuD9F;AAWD,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,cAAc,EAAE,cAAc,EAAE,WAAW,EAAE,MAAM,UAkB9F"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/assemble.js b/build/src/compile/layoutsize/assemble.js new file mode 100644 index 0000000000..52e8827ece --- /dev/null +++ b/build/src/compile/layoutsize/assemble.js @@ -0,0 +1,92 @@ +import { getViewConfigContinuousSize } from '../../config'; +import { hasDiscreteDomain } from '../../scale'; +import { getFirstDefined } from '../../util'; +import { isSignalRef, isVgRangeStep } from '../../vega.schema'; +import { signalOrStringValue } from '../common'; +import { isFacetModel } from '../model'; +export function assembleLayoutSignals(model) { + return [ + ...sizeSignals(model, 'width'), + ...sizeSignals(model, 'height'), + ...sizeSignals(model, 'childWidth'), + ...sizeSignals(model, 'childHeight') + ]; +} +export function sizeSignals(model, sizeType) { + const channel = sizeType === 'width' ? 'x' : 'y'; + const size = model.component.layoutSize.get(sizeType); + if (!size || size === 'merged') { + return []; + } + // Read size signal name from name map, just in case it is the top-level size signal that got renamed. + const name = model.getSizeSignalRef(sizeType).signal; + if (size === 'step') { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const type = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const scaleName = model.scaleName(channel); + if (isFacetModel(model.parent)) { + // If parent is facet and this is an independent scale, return only signal signal + // as the width/height will be calculated using the cardinality from + // facet's aggregate rather than reading from scale domain + const parentResolve = model.parent.component.resolve; + if (parentResolve.scale[channel] === 'independent') { + return [stepSignal(scaleName, range)]; + } + } + return [ + stepSignal(scaleName, range), + { + name, + update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`) + } + ]; + } + } + /* istanbul ignore next: Condition should not happen -- only for warning in development. */ + throw new Error('layout size is step although width/height is not step.'); + } + else if (size == 'container') { + const isWidth = name.endsWith('width'); + const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; + const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); + const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`; + return [{ name, init: safeExpr, on: [{ update: safeExpr, events: 'window:resize' }] }]; + } + else { + return [ + { + name, + value: size + } + ]; + } +} +function stepSignal(scaleName, range) { + const name = `${scaleName}_step`; + if (isSignalRef(range.step)) { + return { name, update: range.step.signal }; + } + else { + return { name, value: range.step }; + } +} +export function sizeExpr(scaleName, scaleComponent, cardinality) { + const type = scaleComponent.get('type'); + const padding = scaleComponent.get('padding'); + const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); + let paddingInner = scaleComponent.get('paddingInner'); + paddingInner = + type === 'band' + ? // only band has real paddingInner + paddingInner !== undefined + ? paddingInner + : padding + : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, + // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. + 1; + return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(paddingOuter)}) * ${scaleName}_step`; +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/assemble.js.map b/build/src/compile/layoutsize/assemble.js.map new file mode 100644 index 0000000000..ee4bd79fee --- /dev/null +++ b/build/src/compile/layoutsize/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,2BAA2B,EAAC,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAE,aAAa,EAAc,MAAM,mBAAmB,CAAC;AAC1E,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,YAAY,EAAQ,MAAM,UAAU,CAAC;AAI7C,MAAM,UAAU,qBAAqB,CAAC,KAAY;IAChD,OAAO;QACL,GAAG,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC;QAC9B,GAAG,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;QAC/B,GAAG,WAAW,CAAC,KAAK,EAAE,YAAY,CAAC;QACnC,GAAG,WAAW,CAAC,KAAK,EAAE,aAAa,CAAC;KACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,K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AAc,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,eAAe,CAAC,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC,CAAC;IAElF,IAAI,YAAY,GAAG,cAAc,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACtD,YAAY;QACV,IAAI,KAAK,MAAM;YACb,CAAC,CAAC,kCAAkC;gBAClC,YAAY,KAAK,SAAS;oBAC1B,CAAC,CAAC,YAAY;oBACd,CAAC,CAAC,OAAO;YACX,CAAC,CAAC,+FAA+F;gBAC/F,2FAA2F;gBAC3F,CAAC,CAAC;IACR,OAAO,aAAa,WAAW,KAAK,mBAAmB,CAAC,YAAY,CAAC,KAAK,mBAAmB,CAC3F,YAAY,CACb,OAAO,SAAS,OAAO,CAAC;AAC3B,CAAC"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/component.d.ts b/build/src/compile/layoutsize/component.d.ts new file mode 100644 index 0000000000..0e6b40fa20 --- /dev/null +++ b/build/src/compile/layoutsize/component.d.ts @@ -0,0 +1,12 @@ +import { Split } from '../split'; +export type LayoutSize = number | 'container' | 'step' | 'merged'; +export interface LayoutSizeIndex { + width?: LayoutSize; + childWidth?: LayoutSize; + height?: LayoutSize; + childHeight?: LayoutSize; +} +export type LayoutSizeType = keyof LayoutSizeIndex; +export type LayoutSizeComponent = Split; +export declare function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height'; +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/component.d.ts.map b/build/src/compile/layoutsize/component.d.ts.map new file mode 100644 index 0000000000..c81c90247e --- /dev/null +++ b/build/src/compile/layoutsize/component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,WAAW,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElE,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,UAAU,CAAC;IAEnB,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB,MAAM,CAAC,EAAE,UAAU,CAAC;IAEpB,WAAW,CAAC,EAAE,UAAU,CAAC;CAC1B;AAED,MAAM,MAAM,cAAc,GAAG,MAAM,eAAe,CAAC;AAEnD,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEzD,wBAAgB,6BAA6B,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,GAAG,QAAQ,CAEhG"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/component.js b/build/src/compile/layoutsize/component.js new file mode 100644 index 0000000000..0ad21ea1b1 --- /dev/null +++ b/build/src/compile/layoutsize/component.js @@ -0,0 +1,4 @@ +export function getSizeTypeFromLayoutSizeType(layoutSizeType) { + return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; +} +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/component.js.map b/build/src/compile/layoutsize/component.js.map new file mode 100644 index 0000000000..e3d9b1f93e --- /dev/null +++ b/build/src/compile/layoutsize/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/component.ts"],"names":[],"mappings":"AAkBA,MAAM,UAAU,6BAA6B,CAAC,cAA8B;IAC1E,OAAO,cAAc,KAAK,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,cAAc,KAAK,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC;AAClH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/init.d.ts b/build/src/compile/layoutsize/init.d.ts new file mode 100644 index 0000000000..5eedd54162 --- /dev/null +++ b/build/src/compile/layoutsize/init.d.ts @@ -0,0 +1,7 @@ +import { Encoding } from '../../encoding'; +import { LayoutSizeMixins } from '../../spec/base'; +export declare function initLayoutSize({ encoding, size }: { + encoding: Encoding; + size: LayoutSizeMixins; +}): LayoutSizeMixins; +//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/init.d.ts.map b/build/src/compile/layoutsize/init.d.ts.map new file mode 100644 index 0000000000..3197e5b168 --- /dev/null +++ b/build/src/compile/layoutsize/init.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/init.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAExC,OAAO,EAAS,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAEzD,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAC,EAAE;IAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAAC,IAAI,EAAE,gBAAgB,CAAA;CAAC,oBAYpG"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/init.js b/build/src/compile/layoutsize/init.js new file mode 100644 index 0000000000..42c29ace74 --- /dev/null +++ b/build/src/compile/layoutsize/init.js @@ -0,0 +1,17 @@ +import { getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel'; +import { isContinuousFieldOrDatumDef } from '../../channeldef'; +import * as log from '../../log'; +import { isStep } from '../../spec/base'; +export function initLayoutSize({ encoding, size }) { + for (const channel of POSITION_SCALE_CHANNELS) { + const sizeType = getSizeChannel(channel); + if (isStep(size[sizeType])) { + if (isContinuousFieldOrDatumDef(encoding[channel])) { + delete size[sizeType]; + log.warn(log.message.stepDropped(sizeType)); + } + } + } + return size; +} +//# sourceMappingURL=init.js.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/init.js.map b/build/src/compile/layoutsize/init.js.map new file mode 100644 index 0000000000..5fac07ebb7 --- /dev/null +++ b/build/src/compile/layoutsize/init.js.map @@ -0,0 +1 @@ +{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAAC,2BAA2B,EAAC,MAAM,kBAAkB,CAAC;AAE7D,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,MAAM,EAAmB,MAAM,iBAAiB,CAAC;AAEzD,MAAM,UAAU,cAAc,CAAC,EAAC,QAAQ,EAAE,IAAI,EAAuD;IACnG,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE;QAC7C,MAAM,QAAQ,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;QACzC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;YAC1B,IAAI,2BAA2B,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,EAAE;gBAClD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACtB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC7C;SACF;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/parse.d.ts b/build/src/compile/layoutsize/parse.d.ts new file mode 100644 index 0000000000..414d7e9fdc --- /dev/null +++ b/build/src/compile/layoutsize/parse.d.ts @@ -0,0 +1,8 @@ +import { ConcatModel } from '../concat'; +import { Model } from '../model'; +import { UnitModel } from '../unit'; +export declare function parseLayerLayoutSize(model: Model): void; +export declare function parseConcatLayoutSize(model: ConcatModel): void; +export declare function parseChildrenLayoutSize(model: Model): void; +export declare function parseUnitLayoutSize(model: UnitModel): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/parse.d.ts.map b/build/src/compile/layoutsize/parse.d.ts.map new file mode 100644 index 0000000000..b9e59a4935 --- /dev/null +++ b/build/src/compile/layoutsize/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/layoutsize/parse.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAG/B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,QAKhD;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,QAWvD;AAED,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,KAAK,QAInD;AA0DD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,QAanD"} \ No newline at end of file diff --git a/build/src/compile/layoutsize/parse.js b/build/src/compile/layoutsize/parse.js new file mode 100644 index 0000000000..f901163c4f --- /dev/null +++ b/build/src/compile/layoutsize/parse.js @@ -0,0 +1,126 @@ +import { getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS } from '../../channel'; +import { getViewConfigContinuousSize, getViewConfigDiscreteSize } from '../../config'; +import { hasDiscreteDomain } from '../../scale'; +import { isStep } from '../../spec/base'; +import { isVgRangeStep } from '../../vega.schema'; +import { defaultScaleResolve } from '../resolve'; +import { mergeValuesWithExplicit } from '../split'; +import { getSizeTypeFromLayoutSizeType } from './component'; +export function parseLayerLayoutSize(model) { + parseChildrenLayoutSize(model); + parseNonUnitLayoutSizeForChannel(model, 'width'); + parseNonUnitLayoutSizeForChannel(model, 'height'); +} +export function parseConcatLayoutSize(model) { + parseChildrenLayoutSize(model); + // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. + const widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; + // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. + const heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; + parseNonUnitLayoutSizeForChannel(model, widthType); + parseNonUnitLayoutSizeForChannel(model, heightType); +} +export function parseChildrenLayoutSize(model) { + for (const child of model.children) { + child.parseLayoutSize(); + } +} +/** + * Merge child layout size (width or height). + */ +function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) { + /* + * For concat, the parent width or height might not be the same as the children's shared height. + * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. + * + * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) + * while the sizeType represents the properties of the child. + */ + const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); + const channel = getPositionScaleChannel(sizeType); + const resolve = model.component.resolve; + const layoutSizeCmpt = model.component.layoutSize; + let mergedSize; + // Try to merge layout size + for (const child of model.children) { + const childSize = child.component.layoutSize.getWithExplicit(sizeType); + const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model); + if (scaleResolve === 'independent' && childSize.value === 'step') { + // Do not merge independent scales with range-step as their size depends + // on the scale domains, which can be different between scales. + mergedSize = undefined; + break; + } + if (mergedSize) { + if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { + // For independent scale, only merge if all the sizes are the same. + // If the values are different, abandon the merge! + mergedSize = undefined; + break; + } + mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); + } + else { + mergedSize = childSize; + } + } + if (mergedSize) { + // If merged, rename size and set size of all children. + for (const child of model.children) { + model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); + child.component.layoutSize.set(sizeType, 'merged', false); + } + layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); + } + else { + layoutSizeCmpt.setWithExplicit(layoutSizeType, { + explicit: false, + value: undefined + }); + } +} +export function parseUnitLayoutSize(model) { + const { size, component } = model; + for (const channel of POSITION_SCALE_CHANNELS) { + const sizeType = getSizeChannel(channel); + if (size[sizeType]) { + const specifiedSize = size[sizeType]; + component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); + } + else { + const defaultSize = defaultUnitSize(model, sizeType); + component.layoutSize.set(sizeType, defaultSize, false); + } + } +} +function defaultUnitSize(model, sizeType) { + const channel = sizeType === 'width' ? 'x' : 'y'; + const config = model.config; + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(scaleType)) { + const size = getViewConfigDiscreteSize(config.view, sizeType); + if (isVgRangeStep(range) || isStep(size)) { + // For discrete domain with range.step, use dynamic width/height + return 'step'; + } + else { + return size; + } + } + else { + return getViewConfigContinuousSize(config.view, sizeType); + } + } + else if (model.hasProjection || model.mark === 'arc') { + // arc should use continuous size by default otherwise the pie is extremely small + return getViewConfigContinuousSize(config.view, sizeType); + } + else { + const size = getViewConfigDiscreteSize(config.view, sizeType); + return isStep(size) ? size.step : size; + } +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/layoutsize/parse.js.map b/build/src/compile/layoutsize/parse.js.map new file mode 100644 index 0000000000..579dfc76f3 --- /dev/null +++ b/build/src/compile/layoutsize/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/layoutsize/parse.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAE,cAAc,EAAE,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAC/F,OAAO,EAAC,2BAA2B,EAAE,yBAAyB,EAAC,MAAM,cAAc,CAAC;AACpF,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAGhD,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OA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I,aAAa,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE;gBACxC,gEAAgE;gBAChE,OAAO,MAAM,CAAC;aACf;iBAAM;gBACL,OAAO,IAAI,CAAC;aACb;SACF;aAAM;YACL,OAAO,2BAA2B,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;SAC3D;KACF;SAAM,IAAI,KAAK,CAAC,aAAa,IAAI,KAAK,CAAC,IAAI,KAAK,KAAK,EAAE;QACtD,iFAAiF;QACjF,OAAO,2BAA2B,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;KAC3D;SAAM;QACL,MAAM,IAAI,GAAG,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;QAC9D,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;KACxC;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/legend/assemble.d.ts b/build/src/compile/legend/assemble.d.ts new file mode 100644 index 0000000000..0610b699f8 --- /dev/null +++ b/build/src/compile/legend/assemble.d.ts @@ -0,0 +1,81 @@ +import { Legend as VgLegend, LegendEncode } from 'vega'; +import { Config } from '../../config'; +import { Model } from '../model'; +import { LegendComponent } from './component'; +export declare function assembleLegends(model: Model): VgLegend[]; +export declare function assembleLegend(legendCmpt: LegendComponent, config: Config): { + size?: string; + shape?: string; + fill?: string; + stroke?: string; + strokeDash?: string; + strokeWidth?: string; + opacity?: string; + type?: import("vega").LegendType; + direction?: import("vega").Orientation; + format?: string | import("vega").SignalRef | import("vega").TimeFormatSpecifier; + formatType?: import("vega").SignalRef | import("vega").FormatType; + title?: import("vega").SignalRef | import("vega").Text; + tickMinStep?: number | import("vega").SignalRef; + values?: any[] | import("vega").SignalRef; + encode?: LegendEncode; + orient?: import("vega").SignalRef | import("vega").LegendOrient; + symbolLimit?: import("vega").NumberValue; + tickCount?: import("vega").TickCount; + aria?: boolean; + description?: string; + cornerRadius?: import("vega").NumberValue; + fillColor?: import("vega").ColorValue; + offset?: import("vega").NumberValue; + padding?: import("vega").NumberValue; + strokeColor?: import("vega").ColorValue; + legendX?: import("vega").NumberValue; + legendY?: import("vega").NumberValue; + titleAlign?: import("vega").AlignValue; + titleAnchor?: import("vega").AnchorValue; + titleBaseline?: import("vega").TextBaselineValue; + titleColor?: import("vega").ColorValue; + titleFont?: import("vega").StringValue; + titleFontSize?: import("vega").NumberValue; + titleFontStyle?: import("vega").FontStyleValue; + titleFontWeight?: import("vega").FontWeightValue; + titleLimit?: import("vega").NumberValue; + titleLineHeight?: import("vega").NumberValue; + titleOpacity?: import("vega").NumberValue; + titleOrient?: import("vega").OrientValue; + titlePadding?: import("vega").NumberValue; + gradientLength?: number | import("vega").SignalRef; + gradientOpacity?: import("vega").NumberValue; + gradientThickness?: number | import("vega").SignalRef; + gradientStrokeColor?: import("vega").ColorValue; + gradientStrokeWidth?: import("vega").NumberValue; + clipHeight?: number | import("vega").SignalRef; + columns?: number | import("vega").SignalRef; + columnPadding?: number | import("vega").SignalRef; + rowPadding?: number | import("vega").SignalRef; + gridAlign?: import("vega").SignalRef | import("vega").LayoutAlign; + symbolDash?: import("vega").DashArrayValue; + symbolDashOffset?: import("vega").NumberValue; + symbolFillColor?: import("vega").ColorValue; + symbolOffset?: import("vega").NumberValue; + symbolOpacity?: import("vega").NumberValue; + symbolSize?: import("vega").NumberValue; + symbolStrokeColor?: import("vega").ColorValue; + symbolStrokeWidth?: import("vega").NumberValue; + symbolType?: import("vega").SymbolShapeValue; + labelAlign?: import("vega").AlignValue; + labelBaseline?: import("vega").TextBaselineValue; + labelColor?: import("vega").ColorValue; + labelFont?: import("vega").StringValue; + labelFontSize?: import("vega").NumberValue; + labelFontStyle?: import("vega").FontStyleValue; + labelFontWeight?: import("vega").FontWeightValue; + labelLimit?: import("vega").NumberValue; + labelOpacity?: import("vega").NumberValue; + labelPadding?: import("vega").NumberValue; + labelOffset?: import("vega").NumberValue; + labelOverlap?: import("vega").SignalRef | import("vega").LabelOverlap; + labelSeparation?: number | import("vega").SignalRef; + zindex?: number; +}; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/legend/assemble.d.ts.map b/build/src/compile/legend/assemble.d.ts.map new file mode 100644 index 0000000000..7d39b3429c --- /dev/null +++ b/build/src/compile/legend/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AACtD,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAIpC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAgB5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,QAAQ,EAAE,CA0BxD;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwCzE"} \ No newline at end of file diff --git a/build/src/compile/legend/assemble.js b/build/src/compile/legend/assemble.js new file mode 100644 index 0000000000..2ea04edddd --- /dev/null +++ b/build/src/compile/legend/assemble.js @@ -0,0 +1,72 @@ +import { LEGEND_SCALE_CHANNELS } from '../../legend'; +import { keys, replaceAll, stringify, vals } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { mergeLegendComponent } from './parse'; +function setLegendEncode(legend, part, vgProp, vgRef) { + var _a, _b; + legend.encode ?? (legend.encode = {}); + (_a = legend.encode)[part] ?? (_a[part] = {}); + (_b = legend.encode[part]).update ?? (_b.update = {}); + // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 + legend.encode[part].update[vgProp] = vgRef; +} +export function assembleLegends(model) { + const legendComponentIndex = model.component.legends; + const legendByDomain = {}; + for (const channel of keys(legendComponentIndex)) { + const scaleComponent = model.getScaleComponent(channel); + const domainHash = stringify(scaleComponent.get('domains')); + if (legendByDomain[domainHash]) { + for (const mergedLegendComponent of legendByDomain[domainHash]) { + const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); + if (!merged) { + // If cannot merge, need to add this legend separately + legendByDomain[domainHash].push(legendComponentIndex[channel]); + } + } + } + else { + legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; + } + } + const legends = vals(legendByDomain) + .flat() + .map(l => assembleLegend(l, model.config)) + .filter(l => l !== undefined); + return legends; +} +export function assembleLegend(legendCmpt, config) { + const { disable, labelExpr, selections, ...legend } = legendCmpt.combine(); + if (disable) { + return undefined; + } + if (config.aria === false && legend.aria == undefined) { + legend.aria = false; + } + if (legend.encode?.symbols) { + const out = legend.encode.symbols.update; + if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { + // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. + out.stroke = { value: 'transparent' }; + } + // Remove properties that the legend is encoding. + for (const property of LEGEND_SCALE_CHANNELS) { + if (legend[property]) { + delete out[property]; + } + } + } + if (!legend.title) { + // title schema doesn't include null, '' + delete legend.title; + } + if (labelExpr !== undefined) { + let expr = labelExpr; + if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) { + expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); + } + setLegendEncode(legend, 'labels', 'text', { signal: expr }); + } + return legend; +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/legend/assemble.js.map b/build/src/compile/legend/assemble.js.map new file mode 100644 index 0000000000..34c5539312 --- /dev/null +++ b/build/src/compile/legend/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../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a,EAAC,CAAC;SACrC;QAED,iDAAiD;QACjD,KAAK,MAAM,QAAQ,IAAI,qBAAqB,EAAE;YAC5C,IAAI,MAAM,CAAC,QAAQ,CAAC,EAAE;gBACpB,OAAO,GAAG,CAAC,QAAQ,CAAC,CAAC;aACtB;SACF;KACF;IAED,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE;QACjB,wCAAwC;QACxC,OAAO,MAAM,CAAC,KAAK,CAAC;KACrB;IAED,IAAI,SAAS,KAAK,SAAS,EAAE;QAC3B,IAAI,IAAI,GAAG,SAAS,CAAC;QACrB,IAAI,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE;YAClF,IAAI,GAAG,UAAU,CAAC,SAAS,EAAE,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtF;QACD,eAAe,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC;KAC3D;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/legend/component.d.ts b/build/src/compile/legend/component.d.ts new file mode 100644 index 0000000000..f0deda8a6b --- /dev/null +++ b/build/src/compile/legend/component.d.ts @@ -0,0 +1,15 @@ +import { Legend as VgLegend } from 'vega'; +import { NonPositionScaleChannel } from '../../channel'; +import { LegendInternal } from '../../legend'; +import { Split } from '../split'; +export type LegendComponentProps = VgLegend & { + labelExpr?: string; + selections?: string[]; + disable?: boolean; +}; +export declare const LEGEND_COMPONENT_PROPERTIES: ("labelExpr" | "disable" | keyof VgLegend | "selections")[]; +export declare class LegendComponent extends Split { +} +export type LegendComponentIndex = Partial>; +export type LegendInternalIndex = Partial>; +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/legend/component.d.ts.map b/build/src/compile/legend/component.d.ts.map new file mode 100644 index 0000000000..46918fd8ee --- /dev/null +++ b/build/src/compile/legend/component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,IAAI,QAAQ,EAAC,MAAM,MAAM,CAAC;AACxC,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AACtD,OAAO,EAA+B,cAAc,EAAC,MAAM,cAAc,CAAC;AAE1E,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,MAAM,MAAM,oBAAoB,GAAG,QAAQ,GAAG;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAmBF,eAAO,MAAM,2BAA2B,6DAAwC,CAAC;AAEjF,qBAAa,eAAgB,SAAQ,KAAK,CAAC,oBAAoB,CAAC;CAAG;AAEnE,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC,CAAC,CAAC;AAE7F,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,cAAc,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/legend/component.js b/build/src/compile/legend/component.js new file mode 100644 index 0000000000..cbd9cac777 --- /dev/null +++ b/build/src/compile/legend/component.js @@ -0,0 +1,23 @@ +import { COMMON_LEGEND_PROPERTY_INDEX } from '../../legend'; +import { keys } from '../../util'; +import { Split } from '../split'; +const LEGEND_COMPONENT_PROPERTY_INDEX = { + ...COMMON_LEGEND_PROPERTY_INDEX, + disable: 1, + labelExpr: 1, + selections: 1, + // channel scales + opacity: 1, + shape: 1, + stroke: 1, + fill: 1, + size: 1, + strokeWidth: 1, + strokeDash: 1, + // encode + encode: 1 +}; +export const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); +export class LegendComponent extends Split { +} +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/legend/component.js.map b/build/src/compile/legend/component.js.map new file mode 100644 index 0000000000..fbc40b7cd3 --- /dev/null +++ b/build/src/compile/legend/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/legend/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,4BAA4B,EAAiB,MAAM,cAAc,CAAC;AAC1E,OAAO,EAAO,IAAI,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAQ/B,MAAM,+BAA+B,GAAqC;IACxE,GAAG,4BAA4B;IAC/B,OAAO,EAAE,CAAC;IACV,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,iBAAiB;IACjB,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,SAAS;IACT,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,IAAI,CAAC,+BAA+B,CAAC,CAAC;AAEjF,MAAM,OAAO,eAAgB,SAAQ,KAA2B;CAAG"} \ No newline at end of file diff --git a/build/src/compile/legend/encode.d.ts b/build/src/compile/legend/encode.d.ts new file mode 100644 index 0000000000..180346e763 --- /dev/null +++ b/build/src/compile/legend/encode.d.ts @@ -0,0 +1,22 @@ +import { EncodeEntry, Gradient, LegendEncode, LegendType, SymbolEncodeEntry } from 'vega'; +import { NonPositionScaleChannel } from '../../channel'; +import { DatumDef, TypedFieldDef, Value } from '../../channeldef'; +import { Encoding } from '../../encoding'; +import { UnitModel } from '../unit'; +import { LegendComponent } from './component'; +export interface LegendEncodeParams { + fieldOrDatumDef: TypedFieldDef | DatumDef; + model: UnitModel; + channel: NonPositionScaleChannel; + legendCmpt: LegendComponent; + legendType: LegendType; +} +export declare const legendEncodeRules: { + [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry; +}; +export declare function symbols(symbolsSpec: any, { fieldOrDatumDef, model, channel, legendCmpt, legendType }: LegendEncodeParams): SymbolEncodeEntry; +export declare function gradient(gradientSpec: any, { model, legendType, legendCmpt }: LegendEncodeParams): SymbolEncodeEntry; +export declare function labels(specifiedlabelsSpec: any, { fieldOrDatumDef, model, channel, legendCmpt }: LegendEncodeParams): any; +export declare function entries(entriesSpec: any, { legendCmpt }: LegendEncodeParams): any; +export declare function getFirstConditionValue(channelDef: Encoding['fill' | 'stroke' | 'shape']): V; +//# sourceMappingURL=encode.d.ts.map \ No newline at end of file diff --git a/build/src/compile/legend/encode.d.ts.map b/build/src/compile/legend/encode.d.ts.map new file mode 100644 index 0000000000..711d2148b9 --- /dev/null +++ b/build/src/compile/legend/encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAgB,WAAW,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAa,iBAAiB,EAAC,MAAM,MAAM,CAAC;AAElH,OAAO,EAAQ,uBAAuB,EAAU,MAAM,eAAe,CAAC;AACtE,OAAO,EAEL,QAAQ,EAIR,aAAa,EACb,KAAK,EAEN,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAOxC,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAE5C,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,CAAC;IAClD,KAAK,EAAE,SAAS,CAAC;IACjB,OAAO,EAAE,uBAAuB,CAAC;IACjC,UAAU,EAAE,eAAe,CAAC;IAC5B,UAAU,EAAE,UAAU,CAAC;CACxB;AAED,eAAO,MAAM,iBAAiB,EAAE;KAC7B,IAAI,IAAI,MAAM,YAAY,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,kBAAkB,KAAK,WAAW;CAM9F,CAAC;AAEF,wBAAgB,OAAO,CACrB,WAAW,EAAE,GAAG,EAChB,EAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAC,EAAE,kBAAkB,GAC5E,iBAAiB,CA8EnB;AAED,wBAAgB,QAAQ,CAAC,YAAY,EAAE,GAAG,EAAE,EAAC,KAAK,EAAE,UAAU,EAAE,UAAU,EAAC,EAAE,kBAAkB,qBAkB9F;AAED,wBAAgB,MAAM,CAAC,mBAAmB,EAAE,GAAG,EAAE,EAAC,eAAe,EAAE,KAAK,EAAE,OAAO,EAAE,UAAU,EAAC,EAAE,kBAAkB,OAmDjH;AAED,wBAAgB,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,EAAC,UAAU,EAAC,EAAE,kBAAkB,OAGzE;AAMD,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,KAAK,GAAG,QAAQ,EAC/D,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC,GACxD,CAAC,CAIH"} \ No newline at end of file diff --git a/build/src/compile/legend/encode.js b/build/src/compile/legend/encode.js new file mode 100644 index 0000000000..4ff315f4e1 --- /dev/null +++ b/build/src/compile/legend/encode.js @@ -0,0 +1,180 @@ +import { array, isArray, stringValue } from 'vega-util'; +import { COLOR, OPACITY } from '../../channel'; +import { hasConditionalValueDef, isFieldDef, isValueDef } from '../../channeldef'; +import { FILL_STROKE_CONFIG } from '../../mark'; +import { getFirstDefined, isEmpty, varName } from '../../util'; +import { applyMarkConfig, signalOrValueRef } from '../common'; +import { formatCustomType, isCustomFormatType } from '../format'; +import * as mixins from '../mark/encode'; +import { STORE } from '../selection'; +export const legendEncodeRules = { + symbols, + gradient, + labels, + entries +}; +export function symbols(symbolsSpec, { fieldOrDatumDef, model, channel, legendCmpt, legendType }) { + if (legendType !== 'symbol') { + return undefined; + } + const { markDef, encoding, config, mark } = model; + const filled = markDef.filled && mark !== 'trail'; + let out = { + ...applyMarkConfig({}, model, FILL_STROKE_CONFIG), + ...mixins.color(model, { filled }) + }; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry + const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity; + const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor; + const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor; + const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined; + if (out.fill) { + // for fill legend, we don't want any fill in symbol + if (channel === 'fill' || (filled && channel === COLOR)) { + delete out.fill; + } + else { + if (out.fill['field']) { + // For others, set fill to some opaque value (or nothing if a color is already set) + if (symbolFillColor) { + delete out.fill; + } + else { + out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black'); + out.fillOpacity = signalOrValueRef(opacity ?? 1); + } + } + else if (isArray(out.fill)) { + const fill = getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color); + if (fill) { + out.fill = signalOrValueRef(fill); + } + } + } + } + if (out.stroke) { + if (channel === 'stroke' || (!filled && channel === COLOR)) { + delete out.stroke; + } + else { + if (out.stroke['field'] || symbolStrokeColor) { + // For others, remove stroke field + delete out.stroke; + } + else if (isArray(out.stroke)) { + const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined); + if (stroke) { + out.stroke = { value: stroke }; + } + } + } + } + if (channel !== OPACITY) { + const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); + if (condition) { + out.opacity = [ + { test: condition, ...signalOrValueRef(opacity ?? 1) }, + signalOrValueRef(config.legend.unselectedOpacity) + ]; + } + else if (opacity) { + out.opacity = signalOrValueRef(opacity); + } + } + out = { ...out, ...symbolsSpec }; + return isEmpty(out) ? undefined : out; +} +export function gradient(gradientSpec, { model, legendType, legendCmpt }) { + if (legendType !== 'gradient') { + return undefined; + } + const { config, markDef, encoding } = model; + let out = {}; + const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity; + const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; + if (opacity) { + // only apply opacity if it is neither zero or undefined + out.opacity = signalOrValueRef(opacity); + } + out = { ...out, ...gradientSpec }; + return isEmpty(out) ? undefined : out; +} +export function labels(specifiedlabelsSpec, { fieldOrDatumDef, model, channel, legendCmpt }) { + const legend = model.legend(channel) || {}; + const config = model.config; + const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; + const opacity = condition ? [{ test: condition, value: 1 }, { value: config.legend.unselectedOpacity }] : undefined; + const { format, formatType } = legend; + let text = undefined; + if (isCustomFormatType(formatType)) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format, + formatType, + config + }); + } + else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.numberFormat, + formatType: config.numberFormatType, + config + }); + } + else if (fieldOrDatumDef.type === 'temporal' && + config.timeFormatType && + isFieldDef(fieldOrDatumDef) && + fieldOrDatumDef.timeUnit === undefined) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.timeFormat, + formatType: config.timeFormatType, + config + }); + } + } + const labelsSpec = { + ...(opacity ? { opacity } : {}), + ...(text ? { text } : {}), + ...specifiedlabelsSpec + }; + return isEmpty(labelsSpec) ? undefined : labelsSpec; +} +export function entries(entriesSpec, { legendCmpt }) { + const selections = legendCmpt.get('selections'); + return selections?.length ? { ...entriesSpec, fill: { value: 'transparent' } } : entriesSpec; +} +function getMaxValue(channelDef) { + return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value)); +} +export function getFirstConditionValue(channelDef) { + return getConditionValue(channelDef, (v, conditionalDef) => { + return getFirstDefined(v, conditionalDef.value); + }); +} +function getConditionValue(channelDef, reducer) { + if (hasConditionalValueDef(channelDef)) { + return array(channelDef.condition).reduce(reducer, channelDef.value); + } + else if (isValueDef(channelDef)) { + return channelDef.value; + } + return undefined; +} +function selectedCondition(model, legendCmpt, fieldDef) { + const selections = legendCmpt.get('selections'); + if (!selections?.length) + return undefined; + const field = stringValue(fieldDef.field); + return selections + .map(name => { + const store = stringValue(varName(name) + STORE); + return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`; + }) + .join(' || '); +} +//# sourceMappingURL=encode.js.map \ No newline at end of file diff --git a/build/src/compile/legend/encode.js.map b/build/src/compile/legend/encode.js.map new file mode 100644 index 0000000000..4cdaab734b --- /dev/null +++ b/build/src/compile/legend/encode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../../src/compile/legend/encode.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACtD,OAAO,EAAC,KAAK,EAA2B,OAAO,EAAC,MAAM,eAAe,CAAC;AACtE,OAAO,EAGL,sBAAsB,EACtB,UAAU,EACV,UAAU,EAIX,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,C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C,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,OAAO,UAAU;SACd,GAAG,CAAC,IAAI,CAAC,EAAE;QACV,MAAM,KAAK,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC,CAAC;QACjD,OAAO,iBAAiB,KAAK,UAAU,IAAI,IAAI,KAAK,gBAAgB,IAAI,IAAI,KAAK,wBAAwB,CAAC;IAC5G,CAAC,CAAC;SACD,IAAI,CAAC,MAAM,CAAC,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/legend/parse.d.ts b/build/src/compile/legend/parse.d.ts new file mode 100644 index 0000000000..4aed288707 --- /dev/null +++ b/build/src/compile/legend/parse.d.ts @@ -0,0 +1,8 @@ +import { NonPositionScaleChannel } from '../../channel'; +import { Model } from '../model'; +import { UnitModel } from '../unit'; +import { LegendComponent } from './component'; +export declare function parseLegend(model: Model): Partial>; +export declare function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent; +export declare function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/legend/parse.d.ts.map b/build/src/compile/legend/parse.d.ts.map new file mode 100644 index 0000000000..09348b9728 --- /dev/null +++ b/build/src/compile/legend/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAQ,uBAAuB,EAAQ,MAAM,eAAe,CAAC;AAQpE,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,eAAe,EAA0E,MAAM,aAAa,CAAC;AAIrH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,2KAIvC;AAgED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,uBAAuB,GAAG,eAAe,CAuFzG;AA4CD,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,eAAe,GAAG,eAAe,CAiDjH"} \ No newline at end of file diff --git a/build/src/compile/legend/parse.js b/build/src/compile/legend/parse.js new file mode 100644 index 0000000000..89569202f0 --- /dev/null +++ b/build/src/compile/legend/parse.js @@ -0,0 +1,219 @@ +import { COLOR, SHAPE } from '../../channel'; +import { getFieldOrDatumDef, isFieldDef } from '../../channeldef'; +import { LEGEND_SCALE_CHANNELS } from '../../legend'; +import { normalizeTimeUnit } from '../../timeunit'; +import { GEOJSON } from '../../type'; +import { deleteNestedProperty, isEmpty, keys, varName } from '../../util'; +import { mergeTitleComponent } from '../common'; +import { guideEncodeEntry } from '../guide'; +import { isUnitModel } from '../model'; +import { parseGuideResolve } from '../resolve'; +import { parseInteractiveLegend } from '../selection/legends'; +import { defaultTieBreaker, makeImplicit, mergeValuesWithExplicit } from '../split'; +import { LegendComponent, LEGEND_COMPONENT_PROPERTIES } from './component'; +import { legendEncodeRules } from './encode'; +import { getDirection, getLegendType, legendRules } from './properties'; +export function parseLegend(model) { + const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); + model.component.legends = legendComponent; + return legendComponent; +} +function parseUnitLegend(model) { + const { encoding } = model; + const legendComponent = {}; + for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) { + const def = getFieldOrDatumDef(encoding[channel]); + if (!def || !model.getScaleComponent(channel)) { + continue; + } + if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { + continue; + } + legendComponent[channel] = parseLegendForChannel(model, channel); + } + return legendComponent; +} +function getLegendDefWithScale(model, channel) { + const scale = model.scaleName(channel); + if (model.mark === 'trail') { + if (channel === 'color') { + // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" + return { stroke: scale }; + } + else if (channel === 'size') { + return { strokeWidth: scale }; + } + } + if (channel === 'color') { + return model.markDef.filled ? { fill: scale } : { stroke: scale }; + } + return { [channel]: scale }; +} +// eslint-disable-next-line @typescript-eslint/ban-types +function isExplicit(value, property, legend, fieldDef) { + switch (property) { + case 'disable': + return legend !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit + case 'values': + // specified legend.values is already respected, but may get transformed. + return !!legend?.values; + case 'title': + // title can be explicit if fieldDef.title is set + if (property === 'title' && value === fieldDef?.title) { + return true; + } + } + // Otherwise, things are explicit if the returned value matches the specified property + return value === (legend || {})[property]; +} +export function parseLegendForChannel(model, channel) { + let legend = model.legend(channel); + const { markDef, encoding, config } = model; + const legendConfig = config.legend; + const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); + parseInteractiveLegend(model, channel, legendCmpt); + const disable = legend !== undefined ? !legend : legendConfig.disable; + legendCmpt.set('disable', disable, legend !== undefined); + if (disable) { + return legendCmpt; + } + legend = legend || {}; + const scaleType = model.getScaleComponent(channel).get('type'); + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; + const orient = legend.orient || config.legend.orient || 'right'; + const legendType = getLegendType({ legend, channel, timeUnit, scaleType }); + const direction = getDirection({ legend, legendType, orient, legendConfig }); + const ruleParams = { + legend, + channel, + model, + markDef, + encoding, + fieldOrDatumDef, + legendConfig, + config, + scaleType, + orient, + legendType, + direction + }; + for (const property of LEGEND_COMPONENT_PROPERTIES) { + if ((legendType === 'gradient' && property.startsWith('symbol')) || + (legendType === 'symbol' && property.startsWith('gradient'))) { + continue; + } + const value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; + if (value !== undefined) { + const explicit = isExplicit(value, property, legend, model.fieldDef(channel)); + if (explicit || config.legend[property] === undefined) { + legendCmpt.set(property, value, explicit); + } + } + } + const legendEncoding = legend?.encoding ?? {}; + const selections = legendCmpt.get('selections'); + const legendEncode = {}; + const legendEncodeParams = { fieldOrDatumDef, model, channel, legendCmpt, legendType }; + for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) { + const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model); + const value = part in legendEncodeRules + ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule + : legendEncodingPart; // no rule -- just default values + if (value !== undefined && !isEmpty(value)) { + legendEncode[part] = { + ...(selections?.length && isFieldDef(fieldOrDatumDef) + ? { name: `${varName(fieldOrDatumDef.field)}_legend_${part}` } + : {}), + ...(selections?.length ? { interactive: !!selections } : {}), + update: value + }; + } + } + if (!isEmpty(legendEncode)) { + legendCmpt.set('encode', legendEncode, !!legend?.encoding); + } + return legendCmpt; +} +function parseNonUnitLegend(model) { + const { legends, resolve } = model.component; + for (const child of model.children) { + parseLegend(child); + for (const channel of keys(child.component.legends)) { + resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); + if (resolve.legend[channel] === 'shared') { + // If the resolve says shared (and has not been overridden) + // We will try to merge and see if there is a conflict + legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); + if (!legends[channel]) { + // If merge returns nothing, there is a conflict so we cannot make the legend shared. + // Thus, mark legend as independent and remove the legend component. + resolve.legend[channel] = 'independent'; + delete legends[channel]; + } + } + } + } + for (const channel of keys(legends)) { + for (const child of model.children) { + if (!child.component.legends[channel]) { + // skip if the child does not have a particular legend + continue; + } + if (resolve.legend[channel] === 'shared') { + // After merging shared legend, make sure to remove legend from child + delete child.component.legends[channel]; + } + } + } + return legends; +} +export function mergeLegendComponent(mergedLegend, childLegend) { + if (!mergedLegend) { + return childLegend.clone(); + } + const mergedOrient = mergedLegend.getWithExplicit('orient'); + const childOrient = childLegend.getWithExplicit('orient'); + if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { + // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) + // Cannot merge due to inconsistent orient + return undefined; + } + let typeMerged = false; + // Otherwise, let's merge + for (const prop of LEGEND_COMPONENT_PROPERTIES) { + const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', + // Tie breaker function + (v1, v2) => { + switch (prop) { + case 'symbolType': + return mergeSymbolType(v1, v2); + case 'title': + return mergeTitleComponent(v1, v2); + case 'type': + // There are only two types. If we have different types, then prefer symbol over gradient. + typeMerged = true; + return makeImplicit('symbol'); + } + return defaultTieBreaker(v1, v2, prop, 'legend'); + }); + mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); + } + if (typeMerged) { + if (mergedLegend.implicit?.encode?.gradient) { + deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); + } + if (mergedLegend.explicit?.encode?.gradient) { + deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); + } + } + return mergedLegend; +} +function mergeSymbolType(st1, st2) { + if (st2.value === 'circle') { + // prefer "circle" over "stroke" + return st2; + } + return st1; +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/legend/parse.js.map b/build/src/compile/legend/parse.js.map new file mode 100644 index 0000000000..bc947c55b0 --- /dev/null +++ b/build/src/compile/legend/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/legend/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAA2B,KAAK,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAqB,kBAAkB,EAAE,UAAU,EAAqC,MAAM,kBAAkB,CAAC;AACxH,OAAO,EAAiB,qBAAqB,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,oBAAoB,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,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AE;YAC3C,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;SACrE;QACD,IAAI,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE;YAC3C,oBAAoB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC,CAAC;SACrE;KACF;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAS,eAAe,CAAC,GAAqB,EAAE,GAAqB;IACnE,IAAI,GAAG,CAAC,KAAK,KAAK,QAAQ,EAAE;QAC1B,gCAAgC;QAChC,OAAO,GAAG,CAAC;KACZ;IACD,OAAO,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/build/src/compile/legend/properties.d.ts b/build/src/compile/legend/properties.d.ts new file mode 100644 index 0000000000..3da258dbe5 --- /dev/null +++ b/build/src/compile/legend/properties.d.ts @@ -0,0 +1,63 @@ +import { LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape } from 'vega'; +import { DatumDef, MarkPropFieldOrDatumDef, TypedFieldDef } from '../../channeldef'; +import { Config } from '../../config'; +import { Encoding } from '../../encoding'; +import { Legend, LegendConfig, LegendInternal } from '../../legend'; +import { Mark, MarkDef } from '../../mark'; +import { ScaleType } from '../../scale'; +import { TimeUnit } from '../../timeunit'; +import { Model } from '../model'; +import { UnitModel } from '../unit'; +import { NonPositionScaleChannel } from './../../channel'; +import { LegendComponentProps } from './component'; +export interface LegendRuleParams { + legend: LegendInternal; + channel: NonPositionScaleChannel; + model: UnitModel; + markDef: MarkDef; + encoding: Encoding; + fieldOrDatumDef: MarkPropFieldOrDatumDef; + legendConfig: LegendConfig; + config: Config; + scaleType: ScaleType; + orient: LegendOrient; + legendType: LegendType; + direction: Orientation; +} +export declare const legendRules: { + [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k]; +}; +export declare function values(legend: LegendInternal, fieldOrDatumDef: TypedFieldDef | DatumDef): SignalRef | (string | number | boolean | import("../../datetime").DateTime | { + signal: string; +})[]; +export declare function defaultSymbolType(mark: Mark, channel: NonPositionScaleChannel, shapeChannelDef: Encoding['shape'], markShape: SymbolShape | SignalRef): SymbolShape | SignalRef; +export declare function clipHeight(legendType: LegendType): number; +export declare function getLegendType(params: { + legend: LegendInternal; + channel: NonPositionScaleChannel; + timeUnit?: TimeUnit; + scaleType: ScaleType; +}): LegendType; +export declare function defaultType({ channel, timeUnit, scaleType }: { + channel: NonPositionScaleChannel; + timeUnit?: TimeUnit; + scaleType: ScaleType; +}): LegendType; +export declare function getDirection({ legendConfig, legendType, orient, legend }: { + orient: LegendOrient; + legendConfig: LegendConfig; + legendType: LegendType; + legend: Legend; +}): Orientation; +export declare function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined; +export declare function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }: { + scaleType: ScaleType; + direction: Orientation; + orient: LegendOrient; + model: Model; + legendConfig: LegendConfig; +}): number | { + signal: string; +}; +export declare function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/build/src/compile/legend/properties.d.ts.map b/build/src/compile/legend/properties.d.ts.map new file mode 100644 index 0000000000..5753c4551d --- /dev/null +++ b/build/src/compile/legend/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/compile/legend/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAGjG,OAAO,EAAC,QAAQ,EAAE,uBAAuB,EAA0B,aAAa,EAAa,MAAM,kBAAkB,CAAC;AACtH,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB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AS,CAAC,CAAC;CACvC;;EAoBA;AAOD,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,YAAY,CAKtE"} \ No newline at end of file diff --git a/build/src/compile/legend/properties.js b/build/src/compile/legend/properties.js new file mode 100644 index 0000000000..2bb57a556f --- /dev/null +++ b/build/src/compile/legend/properties.js @@ -0,0 +1,148 @@ +import { isArray } from 'vega-util'; +import { isColorChannel } from '../../channel'; +import { title as fieldDefTitle, valueArray } from '../../channeldef'; +import { isContinuousToContinuous } from '../../scale'; +import { contains, getFirstDefined } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { guideFormat, guideFormatType } from '../format'; +import { getFirstConditionValue } from './encode'; +export const legendRules = { + direction: ({ direction }) => direction, + format: ({ fieldOrDatumDef, legend, config }) => { + const { format, formatType } = legend; + return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); + }, + formatType: ({ legend, fieldOrDatumDef, scaleType }) => { + const { formatType } = legend; + return guideFormatType(formatType, fieldOrDatumDef, scaleType); + }, + gradientLength: params => { + const { legend, legendConfig } = params; + return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params); + }, + labelOverlap: ({ legend, legendConfig, scaleType }) => legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType), + symbolType: ({ legend, markDef, channel, encoding }) => legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape), + title: ({ fieldOrDatumDef, config }) => fieldDefTitle(fieldOrDatumDef, config, { allowDisabling: true }), + type: ({ legendType, scaleType, channel }) => { + if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { + if (legendType === 'gradient') { + return undefined; + } + } + else if (legendType === 'symbol') { + return undefined; + } + return legendType; + }, + values: ({ fieldOrDatumDef, legend }) => values(legend, fieldOrDatumDef) +}; +export function values(legend, fieldOrDatumDef) { + const vals = legend.values; + if (isArray(vals)) { + return valueArray(fieldOrDatumDef, vals); + } + else if (isSignalRef(vals)) { + return vals; + } + return undefined; +} +export function defaultSymbolType(mark, channel, shapeChannelDef, markShape) { + if (channel !== 'shape') { + // use the value from the shape encoding or the mark config if they exist + const shape = getFirstConditionValue(shapeChannelDef) ?? markShape; + if (shape) { + return shape; + } + } + switch (mark) { + case 'bar': + case 'rect': + case 'image': + case 'square': + return 'square'; + case 'line': + case 'trail': + case 'rule': + return 'stroke'; + case 'arc': + case 'point': + case 'circle': + case 'tick': + case 'geoshape': + case 'area': + case 'text': + return 'circle'; + } +} +export function clipHeight(legendType) { + if (legendType === 'gradient') { + return 20; + } + return undefined; +} +export function getLegendType(params) { + const { legend } = params; + return getFirstDefined(legend.type, defaultType(params)); +} +export function defaultType({ channel, timeUnit, scaleType }) { + // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js + if (isColorChannel(channel)) { + if (contains(['quarter', 'month', 'day'], timeUnit)) { + return 'symbol'; + } + if (isContinuousToContinuous(scaleType)) { + return 'gradient'; + } + } + return 'symbol'; +} +export function getDirection({ legendConfig, legendType, orient, legend }) { + return (legend.direction ?? + legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ?? + defaultDirection(orient, legendType)); +} +export function defaultDirection(orient, legendType) { + switch (orient) { + case 'top': + case 'bottom': + return 'horizontal'; + case 'left': + case 'right': + case 'none': + case undefined: // undefined = "right" in Vega + return undefined; // vertical is Vega's default + default: + // top-left / ... + // For inner legend, uses compact layout like Tableau + return legendType === 'gradient' ? 'horizontal' : undefined; + } +} +export function defaultGradientLength({ legendConfig, model, direction, orient, scaleType }) { + const { gradientHorizontalMaxLength, gradientHorizontalMinLength, gradientVerticalMaxLength, gradientVerticalMinLength } = legendConfig; + if (isContinuousToContinuous(scaleType)) { + if (direction === 'horizontal') { + if (orient === 'top' || orient === 'bottom') { + return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); + } + else { + return gradientHorizontalMinLength; + } + } + else { + // vertical / undefined (Vega uses vertical by default) + return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); + } + } + return undefined; +} +function gradientLengthSignal(model, sizeType, min, max) { + const sizeSignal = model.getSizeSignalRef(sizeType).signal; + return { signal: `clamp(${sizeSignal}, ${min}, ${max})` }; +} +export function defaultLabelOverlap(scaleType) { + if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) { + return 'greedy'; + } + return undefined; +} +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/build/src/compile/legend/properties.js.map b/build/src/compile/legend/properties.js.map new file mode 100644 index 0000000000..b7eca7bc40 --- /dev/null +++ b/build/src/compile/legend/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/legend/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAoC,KAAK,IAAI,aAAa,EAAiB,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAKtH,OAAO,EAAC,wBAAwB,EAAY,MAAM,aAAa,CAAC;AAEhE,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,WAAW,EAAE,eAAe,EAAC,MAAM,WAAW,CAAC;AAKvD,OAAO,EAAC,sBAAsB,EAAC,MAAM,UAAU,CAAC;AAiBhD,MAAM,CAAC,MAAM,WAAW,GAEpB;IACF,SAAS,EAAE,CAAC,EAAC,SAAS,EAAC,EAAE,EAAE,CAAC,SAAS;IAErC,MAAM,EAAE,CAAC,EAAC,eAAe,EAAE,MAAM,EAAE,MAAM,EAAC,EAAE,EAAE;QAC5C,MAAM,EAAC,MAAM,EAAE,UAAU,EAAC,GAAG,MAAM,CAAC;QACpC,OAAO,WAAW,CAAC,eAAe,EAAE,eAAe,CAAC,IAAI,EAAE,MAA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.d.ts b/build/src/compile/mark/arc.d.ts new file mode 100644 index 0000000000..9ca1032155 --- /dev/null +++ b/build/src/compile/mark/arc.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const arc: MarkCompiler; +//# sourceMappingURL=arc.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/arc.d.ts.map b/build/src/compile/mark/arc.d.ts.map new file mode 100644 index 0000000000..79f0a7d149 --- /dev/null +++ b/build/src/compile/mark/arc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"arc.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/arc.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,GAAG,EAAE,YAoBjB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/arc.js b/build/src/compile/mark/arc.js new file mode 100644 index 0000000000..71c3f9df91 --- /dev/null +++ b/build/src/compile/mark/arc.js @@ -0,0 +1,22 @@ +import * as encode from './encode'; +export const arc = { + vgMark: 'arc', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid' }), + // arcs are rectangles in polar coordinates + ...encode.rectPosition(model, 'radius'), + ...encode.rectPosition(model, 'theta') + }; + } +}; +//# sourceMappingURL=arc.js.map \ No newline at end of file diff --git a/build/src/compile/mark/arc.js.map b/build/src/compile/mark/arc.js.map new file mode 100644 index 0000000000..9c999a3aa9 --- /dev/null +++ b/build/src/compile/mark/arc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"arc.js","sourceRoot":"","sources":["../../../../src/compile/mark/arc.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,MAAM,EAAE,KAAK;IACb,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YAExD,2CAA2C;YAC3C,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,CAAC;YACvC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,OAAO,CAAC;SACvC,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/area.d.ts b/build/src/compile/mark/area.d.ts new file mode 100644 index 0000000000..ecd9da20f9 --- /dev/null +++ b/build/src/compile/mark/area.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const area: MarkCompiler; +//# sourceMappingURL=area.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/area.d.ts.map b/build/src/compile/mark/area.d.ts.map new file mode 100644 index 0000000000..33f80c6db2 --- /dev/null +++ b/build/src/compile/mark/area.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"area.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/area.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAyBlB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/area.js b/build/src/compile/mark/area.js new file mode 100644 index 0000000000..f58f990ab0 --- /dev/null +++ b/build/src/compile/mark/area.js @@ -0,0 +1,28 @@ +import * as encode from './encode'; +export const area = { + vgMark: 'area', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'include', + size: 'ignore', + theta: 'ignore' + }), + ...encode.pointOrRangePosition('x', model, { + defaultPos: 'zeroOrMin', + defaultPos2: 'zeroOrMin', + range: model.markDef.orient === 'horizontal' + }), + ...encode.pointOrRangePosition('y', model, { + defaultPos: 'zeroOrMin', + defaultPos2: 'zeroOrMin', + range: model.markDef.orient === 'vertical' + }), + ...encode.defined(model) + }; + } +}; +//# sourceMappingURL=area.js.map \ No newline at end of file diff --git a/build/src/compile/mark/area.js.map b/build/src/compile/mark/area.js.map new file mode 100644 index 0000000000..4c87cec384 --- /dev/null +++ b/build/src/compile/mark/area.js.map @@ -0,0 +1 @@ +{"version":3,"file":"area.js","sourceRoot":"","sources":["../../../../src/compile/mark/area.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,SAAS;gBACjB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;gBACzC,UAAU,EAAE,WAAW;gBACvB,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,YAAY;aAC7C,CAAC;YACF,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;gBACzC,UAAU,EAAE,WAAW;gBACvB,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,MAAM,KAAK,UAAU;aAC3C,CAAC;YACF,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/bar.d.ts b/build/src/compile/mark/bar.d.ts new file mode 100644 index 0000000000..a144874cef --- /dev/null +++ b/build/src/compile/mark/bar.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const bar: MarkCompiler; +//# sourceMappingURL=bar.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/bar.d.ts.map b/build/src/compile/mark/bar.d.ts.map new file mode 100644 index 0000000000..0365b60c27 --- /dev/null +++ b/build/src/compile/mark/bar.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bar.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/bar.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,GAAG,EAAE,YAgBjB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/bar.js b/build/src/compile/mark/bar.js new file mode 100644 index 0000000000..39dc855130 --- /dev/null +++ b/build/src/compile/mark/bar.js @@ -0,0 +1,19 @@ +import * as encode from './encode'; +export const bar = { + vgMark: 'rect', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...encode.rectPosition(model, 'x'), + ...encode.rectPosition(model, 'y') + }; + } +}; +//# sourceMappingURL=bar.js.map \ No newline at end of file diff --git a/build/src/compile/mark/bar.js.map b/build/src/compile/mark/bar.js.map new file mode 100644 index 0000000000..65452a9ee4 --- /dev/null +++ b/build/src/compile/mark/bar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bar.js","sourceRoot":"","sources":["../../../../src/compile/mark/bar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,GAAG,GAAiB;IAC/B,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;SACnC,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/base.d.ts b/build/src/compile/mark/base.d.ts new file mode 100644 index 0000000000..a242d7a4eb --- /dev/null +++ b/build/src/compile/mark/base.d.ts @@ -0,0 +1,18 @@ +import { Mark } from 'vega'; +import { VgEncodeEntry, VgPostEncodingTransform } from '../../vega.schema'; +import { UnitModel } from '../unit'; +/** + * Abstract interface for compiling a Vega-Lite primitive mark type. + */ +export interface MarkCompiler { + /** + * Underlying Vega Mark type for the Vega-Lite mark. + */ + vgMark: Mark['type']; + encodeEntry: (model: UnitModel) => VgEncodeEntry; + /** + * Transform on a mark after render, used for layout and projections + */ + postEncodingTransform?: (model: UnitModel) => VgPostEncodingTransform[]; +} +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/base.d.ts.map b/build/src/compile/mark/base.d.ts.map new file mode 100644 index 0000000000..977bbdad40 --- /dev/null +++ b/build/src/compile/mark/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,MAAM,CAAC;AAC1B,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AACzE,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IAErB,WAAW,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,aAAa,CAAC;IAEjD;;OAEG;IACH,qBAAqB,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,uBAAuB,EAAE,CAAC;CACzE"} \ No newline at end of file diff --git a/build/src/compile/mark/base.js b/build/src/compile/mark/base.js new file mode 100644 index 0000000000..880caea8fb --- /dev/null +++ b/build/src/compile/mark/base.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/build/src/compile/mark/base.js.map b/build/src/compile/mark/base.js.map new file mode 100644 index 0000000000..28662bb53e --- /dev/null +++ b/build/src/compile/mark/base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../../src/compile/mark/base.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/src/compile/mark/encode/aria.d.ts b/build/src/compile/mark/encode/aria.d.ts new file mode 100644 index 0000000000..963e25011c --- /dev/null +++ b/build/src/compile/mark/encode/aria.d.ts @@ -0,0 +1,386 @@ +import { UnitModel } from './../../unit'; +export declare function aria(model: UnitModel): { + fill?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + stroke?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + angle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + height?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + width?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + url?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + clip?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cursor?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fillOpacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + font?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontSize?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontStyle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontWeight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + opacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeOpacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeWidth?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dir?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + path?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + text?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + size?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + x?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + x2?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + xc?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + y?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + y2?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + yc?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeDash?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeCap?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeJoin?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + tooltip?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + startAngle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + endAngle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + innerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + outerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + orient?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + interpolate?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + tension?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + defined?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeForeground?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeOffset?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + baseline?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + align?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + scaleX?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + scaleY?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + shape?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dx?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dy?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + ellipsis?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + limit?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + radius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + theta?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + href?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; +} | { + fill?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + stroke?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + angle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + height?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + width?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + url?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + clip?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cursor?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fillOpacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + font?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontSize?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontStyle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + fontWeight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + opacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeOpacity?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeWidth?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dir?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + path?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + text?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + size?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + x?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + x2?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + xc?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + y?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + y2?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + yc?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeDash?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeCap?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeJoin?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + tooltip?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + startAngle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + endAngle?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + innerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + outerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + orient?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + interpolate?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + tension?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + defined?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeForeground?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + strokeOffset?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + baseline?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + align?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + scaleX?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + scaleY?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + shape?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dx?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + dy?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + ellipsis?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + limit?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + radius?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + theta?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + href?: import("./../../../vega.schema").VgValueRef | (import("./../../../vega.schema").VgValueRef & { + test?: string; + })[]; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; +}; +export declare function description(model: UnitModel): Partial> | { + description: import("vega-typings").SignalRef | { + value: string; + }; +}; +//# sourceMappingURL=aria.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/aria.d.ts.map b/build/src/compile/mark/encode/aria.d.ts.map new file mode 100644 index 0000000000..4fcae3cdab --- /dev/null +++ b/build/src/compile/mark/encode/aria.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"aria.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/aria.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAKvC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgBpC;AAkBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS;;;;;;EAkC3C"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/aria.js b/build/src/compile/mark/encode/aria.js new file mode 100644 index 0000000000..c4ea174822 --- /dev/null +++ b/build/src/compile/mark/encode/aria.js @@ -0,0 +1,61 @@ +import { entries, isEmpty } from '../../../util'; +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +import { VG_MARK_INDEX } from './../../../vega.schema'; +import { wrapCondition } from './conditional'; +import { textRef } from './text'; +import { tooltipData } from './tooltip'; +export function aria(model) { + const { markDef, config } = model; + const enableAria = getMarkPropOrConfig('aria', markDef, config); + // We can ignore other aria properties if ariaHidden is true. + if (enableAria === false) { + // getMarkGroups sets aria to false already so we don't have to set it in the encode block + return {}; + } + return { + ...(enableAria ? { aria: enableAria } : {}), + ...ariaRoleDescription(model), + ...description(model) + }; +} +function ariaRoleDescription(model) { + const { mark, markDef, config } = model; + if (config.aria === false) { + return {}; + } + const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); + if (ariaRoleDesc != null) { + return { ariaRoleDescription: { value: ariaRoleDesc } }; + } + return mark in VG_MARK_INDEX ? {} : { ariaRoleDescription: { value: mark } }; +} +export function description(model) { + const { encoding, markDef, config, stack } = model; + const channelDef = encoding.description; + if (channelDef) { + return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); + } + // Use default from mark def or config if defined. + // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. + const descriptionValue = getMarkPropOrConfig('description', markDef, config); + if (descriptionValue != null) { + return { + description: signalOrValueRef(descriptionValue) + }; + } + if (config.aria === false) { + return {}; + } + const data = tooltipData(encoding, stack, config); + if (isEmpty(data)) { + return undefined; + } + return { + description: { + signal: entries(data) + .map(([key, value], index) => `"${index > 0 ? '; ' : ''}${key}: " + (${value})`) + .join(' + ') + } + }; +} +//# sourceMappingURL=aria.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/aria.js.map b/build/src/compile/mark/encode/aria.js.map new file mode 100644 index 0000000000..ebe1d03056 --- /dev/null +++ b/build/src/compile/mark/encode/aria.js.map @@ -0,0 +1 @@ +{"version":3,"file":"aria.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/aria.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AACnE,OAAO,EAAC,aAAa,EAAC,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AAEtC,MAAM,UAAU,IAAI,CAAC,KAAgB;IACnC,MAAM,EAAC,OAAO,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAEhC,MAAM,UAAU,GAAG,mBAAmB,CAAC,MAAM,EAAE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AClD,kIAAkI;IAClI,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,aAAa,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7E,IAAI,gBAAgB,IAAI,IAAI,EAAE;QAC5B,OAAO;YACL,WAAW,EAAE,gBAAgB,CAAC,gBAAgB,CAAC;SAChD,CAAC;KACH;IAED,IAAI,MAAM,CAAC,IAAI,KAAK,KAAK,EAAE;QACzB,OAAO,EAAE,CAAC;KACX;IAED,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC;IAElD,IAAI,OAAO,CAAC,IAAI,CAAC,EAAE;QACjB,OAAO,SAAS,CAAC;KAClB;IAED,OAAO;QACL,WAAW,EAAE;YACX,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC;iBAClB,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,GAAG,GAAG,UAAU,KAAK,GAAG,CAAC;iBAC/E,IAAI,CAAC,KAAK,CAAC;SACf;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/base.d.ts b/build/src/compile/mark/encode/base.d.ts new file mode 100644 index 0000000000..f271adec9e --- /dev/null +++ b/build/src/compile/mark/encode/base.d.ts @@ -0,0 +1,1481 @@ +import { VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export { color } from './color'; +export { wrapCondition } from './conditional'; +export { nonPosition } from './nonposition'; +export { pointPosition } from './position-point'; +export { pointOrRangePosition, rangePosition } from './position-range'; +export { rectPosition } from './position-rect'; +export { text } from './text'; +export { tooltip } from './tooltip'; +export type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>; +export declare function baseEncodeEntry(model: UnitModel, ignore: Ignore): { + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; +} | { + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; +} | { + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip: VgValueRef | (VgValueRef & { + test?: string; + })[] | { + signal: string; + }; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription?: undefined; + aria?: true | import("vega-typings").SignalRef; + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip: VgValueRef | (VgValueRef & { + test?: string; + })[] | { + signal: string; + }; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; +} | { + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip: VgValueRef | (VgValueRef & { + test?: string; + })[] | { + signal: string; + }; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; +} | { + description: import("vega-typings").SignalRef | { + value: string; + }; + ariaRoleDescription: { + value: string | import("vega-typings").SignalRef; + }; + aria?: true | import("vega-typings").SignalRef; + fill?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + stroke?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + angle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + height?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + width?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + url?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + clip?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cursor?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fillOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + font?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontSize?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontStyle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + fontWeight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + opacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOpacity?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeWidth?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dir?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + path?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + text?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + size?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + x2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + xc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + y2?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + yc?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDash?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeDashOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeCap?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeJoin?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeMiterLimit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tooltip: VgValueRef | (VgValueRef & { + test?: string; + })[] | { + signal: string; + }; + startAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + endAngle?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + innerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + outerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + orient?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + interpolate?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + tension?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + defined?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeForeground?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + strokeOffset?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusTopRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomRight?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + cornerRadiusBottomLeft?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + baseline?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + align?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleX?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + scaleY?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + shape?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dx?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + dy?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + ellipsis?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + limit?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + radius?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + theta?: VgValueRef | (VgValueRef & { + test?: string; + })[]; + href?: VgValueRef | (VgValueRef & { + test?: string; + })[]; +}; +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/base.d.ts.map b/build/src/compile/mark/encode/base.d.ts.map new file mode 100644 index 0000000000..8d726ec763 --- /dev/null +++ b/build/src/compile/mark/encode/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/base.ts"],"names":[],"mappings":"AAKA,OAAO,EAAgB,UAAU,EAAkB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AASrC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAElC,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC,CAAC;AAIhH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAgB/D"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/base.js b/build/src/compile/mark/encode/base.js new file mode 100644 index 0000000000..d834620396 --- /dev/null +++ b/build/src/compile/mark/encode/base.js @@ -0,0 +1,90 @@ +import { array } from 'vega-util'; +import { SCALE_CHANNELS } from '../../../channel'; +import { isPathMark } from '../../../mark'; +import { hasContinuousDomain } from '../../../scale'; +import { keys } from '../../../util'; +import { VG_MARK_CONFIGS } from '../../../vega.schema'; +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +import { aria } from './aria'; +import { color } from './color'; +import { nonPosition } from './nonposition'; +import { text } from './text'; +import { tooltip } from './tooltip'; +import { fieldInvalidPredicate } from './valueref'; +import { zindex } from './zindex'; +export { color } from './color'; +export { wrapCondition } from './conditional'; +export { nonPosition } from './nonposition'; +export { pointPosition } from './position-point'; +export { pointOrRangePosition, rangePosition } from './position-range'; +export { rectPosition } from './position-rect'; +export { text } from './text'; +export { tooltip } from './tooltip'; +const ALWAYS_IGNORE = new Set(['aria', 'width', 'height']); +export function baseEncodeEntry(model, ignore) { + const { fill = undefined, stroke = undefined } = ignore.color === 'include' ? color(model) : {}; + return { + ...markDefProperties(model.markDef, ignore), + ...wrapAllFieldsInvalid(model, 'fill', fill), + ...wrapAllFieldsInvalid(model, 'stroke', stroke), + ...nonPosition('opacity', model), + ...nonPosition('fillOpacity', model), + ...nonPosition('strokeOpacity', model), + ...nonPosition('strokeWidth', model), + ...nonPosition('strokeDash', model), + ...zindex(model), + ...tooltip(model), + ...text(model, 'href'), + ...aria(model) + }; +} +// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 +function wrapAllFieldsInvalid(model, channel, valueRef) { + const { config, mark, markDef } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid === 'hide' && valueRef && !isPathMark(mark)) { + // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. + // For path marks, we will use "defined" property and skip these values instead. + const test = allFieldsInvalidPredicate(model, { invalid: true, channels: SCALE_CHANNELS }); + if (test) { + return { + [channel]: [ + // prepend the invalid case + // TODO: support custom value + { test, value: null }, + ...array(valueRef) + ] + }; + } + } + return valueRef ? { [channel]: valueRef } : {}; +} +function markDefProperties(mark, ignore) { + return VG_MARK_CONFIGS.reduce((m, prop) => { + if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { + m[prop] = signalOrValueRef(mark[prop]); + } + return m; + }, {}); +} +function allFieldsInvalidPredicate(model, { invalid = false, channels }) { + const filterIndex = channels.reduce((aggregator, channel) => { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const field = model.vgField(channel, { expr: 'datum' }); + // While discrete domain scales can handle invalid values, continuous scales can't. + if (field && hasContinuousDomain(scaleType)) { + aggregator[field] = true; + } + } + return aggregator; + }, {}); + const fields = keys(filterIndex); + if (fields.length > 0) { + const op = invalid ? '||' : '&&'; + return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); + } + return undefined; +} +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/base.js.map b/build/src/compile/mark/encode/base.js.map new file mode 100644 index 0000000000..9b60c55b73 --- /dev/null +++ b/build/src/compile/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AAC,GAAG,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,CAAC;YAEtD,mFAAmF;YACnF,IAAI,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE;gBAC3C,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;aAC1B;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/color.d.ts b/build/src/compile/mark/encode/color.d.ts new file mode 100644 index 0000000000..caa7df6e3f --- /dev/null +++ b/build/src/compile/mark/encode/color.d.ts @@ -0,0 +1,6 @@ +import { VgEncodeEntry } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export declare function color(model: UnitModel, opt?: { + filled: boolean | undefined; +}): VgEncodeEntry; +//# sourceMappingURL=color.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/color.d.ts.map b/build/src/compile/mark/encode/color.d.ts.map new file mode 100644 index 0000000000..1fb381896b --- /dev/null +++ b/build/src/compile/mark/encode/color.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/color.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,KAAK,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE;IAAC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAA;CAAuB,GAAG,aAAa,CAkD/G"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/color.js b/build/src/compile/mark/encode/color.js new file mode 100644 index 0000000000..73f914d943 --- /dev/null +++ b/build/src/compile/mark/encode/color.js @@ -0,0 +1,46 @@ +import * as log from '../../../log'; +import { contains } from '../../../util'; +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +import { nonPosition } from './nonposition'; +export function color(model, opt = { filled: undefined }) { + const { markDef, encoding, config } = model; + const { type: markType } = markDef; + // Allow filled to be overridden (for trail's "filled") + const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config); + const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) + ? 'transparent' + : undefined; + const defaultFill = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { vgChannel: 'fill' }) ?? + // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified + config.mark[filled === true && 'color'] ?? + // If there is no fill, always fill symbols, bar, geoshape + // with transparent fills https://github.com/vega/vega-lite/issues/1316 + transparentIfNeeded; + const defaultStroke = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { vgChannel: 'stroke' }) ?? + // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified + config.mark[filled === false && 'color']; + const colorVgChannel = filled ? 'fill' : 'stroke'; + const fillStrokeMarkDefAndConfig = { + ...(defaultFill ? { fill: signalOrValueRef(defaultFill) } : {}), + ...(defaultStroke ? { stroke: signalOrValueRef(defaultStroke) } : {}) + }; + if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { + log.warn(log.message.droppingColor('property', { fill: 'fill' in markDef, stroke: 'stroke' in markDef })); + } + return { + ...fillStrokeMarkDefAndConfig, + ...nonPosition('color', model, { + vgChannel: colorVgChannel, + defaultValue: filled ? defaultFill : defaultStroke + }), + ...nonPosition('fill', model, { + // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding + defaultValue: encoding.fill ? defaultFill : undefined + }), + ...nonPosition('stroke', model, { + // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding + defaultValue: encoding.stroke ? defaultStroke : undefined + }) + }; +} +//# sourceMappingURL=color.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/color.js.map b/build/src/compile/mark/encode/color.js.map new file mode 100644 index 0000000000..6bd4e1526e --- /dev/null +++ b/build/src/compile/mark/encode/color.js.map @@ -0,0 +1 @@ +{"version":3,"file":"color.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/color.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAE1C,MAAM,UAAU,KAAK,CAAC,KAAgB,EAAE,MAAqC,EAAC,MAAM,EAAE,SAAS,EAAC;IAC9F,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC1C,MAAM,EAAC,IAAI,EAAE,QAAQ,EAAC,GAAG,OAAO,CAAC;IAEjC,uDAAuD;IACvD,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,IAAI,mBAAmB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAE5E,MAAM,mBAAmB,GAAG,QAAQ,CAAC,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC;QAC9F,CAAC,CAAC,aAAa;Q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AQ,IAAI,OAAO,EAAC,CAAC,CAAC,CAAC;KACzG;IAED,OAAO;QACL,GAAG,0BAA0B;QAC7B,GAAG,WAAW,CAAC,OAAO,EAAE,KAAK,EAAE;YAC7B,SAAS,EAAE,cAAc;YACzB,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,aAAa;SACnD,CAAC;QACF,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;YAC5B,sGAAsG;YACtG,YAAY,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;SACtD,CAAC;QACF,GAAG,WAAW,CAAC,QAAQ,EAAE,KAAK,EAAE;YAC9B,0GAA0G;YAC1G,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;SAC1D,CAAC;KACH,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/conditional.d.ts b/build/src/compile/mark/encode/conditional.d.ts new file mode 100644 index 0000000000..e160cff5e9 --- /dev/null +++ b/build/src/compile/mark/encode/conditional.d.ts @@ -0,0 +1,10 @@ +import { ChannelDef } from '../../../channeldef'; +import { GuideEncodingConditionalValueDef } from '../../../guide'; +import { VgEncodeEntry, VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +/** + * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition + * or a simple mixin if channel def has no condition. + */ +export declare function wrapCondition(model: UnitModel, channelDef: CD, vgChannel: string, refFn: (cDef: CD) => VgValueRef): VgEncodeEntry; +//# sourceMappingURL=conditional.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/conditional.d.ts.map b/build/src/compile/mark/encode/conditional.d.ts.map new file mode 100644 index 0000000000..8b8a28751a --- /dev/null +++ b/build/src/compile/mark/encode/conditional.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"conditional.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/conditional.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAiE,MAAM,qBAAqB,CAAC;AAC/G,OAAO,EAAC,gCAAgC,EAAC,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAG/D,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC;;;GAGG;AACH,wBAAgB,aAAa,CAAC,EAAE,SAAS,UAAU,GAAG,gCAAgC,EACpF,KAAK,EAAE,SAAS,EAChB,UAAU,EAAE,EAAE,EACd,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,KAAK,UAAU,GAC9B,aAAa,CAsBf"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/conditional.js b/build/src/compile/mark/encode/conditional.js new file mode 100644 index 0000000000..d3f13c67aa --- /dev/null +++ b/build/src/compile/mark/encode/conditional.js @@ -0,0 +1,34 @@ +import { array } from 'vega-util'; +import { isConditionalDef, isConditionalParameter } from '../../../channeldef'; +import { expression } from '../../predicate'; +import { parseSelectionPredicate } from '../../selection/parse'; +/** + * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition + * or a simple mixin if channel def has no condition. + */ +export function wrapCondition(model, channelDef, vgChannel, refFn) { + const condition = isConditionalDef(channelDef) && channelDef.condition; + const valueRef = refFn(channelDef); + if (condition) { + const conditions = array(condition); + const vgConditions = conditions.map(c => { + const conditionValueRef = refFn(c); + if (isConditionalParameter(c)) { + const { param, empty } = c; + const test = parseSelectionPredicate(model, { param, empty }); + return { test, ...conditionValueRef }; + } + else { + const test = expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it + return { test, ...conditionValueRef }; + } + }); + return { + [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])] + }; + } + else { + return valueRef !== undefined ? { [vgChannel]: valueRef } : {}; + } +} +//# sourceMappingURL=conditional.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/conditional.js.map b/build/src/compile/mark/encode/conditional.js.map new file mode 100644 index 0000000000..5d6206ed32 --- /dev/null +++ b/build/src/compile/mark/encode/conditional.js.map @@ -0,0 +1 @@ +{"version":3,"file":"conditional.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/conditional.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAChC,OAAO,EAAmC,gBAAgB,EAAE,sBAAsB,EAAC,MAAM,qBAAqB,CAAC;AAG/G,OAAO,EAAC,UAAU,EAAC,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAC,uBAAuB,EAAC,MAAM,uBAAuB,CAAC;AAG9D;;;GAGG;AACH,MAAM,UAAU,aAAa,CAC3B,KAAgB,EAChB,UAAc,EACd,SAAiB,EACjB,KAA+B;IAE/B,MAAM,SAAS,GAAG,gBAAgB,CAAK,UAAU,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC;IAC3E,MAAM,QAAQ,GAAG,KAAK,CAAC,UAAU,CAAC,CAAC;IACnC,IAAI,SAAS,EAAE;QACb,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC;QACpC,MAAM,YAAY,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;YACtC,MAAM,iBAAiB,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;YACnC,IAAI,sBAAsB,CAAM,CAAC,CAAC,EAAE;gBAClC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAC,GAAG,CAAC,CAAC;gBACzB,MAAM,IAAI,GAAG,uBAAuB,CAAC,KAAK,EAAE,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC,CAAC;gBAC5D,OAAO,EAAC,IAAI,EAAE,GAAG,iBAAiB,EAAC,CAAC;aACrC;iBAAM;gBACL,MAAM,IAAI,GAAG,UAAU,CAAC,KAAK,EAAG,CAA+B,CAAC,IAAI,CAAC,CAAC,CAAC,2DAA2D;gBAClI,OAAO,EAAC,IAAI,EAAE,GAAG,iBAAiB,EAAC,CAAC;aACrC;QACH,CAAC,CAAC,CAAC;QACH,OAAO;YACL,CAAC,SAAS,CAAC,EAAE,CAAC,GAAG,YAAY,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;SAC9E,CAAC;KACH;SAAM;QACL,OAAO,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,CAAC,SAAS,CAAC,EAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAC9D;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/defined.d.ts b/build/src/compile/mark/encode/defined.d.ts new file mode 100644 index 0000000000..892557ed63 --- /dev/null +++ b/build/src/compile/mark/encode/defined.d.ts @@ -0,0 +1,6 @@ +import { Value } from '../../../channeldef'; +import { VgEncodeEntry } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export declare function defined(model: UnitModel): VgEncodeEntry; +export declare function valueIfDefined(prop: string, value: Value): VgEncodeEntry; +//# sourceMappingURL=defined.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/defined.d.ts.map b/build/src/compile/mark/encode/defined.d.ts.map new file mode 100644 index 0000000000..26eae51d84 --- /dev/null +++ b/build/src/compile/mark/encode/defined.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"defined.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/defined.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAG1C,OAAO,EAAC,aAAa,EAAC,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,aAAa,CAYvD;AA4BD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,aAAa,CAKxE"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/defined.js b/build/src/compile/mark/encode/defined.js new file mode 100644 index 0000000000..de90182ed7 --- /dev/null +++ b/build/src/compile/mark/encode/defined.js @@ -0,0 +1,43 @@ +import { POSITION_SCALE_CHANNELS } from '../../../channel'; +import { hasContinuousDomain } from '../../../scale'; +import { keys } from '../../../util'; +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +import { fieldInvalidPredicate } from './valueref'; +export function defined(model) { + const { config, markDef } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid) { + const signal = allFieldsInvalidPredicate(model, { channels: POSITION_SCALE_CHANNELS }); + if (signal) { + return { defined: { signal } }; + } + } + return {}; +} +function allFieldsInvalidPredicate(model, { invalid = false, channels }) { + const filterIndex = channels.reduce((aggregator, channel) => { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const field = model.vgField(channel, { expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined }); + // While discrete domain scales can handle invalid values, continuous scales can't. + if (field && hasContinuousDomain(scaleType)) { + aggregator[field] = true; + } + } + return aggregator; + }, {}); + const fields = keys(filterIndex); + if (fields.length > 0) { + const op = invalid ? '||' : '&&'; + return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); + } + return undefined; +} +export function valueIfDefined(prop, value) { + if (value !== undefined) { + return { [prop]: signalOrValueRef(value) }; + } + return undefined; +} +//# sourceMappingURL=defined.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/defined.js.map b/build/src/compile/mark/encode/defined.js.map new file mode 100644 index 0000000000..3cf98687c9 --- /dev/null +++ b/build/src/compile/mark/encode/defined.js.map @@ -0,0 +1 @@ +{"version":3,"file":"defined.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/defined.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB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I,KAAK,IAAI,mBAAmB,CAAC,SAAS,CAAC,EAAE;gBAC3C,UAAU,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC;aAC1B;SACF;QACD,OAAO,UAAU,CAAC;IACpB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,MAAM,GAAG,IAAI,CAAC,WAAW,CAAC,CAAC;IACjC,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QACrB,MAAM,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACjC,OAAO,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;KACnF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,IAAY,EAAE,KAAY;IACvD,IAAI,KAAK,KAAK,SAAS,EAAE;QACvB,OAAO,EAAC,CAAC,IAAI,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,EAAC,CAAC;KAC1C;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/index.d.ts b/build/src/compile/mark/encode/index.d.ts new file mode 100644 index 0000000000..3692098a3c --- /dev/null +++ b/build/src/compile/mark/encode/index.d.ts @@ -0,0 +1,12 @@ +export { aria } from './aria'; +export { baseEncodeEntry } from './base'; +export { color } from './color'; +export { wrapCondition } from './conditional'; +export { defined, valueIfDefined } from './defined'; +export { nonPosition } from './nonposition'; +export { pointPosition } from './position-point'; +export { pointOrRangePosition, rangePosition } from './position-range'; +export { rectPosition } from './position-rect'; +export { text } from './text'; +export { tooltip, tooltipRefForEncoding } from './tooltip'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/index.d.ts.map b/build/src/compile/mark/encode/index.d.ts.map new file mode 100644 index 0000000000..316d1d835b --- /dev/null +++ b/build/src/compile/mark/encode/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/index.js b/build/src/compile/mark/encode/index.js new file mode 100644 index 0000000000..df9b306a7f --- /dev/null +++ b/build/src/compile/mark/encode/index.js @@ -0,0 +1,12 @@ +export { aria } from './aria'; +export { baseEncodeEntry } from './base'; +export { color } from './color'; +export { wrapCondition } from './conditional'; +export { defined, valueIfDefined } from './defined'; +export { nonPosition } from './nonposition'; +export { pointPosition } from './position-point'; +export { pointOrRangePosition, rangePosition } from './position-range'; +export { rectPosition } from './position-rect'; +export { text } from './text'; +export { tooltip, tooltipRefForEncoding } from './tooltip'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/index.js.map b/build/src/compile/mark/encode/index.js.map new file mode 100644 index 0000000000..7059f397c3 --- /dev/null +++ b/build/src/compile/mark/encode/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,eAAe,EAAC,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,OAAO,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,oBAAoB,EAAE,aAAa,EAAC,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAE,qBAAqB,EAAC,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/nonposition.d.ts b/build/src/compile/mark/encode/nonposition.d.ts new file mode 100644 index 0000000000..69371aedb7 --- /dev/null +++ b/build/src/compile/mark/encode/nonposition.d.ts @@ -0,0 +1,14 @@ +import type { SignalRef } from 'vega'; +import { NonPositionScaleChannel } from '../../../channel'; +import { Value } from '../../../channeldef'; +import { VgEncodeChannel, VgEncodeEntry, VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +/** + * Return encode for non-positional channels with scales. (Text doesn't have scale.) + */ +export declare function nonPosition(channel: NonPositionScaleChannel, model: UnitModel, opt?: { + defaultValue?: Value | SignalRef; + vgChannel?: VgEncodeChannel; + defaultRef?: VgValueRef; +}): VgEncodeEntry; +//# sourceMappingURL=nonposition.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/nonposition.d.ts.map b/build/src/compile/mark/encode/nonposition.d.ts.map new file mode 100644 index 0000000000..e8c3e47ae7 --- /dev/null +++ b/build/src/compile/mark/encode/nonposition.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"nonposition.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/nonposition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AACpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,KAAK,EAAC,MAAM,qBAAqB,CAAC;AAC1C,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC;;GAEG;AACH,wBAAgB,WAAW,CACzB,OAAO,EAAE,uBAAuB,EAChC,KAAK,EAAE,SAAS,EAChB,GAAG,GAAE;IACH,YAAY,CAAC,EAAE,KAAK,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,eAAe,CAAC;IAC5B,UAAU,CAAC,EAAE,UAAU,CAAC;CACpB,GACL,aAAa,CA4Bf"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/nonposition.js b/build/src/compile/mark/encode/nonposition.js new file mode 100644 index 0000000000..21b337dd4e --- /dev/null +++ b/build/src/compile/mark/encode/nonposition.js @@ -0,0 +1,32 @@ +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +import { wrapCondition } from './conditional'; +import * as ref from './valueref'; +/** + * Return encode for non-positional channels with scales. (Text doesn't have scale.) + */ +export function nonPosition(channel, model, opt = {}) { + const { markDef, encoding, config } = model; + const { vgChannel } = opt; + let { defaultRef, defaultValue } = opt; + if (defaultRef === undefined) { + // prettier-ignore + defaultValue ?? (defaultValue = getMarkPropOrConfig(channel, markDef, config, { vgChannel, ignoreVgConfig: true })); + if (defaultValue !== undefined) { + defaultRef = signalOrValueRef(defaultValue); + } + } + const channelDef = encoding[channel]; + return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => { + return ref.midPoint({ + channel, + channelDef: cDef, + markDef, + config, + scaleName: model.scaleName(channel), + scale: model.getScaleComponent(channel), + stack: null, + defaultRef + }); + }); +} +//# sourceMappingURL=nonposition.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/nonposition.js.map b/build/src/compile/mark/encode/nonposition.js.map new file mode 100644 index 0000000000..2a1f75857b --- /dev/null +++ b/build/src/compile/mark/encode/nonposition.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nonposition.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/nonposition.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAEnE,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,MAAM,UAAU,WAAW,CACzB,OAAgC,EAChC,KAAgB,EAChB,MAII,EAAE;IAEN,MAAM,EAAC,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAC,GAAG,KAAK,CAAC;IAC1C,MAAM,EAAC,SAAS,EAAC,GAAG,GAAG,CAAC;IACxB,IAAI,EAAC,UAAU,EAAE,YAAY,EAAC,GAAG,GAAG,CAAC;IAErC,IAAI,UAAU,KAAK,SAAS,EAAE;QAC5B,kBAAkB;QAClB,YAAY,KAAZ,YAAY,GAAK,mBAAmB,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,EAAC,SAAS,EAAE,cAAc,EAAE,IAAI,EAAC,CAAC,EAAC;QAElG,IAAI,YAAY,KAAK,SAAS,EAAE;YAC9B,UAAU,GAAG,gBAAgB,CAAC,YAAY,CAAC,CAAC;SAC7C;KACF;IAED,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAErC,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,SAAS,IAAI,OAAO,EAAE,IAAI,CAAC,EAAE;QACnE,OAAO,GAAG,CAAC,QAAQ,CAAC;YAClB,OAAO;YACP,UAAU,EAAE,IAAI;YAChB,OAAO;YACP,MAAM;YACN,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;YACnC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,IAAI;YACX,UAAU;SACX,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/offset.d.ts b/build/src/compile/mark/encode/offset.d.ts new file mode 100644 index 0000000000..debf300e4a --- /dev/null +++ b/build/src/compile/mark/encode/offset.d.ts @@ -0,0 +1,21 @@ +/** + * Utility files for producing Vega ValueRef for marks + */ +import type { SignalRef } from 'vega'; +import { PolarPositionChannel, PositionChannel } from '../../../channel'; +import { Encoding } from '../../../encoding'; +import { Mark, MarkDef } from '../../../mark'; +import { VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export interface Offset { + offsetType?: 'visual' | 'encoding'; + offset?: number | VgValueRef; +} +export declare function positionOffset({ channel: baseChannel, markDef, encoding, model, bandPosition }: { + channel: PositionChannel | PolarPositionChannel; + markDef: MarkDef; + encoding?: Encoding; + model?: UnitModel; + bandPosition?: number; +}): Offset; +//# sourceMappingURL=offset.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/offset.d.ts.map b/build/src/compile/mark/encode/offset.d.ts.map new file mode 100644 index 0000000000..4d0a86b3c2 --- /dev/null +++ b/build/src/compile/mark/encode/offset.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"offset.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/offset.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AACpC,OAAO,EAAC,oBAAoB,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,MAAM,WAAW,MAAM;IACrB,UAAU,CAAC,EAAE,QAAQ,GAAG,UAAU,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,GAAG,UAAU,CAAC;CAC9B;AAED,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EAAE,WAAW,EACpB,OAAO,EACP,QAAa,EACb,KAAK,EACL,YAAY,EACb,EAAE;IACD,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAChD,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC5B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,GAAG,MAAM,CAmCT"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/offset.js b/build/src/compile/mark/encode/offset.js new file mode 100644 index 0000000000..c0e5542ac5 --- /dev/null +++ b/build/src/compile/mark/encode/offset.js @@ -0,0 +1,27 @@ +import { signalOrValueRef } from '../../common'; +import { midPoint } from './valueref'; +export function positionOffset({ channel: baseChannel, markDef, encoding = {}, model, bandPosition }) { + const channel = `${baseChannel}Offset`; // Need to cast as the type can't be inferred automatically + const defaultValue = markDef[channel]; + const channelDef = encoding[channel]; + if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) { + const ref = midPoint({ + channel: channel, + channelDef, + markDef, + config: model?.config, + scaleName: model.scaleName(channel), + scale: model.getScaleComponent(channel), + stack: null, + defaultRef: signalOrValueRef(defaultValue), + bandPosition + }); + return { offsetType: 'encoding', offset: ref }; + } + const markDefOffsetValue = markDef[channel]; + if (markDefOffsetValue) { + return { offsetType: 'visual', offset: markDefOffsetValue }; + } + return {}; +} +//# sourceMappingURL=offset.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/offset.js.map b/build/src/compile/mark/encode/offset.js.map new file mode 100644 index 0000000000..52cb33b6db --- /dev/null +++ b/build/src/compile/mark/encode/offset.js.map @@ -0,0 +1 @@ +{"version":3,"file":"offset.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/offset.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAOpC,MAAM,UAAU,cAAc,CAAC,EAC7B,OAAO,EAAE,WAAW,EACpB,OAAO,EACP,QAAQ,GAAG,EAAE,EACb,KAAK,EACL,YAAY,EAOb;IACC,MAAM,OAAO,GAAG,GAAG,WAAW,QAQX,CAAC,CAAC,2DAA2D;IAEhF,MAAM,YAAY,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IACtC,MAAM,UAAU,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IAErC,IAAI,CAAC,OAAO,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,CAAC,IAAI,UAAU,EAAE;QAClE,MAAM,GAAG,GAAG,QAAQ,CAAC;YACnB,OAAO,EAAE,OAAO;YAChB,UAAU;YACV,OAAO;YACP,MAAM,EAAE,KAAK,EAAE,MAAM;YACrB,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,OAAO,CAAC;YACnC,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC;YACvC,KAAK,EAAE,IAAI;YACX,UAAU,EAAE,gBAAgB,CAAC,YAAY,CAAC;YAC1C,YAAY;SACb,CAAC,CAAC;QACH,OAAO,EAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,EAAC,CAAC;KAC9C;IAED,MAAM,kBAAkB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC5C,IAAI,kBAAkB,EAAE;QACtB,OAAO,EAAC,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,kBAAkB,EAAC,CAAC;KAC3D;IAED,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-align.d.ts b/build/src/compile/mark/encode/position-align.d.ts new file mode 100644 index 0000000000..90fb594f8d --- /dev/null +++ b/build/src/compile/mark/encode/position-align.d.ts @@ -0,0 +1,5 @@ +import { SignalRef } from 'vega'; +import { Config } from '../../../config'; +import { Mark, MarkDef } from '../../../mark'; +export declare function vgAlignedPositionChannel(channel: 'x' | 'y' | 'radius' | 'theta', markDef: MarkDef, config: Config, defaultAlign?: 'top' | 'middle'): any; +//# sourceMappingURL=position-align.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-align.d.ts.map b/build/src/compile/mark/encode/position-align.d.ts.map new file mode 100644 index 0000000000..986b803ae4 --- /dev/null +++ b/build/src/compile/mark/encode/position-align.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"position-align.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-align.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,SAAS,EAAe,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AAEvC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAgB5C,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,EACvC,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EACjC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EACzB,YAAY,GAAE,KAAK,GAAG,QAAmB,OAsB1C"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-align.js b/build/src/compile/mark/encode/position-align.js new file mode 100644 index 0000000000..5619f4c1b2 --- /dev/null +++ b/build/src/compile/mark/encode/position-align.js @@ -0,0 +1,36 @@ +import { getVgPositionChannel } from '../../../channel'; +import * as log from '../../../log'; +import { isSignalRef } from '../../../vega.schema'; +import { getMarkPropOrConfig } from '../../common'; +const ALIGNED_X_CHANNEL = { + left: 'x', + center: 'xc', + right: 'x2' +}; +const BASELINED_Y_CHANNEL = { + top: 'y', + middle: 'yc', + bottom: 'y2' +}; +export function vgAlignedPositionChannel(channel, markDef, config, defaultAlign = 'middle') { + if (channel === 'radius' || channel === 'theta') { + return getVgPositionChannel(channel); + } + const alignChannel = channel === 'x' ? 'align' : 'baseline'; + const align = getMarkPropOrConfig(alignChannel, markDef, config); + let alignExcludingSignal; + if (isSignalRef(align)) { + log.warn(log.message.rangeMarkAlignmentCannotBeExpression(alignChannel)); + alignExcludingSignal = undefined; + } + else { + alignExcludingSignal = align; + } + if (channel === 'x') { + return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')]; + } + else { + return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign]; + } +} +//# sourceMappingURL=position-align.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-align.js.map b/build/src/compile/mark/encode/position-align.js.map new file mode 100644 index 0000000000..8429e995d5 --- /dev/null +++ b/build/src/compile/mark/encode/position-align.js.map @@ -0,0 +1 @@ +{"version":3,"file":"position-align.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-align.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AAEtD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAkB,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAEjD,MAAM,iBAAiB,GAAmC;IACxD,IAAI,EAAE,GAAG;IACT,MAAM,EAAE,IAAI;IACZ,KAAK,EAAE,IAAI;CACZ,CAAC;AAEF,MAAM,mBAAmB,GAAG;IAC1B,GAAG,EAAE,GAAG;IACR,MAAM,EAAE,IAAI;IACZ,MAAM,EAAE,IAAI;CACb,CAAC;AAEF,MAAM,UAAU,wBAAwB,CACtC,OAAuC,EACvC,OAAiC,EACjC,MAAyB,EACzB,eAAiC,QAAQ;IAEzC,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,OAAO,EAAE;QAC/C,OAAO,oBAAoB,CAAC,OAAO,CAAC,CAAC;KACtC;IACD,MAAM,YAAY,GAAG,OAAO,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IAC5D,MAAM,KAAK,GAAG,mBAAmB,CAAC,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAEjE,IAAI,oBAA0C,CAAC;IAE/C,IAAI,WAAW,CAAC,KAAK,CAAC,EAAE;QACtB,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,oCAAoC,CAAC,YAAY,CAAC,CAAC,CAAC;QACzE,oBAAoB,GAAG,SAAS,CAAC;KAClC;SAAM;QACL,oBAAoB,GAAG,KAAK,CAAC;KAC9B;IAED,IAAI,OAAO,KAAK,GAAG,EAAE;QACnB,OAAO,iBAAiB,CAAC,oBAAoB,IAAI,CAAC,YAAY,KAAK,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;KAChG;SAAM;QACL,OAAO,mBAAmB,CAAC,oBAAoB,IAAI,YAAY,CAAC,CAAC;KAClE;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-point.d.ts b/build/src/compile/mark/encode/position-point.d.ts new file mode 100644 index 0000000000..a007cb316b --- /dev/null +++ b/build/src/compile/mark/encode/position-point.d.ts @@ -0,0 +1,28 @@ +import { PolarPositionChannel, PositionChannel } from '../../../channel'; +import { VgValueRef } from '../../../vega.schema'; +import { ScaleComponent } from '../../scale/component'; +import { UnitModel } from '../../unit'; +import * as ref from './valueref'; +/** + * Return encode for point (non-band) position channels. + */ +export declare function pointPosition(channel: 'x' | 'y' | 'theta' | 'radius', model: UnitModel, { defaultPos, vgChannel }: { + defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; + vgChannel?: 'x' | 'y' | 'xc' | 'yc'; +}): { + [x: string]: VgValueRef | VgValueRef[]; +}; +/** + * @return Vega ValueRef for normal x- or y-position without projection + */ +export declare function positionRef(params: ref.MidPointParams & { + channel: 'x' | 'y' | 'radius' | 'theta'; +}): VgValueRef | VgValueRef[]; +export declare function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }: { + model: UnitModel; + defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null; + channel: PositionChannel | PolarPositionChannel; + scaleName: string; + scale: ScaleComponent; +}): () => VgValueRef; +//# sourceMappingURL=position-point.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-point.d.ts.map b/build/src/compile/mark/encode/position-point.d.ts.map new file mode 100644 index 0000000000..c563ab88b3 --- /dev/null +++ b/build/src/compile/mark/encode/position-point.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"position-point.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-point.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,oBAAoB,EACpB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAI1B,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAC,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EACvC,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,SAAS,EACV,EAAE;IACD,UAAU,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;IACrD,SAAS,CAAC,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,GAAG,IAAI,CAAC;CACrC;;EA6CF;AAKD;;GAEG;AACH,wBAAgB,WAAW,CACzB,MAAM,EAAE,GAAG,CAAC,cAAc,GAAG;IAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,QAAQ,GAAG,OAAO,CAAC;CACzC,GACA,UAAU,GAAG,UAAU,EAAE,CA6B3B;AAED,wBAAgB,uBAAuB,CAAC,EACtC,KAAK,EACL,UAAU,EACV,OAAO,EACP,SAAS,EACT,KAAK,EACN,EAAE;IACD,KAAK,EAAE,SAAS,CAAC;IACjB,UAAU,EAAE,KAAK,GAAG,WAAW,GAAG,WAAW,GAAG,IAAI,CAAC;IACrD,OAAO,EAAE,eAAe,GAAG,oBAAoB,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,cAAc,CAAC;CACvB,GAAG,MAAM,UAAU,CA0DnB"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-point.js b/build/src/compile/mark/encode/position-point.js new file mode 100644 index 0000000000..1ca5e3d20b --- /dev/null +++ b/build/src/compile/mark/encode/position-point.js @@ -0,0 +1,139 @@ +import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isXorY } from '../../../channel'; +import { isFieldDef, isFieldOrDatumDef } from '../../../channeldef'; +import { ScaleType } from '../../../scale'; +import { contains } from '../../../util'; +import { getMarkPropOrConfig } from '../../common'; +import { positionOffset } from './offset'; +import * as ref from './valueref'; +/** + * Return encode for point (non-band) position channels. + */ +export function pointPosition(channel, model, { defaultPos, vgChannel }) { + const { encoding, markDef, config, stack } = model; + const channelDef = encoding[channel]; + const channel2Def = encoding[getSecondaryRangeChannel(channel)]; + const scaleName = model.scaleName(channel); + const scale = model.getScaleComponent(channel); + const { offset, offsetType } = positionOffset({ + channel, + markDef, + encoding, + model, + bandPosition: 0.5 + }); + // Get default position or position from mark def + const defaultRef = pointPositionDefaultRef({ + model, + defaultPos, + channel, + scaleName, + scale + }); + const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) + ? // use geopoint output if there are lat/long and there is no point position overriding lat/long. + { field: model.getName(channel) } + : positionRef({ + channel, + channelDef, + channel2Def, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef, + bandPosition: offsetType === 'encoding' ? 0 : undefined + }); + return valueRef ? { [vgChannel || channel]: valueRef } : undefined; +} +// TODO: we need to find a way to refactor these so that scaleName is a part of scale +// but that's complicated. For now, this is a huge step moving forward. +/** + * @return Vega ValueRef for normal x- or y-position without projection + */ +export function positionRef(params) { + const { channel, channelDef, scaleName, stack, offset, markDef } = params; + // This isn't a part of midPoint because we use midPoint for non-position too + if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { + if (isFieldDef(channelDef)) { + let bandPosition = channelDef.bandPosition; + if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) { + // theta and radius of text mark should use bandPosition = 0.5 by default + // so that labels for arc marks are centered automatically + bandPosition = 0.5; + } + if (bandPosition !== undefined) { + return ref.interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: channelDef, + startSuffix: 'start', + bandPosition, + offset + }); + } + } + // x or y use stack_end so that stacked line's point mark use stack_end too. + return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'end' }, { offset }); + } + return ref.midPointRefWithPositionInvalidTest(params); +} +export function pointPositionDefaultRef({ model, defaultPos, channel, scaleName, scale }) { + const { markDef, config } = model; + return () => { + const mainChannel = getMainRangeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { vgChannel }); + if (definedValueOrConfig !== undefined) { + return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig); + } + switch (defaultPos) { + case 'zeroOrMin': + case 'zeroOrMax': + if (scaleName) { + const scaleType = scale.get('type'); + if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) { + // Log scales cannot have zero. + // Zero in time scale is arbitrary, and does not affect ratio. + // (Time is an interval level of measurement, not ratio). + // See https://en.wikipedia.org/wiki/Level_of_measurement for more info. + } + else { + if (scale.domainDefinitelyIncludesZero()) { + return { + scale: scaleName, + value: 0 + }; + } + } + } + if (defaultPos === 'zeroOrMin') { + return mainChannel === 'y' ? { field: { group: 'height' } } : { value: 0 }; + } + else { + // zeroOrMax + switch (mainChannel) { + case 'radius': + // max of radius is min(width, height) / 2 + return { + signal: `min(${model.width.signal},${model.height.signal})/2` + }; + case 'theta': + return { signal: '2*PI' }; + case 'x': + return { field: { group: 'width' } }; + case 'y': + return { value: 0 }; + } + } + break; + case 'mid': { + const sizeRef = model[getSizeChannel(channel)]; + return { ...sizeRef, mult: 0.5 }; + } + } + // defaultPos === null + return undefined; + }; +} +//# sourceMappingURL=position-point.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-point.js.map b/build/src/compile/mark/encode/position-point.js.map new file mode 100644 index 0000000000..444f511d5c --- /dev/null +++ b/build/src/compile/mark/encode/position-point.js.map @@ -0,0 +1 @@ +{"version":3,"file":"position-point.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-point.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,MAAM,EAGP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,UAAU,EAAE,iBAAiB,EAAgB,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAC,SAAS,EAAC,MAAM,gBAAgB,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAEvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,cAAc,CAAC;AAGjD,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC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KAAK,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,MAAM,KAAK;6BAC9D,CAAC;wBACJ,KAAK,OAAO;4BACV,OAAO,EAAC,MAAM,EAAE,MAAM,EAAC,CAAC;wBAC1B,KAAK,GAAG;4BACN,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,OAAO,EAAC,EAAC,CAAC;wBACnC,KAAK,GAAG;4BACN,OAAO,EAAC,KAAK,EAAE,CAAC,EAAC,CAAC;qBACrB;iBACF;gBACD,MAAM;YACR,KAAK,KAAK,CAAC,CAAC;gBACV,MAAM,OAAO,GAAG,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;gBAC/C,OAAO,EAAC,GAAG,OAAO,EAAE,IAAI,EAAE,GAAG,EAAC,CAAC;aAChC;SACF;QACD,sBAAsB;QACtB,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-range.d.ts b/build/src/compile/mark/encode/position-range.d.ts new file mode 100644 index 0000000000..c9e24e9cfd --- /dev/null +++ b/build/src/compile/mark/encode/position-range.d.ts @@ -0,0 +1,24 @@ +import { VgEncodeEntry, VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +import * as ref from './valueref'; +/** + * Utility for area/rule position, which can be either point or range. + * (One of the axes should be point and the other should be range.) + */ +export declare function pointOrRangePosition(channel: 'x' | 'y', model: UnitModel, { defaultPos, defaultPos2, range }: { + defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; + defaultPos2: 'zeroOrMin' | 'zeroOrMax'; + range: boolean; +}): Partial> | { + [x: string]: VgValueRef | VgValueRef[]; +}; +export declare function rangePosition(channel: 'x' | 'y' | 'theta' | 'radius', model: UnitModel, { defaultPos, defaultPos2 }: { + defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid'; + defaultPos2: 'zeroOrMin' | 'zeroOrMax'; +}): VgEncodeEntry; +export declare function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }: ref.MidPointParams & { + channel: 'x2' | 'y2' | 'radius2' | 'theta2'; +}): VgValueRef | VgValueRef[]; +//# sourceMappingURL=position-range.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-range.d.ts.map b/build/src/compile/mark/encode/position-range.d.ts.map new file mode 100644 index 0000000000..b5ee355cbe --- /dev/null +++ b/build/src/compile/mark/encode/position-range.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"position-range.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-range.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,aAAa,EAAE,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,GAAG,GAAG,GAAG,EAClB,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,WAAW,EACX,KAAK,EACN,EAAE;IACD,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9C,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC;IACvC,KAAK,EAAE,OAAO,CAAC;CAChB;;;;EAMF;AAED,wBAAgB,aAAa,CAC3B,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,EACvC,KAAK,EAAE,SAAS,EAChB,EACE,UAAU,EACV,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,WAAW,GAAG,WAAW,GAAG,KAAK,CAAC;IAC9C,WAAW,EAAE,WAAW,GAAG,WAAW,CAAC;CACxC,GACA,aAAa,CAiBf;AAkFD,wBAAgB,YAAY,CAAC,EAC3B,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACX,EAAE,GAAG,CAAC,cAAc,GAAG;IACtB,OAAO,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,CAAC;CAC7C,GAAG,UAAU,GAAG,UAAU,EAAE,CAoB5B"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-range.js b/build/src/compile/mark/encode/position-range.js new file mode 100644 index 0000000000..37a087fc1d --- /dev/null +++ b/build/src/compile/mark/encode/position-range.js @@ -0,0 +1,137 @@ +import { getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel } from '../../../channel'; +import { isFieldOrDatumDef } from '../../../channeldef'; +import * as log from '../../../log'; +import { isRelativeBandSize } from '../../../mark'; +import { getMarkStyleConfig } from '../../common'; +import { positionOffset } from './offset'; +import { vgAlignedPositionChannel } from './position-align'; +import { pointPosition, pointPositionDefaultRef } from './position-point'; +import * as ref from './valueref'; +/** + * Utility for area/rule position, which can be either point or range. + * (One of the axes should be point and the other should be range.) + */ +export function pointOrRangePosition(channel, model, { defaultPos, defaultPos2, range }) { + if (range) { + return rangePosition(channel, model, { defaultPos, defaultPos2 }); + } + return pointPosition(channel, model, { defaultPos }); +} +export function rangePosition(channel, model, { defaultPos, defaultPos2 }) { + const { markDef, config } = model; + const channel2 = getSecondaryRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); + const vgChannel = pos2Mixins[sizeChannel] + ? // If there is width/height, we need to position the marks based on the alignment. + vgAlignedPositionChannel(channel, markDef, config) + : // Otherwise, make sure to apply to the right Vg Channel (for arc mark) + getVgPositionChannel(channel); + return { + ...pointPosition(channel, model, { defaultPos, vgChannel }), + ...pos2Mixins + }; +} +/** + * Return encode for x2, y2. + * If channel is not specified, return one channel based on orientation. + */ +function pointPosition2OrSize(model, defaultPos, channel) { + const { encoding, mark, markDef, stack, config } = model; + const baseChannel = getMainRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const channelDef = encoding[baseChannel]; + const scaleName = model.scaleName(baseChannel); + const scale = model.getScaleComponent(baseChannel); + const { offset } = channel in encoding || channel in markDef + ? positionOffset({ channel, markDef, encoding, model }) + : positionOffset({ channel: baseChannel, markDef, encoding, model }); + if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { + const vgSizeChannel = getSizeChannel(channel); + const size = model.markDef[vgSizeChannel]; + if (size != null) { + return { + [vgSizeChannel]: { value: size } + }; + } + else { + return { + [vgChannel]: { field: model.getName(channel) } + }; + } + } + const valueRef = position2Ref({ + channel, + channelDef, + channel2Def: encoding[channel], + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef: undefined + }); + if (valueRef !== undefined) { + return { [vgChannel]: valueRef }; + } + // TODO: check width/height encoding here once we add them + // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: + // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) + return (position2orSize(channel, markDef) || + position2orSize(channel, { + [channel]: getMarkStyleConfig(channel, markDef, config.style), + [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style) + }) || + position2orSize(channel, config[mark]) || + position2orSize(channel, config.mark) || { + [vgChannel]: pointPositionDefaultRef({ + model, + defaultPos, + channel, + scaleName, + scale + })() + }); +} +export function position2Ref({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef }) { + if (isFieldOrDatumDef(channelDef) && + stack && + // If fieldChannel is X and channel is X2 (or Y and Y2) + channel.charAt(0) === stack.fieldChannel.charAt(0)) { + return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, { suffix: 'start' }, { offset }); + } + return ref.midPointRefWithPositionInvalidTest({ + channel, + channelDef: channel2Def, + scaleName, + scale, + stack, + markDef, + config, + offset, + defaultRef + }); +} +function position2orSize(channel, markDef) { + const sizeChannel = getSizeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + if (markDef[vgChannel] !== undefined) { + return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel]) }; + } + else if (markDef[channel] !== undefined) { + return { [vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel]) }; + } + else if (markDef[sizeChannel]) { + const dimensionSize = markDef[sizeChannel]; + if (isRelativeBandSize(dimensionSize)) { + log.warn(log.message.relativeBandSizeNotSupported(sizeChannel)); + } + else { + return { [sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize) }; + } + } + return undefined; +} +//# sourceMappingURL=position-range.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-range.js.map b/build/src/compile/mark/encode/position-range.js.map new file mode 100644 index 0000000000..056134ea34 --- /dev/null +++ b/build/src/compile/mark/encode/position-range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"position-range.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-range.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,mBAAmB,EAAE,wBAAwB,EAAE,cAAc,EAAE,oBAAoB,EAAC,MAAM,kBAAkB,CAAC;AACrH,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,kBAAkB,EAA4B,MAAM,eAAe,CAAC;AAE5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAEhD,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,aAAa,EAAE,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,GAAG,MAAM,YAAY,CAAC;AAElC;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAClC,OAAkB,EAClB,KAAgB,EAChB,EACE,UAAU,EACV,WAAW,EACX,KAAK,EAKN;IAED,IAAI,KAAK,EAAE;QACT,OAAO,aAAa,CAAC,OAAO,E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ACL,CAAC;AAED,SAAS,eAAe,CACtB,OAA2C,EAC3C,OAAyD;IAEzD,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC5C,MAAM,SAAS,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC;IAChD,IAAI,OAAO,CAAC,SAAS,CAAC,KAAK,SAAS,EAAE;QACpC,OAAO,EAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,SAAS,CAAC,CAAC,EAAC,CAAC;KACpF;SAAM,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,SAAS,EAAE;QACzC,OAAO,EAAC,CAAC,SAAS,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,EAAC,CAAC;KAClF;SAAM,IAAI,OAAO,CAAC,WAAW,CAAC,EAAE;QAC/B,MAAM,aAAa,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,kBAAkB,CAAC,aAAa,CAAC,EAAE;YACrC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,4BAA4B,CAAC,WAAW,CAAC,CAAC,CAAC;SACjE;aAAM;YACL,OAAO,EAAC,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,2BAA2B,CAAC,OAAO,EAAE,aAAa,CAAC,EAAC,CAAC;SACjF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-rect.d.ts b/build/src/compile/mark/encode/position-rect.d.ts new file mode 100644 index 0000000000..3d7538b9b6 --- /dev/null +++ b/build/src/compile/mark/encode/position-rect.d.ts @@ -0,0 +1,4 @@ +import { VgEncodeEntry } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export declare function rectPosition(model: UnitModel, channel: 'x' | 'y' | 'theta' | 'radius'): VgEncodeEntry; +//# sourceMappingURL=position-rect.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-rect.d.ts.map b/build/src/compile/mark/encode/position-rect.d.ts.map new file mode 100644 index 0000000000..4cc23f0dc7 --- /dev/null +++ b/build/src/compile/mark/encode/position-rect.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"position-rect.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-rect.ts"],"names":[],"mappings":"AAmBA,OAAO,EAA6B,aAAa,EAAa,MAAM,sBAAsB,CAAC;AAG3F,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAYrC,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,GAAG,aAAa,CAuCrG"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-rect.js b/build/src/compile/mark/encode/position-rect.js new file mode 100644 index 0000000000..3ce4b9a56b --- /dev/null +++ b/build/src/compile/mark/encode/position-rect.js @@ -0,0 +1,310 @@ +import { isArray, isNumber } from 'vega-util'; +import { isBinned, isBinning, isBinParams } from '../../../bin'; +import { getOffsetChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel, isPolarPositionChannel, isXorY } from '../../../channel'; +import { getBandPosition, getBandSize, isFieldDef, isFieldOrDatumDef, vgField } from '../../../channeldef'; +import { getViewConfigDiscreteStep } from '../../../config'; +import * as log from '../../../log'; +import { isRelativeBandSize } from '../../../mark'; +import { hasDiscreteDomain } from '../../../scale'; +import { isSignalRef, isVgRangeStep } from '../../../vega.schema'; +import { getMarkConfig, getMarkPropOrConfig, signalOrStringValue, signalOrValueRef } from '../../common'; +import { nonPosition } from './nonposition'; +import { positionOffset } from './offset'; +import { vgAlignedPositionChannel } from './position-align'; +import { pointPositionDefaultRef } from './position-point'; +import { rangePosition } from './position-range'; +import * as ref from './valueref'; +import { getOffsetScaleChannel } from '../../../channel'; +import { getFirstDefined } from '../../../util'; +import { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../../data/timeunit'; +export function rectPosition(model, channel) { + const { config, encoding, markDef } = model; + const mark = markDef.type; + const channel2 = getSecondaryRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const channelDef = encoding[channel]; + const channelDef2 = encoding[channel2]; + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + const orient = markDef.orient; + const hasSizeDef = encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, { vgChannel: sizeChannel }); + const offsetScaleChannel = getOffsetChannel(channel); + const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); + // x, x2, and width -- we must specify two of these in all conditions + if (isFieldDef(channelDef) && + (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) && + !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) && + !encoding[offsetScaleChannel] && + !hasDiscreteDomain(scaleType)) { + return rectBinPosition({ + fieldDef: channelDef, + fieldDef2: channelDef2, + channel, + model + }); + } + else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) { + return positionAndSize(channelDef, channel, model); + } + else { + return rangePosition(channel, model, { defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin' }); + } +} +function defaultSizeRef(sizeChannel, scaleName, scale, config, bandSize, hasFieldDef, mark) { + if (isRelativeBandSize(bandSize)) { + if (scale) { + const scaleType = scale.get('type'); + if (scaleType === 'band') { + let bandWidth = `bandwidth('${scaleName}')`; + if (bandSize.band !== 1) { + bandWidth = `${bandSize.band} * ${bandWidth}`; + } + const minBandSize = getMarkConfig('minBandSize', { type: mark }, config); + return { signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth }; + } + else if (bandSize.band !== 1) { + log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType)); + bandSize = undefined; + } + } + else { + return { + mult: bandSize.band, + field: { group: sizeChannel } + }; + } + } + else if (isSignalRef(bandSize)) { + return bandSize; + } + else if (bandSize) { + return { value: bandSize }; + } + // no valid band size + if (scale) { + const scaleRange = scale.get('range'); + if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { + return { value: scaleRange.step - 2 }; + } + } + if (!hasFieldDef) { + const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner } = config.scale; + const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts + if (isSignalRef(padding)) { + return { signal: `(1 - (${padding.signal})) * ${sizeChannel}` }; + } + else if (isNumber(padding)) { + return { signal: `${1 - padding} * ${sizeChannel}` }; + } + } + const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel); + return { value: defaultStep - 2 }; +} +/** + * Output position encoding and its size encoding for continuous, point, and band scales. + */ +function positionAndSize(fieldDef, channel, model) { + const { markDef, encoding, config, stack } = model; + const orient = markDef.orient; + const scaleName = model.scaleName(channel); + const scale = model.getScaleComponent(channel); + const vgSizeChannel = getSizeChannel(channel); + const channel2 = getSecondaryRangeChannel(channel); + const offsetScaleChannel = getOffsetChannel(channel); + const offsetScaleName = model.scaleName(offsetScaleChannel); + const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel)); + // use "size" channel for bars, if there is orient and the channel matches the right orientation + const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x'); + // Use size encoding / mark property / config if it exists + let sizeMixins; + if (encoding.size || markDef.size) { + if (useVlSizeChannel) { + sizeMixins = nonPosition('size', model, { + vgChannel: vgSizeChannel, + defaultRef: signalOrValueRef(markDef.size) + }); + } + else { + log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type)); + } + } + const hasSizeFromMarkOrEncoding = !!sizeMixins; + // Otherwise, apply default value + const bandSize = getBandSize({ + channel, + fieldDef, + markDef, + config, + scaleType: (scale || offsetScale)?.get('type'), + useVlSizeChannel + }); + sizeMixins = sizeMixins || { + [vgSizeChannel]: defaultSizeRef(vgSizeChannel, offsetScaleName || scaleName, offsetScale || scale, config, bandSize, !!fieldDef, markDef.type) + }; + /* + Band scales with size value and all point scales, use xc/yc + band=0.5 + + Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. + In this case, size_band is the band specified in the x/y-encoding. + By default band is 1, so `(1 - band) / 2` = 0. + If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 + */ + const defaultBandAlign = (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding + ? 'top' + : 'middle'; + const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign); + const center = vgChannel === 'xc' || vgChannel === 'yc'; + const { offset, offsetType } = positionOffset({ channel, markDef, encoding, model, bandPosition: center ? 0.5 : 0 }); + const posRef = ref.midPointRefWithPositionInvalidTest({ + channel, + channelDef: fieldDef, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef: pointPositionDefaultRef({ model, defaultPos: 'mid', channel, scaleName, scale }), + bandPosition: center + ? offsetType === 'encoding' + ? 0 + : 0.5 + : isSignalRef(bandSize) + ? { signal: `(1-${bandSize})/2` } + : isRelativeBandSize(bandSize) + ? (1 - bandSize.band) / 2 + : 0 + }); + if (vgSizeChannel) { + return { [vgChannel]: posRef, ...sizeMixins }; + } + else { + // otherwise, we must simulate size by setting position2 = position + size + // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) + const vgChannel2 = getVgPositionChannel(channel2); + const sizeRef = sizeMixins[vgSizeChannel]; + const sizeOffset = offset ? { ...sizeRef, offset } : sizeRef; + return { + [vgChannel]: posRef, + // posRef might be an array that wraps position invalid test + [vgChannel2]: isArray(posRef) + ? [posRef[0], { ...posRef[1], offset: sizeOffset }] + : { + ...posRef, + offset: sizeOffset + } + }; + } +} +function getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr) { + if (isPolarPositionChannel(channel)) { + return 0; + } + const isEnd = channel === 'x' || channel === 'y2'; + const spacingOffset = isEnd ? -spacing / 2 : spacing / 2; + if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) { + const reverseExpr = signalOrStringValue(reverse); + const offsetExpr = signalOrStringValue(offset); + const axisTranslateExpr = signalOrStringValue(axisTranslate); + const minBandSizeExpr = signalOrStringValue(minBandSize); + const sign = isEnd ? '' : '-'; + const spacingAndSizeOffset = minBandSize + ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})` + : spacingOffset; + const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : ''; + const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : ''; + const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset; + return { + signal: t + r + o + }; + } + else { + offset = offset || 0; + return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); + } +} +function rectBinPosition({ fieldDef, fieldDef2, channel, model }) { + const { config, markDef, encoding } = model; + const scale = model.getScaleComponent(channel); + const scaleName = model.scaleName(channel); + const scaleType = scale ? scale.get('type') : undefined; + const reverse = scale.get('reverse'); + const bandSize = getBandSize({ channel, fieldDef, markDef, config, scaleType }); + const axis = model.component.axes[channel]?.[0]; + const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5 + const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0; + const channel2 = getSecondaryRangeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const vgChannel2 = getVgPositionChannel(channel2); + const minBandSize = getMarkConfig('minBandSize', markDef, config); + const { offset } = positionOffset({ channel, markDef, encoding, model, bandPosition: 0 }); + const { offset: offset2 } = positionOffset({ channel: channel2, markDef, encoding, model, bandPosition: 0 }); + const bandSizeExpr = ref.binSizeExpr({ fieldDef, scaleName }); + const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr); + const binSpacingOffset2 = getBinSpacing(channel2, spacing, reverse, axisTranslate, offset2 ?? offset, minBandSize, bandSizeExpr); + const bandPositionForBandSize = isSignalRef(bandSize) + ? { signal: `(1-${bandSize.signal})/2` } + : isRelativeBandSize(bandSize) + ? (1 - bandSize.band) / 2 + : 0.5; + const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config }); + if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { + const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5; + return { + [vgChannel2]: rectBinRef({ + fieldDef, + scaleName, + bandPosition: bandPositionForBandSize, + offset: binSpacingOffset2, + useRectOffsetField + }), + [vgChannel]: rectBinRef({ + fieldDef, + scaleName, + bandPosition: isSignalRef(bandPositionForBandSize) + ? { signal: `1-${bandPositionForBandSize.signal}` } + : 1 - bandPositionForBandSize, + offset: binSpacingOffset, + useRectOffsetField + }) + }; + } + else if (isBinned(fieldDef.bin)) { + const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { offset: binSpacingOffset2 }); + if (isFieldDef(fieldDef2)) { + return { + [vgChannel2]: startRef, + [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { offset: binSpacingOffset }) + }; + } + else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { + return { + [vgChannel2]: startRef, + [vgChannel]: { + signal: `scale("${scaleName}", ${vgField(fieldDef, { expr: 'datum' })} + ${fieldDef.bin.step})`, + offset: binSpacingOffset + } + }; + } + } + log.warn(log.message.channelRequiredForBinned(channel2)); + return undefined; +} +/** + * Value Ref for binned fields + */ +function rectBinRef({ fieldDef, scaleName, bandPosition, offset, useRectOffsetField }) { + return ref.interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: fieldDef, + bandPosition, + offset, + ...(useRectOffsetField + ? { + startSuffix: OFFSETTED_RECT_START_SUFFIX, + endSuffix: OFFSETTED_RECT_END_SUFFIX + } + : {}) + }); +} +//# sourceMappingURL=position-rect.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/position-rect.js.map b/build/src/compile/mark/encode/position-rect.js.map new file mode 100644 index 0000000000..7950e7567e --- /dev/null +++ b/build/src/compile/mark/encode/position-rect.js.map @@ -0,0 +1 @@ +{"version":3,"file":"position-rect.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/position-rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EACL,gBAAgB,EAChB,wBAAwB,EACxB,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACtB,MAAM,EAGP,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,UAAU,EAAE,iBAAiB,EAAiB,OAAO,EAAC,MAAM,qBAAqB,CAAC;AACxH,OAAO,EAAS,yBAAyB,EAAC,MAAM,iBAAiB,CAAC;AAElE,OAAO,KAAK,GAAG,MAAM,cAAc,CAAC;AACpC,OAAO,EAAW,kBAAkB,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAC,WAAW,EAAE,aAAa,EAA4B,MAAM,sBAAsB,CAAC;AAC3F,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAGvG,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AACxC,OAAO,EAAC,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC1D,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,aAAa,EAA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C,CAAC,EAAE,CAAC;KACR,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/text.d.ts b/build/src/compile/mark/encode/text.d.ts new file mode 100644 index 0000000000..fb6a7594f8 --- /dev/null +++ b/build/src/compile/mark/encode/text.d.ts @@ -0,0 +1,9 @@ +import { Config } from '../../../config'; +import { Encoding } from '../../../encoding'; +import { VgValueRef } from '../../../vega.schema'; +import { UnitModel } from '../../unit'; +export declare function text(model: UnitModel, channel?: 'text' | 'href' | 'url' | 'description'): Partial>; +export declare function textRef(channelDef: Encoding['text' | 'tooltip'], config: Config, expr?: 'datum' | 'datum.datum'): VgValueRef; +//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/text.d.ts.map b/build/src/compile/mark/encode/text.d.ts.map new file mode 100644 index 0000000000..00ab876121 --- /dev/null +++ b/build/src/compile/mark/encode/text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/text.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AAC3C,OAAO,EAAC,UAAU,EAAC,MAAM,sBAAsB,CAAC;AAGhD,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,IAAI,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,GAAE,MAAM,GAAG,MAAM,GAAG,KAAK,GAAG,aAAsB;;OAG/F;AAED,wBAAgB,OAAO,CACrB,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,SAAS,CAAC,EAChD,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,OAAO,GAAG,aAAuB,GACtC,UAAU,CAYZ"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/text.js b/build/src/compile/mark/encode/text.js new file mode 100644 index 0000000000..0e8a425b7c --- /dev/null +++ b/build/src/compile/mark/encode/text.js @@ -0,0 +1,22 @@ +import { getFormatMixins, isFieldOrDatumDef, isValueDef } from '../../../channeldef'; +import { signalOrValueRef } from '../../common'; +import { formatSignalRef } from '../../format'; +import { wrapCondition } from './conditional'; +export function text(model, channel = 'text') { + const channelDef = model.encoding[channel]; + return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); +} +export function textRef(channelDef, config, expr = 'datum') { + // text + if (channelDef) { + if (isValueDef(channelDef)) { + return signalOrValueRef(channelDef.value); + } + if (isFieldOrDatumDef(channelDef)) { + const { format, formatType } = getFormatMixins(channelDef); + return formatSignalRef({ fieldOrDatumDef: channelDef, format, formatType, expr, config }); + } + } + return undefined; +} +//# sourceMappingURL=text.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/text.js.map b/build/src/compile/mark/encode/text.js.map new file mode 100644 index 0000000000..5c106558a7 --- /dev/null +++ b/build/src/compile/mark/encode/text.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAInF,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAE7C,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,IAAI,CAAC,KAAgB,EAAE,UAAmD,MAAM;IAC9F,MAAM,UAAU,GAAG,KAAK,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;IAC3C,OAAO,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,OAAO,CACrB,UAAgD,EAChD,MAAc,EACd,OAAgC,OAAO;IAEvC,OAAO;IACP,IAAI,UAAU,EAAE;QACd,IAAI,UAAU,CAAC,UAAU,CAAC,EAAE;YAC1B,OAAO,gBAAgB,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;SAC3C;QACD,IAAI,iBAAiB,CAAC,UAAU,CAAC,EAAE;YACjC,MAAM,EAAC,MAAM,EAAE,UAAU,EAAC,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;YACzD,OAAO,eAAe,CAAC,EAAC,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC;SACzF;KACF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/tooltip.d.ts b/build/src/compile/mark/encode/tooltip.d.ts new file mode 100644 index 0000000000..4358294c4a --- /dev/null +++ b/build/src/compile/mark/encode/tooltip.d.ts @@ -0,0 +1,22 @@ +import { Config } from '../../../config'; +import { Encoding } from '../../../encoding'; +import { StackProperties } from '../../../stack'; +import { UnitModel } from '../../unit'; +export declare function tooltip(model: UnitModel, opt?: { + reactiveGeom?: boolean; +}): Partial> | { + tooltip: { + signal: string; + }; +}; +export declare function tooltipData(encoding: Encoding, stack: StackProperties, config: Config, { reactiveGeom }?: { + reactiveGeom?: boolean; +}): {}; +export declare function tooltipRefForEncoding(encoding: Encoding, stack: StackProperties, config: Config, { reactiveGeom }?: { + reactiveGeom?: boolean; +}): { + signal: string; +}; +//# sourceMappingURL=tooltip.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/tooltip.d.ts.map b/build/src/compile/mark/encode/tooltip.d.ts.map new file mode 100644 index 0000000000..60af9322d2 --- /dev/null +++ b/build/src/compile/mark/encode/tooltip.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tooltip.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/tooltip.ts"],"names":[],"mappings":"AAcA,OAAO,EAAC,MAAM,EAAC,MAAM,iBAAiB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAU,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAC,eAAe,EAAC,MAAM,gBAAgB,CAAC;AAK/C,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAIrC,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM;;;;;;EAyC3E;AAED,wBAAgB,WAAW,CACzB,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,EACd,EAAC,YAAY,EAAC,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM,MAyE9C;AAED,wBAAgB,qBAAqB,CACnC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC1B,KAAK,EAAE,eAAe,EACtB,MAAM,EAAE,MAAM,EACd,EAAC,YAAY,EAAC,GAAE;IAAC,YAAY,CAAC,EAAE,OAAO,CAAA;CAAM;;EAM9C"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/tooltip.js b/build/src/compile/mark/encode/tooltip.js new file mode 100644 index 0000000000..d5a812d8ee --- /dev/null +++ b/build/src/compile/mark/encode/tooltip.js @@ -0,0 +1,118 @@ +import { array, isArray, isObject, isString } from 'vega-util'; +import { isBinned } from '../../../bin'; +import { getMainRangeChannel, isXorY, THETA, RADIUS } from '../../../channel'; +import { defaultTitle, getFieldDef, getFormatMixins, hasConditionalFieldDef, isFieldDef, isTypedFieldDef, vgField } from '../../../channeldef'; +import { forEach } from '../../../encoding'; +import { entries } from '../../../util'; +import { isSignalRef } from '../../../vega.schema'; +import { getMarkPropOrConfig } from '../../common'; +import { binFormatExpression, formatSignalRef } from '../../format'; +import { wrapCondition } from './conditional'; +import { textRef } from './text'; +export function tooltip(model, opt = {}) { + const { encoding, markDef, config, stack } = model; + const channelDef = encoding.tooltip; + if (isArray(channelDef)) { + return { tooltip: tooltipRefForEncoding({ tooltip: channelDef }, stack, config, opt) }; + } + else { + const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; + return wrapCondition(model, channelDef, 'tooltip', cDef => { + // use valueRef based on channelDef first + const tooltipRefFromChannelDef = textRef(cDef, config, datum); + if (tooltipRefFromChannelDef) { + return tooltipRefFromChannelDef; + } + if (cDef === null) { + // Allow using encoding.tooltip = null to disable tooltip + return undefined; + } + let markTooltip = getMarkPropOrConfig('tooltip', markDef, config); + if (markTooltip === true) { + markTooltip = { content: 'encoding' }; + } + if (isString(markTooltip)) { + return { value: markTooltip }; + } + else if (isObject(markTooltip)) { + // `tooltip` is `{fields: 'encodings' | 'fields'}` + if (isSignalRef(markTooltip)) { + return markTooltip; + } + else if (markTooltip.content === 'encoding') { + return tooltipRefForEncoding(encoding, stack, config, opt); + } + else { + return { signal: datum }; + } + } + return undefined; + }); + } +} +export function tooltipData(encoding, stack, config, { reactiveGeom } = {}) { + const formatConfig = { ...config, ...config.tooltipFormat }; + const toSkip = {}; + const expr = reactiveGeom ? 'datum.datum' : 'datum'; + const tuples = []; + function add(fDef, channel) { + const mainChannel = getMainRangeChannel(channel); + const fieldDef = isTypedFieldDef(fDef) + ? fDef + : { + ...fDef, + type: encoding[mainChannel].type // for secondary field def, copy type from main channel + }; + const title = fieldDef.title || defaultTitle(fieldDef, formatConfig); + const key = array(title).join(', ').replaceAll(/"/g, '\\"'); + let value; + if (isXorY(channel)) { + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef2 = getFieldDef(encoding[channel2]); + if (isBinned(fieldDef.bin) && fieldDef2) { + const startField = vgField(fieldDef, { expr }); + const endField = vgField(fieldDef2, { expr }); + const { format, formatType } = getFormatMixins(fieldDef); + value = binFormatExpression(startField, endField, format, formatType, formatConfig); + toSkip[channel2] = true; + } + } + if ((isXorY(channel) || channel === THETA || channel === RADIUS) && + stack && + stack.fieldChannel === channel && + stack.offset === 'normalize') { + const { format, formatType } = getFormatMixins(fieldDef); + value = formatSignalRef({ + fieldOrDatumDef: fieldDef, + format, + formatType, + expr, + config: formatConfig, + normalizeStack: true + }).signal; + } + value ?? (value = textRef(fieldDef, formatConfig, expr).signal); + tuples.push({ channel, key, value }); + } + forEach(encoding, (channelDef, channel) => { + if (isFieldDef(channelDef)) { + add(channelDef, channel); + } + else if (hasConditionalFieldDef(channelDef)) { + add(channelDef.condition, channel); + } + }); + const out = {}; + for (const { channel, key, value } of tuples) { + if (!toSkip[channel] && !out[key]) { + out[key] = value; + } + } + return out; +} +export function tooltipRefForEncoding(encoding, stack, config, { reactiveGeom } = {}) { + const data = tooltipData(encoding, stack, config, { reactiveGeom }); + const keyValues = entries(data).map(([key, value]) => `"${key}": ${value}`); + return keyValues.length > 0 ? { signal: `{${keyValues.join(', ')}}` } : undefined; +} +//# sourceMappingURL=tooltip.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/tooltip.js.map b/build/src/compile/mark/encode/tooltip.js.map new file mode 100644 index 0000000000..a457e35637 --- /dev/null +++ b/build/src/compile/mark/encode/tooltip.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tooltip.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/tooltip.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7D,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAE,MAAM,EAAW,KAAK,EAAE,MAAM,EAAC,MAAM,kBAAkB,CAAC;AACrF,OAAO,EACL,YAAY,EACZ,WAAW,EACX,eAAe,EACf,sBAAsB,EACtB,UAAU,EACV,eAAe,EAGf,OAAO,EACR,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAW,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAEpD,OAAO,EAAC,OAAO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,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAClF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/valueref.d.ts b/build/src/compile/mark/encode/valueref.d.ts new file mode 100644 index 0000000000..c153e2add3 --- /dev/null +++ b/build/src/compile/mark/encode/valueref.d.ts @@ -0,0 +1,82 @@ +/** + * Utility files for producing Vega ValueRef for marks + */ +import type { SignalRef } from 'vega'; +import { Channel, PolarPositionChannel, PositionChannel } from '../../../channel'; +import { ChannelDef, DatumDef, FieldDef, FieldDefBase, FieldName, FieldRefOption, SecondaryChannelDef, SecondaryFieldDef, TypedFieldDef, Value } from '../../../channeldef'; +import { Config } from '../../../config'; +import { Mark, MarkDef } from '../../../mark'; +import { StackProperties } from '../../../stack'; +import { VgValueRef } from '../../../vega.schema'; +import { ScaleComponent } from '../../scale/component'; +export declare function midPointRefWithPositionInvalidTest(params: MidPointParams & { + channel: PositionChannel | PolarPositionChannel; +}): VgValueRef | VgValueRef[]; +export declare function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }: { + fieldDef: FieldDef; + channel: PositionChannel | PolarPositionChannel; + markDef: MarkDef; + ref: VgValueRef; + config: Config; +}): VgValueRef | VgValueRef[]; +export declare function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel): { + field: { + group: string; + }; + value?: undefined; + test: string; +} | { + value: number; + field?: undefined; + test: string; +}; +export declare function fieldInvalidPredicate(field: FieldName | FieldDef, invalid?: boolean): string; +export declare function datumDefToExpr(datumDef: DatumDef): string; +export declare function valueRefForFieldOrDatumDef(fieldDef: FieldDefBase | DatumDef, scaleName: string, opt: FieldRefOption, encode: { + offset?: number | VgValueRef; + band?: number | boolean | SignalRef; +}): VgValueRef; +/** + * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. + */ +export declare function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, endSuffix, bandPosition }: { + scaleName: string; + fieldOrDatumDef: TypedFieldDef; + fieldOrDatumDef2?: SecondaryFieldDef; + startSuffix?: string; + endSuffix?: string; + offset: number | SignalRef | VgValueRef; + bandPosition: number | SignalRef; +}): VgValueRef; +export declare function binSizeExpr({ scaleName, fieldDef }: { + scaleName: string; + fieldDef: TypedFieldDef; +}): string; +export interface MidPointParams { + channel: Channel; + channelDef: ChannelDef; + channel2Def?: SecondaryChannelDef; + markDef: MarkDef; + config: Config; + scaleName: string; + scale: ScaleComponent; + stack?: StackProperties; + offset?: number | SignalRef | VgValueRef; + defaultRef: VgValueRef | (() => VgValueRef); + bandPosition?: number | SignalRef; +} +/** + * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. + */ +export declare function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, bandPosition }: MidPointParams): VgValueRef; +/** + * Convert special "width" and "height" values in Vega-Lite into Vega value ref. + */ +export declare function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef): SignalRef | { + value: string | number | boolean | string[] | number[] | import("vega").LinearGradient | import("vega").RadialGradient; +} | { + field: { + group: string; + }; +}; +//# sourceMappingURL=valueref.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/valueref.d.ts.map b/build/src/compile/mark/encode/valueref.d.ts.map new file mode 100644 index 0000000000..9ab407239c --- /dev/null +++ b/build/src/compile/mark/encode/valueref.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"valueref.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/valueref.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAIpC,OAAO,EAAC,OAAO,EAAuB,oBAAoB,EAAE,eAAe,EAAY,MAAM,kBAAkB,CAAC;AAChH,OAAO,EA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C,EAAE,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;IACzC,UAAU,EAAE,UAAU,GAAG,CAAC,MAAM,UAAU,CAAC,CAAC;IAE5C,YAAY,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,EACvB,OAAO,EACP,UAAU,EACV,WAAW,EACX,OAAO,EACP,MAAM,EACN,SAAS,EACT,KAAK,EACL,KAAK,EACL,MAAM,EACN,UAAU,EACV,YAAY,EACb,EAAE,cAAc,GAAG,UAAU,CAuF7B;AAED;;GAEG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS;;;;;;EAOrF"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/valueref.js b/build/src/compile/mark/encode/valueref.js new file mode 100644 index 0000000000..38e0af9ca9 --- /dev/null +++ b/build/src/compile/mark/encode/valueref.js @@ -0,0 +1,222 @@ +import { isFunction, isString } from 'vega-util'; +import { isCountingAggregateOp } from '../../../aggregate'; +import { isBinned, isBinning } from '../../../bin'; +import { getMainRangeChannel, X, X2, Y2 } from '../../../channel'; +import { binRequiresRange, getBandPosition, isDatumDef, isFieldDef, isFieldOrDatumDef, isTypedFieldDef, isValueDef, vgField } from '../../../channeldef'; +import { dateTimeToExpr, isDateTime } from '../../../datetime'; +import { isExprRef } from '../../../expr'; +import * as log from '../../../log'; +import { isPathMark } from '../../../mark'; +import { fieldValidPredicate } from '../../../predicate'; +import { hasDiscreteDomain, isContinuousToContinuous } from '../../../scale'; +import { TEMPORAL } from '../../../type'; +import { contains, stringify } from '../../../util'; +import { isSignalRef } from '../../../vega.schema'; +import { getMarkPropOrConfig, signalOrValueRef } from '../../common'; +export function midPointRefWithPositionInvalidTest(params) { + const { channel, channelDef, markDef, scale, config } = params; + const ref = midPoint(params); + // Wrap to check if the positional value is invalid, if so, plot the point on the min value + if ( + // Only this for field def without counting aggregate (as count wouldn't be null) + isFieldDef(channelDef) && + !isCountingAggregateOp(channelDef.aggregate) && + // and only for continuous scale + scale && + isContinuousToContinuous(scale.get('type'))) { + return wrapPositionInvalidTest({ + fieldDef: channelDef, + channel, + markDef, + ref, + config + }); + } + return ref; +} +export function wrapPositionInvalidTest({ fieldDef, channel, markDef, ref, config }) { + if (isPathMark(markDef.type)) { + // path mark already use defined to skip points, no need to do it here. + return ref; + } + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid === null) { + // if there is no invalid filter, don't do the invalid test + return [fieldInvalidTestValueRef(fieldDef, channel), ref]; + } + return ref; +} +export function fieldInvalidTestValueRef(fieldDef, channel) { + const test = fieldInvalidPredicate(fieldDef, true); + const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things. + const zeroValueRef = mainChannel === 'y' + ? { field: { group: 'height' } } + : // x / angle / radius can all use 0 + { value: 0 }; + return { test, ...zeroValueRef }; +} +export function fieldInvalidPredicate(field, invalid = true) { + return fieldValidPredicate(isString(field) ? field : vgField(field, { expr: 'datum' }), !invalid); +} +export function datumDefToExpr(datumDef) { + const { datum } = datumDef; + if (isDateTime(datum)) { + return dateTimeToExpr(datum); + } + return `${stringify(datum)}`; +} +export function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) { + const ref = {}; + if (scaleName) { + ref.scale = scaleName; + } + if (isDatumDef(fieldDef)) { + const { datum } = fieldDef; + if (isDateTime(datum)) { + ref.signal = dateTimeToExpr(datum); + } + else if (isSignalRef(datum)) { + ref.signal = datum.signal; + } + else if (isExprRef(datum)) { + ref.signal = datum.expr; + } + else { + ref.value = datum; + } + } + else { + ref.field = vgField(fieldDef, opt); + } + if (encode) { + const { offset, band } = encode; + if (offset) { + ref.offset = offset; + } + if (band) { + ref.band = band; + } + } + return ref; +} +/** + * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. + */ +export function interpolatedSignalRef({ scaleName, fieldOrDatumDef, fieldOrDatumDef2, offset, startSuffix, endSuffix = 'end', bandPosition = 0.5 }) { + const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined; + const start = vgField(fieldOrDatumDef, { expr, suffix: startSuffix }); + const end = fieldOrDatumDef2 !== undefined + ? vgField(fieldOrDatumDef2, { expr }) + : vgField(fieldOrDatumDef, { suffix: endSuffix, expr }); + const ref = {}; + if (bandPosition === 0 || bandPosition === 1) { + ref.scale = scaleName; + const field = bandPosition === 0 ? start : end; + ref.field = field; + } + else { + const datum = isSignalRef(bandPosition) + ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}` + : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`; + ref.signal = `scale("${scaleName}", ${datum})`; + } + if (offset) { + ref.offset = offset; + } + return ref; +} +export function binSizeExpr({ scaleName, fieldDef }) { + const start = vgField(fieldDef, { expr: 'datum' }); + const end = vgField(fieldDef, { expr: 'datum', suffix: 'end' }); + return `abs(scale("${scaleName}", ${end}) - scale("${scaleName}", ${start}))`; +} +/** + * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. + */ +export function midPoint({ channel, channelDef, channel2Def, markDef, config, scaleName, scale, stack, offset, defaultRef, bandPosition }) { + // TODO: datum support + if (channelDef) { + /* istanbul ignore else */ + if (isFieldOrDatumDef(channelDef)) { + const scaleType = scale?.get('type'); + if (isTypedFieldDef(channelDef)) { + bandPosition ?? (bandPosition = getBandPosition({ + fieldDef: channelDef, + fieldDef2: channel2Def, + markDef, + config + })); + const { bin, timeUnit, type } = channelDef; + if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) { + // Use middle only for x an y to place marks in the center between start and end of the bin range. + // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. + if (stack?.impute) { + // For stack, we computed bin_mid so we can impute. + return valueRefForFieldOrDatumDef(channelDef, scaleName, { binSuffix: 'mid' }, { offset }); + } + if (bandPosition && !hasDiscreteDomain(scaleType)) { + // if band = 0, no need to call interpolation + // For non-stack, we can just calculate bin mid on the fly using signal. + return interpolatedSignalRef({ scaleName, fieldOrDatumDef: channelDef, bandPosition, offset }); + } + return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { binSuffix: 'range' } : {}, { + offset + }); + } + else if (isBinned(bin)) { + if (isFieldDef(channel2Def)) { + return interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: channelDef, + fieldOrDatumDef2: channel2Def, + bandPosition, + offset + }); + } + else { + const channel2 = channel === X ? X2 : Y2; + log.warn(log.message.channelRequiredForBinned(channel2)); + } + } + } + return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { binSuffix: 'range' } : {}, // no need for bin suffix if there is no scale + { + offset, + // For band, to get mid point, need to offset by half of the band + band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined + }); + } + else if (isValueDef(channelDef)) { + const value = channelDef.value; + const offsetMixins = offset ? { offset } : {}; + return { ...widthHeightValueOrSignalRef(channel, value), ...offsetMixins }; + } + // If channelDef is neither field def or value def, it's a condition-only def. + // In such case, we will use default ref. + } + if (isFunction(defaultRef)) { + defaultRef = defaultRef(); + } + if (defaultRef) { + // for non-position, ref could be undefined. + return { + ...defaultRef, + // only include offset when it is non-zero (zero = no offset) + ...(offset ? { offset } : {}) + }; + } + return defaultRef; +} +/** + * Convert special "width" and "height" values in Vega-Lite into Vega value ref. + */ +export function widthHeightValueOrSignalRef(channel, value) { + if (contains(['x', 'x2'], channel) && value === 'width') { + return { field: { group: 'width' } }; + } + else if (contains(['y', 'y2'], channel) && value === 'height') { + return { field: { group: 'height' } }; + } + return signalOrValueRef(value); +} +//# sourceMappingURL=valueref.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/valueref.js.map b/build/src/compile/mark/encode/valueref.js.map new file mode 100644 index 0000000000..57f00cb992 --- /dev/null +++ b/build/src/compile/mark/encode/valueref.js.map @@ -0,0 +1 @@ +{"version":3,"file":"valueref.js","sourceRoot":"","sources":["../../../../../src/comp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AQ,CAAC,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,IAAI,KAAK,KAAK,QAAQ,EAAE;QAC/D,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,QAAQ,EAAC,EAAC,CAAC;KACnC;IACD,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;AACjC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/zindex.d.ts b/build/src/compile/mark/encode/zindex.d.ts new file mode 100644 index 0000000000..21178a401d --- /dev/null +++ b/build/src/compile/mark/encode/zindex.d.ts @@ -0,0 +1,5 @@ +import { UnitModel } from '../../unit'; +export declare function zindex(model: UnitModel): Partial>; +//# sourceMappingURL=zindex.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/zindex.d.ts.map b/build/src/compile/mark/encode/zindex.d.ts.map new file mode 100644 index 0000000000..3205c9b1ad --- /dev/null +++ b/build/src/compile/mark/encode/zindex.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"zindex.d.ts","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/zindex.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAGrC,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS;;OAQtC"} \ No newline at end of file diff --git a/build/src/compile/mark/encode/zindex.js b/build/src/compile/mark/encode/zindex.js new file mode 100644 index 0000000000..db75440b7e --- /dev/null +++ b/build/src/compile/mark/encode/zindex.js @@ -0,0 +1,13 @@ +import { isValueDef } from '../../../channeldef'; +import { isPathMark } from '../../../mark'; +import { signalOrValueRef } from '../../common'; +import { wrapCondition } from './conditional'; +export function zindex(model) { + const { encoding, mark } = model; + const order = encoding.order; + if (!isPathMark(mark) && isValueDef(order)) { + return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value)); + } + return {}; +} +//# sourceMappingURL=zindex.js.map \ No newline at end of file diff --git a/build/src/compile/mark/encode/zindex.js.map b/build/src/compile/mark/encode/zindex.js.map new file mode 100644 index 0000000000..fb3e375869 --- /dev/null +++ b/build/src/compile/mark/encode/zindex.js.map @@ -0,0 +1 @@ +{"version":3,"file":"zindex.js","sourceRoot":"","sources":["../../../../../src/compile/mark/encode/zindex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,EAAC,MAAM,qBAAqB,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,MAAM,UAAU,MAAM,CAAC,KAAgB;IACrC,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,KAAK,CAAC;IAC/B,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC;IAE7B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;QAC1C,OAAO,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,EAAE,CAAC,gBAAgB,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;KAChF;IACD,OAAO,EAAE,CAAC;AACZ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/geoshape.d.ts b/build/src/compile/mark/geoshape.d.ts new file mode 100644 index 0000000000..afc3e23b08 --- /dev/null +++ b/build/src/compile/mark/geoshape.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const geoshape: MarkCompiler; +//# sourceMappingURL=geoshape.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/geoshape.d.ts.map b/build/src/compile/mark/geoshape.d.ts.map new file mode 100644 index 0000000000..89f169ba75 --- /dev/null +++ b/build/src/compile/mark/geoshape.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geoshape.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/geoshape.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,QAAQ,EAAE,YA4BtB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/geoshape.js b/build/src/compile/mark/geoshape.js new file mode 100644 index 0000000000..13e6b885c9 --- /dev/null +++ b/build/src/compile/mark/geoshape.js @@ -0,0 +1,32 @@ +import { isFieldDef, vgField } from '../../channeldef'; +import { GEOJSON } from '../../type'; +import * as encode from './encode'; +export const geoshape = { + vgMark: 'shape', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }) + }; + }, + postEncodingTransform: (model) => { + const { encoding } = model; + const shapeDef = encoding.shape; + const transform = { + type: 'geoshape', + projection: model.projectionName(), + // as: 'shape', + ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON + ? { field: vgField(shapeDef, { expr: 'datum' }) } + : {}) + }; + return [transform]; + } +}; +//# sourceMappingURL=geoshape.js.map \ No newline at end of file diff --git a/build/src/compile/mark/geoshape.js.map b/build/src/compile/mark/geoshape.js.map new file mode 100644 index 0000000000..116c7b62e1 --- /dev/null +++ b/build/src/compile/mark/geoshape.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geoshape.js","sourceRoot":"","sources":["../../../../src/compile/mark/geoshape.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,UAAU,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AAInC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,QAAQ,GAAiB;IACpC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,QAAQ;aAChB,CAAC;SACH,CAAC;IACJ,CAAC;IACD,qBAAqB,EAAE,CAAC,KAAgB,EAA6B,EAAE;QACrE,MAAM,EAAC,QAAQ,EAAC,GAAG,KAAK,CAAC;QACzB,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC;QAEhC,MAAM,SAAS,GAAwB;YACrC,IAAI,EAAE,UAAU;YAChB,UAAU,EAAE,KAAK,CAAC,cAAc,EAAE;YAClC,eAAe;YACf,GAAG,CAAC,QAAQ,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,IAAI,KAAK,OAAO;gBAC/D,CAAC,CAAC,EAAC,KAAK,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,OAAO,EAAC,CAAC,EAAC;gBAC7C,CAAC,CAAC,EAAE,CAAC;SACR,CAAC;QACF,OAAO,CAAC,SAAS,CAAC,CAAC;IACrB,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/image.d.ts b/build/src/compile/mark/image.d.ts new file mode 100644 index 0000000000..86aeac905d --- /dev/null +++ b/build/src/compile/mark/image.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const image: MarkCompiler; +//# sourceMappingURL=image.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/image.d.ts.map b/build/src/compile/mark/image.d.ts.map new file mode 100644 index 0000000000..c053ebd392 --- /dev/null +++ b/build/src/compile/mark/image.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"image.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/image.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,KAAK,EAAE,YAiBnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/image.js b/build/src/compile/mark/image.js new file mode 100644 index 0000000000..3d4d1634fa --- /dev/null +++ b/build/src/compile/mark/image.js @@ -0,0 +1,20 @@ +import * as encode from './encode'; +export const image = { + vgMark: 'image', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'ignore', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...encode.rectPosition(model, 'x'), + ...encode.rectPosition(model, 'y'), + ...encode.text(model, 'url') + }; + } +}; +//# sourceMappingURL=image.js.map \ No newline at end of file diff --git a/build/src/compile/mark/image.js.map b/build/src/compile/mark/image.js.map new file mode 100644 index 0000000000..1855b5c4de --- /dev/null +++ b/build/src/compile/mark/image.js.map @@ -0,0 +1 @@ +{"version":3,"file":"image.js","sourceRoot":"","sources":["../../../../src/compile/mark/image.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,QAAQ;gBACf,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC;SAC7B,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/init.d.ts b/build/src/compile/mark/init.d.ts new file mode 100644 index 0000000000..8564451869 --- /dev/null +++ b/build/src/compile/mark/init.d.ts @@ -0,0 +1,9 @@ +import { SignalRef } from 'vega'; +import { Config } from '../../config'; +import { Encoding } from '../../encoding'; +import { MarkDef } from '../../mark'; +export declare function initMarkdef(originalMarkDef: MarkDef, encoding: Encoding, config: Config): MarkDef<"square" | "area" | "circle" | "image" | "line" | "rect" | "text" | "point" | "arc" | "rule" | "trail" | "geoshape" | "bar" | "tick", SignalRef>; +export declare function defaultFilled(markDef: MarkDef, config: Config, { graticule }: { + graticule: boolean; +}): boolean; +//# sourceMappingURL=init.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/init.d.ts.map b/build/src/compile/mark/init.d.ts.map new file mode 100644 index 0000000000..1b46aeb382 --- /dev/null +++ b/build/src/compile/mark/init.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,MAAM,CAAC;AAG5C,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAc,MAAM,gBAAgB,CAAC;AAGrD,OAAO,EAQL,OAAO,EAOR,MAAM,YAAY,CAAC;AAKpB,wBAAgB,WAAW,CAAC,eAAe,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,4JA0C1G;AAmBD,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,EAAC,SAAS,EAAC,EAAE;IAAC,SAAS,EAAE,OAAO,CAAA;CAAC,WAO3G"} \ No newline at end of file diff --git a/build/src/compile/mark/init.js b/build/src/compile/mark/init.js new file mode 100644 index 0000000000..a7243b3b02 --- /dev/null +++ b/build/src/compile/mark/init.js @@ -0,0 +1,181 @@ +import { isBinned, isBinning } from '../../bin'; +import { isFieldDef, isNumericDataDef, isUnbinnedQuantitativeFieldOrDatumDef, isTypedFieldDef } from '../../channeldef'; +import { isAggregate } from '../../encoding'; +import { replaceExprRef } from '../../expr'; +import * as log from '../../log'; +import { AREA, BAR, BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX, CIRCLE, IMAGE, LINE, POINT, RECT, RULE, SQUARE, TEXT, TICK } from '../../mark'; +import { QUANTITATIVE, TEMPORAL } from '../../type'; +import { contains, getFirstDefined } from '../../util'; +import { getMarkConfig, getMarkPropOrConfig } from '../common'; +export function initMarkdef(originalMarkDef, encoding, config) { + // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level + const markDef = replaceExprRef(originalMarkDef); + // set orient, which can be overridden by rules as sometimes the specified orient is invalid. + const specifiedOrient = getMarkPropOrConfig('orient', markDef, config); + markDef.orient = orient(markDef.type, encoding, specifiedOrient); + if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { + log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient)); + } + if (markDef.type === 'bar' && markDef.orient) { + const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); + if (cornerRadiusEnd !== undefined) { + const newProps = (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2) + ? ['cornerRadius'] + : BAR_CORNER_RADIUS_END_INDEX[markDef.orient]; + for (const newProp of newProps) { + markDef[newProp] = cornerRadiusEnd; + } + if (markDef.cornerRadiusEnd !== undefined) { + delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius + } + } + } + // set opacity and filled if not specified in mark config + const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); + if (specifiedOpacity === undefined) { + markDef.opacity = opacity(markDef.type, encoding); + } + // set cursor, which should be pointer if href channel is present unless otherwise specified + const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); + if (specifiedCursor === undefined) { + markDef.cursor = cursor(markDef, encoding, config); + } + return markDef; +} +function cursor(markDef, encoding, config) { + if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { + return 'pointer'; + } + return markDef.cursor; +} +function opacity(mark, encoding) { + if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { + // point-based marks + if (!isAggregate(encoding)) { + return 0.7; + } + } + return undefined; +} +export function defaultFilled(markDef, config, { graticule }) { + if (graticule) { + return false; + } + const filledConfig = getMarkConfig('filled', markDef, config); + const mark = markDef.type; + return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); +} +function orient(mark, encoding, specifiedOrient) { + switch (mark) { + case POINT: + case CIRCLE: + case SQUARE: + case TEXT: + case RECT: + case IMAGE: + // orient is meaningless for these marks. + return undefined; + } + const { x, y, x2, y2 } = encoding; + switch (mark) { + case BAR: + if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) { + return 'vertical'; + } + if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) { + return 'horizontal'; + } + if (y2 || x2) { + // Ranged bar does not always have clear orientation, so we allow overriding + if (specifiedOrient) { + return specifiedOrient; + } + // If y is range and x is non-range, non-bin Q + if (!x2) { + if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) { + if (isFieldDef(y) && isBinned(y.bin)) { + return 'horizontal'; + } + } + return 'vertical'; + } + // If x is range and y is non-range, non-bin Q + if (!y2) { + if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) { + if (isFieldDef(x) && isBinned(x.bin)) { + return 'vertical'; + } + } + return 'horizontal'; + } + } + // falls through + case RULE: + // return undefined for line segment rule and bar with both axis ranged + // we have to ignore the case that the data are already binned + if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { + return undefined; + } + // falls through + case AREA: + // If there are range for both x and y, y (vertical) has higher precedence. + if (y2) { + if (isFieldDef(y) && isBinned(y.bin)) { + return 'horizontal'; + } + else { + return 'vertical'; + } + } + else if (x2) { + if (isFieldDef(x) && isBinned(x.bin)) { + return 'vertical'; + } + else { + return 'horizontal'; + } + } + else if (mark === RULE) { + if (x && !y) { + return 'vertical'; + } + else if (y && !x) { + return 'horizontal'; + } + } + // falls through + case LINE: + case TICK: { + const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x); + const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y); + if (specifiedOrient) { + return specifiedOrient; + } + else if (xIsMeasure && !yIsMeasure) { + // Tick is opposite to bar, line, area + return mark !== 'tick' ? 'horizontal' : 'vertical'; + } + else if (!xIsMeasure && yIsMeasure) { + // Tick is opposite to bar, line, area + return mark !== 'tick' ? 'vertical' : 'horizontal'; + } + else if (xIsMeasure && yIsMeasure) { + return 'vertical'; + } + else { + const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL; + const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL; + // x: T, y: N --> vertical tick + if (xIsTemporal && !yIsTemporal) { + return 'vertical'; + } + else if (!xIsTemporal && yIsTemporal) { + return 'horizontal'; + } + } + return undefined; + } + } + return 'vertical'; +} +//# sourceMappingURL=init.js.map \ No newline at end of file diff --git a/build/src/compile/mark/init.js.map b/build/src/compile/mark/init.js.map new file mode 100644 index 0000000000..ea9a1f82a6 --- /dev/null +++ b/build/src/compile/mark/init.js.map @@ -0,0 +1 @@ +{"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../src/compile/mark/init.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC9C,OAAO,EAAC,UAAU,EAAE,gBAAgB,EAAE,qCAAqC,EAAE,eAAe,EAAC,MAAM,kBAAkB,CAAC;AAEtH,OAAO,EAAW,WAAW,EAAC,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY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AC,CAAC,YAAY,CAAC;aACpD;iBAAM,IAAI,UAAU,IAAI,UAAU,EAAE;gBACnC,OAAO,UAAU,CAAC;aACnB;iBAAM;gBACL,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAC9D,MAAM,WAAW,GAAG,eAAe,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC;gBAE9D,+BAA+B;gBAC/B,IAAI,WAAW,IAAI,CAAC,WAAW,EAAE;oBAC/B,OAAO,UAAU,CAAC;iBACnB;qBAAM,IAAI,CAAC,WAAW,IAAI,WAAW,EAAE;oBACtC,OAAO,YAAY,CAAC;iBACrB;aACF;YACD,OAAO,SAAS,CAAC;SAClB;KACF;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/line.d.ts b/build/src/compile/mark/line.d.ts new file mode 100644 index 0000000000..256ed0d928 --- /dev/null +++ b/build/src/compile/mark/line.d.ts @@ -0,0 +1,4 @@ +import { MarkCompiler } from './base'; +export declare const line: MarkCompiler; +export declare const trail: MarkCompiler; +//# sourceMappingURL=line.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/line.d.ts.map b/build/src/compile/mark/line.d.ts.map new file mode 100644 index 0000000000..b470ba6d8f --- /dev/null +++ b/build/src/compile/mark/line.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"line.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/line.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAoBlB,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,YAkBnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/line.js b/build/src/compile/mark/line.js new file mode 100644 index 0000000000..bd46b0f1f9 --- /dev/null +++ b/build/src/compile/mark/line.js @@ -0,0 +1,42 @@ +import * as encode from './encode'; +export const line = { + vgMark: 'line', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid' }), + ...encode.nonPosition('size', model, { + vgChannel: 'strokeWidth' // VL's line size is strokeWidth + }), + ...encode.defined(model) + }; + } +}; +export const trail = { + vgMark: 'trail', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'include', + orient: 'ignore', + theta: 'ignore' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid' }), + ...encode.nonPosition('size', model), + ...encode.defined(model) + }; + } +}; +//# sourceMappingURL=line.js.map \ No newline at end of file diff --git a/build/src/compile/mark/line.js.map b/build/src/compile/mark/line.js.map new file mode 100644 index 0000000000..77658ac9b1 --- /dev/null +++ b/build/src/compile/mark/line.js.map @@ -0,0 +1 @@ +{"version":3,"file":"line.js","sourceRoot":"","sources":["../../../../src/compile/mark/line.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;gBACnC,SAAS,EAAE,aAAa,CAAC,gCAAgC;aAC1D,CAAC;YACF,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,OAAO;IACf,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,SAAS;gBACf,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC;YACpC,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;SACzB,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/mark.d.ts b/build/src/compile/mark/mark.d.ts new file mode 100644 index 0000000000..11401c56be --- /dev/null +++ b/build/src/compile/mark/mark.d.ts @@ -0,0 +1,5 @@ +import { VgCompare } from '../../vega.schema'; +import { UnitModel } from '../unit'; +export declare function parseMarkGroups(model: UnitModel): any[]; +export declare function getSort(model: UnitModel): VgCompare; +//# sourceMappingURL=mark.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/mark.d.ts.map b/build/src/compile/mark/mark.d.ts.map new file mode 100644 index 0000000000..88ace2986c --- /dev/null +++ b/build/src/compile/mark/mark.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/mark.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,SAAS,EAA0C,MAAM,mBAAmB,CAAC;AAErF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AA+BlC,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,EAAE,CAiBvD;AAiMD,wBAAgB,OAAO,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAuDnD"} \ No newline at end of file diff --git a/build/src/compile/mark/mark.js b/build/src/compile/mark/mark.js new file mode 100644 index 0000000000..df85e7afc5 --- /dev/null +++ b/build/src/compile/mark/mark.js @@ -0,0 +1,358 @@ +import { isArray } from 'vega-util'; +import { isFieldDef, isValueDef, vgField } from '../../channeldef'; +import { DataSourceType } from '../../data'; +import { isAggregate, pathGroupingFields } from '../../encoding'; +import { AREA, BAR, isPathMark, LINE, TRAIL } from '../../mark'; +import { isSortByEncoding, isSortField } from '../../sort'; +import { contains, getFirstDefined, isNullOrFalse, keys, omit, pick } from '../../util'; +import { VG_CORNERRADIUS_CHANNELS } from '../../vega.schema'; +import { getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams } from '../common'; +import { arc } from './arc'; +import { area } from './area'; +import { bar } from './bar'; +import { geoshape } from './geoshape'; +import { image } from './image'; +import { line, trail } from './line'; +import { circle, point, square } from './point'; +import { rect } from './rect'; +import { rule } from './rule'; +import { text } from './text'; +import { tick } from './tick'; +const markCompiler = { + arc, + area, + bar, + circle, + geoshape, + image, + line, + point, + rect, + rule, + square, + text, + tick, + trail +}; +export function parseMarkGroups(model) { + if (contains([LINE, AREA, TRAIL], model.mark)) { + const details = pathGroupingFields(model.mark, model.encoding); + if (details.length > 0) { + return getPathGroups(model, details); + } + // otherwise use standard mark groups + } + else if (model.mark === BAR) { + const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config)); + if (model.stack && !model.fieldDef('size') && hasCornerRadius) { + return getGroupsForStackedBarWithCornerRadius(model); + } + } + return getMarkGroup(model); +} +const FACETED_PATH_PREFIX = 'faceted_path_'; +function getPathGroups(model, details) { + // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) + return [ + { + name: model.getName('pathgroup'), + type: 'group', + from: { + facet: { + name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), + data: model.requestDataName(DataSourceType.Main), + groupby: details + } + }, + encode: { + update: { + width: { field: { group: 'width' } }, + height: { field: { group: 'height' } } + } + }, + // With subfacet for line/area group, need to use faceted data from above. + marks: getMarkGroup(model, { fromPrefix: FACETED_PATH_PREFIX }) + } + ]; +} +const STACK_GROUP_PREFIX = 'stack_group_'; +/** + * We need to put stacked bars into groups in order to enable cornerRadius for stacks. + * If stack is used and the model doesn't have size encoding, we put the mark into groups, + * and apply cornerRadius properties at the group. + */ +function getGroupsForStackedBarWithCornerRadius(model) { + // Generate the mark + const [mark] = getMarkGroup(model, { fromPrefix: STACK_GROUP_PREFIX }); + // Get the scale for the stacked field + const fieldScale = model.scaleName(model.stack.fieldChannel); + const stackField = (opt = {}) => model.vgField(model.stack.fieldChannel, opt); + // Find the min/max of the pixel value on the stacked direction + const stackFieldGroup = (func, expr) => { + const vgFieldMinMax = [ + stackField({ prefix: 'min', suffix: 'start', expr }), + stackField({ prefix: 'max', suffix: 'start', expr }), + stackField({ prefix: 'min', suffix: 'end', expr }), + stackField({ prefix: 'max', suffix: 'end', expr }) + ]; + return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`; + }; + let groupUpdate; + let innerGroupUpdate; + // Build the encoding for group and an inner group + if (model.stack.fieldChannel === 'x') { + // Move cornerRadius, y/yc/y2/height properties to group + // Group x/x2 should be the min/max of the marks within + groupUpdate = { + ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]), + x: { signal: stackFieldGroup('min', 'datum') }, + x2: { signal: stackFieldGroup('max', 'datum') }, + clip: { value: true } + }; + // Inner group should revert the x translation, and pass height through + innerGroupUpdate = { + x: { field: { group: 'x' }, mult: -1 }, + height: { field: { group: 'height' } } + }; + // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) + // This is why size encoding is not supported yet + mark.encode.update = { + ...omit(mark.encode.update, ['y', 'yc', 'y2']), + height: { field: { group: 'height' } } + }; + } + else { + groupUpdate = { + ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']), + y: { signal: stackFieldGroup('min', 'datum') }, + y2: { signal: stackFieldGroup('max', 'datum') }, + clip: { value: true } + }; + innerGroupUpdate = { + y: { field: { group: 'y' }, mult: -1 }, + width: { field: { group: 'width' } } + }; + mark.encode.update = { + ...omit(mark.encode.update, ['x', 'xc', 'x2']), + width: { field: { group: 'width' } } + }; + } + // Deal with cornerRadius properties + for (const key of VG_CORNERRADIUS_CHANNELS) { + const configValue = getMarkConfig(key, model.markDef, model.config); + // Move from mark to group + if (mark.encode.update[key]) { + groupUpdate[key] = mark.encode.update[key]; + delete mark.encode.update[key]; + } + else if (configValue) { + groupUpdate[key] = signalOrValueRef(configValue); + } + // Overwrite any cornerRadius on mark set by config --- they are already moved to the group + if (configValue) { + mark.encode.update[key] = { value: 0 }; + } + } + const groupby = []; + if (model.stack.groupbyChannels?.length > 0) { + for (const groupbyChannel of model.stack.groupbyChannels) { + // For bin and time unit, we have to add bin/timeunit -end channels. + const groupByField = model.fieldDef(groupbyChannel); + const field = vgField(groupByField); + if (field) { + groupby.push(field); + } + if (groupByField?.bin || groupByField?.timeUnit) { + groupby.push(vgField(groupByField, { binSuffix: 'end' })); + } + } + } + const strokeProperties = [ + 'stroke', + 'strokeWidth', + 'strokeJoin', + 'strokeCap', + 'strokeDash', + 'strokeDashOffset', + 'strokeMiterLimit', + 'strokeOpacity' + ]; + // Generate stroke properties for the group + groupUpdate = strokeProperties.reduce((encode, prop) => { + if (mark.encode.update[prop]) { + return { ...encode, [prop]: mark.encode.update[prop] }; + } + else { + const configValue = getMarkConfig(prop, model.markDef, model.config); + if (configValue !== undefined) { + return { ...encode, [prop]: signalOrValueRef(configValue) }; + } + else { + return encode; + } + } + }, groupUpdate); + // Apply strokeForeground and strokeOffset if stroke is used + if (groupUpdate.stroke) { + groupUpdate.strokeForeground = { value: true }; + groupUpdate.strokeOffset = { value: 0 }; + } + return [ + { + type: 'group', + from: { + facet: { + data: model.requestDataName(DataSourceType.Main), + name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), + groupby, + aggregate: { + fields: [ + stackField({ suffix: 'start' }), + stackField({ suffix: 'start' }), + stackField({ suffix: 'end' }), + stackField({ suffix: 'end' }) + ], + ops: ['min', 'max', 'min', 'max'] + } + } + }, + encode: { + update: groupUpdate + }, + marks: [ + { + type: 'group', + encode: { update: innerGroupUpdate }, + marks: [mark] + } + ] + } + ]; +} +export function getSort(model) { + const { encoding, stack, mark, markDef, config } = model; + const order = encoding.order; + if ((!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) || + (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))) { + return undefined; + } + else if ((isArray(order) || isFieldDef(order)) && !stack) { + // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) + return sortParams(order, { expr: 'datum' }); + } + else if (isPathMark(mark)) { + // For both line and area, we sort values based on dimension by default + const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; + const dimensionChannelDef = encoding[dimensionChannel]; + if (isFieldDef(dimensionChannelDef)) { + const s = dimensionChannelDef.sort; + if (isArray(s)) { + return { + field: vgField(dimensionChannelDef, { prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum' }) + }; + } + else if (isSortField(s)) { + return { + field: vgField({ + // FIXME: this op might not already exist? + // FIXME: what if dimensionChannel (x or y) contains custom domain? + aggregate: isAggregate(model.encoding) ? s.op : undefined, + field: s.field + }, { expr: 'datum' }) + }; + } + else if (isSortByEncoding(s)) { + const fieldDefToSort = model.fieldDef(s.encoding); + return { + field: vgField(fieldDefToSort, { expr: 'datum' }), + order: s.order + }; + } + else if (s === null) { + return undefined; + } + else { + return { + field: vgField(dimensionChannelDef, { + // For stack with imputation, we only have bin_mid + binSuffix: model.stack?.impute ? 'mid' : undefined, + expr: 'datum' + }) + }; + } + } + return undefined; + } + return undefined; +} +function getMarkGroup(model, opt = { fromPrefix: '' }) { + const { mark, markDef, encoding, config } = model; + const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); + const style = getStyles(markDef); + const key = encoding.key; + const sort = getSort(model); + const interactive = interactiveFlag(model); + const aria = getMarkPropOrConfig('aria', markDef, config); + const postEncodingTransform = markCompiler[mark].postEncodingTransform + ? markCompiler[mark].postEncodingTransform(model) + : null; + return [ + { + name: model.getName('marks'), + type: markCompiler[mark].vgMark, + ...(clip ? { clip: true } : {}), + ...(style ? { style } : {}), + ...(key ? { key: key.field } : {}), + ...(sort ? { sort } : {}), + ...(interactive ? interactive : {}), + ...(aria === false ? { aria } : {}), + from: { data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) }, + encode: { + update: markCompiler[mark].encodeEntry(model) + }, + ...(postEncodingTransform + ? { + transform: postEncodingTransform + } + : {}) + } + ]; +} +/** + * If scales are bound to interval selections, we want to automatically clip + * marks to account for panning/zooming interactions. We identify bound scales + * by the selectionExtent property, which gets added during scale parsing. + */ +function scaleClip(model) { + const xScale = model.getScaleComponent('x'); + const yScale = model.getScaleComponent('y'); + return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined; +} +/** + * If we use a custom projection with auto-fitting to the geodata extent, + * we need to clip to ensure the chart size doesn't explode. + */ +function projectionClip(model) { + const projection = model.component.projection; + return projection && !projection.isFit ? true : undefined; +} +/** + * Only output interactive flags if we have selections defined somewhere in our model hierarchy. + */ +function interactiveFlag(model) { + if (!model.component.selection) + return null; + const unitCount = keys(model.component.selection).length; + let parentCount = unitCount; + let parent = model.parent; + while (parent && parentCount === 0) { + parentCount = keys(parent.component.selection).length; + parent = parent.parent; + } + return parentCount + ? { + interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip + } + : null; +} +//# sourceMappingURL=mark.js.map \ No newline at end of file diff --git a/build/src/compile/mark/mark.js.map b/build/src/compile/mark/mark.js.map new file mode 100644 index 0000000000..6e4d5f0c04 --- /dev/null +++ b/build/src/compile/mark/mark.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../../../src/compile/mark/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAiB,UAAU,EAAE,UAAU,EAAE,OAAO,EAAC,MAAM,kBAAkB,CAAC;AACjF,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,WAAW,EAAE,kBAAkB,EAAC,MAAM,gBAAgB,CAAC;AAC/D,OAAO,EAAC,IAAI,EAAE,GAAG,EAAE,UAAU,EAAE,IAAI,EAAQ,KAAK,EAAC,MAAM,YAAY,CAAC;AACpE,OAAO,EAAC,gBAAgB,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AACzD,OAAO,EAAC,QAAQ,EAAE,eAAe,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAA2B,wBAAwB,EAAC,MAAM,mBAAmB,CAAC;AACrF,OAAO,EAAC,aAAa,EAAE,mBAAmB,EAAE,SAAS,EAAE,gBAAgB,EAAE,UAAU,EAAC,MAAM,WAAW,CAAC;AAEtG,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,IAAI,EAAC,MA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AC,iBAAiB,CAAC,IAAI,MAAM,EAAE,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC7F,CAAC;AAED;;;GAGG;AACH,SAAS,cAAc,CAAC,KAAgB;IACtC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC;IAC9C,OAAO,UAAU,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC;AAC5D,CAAC;AAED;;GAEG;AACH,SAAS,eAAe,CAAC,KAAgB;IACvC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS;QAAE,OAAO,IAAI,CAAC;IAC5C,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;IACzD,IAAI,WAAW,GAAG,SAAS,CAAC;IAC5B,IAAI,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAC1B,OAAO,MAAM,IAAI,WAAW,KAAK,CAAC,EAAE;QAClC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC;QACtD,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;KACxB;IACD,OAAO,WAAW;QAChB,CAAC,CAAC;YACE,WAAW,EAAE,SAAS,GAAG,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,UAAU,IAAI,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO;SACpF;QACH,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/point.d.ts b/build/src/compile/mark/point.d.ts new file mode 100644 index 0000000000..c83fe8c7f0 --- /dev/null +++ b/build/src/compile/mark/point.d.ts @@ -0,0 +1,9 @@ +import { Config } from '../../config'; +import { VgEncodeEntry } from '../../vega.schema'; +import { UnitModel } from '../unit'; +import { MarkCompiler } from './base'; +export declare function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry; +export declare const point: MarkCompiler; +export declare const circle: MarkCompiler; +export declare const square: MarkCompiler; +//# sourceMappingURL=point.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/point.d.ts.map b/build/src/compile/mark/point.d.ts.map new file mode 100644 index 0000000000..abd47ba201 --- /dev/null +++ b/build/src/compile/mark/point.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/point.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AACpC,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAClC,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAuBpC,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,aAAa,CAK7G;AAED,eAAO,MAAM,KAAK,EAAE,YAKnB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAKpB,CAAC;AAEF,eAAO,MAAM,MAAM,EAAE,YAKpB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/point.js b/build/src/compile/mark/point.js new file mode 100644 index 0000000000..2ab590d888 --- /dev/null +++ b/build/src/compile/mark/point.js @@ -0,0 +1,44 @@ +import * as encode from './encode'; +function encodeEntry(model, fixedShape) { + const { config } = model; + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'include', + orient: 'ignore', + theta: 'ignore' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid' }), + ...encode.nonPosition('size', model), + ...encode.nonPosition('angle', model), + ...shapeMixins(model, config, fixedShape) + }; +} +export function shapeMixins(model, config, fixedShape) { + if (fixedShape) { + return { shape: { value: fixedShape } }; + } + return encode.nonPosition('shape', model); +} +export const point = { + vgMark: 'symbol', + encodeEntry: (model) => { + return encodeEntry(model); + } +}; +export const circle = { + vgMark: 'symbol', + encodeEntry: (model) => { + return encodeEntry(model, 'circle'); + } +}; +export const square = { + vgMark: 'symbol', + encodeEntry: (model) => { + return encodeEntry(model, 'square'); + } +}; +//# sourceMappingURL=point.js.map \ No newline at end of file diff --git a/build/src/compile/mark/point.js.map b/build/src/compile/mark/point.js.map new file mode 100644 index 0000000000..0900967960 --- /dev/null +++ b/build/src/compile/mark/point.js.map @@ -0,0 +1 @@ +{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../../src/compile/mark/point.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,SAAS,WAAW,CAAC,KAAgB,EAAE,UAAgC;IACrE,MAAM,EAAC,MAAM,EAAC,GAAG,KAAK,CAAC;IAEvB,OAAO;QACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;YAC/B,KAAK,EAAE,QAAQ;YACf,QAAQ,EAAE,QAAQ;YAClB,KAAK,EAAE,SAAS;YAChB,IAAI,EAAE,SAAS;YACf,MAAM,EAAE,QAAQ;YAChB,KAAK,EAAE,QAAQ;SAChB,CAAC;QACF,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;QACxD,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;QACxD,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC;QACpC,GAAG,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC;QACrC,GAAG,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,UAAU,CAAC;KAC1C,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAgB,EAAE,MAAc,EAAE,UAAgC;IAC5F,IAAI,UAAU,EAAE;QACd,OAAO,EAAC,KAAK,EAAE,EAAC,KAAK,EAAE,UAAU,EAAC,EAAC,CAAC;KACrC;IACD,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAiB;IACjC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,MAAM,GAAiB;IAClC,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;IACtC,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/rect.d.ts b/build/src/compile/mark/rect.d.ts new file mode 100644 index 0000000000..2734b2926d --- /dev/null +++ b/build/src/compile/mark/rect.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const rect: MarkCompiler; +//# sourceMappingURL=rect.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/rect.d.ts.map b/build/src/compile/mark/rect.d.ts.map new file mode 100644 index 0000000000..08a06be21d --- /dev/null +++ b/build/src/compile/mark/rect.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rect.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/rect.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAgBlB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/rect.js b/build/src/compile/mark/rect.js new file mode 100644 index 0000000000..2b585ae318 --- /dev/null +++ b/build/src/compile/mark/rect.js @@ -0,0 +1,19 @@ +import * as encode from './encode'; +export const rect = { + vgMark: 'rect', + encodeEntry: (model) => { + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...encode.rectPosition(model, 'x'), + ...encode.rectPosition(model, 'y') + }; + } +}; +//# sourceMappingURL=rect.js.map \ No newline at end of file diff --git a/build/src/compile/mark/rect.js.map b/build/src/compile/mark/rect.js.map new file mode 100644 index 0000000000..a80cb665fe --- /dev/null +++ b/build/src/compile/mark/rect.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rect.js","sourceRoot":"","sources":["../../../../src/compile/mark/rect.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;YAClC,GAAG,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE,GAAG,CAAC;SACnC,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/rule.d.ts b/build/src/compile/mark/rule.d.ts new file mode 100644 index 0000000000..fc72b267b0 --- /dev/null +++ b/build/src/compile/mark/rule.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const rule: MarkCompiler; +//# sourceMappingURL=rule.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/rule.d.ts.map b/build/src/compile/mark/rule.d.ts.map new file mode 100644 index 0000000000..c455d4b611 --- /dev/null +++ b/build/src/compile/mark/rule.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rule.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/rule.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YAmClB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/rule.js b/build/src/compile/mark/rule.js new file mode 100644 index 0000000000..5cf07f8c16 --- /dev/null +++ b/build/src/compile/mark/rule.js @@ -0,0 +1,36 @@ +import * as encode from './encode'; +export const rule = { + vgMark: 'rule', + encodeEntry: (model) => { + const { markDef } = model; + const orient = markDef.orient; + if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { + // Show nothing if we have none of x, y, lat, and long. + return {}; + } + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...encode.pointOrRangePosition('x', model, { + defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', + defaultPos2: 'zeroOrMin', + range: orient !== 'vertical' // include x2 for horizontal or line segment rule + }), + ...encode.pointOrRangePosition('y', model, { + defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', + defaultPos2: 'zeroOrMin', + range: orient !== 'horizontal' // include y2 for vertical or line segment rule + }), + ...encode.nonPosition('size', model, { + vgChannel: 'strokeWidth' // VL's rule size is strokeWidth + }) + }; + } +}; +//# sourceMappingURL=rule.js.map \ No newline at end of file diff --git a/build/src/compile/mark/rule.js.map b/build/src/compile/mark/rule.js.map new file mode 100644 index 0000000000..c6e28010d8 --- /dev/null +++ b/build/src/compile/mark/rule.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rule.js","sourceRoot":"","sources":["../../../../src/compile/mark/rule.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IACd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,MAAM,EAAC,OAAO,EAAC,GAAG,KAAK,CAAC;QACxB,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,QAAQ,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,SAAS,EAAE;YACnG,uDAAuD;YACvD,OAAO,EAAE,CAAC;SACX;QAED,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,QAAQ;gBACf,QAAQ,EAAE,QAAQ;gBAClB,KAAK,EAAE,SAAS;gBAChB,MAAM,EAAE,QAAQ;gBAChB,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;YACF,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;gBACzC,UAAU,EAAE,MAAM,KAAK,YAAY,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;gBACzD,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,MAAM,KAAK,UAAU,CAAC,iDAAiD;aAC/E,CAAC;YACF,GAAG,MAAM,CAAC,oBAAoB,CAAC,GAAG,EAAE,KAAK,EAAE;gBACzC,UAAU,EAAE,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,KAAK;gBACvD,WAAW,EAAE,WAAW;gBACxB,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC,+CAA+C;aAC/E,CAAC;YACF,GAAG,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,KAAK,EAAE;gBACnC,SAAS,EAAE,aAAa,CAAC,gCAAgC;aAC1D,CAAC;SACH,CAAC;IACJ,CAAC;CACF,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/text.d.ts b/build/src/compile/mark/text.d.ts new file mode 100644 index 0000000000..30da99e512 --- /dev/null +++ b/build/src/compile/mark/text.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const text: MarkCompiler; +//# sourceMappingURL=text.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/text.d.ts.map b/build/src/compile/mark/text.d.ts.map new file mode 100644 index 0000000000..62b1f3ec48 --- /dev/null +++ b/build/src/compile/mark/text.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"text.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/text.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YA4BlB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/text.js b/build/src/compile/mark/text.js new file mode 100644 index 0000000000..2d35b52185 --- /dev/null +++ b/build/src/compile/mark/text.js @@ -0,0 +1,46 @@ +import { getMarkPropOrConfig } from '../common'; +import * as encode from './encode'; +export const text = { + vgMark: 'text', + encodeEntry: (model) => { + const { config, encoding } = model; + return { + ...encode.baseEncodeEntry(model, { + align: 'include', + baseline: 'include', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'include' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid' }), + ...encode.text(model), + ...encode.nonPosition('size', model, { + vgChannel: 'fontSize' // VL's text size is fontSize + }), + ...encode.nonPosition('angle', model), + ...encode.valueIfDefined('align', align(model.markDef, encoding, config)), + ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)), + ...encode.pointPosition('radius', model, { defaultPos: null }), + ...encode.pointPosition('theta', model, { defaultPos: null }) + }; + } +}; +function align(markDef, encoding, config) { + const a = getMarkPropOrConfig('align', markDef, config); + if (a === undefined) { + return 'center'; + } + // If there is a config, Vega-parser will process this already. + return undefined; +} +function baseline(markDef, encoding, config) { + const b = getMarkPropOrConfig('baseline', markDef, config); + if (b === undefined) { + return 'middle'; + } + // If there is a config, Vega-parser will process this already. + return undefined; +} +//# sourceMappingURL=text.js.map \ No newline at end of file diff --git a/build/src/compile/mark/text.js.map b/build/src/compile/mark/text.js.map new file mode 100644 index 0000000000..b96f4cf78e --- /dev/null +++ b/build/src/compile/mark/text.js.map @@ -0,0 +1 @@ +{"version":3,"file":"text.js","sourceRoot":"","sources":["../../../../src/compile/mark/text.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,mBAAmB,EAAC,MAAM,WAAW,CAAC;AAG9C,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IAEd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,MAAM,EAAC,MAAM,EAAE,QAAQ,EAAC,GAAG,KAAK,CAAC;QAEjC,OAAO;YACL,GAAG,MAAM,CAAC,eAAe,CAAC,KAAK,EAAE;gBAC/B,KAAK,EAAE,SAAS;gBAChB,QAAQ,EAAE,SAAS;gBACnB,KAAK,EAAE,SAAS;gBAChB,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE,QAAQ;gBAChB,KAAK,EAAE,SAAS;aACjB,CAAC;YACF,GAAG,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,EAAE,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;YACxD,GAAG,MAAM,CAAC,aAAa,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,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/tick.d.ts b/build/src/compile/mark/tick.d.ts new file mode 100644 index 0000000000..fef4920b14 --- /dev/null +++ b/build/src/compile/mark/tick.d.ts @@ -0,0 +1,3 @@ +import { MarkCompiler } from './base'; +export declare const tick: MarkCompiler; +//# sourceMappingURL=tick.d.ts.map \ No newline at end of file diff --git a/build/src/compile/mark/tick.d.ts.map b/build/src/compile/mark/tick.d.ts.map new file mode 100644 index 0000000000..3b2a51448a --- /dev/null +++ b/build/src/compile/mark/tick.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tick.d.ts","sourceRoot":"","sources":["../../../../src/compile/mark/tick.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AAGpC,eAAO,MAAM,IAAI,EAAE,YA+BlB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/mark/tick.js b/build/src/compile/mark/tick.js new file mode 100644 index 0000000000..43e73903d6 --- /dev/null +++ b/build/src/compile/mark/tick.js @@ -0,0 +1,51 @@ +import { isNumber } from 'vega-util'; +import { getViewConfigDiscreteStep } from '../../config'; +import { isVgRangeStep } from '../../vega.schema'; +import { getMarkPropOrConfig, signalOrValueRef } from '../common'; +import * as encode from './encode'; +export const tick = { + vgMark: 'rect', + encodeEntry: (model) => { + const { config, markDef } = model; + const orient = markDef.orient; + const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; + const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; + return { + ...encode.baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...encode.pointPosition('x', model, { defaultPos: 'mid', vgChannel: 'xc' }), + ...encode.pointPosition('y', model, { defaultPos: 'mid', vgChannel: 'yc' }), + // size / thickness => width / height + ...encode.nonPosition('size', model, { + defaultValue: defaultSize(model), + vgChannel: vgSizeChannel + }), + [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)) + }; + } +}; +function defaultSize(model) { + const { config, markDef } = model; + const { orient } = markDef; + const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; + const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); + const markPropOrConfig = getMarkPropOrConfig('size', markDef, config, { vgChannel: vgSizeChannel }) ?? config.tick.bandSize; + if (markPropOrConfig !== undefined) { + return markPropOrConfig; + } + else { + const scaleRange = scale ? scale.get('range') : undefined; + if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) { + return (scaleRange.step * 3) / 4; + } + const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); + return (defaultViewStep * 3) / 4; + } +} +//# sourceMappingURL=tick.js.map \ No newline at end of file diff --git a/build/src/compile/mark/tick.js.map b/build/src/compile/mark/tick.js.map new file mode 100644 index 0000000000..5a6b88de52 --- /dev/null +++ b/build/src/compile/mark/tick.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tick.js","sourceRoot":"","sources":["../../../../src/compile/mark/tick.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,yBAAyB,EAAC,MAAM,cAAc,CAAC;AACvD,OAAO,EAAC,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAGhE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,MAAM,CAAC,MAAM,IAAI,GAAiB;IAChC,MAAM,EAAE,MAAM;IAEd,WAAW,EAAE,CAAC,KAAgB,EAAE,EAAE;QAChC,MAAM,EAAC,MAAM,EAAE,OAAO,EAAC,GAAG,KAAK,CAAC;QAChC,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAE9B,MAAM,aAAa,GAAG,MAAM,KAAK,YAAY,CAAC,CAAC,C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AAG,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAE3E,MAAM,gBAAgB,GACpB,mBAAmB,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,EAAC,SAAS,EAAE,aAAa,EAAC,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC;IAEnG,IAAI,gBAAgB,KAAK,SAAS,EAAE;QAClC,OAAO,gBAAgB,CAAC;KACzB;SAAM;QACL,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1D,IAAI,UAAU,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACxE,OAAO,CAAC,UAAU,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;SAClC;QAED,MAAM,eAAe,GAAG,yBAAyB,CAAC,MAAM,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;QAE9E,OAAO,CAAC,eAAe,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC;KAClC;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/model.d.ts b/build/src/compile/model.d.ts new file mode 100644 index 0000000000..6ac0ed2585 --- /dev/null +++ b/build/src/compile/model.d.ts @@ -0,0 +1,176 @@ +import { Axis as VgAxis, Legend as VgLegend, NewSignal, Projection as VgProjection, Signal, SignalRef, Title as VgTitle } from 'vega'; +import { Channel, ExtendedChannel, ScaleChannel, SingleDefChannel } from '../channel'; +import { FieldDef, FieldRefOption } from '../channeldef'; +import { Config } from '../config'; +import { Data, DataSourceType } from '../data'; +import { ExprRef } from '../expr'; +import { Resolve } from '../resolve'; +import { GenericCompositionLayoutWithColumns, LayoutSizeMixins, SpecType, ViewBackground } from '../spec/base'; +import { NormalizedSpec } from '../spec/index'; +import { TitleParams } from '../title'; +import { Transform } from '../transform'; +import { Dict } from '../util'; +import { VgData, VgEncodeEntry, VgLayout, VgMarkGroup } from '../vega.schema'; +import { AxisComponentIndex } from './axis/component'; +import { ConcatModel } from './concat'; +import { DataComponent } from './data'; +import { FacetModel } from './facet'; +import { LayoutHeaderComponent } from './header/component'; +import { LayerModel } from './layer'; +import { LayoutSizeComponent, LayoutSizeType } from './layoutsize/component'; +import { LegendComponentIndex } from './legend/component'; +import { ProjectionComponent } from './projection/component'; +import { ScaleComponent, ScaleComponentIndex } from './scale/component'; +import { SelectionComponent } from './selection'; +import { UnitModel } from './unit'; +/** + * Composable Components that are intermediate results of the parsing phase of the + * compilations. The components represents parts of the specification in a form that + * can be easily merged (during parsing for composite specs). + * In addition, these components are easily transformed into Vega specifications + * during the "assemble" phase, which is the last phase of the compilation step. + */ +export interface Component { + data: DataComponent; + layoutSize: LayoutSizeComponent; + layoutHeaders: { + row?: LayoutHeaderComponent; + column?: LayoutHeaderComponent; + facet?: LayoutHeaderComponent; + }; + mark: VgMarkGroup[]; + scales: ScaleComponentIndex; + projection: ProjectionComponent; + selection: Dict; + /** Dictionary mapping channel to VgAxis definition */ + axes: AxisComponentIndex; + /** Dictionary mapping channel to VgLegend definition */ + legends: LegendComponentIndex; + resolve: Resolve; +} +export interface NameMapInterface { + rename(oldname: string, newName: string): void; + has(name: string): boolean; + get(name: string): string; +} +export declare class NameMap implements NameMapInterface { + private nameMap; + constructor(); + rename(oldName: string, newName: string): void; + has(name: string): boolean; + get(name: string): string; +} +export declare function isUnitModel(model: Model): model is UnitModel; +export declare function isFacetModel(model: Model): model is FacetModel; +export declare function isConcatModel(model: Model): model is ConcatModel; +export declare function isLayerModel(model: Model): model is LayerModel; +export declare abstract class Model { + readonly type: SpecType; + readonly parent: Model; + readonly config: Config; + readonly name: string; + size: LayoutSizeMixins; + readonly title: TitleParams; + readonly description: string; + readonly data: Data | null; + readonly transforms: Transform[]; + readonly layout: GenericCompositionLayoutWithColumns; + /** Name map for scales, which can be renamed by a model's parent. */ + protected scaleNameMap: NameMapInterface; + /** Name map for projections, which can be renamed by a model's parent. */ + protected projectionNameMap: NameMapInterface; + /** Name map for signals, which can be renamed by a model's parent. */ + protected signalNameMap: NameMapInterface; + readonly component: Component; + readonly view?: ViewBackground; + abstract readonly children: Model[]; + constructor(spec: NormalizedSpec, type: SpecType, parent: Model, parentGivenName: string, config: Config, resolve: Resolve, view?: ViewBackground); + get width(): SignalRef; + get height(): SignalRef; + parse(): void; + abstract parseData(): void; + abstract parseSelections(): void; + parseScale(): void; + parseProjection(): void; + abstract parseLayoutSize(): void; + /** + * Rename top-level spec's size to be just width / height, ignoring model name. + * This essentially merges the top-level spec's width/height signals with the width/height signals + * to help us reduce redundant signals declaration. + */ + private renameTopLevelLayoutSizeSignal; + abstract parseMarkGroup(): void; + abstract parseAxesAndHeaders(): void; + parseLegends(): void; + abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[]; + abstract assembleSignals(): NewSignal[]; + abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[]; + abstract assembleGroupStyle(): string | string[]; + private assembleEncodeFromView; + assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry; + assembleLayout(): VgLayout; + protected assembleDefaultLayout(): VgLayout; + abstract assembleLayoutSignals(): NewSignal[]; + assembleHeaderMarks(): VgMarkGroup[]; + abstract assembleMarks(): VgMarkGroup[]; + assembleAxes(): VgAxis[]; + assembleLegends(): VgLegend[]; + assembleProjections(): VgProjection[]; + assembleTitle(): VgTitle; + /** + * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. + */ + assembleGroup(signals?: Signal[]): any; + getName(text: string): string; + getDataName(type: DataSourceType): string; + /** + * Request a data source name for the given data source type and mark that data source as required. + * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). + * You can lookup the correct dataset name in assemble with `lookupDataSource`. + */ + requestDataName(name: DataSourceType): string; + getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef; + /** + * Lookup the name of the datasource for an output node. You probably want to call this in assemble. + */ + lookupDataSource(name: string): string; + getSignalName(oldSignalName: string): string; + renameSignal(oldName: string, newName: string): void; + renameScale(oldName: string, newName: string): void; + renameProjection(oldName: string, newName: string): void; + /** + * @return scale name for a given channel after the scale has been parsed and named. + */ + scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string; + /** + * @return projection name after the projection has been parsed and named. + */ + projectionName(parse?: boolean): string; + /** + * Corrects the data references in marks after assemble. + */ + correctDataNames: (mark: VgMarkGroup) => any; + /** + * Traverse a model's hierarchy to get the scale component for a particular channel. + */ + getScaleComponent(channel: ScaleChannel): ScaleComponent; + /** + * Traverse a model's hierarchy to get a particular selection component. + */ + getSelectionComponent(variableName: string, origName: string): SelectionComponent; + /** + * Returns true if the model has a signalRef for an axis orient. + */ + hasAxisOrientSignalRef(): boolean; +} +/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ +export declare abstract class ModelWithField extends Model { + abstract fieldDef(channel: SingleDefChannel): FieldDef; + /** Get "field" reference for Vega */ + vgField(channel: SingleDefChannel, opt?: FieldRefOption): string; + protected abstract getMapping(): Partial>; + reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T; + forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any): void; + abstract channelHasField(channel: Channel): boolean; +} +//# sourceMappingURL=model.d.ts.map \ No newline at end of file diff --git a/build/src/compile/model.d.ts.map b/build/src/compile/model.d.ts.map new file mode 100644 index 0000000000..53e741fea1 --- /dev/null +++ b/build/src/compile/model.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../../src/compile/model.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,IAAI,IAAI,MAAM,EACd,MAAM,IAAI,QAAQ,EAClB,SAAS,EACT,UAAU,IAAI,YAAY,EAC1B,MAAM,EACN,SAAS,EACT,KAAK,IAAI,OAAO,EACjB,MAAM,MAAM,CAAC;AACd,OAAO,EACL,OAAO,E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/compile/model.js new file mode 100644 index 0000000000..e1ad68dae4 --- /dev/null +++ b/build/src/compile/model.js @@ -0,0 +1,465 @@ +import { FACET_CHANNELS, getPositionScaleChannel, isChannel, isScaleChannel } from '../channel'; +import { getFieldDef, vgField } from '../channeldef'; +import { DataSourceType } from '../data'; +import { forEach, reduce } from '../encoding'; +import { replaceExprRef } from '../expr'; +import * as log from '../log'; +import { hasDiscreteDomain } from '../scale'; +import { isFacetSpec } from '../spec'; +import { extractCompositionLayout } from '../spec/base'; +import { extractTitleConfig, isText } from '../title'; +import { normalizeTransform } from '../transform'; +import { contains, duplicate, isEmpty, keys, varName } from '../util'; +import { isVgRangeStep } from '../vega.schema'; +import { assembleAxes } from './axis/assemble'; +import { signalOrValueRef } from './common'; +import { assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup } from './header/assemble'; +import { HEADER_CHANNELS } from './header/component'; +import { sizeExpr } from './layoutsize/assemble'; +import { getSizeTypeFromLayoutSizeType } from './layoutsize/component'; +import { assembleLegends } from './legend/assemble'; +import { parseLegend } from './legend/parse'; +import { assembleProjections } from './projection/assemble'; +import { parseProjection } from './projection/parse'; +import { assembleScales } from './scale/assemble'; +import { assembleDomain, getFieldFromDomain } from './scale/domain'; +import { parseScales } from './scale/parse'; +import { Split } from './split'; +export class NameMap { + constructor() { + this.nameMap = {}; + } + rename(oldName, newName) { + this.nameMap[oldName] = newName; + } + has(name) { + return this.nameMap[name] !== undefined; + } + get(name) { + // If the name appears in the _nameMap, we need to read its new name. + // We have to loop over the dict just in case the new name also gets renamed. + while (this.nameMap[name] && name !== this.nameMap[name]) { + name = this.nameMap[name]; + } + return name; + } +} +/* + We use type guards instead of `instanceof` as `instanceof` makes + different parts of the compiler depend on the actual implementation of + the model classes, which in turn depend on different parts of the compiler. + Thus, `instanceof` leads to circular dependency problems. + + On the other hand, type guards only make different parts of the compiler + depend on the type of the model classes, but not the actual implementation. +*/ +export function isUnitModel(model) { + return model?.type === 'unit'; +} +export function isFacetModel(model) { + return model?.type === 'facet'; +} +export function isConcatModel(model) { + return model?.type === 'concat'; +} +export function isLayerModel(model) { + return model?.type === 'layer'; +} +export class Model { + constructor(spec, type, parent, parentGivenName, config, resolve, view) { + this.type = type; + this.parent = parent; + this.config = config; + /** + * Corrects the data references in marks after assemble. + */ + this.correctDataNames = (mark) => { + // TODO: make this correct + // for normal data references + if (mark.from?.data) { + mark.from.data = this.lookupDataSource(mark.from.data); + } + // for access to facet data + if (mark.from?.facet?.data) { + mark.from.facet.data = this.lookupDataSource(mark.from.facet.data); + } + return mark; + }; + this.parent = parent; + this.config = config; + this.view = replaceExprRef(view); + // If name is not provided, always use parent's givenName to avoid name conflicts. + this.name = spec.name ?? parentGivenName; + this.title = isText(spec.title) ? { text: spec.title } : spec.title ? replaceExprRef(spec.title) : undefined; + // Shared name maps + this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); + this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); + this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); + this.data = spec.data; + this.description = spec.description; + this.transforms = normalizeTransform(spec.transform ?? []); + this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); + this.component = { + data: { + sources: parent ? parent.component.data.sources : [], + outputNodes: parent ? parent.component.data.outputNodes : {}, + outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, + // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined + isFaceted: isFacetSpec(spec) || (parent?.component.data.isFaceted && spec.data === undefined) + }, + layoutSize: new Split(), + layoutHeaders: { row: {}, column: {}, facet: {} }, + mark: null, + resolve: { + scale: {}, + axis: {}, + legend: {}, + ...(resolve ? duplicate(resolve) : {}) + }, + selection: null, + scales: null, + projection: null, + axes: {}, + legends: {} + }; + } + get width() { + return this.getSizeSignalRef('width'); + } + get height() { + return this.getSizeSignalRef('height'); + } + parse() { + this.parseScale(); + this.parseLayoutSize(); // depends on scale + this.renameTopLevelLayoutSizeSignal(); + this.parseSelections(); + this.parseProjection(); + this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. + this.parseAxesAndHeaders(); // depends on scale and layout size + this.parseLegends(); // depends on scale, markDef + this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. + } + parseScale() { + parseScales(this); + } + parseProjection() { + parseProjection(this); + } + /** + * Rename top-level spec's size to be just width / height, ignoring model name. + * This essentially merges the top-level spec's width/height signals with the width/height signals + * to help us reduce redundant signals declaration. + */ + renameTopLevelLayoutSizeSignal() { + if (this.getName('width') !== 'width') { + this.renameSignal(this.getName('width'), 'width'); + } + if (this.getName('height') !== 'height') { + this.renameSignal(this.getName('height'), 'height'); + } + } + parseLegends() { + parseLegend(this); + } + assembleEncodeFromView(view) { + // Exclude "style" + const { style: _, ...baseView } = view; + const e = {}; + for (const property of keys(baseView)) { + const value = baseView[property]; + if (value !== undefined) { + e[property] = signalOrValueRef(value); + } + } + return e; + } + assembleGroupEncodeEntry(isTopLevel) { + let encodeEntry = {}; + if (this.view) { + encodeEntry = this.assembleEncodeFromView(this.view); + } + if (!isTopLevel) { + // Descriptions are already added to the top-level description so we only need to add them to the inner views. + if (this.description) { + encodeEntry['description'] = signalOrValueRef(this.description); + } + // For top-level spec, we can set the global width and height signal to adjust the group size. + // For other child specs, we have to manually set width and height in the encode entry. + if (this.type === 'unit' || this.type === 'layer') { + return { + width: this.getSizeSignalRef('width'), + height: this.getSizeSignalRef('height'), + ...(encodeEntry ?? {}) + }; + } + } + return isEmpty(encodeEntry) ? undefined : encodeEntry; + } + assembleLayout() { + if (!this.layout) { + return undefined; + } + const { spacing, ...layout } = this.layout; + const { component, config } = this; + const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); + return { + padding: spacing, + ...this.assembleDefaultLayout(), + ...layout, + ...(titleBand ? { titleBand } : {}) + }; + } + assembleDefaultLayout() { + return {}; + } + assembleHeaderMarks() { + const { layoutHeaders } = this.component; + let headerMarks = []; + for (const channel of FACET_CHANNELS) { + if (layoutHeaders[channel].title) { + headerMarks.push(assembleTitleGroup(this, channel)); + } + } + for (const channel of HEADER_CHANNELS) { + headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel)); + } + return headerMarks; + } + assembleAxes() { + return assembleAxes(this.component.axes, this.config); + } + assembleLegends() { + return assembleLegends(this); + } + assembleProjections() { + return assembleProjections(this); + } + assembleTitle() { + const { encoding, ...titleNoEncoding } = this.title ?? {}; + const title = { + ...extractTitleConfig(this.config.title).nonMarkTitleProperties, + ...titleNoEncoding, + ...(encoding ? { encode: { update: encoding } } : {}) + }; + if (title.text) { + if (contains(['unit', 'layer'], this.type)) { + // Unit/Layer + if (contains(['middle', undefined], title.anchor)) { + title.frame ?? (title.frame = 'group'); + } + } + else { + // composition with Vega layout + // Set title = "start" by default for composition as "middle" does not look nice + // https://github.com/vega/vega/issues/960#issuecomment-471360328 + title.anchor ?? (title.anchor = 'start'); + } + return isEmpty(title) ? undefined : title; + } + return undefined; + } + /** + * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. + */ + assembleGroup(signals = []) { + const group = {}; + signals = signals.concat(this.assembleSignals()); + if (signals.length > 0) { + group.signals = signals; + } + const layout = this.assembleLayout(); + if (layout) { + group.layout = layout; + } + group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); + // Only include scales if this spec is top-level or if parent is facet. + // (Otherwise, it will be merged with upper-level's scope.) + const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; + if (scales.length > 0) { + group.scales = scales; + } + const axes = this.assembleAxes(); + if (axes.length > 0) { + group.axes = axes; + } + const legends = this.assembleLegends(); + if (legends.length > 0) { + group.legends = legends; + } + return group; + } + getName(text) { + return varName((this.name ? `${this.name}_` : '') + text); + } + getDataName(type) { + return this.getName(DataSourceType[type].toLowerCase()); + } + /** + * Request a data source name for the given data source type and mark that data source as required. + * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). + * You can lookup the correct dataset name in assemble with `lookupDataSource`. + */ + requestDataName(name) { + const fullName = this.getDataName(name); + // Increase ref count. This is critical because otherwise we won't create a data source. + // We also increase the ref counts on OutputNode.getSource() calls. + const refCounts = this.component.data.outputNodeRefCounts; + refCounts[fullName] = (refCounts[fullName] || 0) + 1; + return fullName; + } + getSizeSignalRef(layoutSizeType) { + if (isFacetModel(this.parent)) { + const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); + const channel = getPositionScaleChannel(sizeType); + const scaleComponent = this.component.scales[channel]; + if (scaleComponent && !scaleComponent.merged) { + // independent scale + const type = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const scaleName = scaleComponent.get('name'); + const domain = assembleDomain(this, channel); + const field = getFieldFromDomain(domain); + if (field) { + const fieldRef = vgField({ aggregate: 'distinct', field }, { expr: 'datum' }); + return { + signal: sizeExpr(scaleName, scaleComponent, fieldRef) + }; + } + else { + log.warn(log.message.unknownField(channel)); + return null; + } + } + } + } + return { + signal: this.signalNameMap.get(this.getName(layoutSizeType)) + }; + } + /** + * Lookup the name of the datasource for an output node. You probably want to call this in assemble. + */ + lookupDataSource(name) { + const node = this.component.data.outputNodes[name]; + if (!node) { + // Name not found in map so let's just return what we got. + // This can happen if we already have the correct name. + return name; + } + return node.getSource(); + } + getSignalName(oldSignalName) { + return this.signalNameMap.get(oldSignalName); + } + renameSignal(oldName, newName) { + this.signalNameMap.rename(oldName, newName); + } + renameScale(oldName, newName) { + this.scaleNameMap.rename(oldName, newName); + } + renameProjection(oldName, newName) { + this.projectionNameMap.rename(oldName, newName); + } + /** + * @return scale name for a given channel after the scale has been parsed and named. + */ + scaleName(originalScaleName, parse) { + if (parse) { + // During the parse phase always return a value + // No need to refer to rename map because a scale can't be renamed + // before it has the original name. + return this.getName(originalScaleName); + } + // If there is a scale for the channel, it should either + // be in the scale component or exist in the name map + if ( + // If there is a scale for the channel, there should be a local scale component for it + (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) || + // in the scale name map (the scale get merged by its parent) + this.scaleNameMap.has(this.getName(originalScaleName))) { + return this.scaleNameMap.get(this.getName(originalScaleName)); + } + return undefined; + } + /** + * @return projection name after the projection has been parsed and named. + */ + projectionName(parse) { + if (parse) { + // During the parse phase always return a value + // No need to refer to rename map because a projection can't be renamed + // before it has the original name. + return this.getName('projection'); + } + if ((this.component.projection && !this.component.projection.merged) || + this.projectionNameMap.has(this.getName('projection'))) { + return this.projectionNameMap.get(this.getName('projection')); + } + return undefined; + } + /** + * Traverse a model's hierarchy to get the scale component for a particular channel. + */ + getScaleComponent(channel) { + /* istanbul ignore next: This is warning for debugging test */ + if (!this.component.scales) { + throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'); + } + const localScaleComponent = this.component.scales[channel]; + if (localScaleComponent && !localScaleComponent.merged) { + return localScaleComponent; + } + return this.parent ? this.parent.getScaleComponent(channel) : undefined; + } + /** + * Traverse a model's hierarchy to get a particular selection component. + */ + getSelectionComponent(variableName, origName) { + let sel = this.component.selection[variableName]; + if (!sel && this.parent) { + sel = this.parent.getSelectionComponent(variableName, origName); + } + if (!sel) { + throw new Error(log.message.selectionNotFound(origName)); + } + return sel; + } + /** + * Returns true if the model has a signalRef for an axis orient. + */ + hasAxisOrientSignalRef() { + return (this.component.axes.x?.some(a => a.hasOrientSignalRef()) || + this.component.axes.y?.some(a => a.hasOrientSignalRef())); + } +} +/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ +export class ModelWithField extends Model { + /** Get "field" reference for Vega */ + vgField(channel, opt = {}) { + const fieldDef = this.fieldDef(channel); + if (!fieldDef) { + return undefined; + } + return vgField(fieldDef, opt); + } + reduceFieldDef(f, init) { + return reduce(this.getMapping(), (acc, cd, c) => { + const fieldDef = getFieldDef(cd); + if (fieldDef) { + return f(acc, fieldDef, c); + } + return acc; + }, init); + } + forEachFieldDef(f, t) { + forEach(this.getMapping(), (cd, c) => { + const fieldDef = getFieldDef(cd); + if (fieldDef) { + f(fieldDef, c); + } + }, t); + } +} +//# sourceMappingURL=model.js.map \ No newline at end of file diff --git a/build/src/compile/model.js.map b/build/src/compile/model.js.map new file mode 100644 index 0000000000..4e500de0b3 --- /dev/null +++ b/build/src/compile/model.js.map @@ -0,0 +1 @@ +{"version":3,"file":"model.js","sourceRoot":"","sources":["../../../src/compile/model.ts"],"names":[],"mappings":"AAUA,OAAO,EAGL,cAAc,EACd,uBAAuB,EACvB,SAAS,EACT,cAAc,EAGf,MAAM,YAAY,CAAC;AACpB,OAAO,EAAuC,WAAW,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAEzF,OAAO,EAAO,cAAc,EAAC,MAAM,SAAS,CAAC;AAC7C,OAAO,EAAC,OAAO,EAAE,MAAM,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAU,cAAc,EAAC,MAAM,SAAS,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAC,iBAAiB,EAAC,MAAM,UAAU,CAAC;AAC3C,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EACL,wBAAwB,EAKzB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,kBAAkB,EAAE,MAAM,EAAc,MAAM,UAAU,CAAC;AACjE,OAAO,EAAC,kBAAkB,EAAY,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAQ,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC1E,OAAO,EAAC,aAAa,EAA+C,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAE7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAI1C,OAAO,EAAC,oBAAoB,EAAE,uBAAuB,EAAE,kBAAkB,EAAC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,EAAE,EACjB,CAAC,EAAE,EAAE,CAAC,EAAE,EAAE;YACR,MAAM,QAAQ,GAAG,WAAW,CAAC,EAAE,CAAC,CAAC;YACjC,IAAI,QAAQ,EAAE;gBACZ,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC;aAChB;QACH,CAAC,EACD,CAAC,CACF,CAAC;IACJ,CAAC;CAGF"} \ No newline at end of file diff --git a/build/src/compile/predicate.d.ts b/build/src/compile/predicate.d.ts new file mode 100644 index 0000000000..d67168516c --- /dev/null +++ b/build/src/compile/predicate.d.ts @@ -0,0 +1,9 @@ +import { LogicalComposition } from '../logical'; +import { Predicate } from '../predicate'; +import { DataFlowNode } from './data/dataflow'; +import { Model } from './model'; +/** + * Converts a predicate into an expression. + */ +export declare function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string; +//# sourceMappingURL=predicate.d.ts.map \ No newline at end of file diff --git a/build/src/compile/predicate.d.ts.map b/build/src/compile/predicate.d.ts.map new file mode 100644 index 0000000000..e44f5471b2 --- /dev/null +++ b/build/src/compile/predicate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../../src/compile/predicate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,kBAAkB,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAA8C,SAAS,EAAC,MAAM,cAAc,CAAC;AAEpF,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAG9B;;GAEG;AAEH,wBAAgB,UAAU,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,kBAAkB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,MAAM,CAW7G"} \ No newline at end of file diff --git a/build/src/compile/predicate.js b/build/src/compile/predicate.js new file mode 100644 index 0000000000..4127b7395f --- /dev/null +++ b/build/src/compile/predicate.js @@ -0,0 +1,23 @@ +import { isString } from 'vega-util'; +import { fieldFilterExpression, isSelectionPredicate } from '../predicate'; +import { logicalExpr } from '../util'; +import { parseSelectionPredicate } from './selection/parse'; +/** + * Converts a predicate into an expression. + */ +// model is only used for selection filters. +export function expression(model, filterOp, node) { + return logicalExpr(filterOp, (predicate) => { + if (isString(predicate)) { + return predicate; + } + else if (isSelectionPredicate(predicate)) { + return parseSelectionPredicate(model, predicate, node); + } + else { + // Filter Object + return fieldFilterExpression(predicate); + } + }); +} +//# sourceMappingURL=predicate.js.map \ No newline at end of file diff --git a/build/src/compile/predicate.js.map b/build/src/compile/predicate.js.map new file mode 100644 index 0000000000..2bde470c9f --- /dev/null +++ b/build/src/compile/predicate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../../../src/compile/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAC,qBAAqB,EAAE,oBAAoB,EAAY,MAAM,cAAc,CAAC;AACpF,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAGpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,mBAAmB,CAAC;AAE1D;;GAEG;AACH,4CAA4C;AAC5C,MAAM,UAAU,UAAU,CAAC,KAAY,EAAE,QAAuC,EAAE,IAAmB;IACnG,OAAO,WAAW,CAAC,QAAQ,EAAE,CAAC,SAAoB,EAAE,EAAE;QACpD,IAAI,QAAQ,CAAC,SAAS,CAAC,EAAE;YACvB,OAAO,SAAS,CAAC;SAClB;aAAM,IAAI,oBAAoB,CAAC,SAAS,CAAC,EAAE;YAC1C,OAAO,uBAAuB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;SACxD;aAAM;YACL,gBAAgB;YAChB,OAAO,qBAAqB,CAAC,SAAS,CAAC,CAAC;SACzC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/projection/assemble.d.ts b/build/src/compile/projection/assemble.d.ts new file mode 100644 index 0000000000..a8e6bc127b --- /dev/null +++ b/build/src/compile/projection/assemble.d.ts @@ -0,0 +1,6 @@ +import { Projection as VgProjection } from 'vega'; +import { Model } from '../model'; +export declare function assembleProjections(model: Model): VgProjection[]; +export declare function assembleProjectionsForModelAndChildren(model: Model): VgProjection[]; +export declare function assembleProjectionForModel(model: Model): VgProjection[]; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/projection/assemble.d.ts.map b/build/src/compile/projection/assemble.d.ts.map new file mode 100644 index 0000000000..a22f159f7e --- /dev/null +++ b/build/src/compile/projection/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,YAAY,EAAY,MAAM,MAAM,CAAC;AAG3D,OAAO,EAA8B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE5D,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAMhE;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAInF;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,KAAK,GAAG,YAAY,EAAE,CAkDvE"} \ No newline at end of file diff --git a/build/src/compile/projection/assemble.js b/build/src/compile/projection/assemble.js new file mode 100644 index 0000000000..98d04d8673 --- /dev/null +++ b/build/src/compile/projection/assemble.js @@ -0,0 +1,64 @@ +import { contains } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { isConcatModel, isLayerModel } from '../model'; +export function assembleProjections(model) { + if (isLayerModel(model) || isConcatModel(model)) { + return assembleProjectionsForModelAndChildren(model); + } + else { + return assembleProjectionForModel(model); + } +} +export function assembleProjectionsForModelAndChildren(model) { + return model.children.reduce((projections, child) => { + return projections.concat(child.assembleProjections()); + }, assembleProjectionForModel(model)); +} +export function assembleProjectionForModel(model) { + const component = model.component.projection; + if (!component || component.merged) { + return []; + } + const projection = component.combine(); + const { name } = projection; // we need to extract name so that it is always present in the output and pass TS type validation + if (!component.data) { + // generate custom projection, no automatic fitting + return [ + { + name, + // translate to center by default + ...{ translate: { signal: '[width / 2, height / 2]' } }, + // parameters, overwrite default translate if specified + ...projection + } + ]; + } + else { + // generate projection that uses extent fitting + const size = { + signal: `[${component.size.map(ref => ref.signal).join(', ')}]` + }; + const fits = component.data.reduce((sources, data) => { + const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`; + if (!contains(sources, source)) { + // build a unique list of sources + sources.push(source); + } + return sources; + }, []); + if (fits.length <= 0) { + throw new Error("Projection's fit didn't find any data sources"); + } + return [ + { + name, + size, + fit: { + signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0] + }, + ...projection + } + ]; + } +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/projection/assemble.js.map b/build/src/compile/projection/assemble.js.map new file mode 100644 index 0000000000..e9fcc12443 --- /dev/null +++ b/build/src/compile/projection/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/projection/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAC,aAAa,EAAE,YAAY,EAAQ,MAAM,UAAU,CAAC;AAE5D,MAAM,UAAU,mBAAmB,CAAC,KAAY;IAC9C,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QAC/C,OAAO,sCAAsC,CAAC,KAAK,CAAC,CAAC;KACtD;SAAM;QACL,OAAO,0BAA0B,CAAC,KAAK,CAAC,CAAC;KAC1C;AACH,CAAC;AAED,MAAM,UAAU,sCAAsC,CAAC,KAAY;IACjE,OAAO,KAA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EAAE,MAAM,CAAC,EAAE;gBAC9B,iCAAiC;gBACjC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;aACtB;YACD,OAAO,OAAO,CAAC;QACjB,CAAC,EAAE,EAAE,CAAC,CAAC;QAEP,IAAI,IAAI,CAAC,MAAM,IAAI,CAAC,EAAE;YACpB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;SAClE;QAED,OAAO;YACL;gBACE,IAAI;gBACJ,IAAI;gBACJ,GAAG,EAAE;oBACH,MAAM,EAAE,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC;iBAC3D;gBACD,GAAG,UAAU;aACd;SACF,CAAC;KACH;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/projection/component.d.ts b/build/src/compile/projection/component.d.ts new file mode 100644 index 0000000000..11578c0c47 --- /dev/null +++ b/build/src/compile/projection/component.d.ts @@ -0,0 +1,15 @@ +import { Projection as VgProjection, SignalRef } from 'vega'; +import { Projection } from '../../projection'; +import { Split } from '../split'; +export declare class ProjectionComponent extends Split { + specifiedProjection: Projection; + size: SignalRef[]; + data: (string | SignalRef)[]; + merged: boolean; + constructor(name: string, specifiedProjection: Projection, size: SignalRef[], data: (string | SignalRef)[]); + /** + * Whether the projection parameters should fit provided data. + */ + get isFit(): boolean; +} +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/projection/component.d.ts.map b/build/src/compile/projection/component.d.ts.map new file mode 100644 index 0000000000..6aec1a2e3a --- /dev/null +++ b/build/src/compile/projection/component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/component.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,UAAU,IAAI,YAAY,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAC3D,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,qBAAa,mBAAoB,SAAQ,KAAK,CAAC,YAAY,CAAC;IAKjD,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC;IAC1C,IAAI,EAAE,SAAS,EAAE;IACjB,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAN9B,MAAM,UAAS;gBAGpB,IAAI,EAAE,MAAM,EACL,mBAAmB,EAAE,UAAU,CAAC,SAAS,CAAC,EAC1C,IAAI,EAAE,SAAS,EAAE,EACjB,IAAI,EAAE,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE;IAQrC;;OAEG;IACH,IAAW,KAAK,YAEf;CACF"} \ No newline at end of file diff --git a/build/src/compile/projection/component.js b/build/src/compile/projection/component.js new file mode 100644 index 0000000000..c8a407e2db --- /dev/null +++ b/build/src/compile/projection/component.js @@ -0,0 +1,19 @@ +import { Split } from '../split'; +export class ProjectionComponent extends Split { + constructor(name, specifiedProjection, size, data) { + super({ ...specifiedProjection }, // all explicit properties of projection + { name } // name as initial implicit property + ); + this.specifiedProjection = specifiedProjection; + this.size = size; + this.data = data; + this.merged = false; + } + /** + * Whether the projection parameters should fit provided data. + */ + get isFit() { + return !!this.data; + } +} +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/projection/component.js.map b/build/src/compile/projection/component.js.map new file mode 100644 index 0000000000..9c35dccb09 --- /dev/null +++ b/build/src/compile/projection/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/projection/component.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAE/B,MAAM,OAAO,mBAAoB,SAAQ,KAAmB;IAG1D,YACE,IAAY,EACL,mBAA0C,EAC1C,IAAiB,EACjB,IAA4B;QAEnC,KAAK,CACH,EAAC,GAAG,mBAAmB,EAAC,EAAE,wCAAwC;QAClE,EAAC,IAAI,EAAC,CAAC,oCAAoC;SAC5C,CAAC;QAPK,wBAAmB,GAAnB,mBAAmB,CAAuB;QAC1C,SAAI,GAAJ,IAAI,CAAa;QACjB,SAAI,GAAJ,IAAI,CAAwB;QAN9B,WAAM,GAAG,KAAK,CAAC;IAYtB,CAAC;IAED;;OAEG;IACH,IAAW,KAAK;QACd,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;IACrB,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/projection/parse.d.ts b/build/src/compile/projection/parse.d.ts new file mode 100644 index 0000000000..5264b8e8de --- /dev/null +++ b/build/src/compile/projection/parse.d.ts @@ -0,0 +1,3 @@ +import { Model } from '../model'; +export declare function parseProjection(model: Model): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/projection/parse.d.ts.map b/build/src/compile/projection/parse.d.ts.map new file mode 100644 index 0000000000..ea1d95baa2 --- /dev/null +++ b/build/src/compile/projection/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/projection/parse.ts"],"names":[],"mappings":"AASA,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5C,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,QAE3C"} \ No newline at end of file diff --git a/build/src/compile/projection/parse.js b/build/src/compile/projection/parse.js new file mode 100644 index 0000000000..a3d2510226 --- /dev/null +++ b/build/src/compile/projection/parse.js @@ -0,0 +1,134 @@ +import { hasOwnProperty } from 'vega-util'; +import { LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE } from '../../channel'; +import { getFieldOrDatumDef } from '../../channeldef'; +import { DataSourceType } from '../../data'; +import { replaceExprRef } from '../../expr'; +import { PROJECTION_PROPERTIES } from '../../projection'; +import { GEOJSON } from '../../type'; +import { deepEqual, duplicate, every } from '../../util'; +import { isUnitModel } from '../model'; +import { ProjectionComponent } from './component'; +export function parseProjection(model) { + model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); +} +function parseUnitProjection(model) { + if (model.hasProjection) { + const proj = replaceExprRef(model.specifiedProjection); + const fit = !(proj && (proj.scale != null || proj.translate != null)); + const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; + const data = fit ? gatherFitData(model) : undefined; + const projComp = new ProjectionComponent(model.projectionName(true), { + ...(replaceExprRef(model.config.projection) ?? {}), + ...(proj ?? {}) + }, size, data); + if (!projComp.get('type')) { + projComp.set('type', 'equalEarth', false); + } + return projComp; + } + return undefined; +} +function gatherFitData(model) { + const data = []; + const { encoding } = model; + for (const posssiblePair of [ + [LONGITUDE, LATITUDE], + [LONGITUDE2, LATITUDE2] + ]) { + if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { + data.push({ + signal: model.getName(`geojson_${data.length}`) + }); + } + } + if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { + data.push({ + signal: model.getName(`geojson_${data.length}`) + }); + } + if (data.length === 0) { + // main source is geojson, so we can just use that + data.push(model.requestDataName(DataSourceType.Main)); + } + return data; +} +function mergeIfNoConflict(first, second) { + const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => { + // neither has the property + if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) { + return true; + } + // both have property and an equal value for property + if (hasOwnProperty(first.explicit, prop) && + hasOwnProperty(second.explicit, prop) && + // some properties might be signals or objects and require hashing for comparison + deepEqual(first.get(prop), second.get(prop))) { + return true; + } + return false; + }); + const size = deepEqual(first.size, second.size); + if (size) { + if (allPropertiesShared) { + return first; + } + else if (deepEqual(first.explicit, {})) { + return second; + } + else if (deepEqual(second.explicit, {})) { + return first; + } + } + // if all properties don't match, let each unit spec have its own projection + return null; +} +function parseNonUnitProjections(model) { + if (model.children.length === 0) { + return undefined; + } + let nonUnitProjection; + // parse all children first + for (const child of model.children) { + parseProjection(child); + } + // analyze parsed projections, attempt to merge + const mergable = every(model.children, child => { + const projection = child.component.projection; + if (!projection) { + // child layer does not use a projection + return true; + } + else if (!nonUnitProjection) { + // cached 'projection' is null, cache this one + nonUnitProjection = projection; + return true; + } + else { + const merge = mergeIfNoConflict(nonUnitProjection, projection); + if (merge) { + nonUnitProjection = merge; + } + return !!merge; + } + }); + // if cached one and all other children share the same projection, + if (nonUnitProjection && mergable) { + // so we can elevate it to the layer level + const name = model.projectionName(true); + const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); + // rename and assign all others as merged + for (const child of model.children) { + const projection = child.component.projection; + if (projection) { + if (projection.isFit) { + modelProjection.data.push(...child.component.projection.data); + } + child.renameProjection(projection.get('name'), name); + projection.merged = true; + } + } + return modelProjection; + } + return undefined; +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/projection/parse.js.map b/build/src/compile/projection/parse.js.map new file mode 100644 index 0000000000..8225ce1263 --- /dev/null +++ b/build/src/compile/projection/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/projection/parse.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,cAAc,EAAC,MAAM,WAAW,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,UAAU,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAChF,OAAO,EAAC,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,qBAAqB,EAAC,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,S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CAAC;aAC1B;SACF;QAED,OAAO,eAAe,CAAC;KACxB;IAED,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/resolve.d.ts b/build/src/compile/resolve.d.ts new file mode 100644 index 0000000000..6a2c24e10a --- /dev/null +++ b/build/src/compile/resolve.d.ts @@ -0,0 +1,6 @@ +import { ScaleChannel } from '../channel'; +import { Resolve, ResolveMode } from '../resolve'; +import { Model } from './model'; +export declare function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode; +export declare function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode; +//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/build/src/compile/resolve.d.ts.map b/build/src/compile/resolve.d.ts.map new file mode 100644 index 0000000000..51209524a1 --- /dev/null +++ b/build/src/compile/resolve.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../../src/compile/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,YAAY,EAAC,MAAM,YAAY,CAAC;AAEhD,OAAO,EAAC,OAAO,EAAE,WAAW,EAAC,MAAM,YAAY,CAAC;AAChD,OAAO,EAA4C,KAAK,EAAC,MAAM,SAAS,CAAC;AAEzE,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,KAAK,GAAG,WAAW,CAUpF;AAED,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,YAAY,GAAG,WAAW,CAYtF"} \ No newline at end of file diff --git a/build/src/compile/resolve.js b/build/src/compile/resolve.js new file mode 100644 index 0000000000..d93213cf18 --- /dev/null +++ b/build/src/compile/resolve.js @@ -0,0 +1,28 @@ +import { isXorY } from '../channel'; +import * as log from '../log'; +import { isConcatModel, isFacetModel, isLayerModel } from './model'; +export function defaultScaleResolve(channel, model) { + if (isFacetModel(model)) { + return channel === 'theta' ? 'independent' : 'shared'; + } + else if (isLayerModel(model)) { + return 'shared'; + } + else if (isConcatModel(model)) { + return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared'; + } + /* istanbul ignore next: should never reach here. */ + throw new Error('invalid model type for resolve'); +} +export function parseGuideResolve(resolve, channel) { + const channelScaleResolve = resolve.scale[channel]; + const guide = isXorY(channel) ? 'axis' : 'legend'; + if (channelScaleResolve === 'independent') { + if (resolve[guide][channel] === 'shared') { + log.warn(log.message.independentScaleMeansIndependentGuide(channel)); + } + return 'independent'; + } + return resolve[guide][channel] || 'shared'; +} +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/build/src/compile/resolve.js.map b/build/src/compile/resolve.js.map new file mode 100644 index 0000000000..bc64a6b011 --- /dev/null +++ b/build/src/compile/resolve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../../src/compile/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAe,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAAC,aAAa,EAAE,YAAY,EAAE,YAAY,EAAQ,MAAM,SAAS,CAAC;AAEzE,MAAM,UAAU,mBAAmB,CAAC,OAAqB,EAAE,KAAY;IACrE,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;QACvB,OAAO,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;KACvD;SAAM,IAAI,YAAY,CAAC,KAAK,CAAC,EAAE;QAC9B,OAAO,QAAQ,CAAC;KACjB;SAAM,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QAC/B,OAAO,MAAM,CAAC,OAAO,CAAC,IAAI,OAAO,KAAK,OAAO,IAAI,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC;KAClG;IACD,oDAAoD;IACpD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,OAAgB,EAAE,OAAqB;IACvE,MAAM,mBAAmB,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACnD,MAAM,KAAK,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC;IAElD,IAAI,mBAAmB,KAAK,aAAa,EAAE;QACzC,IAAI,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;YACxC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,qCAAqC,CAAC,OAAO,CAAC,CAAC,CAAC;SACtE;QACD,OAAO,aAAa,CAAC;KACtB;IAED,OAAO,OAAO,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC;AAC7C,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/assemble.d.ts b/build/src/compile/scale/assemble.d.ts new file mode 100644 index 0000000000..0bd45a0b03 --- /dev/null +++ b/build/src/compile/scale/assemble.d.ts @@ -0,0 +1,7 @@ +import { ScaleChannel } from '../../channel'; +import { VgRange, VgScale } from '../../vega.schema'; +import { Model } from '../model'; +export declare function assembleScales(model: Model): VgScale[]; +export declare function assembleScalesForModel(model: Model): VgScale[]; +export declare function assembleScaleRange(scaleRange: VgRange, scaleName: string, channel: ScaleChannel, model?: Model): VgRange; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/assemble.d.ts.map b/build/src/compile/scale/assemble.d.ts.map new file mode 100644 index 0000000000..63ff3d2b2e --- /dev/null +++ b/build/src/compile/scale/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAS,YAAY,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAiC,OAAO,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAA8B,KAAK,EAAC,MAAM,UAAU,CAAC;AAI5D,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,CAWtD;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,EAAE,CA6B9D;AAED,wBAAgB,kBAAkB,CAChC,UAAU,EAAE,OAAO,EACnB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,YAAY,EACrB,KAAK,CAAC,EAAE,KAAK,GACZ,OAAO,CAgBT"} \ No newline at end of file diff --git a/build/src/compile/scale/assemble.js b/build/src/compile/scale/assemble.js new file mode 100644 index 0000000000..bff30d6495 --- /dev/null +++ b/build/src/compile/scale/assemble.js @@ -0,0 +1,65 @@ +import { isObject } from 'vega-util'; +import { isXorY } from '../../channel'; +import { keys } from '../../util'; +import { isDataRefDomain, isVgRangeStep } from '../../vega.schema'; +import { isConcatModel, isLayerModel } from '../model'; +import { assembleSelectionScaleDomain } from '../selection/assemble'; +import { assembleDomain } from './domain'; +export function assembleScales(model) { + if (isLayerModel(model) || isConcatModel(model)) { + // For concat and layer, include scales of children too + return model.children.reduce((scales, child) => { + return scales.concat(assembleScales(child)); + }, assembleScalesForModel(model)); + } + else { + // For facet, child scales would not be included in the parent's scope. + // For unit, there is no child. + return assembleScalesForModel(model); + } +} +export function assembleScalesForModel(model) { + return keys(model.component.scales).reduce((scales, channel) => { + const scaleComponent = model.component.scales[channel]; + if (scaleComponent.merged) { + // Skipped merged scales + return scales; + } + const scale = scaleComponent.combine(); + const { name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps } = scale; + const range = assembleScaleRange(scale.range, name, channel, model); + const domain = assembleDomain(model, channel); + const domainRaw = selectionExtent + ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain) + : null; + scales.push({ + name, + type, + ...(domain ? { domain } : {}), + ...(domainRaw ? { domainRaw } : {}), + range, + ...(reverse !== undefined ? { reverse: reverse } : {}), + ...otherScaleProps + }); + return scales; + }, []); +} +export function assembleScaleRange(scaleRange, scaleName, channel, model) { + // add signals to x/y range + if (isXorY(channel)) { + if (isVgRangeStep(scaleRange)) { + // For width/height step, use a signal created in layout assemble instead of a constant step. + return { + step: { signal: `${scaleName}_step` } + }; + } + } + else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) { + return { + ...scaleRange, + data: model.lookupDataSource(scaleRange.data) + }; + } + return scaleRange; +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/scale/assemble.js.map b/build/src/compile/scale/assemble.js.map new file mode 100644 index 0000000000..9b1a9f0e64 --- /dev/null +++ b/build/src/compile/scale/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/scale/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,MAAM,EAAe,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,eAAe,EAAE,aAAa,EAAmB,MAAM,mBAAmB,CAAC;AACnF,OAAO,EAAC,aAAa,EAAE,YAAY,EAAQ,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAC,4BAA4B,EAAC,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAC,cAAc,EAAC,MAAM,UAAU,CAAC;AAExC,MAAM,UAAU,cAAc,CAAC,KAAY;IACzC,IAAI,YAAY,CAAC,KAAK,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE;QAC/C,uDAAuD;QACvD,OAAO,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YAC7C,OAAO,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9C,CAAC,EAAE,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C,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAC,OAAO,EAAE,OAAc,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,GAAG,eAAe;SACnB,CAAC,CAAC;QAEH,OAAO,MAAM,CAAC;IAChB,CAAC,EAAE,EAAe,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,kBAAkB,CAChC,UAAmB,EACnB,SAAiB,EACjB,OAAqB,EACrB,KAAa;IAEb,2BAA2B;IAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,EAAE;QACnB,IAAI,aAAa,CAAC,UAAU,CAAC,EAAE;YAC7B,6FAA6F;YAC7F,OAAO;gBACL,IAAI,EAAE,EAAC,MAAM,EAAE,GAAG,SAAS,OAAO,EAAC;aACpC,CAAC;SACH;KACF;SAAM,IAAI,QAAQ,CAAC,UAAU,CAAC,IAAI,eAAe,CAAC,UAAU,CAAC,EAAE;QAC9D,OAAO;YACL,GAAG,UAAU;YACb,IAAI,EAAE,KAAK,CAAC,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC;SAC9C,CAAC;KACH;IACD,OAAO,UAAU,CAAC;AACpB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/component.d.ts b/build/src/compile/scale/component.d.ts new file mode 100644 index 0000000000..9e999b7f67 --- /dev/null +++ b/build/src/compile/scale/component.d.ts @@ -0,0 +1,27 @@ +import type { SignalRef } from 'vega'; +import { ScaleChannel } from '../../channel'; +import { Scale, ScaleType } from '../../scale'; +import { ParameterExtent } from '../../selection'; +import { VgNonUnionDomain, VgScale } from '../../vega.schema'; +import { Explicit, Split } from '../split'; +/** + * All VgDomain property except domain. + * (We exclude domain as we have a special "domains" array that allow us merge them all at once in assemble.) + */ +export type ScaleComponentProps = Omit & { + domains: VgNonUnionDomain[]; + selectionExtent?: ParameterExtent; + reverse?: boolean | SignalRef; +}; +export type Range = ScaleComponentProps['range']; +export declare class ScaleComponent extends Split { + merged: boolean; + constructor(name: string, typeWithExplicit: Explicit); + /** + * Whether the scale definitely includes zero in the domain + */ + domainDefinitelyIncludesZero(): boolean; +} +export type ScaleComponentIndex = Partial>; +export type ScaleIndex = Partial>>; +//# sourceMappingURL=component.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/component.d.ts.map b/build/src/compile/scale/component.d.ts.map new file mode 100644 index 0000000000..1b3686ce73 --- /dev/null +++ b/build/src/compile/scale/component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAEhD,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAC,QAAQ,EAAE,KAAK,EAAC,MAAM,UAAU,CAAC;AAEzC;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,OAAO,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;IACtE,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAC5B,eAAe,CAAC,EAAE,eAAe,CAAC;IAClC,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;AAEjD,qBAAa,cAAe,SAAQ,KAAK,CAAC,mBAAmB,CAAC;IACrD,MAAM,UAAS;gBAEV,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE,QAAQ,CAAC,SAAS,CAAC;IAQ/D;;OAEG;IACI,4BAA4B;CASpC;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC,CAAC;AAEhF,MAAM,MAAM,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/component.js b/build/src/compile/scale/component.js new file mode 100644 index 0000000000..44711adbeb --- /dev/null +++ b/build/src/compile/scale/component.js @@ -0,0 +1,22 @@ +import { isArray, isNumber } from 'vega-util'; +import { some } from '../../util'; +import { Split } from '../split'; +export class ScaleComponent extends Split { + constructor(name, typeWithExplicit) { + super({}, // no initial explicit property + { name } // name as initial implicit property + ); + this.merged = false; + this.setWithExplicit('type', typeWithExplicit); + } + /** + * Whether the scale definitely includes zero in the domain + */ + domainDefinitelyIncludesZero() { + if (this.get('zero') !== false) { + return true; + } + return some(this.get('domains'), d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0); + } +} +//# sourceMappingURL=component.js.map \ No newline at end of file diff --git a/build/src/compile/scale/component.js.map b/build/src/compile/scale/component.js.map new file mode 100644 index 0000000000..421ec5e881 --- /dev/null +++ b/build/src/compile/scale/component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"component.js","sourceRoot":"","sources":["../../../../src/compile/scale/component.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAI5C,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAEhC,OAAO,EAAW,KAAK,EAAC,MAAM,UAAU,CAAC;AAczC,MAAM,OAAO,cAAe,SAAQ,KAA0B;IAG5D,YAAY,IAAY,EAAE,gBAAqC;QAC7D,KAAK,CACH,EAAE,EAAE,+BAA+B;QACnC,EAAC,IAAI,EAAC,CAAC,oCAAoC;SAC5C,CAAC;QANG,WAAM,GAAG,KAAK,CAAC;QAOpB,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;IACjD,CAAC;IAED;;OAEG;IACI,4BAA4B;QACjC,IAAI,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,KAAK,EAAE;YAC9B,OAAO,IAAI,CAAC;SACb;QACD,OAAO,IAAI,CACT,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,EACnB,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAChG,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/scale/domain.d.ts b/build/src/compile/scale/domain.d.ts new file mode 100644 index 0000000000..be0200e404 --- /dev/null +++ b/build/src/compile/scale/domain.d.ts @@ -0,0 +1,33 @@ +import type { SignalRef } from 'vega'; +import { ScaleChannel } from '../../channel'; +import { TypedFieldDef } from '../../channeldef'; +import { ScaleType } from '../../scale'; +import { VgDomain, VgNonUnionDomain, VgSortField } from '../../vega.schema'; +import { Model } from '../model'; +import { Explicit } from '../split'; +import { UnitModel } from '../unit'; +export declare function parseScaleDomain(model: Model): void; +export declare function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit; +export declare function domainSort(model: UnitModel, channel: ScaleChannel, scaleType: ScaleType): undefined | true | VgSortField; +/** + * Determine if a scale can use unaggregated domain. + * @return {Boolean} Returns true if all of the following conditions apply: + * 1. `scale.domain` is `unaggregated` + * 2. Aggregation function is not `count` or `sum` + * 3. The scale is quantitative or time scale. + */ +export declare function canUseUnaggregatedDomain(fieldDef: TypedFieldDef, scaleType: ScaleType): { + valid: boolean; + reason?: string; +}; +/** + * Converts an array of domains to a single Vega scale domain. + */ +export declare function mergeDomains(domains: VgNonUnionDomain[]): VgDomain; +/** + * Return a field if a scale uses a single field. + * Return `undefined` otherwise. + */ +export declare function getFieldFromDomain(domain: VgDomain): string; +export declare function assembleDomain(model: Model, channel: ScaleChannel): SignalRef | import("vega").ScaleData | (string | number | boolean | SignalRef)[]; +//# sourceMappingURL=domain.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/domain.d.ts.map b/build/src/compile/scale/domain.d.ts.map new file mode 100644 index 0000000000..f84cea72c6 --- /dev/null +++ b/build/src/compile/scale/domain.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"domain.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/domain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAYpC,OAAO,EAA2C,YAAY,EAAC,MAAM,eAAe,CAAC;AACrF,OAAO,EASL,aAAa,EAGd,MAAM,kBAAkB,CAAC;AAM1B,OAAO,EAA+E,SAAS,EAAC,MAAM,aAAa,CAAC;AAMpH,OAAO,EAKL,QAAQ,EAER,gBAAgB,EAEhB,WAAW,EAEZ,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EAA4B,KAAK,EAAC,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAC,QAAQ,EAAsD,MAAM,UAAU,CAAC;AACvF,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAKlC,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,QAM5C;AAsGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,GAAG,QAAQ,CAAC,gBAAgB,EAAE,CAAC,CA4C3G;AAgND,wBAAgB,UAAU,CACxB,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,GACnB,SAAS,GAAG,IAAI,GAAG,WAAW,CAgEhC;AAED;;;;;;GAMG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,EAC/B,SAAS,EAAE,SAAS,GACnB;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAC,CA2BnC;AAkBD;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,gBAAgB,EAAE,GAAG,QAAQ,CA+GlE;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,QAAQ,GAAG,MAAM,CAwB3D;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,YAAY,oFAgBjE"} \ No newline at end of file diff --git a/build/src/compile/scale/domain.js b/build/src/compile/scale/domain.js new file mode 100644 index 0000000000..c4826a962d --- /dev/null +++ b/build/src/compile/scale/domain.js @@ -0,0 +1,553 @@ +import { isObject, isString } from 'vega-util'; +import { isAggregateOp, isArgmaxDef, isArgminDef, MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX, SHARED_DOMAIN_OPS } from '../../aggregate'; +import { isBinning, isBinParams, isParameterExtent } from '../../bin'; +import { getSecondaryRangeChannel, isScaleChannel } from '../../channel'; +import { binRequiresRange, getBandPosition, getFieldOrDatumDef, hasBandEnd, isDatumDef, isFieldDef, valueExpr, vgField } from '../../channeldef'; +import { DataSourceType } from '../../data'; +import * as log from '../../log'; +import { hasDiscreteDomain, isDomainUnionWith, isParameterDomain } from '../../scale'; +import { DEFAULT_SORT_OP, isSortArray, isSortByEncoding, isSortField } from '../../sort'; +import { normalizeTimeUnit } from '../../timeunit'; +import * as util from '../../util'; +import { isDataRefDomain, isDataRefUnionedDomain, isFieldRefUnionDomain, isSignalRef } from '../../vega.schema'; +import { getBinSignalName } from '../data/bin'; +import { sortArrayIndexField } from '../data/calculate'; +import { FACET_SCALE_PREFIX } from '../data/optimize'; +import { isFacetModel, isUnitModel } from '../model'; +import { SignalRefWrapper } from '../signal'; +import { makeExplicit, makeImplicit, mergeValuesWithExplicit } from '../split'; +import { isRectBasedMark } from '../../mark'; +import { OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX } from '../data/timeunit'; +export function parseScaleDomain(model) { + if (isUnitModel(model)) { + parseUnitScaleDomain(model); + } + else { + parseNonUnitScaleDomain(model); + } +} +function parseUnitScaleDomain(model) { + const localScaleComponents = model.component.scales; + for (const channel of util.keys(localScaleComponents)) { + const domains = parseDomainForChannel(model, channel); + const localScaleCmpt = localScaleComponents[channel]; + localScaleCmpt.setWithExplicit('domains', domains); + parseSelectionDomain(model, channel); + if (model.component.data.isFaceted) { + // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not + let facetParent = model; + while (!isFacetModel(facetParent) && facetParent.parent) { + facetParent = facetParent.parent; + } + const resolve = facetParent.component.resolve.scale[channel]; + if (resolve === 'shared') { + for (const domain of domains.value) { + // Replace the scale domain with data output from a cloned subtree after the facet. + if (isDataRefDomain(domain)) { + // use data from cloned subtree (which is the same as data but with a prefix added once) + domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, ''); + } + } + } + } + } +} +function parseNonUnitScaleDomain(model) { + for (const child of model.children) { + parseScaleDomain(child); + } + const localScaleComponents = model.component.scales; + for (const channel of util.keys(localScaleComponents)) { + let domains; + let selectionExtent = null; + for (const child of model.children) { + const childComponent = child.component.scales[channel]; + if (childComponent) { + if (domains === undefined) { + domains = childComponent.getWithExplicit('domains'); + } + else { + domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker); + } + const se = childComponent.get('selectionExtent'); + if (selectionExtent && se && selectionExtent.param !== se.param) { + log.warn(log.message.NEEDS_SAME_SELECTION); + } + selectionExtent = se; + } + } + localScaleComponents[channel].setWithExplicit('domains', domains); + if (selectionExtent) { + localScaleComponents[channel].set('selectionExtent', selectionExtent, true); + } + } +} +/** + * Remove unaggregated domain if it is not applicable + * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. + */ +function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) { + if (domain === 'unaggregated') { + const { valid, reason } = canUseUnaggregatedDomain(fieldDef, scaleType); + if (!valid) { + log.warn(reason); + return undefined; + } + } + else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { + // Apply config if domain is not specified. + const { valid } = canUseUnaggregatedDomain(fieldDef, scaleType); + if (valid) { + return 'unaggregated'; + } + } + return domain; +} +export function parseDomainForChannel(model, channel) { + const scaleType = model.getScaleComponent(channel).get('type'); + const { encoding } = model; + const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale); + if (domain !== model.scaleDomain(channel)) { + model.specifiedScales[channel] = { + ...model.specifiedScales[channel], + domain + }; + } + // If channel is either X or Y then union them with X2 & Y2 if they exist + if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { + if (getFieldOrDatumDef(encoding.x)) { + return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker); + } + else { + return parseSingleChannelDomain(scaleType, domain, model, 'x2'); + } + } + else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { + if (getFieldOrDatumDef(encoding.y)) { + return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker); + } + else { + return parseSingleChannelDomain(scaleType, domain, model, 'y2'); + } + } + return parseSingleChannelDomain(scaleType, domain, model, channel); +} +function mapDomainToDataSignal(domain, type, timeUnit) { + return domain.map(v => { + const data = valueExpr(v, { timeUnit, type }); + return { signal: `{data: ${data}}` }; + }); +} +function convertDomainIfItIsDateTime(domain, type, timeUnit) { + // explicit value + const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit; + if (type === 'temporal' || normalizedTimeUnit) { + return mapDomainToDataSignal(domain, type, normalizedTimeUnit); + } + return [domain]; // Date time won't make sense +} +function parseSingleChannelDomain(scaleType, domain, model, channel) { + const { encoding, markDef, mark, config, stack } = model; + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const { type } = fieldOrDatumDef; + const timeUnit = fieldOrDatumDef['timeUnit']; + if (isDomainUnionWith(domain)) { + const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); + const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); + return makeExplicit([...unionWith, ...defaultDomain.value]); + } + else if (isSignalRef(domain)) { + return makeExplicit([domain]); + } + else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) { + return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); + } + if (stack && channel === stack.fieldChannel) { + if (stack.offset === 'normalize') { + return makeImplicit([[0, 1]]); + } + const data = model.requestDataName(DataSourceType.Main); + return makeImplicit([ + { + data, + field: model.vgField(channel, { suffix: 'start' }) + }, + { + data, + field: model.vgField(channel, { suffix: 'end' }) + } + ]); + } + const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; + if (isDatumDef(fieldOrDatumDef)) { + const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); + return makeImplicit(d); + } + const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef + if (domain === 'unaggregated') { + const data = model.requestDataName(DataSourceType.Main); + const { field } = fieldOrDatumDef; + return makeImplicit([ + { + data, + field: vgField({ field, aggregate: 'min' }) + }, + { + data, + field: vgField({ field, aggregate: 'max' }) + } + ]); + } + else if (isBinning(fieldDef.bin)) { + if (hasDiscreteDomain(scaleType)) { + if (scaleType === 'bin-ordinal') { + // we can omit the domain as it is inferred from the `bins` property + return makeImplicit([]); + } + // ordinal bin scale takes domain from bin_range, ordered by bin start + // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). + return makeImplicit([ + { + // If sort by aggregation of a specified sort field, we need to use RAW table, + // so we can aggregate values for the scale independently from the main aggregation. + data: util.isBoolean(sort) + ? model.requestDataName(DataSourceType.Main) + : model.requestDataName(DataSourceType.Raw), + // Use range if we added it and the scale does not support computing a range as a signal. + field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { binSuffix: 'range' } : {}), + // we have to use a sort object if sort = true to make the sort correct by bin start + sort: sort === true || !isObject(sort) + ? { + field: model.vgField(channel, {}), + op: 'min' // min or max doesn't matter since we sort by the start of the bin range + } + : sort + } + ]); + } + else { + // continuous scales + const { bin } = fieldDef; + if (isBinning(bin)) { + const binSignal = getBinSignalName(model, fieldDef.field, bin); + return makeImplicit([ + new SignalRefWrapper(() => { + const signal = model.getSignalName(binSignal); + return `[${signal}.start, ${signal}.stop]`; + }) + ]); + } + else { + return makeImplicit([ + { + data: model.requestDataName(DataSourceType.Main), + field: model.vgField(channel, {}) + } + ]); + } + } + } + else if (fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType)) { + const fieldDef2 = encoding[getSecondaryRangeChannel(channel)]; + if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) { + const data = model.requestDataName(DataSourceType.Main); + const bandPosition = getBandPosition({ fieldDef, fieldDef2, markDef, config }); + const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5; + return makeImplicit([ + { + data, + field: model.vgField(channel, isRectWithOffset ? { suffix: OFFSETTED_RECT_START_SUFFIX } : {}) + }, + { + data, + field: model.vgField(channel, { suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end' }) + } + ]); + } + } + if (sort) { + return makeImplicit([ + { + // If sort by aggregation of a specified sort field, we need to use RAW table, + // so we can aggregate values for the scale independently from the main aggregation. + data: util.isBoolean(sort) + ? model.requestDataName(DataSourceType.Main) + : model.requestDataName(DataSourceType.Raw), + field: model.vgField(channel), + sort + } + ]); + } + else { + return makeImplicit([ + { + data: model.requestDataName(DataSourceType.Main), + field: model.vgField(channel) + } + ]); + } +} +function normalizeSortField(sort, isStackedMeasure) { + const { op, field, order } = sort; + return { + // Apply default op + op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP), + // flatten nested fields + ...(field ? { field: util.replacePathInField(field) } : {}), + ...(order ? { order } : {}) + }; +} +function parseSelectionDomain(model, channel) { + const scale = model.component.scales[channel]; + const spec = model.specifiedScales[channel].domain; + const bin = model.fieldDef(channel)?.bin; + const domain = isParameterDomain(spec) && spec; + const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent; + if (domain || extent) { + // As scale parsing occurs before selection parsing, we cannot set + // domainRaw directly. So instead, we store the selectionExtent on + // the scale component, and then add domainRaw during scale assembly. + scale.set('selectionExtent', domain ?? extent, true); + } +} +export function domainSort(model, channel, scaleType) { + if (!hasDiscreteDomain(scaleType)) { + return undefined; + } + // save to cast as the only exception is the geojson type for shape, which would not generate a scale + const fieldDef = model.fieldDef(channel); + const sort = fieldDef.sort; + // if the sort is specified with array, use the derived sort index field + if (isSortArray(sort)) { + return { + op: 'min', + field: sortArrayIndexField(fieldDef, channel), + order: 'ascending' + }; + } + const { stack } = model; + const stackDimensions = stack + ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)]) + : undefined; + // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) + if (isSortField(sort)) { + const isStackedMeasure = stack && !stackDimensions.has(sort.field); + return normalizeSortField(sort, isStackedMeasure); + } + else if (isSortByEncoding(sort)) { + const { encoding, order } = sort; + const fieldDefToSortBy = model.fieldDef(encoding); + const { aggregate, field } = fieldDefToSortBy; + const isStackedMeasure = stack && !stackDimensions.has(field); + if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { + return normalizeSortField({ + field: vgField(fieldDefToSortBy), + order + }, isStackedMeasure); + } + else if (isAggregateOp(aggregate) || !aggregate) { + return normalizeSortField({ + op: aggregate, + field, + order + }, isStackedMeasure); + } + } + else if (sort === 'descending') { + return { + op: 'min', + field: model.vgField(channel), + order: 'descending' + }; + } + else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) { + return true; + } + // sort == null + return undefined; +} +/** + * Determine if a scale can use unaggregated domain. + * @return {Boolean} Returns true if all of the following conditions apply: + * 1. `scale.domain` is `unaggregated` + * 2. Aggregation function is not `count` or `sum` + * 3. The scale is quantitative or time scale. + */ +export function canUseUnaggregatedDomain(fieldDef, scaleType) { + const { aggregate, type } = fieldDef; + if (!aggregate) { + return { + valid: false, + reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef) + }; + } + if (isString(aggregate) && !SHARED_DOMAIN_OPS.has(aggregate)) { + return { + valid: false, + reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate) + }; + } + if (type === 'quantitative') { + if (scaleType === 'log') { + return { + valid: false, + reason: log.message.unaggregatedDomainWithLogScale(fieldDef) + }; + } + } + return { valid: true }; +} +/** + * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. + */ +function domainsTieBreaker(v1, v2, property, propertyOf) { + if (v1.explicit && v2.explicit) { + log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); + } + // If equal score, concat the domains so that we union them later. + return { explicit: v1.explicit, value: [...v1.value, ...v2.value] }; +} +/** + * Converts an array of domains to a single Vega scale domain. + */ +export function mergeDomains(domains) { + const uniqueDomains = util.unique(domains.map(domain => { + // ignore sort property when computing the unique domains + if (isDataRefDomain(domain)) { + const { sort: _s, ...domainWithoutSort } = domain; + return domainWithoutSort; + } + return domain; + }), util.hash); + const sorts = util.unique(domains + .map(d => { + if (isDataRefDomain(d)) { + const s = d.sort; + if (s !== undefined && !util.isBoolean(s)) { + if ('op' in s && s.op === 'count') { + // let's make sure that if op is count, we don't use a field + delete s.field; + } + if (s.order === 'ascending') { + // drop order: ascending as it is the default + delete s.order; + } + } + return s; + } + return undefined; + }) + .filter(s => s !== undefined), util.hash); + if (uniqueDomains.length === 0) { + return undefined; + } + else if (uniqueDomains.length === 1) { + const domain = domains[0]; + if (isDataRefDomain(domain) && sorts.length > 0) { + let sort = sorts[0]; + if (sorts.length > 1) { + log.warn(log.message.MORE_THAN_ONE_SORT); + // Get sorts with non-default ops + const filteredSorts = sorts.filter(s => isObject(s) && 'op' in s && s.op !== 'min'); + if (sorts.every(s => isObject(s) && 'op' in s) && filteredSorts.length === 1) { + sort = filteredSorts[0]; + } + else { + sort = true; + } + } + else { + // Simplify domain sort by removing field and op when the field is the same as the domain field. + if (isObject(sort) && 'field' in sort) { + const sortField = sort.field; + if (domain.field === sortField) { + sort = sort.order ? { order: sort.order } : true; + } + } + } + return { + ...domain, + sort + }; + } + return domain; + } + // only keep sort properties that work with unioned domains + const unionDomainSorts = util.unique(sorts.map(s => { + if (util.isBoolean(s) || !('op' in s) || (isString(s.op) && s.op in UNIONDOMAIN_SORT_OP_INDEX)) { + return s; + } + log.warn(log.message.domainSortDropped(s)); + return true; + }), util.hash); + let sort; + if (unionDomainSorts.length === 1) { + sort = unionDomainSorts[0]; + } + else if (unionDomainSorts.length > 1) { + log.warn(log.message.MORE_THAN_ONE_SORT); + sort = true; + } + const allData = util.unique(domains.map(d => { + if (isDataRefDomain(d)) { + return d.data; + } + return null; + }), x => x); + if (allData.length === 1 && allData[0] !== null) { + // create a union domain of different fields with a single data source + const domain = { + data: allData[0], + fields: uniqueDomains.map(d => d.field), + ...(sort ? { sort } : {}) + }; + return domain; + } + return { fields: uniqueDomains, ...(sort ? { sort } : {}) }; +} +/** + * Return a field if a scale uses a single field. + * Return `undefined` otherwise. + */ +export function getFieldFromDomain(domain) { + if (isDataRefDomain(domain) && isString(domain.field)) { + return domain.field; + } + else if (isDataRefUnionedDomain(domain)) { + let field; + for (const nonUnionDomain of domain.fields) { + if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) { + if (!field) { + field = nonUnionDomain.field; + } + else if (field !== nonUnionDomain.field) { + log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES); + return field; + } + } + } + log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); + return field; + } + else if (isFieldRefUnionDomain(domain)) { + log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE); + const field = domain.fields[0]; + return isString(field) ? field : undefined; + } + return undefined; +} +export function assembleDomain(model, channel) { + const scaleComponent = model.component.scales[channel]; + const domains = scaleComponent.get('domains').map((domain) => { + // Correct references to data as the original domain's data was determined + // in parseScale, which happens before parseData. Thus the original data + // reference can be incorrect. + if (isDataRefDomain(domain)) { + domain.data = model.lookupDataSource(domain.data); + } + return domain; + }); + // domains is an array that has to be merged into a single vega domain + return mergeDomains(domains); +} +//# sourceMappingURL=domain.js.map \ No newline at end of file diff --git a/build/src/compile/scale/domain.js.map b/build/src/compile/scale/domain.js.map new file mode 100644 index 0000000000..6ef8850dc5 --- /dev/null +++ b/build/src/compile/scale/domain.js.map @@ -0,0 +1 @@ +{"version":3,"file":"domain.js","sourceRoot":"","sources":["../../../../src/compile/scale/domain.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAEL,aAAa,EACb,WAAW,EACX,WAAW,EACX,yBAAyB,IAAI,yBAAyB,EAEtD,iBAAiB,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,SAAS,EAAE,WAAW,EAAE,iBAAiB,EAAC,MAAM,WAAW,CAAC;AACpE,OAAO,EAAC,wBAAwB,EAAE,cAAc,EAAe,MAAM,eAAe,CAAC;AACrF,OAAO,EACL,gBAAgB,EAChB,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,UAAU,EACV,UAAU,EAIV,SAAS,EACT,OAAO,EACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAG1C,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAS,iBAAiB,EAAE,iBAAiB,EAAE,iBAAiB,EAAyB,MAAM,aAAa,CAAC;AAEpH,OAAO,EAAC,eAAe,EAAqB,WAAW,EAAE,gBAAgB,EAAE,WAAW,E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AChE,MAAM,cAAc,GAAmB,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAEvE,MAAM,OAAO,GAAG,cAAc,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,MAAwB,EAAE,EAAE;QAC7E,0EAA0E;QAC1E,wEAAwE;QACxE,8BAA8B;QAC9B,IAAI,eAAe,CAAC,MAAM,CAAC,EAAE;YAC3B,MAAM,CAAC,IAAI,GAAG,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;SACnD;QAED,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC;IAEH,sEAAsE;IACtE,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/parse.d.ts b/build/src/compile/scale/parse.d.ts new file mode 100644 index 0000000000..7bf92f99ac --- /dev/null +++ b/build/src/compile/scale/parse.d.ts @@ -0,0 +1,6 @@ +import { Model } from '../model'; +export declare function parseScales(model: Model, { ignoreRange }?: { + ignoreRange?: boolean; +}): void; +export declare function parseScaleCore(model: Model): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/parse.d.ts.map b/build/src/compile/scale/parse.d.ts.map new file mode 100644 index 0000000000..d8d153a105 --- /dev/null +++ b/build/src/compile/scale/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/parse.ts"],"names":[],"mappings":"AAaA,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAS5C,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,WAAW,EAAC,GAAE;IAAC,WAAW,CAAC,EAAE,OAAO,CAAA;CAAM,QAUpF;AAED,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,QAM1C"} \ No newline at end of file diff --git a/build/src/compile/scale/parse.js b/build/src/compile/scale/parse.js new file mode 100644 index 0000000000..374c8e7a8d --- /dev/null +++ b/build/src/compile/scale/parse.js @@ -0,0 +1,110 @@ +import { SCALE_CHANNELS, SHAPE } from '../../channel'; +import { getFieldOrDatumDef } from '../../channeldef'; +import { channelHasNestedOffsetScale } from '../../encoding'; +import { GEOSHAPE } from '../../mark'; +import { NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES, scaleCompatible, scaleTypePrecedence } from '../../scale'; +import { GEOJSON } from '../../type'; +import { keys } from '../../util'; +import { isUnitModel } from '../model'; +import { defaultScaleResolve } from '../resolve'; +import { mergeValuesWithExplicit, tieBreakByComparing } from '../split'; +import { ScaleComponent } from './component'; +import { parseScaleDomain } from './domain'; +import { parseScaleProperty, parseScaleRange } from './properties'; +import { scaleType } from './type'; +export function parseScales(model, { ignoreRange } = {}) { + parseScaleCore(model); + parseScaleDomain(model); + for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) { + parseScaleProperty(model, prop); + } + if (!ignoreRange) { + // range depends on zero + parseScaleRange(model); + } +} +export function parseScaleCore(model) { + if (isUnitModel(model)) { + model.component.scales = parseUnitScaleCore(model); + } + else { + model.component.scales = parseNonUnitScaleCore(model); + } +} +/** + * Parse scales for all channels of a model. + */ +function parseUnitScaleCore(model) { + const { encoding, mark, markDef } = model; + const scaleComponents = {}; + for (const channel of SCALE_CHANNELS) { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale + // Don't generate scale for shape of geoshape + if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { + continue; + } + let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; + if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { + specifiedScale ?? (specifiedScale = {}); + const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel); + const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale); + scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), { + value: sType, + explicit: specifiedScale.type === sType + }); + } + } + return scaleComponents; +} +const scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)); +function parseNonUnitScaleCore(model) { + var _a; + const scaleComponents = (model.component.scales = {}); + const scaleTypeWithExplicitIndex = {}; + const resolve = model.component.resolve; + // Parse each child scale and determine if a particular channel can be merged. + for (const child of model.children) { + parseScaleCore(child); + // Instead of always merging right away -- check if it is compatible to merge first! + for (const channel of keys(child.component.scales)) { + // if resolve is undefined, set default first + (_a = resolve.scale)[channel] ?? (_a[channel] = defaultScaleResolve(channel, model)); + if (resolve.scale[channel] === 'shared') { + const explicitScaleType = scaleTypeWithExplicitIndex[channel]; + const childScaleType = child.component.scales[channel].getWithExplicit('type'); + if (explicitScaleType) { + if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { + // merge scale component if type are compatible + scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker); + } + else { + // Otherwise, update conflicting channel to be independent + resolve.scale[channel] = 'independent'; + // Remove from the index so they don't get merged + delete scaleTypeWithExplicitIndex[channel]; + } + } + else { + scaleTypeWithExplicitIndex[channel] = childScaleType; + } + } + } + } + // Merge each channel listed in the index + for (const channel of keys(scaleTypeWithExplicitIndex)) { + // Create new merged scale component + const name = model.scaleName(channel, true); + const typeWithExplicit = scaleTypeWithExplicitIndex[channel]; + scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit); + // rename each child and mark them as merged + for (const child of model.children) { + const childScale = child.component.scales[channel]; + if (childScale) { + child.renameScale(childScale.get('name'), name); + childScale.merged = true; + } + } + } + return scaleComponents; +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/scale/parse.js.map b/build/src/compile/scale/parse.js.map new file mode 100644 index 0000000000..c415a83ca8 --- /dev/null +++ b/build/src/compile/scale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,CACpB,CAAC;qBACH;yBAAM;wBACL,0DAA0D;wBAC1D,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,aAAa,CAAC;wBACvC,iDAAiD;wBACjD,OAAO,0BAA0B,CAAC,OAAO,CAAC,CAAC;qBAC5C;iBACF;qBAAM;oBACL,0BAA0B,CAAC,OAAO,CAAC,GAAG,cAAc,CAAC;iBACtD;aACF;SACF;KACF;IAED,yCAAyC;IACzC,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,0BAA0B,CAAC,EAAE;QACtD,oCAAoC;QACpC,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;QAC5C,MAAM,gBAAgB,GAAG,0BAA0B,CAAC,OAAO,CAAC,CAAC;QAC7D,eAAe,CAAC,OAAO,CAAC,GAAG,IAAI,cAAc,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;QAEtE,4CAA4C;QAC5C,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,QAAQ,EAAE;YAClC,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACnD,IAAI,UAAU,EAAE;gBACd,KAAK,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,IAAI,CAAC,CAAC;gBAChD,UAAU,CAAC,MAAM,GAAG,IAAI,CAAC;aAC1B;SACF;KACF;IAED,OAAO,eAAe,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/properties.d.ts b/build/src/compile/scale/properties.d.ts new file mode 100644 index 0000000000..5e34a0e8fe --- /dev/null +++ b/build/src/compile/scale/properties.d.ts @@ -0,0 +1,43 @@ +import { SignalRef, TimeInterval } from 'vega'; +import { ScaleChannel } from '../../channel'; +import { ScaleDatumDef, ScaleFieldDef, TypedFieldDef } from '../../channeldef'; +import { Config } from '../../config'; +import { Mark, MarkDef, RectConfig } from '../../mark'; +import { Domain, Scale, ScaleConfig, ScaleType } from '../../scale'; +import { Sort } from '../../sort'; +import { Type } from '../../type'; +import { Model } from '../model'; +import { SignalRefWrapper } from '../signal'; +import { ScaleComponentProps } from './component'; +export declare function parseScaleProperty(model: Model, property: Exclude): void; +export interface ScaleRuleParams { + model: Model; + channel: ScaleChannel; + fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef; + hasNestedOffsetScale: boolean; + scaleType: ScaleType; + scalePadding: number | SignalRef; + scalePaddingInner: number | SignalRef; + domain: Domain; + domainMin: Scale['domainMin']; + domainMax: Scale['domainMax']; + markDef: MarkDef; + config: Config; + hasSecondaryRangeChannel: boolean; +} +export declare const scaleRules: { + [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k]; +}; +export declare function parseScaleRange(model: Model): void; +export declare function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)): void; +export declare function bins(model: Model, fieldDef: TypedFieldDef): SignalRefWrapper | { + step: number; +}; +export declare function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate']; +export declare function nice(scaleType: ScaleType, channel: ScaleChannel, specifiedDomain: Domain, domainMin: Scale['domainMin'], domainMax: Scale['domainMax'], fieldOrDatumDef: TypedFieldDef | ScaleDatumDef): boolean | TimeInterval; +export declare function padding(channel: ScaleChannel, scaleType: ScaleType, scaleConfig: ScaleConfig, fieldOrDatumDef: TypedFieldDef | ScaleDatumDef, markDef: MarkDef, barConfig: RectConfig): number | SignalRef; +export declare function paddingInner(paddingValue: number | SignalRef, channel: ScaleChannel, mark: Mark, scaleType: ScaleType, scaleConfig: ScaleConfig, hasNestedOffsetScale?: boolean): number | SignalRef; +export declare function paddingOuter(paddingValue: number | SignalRef, channel: ScaleChannel, scaleType: ScaleType, paddingInnerValue: number | SignalRef, scaleConfig: ScaleConfig, hasNestedOffsetScale?: boolean): number | SignalRef; +export declare function reverse(scaleType: ScaleType, sort: Sort, channel: ScaleChannel, scaleConfig: ScaleConfig): boolean | SignalRef; +export declare function zero(channel: ScaleChannel, fieldDef: TypedFieldDef | ScaleDatumDef, specifiedDomain: Domain, markDef: MarkDef, scaleType: ScaleType, scaleConfig: ScaleConfig, hasSecondaryRangeChannel: boolean): boolean; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/properties.d.ts.map b/build/src/compile/scale/properties.d.ts.map new file mode 100644 index 0000000000..2a5921acc7 --- /dev/null +++ b/build/src/compile/scale/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/properties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAG7C,OAAO,EAQL,YAAY,EAEb,MAAM,eAAe,CAAC;AACvB,OAAO,EAIL,aAAa,EACb,aAAa,EACb,aAAa,EAEd,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAC,MAAM,EAAC,MAAM,cAAc,CAAC;AAIpC,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,UAAU,EAAC,MAAM,YAAY,CAAC;AACrD,OAAO,EAEL,MAAM,EAIN,KAAK,EACL,WAAW,EACX,SAAS,EAEV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAKhC,OAAO,EAAc,KAAK,EAAC,MAAM,UAAU,CAAC;AAC5C,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAG3C,OAAO,EAAsB,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAGrE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,GAAG,mBAAmB,CAAC,EAAE,OAAO,CAAC,QAM/G;AA6ED,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,KAAK,CAAC;IACb,OAAO,EAAE,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M,CAAC,GAAG,aAAa,GACrD,OAAO,GAAG,YAAY,CAWxB;AAED,wBAAgB,OAAO,CACrB,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,EACnC,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,aAAa,EACtD,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,EACjC,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,sBAqBjC;AAED,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,EAAE,YAAY,EACrB,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,EACnC,oBAAoB,UAAQ,sBAyB7B;AAED,wBAAgB,YAAY,CAC1B,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,OAAO,EAAE,YAAY,EACrB,SAAS,EAAE,SAAS,EACpB,iBAAiB,EAAE,MAAM,GAAG,SAAS,EACrC,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,EACnC,oBAAoB,UAAQ,sBAgC7B;AAED,wBAAgB,OAAO,CACrB,SAAS,EAAE,SAAS,EACpB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,EAClB,OAAO,EAAE,YAAY,EACrB,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,uBAmBpC;AAED,wBAAgB,IAAI,CAClB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,aAAa,EAC/C,eAAe,EAAE,MAAM,EACvB,OAAO,EAAE,OAAO,EAChB,SAAS,EAAE,SAAS,EACpB,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,EACnC,wBAAwB,EAAE,OAAO,WAmDlC"} \ No newline at end of file diff --git a/build/src/compile/scale/properties.js b/build/src/compile/scale/properties.js new file mode 100644 index 0000000000..c2e6bb42b8 --- /dev/null +++ b/build/src/compile/scale/properties.js @@ -0,0 +1,313 @@ +import { isArray, isNumber } from 'vega-util'; +import { isBinned, isBinning, isBinParams } from '../../bin'; +import { COLOR, FILL, getSecondaryRangeChannel, isXorY, isXorYOffset, POLAR_POSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, STROKE } from '../../channel'; +import { getFieldDef, getFieldOrDatumDef, isFieldDef, valueExpr } from '../../channeldef'; +import { isDateTime } from '../../datetime'; +import { channelHasNestedOffsetScale } from '../../encoding'; +import * as log from '../../log'; +import { channelScalePropertyIncompatability, hasContinuousDomain, isContinuousToContinuous, isContinuousToDiscrete, ScaleType, scaleTypeSupportProperty } from '../../scale'; +import * as util from '../../util'; +import { contains, getFirstDefined, keys } from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { getBinSignalName } from '../data/bin'; +import { isUnitModel } from '../model'; +import { SignalRefWrapper } from '../signal'; +import { mergeValuesWithExplicit, tieBreakByComparing } from '../split'; +import { parseUnitScaleRange } from './range'; +export function parseScaleProperty(model, property) { + if (isUnitModel(model)) { + parseUnitScaleProperty(model, property); + } + else { + parseNonUnitScaleProperty(model, property); + } +} +function parseUnitScaleProperty(model, property) { + const localScaleComponents = model.component.scales; + const { config, encoding, markDef, specifiedScales } = model; + for (const channel of keys(localScaleComponents)) { + const specifiedScale = specifiedScales[channel]; + const localScaleCmpt = localScaleComponents[channel]; + const mergedScaleCmpt = model.getScaleComponent(channel); + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const specifiedValue = specifiedScale[property]; + const scaleType = mergedScaleCmpt.get('type'); + const scalePadding = mergedScaleCmpt.get('padding'); + const scalePaddingInner = mergedScaleCmpt.get('paddingInner'); + const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); + const channelIncompatability = channelScalePropertyIncompatability(channel, property); + if (specifiedValue !== undefined) { + // If there is a specified value, check if it is compatible with scale type and channel + if (!supportedByScaleType) { + log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); + } + else if (channelIncompatability) { + // channel + log.warn(channelIncompatability); + } + } + if (supportedByScaleType && channelIncompatability === undefined) { + if (specifiedValue !== undefined) { + const timeUnit = fieldOrDatumDef['timeUnit']; + const type = fieldOrDatumDef.type; + switch (property) { + // domainMax/Min to signal if the value is a datetime object + case 'domainMax': + case 'domainMin': + if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { + localScaleCmpt.set(property, { signal: valueExpr(specifiedScale[property], { type, timeUnit }) }, true); + } + else { + localScaleCmpt.set(property, specifiedScale[property], true); + } + break; + default: + localScaleCmpt.copyKeyFromObject(property, specifiedScale); + } + } + else { + const value = property in scaleRules + ? scaleRules[property]({ + model, + channel, + fieldOrDatumDef, + scaleType, + scalePadding, + scalePaddingInner, + domain: specifiedScale.domain, + domainMin: specifiedScale.domainMin, + domainMax: specifiedScale.domainMax, + markDef, + config, + hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel), + hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)] + }) + : config.scale[property]; + if (value !== undefined) { + localScaleCmpt.set(property, value, false); + } + } + } + } +} +export const scaleRules = { + bins: ({ model, fieldOrDatumDef }) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined), + interpolate: ({ channel, fieldOrDatumDef }) => interpolate(channel, fieldOrDatumDef.type), + nice: ({ scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef }) => nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef), + padding: ({ channel, scaleType, fieldOrDatumDef, markDef, config }) => padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar), + paddingInner: ({ scalePadding, channel, markDef, scaleType, config, hasNestedOffsetScale }) => paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale), + paddingOuter: ({ scalePadding, channel, scaleType, scalePaddingInner, config, hasNestedOffsetScale }) => paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale), + reverse: ({ fieldOrDatumDef, scaleType, channel, config }) => { + const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; + return reverse(scaleType, sort, channel, config.scale); + }, + zero: ({ channel, fieldOrDatumDef, domain, markDef, scaleType, config, hasSecondaryRangeChannel }) => zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel) +}; +// This method is here rather than in range.ts to avoid circular dependency. +export function parseScaleRange(model) { + if (isUnitModel(model)) { + parseUnitScaleRange(model); + } + else { + parseNonUnitScaleProperty(model, 'range'); + } +} +export function parseNonUnitScaleProperty(model, property) { + const localScaleComponents = model.component.scales; + for (const child of model.children) { + if (property === 'range') { + parseScaleRange(child); + } + else { + parseScaleProperty(child, property); + } + } + for (const channel of keys(localScaleComponents)) { + let valueWithExplicit; + for (const child of model.children) { + const childComponent = child.component.scales[channel]; + if (childComponent) { + const childValueWithExplicit = childComponent.getWithExplicit(property); + valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => { + switch (property) { + case 'range': + // For step, prefer larger step + if (v1.step && v2.step) { + return v1.step - v2.step; + } + return 0; + // TODO: precedence rule for other properties + } + return 0; + })); + } + } + localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); + } +} +export function bins(model, fieldDef) { + const bin = fieldDef.bin; + if (isBinning(bin)) { + const binSignal = getBinSignalName(model, fieldDef.field, bin); + return new SignalRefWrapper(() => { + return model.getSignalName(binSignal); + }); + } + else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { + // start and stop will be determined from the scale domain + return { + step: bin.step + }; + } + return undefined; +} +export function interpolate(channel, type) { + if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { + return 'hcl'; + } + return undefined; +} +export function nice(scaleType, channel, specifiedDomain, domainMin, domainMax, fieldOrDatumDef) { + if (getFieldDef(fieldOrDatumDef)?.bin || + isArray(specifiedDomain) || + domainMax != null || + domainMin != null || + util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { + return undefined; + } + return isXorY(channel) ? true : undefined; +} +export function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) { + if (isXorY(channel)) { + if (isContinuousToContinuous(scaleType)) { + if (scaleConfig.continuousPadding !== undefined) { + return scaleConfig.continuousPadding; + } + const { type, orient } = markDef; + if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { + if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) { + return barConfig.continuousBandSize; + } + } + } + if (scaleType === ScaleType.POINT) { + return scaleConfig.pointPadding; + } + } + return undefined; +} +export function paddingInner(paddingValue, channel, mark, scaleType, scaleConfig, hasNestedOffsetScale = false) { + if (paddingValue !== undefined) { + // If user has already manually specified "padding", no need to add default paddingInner. + return undefined; + } + if (isXorY(channel)) { + // Padding is only set for X and Y by default. + // Basically it doesn't make sense to add padding for color and size. + // paddingOuter would only be called if it's a band scale, just return the default for bandScale. + const { bandPaddingInner, barBandPaddingInner, rectBandPaddingInner, bandWithNestedOffsetPaddingInner } = scaleConfig; + if (hasNestedOffsetScale) { + return bandWithNestedOffsetPaddingInner; + } + return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); + } + else if (isXorYOffset(channel)) { + if (scaleType === ScaleType.BAND) { + return scaleConfig.offsetBandPaddingInner; + } + } + return undefined; +} +export function paddingOuter(paddingValue, channel, scaleType, paddingInnerValue, scaleConfig, hasNestedOffsetScale = false) { + if (paddingValue !== undefined) { + // If user has already manually specified "padding", no need to add default paddingOuter. + return undefined; + } + if (isXorY(channel)) { + const { bandPaddingOuter, bandWithNestedOffsetPaddingOuter } = scaleConfig; + if (hasNestedOffsetScale) { + return bandWithNestedOffsetPaddingOuter; + } + // Padding is only set for X and Y by default. + // Basically it doesn't make sense to add padding for color and size. + if (scaleType === ScaleType.BAND) { + return getFirstDefined(bandPaddingOuter, + /* By default, paddingOuter is paddingInner / 2. The reason is that + size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). + and we want the width/height to be integer by default. + Note that step (by default) and cardinality are integers.) */ + isSignalRef(paddingInnerValue) ? { signal: `${paddingInnerValue.signal}/2` } : paddingInnerValue / 2); + } + } + else if (isXorYOffset(channel)) { + if (scaleType === ScaleType.POINT) { + return 0.5; // so the point positions align with centers of band scales. + } + else if (scaleType === ScaleType.BAND) { + return scaleConfig.offsetBandPaddingOuter; + } + } + return undefined; +} +export function reverse(scaleType, sort, channel, scaleConfig) { + if (channel === 'x' && scaleConfig.xReverse !== undefined) { + if (hasContinuousDomain(scaleType) && sort === 'descending') { + if (isSignalRef(scaleConfig.xReverse)) { + return { signal: `!${scaleConfig.xReverse.signal}` }; + } + else { + return !scaleConfig.xReverse; + } + } + return scaleConfig.xReverse; + } + if (hasContinuousDomain(scaleType) && sort === 'descending') { + // For continuous domain scales, Vega does not support domain sort. + // Thus, we reverse range instead if sort is descending + return true; + } + return undefined; +} +export function zero(channel, fieldDef, specifiedDomain, markDef, scaleType, scaleConfig, hasSecondaryRangeChannel) { + // If users explicitly provide a domain, we should not augment zero as that will be unexpected. + const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; + if (hasCustomDomain) { + if (hasContinuousDomain(scaleType)) { + if (isArray(specifiedDomain)) { + const first = specifiedDomain[0]; + const last = specifiedDomain[specifiedDomain.length - 1]; + if (isNumber(first) && first <= 0 && isNumber(last) && last >= 0) { + // if the domain includes zero, make zero remain true + return true; + } + } + return false; + } + } + // If there is no custom domain, return configZero value (=`true` as default) only for the following cases: + // 1) using quantitative field with size + // While this can be either ratio or interval fields, our assumption is that + // ratio are more common. However, if the scaleType is discretizing scale, we want to return + // false so that range doesn't start at zero + if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { + return true; + } + // 2) non-binned, quantitative x-scale or y-scale + // (For binning, we should not include zero by default because binning are calculated without zero.) + // (For area/bar charts with ratio scale chart, we should always include zero.) + if (!(isFieldDef(fieldDef) && fieldDef.bin) && + util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) { + const { orient, type } = markDef; + if (contains(['bar', 'area', 'line', 'trail'], type)) { + if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) { + return false; + } + } + if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) { + return true; + } + return scaleConfig?.zero; + } + return false; +} +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/build/src/compile/scale/properties.js.map b/build/src/compile/scale/properties.js.map new file mode 100644 index 0000000000..33ca17e3f0 --- /dev/null +++ b/build/src/compile/scale/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/compile/scale/properties.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC5C,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAC3D,OAAO,EACL,KAAK,EACL,IAAI,EACJ,wBAAwB,EACxB,MAAM,EACN,YAAY,EACZ,6BAA6B,EAC7B,uBAAuB,EAEvB,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,UAAU,EAIV,SAAS,EACV,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAC,2BAA2B,EAAC,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,mCAAmC,EAEnC,mBAAmB,EACnB,wBAAwB,EACxB,sBAAsB,EAGtB,SAAS,EACT,wBAAwB,EACzB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AAC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;SACF;QAED,IAAI,QAAQ,CAAC,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE;YAChE,OAAO,IAAI,CAAC;SACb;QAED,OAAO,WAAW,EAAE,IAAI,CAAC;KAC1B;IAED,OAAO,KAAK,CAAC;AACf,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/range.d.ts b/build/src/compile/scale/range.d.ts new file mode 100644 index 0000000000..fd5a425837 --- /dev/null +++ b/build/src/compile/scale/range.d.ts @@ -0,0 +1,24 @@ +import { SignalRef } from 'vega'; +import { ScaleChannel } from '../../channel'; +import { Config } from '../../config'; +import { Domain, Scale } from '../../scale'; +import { VgRange } from '../../vega.schema'; +import { Explicit } from '../split'; +import { UnitModel } from '../unit'; +export declare const RANGE_PROPERTIES: (keyof Scale)[]; +export declare function parseUnitScaleRange(model: UnitModel): void; +/** + * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). + */ +export declare function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit; +export declare function defaultContinuousToDiscreteCount(scaleType: 'quantile' | 'quantize' | 'threshold', config: Config, domain: Domain, channel: ScaleChannel): number; +/** + * Returns the linear interpolation of the range according to the cardinality + * + * @param rangeMin start of the range + * @param rangeMax end of the range + * @param cardinality number of values in the output range + */ +export declare function interpolateRange(rangeMin: number | SignalRef, rangeMax: number | SignalRef, cardinality: number): SignalRef; +export declare const MAX_SIZE_RANGE_STEP_RATIO = 0.95; +//# sourceMappingURL=range.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/range.d.ts.map b/build/src/compile/scale/range.d.ts.map new file mode 100644 index 0000000000..df4e9dacd9 --- /dev/null +++ b/build/src/compile/scale/range.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"range.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,SAAS,EAAC,MAAM,MAAM,CAAC;AAG5C,OAAO,EAYL,YAAY,EAab,MAAM,eAAe,CAAC;AASvB,OAAO,EAAC,MAAM,EAAmE,MAAM,cAAc,CAAC;AAKtG,OAAO,EAEL,MAAM,EAKN,KAAK,EAIN,MAAM,aAAa,CAAC;AAIrB,OAAO,EAAc,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAIvD,OAAO,EAAC,QAAQ,EAA6B,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAIlC,eAAO,MAAM,gBAAgB,EAAE,CAAC,MAAM,KAAK,CAAC,EAAwB,CAAC;AAErE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,SAAS,QAcnD;AA8BD;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,GAAG,QAAQ,CAAC,OAAO,CAAC,CAgG/F;AAqPD,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,UAAU,GAAG,UAAU,GAAG,WAAW,EAChD,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,YAAY,UAgBtB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,QAAQ,EAAE,MAAM,GAAG,SAAS,EAC5B,WAAW,EAAE,MAAM,GAClB,SAAS,CAaX;AA8BD,eAAO,MAAM,yBAAyB,OAAO,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/range.js b/build/src/compile/scale/range.js new file mode 100644 index 0000000000..35969c5c00 --- /dev/null +++ b/build/src/compile/scale/range.js @@ -0,0 +1,484 @@ +import { isArray, isNumber, isObject } from 'vega-util'; +import { isBinning } from '../../bin'; +import { ANGLE, COLOR, FILL, FILLOPACITY, getOffsetScaleChannel, getSizeChannel, isXorY, isXorYOffset, OPACITY, RADIUS, SCALE_CHANNELS, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, THETA, X, XOFFSET, Y, YOFFSET } from '../../channel'; +import { getBandPosition, getFieldOrDatumDef, isFieldDef, isFieldOrDatumDef } from '../../channeldef'; +import { getViewConfigDiscreteSize, getViewConfigDiscreteStep } from '../../config'; +import { DataSourceType } from '../../data'; +import { channelHasFieldOrDatum } from '../../encoding'; +import * as log from '../../log'; +import { channelScalePropertyIncompatability, hasContinuousDomain, hasDiscreteDomain, isContinuousToDiscrete, isExtendedScheme, scaleTypeSupportProperty } from '../../scale'; +import { getStepFor, isStep } from '../../spec/base'; +import { isDiscrete } from '../../type'; +import * as util from '../../util'; +import { isSignalRef } from '../../vega.schema'; +import { exprFromSignalRefOrValue, signalOrStringValue } from '../common'; +import { getBinSignalName } from '../data/bin'; +import { SignalRefWrapper } from '../signal'; +import { makeExplicit, makeImplicit } from '../split'; +import { durationExpr } from '../../timeunit'; +export const RANGE_PROPERTIES = ['range', 'scheme']; +export function parseUnitScaleRange(model) { + const localScaleComponents = model.component.scales; + // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! + for (const channel of SCALE_CHANNELS) { + const localScaleCmpt = localScaleComponents[channel]; + if (!localScaleCmpt) { + continue; + } + const rangeWithExplicit = parseRangeForChannel(channel, model); + localScaleCmpt.setWithExplicit('range', rangeWithExplicit); + } +} +function getBinStepSignal(model, channel) { + const fieldDef = model.fieldDef(channel); + if (fieldDef?.bin) { + const { bin, field } = fieldDef; + const sizeType = getSizeChannel(channel); + const sizeSignal = model.getName(sizeType); + if (isObject(bin) && bin.binned && bin.step !== undefined) { + return new SignalRefWrapper(() => { + const scaleName = model.scaleName(channel); + const binCount = `(domain("${scaleName}")[1] - domain("${scaleName}")[0]) / ${bin.step}`; + return `${model.getSignalName(sizeSignal)} / (${binCount})`; + }); + } + else if (isBinning(bin)) { + const binSignal = getBinSignalName(model, field, bin); + // TODO: extract this to be range step signal + return new SignalRefWrapper(() => { + const updatedName = model.getSignalName(binSignal); + const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`; + return `${model.getSignalName(sizeSignal)} / (${binCount})`; + }); + } + } + return undefined; +} +/** + * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). + */ +export function parseRangeForChannel(channel, model) { + const specifiedScale = model.specifiedScales[channel]; + const { size } = model; + const mergedScaleCmpt = model.getScaleComponent(channel); + const scaleType = mergedScaleCmpt.get('type'); + // Check if any of the range properties is specified. + // If so, check if it is compatible and make sure that we only output one of the properties + for (const property of RANGE_PROPERTIES) { + if (specifiedScale[property] !== undefined) { + const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); + const channelIncompatability = channelScalePropertyIncompatability(channel, property); + if (!supportedByScaleType) { + log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel)); + } + else if (channelIncompatability) { + // channel + log.warn(channelIncompatability); + } + else { + switch (property) { + case 'range': { + const range = specifiedScale.range; + if (isArray(range)) { + if (isXorY(channel)) { + return makeExplicit(range.map(v => { + if (v === 'width' || v === 'height') { + // get signal for width/height + // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. + const sizeSignal = model.getName(v); + const getSignalName = model.getSignalName.bind(model); + return SignalRefWrapper.fromName(getSignalName, sizeSignal); + } + return v; + })); + } + } + else if (isObject(range)) { + return makeExplicit({ + data: model.requestDataName(DataSourceType.Main), + field: range.field, + sort: { op: 'min', field: model.vgField(channel) } + }); + } + return makeExplicit(range); + } + case 'scheme': + return makeExplicit(parseScheme(specifiedScale[property])); + } + } + } + } + const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height'; + const sizeValue = size[sizeChannel]; + if (isStep(sizeValue)) { + if (isXorY(channel)) { + if (hasDiscreteDomain(scaleType)) { + const step = getPositionStep(sizeValue, model, channel); + // Need to be explicit so layer with step wins over layer without step + if (step) { + return makeExplicit({ step }); + } + } + else { + log.warn(log.message.stepDropped(sizeChannel)); + } + } + else if (isXorYOffset(channel)) { + const positionChannel = channel === XOFFSET ? 'x' : 'y'; + const positionScaleCmpt = model.getScaleComponent(positionChannel); + const positionScaleType = positionScaleCmpt.get('type'); + if (positionScaleType === 'band') { + const step = getOffsetStep(sizeValue, scaleType); + if (step) { + return makeExplicit(step); + } + } + } + } + const { rangeMin, rangeMax } = specifiedScale; + const d = defaultRange(channel, model); + if ((rangeMin !== undefined || rangeMax !== undefined) && + // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same + scaleTypeSupportProperty(scaleType, 'rangeMin') && + isArray(d) && + d.length === 2) { + return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]); + } + return makeImplicit(d); +} +function parseScheme(scheme) { + if (isExtendedScheme(scheme)) { + return { + scheme: scheme.name, + ...util.omit(scheme, ['name']) + }; + } + return { scheme }; +} +function fullWidthOrHeightRange(channel, model, scaleType, { center } = {}) { + // If step is null, use zero to width or height. + // Note that we use SignalRefWrapper to account for potential merges and renames. + const sizeType = getSizeChannel(channel); + const sizeSignal = model.getName(sizeType); + const getSignalName = model.getSignalName.bind(model); + if (channel === Y && hasContinuousDomain(scaleType)) { + // For y continuous scale, we have to start from the height as the bottom part has the max value. + return center + ? [ + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal) + ] + : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; + } + else { + return center + ? [ + SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), + SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal) + ] + : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; + } +} +function defaultRange(channel, model) { + const { size, config, mark, encoding } = model; + const { type } = getFieldOrDatumDef(encoding[channel]); + const mergedScaleCmpt = model.getScaleComponent(channel); + const scaleType = mergedScaleCmpt.get('type'); + const { domain, domainMid } = model.specifiedScales[channel]; + switch (channel) { + case X: + case Y: { + // If there is no explicit width/height for discrete x/y scales + if (util.contains(['point', 'band'], scaleType)) { + const positionSize = getDiscretePositionSize(channel, size, config.view); + if (isStep(positionSize)) { + const step = getPositionStep(positionSize, model, channel); + return { step }; + } + } + return fullWidthOrHeightRange(channel, model, scaleType); + } + case XOFFSET: + case YOFFSET: + return getOffsetRange(channel, model, scaleType); + case SIZE: { + // TODO: support custom rangeMin, rangeMax + const zero = model.component.scales[channel].get('zero'); + const rangeMin = sizeRangeMin(mark, zero, config); + const rangeMax = sizeRangeMax(mark, size, model, config); + if (isContinuousToDiscrete(scaleType)) { + return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel)); + } + else { + return [rangeMin, rangeMax]; + } + } + case THETA: + return [0, Math.PI * 2]; + case ANGLE: + // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. + // (It's weird to add just config.scale.min/maxAngleDegree for now) + return [0, 360]; + case RADIUS: { + // max radius = half od min(width,height) + return [ + 0, + new SignalRefWrapper(() => { + const w = model.getSignalName('width'); + const h = model.getSignalName('height'); + return `min(${w},${h})/2`; + }) + ]; + } + case STROKEWIDTH: + // TODO: support custom rangeMin, rangeMax + return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; + case STROKEDASH: + return [ + // TODO: add this to Vega's config.range? + [1, 0], + [4, 2], + [2, 1], + [1, 1], + [1, 2, 4, 2] + ]; + case SHAPE: + return 'symbol'; + case COLOR: + case FILL: + case STROKE: + if (scaleType === 'ordinal') { + // Only nominal data uses ordinal scale by default + return type === 'nominal' ? 'category' : 'ordinal'; + } + else { + if (domainMid !== undefined) { + return 'diverging'; + } + else { + return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; + } + } + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + // TODO: support custom rangeMin, rangeMax + return [config.scale.minOpacity, config.scale.maxOpacity]; + } +} +function getPositionStep(step, model, channel) { + const { encoding } = model; + const mergedScaleCmpt = model.getScaleComponent(channel); + const offsetChannel = getOffsetScaleChannel(channel); + const offsetDef = encoding[offsetChannel]; + const stepFor = getStepFor({ step, offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete(offsetDef.type) }); + if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) { + const offsetScaleCmpt = model.getScaleComponent(offsetChannel); + const offsetScaleName = model.scaleName(offsetChannel); + let stepCount = `domain('${offsetScaleName}').length`; + if (offsetScaleCmpt.get('type') === 'band') { + const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0; + const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0; + stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`; + } + const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding'); + return { + signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})` + }; + } + else { + return step.step; + } +} +function getOffsetStep(step, offsetScaleType) { + const stepFor = getStepFor({ step, offsetIsDiscrete: hasDiscreteDomain(offsetScaleType) }); + if (stepFor === 'offset') { + return { step: step.step }; + } + return undefined; +} +function getOffsetRange(channel, model, offsetScaleType) { + const positionChannel = channel === XOFFSET ? 'x' : 'y'; + const positionScaleCmpt = model.getScaleComponent(positionChannel); + if (!positionScaleCmpt) { + return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, { center: true }); + } + const positionScaleType = positionScaleCmpt.get('type'); + const positionScaleName = model.scaleName(positionChannel); + const { markDef, config } = model; + if (positionScaleType === 'band') { + const size = getDiscretePositionSize(positionChannel, model.size, model.config.view); + if (isStep(size)) { + // step is for offset + const step = getOffsetStep(size, offsetScaleType); + if (step) { + return step; + } + } + // otherwise use the position + return [0, { signal: `bandwidth('${positionScaleName}')` }]; + } + else { + // continuous scale + const positionDef = model.encoding[positionChannel]; + if (isFieldDef(positionDef) && positionDef.timeUnit) { + const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`); + const padding = model.config.scale.bandWithNestedOffsetPaddingInner; + const bandPositionOffset = getBandPosition({ + fieldDef: positionDef, + markDef, + config + }) - 0.5; + const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : ''; + if (padding) { + const startRatio = isSignalRef(padding) + ? `${padding.signal}/2` + bandPositionOffsetExpr + : `${padding / 2 + bandPositionOffset}`; + const endRatio = isSignalRef(padding) + ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr + : `${1 - padding / 2 + bandPositionOffset}`; + return [{ signal: `${startRatio} * (${duration})` }, { signal: `${endRatio} * (${duration})` }]; + } + return [0, { signal: duration }]; + } + return util.never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`); + } +} +function getDiscretePositionSize(channel, size, viewConfig) { + const sizeChannel = channel === X ? 'width' : 'height'; + const sizeValue = size[sizeChannel]; + if (sizeValue) { + return sizeValue; + } + return getViewConfigDiscreteSize(viewConfig, sizeChannel); +} +export function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) { + switch (scaleType) { + case 'quantile': + return config.scale.quantileCount; + case 'quantize': + return config.scale.quantizeCount; + case 'threshold': + if (domain !== undefined && isArray(domain)) { + return domain.length + 1; + } + else { + log.warn(log.message.domainRequiredForThresholdScale(channel)); + // default threshold boundaries for threshold scale since domain has cardinality of 2 + return 3; + } + } +} +/** + * Returns the linear interpolation of the range according to the cardinality + * + * @param rangeMin start of the range + * @param rangeMax end of the range + * @param cardinality number of values in the output range + */ +export function interpolateRange(rangeMin, rangeMax, cardinality) { + // always return a signal since it's better to compute the sequence in Vega later + const f = () => { + const rMax = signalOrStringValue(rangeMax); + const rMin = signalOrStringValue(rangeMin); + const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`; + return `sequence(${rMin}, ${rMax} + ${step}, ${step})`; + }; + if (isSignalRef(rangeMax)) { + return new SignalRefWrapper(f); + } + else { + return { signal: f() }; + } +} +function sizeRangeMin(mark, zero, config) { + if (zero) { + if (isSignalRef(zero)) { + return { signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` }; + } + else { + return 0; + } + } + switch (mark) { + case 'bar': + case 'tick': + return config.scale.minBandSize; + case 'line': + case 'trail': + case 'rule': + return config.scale.minStrokeWidth; + case 'text': + return config.scale.minFontSize; + case 'point': + case 'square': + case 'circle': + return config.scale.minSize; + } + /* istanbul ignore next: should never reach here */ + // sizeRangeMin not implemented for the mark + throw new Error(log.message.incompatibleChannel('size', mark)); +} +export const MAX_SIZE_RANGE_STEP_RATIO = 0.95; +function sizeRangeMax(mark, size, model, config) { + const xyStepSignals = { + x: getBinStepSignal(model, 'x'), + y: getBinStepSignal(model, 'y') + }; + switch (mark) { + case 'bar': + case 'tick': { + if (config.scale.maxBandSize !== undefined) { + return config.scale.maxBandSize; + } + const min = minXYStep(size, xyStepSignals, config.view); + if (isNumber(min)) { + return min - 1; + } + else { + return new SignalRefWrapper(() => `${min.signal} - 1`); + } + } + case 'line': + case 'trail': + case 'rule': + return config.scale.maxStrokeWidth; + case 'text': + return config.scale.maxFontSize; + case 'point': + case 'square': + case 'circle': { + if (config.scale.maxSize) { + return config.scale.maxSize; + } + const pointStep = minXYStep(size, xyStepSignals, config.view); + if (isNumber(pointStep)) { + return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); + } + else { + return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`); + } + } + } + /* istanbul ignore next: should never reach here */ + // sizeRangeMax not implemented for the mark + throw new Error(log.message.incompatibleChannel('size', mark)); +} +/** + * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. + */ +function minXYStep(size, xyStepSignals, viewConfig) { + const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); + const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); + if (xyStepSignals.x || xyStepSignals.y) { + return new SignalRefWrapper(() => { + const exprs = [ + xyStepSignals.x ? xyStepSignals.x.signal : widthStep, + xyStepSignals.y ? xyStepSignals.y.signal : heightStep + ]; + return `min(${exprs.join(', ')})`; + }); + } + return Math.min(widthStep, heightStep); +} +//# sourceMappingURL=range.js.map \ No newline at end of file diff --git a/build/src/compile/scale/range.js.map b/build/src/compile/scale/range.js.map new file mode 100644 index 0000000000..07894dc6ae --- /dev/null +++ b/build/src/compile/scale/range.js.map @@ -0,0 +1 @@ +{"version":3,"file":"range.js","sourceRoot":"","sources":["../../../../src/compile/scale/range.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,WAAW,EACX,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,YAAY,EACZ,OAAO,EAEP,MAAM,EAEN,cAAc,EACd,KAAK,EACL,IAAI,EACJ,MAAM,EACN,UAAU,EACV,aAAa,EACb,WAAW,EACX,KAAK,EACL,CAAC,EACD,OAAO,EACP,CAAC,EACD,OAAO,EACR,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,kBAAkB,EAClB,UAAU,EACV,iBAAiB,EAGlB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAS,yBAAyB,EAAE,yBAAyB,EAAa,MAAM,cAAc,CAAC;AACtG,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,sBAAsB,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AAEjC,OAAO,EACL,mCAAmC,EAEnC,mBAAmB,EACnB,iBAAiB,EACjB,sBAAsB,EACtB,gBAAgB,EAGhB,wBAAwB,EAEzB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,UAAU,EAAE,MAAM,EAAyB,MAAM,iBAAiB,CAAC;AAC3E,OAA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,yBAAyB,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;IACxG,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,yBAAyB,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAE5G,IAAI,aAAa,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE;QACtC,OAAO,IAAI,gBAAgB,CAAC,GAAG,EAAE;YAC/B,MAAM,KAAK,GAAG;gBACZ,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;gBACpD,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,UAAU;aACtD,CAAC;YACF,OAAO,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;QACpC,CAAC,CAAC,CAAC;KACJ;IAED,OAAO,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,UAAU,CAAC,CAAC;AACzC,CAAC"} \ No newline at end of file diff --git a/build/src/compile/scale/type.d.ts b/build/src/compile/scale/type.d.ts new file mode 100644 index 0000000000..f5e03d1b2a --- /dev/null +++ b/build/src/compile/scale/type.d.ts @@ -0,0 +1,11 @@ +import { ScaleChannel } from '../../channel'; +import { DatumDef, TypedFieldDef } from '../../channeldef'; +import { MarkDef } from '../../mark'; +import { Scale, ScaleType } from '../../scale'; +export type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined; +/** + * Determine if there is a specified scale type and if it is appropriate, + * or determine default type if type is unspecified or inappropriate. + */ +export declare function scaleType(specifiedScale: Scale, channel: ScaleChannel, fieldDef: TypedFieldDef | DatumDef, mark: MarkDef, hasNestedOffsetScale?: boolean): ScaleType; +//# sourceMappingURL=type.d.ts.map \ No newline at end of file diff --git a/build/src/compile/scale/type.d.ts.map b/build/src/compile/scale/type.d.ts.map new file mode 100644 index 0000000000..0cf4d10367 --- /dev/null +++ b/build/src/compile/scale/type.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../../../src/compile/scale/type.ts"],"names":[],"mappings":"AACA,OAAO,EAOL,YAAY,EACb,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAwD,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAE/G,OAAO,EAAqB,OAAO,EAAC,MAAM,YAAY,CAAC;AACvD,OAAO,EAA0B,KAAK,EAAE,SAAS,EAA2B,MAAM,aAAa,CAAC;AAKhG,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG,UAAU,GAAG,UAAU,GAAG,SAAS,CAAC;AAE3E;;;GAGG;AAEH,wBAAgB,SAAS,CACvB,cAAc,EAAE,KAAK,EACrB,OAAO,EAAE,YAAY,EACrB,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,GAAG,QAAQ,EAC1C,IAAI,EAAE,OAAO,EACb,oBAAoB,UAAQ,GAC3B,SAAS,CAyBX"} \ No newline at end of file diff --git a/build/src/compile/scale/type.js b/build/src/compile/scale/type.js new file mode 100644 index 0000000000..b095d55ecc --- /dev/null +++ b/build/src/compile/scale/type.js @@ -0,0 +1,107 @@ +import { isBinning } from '../../bin'; +import { getSizeChannel, isColorChannel, isScaleChannel, isXorY, isXorYOffset, rangeType } from '../../channel'; +import { isFieldDef, isPositionFieldOrDatumDef } from '../../channeldef'; +import * as log from '../../log'; +import { isRelativeBandSize } from '../../mark'; +import { channelSupportScaleType, scaleTypeSupportDataType } from '../../scale'; +import { normalizeTimeUnit } from '../../timeunit'; +import * as util from '../../util'; +import { POLAR_POSITION_SCALE_CHANNEL_INDEX } from './../../channel'; +/** + * Determine if there is a specified scale type and if it is appropriate, + * or determine default type if type is unspecified or inappropriate. + */ +// NOTE: CompassQL uses this method. +export function scaleType(specifiedScale, channel, fieldDef, mark, hasNestedOffsetScale = false) { + const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale); + const { type } = specifiedScale; + if (!isScaleChannel(channel)) { + // There is no scale for these channels + return null; + } + if (type !== undefined) { + // Check if explicitly specified scale type is supported by the channel + if (!channelSupportScaleType(channel, type)) { + log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); + return defaultScaleType; + } + // Check if explicitly specified scale type is supported by the data type + if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { + log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); + return defaultScaleType; + } + return type; + } + return defaultScaleType; +} +/** + * Determine appropriate default scale type. + */ +// NOTE: Voyager uses this method. +function defaultType(channel, fieldDef, mark, hasNestedOffsetScale) { + switch (fieldDef.type) { + case 'nominal': + case 'ordinal': { + if (isColorChannel(channel) || rangeType(channel) === 'discrete') { + if (channel === 'shape' && fieldDef.type === 'ordinal') { + log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal')); + } + return 'ordinal'; + } + if (isXorY(channel) || isXorYOffset(channel)) { + if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) { + // The rect/bar mark should fit into a band. + // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 + return 'band'; + } + if (hasNestedOffsetScale) { + // If there is a nested offset scale, then there is a "band" for the span of the nested scale. + return 'band'; + } + } + else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { + return 'band'; + } + const dimensionSize = mark[getSizeChannel(channel)]; + if (isRelativeBandSize(dimensionSize)) { + return 'band'; + } + if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) { + return 'band'; + } + // Otherwise, use ordinal point scale so we can easily get center positions of the marks. + return 'point'; + } + case 'temporal': + if (isColorChannel(channel)) { + return 'time'; + } + else if (rangeType(channel) === 'discrete') { + log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal')); + // TODO: consider using quantize (equivalent to binning) once we have it + return 'ordinal'; + } + else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { + return 'utc'; + } + return 'time'; + case 'quantitative': + if (isColorChannel(channel)) { + if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { + return 'bin-ordinal'; + } + return 'linear'; + } + else if (rangeType(channel) === 'discrete') { + log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative')); + // TODO: consider using quantize (equivalent to binning) once we have it + return 'ordinal'; + } + return 'linear'; + case 'geojson': + return undefined; + } + /* istanbul ignore next: should never reach this */ + throw new Error(log.message.invalidFieldType(fieldDef.type)); +} +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/build/src/compile/scale/type.js.map b/build/src/compile/scale/type.js.map new file mode 100644 index 0000000000..a13ebe4168 --- /dev/null +++ b/build/src/compile/scale/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../../../src/compile/scale/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,cAAc,EACd,cAAc,EACd,cAAc,EACd,MAAM,EACN,YAAY,EACZ,SAAS,EAEV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAW,UAAU,EAAE,yBAAyB,EAA+B,MAAM,kBAAkB,CAAC;AAC/G,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,kBAAkB,EAAU,MAAM,YAAY,CAAC;AACvD,OAAO,EAAC,uBAAuB,EAAoB,wBAAwB,EAAC,MAAM,aAAa,CAAC;AAChG,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,KAAK,IAAI,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,kCAAkC,EAAC,MAAM,iBAAiB,CAAC;AAInE;;;GAGG;AACH,oCAAoC;AACpC,MAAM,UAAU,SAAS,CACvB,cAAqB,EACr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AQ,CAAC,IAAI,QAAQ,CAAC,QAAQ,IAAI,iBAAiB,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,GAAG,EAAE;gBAChG,OAAO,KAAK,CAAC;aACd;YACD,OAAO,MAAM,CAAC;QAEhB,KAAK,cAAc;YACjB,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,UAAU,CAAC,QAAQ,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;oBACnD,OAAO,aAAa,CAAC;iBACtB;gBAED,OAAO,QAAQ,CAAC;aACjB;iBAAM,IAAI,SAAS,CAAC,OAAO,CAAC,KAAK,UAAU,EAAE;gBAC5C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,2BAA2B,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,CAAC;gBAC3E,wEAAwE;gBACxE,OAAO,SAAS,CAAC;aAClB;YAED,OAAO,QAAQ,CAAC;QAElB,KAAK,SAAS;YACZ,OAAO,SAAS,CAAC;KACpB;IAED,mDAAmD;IACnD,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,gBAAgB,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAC/D,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/assemble.d.ts b/build/src/compile/selection/assemble.d.ts new file mode 100644 index 0000000000..a5fa8aad53 --- /dev/null +++ b/build/src/compile/selection/assemble.d.ts @@ -0,0 +1,24 @@ +import { Signal, SignalRef } from 'vega'; +import { SelectionInit, SelectionInitInterval, ParameterExtent } from '../../selection'; +import { VgData, VgDomain } from '../../vega.schema'; +import { FacetModel } from '../facet'; +import { LayerModel } from '../layer'; +import { Model } from '../model'; +import { ScaleComponent } from '../scale/component'; +import { UnitModel } from '../unit'; +import { SelectionProjection } from './project'; +export declare function assembleProjection(proj: SelectionProjection): { + type: import("./project").TupleStoreType; + field: string; + channel?: "fill" | "stroke" | "angle" | "key" | "url" | "color" | "fillOpacity" | "opacity" | "strokeOpacity" | "strokeWidth" | "text" | "size" | "description" | "x" | "x2" | "y" | "y2" | "strokeDash" | "shape" | "radius" | "theta" | "href" | "theta2" | "radius2" | "xOffset" | "yOffset" | "longitude" | "latitude" | "longitude2" | "latitude2"; + geoChannel?: "longitude" | "latitude" | "longitude2" | "latitude2"; +}; +export declare function assembleInit(init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit, isExpr?: boolean, wrap?: (str: string | number) => string | number): any; +export declare function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]): Signal[]; +export declare function assembleFacetSignals(model: FacetModel, signals: Signal[]): Signal[]; +export declare function assembleTopLevelSignals(model: UnitModel, signals: Signal[]): Signal[]; +export declare function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[]; +export declare function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[]; +export declare function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[]; +export declare function assembleSelectionScaleDomain(model: Model, extent: ParameterExtent, scaleCmpt: ScaleComponent, domain: VgDomain): SignalRef; +//# sourceMappingURL=assemble.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/assemble.d.ts.map b/build/src/compile/selection/assemble.d.ts.map new file mode 100644 index 0000000000..ad9679f2ce --- /dev/null +++ b/build/src/compile/selection/assemble.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/assemble.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAMvC,OAAO,EAAC,aAAa,EAAE,qBAAqB,EAAE,eAAe,EAAe,MAAM,iBAAiB,CAAC;AAEpG,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAC,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AACpC,OAAO,EAAC,UAAU,EAAC,MAA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compile/selection/assemble.js b/build/src/compile/selection/assemble.js new file mode 100644 index 0000000000..4a2050dfe4 --- /dev/null +++ b/build/src/compile/selection/assemble.js @@ -0,0 +1,157 @@ +import { parseSelector } from 'vega-event-selector'; +import { identity, isArray, stringValue } from 'vega-util'; +import { MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE, selectionCompilers } from '.'; +import { dateTimeToExpr, isDateTime, dateTimeToTimestamp } from '../../datetime'; +import { hasContinuousDomain } from '../../scale'; +import { SELECTION_ID } from '../../selection'; +import { keys, replacePathInField, stringify, vals } from '../../util'; +import { isUnitModel } from '../model'; +import { parseSelectionExtent } from './parse'; +export function assembleProjection(proj) { + const { signals, hasLegend, index, ...rest } = proj; + rest.field = replacePathInField(rest.field); + return rest; +} +export function assembleInit(init, isExpr = true, wrap = identity) { + if (isArray(init)) { + const assembled = init.map(v => assembleInit(v, isExpr, wrap)); + return isExpr ? `[${assembled.join(', ')}]` : assembled; + } + else if (isDateTime(init)) { + if (isExpr) { + return wrap(dateTimeToExpr(init)); + } + else { + return wrap(dateTimeToTimestamp(init)); + } + } + return isExpr ? wrap(stringify(init)) : init; +} +export function assembleUnitSelectionSignals(model, signals) { + for (const selCmpt of vals(model.component.selection ?? {})) { + const name = selCmpt.name; + let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`; + for (const c of selectionCompilers) { + if (!c.defined(selCmpt)) + continue; + if (c.signals) + signals = c.signals(model, selCmpt, signals); + if (c.modifyExpr) + modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr); + } + signals.push({ + name: name + MODIFY, + on: [ + { + events: { signal: selCmpt.name + TUPLE }, + update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})` + } + ] + }); + } + return cleanupEmptyOnArray(signals); +} +export function assembleFacetSignals(model, signals) { + if (model.component.selection && keys(model.component.selection).length) { + const name = stringValue(model.getName('cell')); + signals.unshift({ + name: 'facet', + value: {}, + on: [ + { + events: parseSelector('pointermove', 'scope'), + update: `isTuple(facet) ? facet : group(${name}).datum` + } + ] + }); + } + return cleanupEmptyOnArray(signals); +} +export function assembleTopLevelSignals(model, signals) { + let hasSelections = false; + for (const selCmpt of vals(model.component.selection ?? {})) { + const name = selCmpt.name; + const store = stringValue(name + STORE); + const hasSg = signals.filter(s => s.name === name); + if (hasSg.length === 0) { + const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; + const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')'; + signals.push({ + name: selCmpt.name, + update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isPoint}` + }); + } + hasSelections = true; + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.topLevelSignals) { + signals = c.topLevelSignals(model, selCmpt, signals); + } + } + } + if (hasSelections) { + const hasUnit = signals.filter(s => s.name === 'unit'); + if (hasUnit.length === 0) { + signals.unshift({ + name: 'unit', + value: {}, + on: [{ events: 'pointermove', update: 'isTuple(group()) ? group() : unit' }] + }); + } + } + return cleanupEmptyOnArray(signals); +} +export function assembleUnitSelectionData(model, data) { + const dataCopy = [...data]; + const unit = unitName(model, { escape: false }); + for (const selCmpt of vals(model.component.selection ?? {})) { + const store = { name: selCmpt.name + STORE }; + if (selCmpt.project.hasSelectionId) { + store.transform = [{ type: 'collect', sort: { field: SELECTION_ID } }]; + } + if (selCmpt.init) { + const fields = selCmpt.project.items.map(assembleProjection); + store.values = selCmpt.project.hasSelectionId + ? selCmpt.init.map(i => ({ unit, [SELECTION_ID]: assembleInit(i, false)[0] })) + : selCmpt.init.map(i => ({ unit, fields, values: assembleInit(i, false) })); + } + const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE); + if (!contains.length) { + dataCopy.push(store); + } + } + return dataCopy; +} +export function assembleUnitSelectionMarks(model, marks) { + for (const selCmpt of vals(model.component.selection ?? {})) { + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.marks) { + marks = c.marks(model, selCmpt, marks); + } + } + } + return marks; +} +export function assembleLayerSelectionMarks(model, marks) { + for (const child of model.children) { + if (isUnitModel(child)) { + marks = assembleUnitSelectionMarks(child, marks); + } + } + return marks; +} +export function assembleSelectionScaleDomain(model, extent, scaleCmpt, domain) { + const parsedExtent = parseSelectionExtent(model, extent.param, extent); + return { + signal: hasContinuousDomain(scaleCmpt.get('type')) && isArray(domain) && domain[0] > domain[1] + ? `isValid(${parsedExtent}) && reverse(${parsedExtent})` + : parsedExtent + }; +} +function cleanupEmptyOnArray(signals) { + return signals.map(s => { + if (s.on && !s.on.length) + delete s.on; + return s; + }); +} +//# sourceMappingURL=assemble.js.map \ No newline at end of file diff --git a/build/src/compile/selection/assemble.js.map b/build/src/compile/selection/assemble.js.map new file mode 100644 index 0000000000..b51cf34fe7 --- /dev/null +++ b/build/src/compile/selection/assemble.js.map @@ -0,0 +1 @@ +{"version":3,"file":"assemble.js","sourceRoot":"","sources":["../../../../src/compile/selection/assemble.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,OAAO,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACzD,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,oBAAoB,EAAE,KAAK,EAAE,kBAAkB,EAAC,MAAM,GAAG,CAAC;AAC3F,OAAO,EAAC,cAAc,EAAE,UAAU,EAAE,mBAAmB,EAAC,MAAM,gBAAgB,CAAC;AAC/E,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAAwD,YAAY,EAAC,MAAM,iBAAiB,CAAC;AACpG,OAAO,EAAC,IAAI,EAAE,kBAAkB,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,YAAY,CAAC;AAIrE,OAAO,EAAC,WAAW,EAAQ,MAAM,UAAU,CAAC;AAG5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAG7C,MAAM,U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D;KACF;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,KAAY,EACZ,MAAuB,EACvB,SAAyB,EACzB,MAAgB;IAEhB,MAAM,YAAY,GAAG,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAEvE,OAAO;QACL,MAAM,EACJ,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,IAAI,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC;YACpF,CAAC,CAAC,WAAW,YAAY,gBAAgB,YAAY,GAAG;YACxD,CAAC,CAAC,YAAY;KACnB,CAAC;AACJ,CAAC;AAED,SAAS,mBAAmB,CAAC,OAAiB;IAC5C,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACrB,IAAI,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM;YAAE,OAAO,CAAC,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/clear.d.ts b/build/src/compile/selection/clear.d.ts new file mode 100644 index 0000000000..e8dd1763b1 --- /dev/null +++ b/build/src/compile/selection/clear.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const clear: SelectionCompiler; +export default clear; +//# sourceMappingURL=clear.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/clear.d.ts.map b/build/src/compile/selection/clear.d.ts.map new file mode 100644 index 0000000000..8ad230dcc0 --- /dev/null +++ b/build/src/compile/selection/clear.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"clear.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/clear.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAEpC,QAAA,MAAM,KAAK,EAAE,iBAsDZ,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/clear.js b/build/src/compile/selection/clear.js new file mode 100644 index 0000000000..e0b5f247fe --- /dev/null +++ b/build/src/compile/selection/clear.js @@ -0,0 +1,56 @@ +import { parseSelector } from 'vega-event-selector'; +import { isString } from 'vega-util'; +import { TUPLE } from '.'; +import { varName } from '../../util'; +import inputBindings from './inputs'; +import toggle, { TOGGLE } from './toggle'; +const clear = { + defined: selCmpt => { + return selCmpt.clear !== undefined && selCmpt.clear !== false; + }, + parse: (model, selCmpt) => { + if (selCmpt.clear) { + selCmpt.clear = isString(selCmpt.clear) ? parseSelector(selCmpt.clear, 'view') : selCmpt.clear; + } + }, + topLevelSignals: (model, selCmpt, signals) => { + if (inputBindings.defined(selCmpt)) { + for (const proj of selCmpt.project.items) { + const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`)); + if (idx !== -1) { + signals[idx].on.push({ events: selCmpt.clear, update: 'null' }); + } + } + } + return signals; + }, + signals: (model, selCmpt, signals) => { + function addClear(idx, update) { + if (idx !== -1 && signals[idx].on) { + signals[idx].on.push({ events: selCmpt.clear, update }); + } + } + // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. + if (selCmpt.type === 'interval') { + for (const proj of selCmpt.project.items) { + const vIdx = signals.findIndex(n => n.name === proj.signals.visual); + addClear(vIdx, '[0, 0]'); + if (vIdx === -1) { + const dIdx = signals.findIndex(n => n.name === proj.signals.data); + addClear(dIdx, 'null'); + } + } + } + else { + let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE); + addClear(tIdx, 'null'); + if (toggle.defined(selCmpt)) { + tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE); + addClear(tIdx, 'false'); + } + } + return signals; + } +}; +export default clear; +//# sourceMappingURL=clear.js.map \ No newline at end of file diff --git a/build/src/compile/selection/clear.js.map b/build/src/compile/selection/clear.js.map new file mode 100644 index 0000000000..c2b35f4832 --- /dev/null +++ b/build/src/compile/selection/clear.js.map @@ -0,0 +1 @@ +{"version":3,"file":"clear.js","sourceRoot":"","sources":["../../../../src/compile/selection/clear.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,GAAG,CAAC;AACxB,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,aAAa,MAAM,UAAU,CAAC;AACrC,OAAO,MAAM,EAAE,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGxC,MAAM,KAAK,GAAsB;IAC/B,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,OAAO,OAAO,CAAC,KAAK,KAAK,SAAS,IAAI,OAAO,CAAC,KAAK,KAAK,KAAK,CAAC;IAChE,CAAC;IAED,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,IAAI,OAAO,CAAC,KAAK,EAAE;YACjB,OAAO,CAAC,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;SAChG;IACH,CAAC;IAED,eAAe,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QAC3C,IAAI,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;YAClC,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE;gBACxC,MAAM,GAAG,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,GAAG,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,E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EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAEvB,IAAI,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gBAC3B,IAAI,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;gBAChE,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;aACzB;SACF;QAED,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/index.d.ts b/build/src/compile/selection/index.d.ts new file mode 100644 index 0000000000..8e3f841eef --- /dev/null +++ b/build/src/compile/selection/index.d.ts @@ -0,0 +1,46 @@ +import { Binding, Signal, Stream } from 'vega'; +import { BrushConfig, LegendBinding, SelectionInit, SelectionInitInterval, SelectionResolution, SelectionType } from '../../selection'; +import { Dict } from '../../util'; +import { OutputNode } from '../data/dataflow'; +import { Model } from '../model'; +import { UnitModel } from '../unit'; +import { SelectionProjection, SelectionProjectionComponent } from './project'; +import { SelectionParameter } from '../../selection'; +import { ParameterName } from '../../parameter'; +export declare const STORE = "_store"; +export declare const TUPLE = "_tuple"; +export declare const MODIFY = "_modify"; +export declare const SELECTION_DOMAIN = "_selection_domain_"; +export declare const VL_SELECTION_RESOLVE = "vlSelectionResolve"; +export interface SelectionComponent { + name: ParameterName; + type: T; + init?: (T extends 'interval' ? SelectionInitInterval : T extends 'point' ? SelectionInit : never)[][]; + events: Stream[]; + materialized: OutputNode; + bind?: 'scales' | Binding | Dict | LegendBinding; + resolve: SelectionResolution; + mark?: BrushConfig; + project: SelectionProjectionComponent; + scales?: SelectionProjection[]; + toggle?: string; + translate?: any; + zoom?: any; + nearest?: any; + clear?: any; +} +export interface SelectionCompiler { + defined: (selCmpt: SelectionComponent) => boolean; + parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionParameter) => void; + signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: Signal[]) => Signal[]; + topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: Signal[]) => Signal[]; + modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string; + marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[]; +} +export declare const selectionCompilers: SelectionCompiler[]; +export declare function unitName(model: Model, { escape }?: { + escape: boolean; +}): string; +export declare function requiresSelectionId(model: Model): boolean; +export declare function disableDirectManipulation(selCmpt: SelectionComponent, selDef: SelectionParameter<'point'>): void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/index.d.ts.map b/build/src/compile/selection/index.d.ts.map new file mode 100644 index 0000000000..384f974d65 --- /dev/null +++ b/build/src/compile/selection/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAY,MAAM,EAAE,MAAM,EAAC,MAAM,MAAM,CAAC;AAGvD,OAAO,EACL,WAAW,EACX,aAAa,EACb,aAAa,EACb,qBAAqB,EACrB,mBAAmB,EACnB,aAAa,EACd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,IAAI,EAAO,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE5C,OAAO,EAAe,KAAK,EAAC,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAC,mBAAmB,EAAE,4BAA4B,EAAC,MAAM,WAAW,CAAC;AAC5E,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAUnD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB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F,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IAC5F,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,MAAM,EAAE,CAAC;IAChG,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACxF,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC;CACnF;AAGD,eAAO,MAAM,kBAAkB,EAAE,iBAAiB,EAejD,CAAC;AAYF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,EAAC,MAAM,EAAC;;CAAiB,UAY/D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,KAAK,WAI/C;AAID,wBAAgB,yBAAyB,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,EAAE,kBAAkB,CAAC,OAAO,CAAC,QAIzG"} \ No newline at end of file diff --git a/build/src/compile/selection/index.js b/build/src/compile/selection/index.js new file mode 100644 index 0000000000..d266d23a16 --- /dev/null +++ b/build/src/compile/selection/index.js @@ -0,0 +1,74 @@ +import { isString } from 'vega'; +import { stringValue } from 'vega-util'; +import { FACET_CHANNELS } from '../../channel'; +import { vals } from '../../util'; +import { isFacetModel } from '../model'; +import interval from './interval'; +import point from './point'; +import clear from './clear'; +import inputs from './inputs'; +import nearest from './nearest'; +import project from './project'; +import scales from './scales'; +import legends from './legends'; +import toggle from './toggle'; +import translate from './translate'; +import zoom from './zoom'; +export const STORE = '_store'; +export const TUPLE = '_tuple'; +export const MODIFY = '_modify'; +export const SELECTION_DOMAIN = '_selection_domain_'; +export const VL_SELECTION_RESOLVE = 'vlSelectionResolve'; +// Order matters for parsing and assembly. +export const selectionCompilers = [ + point, + interval, + project, + toggle, + // Bindings may disable direct manipulation. + inputs, + scales, + legends, + clear, + translate, + zoom, + nearest +]; +function getFacetModel(model) { + let parent = model.parent; + while (parent) { + if (isFacetModel(parent)) + break; + parent = parent.parent; + } + return parent; +} +export function unitName(model, { escape } = { escape: true }) { + let name = escape ? stringValue(model.name) : model.name; + const facetModel = getFacetModel(model); + if (facetModel) { + const { facet } = facetModel; + for (const channel of FACET_CHANNELS) { + if (facet[channel]) { + name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`; + } + } + } + return name; +} +export function requiresSelectionId(model) { + return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => { + return identifier || selCmpt.project.hasSelectionId; + }, false); +} +// Binding a point selection to query widgets or legends disables default direct manipulation interaction. +// A user can choose to re-enable it by explicitly specifying triggering input events. +export function disableDirectManipulation(selCmpt, selDef) { + if (isString(selDef.select) || !selDef.select.on) + delete selCmpt.events; + if (isString(selDef.select) || !selDef.select.clear) + delete selCmpt.clear; + if (isString(selDef.select) || !selDef.select.toggle) + delete selCmpt.toggle; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/compile/selection/index.js.map b/build/src/compile/selection/index.js.map new file mode 100644 index 0000000000..99f174d971 --- /dev/null +++ b/build/src/compile/selection/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/compile/selection/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,QAAQ,EAAiB,MAAM,MAAM,CAAC;AACvD,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAS7C,OAAO,EAAO,IAAI,EAAC,MA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M;QAAE,OAAO,OAAO,CAAC,MAAM,CAAC;AAC9E,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/inputs.d.ts b/build/src/compile/selection/inputs.d.ts new file mode 100644 index 0000000000..dd5c8543f2 --- /dev/null +++ b/build/src/compile/selection/inputs.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const inputBindings: SelectionCompiler<'point'>; +export default inputBindings; +//# sourceMappingURL=inputs.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/inputs.d.ts.map b/build/src/compile/selection/inputs.d.ts.map new file mode 100644 index 0000000000..ee969689f1 --- /dev/null +++ b/build/src/compile/selection/inputs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"inputs.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/inputs.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAIpC,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,OAAO,CA6D7C,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/inputs.js b/build/src/compile/selection/inputs.js new file mode 100644 index 0000000000..1d950ce0df --- /dev/null +++ b/build/src/compile/selection/inputs.js @@ -0,0 +1,60 @@ +import { stringValue } from 'vega-util'; +import { disableDirectManipulation, TUPLE } from '.'; +import { varName } from '../../util'; +import { assembleInit } from './assemble'; +import nearest from './nearest'; +import { TUPLE_FIELDS } from './project'; +import { isLegendBinding } from '../../selection'; +const inputBindings = { + defined: selCmpt => { + return (selCmpt.type === 'point' && + selCmpt.resolve === 'global' && + selCmpt.bind && + selCmpt.bind !== 'scales' && + !isLegendBinding(selCmpt.bind)); + }, + parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef), + topLevelSignals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const bind = selCmpt.bind; + const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). + const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; + proj.items.forEach((p, i) => { + const sgname = varName(`${name}_${p.field}`); + const hasSignal = signals.filter(s => s.name === sgname); + if (!hasSignal.length) { + signals.unshift({ + name: sgname, + ...(init ? { init: assembleInit(init[i]) } : { value: null }), + on: selCmpt.events + ? [ + { + events: selCmpt.events, + update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null` + } + ] + : [], + bind: bind[p.field] ?? bind[p.channel] ?? bind + }); + } + }); + return signals; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const signal = signals.filter(s => s.name === name + TUPLE)[0]; + const fields = name + TUPLE_FIELDS; + const values = proj.items.map(p => varName(`${name}_${p.field}`)); + const valid = values.map(v => `${v} !== null`).join(' && '); + if (values.length) { + signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; + } + delete signal.value; + delete signal.on; + return signals; + } +}; +export default inputBindings; +//# sourceMappingURL=inputs.js.map \ No newline at end of file diff --git a/build/src/compile/selection/inputs.js.map b/build/src/compile/selection/inputs.js.map new file mode 100644 index 0000000000..a0758a00c7 --- /dev/null +++ b/build/src/compile/selection/inputs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"inputs.js","sourceRoot":"","sources":["../../../../src/compile/selection/inputs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,yBAAyB,EAAE,KAAK,EAAC,MAAM,GAAG,CAAC;AACnD,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,YAAY,EAAC,MAAM,YAAY,CAAC;AACxC,OAAO,OAAO,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAEvC,OAAO,EAAC,eAAe,EAAC,MAAM,iBAAiB,CAAC;AAGhD,MAAM,aAAa,GAA+B;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C,MAAM,GAAG,GAAG,KAAK,eAAe,MAAM,cAAc,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC;SACzF;QAED,OAAO,MAAM,CAAC,KAAK,CAAC;QACpB,OAAO,MAAM,CAAC,EAAE,CAAC;QAEjB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF,CAAC;AAEF,eAAe,aAAa,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/interval.d.ts b/build/src/compile/selection/interval.d.ts new file mode 100644 index 0000000000..73aa794a49 --- /dev/null +++ b/build/src/compile/selection/interval.d.ts @@ -0,0 +1,12 @@ +import { SelectionCompiler } from '.'; +import { FieldName } from '../../channeldef'; +import { IntervalSelectionConfigWithoutType } from '../../selection'; +export declare const BRUSH = "_brush"; +export declare const SCALE_TRIGGER = "_scale_trigger"; +export declare const GEO_INIT_TICK = "geo_interval_init_tick"; +export type IntervalSelectionConfigWithField = IntervalSelectionConfigWithoutType & { + fields?: FieldName[]; +}; +declare const interval: SelectionCompiler<'interval'>; +export default interval; +//# sourceMappingURL=interval.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/interval.d.ts.map b/build/src/compile/selection/interval.d.ts.map new file mode 100644 index 0000000000..0cba29ea26 --- /dev/null +++ b/build/src/compile/selection/interval.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/interval.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAA6C,MAAM,GAAG,CAAC;AAEhF,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAG3C,OAAO,EAAC,kCAAkC,EAAsC,MAAM,iBAAiB,CAAC;AASxG,eAAO,MAAM,KAAK,WAAW,CAAC;AAC9B,eAAO,MAAM,aAAa,mBAAmB,CAAC;AAC9C,eAAO,MAAM,aAAa,2BAA2B,CAAC;AAKtD,MAAM,MAAM,gCAAgC,GAAG,kCAAkC,GAAG;IAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAA;CAAC,CAAC;AAE3G,QAAA,MAAM,QAAQ,EAAE,iBAAiB,CAAC,UAAU,CA6P3C,CAAC;AACF,eAAe,QAAQ,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/interval.js b/build/src/compile/selection/interval.js new file mode 100644 index 0000000000..dd51b5152d --- /dev/null +++ b/build/src/compile/selection/interval.js @@ -0,0 +1,302 @@ +import { isObject } from 'vega'; +import { array, stringValue } from 'vega-util'; +import { STORE, TUPLE, unitName } from '.'; +import { LATITUDE, LONGITUDE, X, Y } from '../../channel'; +import { warn } from '../../log'; +import { hasContinuousDomain } from '../../scale'; +import { SELECTION_ID } from '../../selection'; +import { keys, vals } from '../../util'; +import { isUnitModel } from '../model'; +import { assembleInit } from './assemble'; +import { TUPLE_FIELDS } from './project'; +import scales from './scales'; +export const BRUSH = '_brush'; +export const SCALE_TRIGGER = '_scale_trigger'; +export const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481 +const INIT = '_init'; +const CENTER = '_center'; +const interval = { + defined: selCmpt => selCmpt.type === 'interval', + parse: (model, selCmpt, selDef) => { + var _a; + if (model.hasProjection) { + const def = { ...(isObject(selDef.select) ? selDef.select : {}) }; + def.fields = [SELECTION_ID]; + if (!def.encodings) { + // Remap default x/y projection + def.encodings = selDef.value ? keys(selDef.value) : [LONGITUDE, LATITUDE]; + } + selDef.select = { type: 'interval', ...def }; + } + if (selCmpt.translate && !scales.defined(selCmpt)) { + const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(selCmpt.name + BRUSH)}`; + for (const evt of selCmpt.events) { + if (!evt.between) { + warn(`${evt} is not an ordered event stream for interval selections.`); + continue; + } + const filters = array(((_a = evt.between[0]).filter ?? (_a.filter = []))); + if (filters.indexOf(filterExpr) < 0) { + filters.push(filterExpr); + } + } + } + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const tupleSg = name + TUPLE; + const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y); + const init = selCmpt.init ? selCmpt.init[0] : null; + signals.push(...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), [])); + if (!model.hasProjection) { + // Proxy scale reactions to ensure that an infinite loop doesn't occur + // when an interval selection filter touches the scale. + if (!scales.defined(selCmpt)) { + const triggerSg = name + SCALE_TRIGGER; + const scaleTriggers = channels.map(proj => { + const channel = proj.channel; + const { data: dname, visual: vname } = proj.signals; + const scaleName = stringValue(model.scaleName(channel)); + const scaleType = model.getScaleComponent(channel).get('type'); + const toNum = hasContinuousDomain(scaleType) ? '+' : ''; + return (`(!isArray(${dname}) || ` + + `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` + + `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`); + }); + if (scaleTriggers.length) { + signals.push({ + name: triggerSg, + value: {}, + on: [ + { + events: channels.map(proj => ({ scale: model.scaleName(proj.channel) })), + update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}` + } + ] + }); + } + } + // Only add an interval to the store if it has valid data extents. Data extents + // are set to null if pixel extents are equal to account for intervals over + // ordinal/nominal domains which, when inverted, will still produce a valid datum. + const dataSignals = channels.map(proj => proj.signals.data); + const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`; + return signals.concat({ + name: tupleSg, + ...(init ? { init: `{${update}: ${assembleInit(init)}}` } : {}), + ...(dataSignals.length + ? { + on: [ + { + events: [{ signal: dataSignals.join(' || ') }], + update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null` + } + ] + } + : {}) + }); + } + else { + const projection = stringValue(model.projectionName()); + const centerSg = model.projectionName() + CENTER; + const { x, y } = selCmpt.project.hasChannel; + const xvname = x && x.signals.visual; + const yvname = y && y.signals.visual; + const xinit = x ? init && init[x.index] : `${centerSg}[0]`; + const yinit = y ? init && init[y.index] : `${centerSg}[1]`; + const sizeSg = (layout) => model.getSizeSignalRef(layout).signal; + const bbox = `[` + + `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` + + `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` + + `${yvname ? yvname + '[1]' : sizeSg('height')}]` + + `]`; + if (init) { + signals.unshift({ + name: name + INIT, + init: `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` + + `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]` + }); + if (!x || !y) { + // If initializing a uni-dimensional brush, use the center of the view to determine the other coord + const hasCenterSg = signals.find(s => s.name === centerSg); + if (!hasCenterSg) { + signals.unshift({ + name: centerSg, + update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])` + }); + } + } + } + const intersect = `intersect(${bbox}, {markname: ${stringValue(model.getName('marks'))}}, unit.mark)`; + const base = `{unit: ${unitName(model)}}`; + const update = `vlSelectionTuples(${intersect}, ${base})`; + const visualSignals = channels.map(proj => proj.signals.visual); + return signals.concat({ + name: tupleSg, + on: [ + { + events: [ + ...(visualSignals.length ? [{ signal: visualSignals.join(' || ') }] : []), + ...(init ? [{ signal: GEO_INIT_TICK }] : []) + ], + update + } + ] + }); + } + }, + topLevelSignals: (model, selCmpt, signals) => { + if (isUnitModel(model) && model.hasProjection && selCmpt.init) { + // Workaround for https://github.com/vega/vega/issues/3481 + // The scenegraph isn't populated on the first pulse. So we use a timer signal + // to re-pulse the dataflow as soon as possible. We return an object to ensure + // this only occurs once. + const hasTick = signals.filter(s => s.name === GEO_INIT_TICK); + if (!hasTick.length) { + signals.unshift({ + name: GEO_INIT_TICK, + value: null, + on: [ + { + events: 'timer{1}', + update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}` + } + ] + }); + } + } + return signals; + }, + marks: (model, selCmpt, marks) => { + const name = selCmpt.name; + const { x, y } = selCmpt.project.hasChannel; + const xvname = x?.signals.visual; + const yvname = y?.signals.visual; + const store = `data(${stringValue(selCmpt.name + STORE)})`; + // Do not add a brush if we're binding to scales + // or we don't have a valid interval projection + if (scales.defined(selCmpt) || (!x && !y)) { + return marks; + } + const update = { + x: x !== undefined ? { signal: `${xvname}[0]` } : { value: 0 }, + y: y !== undefined ? { signal: `${yvname}[0]` } : { value: 0 }, + x2: x !== undefined ? { signal: `${xvname}[1]` } : { field: { group: 'width' } }, + y2: y !== undefined ? { signal: `${yvname}[1]` } : { field: { group: 'height' } } + }; + // If the selection is resolved to global, only a single interval is in + // the store. Wrap brush mark's encodings with a production rule to test + // this based on the `unit` property. Hide the brush mark if it corresponds + // to a unit different from the one in the store. + if (selCmpt.resolve === 'global') { + for (const key of keys(update)) { + update[key] = [ + { + test: `${store}.length && ${store}[0].unit === ${unitName(model)}`, + ...update[key] + }, + { value: 0 } + ]; + } + } + // Two brush marks ensure that fill colors and other aesthetic choices do + // not interefere with the core marks, but that the brushed region can still + // be interacted with (e.g., dragging it around). + const { fill, fillOpacity, cursor, ...stroke } = selCmpt.mark; + const vgStroke = keys(stroke).reduce((def, k) => { + def[k] = [ + { + test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`] + .filter(t => t) + .join(' && '), + value: stroke[k] + }, + { value: null } + ]; + return def; + }, {}); + return [ + { + name: `${name + BRUSH}_bg`, + type: 'rect', + clip: true, + encode: { + enter: { + fill: { value: fill }, + fillOpacity: { value: fillOpacity } + }, + update + } + }, + ...marks, + { + name: name + BRUSH, + type: 'rect', + clip: true, + encode: { + enter: { + ...(cursor ? { cursor: { value: cursor } } : {}), + fill: { value: 'transparent' } + }, + update: { ...update, ...vgStroke } + } + } + ]; + } +}; +export default interval; +/** + * Returns the visual and data signals for an interval selection. + */ +function channelSignals(model, selCmpt, proj, init) { + const scaledInterval = !model.hasProjection; + const channel = proj.channel; + const vname = proj.signals.visual; + const scaleName = stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName()); + const scaled = (str) => `scale(${scaleName}, ${str})`; + const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; + const coord = `${channel}(unit)`; + const von = selCmpt.events.reduce((def, evt) => { + return [ + ...def, + { events: evt.between[0], update: `[${coord}, ${coord}]` }, + { events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]` } // Brush End + ]; + }, []); + if (scaledInterval) { + const dname = proj.signals.data; + const hasScales = scales.defined(selCmpt); + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + const vinit = init ? { init: assembleInit(init, true, scaled) } : { value: [] }; + // React to pan/zooms of continuous scales. Non-continuous scales + // (band, point) cannot be pan/zoomed and any other changes + // to their domains (e.g., filtering) should clear the brushes. + von.push({ + events: { signal: selCmpt.name + SCALE_TRIGGER }, + update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]` + }); + return hasScales + ? [{ name: dname, on: [] }] + : [ + { name: vname, ...vinit, on: von }, + { + name: dname, + ...(init ? { init: assembleInit(init) } : {}), + on: [ + { + events: { signal: vname }, + update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})` + } + ] + } + ]; + } + else { + const initIdx = channel === X ? 0 : 1; + const initSg = selCmpt.name + INIT; + const vinit = init ? { init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]` } : { value: [] }; + return [{ name: vname, ...vinit, on: von }]; + } +} +//# sourceMappingURL=interval.js.map \ No newline at end of file diff --git a/build/src/compile/selection/interval.js.map b/build/src/compile/selection/interval.js.map new file mode 100644 index 0000000000..c62fae8aae --- /dev/null +++ b/build/src/compile/selection/interval.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interval.js","sourceRoot":"","sources":["../../../../src/compile/selection/interval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAA0C,MAAM,MAAM,CAAC;AACvE,OAAO,EAAC,KAAK,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AAC7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SAAS;YACd,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,EAAC,CAAC;YACzB,CAAC,CAAC;gBACE,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,EAAC;gBAChC;oBACE,IAAI,EAAE,KAAK;oBACX,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,YAAY,CAAC,IAAI,CAAC,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;oBAC3C,EAAE,EAAE;wBACF;4BACE,MAAM,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC;4BACvB,MAAM,EAAE,GAAG,KAAK,WAAW,KAAK,uBAAuB,SAAS,KAAK,KAAK,GAAG;yBAC9E;qBACF;iBACF;aACF,CAAC;KACP;SAAM;QACL,MAAM,OAAO,GAAG,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC;QACnC,MAAM,KAAK,GAAgB,IAAI,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,IAAI,MAAM,OAAO,OAAO,MAAM,MAAM,OAAO,OAAO,IAAI,EAAC,CAAC,CAAC,CAAC,EAAC,KAAK,EAAE,EAAE,EAAC,CAAC;QAC/G,OAAO,CAAC,EAAC,IAAI,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,EAAE,GAAG,EAAC,CAAC,CAAC;KAC3C;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/legends.d.ts b/build/src/compile/selection/legends.d.ts new file mode 100644 index 0000000000..0aa4775aab --- /dev/null +++ b/build/src/compile/selection/legends.d.ts @@ -0,0 +1,8 @@ +import { NonPositionScaleChannel } from '../../channel'; +import { LegendComponent } from '../legend/component'; +import { UnitModel } from '../unit'; +import { SelectionCompiler } from '.'; +declare const legendBindings: SelectionCompiler<'point'>; +export default legendBindings; +export declare function parseInteractiveLegend(model: UnitModel, channel: NonPositionScaleChannel, legendCmpt: LegendComponent): void; +//# sourceMappingURL=legends.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/legends.d.ts.map b/build/src/compile/selection/legends.d.ts.map new file mode 100644 index 0000000000..91015add79 --- /dev/null +++ b/build/src/compile/selection/legends.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"legends.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/legends.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,uBAAuB,EAAC,MAAM,eAAe,CAAC;AAItD,OAAO,EAAC,eAAe,EAAC,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAEpC,QAAA,MAAM,cAAc,EAAE,iBAAiB,CAAC,OAAO,CAuG9C,CAAC;AAEF,eAAe,cAAc,CAAC;AAE9B,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,uBAAuB,EAChC,UAAU,EAAE,eAAe,QAY5B"} \ No newline at end of file diff --git a/build/src/compile/selection/legends.js b/build/src/compile/selection/legends.js new file mode 100644 index 0000000000..b9883df765 --- /dev/null +++ b/build/src/compile/selection/legends.js @@ -0,0 +1,118 @@ +import { isObject } from 'vega'; +import { parseSelector } from 'vega-event-selector'; +import { array, isString } from 'vega-util'; +import { disableDirectManipulation, TUPLE } from '.'; +import * as log from '../../log'; +import { isLegendBinding, isLegendStreamBinding, SELECTION_ID } from '../../selection'; +import { duplicate, vals, varName } from '../../util'; +import { TUPLE_FIELDS } from './project'; +import { TOGGLE } from './toggle'; +const legendBindings = { + defined: selCmpt => { + const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); + const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; + if (spec && !projLen) { + log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION); + } + return spec && projLen; + }, + parse: (model, selCmpt, selDef) => { + // Allow legend items to be toggleable by default even though direct manipulation is disabled. + const selDef_ = duplicate(selDef); + selDef_.select = isString(selDef_.select) + ? { type: selDef_.select, toggle: selCmpt.toggle } + : { ...selDef_.select, toggle: selCmpt.toggle }; + disableDirectManipulation(selCmpt, selDef_); + if (isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) { + const legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; + for (const evt of selCmpt.events) { + evt.filter = array(evt.filter ?? []); + if (!evt.filter.includes(legendFilter)) { + evt.filter.push(legendFilter); + } + } + } + const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; + const stream = isString(evt) ? parseSelector(evt, 'view') : array(evt); + selCmpt.bind = { legend: { merge: stream } }; + }, + topLevelSignals: (model, selCmpt, signals) => { + const selName = selCmpt.name; + const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; + const markName = (name) => (s) => { + const ds = duplicate(s); + ds.markname = name; + return ds; + }; + for (const proj of selCmpt.project.items) { + if (!proj.hasLegend) + continue; + const prefix = `${varName(proj.field)}_legend`; + const sgName = `${selName}_${prefix}`; + const hasSignal = signals.filter(s => s.name === sgName); + if (hasSignal.length === 0) { + const events = stream.merge + .map(markName(`${prefix}_symbols`)) + .concat(stream.merge.map(markName(`${prefix}_labels`))) + .concat(stream.merge.map(markName(`${prefix}_entries`))); + signals.unshift({ + name: sgName, + ...(!selCmpt.init ? { value: null } : {}), + on: [ + // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. + { + events, + update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value', + force: true + }, + { events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true } + ] + }); + } + } + return signals; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const tuple = signals.find(s => s.name === name + TUPLE); + const fields = name + TUPLE_FIELDS; + const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`)); + const valid = values.map(v => `${v} !== null`).join(' && '); + const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; + if (selCmpt.events && values.length > 0) { + tuple.on.push({ + events: values.map(signal => ({ signal })), + update + }); + } + else if (values.length > 0) { + tuple.update = update; + delete tuple.value; + delete tuple.on; + } + const toggle = signals.find(s => s.name === name + TOGGLE); + const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; + if (toggle) { + if (!selCmpt.events) + toggle.on[0].events = events; + else + toggle.on.push({ ...toggle.on[0], events }); + } + return signals; + } +}; +export default legendBindings; +export function parseInteractiveLegend(model, channel, legendCmpt) { + const field = model.fieldDef(channel)?.field; + for (const selCmpt of vals(model.component.selection ?? {})) { + const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel]; + if (proj && legendBindings.defined(selCmpt)) { + const legendSelections = legendCmpt.get('selections') ?? []; + legendSelections.push(selCmpt.name); + legendCmpt.set('selections', legendSelections, false); + proj.hasLegend = true; + } + } +} +//# sourceMappingURL=legends.js.map \ No newline at end of file diff --git a/build/src/compile/selection/legends.js.map b/build/src/compile/selection/legends.js.map new file mode 100644 index 0000000000..0cdc86a719 --- /dev/null +++ b/build/src/compile/selection/legends.js.map @@ -0,0 +1 @@ +{"version":3,"file":"legends.js","sourceRoot":"","sources":["../../../../src/compile/selection/legends.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAkC,MAAM,MAAM,CAAC;AAC/D,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAClD,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAC,yBAAyB,EAAE,KAAK,EAAC,MAAM,GAAG,CAAC;AAEnD,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,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E,gBAAgB,EAAE,KAAK,CAAC,CAAC;YACtD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;SACvB;KACF;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/nearest.d.ts b/build/src/compile/selection/nearest.d.ts new file mode 100644 index 0000000000..1649e19fb3 --- /dev/null +++ b/build/src/compile/selection/nearest.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const nearest: SelectionCompiler<'point'>; +export default nearest; +//# sourceMappingURL=nearest.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/nearest.d.ts.map b/build/src/compile/selection/nearest.d.ts.map new file mode 100644 index 0000000000..1f8a0ab176 --- /dev/null +++ b/build/src/compile/selection/nearest.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"nearest.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/nearest.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAIpC,QAAA,MAAM,OAAO,EAAE,iBAAiB,CAAC,OAAO,CAgEvC,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/nearest.js b/build/src/compile/selection/nearest.js new file mode 100644 index 0000000000..109716bd1a --- /dev/null +++ b/build/src/compile/selection/nearest.js @@ -0,0 +1,66 @@ +import * as log from '../../log'; +import { isPathMark } from '../../mark'; +import { tooltip } from '../mark/encode'; +const VORONOI = 'voronoi'; +const nearest = { + defined: selCmpt => { + return selCmpt.type === 'point' && selCmpt.nearest; + }, + parse: (model, selCmpt) => { + // Scope selection events to the voronoi mark to prevent capturing + // events that occur on the group mark (https://github.com/vega/vega/issues/2112). + if (selCmpt.events) { + for (const s of selCmpt.events) { + s.markname = model.getName(VORONOI); + } + } + }, + marks: (model, selCmpt, marks) => { + const { x, y } = selCmpt.project.hasChannel; + const markType = model.mark; + if (isPathMark(markType)) { + log.warn(log.message.nearestNotSupportForContinuous(markType)); + return marks; + } + const cellDef = { + name: model.getName(VORONOI), + type: 'path', + interactive: true, + from: { data: model.getName('marks') }, + encode: { + update: { + fill: { value: 'transparent' }, + strokeWidth: { value: 0.35 }, + stroke: { value: 'transparent' }, + isVoronoi: { value: true }, + ...tooltip(model, { reactiveGeom: true }) + } + }, + transform: [ + { + type: 'voronoi', + x: { expr: x || !y ? 'datum.datum.x || 0' : '0' }, + y: { expr: y || !x ? 'datum.datum.y || 0' : '0' }, + size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] + } + ] + }; + let index = 0; + let exists = false; + marks.forEach((mark, i) => { + const name = mark.name ?? ''; + if (name === model.component.mark[0].name) { + index = i; + } + else if (name.indexOf(VORONOI) >= 0) { + exists = true; + } + }); + if (!exists) { + marks.splice(index + 1, 0, cellDef); + } + return marks; + } +}; +export default nearest; +//# sourceMappingURL=nearest.js.map \ No newline at end of file diff --git a/build/src/compile/selection/nearest.js.map b/build/src/compile/selection/nearest.js.map new file mode 100644 index 0000000000..cbc8cd098e --- /dev/null +++ b/build/src/compile/selection/nearest.js.map @@ -0,0 +1 @@ +{"version":3,"file":"nearest.js","sourceRoot":"","sources":["../../../../src/compile/selection/nearest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,UAAU,EAAC,MAAM,YAAY,CAAC;AACtC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAGvC,MAAM,OAAO,GAAG,SAAS,CAAC;AAE1B,MAAM,OAAO,GAA+B;IAC1C,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,OAAO,CAAC,OAAO,CAAC;IACrD,CAAC;IAED,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QACxB,kEAAkE;QAClE,kFAAkF;QAClF,IAAI,OAAO,CAAC,MAAM,EAAE;YAClB,KAAK,MAAM,CAAC,IAAI,OAAO,CAAC,MAAM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AAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,GAAG,EAAC;oBAC/C,IAAI,EAAE,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;iBAC1E;aACF;SACF,CAAC;QAEF,IAAI,KAAK,GAAG,CAAC,CAAC;QACd,IAAI,MAAM,GAAG,KAAK,CAAC;QACnB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE;YACxB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC7B,IAAI,IAAI,KAAK,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;gBACzC,KAAK,GAAG,CAAC,CAAC;aACX;iBAAM,IAAI,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACrC,MAAM,GAAG,IAAI,CAAC;aACf;QACH,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,EAAE;YACX,KAAK,CAAC,MAAM,CAAC,KAAK,GAAG,CAAC,EAAE,CAAC,EAAE,OAAO,CAAC,CAAC;SACrC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/parse.d.ts b/build/src/compile/selection/parse.d.ts new file mode 100644 index 0000000000..16609f4968 --- /dev/null +++ b/build/src/compile/selection/parse.d.ts @@ -0,0 +1,12 @@ +import { SelectionComponent } from '.'; +import { SelectionParameter, ParameterExtent } from '../../selection'; +import { Dict } from '../../util'; +import { DataFlowNode, OutputNode } from '../data/dataflow'; +import { Model } from '../model'; +import { UnitModel } from '../unit'; +import { ParameterPredicate } from '../../predicate'; +export declare function parseUnitSelection(model: UnitModel, selDefs: SelectionParameter[]): Dict>; +export declare function parseSelectionPredicate(model: Model, pred: ParameterPredicate, dfnode?: DataFlowNode, datum?: string): string; +export declare function parseSelectionExtent(model: Model, name: string, extent: ParameterExtent): string; +export declare function materializeSelections(model: UnitModel, main: OutputNode): void; +//# sourceMappingURL=parse.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/parse.d.ts.map b/build/src/compile/selection/parse.d.ts.map new file mode 100644 index 0000000000..35ab889536 --- /dev/null +++ b/build/src/compile/selection/parse.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/parse.ts"],"names":[],"mappings":"AAEA,OAAO,EAAqB,kBAAkB,EAAQ,MAAM,GAAG,CAAC;AAEhE,OAAO,EAAsB,kBAAkB,EAAE,eAAe,EAAC,MAAM,iBAAiB,CAAC;AACzF,OAAO,EAAC,IAAI,EAAkD,MAAM,YAAY,CAAC;AACjF,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,kBAAkB,CAAC;AAE1D,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,OAAO,EAAC,kBAAkB,EAAC,MAAM,iBAAiB,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,kBAAkB,EAAE,iCAkDjF;AAED,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,KAAK,EACZ,IAAI,EAAE,kBAAkB,EACxB,MAAM,CAAC,EAAE,YAAY,EACrB,KAAK,SAAU,GACd,MAAM,CA6BR;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,eAAe,UAoCvF;AAED,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,QAUvE"} \ No newline at end of file diff --git a/build/src/compile/selection/parse.js b/build/src/compile/selection/parse.js new file mode 100644 index 0000000000..8bfb3989b8 --- /dev/null +++ b/build/src/compile/selection/parse.js @@ -0,0 +1,120 @@ +import { parseSelector } from 'vega-event-selector'; +import { array, isObject, isString, stringValue } from 'vega-util'; +import { selectionCompilers, STORE } from '.'; +import { warn } from '../../log'; +import { duplicate, entries, replacePathInField, varName } from '../../util'; +import { OutputNode } from '../data/dataflow'; +import { FilterNode } from '../data/filter'; +import { DataSourceType } from '../../data'; +export function parseUnitSelection(model, selDefs) { + const selCmpts = {}; + const selectionConfig = model.config.selection; + if (!selDefs || !selDefs.length) + return selCmpts; + for (const def of selDefs) { + const name = varName(def.name); + const selDef = def.select; + const type = isString(selDef) ? selDef : selDef.type; + const defaults = isObject(selDef) ? duplicate(selDef) : { type }; + // Set default values from config if a property hasn't been specified, + // or if it is true. E.g., "translate": true should use the default + // event handlers for translate. However, true may be a valid value for + // a property (e.g., "nearest": true). + const cfg = selectionConfig[type]; + for (const key in cfg) { + // Project transform applies its defaults. + if (key === 'fields' || key === 'encodings') { + continue; + } + if (key === 'mark') { + defaults[key] = { ...cfg[key], ...defaults[key] }; + } + if (defaults[key] === undefined || defaults[key] === true) { + defaults[key] = duplicate(cfg[key] ?? defaults[key]); + } + } + const selCmpt = (selCmpts[name] = { + ...defaults, + name, + type, + init: def.value, + bind: def.bind, + events: isString(defaults.on) ? parseSelector(defaults.on, 'scope') : array(duplicate(defaults.on)) + }); + const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.parse) { + c.parse(model, selCmpt, def_); + } + } + } + return selCmpts; +} +export function parseSelectionPredicate(model, pred, dfnode, datum = 'datum') { + const name = isString(pred) ? pred : pred.param; + const vname = varName(name); + const store = stringValue(vname + STORE); + let selCmpt; + try { + selCmpt = model.getSelectionComponent(vname, name); + } + catch (e) { + // If a selection isn't found, treat as a variable parameter and coerce to boolean. + return `!!${vname}`; + } + if (selCmpt.project.timeUnit) { + const child = dfnode ?? model.component.data.raw; + const tunode = selCmpt.project.timeUnit.clone(); + if (child.parent) { + tunode.insertAsParentOf(child); + } + else { + child.parent = tunode; + } + } + const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest('; + const resolve = selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`; + const test = `${fn}${store}, ${datum}${resolve}`; + const length = `length(data(${store}))`; + return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`; +} +export function parseSelectionExtent(model, name, extent) { + const vname = varName(name); + const encoding = extent['encoding']; + let field = extent['field']; + let selCmpt; + try { + selCmpt = model.getSelectionComponent(vname, name); + } + catch (e) { + // If a selection isn't found, treat it as a variable parameter. + return vname; + } + if (!encoding && !field) { + field = selCmpt.project.items[0].field; + if (selCmpt.project.items.length > 1) { + warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + + `Using "field": ${stringValue(field)}.`); + } + } + else if (encoding && !field) { + const encodings = selCmpt.project.items.filter(p => p.channel === encoding); + if (!encodings.length || encodings.length > 1) { + field = selCmpt.project.items[0].field; + warn((!encodings.length ? 'No ' : 'Multiple ') + + `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.param)}. ` + + `Using "field": ${stringValue(field)}.`); + } + else { + field = encodings[0].field; + } + } + return `${selCmpt.name}[${stringValue(replacePathInField(field))}]`; +} +export function materializeSelections(model, main) { + for (const [selection, selCmpt] of entries(model.component.selection ?? {})) { + const lookupName = model.getName(`lookup_${selection}`); + model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { param: selection }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); + } +} +//# sourceMappingURL=parse.js.map \ No newline at end of file diff --git a/build/src/compile/selection/parse.js.map b/build/src/compile/selection/parse.js.map new file mode 100644 index 0000000000..d7990e5ba9 --- /dev/null +++ b/build/src/compile/selection/parse.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parse.js","sourceRoot":"","sources":["../../../../src/compile/selection/parse.ts"],"names":[],"mappings":"AAAA,OAAO,E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AK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;YACvC,IAAI,CACF,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,CAAC;gBACvC,YAAY,WAAW,CAAC,QAAQ,CAAC,iCAAiC,WAAW,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI;gBAC/F,kBAAkB,WAAW,CAAC,KAAK,CAAC,GAAG,CAC1C,CAAC;SACH;aAAM;YACL,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC;SAC5B;KACF;IAED,OAAO,GAAG,OAAO,CAAC,IAAI,IAAI,WAAW,CAAC,kBAAkB,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC;AACtE,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,KAAgB,EAAE,IAAgB;IACtE,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,SAAS,IAAI,EAAE,CAAC,EAAE;QAC3E,MAAM,UAAU,GAAG,KAAK,CAAC,OAAO,CAAC,UAAU,SAAS,EAAE,CAAC,CAAC;QACxD,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG,IAAI,UAAU,CAClF,IAAI,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,EAAC,KAAK,EAAE,SAAS,EAAC,CAAC,EAC/C,UAAU,EACV,cAAc,CAAC,MAAM,EACrB,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,mBAAmB,CACzC,CAAC;KACH;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/point.d.ts b/build/src/compile/selection/point.d.ts new file mode 100644 index 0000000000..a26e69e270 --- /dev/null +++ b/build/src/compile/selection/point.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const point: SelectionCompiler<'point'>; +export default point; +//# sourceMappingURL=point.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/point.d.ts.map b/build/src/compile/selection/point.d.ts.map new file mode 100644 index 0000000000..4f6008a300 --- /dev/null +++ b/build/src/compile/selection/point.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"point.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/point.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,iBAAiB,EAAkB,MAAM,GAAG,CAAC;AAMrD,QAAA,MAAM,KAAK,EAAE,iBAAiB,CAAC,OAAO,CA8DrC,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/point.js b/build/src/compile/selection/point.js new file mode 100644 index 0000000000..1df232edac --- /dev/null +++ b/build/src/compile/selection/point.js @@ -0,0 +1,63 @@ +import { stringValue } from 'vega-util'; +import { TUPLE, unitName } from '.'; +import { SELECTION_ID } from '../../selection'; +import { vals } from '../../util'; +import { BRUSH } from './interval'; +import { TUPLE_FIELDS } from './project'; +const point = { + defined: selCmpt => selCmpt.type === 'point', + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const fieldsSg = name + TUPLE_FIELDS; + const project = selCmpt.project; + const datum = '(item().isVoronoi ? datum.datum : datum)'; + // Only add a discrete selection to the store if a datum is present _and_ + // the interaction isn't occurring on a group mark. This guards against + // polluting interactive state with invalid values in faceted displays + // as the group marks are also data-driven. We force the update to account + // for constant null states but varying toggles (e.g., shift-click in + // whitespace followed by a click in whitespace; the store should only + // be cleared on the second click). + const brushes = vals(model.component.selection ?? {}) + .reduce((acc, cmpt) => { + return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc; + }, []) + .map(b => `indexof(item().mark.name, '${b}') < 0`) + .join(' && '); + const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${brushes ? ` && ${brushes}` : ''}`; + let update = `unit: ${unitName(model)}, `; + if (selCmpt.project.hasSelectionId) { + update += `${SELECTION_ID}: ${datum}[${stringValue(SELECTION_ID)}]`; + } + else { + const values = project.items + .map(p => { + const fieldDef = model.fieldDef(p.channel); + // Binned fields should capture extents, for a range test against the raw field. + return fieldDef?.bin + ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` + + `${datum}[${stringValue(model.vgField(p.channel, { binSuffix: 'end' }))}]]` + : `${datum}[${stringValue(p.field)}]`; + }) + .join(', '); + update += `fields: ${fieldsSg}, values: [${values}]`; + } + const events = selCmpt.events; + return signals.concat([ + { + name: name + TUPLE, + on: events + ? [ + { + events, + update: `${test} ? {${update}} : null`, + force: true + } + ] + : [] + } + ]); + } +}; +export default point; +//# sourceMappingURL=point.js.map \ No newline at end of file diff --git a/build/src/compile/selection/point.js.map b/build/src/compile/selection/point.js.map new file mode 100644 index 0000000000..f568c594ac --- /dev/null +++ b/build/src/compile/selection/point.js.map @@ -0,0 +1 @@ +{"version":3,"file":"point.js","sourceRoot":"","sources":["../../../../src/compile/selection/point.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAoB,KAAK,EAAE,QAAQ,EAAC,MAAM,GAAG,CAAC;AACrD,OAAO,EAAC,YAAY,EAAC,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAC,IAAI,EAAC,MAAM,YAAY,CAAC;AAChC,OAAO,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,YAAY,EAAC,MAAM,WAAW,CAAC;AAEvC,MAAM,KAAK,GAA+B;IACxC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,KAAK,OAAO;IAE5C,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,MAAM,QAAQ,GAAG,IAAI,GAAG,YAAY,CAAC;QACrC,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;Q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AAK,IAAI,WAAW,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,EAAE,EAAC,SAAS,EAAE,KAAK,EAAC,CAAC,CAAC,IAAI;oBAC7E,CAAC,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC;YAC1C,CAAC,CAAC;iBACD,IAAI,CAAC,IAAI,CAAC,CAAC;YAEd,MAAM,IAAI,WAAW,QAAQ,cAAc,MAAM,GAAG,CAAC;SACtD;QAED,MAAM,MAAM,GAAa,OAAO,CAAC,MAAM,CAAC;QACxC,OAAO,OAAO,CAAC,MAAM,CAAC;YACpB;gBACE,IAAI,EAAE,IAAI,GAAG,KAAK;gBAClB,EAAE,EAAE,MAAM;oBACR,CAAC,CAAC;wBACE;4BACE,MAAM;4BACN,MAAM,EAAE,GAAG,IAAI,OAAO,MAAM,UAAU;4BACtC,KAAK,EAAE,IAAI;yBACZ;qBACF;oBACH,CAAC,CAAC,EAAE;aACP;SACF,CAAC,CAAC;IACL,CAAC;CACF,CAAC;AAEF,eAAe,KAAK,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/project.d.ts b/build/src/compile/selection/project.d.ts new file mode 100644 index 0000000000..af2b9f441b --- /dev/null +++ b/build/src/compile/selection/project.d.ts @@ -0,0 +1,31 @@ +import { GeoPositionChannel, SingleDefUnitChannel } from '../../channel'; +import { TimeUnitNode } from '../data/timeunit'; +import { SelectionCompiler } from '.'; +export declare const TUPLE_FIELDS = "_tuple_fields"; +/** + * Whether the selection tuples hold enumerated or ranged values for a field. + */ +export type TupleStoreType = 'E' | 'R' | 'R-RE'; +export interface SelectionProjection { + type: TupleStoreType; + field: string; + index: number; + channel?: SingleDefUnitChannel; + geoChannel?: GeoPositionChannel; + signals?: { + data?: string; + visual?: string; + }; + hasLegend?: boolean; +} +export declare class SelectionProjectionComponent { + hasChannel: Partial>; + hasField: Record; + hasSelectionId: boolean; + timeUnit?: TimeUnitNode; + items: SelectionProjection[]; + constructor(...items: SelectionProjection[]); +} +declare const project: SelectionCompiler; +export default project; +//# sourceMappingURL=project.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/project.d.ts.map b/build/src/compile/selection/project.d.ts.map new file mode 100644 index 0000000000..fd877b6ec0 --- /dev/null +++ b/build/src/compile/selection/project.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/project.ts"],"names":[],"mappings":"AACA,OAAO,EACL,kBAAkB,EAKlB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAKvB,OAAO,EAAoB,YAAY,EAAC,MAAM,kBAAkB,CAAC;AACjE,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAGpC,eAAO,MAAM,YAAY,kBAAkB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,cAAc,GAEtB,GAAG,GAEH,GAAG,GAEH,MAAM,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,oBAAoB,CAAC;IAC/B,UAAU,CAAC,EAAE,kBAAkB,CAAC;IAChC,OAAO,CAAC,EAAE;QAAC,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAC,CAAC;IAC3C,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,qBAAa,4BAA4B;IAChC,UAAU,EAAE,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,mBAAmB,CAAC,CAAC,CAAC;IACvE,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;IAC9C,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,CAAC,EAAE,YAAY,CAAC;IACxB,KAAK,EAAE,mBAAmB,EAAE,CAAC;gBAExB,GAAG,KAAK,EAAE,mBAAmB,EAAE;CAM5C;AAED,QAAA,MAAM,OAAO,EAAE,iBAgKd,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/project.js b/build/src/compile/selection/project.js new file mode 100644 index 0000000000..fd6e2423b5 --- /dev/null +++ b/build/src/compile/selection/project.js @@ -0,0 +1,166 @@ +import { array, isObject } from 'vega-util'; +import { getPositionChannelFromLatLong, isGeoPositionChannel, isScaleChannel, isSingleDefUnitChannel } from '../../channel'; +import * as log from '../../log'; +import { hasContinuousDomain } from '../../scale'; +import { SELECTION_ID } from '../../selection'; +import { hash, keys, varName, isEmpty } from '../../util'; +import { TimeUnitNode } from '../data/timeunit'; +import { assembleProjection } from './assemble'; +import { isBinnedTimeUnit } from '../../timeunit'; +export const TUPLE_FIELDS = '_tuple_fields'; +export class SelectionProjectionComponent { + constructor(...items) { + this.items = items; + this.hasChannel = {}; + this.hasField = {}; + this.hasSelectionId = false; + } +} +const project = { + defined: () => { + return true; // This transform handles its own defaults, so always run parse. + }, + parse: (model, selCmpt, selDef) => { + const name = selCmpt.name; + const proj = (selCmpt.project ?? (selCmpt.project = new SelectionProjectionComponent())); + const parsed = {}; + const timeUnits = {}; + const signals = new Set(); + const signalName = (p, range) => { + const suffix = range === 'visual' ? p.channel : p.field; + let sg = varName(`${name}_${suffix}`); + for (let counter = 1; signals.has(sg); counter++) { + sg = varName(`${name}_${suffix}_${counter}`); + } + signals.add(sg); + return { [range]: sg }; + }; + const type = selCmpt.type; + const cfg = model.config.selection[type]; + const init = selDef.value !== undefined + ? array(selDef.value) + : null; + // If no explicit projection (either fields or encodings) is specified, set some defaults. + // If an initial value is set, try to infer projections. + let { fields, encodings } = (isObject(selDef.select) ? selDef.select : {}); + if (!fields && !encodings && init) { + for (const initVal of init) { + // initVal may be a scalar value to smoothen varParam -> pointSelection gradient. + if (!isObject(initVal)) { + continue; + } + for (const key of keys(initVal)) { + if (isSingleDefUnitChannel(key)) { + (encodings || (encodings = [])).push(key); + } + else { + if (type === 'interval') { + log.warn(log.message.INTERVAL_INITIALIZED_WITH_POS); + encodings = cfg.encodings; + } + else { + (fields ?? (fields = [])).push(key); + } + } + } + } + } + // If no initial value is specified, use the default configuration. + // We break this out as a separate if block (instead of an else condition) + // to account for unprojected point selections that have scalar initial values + if (!fields && !encodings) { + encodings = cfg.encodings; + if ('fields' in cfg) { + fields = cfg.fields; + } + } + for (const channel of encodings ?? []) { + const fieldDef = model.fieldDef(channel); + if (fieldDef) { + let field = fieldDef.field; + if (fieldDef.aggregate) { + log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate)); + continue; + } + else if (!field) { + log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); + continue; + } + if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) { + field = model.vgField(channel); + // Construct TimeUnitComponents which will be combined into a + // TimeUnitNode. This node may need to be inserted into the + // dataflow if the selection is used across views that do not + // have these time units defined. + const component = { + timeUnit: fieldDef.timeUnit, + as: field, + field: fieldDef.field + }; + timeUnits[hash(component)] = component; + } + // Prevent duplicate projections on the same field. + // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). + if (!parsed[field]) { + // Determine whether the tuple will store enumerated or ranged values. + // Interval selections store ranges for continuous scales, and enumerations otherwise. + // Single/multi selections store ranges for binned fields, and enumerations otherwise. + const tplType = type === 'interval' && + isScaleChannel(channel) && + hasContinuousDomain(model.getScaleComponent(channel).get('type')) + ? 'R' + : fieldDef.bin + ? 'R-RE' + : 'E'; + const p = { field, channel, type: tplType, index: proj.items.length }; + p.signals = { ...signalName(p, 'data'), ...signalName(p, 'visual') }; + proj.items.push((parsed[field] = p)); + proj.hasField[field] = parsed[field]; + proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID; + if (isGeoPositionChannel(channel)) { + p.geoChannel = channel; + p.channel = getPositionChannelFromLatLong(channel); + proj.hasChannel[p.channel] = parsed[field]; + } + else { + proj.hasChannel[channel] = parsed[field]; + } + } + } + else { + log.warn(log.message.cannotProjectOnChannelWithoutField(channel)); + } + } + for (const field of fields ?? []) { + if (proj.hasField[field]) + continue; + const p = { type: 'E', field, index: proj.items.length }; + p.signals = { ...signalName(p, 'data') }; + proj.items.push(p); + proj.hasField[field] = p; + proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID; + } + if (init) { + selCmpt.init = init.map((v) => { + // Selections can be initialized either with a full object that maps projections to values + // or scalar values to smoothen the abstraction gradient from variable params to point selections. + return proj.items.map(p => isObject(v) ? (v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field]) : v); + }); + } + if (!isEmpty(timeUnits)) { + proj.timeUnit = new TimeUnitNode(null, timeUnits); + } + }, + signals: (model, selCmpt, allSignals) => { + const name = selCmpt.name + TUPLE_FIELDS; + const hasSignal = allSignals.filter(s => s.name === name); + return hasSignal.length > 0 || selCmpt.project.hasSelectionId + ? allSignals + : allSignals.concat({ + name, + value: selCmpt.project.items.map(assembleProjection) + }); + } +}; +export default project; +//# sourceMappingURL=project.js.map \ No newline at end of file diff --git a/build/src/compile/selection/project.js.map b/build/src/compile/selection/project.js.map new file mode 100644 index 0000000000..ed56b1c941 --- /dev/null +++ b/build/src/compile/selection/project.js.map @@ -0,0 +1 @@ +{"version":3,"file":"project.js","sourceRoot":"","sources":["../../../../src/compile/selection/project.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC1C,OAAO,EAEL,6BAA6B,EAC7B,oBAAoB,EACpB,cAAc,EACd,sBAAsB,EAEvB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,GAAG,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAChD,OAAO,EAA2E,YAAY,EAAC,MAAM,iBAAiB,CAAC;AACvH,OAAO,EAAO,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAC,MAAM,YAAY,CAA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C,UAAU,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC3G,CAAC;YACJ,CAAC,CAAC,CAAC;SACJ;QAED,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YACvB,IAAI,CAAC,QAAQ,GAAG,IAAI,YAAY,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;SACnD;IACH,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,UAAU,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,GAAG,YAAY,CAAC;QACzC,MAAM,SAAS,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;QAC1D,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,cAAc;YAC3D,CAAC,CAAC,UAAU;YACZ,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC;gBAChB,IAAI;gBACJ,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,kBAAkB,CAAC;aACrD,CAAC,CAAC;IACT,CAAC;CACF,CAAC;AAEF,eAAe,OAAO,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/scales.d.ts b/build/src/compile/selection/scales.d.ts new file mode 100644 index 0000000000..acc78a5f09 --- /dev/null +++ b/build/src/compile/selection/scales.d.ts @@ -0,0 +1,7 @@ +import { ScaleChannel } from '../../channel'; +import { UnitModel } from '../unit'; +import { SelectionCompiler } from '.'; +declare const scaleBindings: SelectionCompiler<'interval'>; +export default scaleBindings; +export declare function domain(model: UnitModel, channel: ScaleChannel): string; +//# sourceMappingURL=scales.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/scales.d.ts.map b/build/src/compile/selection/scales.d.ts.map new file mode 100644 index 0000000000..2aa89a854a --- /dev/null +++ b/build/src/compile/selection/scales.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scales.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/scales.ts"],"names":[],"mappings":"AAEA,OAAO,EAAiB,YAAY,EAAC,MAAM,eAAe,CAAC;AAI3D,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAIpC,QAAA,MAAM,aAAa,EAAE,iBAAiB,CAAC,UAAU,CA2EhD,CAAC;AAEF,eAAe,aAAa,CAAC;AAE7B,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,YAAY,UAG7D"} \ No newline at end of file diff --git a/build/src/compile/selection/scales.js b/build/src/compile/selection/scales.js new file mode 100644 index 0000000000..9ebbdaf920 --- /dev/null +++ b/build/src/compile/selection/scales.js @@ -0,0 +1,81 @@ +import { stringValue } from 'vega-util'; +import { VL_SELECTION_RESOLVE } from '.'; +import { isScaleChannel } from '../../channel'; +import * as log from '../../log'; +import { hasContinuousDomain } from '../../scale'; +import { isLayerModel } from '../model'; +import { replacePathInField } from '../../util'; +const scaleBindings = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; + }, + parse: (model, selCmpt) => { + const bound = (selCmpt.scales = []); + for (const proj of selCmpt.project.items) { + const channel = proj.channel; + if (!isScaleChannel(channel)) { + continue; + } + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + if (!scale || !hasContinuousDomain(scaleType)) { + log.warn(log.message.SCALE_BINDINGS_CONTINUOUS); + continue; + } + scale.set('selectionExtent', { param: selCmpt.name, field: proj.field }, true); + bound.push(proj); + } + }, + topLevelSignals: (model, selCmpt, signals) => { + const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0); + // Top-level signals are only needed for multiview displays and if this + // view's top-level signals haven't already been generated. + if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { + return signals; + } + // vlSelectionResolve does not account for the behavior of bound scales in + // multiview displays. Each unit view adds a tuple to the store, but the + // state of the selection is the unit selection most recently updated. This + // state is captured by the top-level signals that we insert and "push + // outer" to from within the units. We need to reassemble this state into + // the top-level named signal, except no single selCmpt has a global view. + const namedSg = signals.filter(s => s.name === selCmpt.name)[0]; + let update = namedSg.update; + if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { + namedSg.update = `{${bound + .map(proj => `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`) + .join(', ')}}`; + } + else { + for (const proj of bound) { + const mapping = `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`; + if (!update.includes(mapping)) { + update = `${update.substring(0, update.length - 1)}, ${mapping}}`; + } + } + namedSg.update = update; + } + return signals.concat(bound.map(proj => ({ name: proj.signals.data }))); + }, + signals: (model, selCmpt, signals) => { + // Nested signals need only push to top-level signals with multiview displays. + if (model.parent && !isTopLevelLayer(model)) { + for (const proj of selCmpt.scales) { + const signal = signals.filter(s => s.name === proj.signals.data)[0]; + signal.push = 'outer'; + delete signal.value; + delete signal.update; + } + } + return signals; + } +}; +export default scaleBindings; +export function domain(model, channel) { + const scale = stringValue(model.scaleName(channel)); + return `domain(${scale})`; +} +function isTopLevelLayer(model) { + return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent)); +} +//# sourceMappingURL=scales.js.map \ No newline at end of file diff --git a/build/src/compile/selection/scales.js.map b/build/src/compile/selection/scales.js.map new file mode 100644 index 0000000000..0d21ac85fd --- /dev/null +++ b/build/src/compile/selection/scales.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scales.js","sourceRoot":"","sources":["../../../../src/compile/selection/scales.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,WAAW,CAAC;AACtC,OAAO,EAAC,oBAAoB,EAAC,MAAM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AAO,CAAC,CAAC,CAAC;IACpD,OAAO,UAAU,KAAK,GAAG,CAAC;AAC5B,CAAC;AAED,SAAS,eAAe,CAAC,KAAY;IACnC,OAAO,KAAK,CAAC,MAAM,IAAI,YAAY,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,IAAI,eAAe,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;AACtH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/toggle.d.ts b/build/src/compile/selection/toggle.d.ts new file mode 100644 index 0000000000..9e00149d9f --- /dev/null +++ b/build/src/compile/selection/toggle.d.ts @@ -0,0 +1,5 @@ +import { SelectionCompiler } from '.'; +export declare const TOGGLE = "_toggle"; +declare const toggle: SelectionCompiler<'point'>; +export default toggle; +//# sourceMappingURL=toggle.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/toggle.d.ts.map b/build/src/compile/selection/toggle.d.ts.map new file mode 100644 index 0000000000..11e77375ef --- /dev/null +++ b/build/src/compile/selection/toggle.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/toggle.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAEpC,eAAO,MAAM,MAAM,YAAY,CAAC;AAEhC,QAAA,MAAM,MAAM,EAAE,iBAAiB,CAAC,OAAO,CAuBtC,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/toggle.js b/build/src/compile/selection/toggle.js new file mode 100644 index 0000000000..6cb1344992 --- /dev/null +++ b/build/src/compile/selection/toggle.js @@ -0,0 +1,23 @@ +import { TUPLE, unitName } from '.'; +export const TOGGLE = '_toggle'; +const toggle = { + defined: selCmpt => { + return selCmpt.type === 'point' && !!selCmpt.toggle; + }, + signals: (model, selCmpt, signals) => { + return signals.concat({ + name: selCmpt.name + TOGGLE, + value: false, + on: [{ events: selCmpt.events, update: selCmpt.toggle }] + }); + }, + modifyExpr: (model, selCmpt) => { + const tpl = selCmpt.name + TUPLE; + const signal = selCmpt.name + TOGGLE; + return (`${signal} ? null : ${tpl}, ` + + (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) + + `${signal} ? ${tpl} : null`); + } +}; +export default toggle; +//# sourceMappingURL=toggle.js.map \ No newline at end of file diff --git a/build/src/compile/selection/toggle.js.map b/build/src/compile/selection/toggle.js.map new file mode 100644 index 0000000000..bb6326500b --- /dev/null +++ b/build/src/compile/selection/toggle.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toggle.js","sourceRoot":"","sources":["../../../../src/compile/selection/toggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,GAAG,CAAC;AAGlC,MAAM,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC;AAEhC,MAAM,MAAM,GAA+B;IACzC,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,OAAO,OAAO,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC;IACtD,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,OAAO,OAAO,CAAC,MAAM,CAAC;YACpB,IAAI,EAAE,OAAO,CAAC,IAAI,GAAG,MAAM;YAC3B,KAAK,EAAE,KAAK;YACZ,EAAE,EAAE,CAAC,EAAC,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAC,CAAC;SACvD,CAAC,CAAC;IACL,CAAC;IAED,UAAU,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;QAC7B,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,GAAG,KAAK,CAAC;QACjC,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;QAErC,OAAO,CACL,GAAG,MAAM,aAAa,GAAG,IAAI;YAC7B,CAAC,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,GAAG,MAAM,kBAAkB,CAAC,CAAC,CAAC,GAAG,MAAM,oBAAoB,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC;YAChH,GAAG,MAAM,MAAM,GAAG,SAAS,CAC5B,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,eAAe,MAAM,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/translate.d.ts b/build/src/compile/selection/translate.d.ts new file mode 100644 index 0000000000..0d36d8073f --- /dev/null +++ b/build/src/compile/selection/translate.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const translate: SelectionCompiler<'interval'>; +export default translate; +//# sourceMappingURL=translate.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/translate.d.ts.map b/build/src/compile/selection/translate.d.ts.map new file mode 100644 index 0000000000..822775ac6e --- /dev/null +++ b/build/src/compile/selection/translate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"translate.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/translate.ts"],"names":[],"mappings":"AAQA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAKpC,QAAA,MAAM,SAAS,EAAE,iBAAiB,CAAC,UAAU,CAqD5C,CAAC;AAEF,eAAe,SAAS,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/translate.js b/build/src/compile/selection/translate.js new file mode 100644 index 0000000000..5ca56f1c98 --- /dev/null +++ b/build/src/compile/selection/translate.js @@ -0,0 +1,88 @@ +import { parseSelector } from 'vega-event-selector'; +import { X, Y } from '../../channel'; +import { BRUSH as INTERVAL_BRUSH } from './interval'; +import scalesCompiler, { domain } from './scales'; +const ANCHOR = '_translate_anchor'; +const DELTA = '_translate_delta'; +const translate = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.translate; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const boundScales = scalesCompiler.defined(selCmpt); + const anchor = name + ANCHOR; + const { x, y } = selCmpt.project.hasChannel; + let events = parseSelector(selCmpt.translate, 'scope'); + if (!boundScales) { + events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e)); + } + signals.push({ + name: anchor, + value: {}, + on: [ + { + events: events.map(e => e.between[0]), + update: '{x: x(unit), y: y(unit)' + + (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') + + (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') + + '}' + } + ] + }, { + name: name + DELTA, + value: {}, + on: [ + { + events, + update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}` + } + ] + }); + if (x !== undefined) { + onDelta(model, selCmpt, x, 'width', signals); + } + if (y !== undefined) { + onDelta(model, selCmpt, y, 'height', signals); + } + return signals; + } +}; +export default translate; +function onDelta(model, selCmpt, proj, size, signals) { + const name = selCmpt.name; + const anchor = name + ANCHOR; + const delta = name + DELTA; + const channel = proj.channel; + const boundScales = scalesCompiler.defined(selCmpt); + const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0]; + const sizeSg = model.getSizeSignalRef(size).signal; + const scaleCmpt = model.getScaleComponent(channel); + const scaleType = scaleCmpt && scaleCmpt.get('type'); + const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort + const sign = !boundScales ? '' : channel === X ? (reversed ? '' : '-') : reversed ? '-' : ''; + const extent = `${anchor}.extent_${channel}`; + const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`; + const panFn = !boundScales || !scaleCmpt + ? 'panLinear' + : scaleType === 'log' + ? 'panLog' + : scaleType === 'symlog' + ? 'panSymlog' + : scaleType === 'pow' + ? 'panPow' + : 'panLinear'; + const arg = !boundScales + ? '' + : scaleType === 'pow' + ? `, ${scaleCmpt.get('exponent') ?? 1}` + : scaleType === 'symlog' + ? `, ${scaleCmpt.get('constant') ?? 1}` + : ''; + const update = `${panFn}(${extent}, ${offset}${arg})`; + signal.on.push({ + events: { signal: delta }, + update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})` + }); +} +//# sourceMappingURL=translate.js.map \ No newline at end of file diff --git a/build/src/compile/selection/translate.js.map b/build/src/compile/selection/translate.js.map new file mode 100644 index 0000000000..18fcf87e78 --- /dev/null +++ b/build/src/compile/selection/translate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"translate.js","sourceRoot":"","sources":["../../../../src/compile/selection/translate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAe,CAAC,EAAE,CAAC,EAAC,MAAM,eAAe,CAAC;AAEjD,OAAO,EAAC,KAAK,IAAI,cAAc,EAAC,MAAM,YAAY,CAAC;AAEnD,OAAO,cAAc,EAAE,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhD,MAAM,MAAM,GAAG,mBAAmB,CAAC;AACnC,MAAM,KAAK,GAAG,kBAAkB,CAAC;AAEjC,MAAM,SAAS,GAAkC;IAC/C,OAAO,EAAE,OAAO,CAAC,EAAE;QACjB,OAAO,OAAO,CAAC,IAAI,KAAK,UAAU,IAAI,OAAO,CAAC,SAAS,CAAC;IAC1D,CAAC;IAED,OAAO,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;QACnC,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC1B,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpD,MAAM,MAAM,GAAG,IAAI,GAAG,MAAM,CAAC;QAC7B,MAAM,EAAC,CAAC,EAAE,CAAC,EAAC,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;QAC1C,IAAI,MAAM,GAAG,a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M,QAAQ,MAAM,GAAG;KACrE,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/zoom.d.ts b/build/src/compile/selection/zoom.d.ts new file mode 100644 index 0000000000..9dcf123bdc --- /dev/null +++ b/build/src/compile/selection/zoom.d.ts @@ -0,0 +1,4 @@ +import { SelectionCompiler } from '.'; +declare const zoom: SelectionCompiler<'interval'>; +export default zoom; +//# sourceMappingURL=zoom.d.ts.map \ No newline at end of file diff --git a/build/src/compile/selection/zoom.d.ts.map b/build/src/compile/selection/zoom.d.ts.map new file mode 100644 index 0000000000..15716bf1a2 --- /dev/null +++ b/build/src/compile/selection/zoom.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"zoom.d.ts","sourceRoot":"","sources":["../../../../src/compile/selection/zoom.ts"],"names":[],"mappings":"AASA,OAAO,EAAC,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAKpC,QAAA,MAAM,IAAI,EAAE,iBAAiB,CAAC,UAAU,CAwDvC,CAAC;AAEF,eAAe,IAAI,CAAC"} \ No newline at end of file diff --git a/build/src/compile/selection/zoom.js b/build/src/compile/selection/zoom.js new file mode 100644 index 0000000000..6dfec47add --- /dev/null +++ b/build/src/compile/selection/zoom.js @@ -0,0 +1,90 @@ +import { parseSelector } from 'vega-event-selector'; +import { stringValue } from 'vega-util'; +import { X, Y } from '../../channel'; +import { BRUSH as INTERVAL_BRUSH } from './interval'; +import { default as scalesCompiler, domain } from './scales'; +const ANCHOR = '_zoom_anchor'; +const DELTA = '_zoom_delta'; +const zoom = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.zoom; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const boundScales = scalesCompiler.defined(selCmpt); + const delta = name + DELTA; + const { x, y } = selCmpt.project.hasChannel; + const sx = stringValue(model.scaleName(X)); + const sy = stringValue(model.scaleName(Y)); + let events = parseSelector(selCmpt.zoom, 'scope'); + if (!boundScales) { + events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e)); + } + signals.push({ + name: name + ANCHOR, + on: [ + { + events, + update: !boundScales + ? `{x: x(unit), y: y(unit)}` + : '{' + + [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : ''] + .filter(expr => expr) + .join(', ') + + '}' + } + ] + }, { + name: delta, + on: [ + { + events, + force: true, + update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' + } + ] + }); + if (x !== undefined) { + onDelta(model, selCmpt, x, 'width', signals); + } + if (y !== undefined) { + onDelta(model, selCmpt, y, 'height', signals); + } + return signals; + } +}; +export default zoom; +function onDelta(model, selCmpt, proj, size, signals) { + const name = selCmpt.name; + const channel = proj.channel; + const boundScales = scalesCompiler.defined(selCmpt); + const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0]; + const sizeSg = model.getSizeSignalRef(size).signal; + const scaleCmpt = model.getScaleComponent(channel); + const scaleType = scaleCmpt && scaleCmpt.get('type'); + const base = boundScales ? domain(model, channel) : signal.name; + const delta = name + DELTA; + const anchor = `${name}${ANCHOR}.${channel}`; + const zoomFn = !boundScales || !scaleCmpt + ? 'zoomLinear' + : scaleType === 'log' + ? 'zoomLog' + : scaleType === 'symlog' + ? 'zoomSymlog' + : scaleType === 'pow' + ? 'zoomPow' + : 'zoomLinear'; + const arg = !boundScales + ? '' + : scaleType === 'pow' + ? `, ${scaleCmpt.get('exponent') ?? 1}` + : scaleType === 'symlog' + ? `, ${scaleCmpt.get('constant') ?? 1}` + : ''; + const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`; + signal.on.push({ + events: { signal: delta }, + update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})` + }); +} +//# sourceMappingURL=zoom.js.map \ No newline at end of file diff --git a/build/src/compile/selection/zoom.js.map b/build/src/compile/selection/zoom.js.map new file mode 100644 index 0000000000..a9dd265029 --- /dev/null +++ b/build/src/compile/selection/zoom.js.map @@ -0,0 +1 @@ +{"version":3,"file":"z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gBACxB,CAAC,CAAC,KAAK,SAAS,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;gBACvC,CAAC,CAAC,EAAE,CAAC;IACP,MAAM,MAAM,GAAG,GAAG,MAAM,IAAI,IAAI,KAAK,MAAM,KAAK,KAAK,GAAG,GAAG,GAAG,CAAC;IAE/D,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC;QACb,MAAM,EAAE,EAAC,MAAM,EAAE,KAAK,EAAC;QACvB,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,cAAc,MAAM,QAAQ,MAAM,GAAG;KACrE,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/compile/signal.d.ts b/build/src/compile/signal.d.ts new file mode 100644 index 0000000000..ecac11cf64 --- /dev/null +++ b/build/src/compile/signal.d.ts @@ -0,0 +1,12 @@ +import type { SignalRef } from 'vega'; +export type Rename = (oldSignalName: string) => string; +/** + * A class that behaves like a SignalRef but lazily generates the signal. + * The provided generator function should use `Model.getSignalName` to use the correct signal name. + */ +export declare class SignalRefWrapper implements SignalRef { + constructor(exprGenerator: () => string); + signal: string; + static fromName(rename: Rename, signalName: string): SignalRefWrapper; +} +//# sourceMappingURL=signal.d.ts.map \ No newline at end of file diff --git a/build/src/compile/signal.d.ts.map b/build/src/compile/signal.d.ts.map new file mode 100644 index 0000000000..1c8b6453b1 --- /dev/null +++ b/build/src/compile/signal.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signal.d.ts","sourceRoot":"","sources":["../../../src/compile/signal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAEpC,MAAM,MAAM,MAAM,GAAG,CAAC,aAAa,EAAE,MAAM,KAAK,MAAM,CAAC;AAEvD;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,SAAS;gBACpC,aAAa,EAAE,MAAM,MAAM;IAOhC,MAAM,EAAE,MAAM,CAAC;WAER,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;CAG1D"} \ No newline at end of file diff --git a/build/src/compile/signal.js b/build/src/compile/signal.js new file mode 100644 index 0000000000..0f2a3f1767 --- /dev/null +++ b/build/src/compile/signal.js @@ -0,0 +1,16 @@ +/** + * A class that behaves like a SignalRef but lazily generates the signal. + * The provided generator function should use `Model.getSignalName` to use the correct signal name. + */ +export class SignalRefWrapper { + constructor(exprGenerator) { + Object.defineProperty(this, 'signal', { + enumerable: true, + get: exprGenerator + }); + } + static fromName(rename, signalName) { + return new SignalRefWrapper(() => rename(signalName)); + } +} +//# sourceMappingURL=signal.js.map \ No newline at end of file diff --git a/build/src/compile/signal.js.map b/build/src/compile/signal.js.map new file mode 100644 index 0000000000..b5af5c44d2 --- /dev/null +++ b/build/src/compile/signal.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signal.js","sourceRoot":"","sources":["../../../src/compile/signal.ts"],"names":[],"mappings":"AAIA;;;GAGG;AACH,MAAM,OAAO,gBAAgB;IAC3B,YAAY,aAA2B;QACrC,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,QAAQ,EAAE;YACpC,UAAU,EAAE,IAAI;YAChB,GAAG,EAAE,aAAa;SACnB,CAAC,CAAC;IACL,CAAC;IAIM,MAAM,CAAC,QAAQ,CAAC,MAAc,EAAE,UAAkB;QACvD,OAAO,IAAI,gBAAgB,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC;IACxD,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compile/split.d.ts b/build/src/compile/split.d.ts new file mode 100644 index 0000000000..e3ddbb2e66 --- /dev/null +++ b/build/src/compile/split.d.ts @@ -0,0 +1,35 @@ +/** + * Generic class for storing properties that are explicitly specified + * and implicitly determined by the compiler. + * This is important for scale/axis/legend merging as + * we want to prioritize properties that users explicitly specified. + */ +export declare class Split { + readonly explicit: Partial; + readonly implicit: Partial; + constructor(explicit?: Partial, implicit?: Partial); + clone(): Split; + combine(): Partial; + get(key: K): T[K]; + getWithExplicit(key: K): Explicit; + setWithExplicit(key: K, { value, explicit }: Explicit): void; + set(key: K, value: T[K], explicit: boolean): this; + copyKeyFromSplit(key: keyof T, { explicit, implicit }: Split): void; + copyKeyFromObject(key: keyof T, s: Partial): void; + /** + * Merge split object into this split object. Properties from the other split + * overwrite properties from this split. + */ + copyAll(other: Split): void; +} +export interface Explicit { + explicit: boolean; + value: T; +} +export declare function makeExplicit(value: T): Explicit; +export declare function makeImplicit(value: T): Explicit; +export type SplitParentProperty = 'scale' | 'axis' | 'legend' | ''; +export declare function tieBreakByComparing(compare: (v1: T, v2: T) => number): (v1: Explicit, v2: Explicit, property: keyof S | never, propertyOf: SplitParentProperty) => Explicit; +export declare function defaultTieBreaker(v1: Explicit, v2: Explicit, property: keyof S, propertyOf: SplitParentProperty): Explicit; +export declare function mergeValuesWithExplicit(v1: Explicit, v2: Explicit, property: keyof S, propertyOf: SplitParentProperty, tieBreaker?: (v1: Explicit, v2: Explicit, property: keyof S, propertyOf: string) => Explicit): Explicit; +//# sourceMappingURL=split.d.ts.map \ No newline at end of file diff --git a/build/src/compile/split.d.ts.map b/build/src/compile/split.d.ts.map new file mode 100644 index 0000000000..4b8795fef1 --- /dev/null +++ b/build/src/compile/split.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"split.d.ts","sourceRoot":"","sources":["../../../src/compile/split.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AAEH,qBAAa,KAAK,CAAC,CAAC,SAAS,MAAM;aAEf,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;aACpB,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC;gBADpB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM,EACzB,QAAQ,GAAE,OAAO,CAAC,CAAC,CAAM;IAGpC,KAAK;IAIL,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC;IAOrB,GAAG,CAAC,CAAC,SAAS,MAA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CAAC,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,KAAK,MAAM,QAEnE,SAAS,CAAC,CAAC,MACX,SAAS,CAAC,CAAC,YACL,MAAM,CAAC,GAAG,KAAK,cACb,mBAAmB,KAC9B,SAAS,CAAC,CAAC,CASf;AAED,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,EACpC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,EAAE,mBAAmB,eAOhC;AAED,wBAAgB,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAC1C,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,EAAE,mBAAmB,EAC/B,UAAU,GAAE,CACV,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,EACf,QAAQ,EAAE,MAAM,CAAC,EACjB,UAAU,EAAE,MAAM,KACf,QAAQ,CAAC,CAAC,CAAqB,eAgBrC"} \ No newline at end of file diff --git a/build/src/compile/split.js b/build/src/compile/split.js new file mode 100644 index 0000000000..147708c43a --- /dev/null +++ b/build/src/compile/split.js @@ -0,0 +1,123 @@ +import * as log from '../log'; +import { deepEqual, duplicate, getFirstDefined, keys } from '../util'; +/** + * Generic class for storing properties that are explicitly specified + * and implicitly determined by the compiler. + * This is important for scale/axis/legend merging as + * we want to prioritize properties that users explicitly specified. + */ +// eslint-disable-next-line @typescript-eslint/ban-types +export class Split { + constructor(explicit = {}, implicit = {}) { + this.explicit = explicit; + this.implicit = implicit; + } + clone() { + return new Split(duplicate(this.explicit), duplicate(this.implicit)); + } + combine() { + return { + ...this.explicit, + ...this.implicit + }; + } + get(key) { + // Explicit has higher precedence + return getFirstDefined(this.explicit[key], this.implicit[key]); + } + getWithExplicit(key) { + // Explicit has higher precedence + if (this.explicit[key] !== undefined) { + return { explicit: true, value: this.explicit[key] }; + } + else if (this.implicit[key] !== undefined) { + return { explicit: false, value: this.implicit[key] }; + } + return { explicit: false, value: undefined }; + } + setWithExplicit(key, { value, explicit }) { + if (value !== undefined) { + this.set(key, value, explicit); + } + } + set(key, value, explicit) { + delete this[explicit ? 'implicit' : 'explicit'][key]; + this[explicit ? 'explicit' : 'implicit'][key] = value; + return this; + } + copyKeyFromSplit(key, { explicit, implicit }) { + // Explicit has higher precedence + if (explicit[key] !== undefined) { + this.set(key, explicit[key], true); + } + else if (implicit[key] !== undefined) { + this.set(key, implicit[key], false); + } + } + copyKeyFromObject(key, s) { + // Explicit has higher precedence + if (s[key] !== undefined) { + this.set(key, s[key], true); + } + } + /** + * Merge split object into this split object. Properties from the other split + * overwrite properties from this split. + */ + copyAll(other) { + for (const key of keys(other.combine())) { + const val = other.getWithExplicit(key); + this.setWithExplicit(key, val); + } + } +} +export function makeExplicit(value) { + return { + explicit: true, + value + }; +} +export function makeImplicit(value) { + return { + explicit: false, + value + }; +} +export function tieBreakByComparing(compare) { + return (v1, v2, property, propertyOf) => { + const diff = compare(v1.value, v2.value); + if (diff > 0) { + return v1; + } + else if (diff < 0) { + return v2; + } + return defaultTieBreaker(v1, v2, property, propertyOf); + }; +} +export function defaultTieBreaker(v1, v2, property, propertyOf) { + if (v1.explicit && v2.explicit) { + log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); + } + // If equal score, prefer v1. + return v1; +} +export function mergeValuesWithExplicit(v1, v2, property, propertyOf, tieBreaker = defaultTieBreaker) { + if (v1 === undefined || v1.value === undefined) { + // For first run + return v2; + } + if (v1.explicit && !v2.explicit) { + return v1; + } + else if (v2.explicit && !v1.explicit) { + return v2; + } + else if (deepEqual(v1.value, v2.value)) { + return v1; + } + else { + return tieBreaker(v1, v2, property, propertyOf); + } +} +//# sourceMappingURL=split.js.map \ No newline at end of file diff --git a/build/src/compile/split.js.map b/build/src/compile/split.js.map new file mode 100644 index 0000000000..7bc44fdc38 --- /dev/null +++ b/build/src/compile/split.js.map @@ -0,0 +1 @@ +{"version":3,"file":"split.js","sourceRoot":"","sources":["../../../src/compile/split.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,eAAe,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAEpE;;;;;GAKG;AACH,wDAAwD;AACxD,MAAM,OAAO,KAAK;IAChB,YACkB,WAAuB,EAAE,EACzB,WAAuB,EAAE;QADzB,aAAQ,GAAR,QAAQ,CAAiB;QACzB,aAAQ,GAAR,QAAQ,CAAiB;IACxC,CAAC;IAEG,KAAK;QACV,OAAO,IAAI,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;IACvE,CAAC;IAEM,OAAO;QACZ,OAAO;YACL,GAAG,IAAI,CAAC,QAAQ;YAChB,GAAG,IAAI,CAAC,QAAQ;SACjB,CAAC;IACJ,CAAC;IAEM,GAAG,CAAoB,GAAM;QAClC,iCAAiC;QACjC,OAAO,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;IACjE,CAAC;IAEM,eAAe,CAAoB,GAAM;QAC9C,iCAAiC;QACjC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YACpC,OAAO,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAC,CAAC;SACpD;aAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,SAAS,EAAE;YAC3C,OAAO,EAAC,QAAQ,EAAE,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,KAAK,CAAC,CAAC,CAAC;KAC1F;IACD,6BAA6B;IAC7B,OAAO,EAAE,CAAC;AACZ,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,EAAe,EACf,EAAe,EACf,QAAiB,EACjB,UAA+B,EAC/B,aAKmB,iBAAiB;IAEpC,IAAI,EAAE,KAAK,SAAS,IAAI,EAAE,CAAC,KAAK,KAAK,SAAS,EAAE;QAC9C,gBAAgB;QAChB,OAAO,EAAE,CAAC;KACX;IAED,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;QAC/B,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,EAAE,CAAC,QAAQ,IAAI,CAAC,EAAE,CAAC,QAAQ,EAAE;QACtC,OAAO,EAAE,CAAC;KACX;SAAM,IAAI,SAAS,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,EAAE;QACxC,OAAO,EAAE,CAAC;KACX;SAAM;QACL,OAAO,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,QAAQ,EAAE,UAAU,CAAC,CAAC;KACjD;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compile/unit.d.ts b/build/src/compile/unit.d.ts new file mode 100644 index 0000000000..f32aa676ff --- /dev/null +++ b/build/src/compile/unit.d.ts @@ -0,0 +1,65 @@ +import { NewSignal, SignalRef } from 'vega'; +import { AxisInternal } from '../axis'; +import { Channel, NonPositionScaleChannel, PositionChannel, ScaleChannel, SingleDefChannel } from '../channel'; +import { Config } from '../config'; +import * as vlEncoding from '../encoding'; +import { Encoding } from '../encoding'; +import { ExprRef } from '../expr'; +import { LegendInternal } from '../legend'; +import { Mark, MarkDef } from '../mark'; +import { Projection } from '../projection'; +import { Domain } from '../scale'; +import { SelectionParameter } from '../selection'; +import { LayoutSizeMixins, NormalizedUnitSpec } from '../spec'; +import { StackProperties } from '../stack'; +import { VgData, VgLayout } from '../vega.schema'; +import { AxisInternalIndex } from './axis/component'; +import { LegendInternalIndex } from './legend/component'; +import { Model, ModelWithField } from './model'; +import { ScaleIndex } from './scale/component'; +/** + * Internal model of Vega-Lite specification for the compiler. + */ +export declare class UnitModel extends ModelWithField { + readonly markDef: MarkDef; + readonly encoding: Encoding; + readonly specifiedScales: ScaleIndex; + readonly stack: StackProperties; + protected specifiedAxes: AxisInternalIndex; + protected specifiedLegends: LegendInternalIndex; + specifiedProjection: Projection; + readonly selection: SelectionParameter[]; + children: Model[]; + constructor(spec: NormalizedUnitSpec, parent: Model, parentGivenName: string, parentGivenSize: LayoutSizeMixins, config: Config); + get hasProjection(): boolean; + /** + * Return specified Vega-Lite scale domain for a particular channel + * @param channel + */ + scaleDomain(channel: ScaleChannel): Domain; + axis(channel: PositionChannel): AxisInternal; + legend(channel: NonPositionScaleChannel): LegendInternal; + private initScales; + private initScale; + private initAxes; + private initAxis; + private initLegends; + parseData(): void; + parseLayoutSize(): void; + parseSelections(): void; + parseMarkGroup(): void; + parseAxesAndHeaders(): void; + assembleSelectionTopLevelSignals(signals: any[]): NewSignal[]; + assembleSignals(): NewSignal[]; + assembleSelectionData(data: readonly VgData[]): VgData[]; + assembleLayout(): VgLayout; + assembleLayoutSignals(): NewSignal[]; + assembleMarks(): any[]; + assembleGroupStyle(): string | string[]; + protected getMapping(): vlEncoding.Encoding; + get mark(): Mark; + channelHasField(channel: Channel): boolean; + fieldDef(channel: SingleDefChannel): import("../channeldef").FieldDef; + typedFieldDef(channel: SingleDefChannel): import("../channeldef").TypedFieldDef; +} +//# sourceMappingURL=unit.d.ts.map \ No newline at end of file diff --git a/build/src/compile/unit.d.ts.map b/build/src/compile/unit.d.ts.map new file mode 100644 index 0000000000..7426f7b559 --- /dev/null +++ b/build/src/compile/unit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/compile/unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAE1C,OA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AC,OAAO,EAAE,gBAAgB;CAO/C"} \ No newline at end of file diff --git a/build/src/compile/unit.js b/build/src/compile/unit.js new file mode 100644 index 0000000000..bc7eb22314 --- /dev/null +++ b/build/src/compile/unit.js @@ -0,0 +1,220 @@ +import { isArray } from 'vega-util'; +import { isConditionalAxisValue } from '../axis'; +import { GEOPOSITION_CHANNELS, NONPOSITION_SCALE_CHANNELS, POSITION_SCALE_CHANNELS, SCALE_CHANNELS, supportLegend, X, Y } from '../channel'; +import { getFieldDef, getFieldOrDatumDef, isFieldOrDatumDef, isTypedFieldDef } from '../channeldef'; +import { isGraticuleGenerator } from '../data'; +import * as vlEncoding from '../encoding'; +import { initEncoding } from '../encoding'; +import { replaceExprRef } from '../expr'; +import { GEOSHAPE, isMarkDef } from '../mark'; +import { isSelectionParameter } from '../selection'; +import { isFrameMixins } from '../spec/base'; +import { stack } from '../stack'; +import { keys } from '../util'; +import { assembleAxisSignals } from './axis/assemble'; +import { parseUnitAxes } from './axis/parse'; +import { signalOrValueRefWithCondition, signalRefOrValue } from './common'; +import { parseData } from './data/parse'; +import { assembleLayoutSignals } from './layoutsize/assemble'; +import { initLayoutSize } from './layoutsize/init'; +import { parseUnitLayoutSize } from './layoutsize/parse'; +import { defaultFilled, initMarkdef } from './mark/init'; +import { parseMarkGroups } from './mark/mark'; +import { isLayerModel, ModelWithField } from './model'; +import { assembleTopLevelSignals, assembleUnitSelectionData, assembleUnitSelectionMarks, assembleUnitSelectionSignals } from './selection/assemble'; +import { parseUnitSelection } from './selection/parse'; +/** + * Internal model of Vega-Lite specification for the compiler. + */ +export class UnitModel extends ModelWithField { + constructor(spec, parent, parentGivenName, parentGivenSize = {}, config) { + super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); + this.specifiedScales = {}; + this.specifiedAxes = {}; + this.specifiedLegends = {}; + this.specifiedProjection = {}; + this.selection = []; + this.children = []; + const markDef = isMarkDef(spec.mark) ? { ...spec.mark } : { type: spec.mark }; + const mark = markDef.type; + // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding + if (markDef.filled === undefined) { + markDef.filled = defaultFilled(markDef, config, { + graticule: spec.data && isGraticuleGenerator(spec.data) + }); + } + const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config)); + this.markDef = initMarkdef(markDef, encoding, config); + this.size = initLayoutSize({ + encoding, + size: isFrameMixins(spec) + ? { + ...parentGivenSize, + ...(spec.width ? { width: spec.width } : {}), + ...(spec.height ? { height: spec.height } : {}) + } + : parentGivenSize + }); + // calculate stack properties + this.stack = stack(this.markDef, encoding); + this.specifiedScales = this.initScales(mark, encoding); + this.specifiedAxes = this.initAxes(encoding); + this.specifiedLegends = this.initLegends(encoding); + this.specifiedProjection = spec.projection; + // Selections will be initialized upon parse. + this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p)); + } + get hasProjection() { + const { encoding } = this; + const isGeoShapeMark = this.mark === GEOSHAPE; + const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel])); + return isGeoShapeMark || hasGeoPosition; + } + /** + * Return specified Vega-Lite scale domain for a particular channel + * @param channel + */ + scaleDomain(channel) { + const scale = this.specifiedScales[channel]; + return scale ? scale.domain : undefined; + } + axis(channel) { + return this.specifiedAxes[channel]; + } + legend(channel) { + return this.specifiedLegends[channel]; + } + initScales(mark, encoding) { + return SCALE_CHANNELS.reduce((scales, channel) => { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + if (fieldOrDatumDef) { + scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {}); + } + return scales; + }, {}); + } + initScale(scale) { + const { domain, range } = scale; + // TODO: we could simplify this function if we had a recursive replace function + const scaleInternal = replaceExprRef(scale); + if (isArray(domain)) { + scaleInternal.domain = domain.map(signalRefOrValue); + } + if (isArray(range)) { + scaleInternal.range = range.map(signalRefOrValue); + } + return scaleInternal; + } + initAxes(encoding) { + return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => { + // Position Axis + // TODO: handle ConditionFieldDef + const channelDef = encoding[channel]; + if (isFieldOrDatumDef(channelDef) || + (channel === X && isFieldOrDatumDef(encoding.x2)) || + (channel === Y && isFieldOrDatumDef(encoding.y2))) { + const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; + _axis[channel] = axisSpec + ? this.initAxis({ ...axisSpec }) // convert truthy value to object + : axisSpec; + } + return _axis; + }, {}); + } + initAxis(axis) { + const props = keys(axis); + const axisInternal = {}; + for (const prop of props) { + const val = axis[prop]; + axisInternal[prop] = isConditionalAxisValue(val) + ? signalOrValueRefWithCondition(val) + : signalRefOrValue(val); + } + return axisInternal; + } + initLegends(encoding) { + return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + if (fieldOrDatumDef && supportLegend(channel)) { + const legend = fieldOrDatumDef.legend; + _legend[channel] = legend + ? replaceExprRef(legend) // convert truthy value to object + : legend; + } + return _legend; + }, {}); + } + parseData() { + this.component.data = parseData(this); + } + parseLayoutSize() { + parseUnitLayoutSize(this); + } + parseSelections() { + this.component.selection = parseUnitSelection(this, this.selection); + } + parseMarkGroup() { + this.component.mark = parseMarkGroups(this); + } + parseAxesAndHeaders() { + this.component.axes = parseUnitAxes(this); + } + assembleSelectionTopLevelSignals(signals) { + return assembleTopLevelSignals(this, signals); + } + assembleSignals() { + return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])]; + } + assembleSelectionData(data) { + return assembleUnitSelectionData(this, data); + } + assembleLayout() { + return null; + } + assembleLayoutSignals() { + return assembleLayoutSignals(this); + } + assembleMarks() { + let marks = this.component.mark ?? []; + // If this unit is part of a layer, selections should augment + // all in concert rather than each unit individually. This + // ensures correct interleaving of clipping and brushed marks. + if (!this.parent || !isLayerModel(this.parent)) { + marks = assembleUnitSelectionMarks(this, marks); + } + return marks.map(this.correctDataNames); + } + assembleGroupStyle() { + const { style } = this.view || {}; + if (style !== undefined) { + return style; + } + if (this.encoding.x || this.encoding.y) { + return 'cell'; + } + else { + return 'view'; + } + } + getMapping() { + return this.encoding; + } + get mark() { + return this.markDef.type; + } + channelHasField(channel) { + return vlEncoding.channelHasField(this.encoding, channel); + } + fieldDef(channel) { + const channelDef = this.encoding[channel]; + return getFieldDef(channelDef); + } + typedFieldDef(channel) { + const fieldDef = this.fieldDef(channel); + if (isTypedFieldDef(fieldDef)) { + return fieldDef; + } + return null; + } +} +//# sourceMappingURL=unit.js.map \ No newline at end of file diff --git a/build/src/compile/unit.js.map b/build/src/compile/unit.js.map new file mode 100644 index 0000000000..938b0c0c30 --- /dev/null +++ b/build/src/compile/unit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/compile/unit.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAqB,sBAAsB,EAAC,MAAM,SAAS,CAAC;AACnE,OAAO,EAEL,oBAAoB,EAEpB,0BAA0B,EAE1B,uBAAuB,EAEvB,cAAc,EAEd,aAAa,EACb,CAAC,EACD,CAAC,EACF,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EAGhB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,oBAAoB,EAAC,MAAM,SAAS,CAAC;AAC7C,OAAO,KAAK,UAAU,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAW,YAAY,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAU,cAAc,EAAC,MAAM,SAAS,CAAC;AAEhD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAgB,MAAM,SAAS,CAAC;AAG3D,OAAO,EAAC,oBAAoB,EAAqB,MAAM,cAAc,CAAC;AAEtE,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,KAAK,EAAkB,MAAM,UAAU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,GAAG,0BAA0B,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;SACjD;QAED,OAAO,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IACM,kBAAkB;QACvB,MAAM,EAAC,KAAK,EAAC,GAAG,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;QAChC,IAAI,KAAK,KAAK,SAAS,EAAE;YACvB,OAAO,KAAK,CAAC;SACd;QACD,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,EAAE;YACtC,OAAO,MAAM,CAAC;SACf;aAAM;YACL,OAAO,MAAM,CAAC;SACf;IACH,CAAC;IAES,UAAU;QAClB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IAED,IAAW,IAAI;QACb,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC;IAC3B,CAAC;IAEM,eAAe,CAAC,OAAgB;QACrC,OAAO,UAAU,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAEM,QAAQ,CAAC,OAAyB;QACvC,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAC1C,OAAO,WAAW,CAAS,UAAU,CAAC,CAAC;IACzC,CAAC;IAEM,aAAa,CAAC,OAAyB;QAC5C,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QACxC,IAAI,eAAe,CAAC,QAAQ,CAAC,EAAE;YAC7B,OAAO,QAAQ,CAAC;SACjB;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compositemark/base.d.ts b/build/src/compositemark/base.d.ts new file mode 100644 index 0000000000..40680ff44f --- /dev/null +++ b/build/src/compositemark/base.d.ts @@ -0,0 +1,15 @@ +import { Encoding } from '../encoding'; +import { GenericMarkDef } from '../mark'; +import { NonFacetUnitNormalizer, Normalize, NormalizerParams } from '../normalize/base'; +import { GenericSpec } from '../spec'; +import { GenericLayerSpec, NormalizedLayerSpec } from '../spec/layer'; +import { GenericUnitSpec, NormalizedUnitSpec } from '../spec/unit'; +import { FieldName } from '../channeldef'; +export type CompositeMarkUnitSpec = GenericUnitSpec>; +export declare class CompositeMarkNormalizer implements NonFacetUnitNormalizer> { + name: string; + run: (spec: CompositeMarkUnitSpec, params: NormalizerParams, normalize: Normalize, M> | GenericLayerSpec, NormalizedLayerSpec | NormalizedUnitSpec>) => NormalizedLayerSpec | NormalizedUnitSpec; + constructor(name: string, run: (spec: CompositeMarkUnitSpec, params: NormalizerParams, normalize: Normalize, M> | GenericLayerSpec, NormalizedLayerSpec | NormalizedUnitSpec>) => NormalizedLayerSpec | NormalizedUnitSpec); + hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec; +} +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/base.d.ts.map b/build/src/compositemark/base.d.ts.map new file mode 100644 index 0000000000..8796fb81d0 --- /dev/null +++ b/build/src/compositemark/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/compositemark/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,cAAc,EAAc,MAAM,SAAS,CAAC;AACpD,OAAO,EAAC,sBAAsB,EAAE,SAAS,EAAE,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AACtF,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,eAAe,EAAc,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAGxC,MAAM,MAAM,qBAAqB,CAAC,CAAC,SAAS,MAAM,IAAI,eAAe,CAAC,GAAG,EAAE,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;AAElG,qBAAa,uBAAuB,CAAC,CAAC,SAAS,MAAM,CAAE,YAAW,sBAAsB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC;IAEvG,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,CACV,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,SAAS,CAElB,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAE/D,mBAAmB,GAAG,kBAAkB,CACzC,KACE,mBAAmB,GAAG,kBAAkB;gBAVtC,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE,CACV,IAAI,EAAE,qBAAqB,CAAC,CAAC,CAAC,EAC9B,MAAM,EAAE,gBAAgB,EACxB,SAAS,EAAE,SAAS,CAElB,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,EAE/D,mBAAmB,GAAG,kBAAkB,CACzC,KACE,mBAAmB,GAAG,kBAAkB;IAGxC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,qBAAqB,CAAC,CAAC,CAAC;CAMhG"} \ No newline at end of file diff --git a/build/src/compositemark/base.js b/build/src/compositemark/base.js new file mode 100644 index 0000000000..6e6af8ed24 --- /dev/null +++ b/build/src/compositemark/base.js @@ -0,0 +1,15 @@ +import { getMarkType } from '../mark'; +import { isUnitSpec } from '../spec/unit'; +export class CompositeMarkNormalizer { + constructor(name, run) { + this.name = name; + this.run = run; + } + hasMatchingType(spec) { + if (isUnitSpec(spec)) { + return getMarkType(spec.mark) === this.name; + } + return false; + } +} +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/build/src/compositemark/base.js.map b/build/src/compositemark/base.js.map new file mode 100644 index 0000000000..fa503356a6 --- /dev/null +++ b/build/src/compositemark/base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/compositemark/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,WAAW,EAAC,MAAM,SAAS,CAAC;AAIpD,OAAO,EAAkB,UAAU,EAAqB,MAAM,cAAc,CAAC;AAM7E,MAAM,OAAO,uBAAuB;IAClC,YACS,IAAY,EACZ,GASsC;QAVtC,SAAI,GAAJ,IAAI,CAAQ;QACZ,QAAG,GAAH,GAAG,CASmC;IAC5C,CAAC;IAEG,eAAe,CAAC,IAAqC;QAC1D,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,OAAO,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,IAAI,CAAC;SAC7C;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/compositemark/boxplot.d.ts b/build/src/compositemark/boxplot.d.ts new file mode 100644 index 0000000000..2b2c285ab7 --- /dev/null +++ b/build/src/compositemark/boxplot.d.ts @@ -0,0 +1,48 @@ +import { Orientation } from 'vega'; +import { Encoding } from '../encoding'; +import { MarkInvalidMixins } from '../mark'; +import { NormalizerParams } from '../normalize'; +import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; +import { CompositeMarkNormalizer } from './base'; +import { GenericCompositeMarkDef, PartsMixins } from './common'; +export declare const BOXPLOT: "boxplot"; +export type BoxPlot = typeof BOXPLOT; +export declare const BOXPLOT_PARTS: readonly ["box", "median", "outliers", "rule", "ticks"]; +type BoxPlotPart = (typeof BOXPLOT_PARTS)[number]; +export type BoxPlotPartsMixins = PartsMixins; +export interface BoxPlotConfig extends BoxPlotPartsMixins { + /** Size of the box and median tick of a box plot */ + size?: number; + /** + * The extent of the whiskers. Available options include: + * - `"min-max"`: min and max are the lower and upper whiskers respectively. + * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_). + * + * __Default value:__ `1.5`. + */ + extent?: 'min-max' | number; +} +export type BoxPlotDef = GenericCompositeMarkDef & BoxPlotConfig & MarkInvalidMixins & { + /** + * Type of the mark. For box plots, this should always be `"boxplot"`. + * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html) + */ + type: BoxPlot; + /** + * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous. + * + * __Default value:__ `"vertical"`. + */ + orient?: Orientation; +}; +export interface BoxPlotConfigMixins { + /** + * Box Config + */ + boxplot?: BoxPlotConfig; +} +export declare const boxPlotNormalizer: CompositeMarkNormalizer<"boxplot">; +export declare function getBoxPlotType(extent: number | 'min-max'): "min-max" | "tukey"; +export declare function normalizeBoxPlot(spec: GenericUnitSpec, BoxPlot | BoxPlotDef>, { config }: NormalizerParams): NormalizedLayerSpec; +export {}; +//# sourceMappingURL=boxplot.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/boxplot.d.ts.map b/build/src/compositemark/boxplot.d.ts.map new file mode 100644 index 0000000000..ab747f400f --- /dev/null +++ b/build/src/compositemark/boxplot.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"boxplot.d.ts","sourceRoot":"","sources":["../../../src/compositemark/boxplot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AAIjC,OAAO,EAAC,QAAQ,EAAmD,MAAM,aAAa,CAAC;AAEvF,OAAO,EAAqB,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAqB,MAAM,SAAS,CAAC;AAGjF,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAIL,uBAAuB,EAKvB,WAAW,EACZ,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,OAAO,WAAqB,CAAC;AAC1C,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC;AAErC,eAAO,MAAM,aAAa,yDAA0D,CAAC;AAErF,KAAK,WAAW,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAElD,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AAE1D,MAAM,WAAW,aAAc,SAAQ,kBAAkB;IACvD,oDAAoD;IACpD,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;CAC7B;AAED,MAAM,MAAM,UAAU,GAAG,uBAAuB,CAAC,OAAO,CAAC,GACvD,aAAa,GACb,iBAAiB,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,OAAO,CAAC;IAEd;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEJ,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AAED,eAAO,MAAM,iBAAiB,oCAAyD,CAAC;AAExF,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,uBAMxD;AAED,wBAAgB,gBAAgB,CAC9B,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,EAC7D,EAAC,MAAM,EAAC,EAAE,gBAAgB,GACzB,mBAAmB,CAyPrB"} \ No newline at end of file diff --git a/build/src/compositemark/boxplot.js b/build/src/compositemark/boxplot.js new file mode 100644 index 0000000000..add7aca8a8 --- /dev/null +++ b/build/src/compositemark/boxplot.js @@ -0,0 +1,299 @@ +import { isNumber, isObject } from 'vega-util'; +import { getMarkPropOrConfig } from '../compile/common'; +import { extractTransformsFromEncoding, normalizeEncoding } from '../encoding'; +import * as log from '../log'; +import { isMarkDef } from '../mark'; +import { isEmpty, omit } from '../util'; +import { CompositeMarkNormalizer } from './base'; +import { compositeMarkContinuousAxis, compositeMarkOrient, filterTooltipWithAggregatedField, getCompositeMarkTooltip, getTitle, makeCompositeAggregatePartFactory, partLayerMixins } from './common'; +export const BOXPLOT = 'boxplot'; +export const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks']; +export const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); +export function getBoxPlotType(extent) { + if (isNumber(extent)) { + return 'tukey'; + } + // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. + return extent; +} +export function normalizeBoxPlot(spec, { config }) { + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { mark, encoding: _encoding, params, projection: _p, ...outerSpec } = spec; + const markDef = isMarkDef(mark) ? mark : { type: mark }; + // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support + if (params) { + log.warn(log.message.selectionNotSupported('boxplot')); + } + const extent = markDef.extent ?? config.boxplot.extent; + const sizeValue = getMarkPropOrConfig('size', markDef, // TODO: https://github.com/vega/vega-lite/issues/6245 + config); + const invalid = markDef.invalid; + const boxPlotType = getBoxPlotType(extent); + const { bins, timeUnits, transform, continuousAxisChannelDef, continuousAxis, groupby, aggregate, encodingWithoutContinuousAxis, ticksOrient, boxOrient, customTooltipWithoutAggregatedField } = boxParams(spec, extent, config); + const { color, size, ...encodingWithoutSizeColorAndContinuousAxis } = encodingWithoutContinuousAxis; + const makeBoxPlotPart = (sharedEncoding) => { + return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot); + }; + const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); + const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); + const makeBoxPlotMidTick = makeBoxPlotPart({ ...encodingWithoutSizeColorAndContinuousAxis, ...(size ? { size } : {}) }); + const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([ + { fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max' }, + { fieldPrefix: 'upper_box_', titlePrefix: 'Q3' }, + { fieldPrefix: 'mid_box_', titlePrefix: 'Median' }, + { fieldPrefix: 'lower_box_', titlePrefix: 'Q1' }, + { fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min' } + ], continuousAxisChannelDef, encodingWithoutContinuousAxis); + // ## Whisker Layers + const endTick = { type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid, aria: false }; + const whiskerTooltipEncoding = boxPlotType === 'min-max' + ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker + : // for tukey / k-IQR, just show upper/lower-whisker + getCompositeMarkTooltip([ + { fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker' }, + { fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker' } + ], continuousAxisChannelDef, encodingWithoutContinuousAxis); + const whiskerLayers = [ + ...makeBoxPlotExtent({ + partName: 'rule', + mark: { type: 'rule', invalid, aria: false }, + positionPrefix: 'lower_whisker', + endPositionPrefix: 'lower_box', + extraEncoding: whiskerTooltipEncoding + }), + ...makeBoxPlotExtent({ + partName: 'rule', + mark: { type: 'rule', invalid, aria: false }, + positionPrefix: 'upper_box', + endPositionPrefix: 'upper_whisker', + extraEncoding: whiskerTooltipEncoding + }), + ...makeBoxPlotExtent({ + partName: 'ticks', + mark: endTick, + positionPrefix: 'lower_whisker', + extraEncoding: whiskerTooltipEncoding + }), + ...makeBoxPlotExtent({ + partName: 'ticks', + mark: endTick, + positionPrefix: 'upper_whisker', + extraEncoding: whiskerTooltipEncoding + }) + ]; + // ## Box Layers + // TODO: support hiding certain mark parts + const boxLayers = [ + ...(boxPlotType !== 'tukey' ? whiskerLayers : []), + ...makeBoxPlotBox({ + partName: 'box', + mark: { + type: 'bar', + ...(sizeValue ? { size: sizeValue } : {}), + orient: boxOrient, + invalid, + ariaRoleDescription: 'box' + }, + positionPrefix: 'lower_box', + endPositionPrefix: 'upper_box', + extraEncoding: fiveSummaryTooltipEncoding + }), + ...makeBoxPlotMidTick({ + partName: 'median', + mark: { + type: 'tick', + invalid, + ...(isObject(config.boxplot.median) && config.boxplot.median.color ? { color: config.boxplot.median.color } : {}), + ...(sizeValue ? { size: sizeValue } : {}), + orient: ticksOrient, + aria: false + }, + positionPrefix: 'mid_box', + extraEncoding: fiveSummaryTooltipEncoding + }) + ]; + if (boxPlotType === 'min-max') { + return { + ...outerSpec, + transform: (outerSpec.transform ?? []).concat(transform), + layer: boxLayers + }; + } + // Tukey Box Plot + const lowerBoxExpr = `datum["lower_box_${continuousAxisChannelDef.field}"]`; + const upperBoxExpr = `datum["upper_box_${continuousAxisChannelDef.field}"]`; + const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`; + const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`; + const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`; + const fieldExpr = `datum["${continuousAxisChannelDef.field}"]`; + const joinaggregateTransform = { + joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), + groupby + }; + const filteredWhiskerSpec = { + transform: [ + { + filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})` + }, + { + aggregate: [ + { + op: 'min', + field: continuousAxisChannelDef.field, + as: `lower_whisker_${continuousAxisChannelDef.field}` + }, + { + op: 'max', + field: continuousAxisChannelDef.field, + as: `upper_whisker_${continuousAxisChannelDef.field}` + }, + // preserve lower_box / upper_box + { + op: 'min', + field: `lower_box_${continuousAxisChannelDef.field}`, + as: `lower_box_${continuousAxisChannelDef.field}` + }, + { + op: 'max', + field: `upper_box_${continuousAxisChannelDef.field}`, + as: `upper_box_${continuousAxisChannelDef.field}` + }, + ...aggregate + ], + groupby + } + ], + layer: whiskerLayers + }; + const { tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip } = encodingWithoutSizeColorAndContinuousAxis; + const { scale, axis } = continuousAxisChannelDef; + const title = getTitle(continuousAxisChannelDef); + const axisWithoutTitle = omit(axis, ['title']); + const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { + transform: [{ filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` }], + mark: 'point', + encoding: { + [continuousAxis]: { + field: continuousAxisChannelDef.field, + type: continuousAxisChannelDef.type, + ...(title !== undefined ? { title } : {}), + ...(scale !== undefined ? { scale } : {}), + // add axis without title since we already added the title above + ...(isEmpty(axisWithoutTitle) ? {} : { axis: axisWithoutTitle }) + }, + ...encodingWithoutSizeColorContinuousAxisAndTooltip, + ...(color ? { color } : {}), + ...(customTooltipWithoutAggregatedField ? { tooltip: customTooltipWithoutAggregatedField } : {}) + } + })[0]; + let filteredLayersMixins; + const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform]; + if (outlierLayersMixins) { + filteredLayersMixins = { + transform: filteredLayersMixinsTransforms, + layer: [outlierLayersMixins, filteredWhiskerSpec] + }; + } + else { + filteredLayersMixins = filteredWhiskerSpec; + filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms); + } + return { + ...outerSpec, + layer: [ + filteredLayersMixins, + { + // boxplot + transform, + layer: boxLayers + } + ] + }; +} +function boxParamsQuartiles(continousAxisField) { + return [ + { + op: 'q1', + field: continousAxisField, + as: `lower_box_${continousAxisField}` + }, + { + op: 'q3', + field: continousAxisField, + as: `upper_box_${continousAxisField}` + } + ]; +} +function boxParams(spec, extent, config) { + const orient = compositeMarkOrient(spec, BOXPLOT); + const { continuousAxisChannelDef, continuousAxis } = compositeMarkContinuousAxis(spec, orient, BOXPLOT); + const continuousFieldName = continuousAxisChannelDef.field; + const boxPlotType = getBoxPlotType(extent); + const boxplotSpecificAggregate = [ + ...boxParamsQuartiles(continuousFieldName), + { + op: 'median', + field: continuousFieldName, + as: `mid_box_${continuousFieldName}` + }, + { + op: 'min', + field: continuousFieldName, + as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName + }, + { + op: 'max', + field: continuousFieldName, + as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName + } + ]; + const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' + ? [] + : [ + // This is for the original k-IQR, which we do not expose + { + calculate: `datum["upper_box_${continuousFieldName}"] - datum["lower_box_${continuousFieldName}"]`, + as: `iqr_${continuousFieldName}` + }, + { + calculate: `min(datum["upper_box_${continuousFieldName}"] + datum["iqr_${continuousFieldName}"] * ${extent}, datum["max_${continuousFieldName}"])`, + as: `upper_whisker_${continuousFieldName}` + }, + { + calculate: `max(datum["lower_box_${continuousFieldName}"] - datum["iqr_${continuousFieldName}"] * ${extent}, datum["min_${continuousFieldName}"])`, + as: `lower_whisker_${continuousFieldName}` + } + ]; + const { [continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis } = spec.encoding; + const { customTooltipWithoutAggregatedField, filteredEncoding } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis); + const { bins, timeUnits, aggregate, groupby, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(filteredEncoding, config); + const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical'; + const boxOrient = orient; + const transform = [ + ...bins, + ...timeUnits, + { + aggregate: [...aggregate, ...boxplotSpecificAggregate], + groupby + }, + ...postAggregateCalculates + ]; + return { + bins, + timeUnits, + transform, + groupby, + aggregate, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + ticksOrient, + boxOrient, + customTooltipWithoutAggregatedField + }; +} +//# sourceMappingURL=boxplot.js.map \ No newline at end of file diff --git a/build/src/compositemark/boxplot.js.map b/build/src/compositemark/boxplot.js.map new file mode 100644 index 0000000000..00817c86db --- /dev/null +++ b/build/src/compositemark/boxplot.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boxplot.js","sourceRoot":"","sources":["../../../src/compositemark/boxplot.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,mBAAmB,EAAC,MAAM,mBAAmB,CAAC;AAEtD,OAAO,EAAW,6BAA6B,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACvF,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAA6B,MAAM,SAAS,CAAC;AAI9D,OAAO,EAAC,OAAO,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,mBAAmB,EACnB,gCAAgC,EAEhC,uBAAuB,EACvB,QAAQ,EACR,iCAAiC,EACjC,eAAe,EAEhB,MAAM,UAAU,CAAC;AAElB,MAAM,CAAC,MAAM,OAAO,GAAG,SAAkB,CAAC;AAG1C,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,CAAU,CAAC;AA4CrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,uBAAuB,CAAC,OAAO,EAAE,gBAAgB,CAAC,CAAC;AAExF,MAAM,UAAU,cAAc,CAAC,MAA0B;IACvD,IAAI,QAAQ,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,OAAO,CAAC;KAChB;IACD,yMAAyM;IACzM,OAAO,MAAM,CAAC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CAAC,CAAC,UAAU,CAAC;IACnF,MAAM,SAAS,GAAgB,MAAM,CAAC;IAEtC,MAAM,SAAS,GAAgB;QAC7B,GAAG,IAAI;QACP,GAAG,SAAS;QACZ;YACE,SAAS,EAAE,CAAC,GAAG,SAAS,EAAE,GAAG,wBAAwB,CAAC;YACtD,OAAO;SACR;QACD,GAAG,uBAAuB;KAC3B,CAAC;IAEF,OAAO;QACL,IAAI;QACJ,SAAS;QACT,SAAS;QACT,OAAO;QACP,SAAS;QACT,wBAAwB;QACxB,cAAc;QACd,6BAA6B;QAC7B,WAAW;QACX,SAAS;QACT,mCAAmC;KACpC,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compositemark/common.d.ts b/build/src/compositemark/common.d.ts new file mode 100644 index 0000000000..0940bc242c --- /dev/null +++ b/build/src/compositemark/common.d.ts @@ -0,0 +1,54 @@ +import { Orientation, SignalRef, Text } from 'vega'; +import { CompositeMark, CompositeMarkDef } from '.'; +import { Field, PositionFieldDef, SecondaryFieldDef, StringFieldDef, StringFieldDefWithCondition, StringValueDefWithCondition } from '../channeldef'; +import { Encoding } from '../encoding'; +import { ExprRef } from '../expr'; +import { ColorMixins, GenericMarkDef, Mark, AnyMarkConfig, MarkDef } from '../mark'; +import { GenericUnitSpec, NormalizedUnitSpec } from '../spec'; +export type PartsMixins

= Partial>>; +export type GenericCompositeMarkDef = GenericMarkDef & ColorMixins & { + /** + * The opacity (value between [0,1]) of the mark. + * + * @minimum 0 + * @maximum 1 + */ + opacity?: number; + /** + * Whether a composite mark be clipped to the enclosing group’s width and height. + */ + clip?: boolean; +}; +export interface CompositeMarkTooltipSummary { + /** + * The prefix of the field to be shown in tooltip + */ + fieldPrefix: string; + /** + * The title prefix to show, corresponding to the field with field prefix `fieldPrefix` + */ + titlePrefix: Text | SignalRef; +} +export declare function filterTooltipWithAggregatedField(oldEncoding: Encoding): { + customTooltipWithoutAggregatedField?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[]; + filteredEncoding: Encoding; +}; +export declare function getCompositeMarkTooltip(tooltipSummary: CompositeMarkTooltipSummary[], continuousAxisChannelDef: PositionFieldDef, encodingWithoutContinuousAxis: Encoding, withFieldName?: boolean): Encoding; +export declare function getTitle(continuousAxisChannelDef: PositionFieldDef): SignalRef | Text; +export declare function makeCompositeAggregatePartFactory

>(compositeMarkDef: GenericCompositeMarkDef & P, continuousAxis: 'x' | 'y', continuousAxisChannelDef: PositionFieldDef, sharedEncoding: Encoding, compositeMarkConfig: P): ({ partName, mark, positionPrefix, endPositionPrefix, extraEncoding }: { + partName: keyof P; + mark: Mark | MarkDef; + positionPrefix: string; + endPositionPrefix?: string; + extraEncoding?: Encoding; +}) => NormalizedUnitSpec[]; +export declare function partLayerMixins

>(markDef: GenericCompositeMarkDef & P, part: keyof P, compositeMarkConfig: P, partBaseSpec: NormalizedUnitSpec): NormalizedUnitSpec[]; +export declare function compositeMarkContinuousAxis(spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, orient: Orientation, compositeMark: M): { + continuousAxisChannelDef: PositionFieldDef; + continuousAxisChannelDef2: SecondaryFieldDef; + continuousAxisChannelDefError: SecondaryFieldDef; + continuousAxisChannelDefError2: SecondaryFieldDef; + continuousAxis: 'x' | 'y'; +}; +export declare function compositeMarkOrient(spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>, compositeMark: M): Orientation; +//# sourceMappingURL=common.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/common.d.ts.map b/build/src/compositemark/common.d.ts.map new file mode 100644 index 0000000000..8a8b8a64b6 --- /dev/null +++ b/build/src/compositemark/common.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/compositemark/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAElD,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,GAAG,CAAC;AAClD,OA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AC;IAC1D,cAAc,EAAE,GAAG,GAAG,GAAG,CAAC;CAC3B,CAgBA;AAiBD,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,aAAa,EACzD,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,aAAa,GAAG,gBAAgB,CAAC,EACzE,aAAa,EAAE,CAAC,GACf,WAAW,CAwCb"} \ No newline at end of file diff --git a/build/src/compositemark/common.js b/build/src/compositemark/common.js new file mode 100644 index 0000000000..b6d2077399 --- /dev/null +++ b/build/src/compositemark/common.js @@ -0,0 +1,189 @@ +import { isArray, isBoolean, isString } from 'vega-util'; +import { isContinuousFieldOrDatumDef, isFieldDef, isFieldOrDatumDefForTimeFormat } from '../channeldef'; +import { fieldDefs } from '../encoding'; +import * as log from '../log'; +import { isMarkDef } from '../mark'; +import { getFirstDefined, hash, unique } from '../util'; +import { isSignalRef } from '../vega.schema'; +import { toStringFieldDef } from './../channeldef'; +export function filterTooltipWithAggregatedField(oldEncoding) { + const { tooltip, ...filteredEncoding } = oldEncoding; + if (!tooltip) { + return { filteredEncoding }; + } + let customTooltipWithAggregatedField; + let customTooltipWithoutAggregatedField; + if (isArray(tooltip)) { + for (const t of tooltip) { + if (t.aggregate) { + if (!customTooltipWithAggregatedField) { + customTooltipWithAggregatedField = []; + } + customTooltipWithAggregatedField.push(t); + } + else { + if (!customTooltipWithoutAggregatedField) { + customTooltipWithoutAggregatedField = []; + } + customTooltipWithoutAggregatedField.push(t); + } + } + if (customTooltipWithAggregatedField) { + filteredEncoding.tooltip = customTooltipWithAggregatedField; + } + } + else { + if (tooltip['aggregate']) { + filteredEncoding.tooltip = tooltip; + } + else { + customTooltipWithoutAggregatedField = tooltip; + } + } + if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { + customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; + } + return { customTooltipWithoutAggregatedField, filteredEncoding }; +} +export function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, withFieldName = true) { + if ('tooltip' in encodingWithoutContinuousAxis) { + return { tooltip: encodingWithoutContinuousAxis.tooltip }; + } + const fiveSummaryTooltip = tooltipSummary.map(({ fieldPrefix, titlePrefix }) => { + const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : ''; + return { + field: fieldPrefix + continuousAxisChannelDef.field, + type: continuousAxisChannelDef.type, + title: isSignalRef(titlePrefix) ? { signal: `${titlePrefix}"${escape(mainTitle)}"` } : titlePrefix + mainTitle + }; + }); + const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); + return { + tooltip: [ + ...fiveSummaryTooltip, + // need to cast because TextFieldDef supports fewer types of bin + ...unique(tooltipFieldDefs, hash) + ] + }; +} +export function getTitle(continuousAxisChannelDef) { + const { title, field } = continuousAxisChannelDef; + return getFirstDefined(title, field); +} +export function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) { + const { scale, axis } = continuousAxisChannelDef; + return ({ partName, mark, positionPrefix, endPositionPrefix = undefined, extraEncoding = {} }) => { + const title = getTitle(continuousAxisChannelDef); + return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, { + mark, + encoding: { + [continuousAxis]: { + field: `${positionPrefix}_${continuousAxisChannelDef.field}`, + type: continuousAxisChannelDef.type, + ...(title !== undefined ? { title } : {}), + ...(scale !== undefined ? { scale } : {}), + ...(axis !== undefined ? { axis } : {}) + }, + ...(isString(endPositionPrefix) + ? { + [`${continuousAxis}2`]: { + field: `${endPositionPrefix}_${continuousAxisChannelDef.field}` + } + } + : {}), + ...sharedEncoding, + ...extraEncoding + } + }); + }; +} +export function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) { + const { clip, color, opacity } = markDef; + const mark = markDef.type; + if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) { + return [ + { + ...partBaseSpec, + mark: { + ...compositeMarkConfig[part], + ...(clip ? { clip } : {}), + ...(color ? { color } : {}), + ...(opacity ? { opacity } : {}), + ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { type: partBaseSpec.mark }), + style: `${mark}-${String(part)}`, + ...(isBoolean(markDef[part]) ? {} : markDef[part]) + } + } + ]; + } + return []; +} +export function compositeMarkContinuousAxis(spec, orient, compositeMark) { + const { encoding } = spec; + const continuousAxis = orient === 'vertical' ? 'y' : 'x'; + const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. + const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`]; + const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`]; + const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`]; + return { + continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), + continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), + continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), + continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), + continuousAxis + }; +} +function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) { + if (continuousAxisChannelDef?.aggregate) { + const { aggregate, ...continuousAxisWithoutAggregate } = continuousAxisChannelDef; + if (aggregate !== compositeMark) { + log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); + } + return continuousAxisWithoutAggregate; + } + else { + return continuousAxisChannelDef; + } +} +export function compositeMarkOrient(spec, compositeMark) { + const { mark, encoding } = spec; + const { x, y } = encoding; + if (isMarkDef(mark) && mark.orient) { + return mark.orient; + } + if (isContinuousFieldOrDatumDef(x)) { + // x is continuous + if (isContinuousFieldOrDatumDef(y)) { + // both x and y are continuous + const xAggregate = isFieldDef(x) && x.aggregate; + const yAggregate = isFieldDef(y) && y.aggregate; + if (!xAggregate && yAggregate === compositeMark) { + return 'vertical'; + } + else if (!yAggregate && xAggregate === compositeMark) { + return 'horizontal'; + } + else if (xAggregate === compositeMark && yAggregate === compositeMark) { + throw new Error('Both x and y cannot have aggregate'); + } + else { + if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { + // y is temporal but x is not + return 'horizontal'; + } + // default orientation for two continuous + return 'vertical'; + } + } + return 'horizontal'; + } + else if (isContinuousFieldOrDatumDef(y)) { + // y is continuous but x is not + return 'vertical'; + } + else { + // Neither x nor y is continuous. + throw new Error(`Need a valid continuous axis for ${compositeMark}s`); + } +} +//# sourceMappingURL=common.js.map \ No newline at end of file diff --git a/build/src/compositemark/common.js.map b/build/src/compositemark/common.js.map new file mode 100644 index 0000000000..227513b4ba --- /dev/null +++ b/build/src/compositemark/common.js.map @@ -0,0 +1 @@ +{"version":3,"file":"common.js","sourceRoot":"","sources":["../../../src/compositemark/common.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEvD,OAAO,EAGL,2BAA2B,EAC3B,UAAU,EACV,8BAA8B,EAM/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAW,SAAS,EAAC,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAA8B,SAAS,EAA+B,MAAM,SAAS,CAAC;AAE7F,OAAO,EAAC,eAAe,EAAE,IAAI,EAAE,MAAM,EAAC,MAAM,SAAS,CAAC;AACtD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAiCjD,MAAM,UAAU,gCAAgC,CAC9C,WAAwB;IAQxB,MAAM,EAAC,OAAO,EAAE,GAAG,gBAAgB,EAAC,GAAG,WAAW,CAAC;IACnD,IAAI,CAAC,OAAO,EAAE;QACZ,OAAO,EAAC,gBAAgB,EAAC,CAAC;KA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ACnB;iBAAM,IAAI,CAAC,UAAU,IAAI,UAAU,KAAK,aAAa,EAAE;gBACtD,OAAO,YAAY,CAAC;aACrB;iBAAM,IAAI,UAAU,KAAK,aAAa,IAAI,UAAU,KAAK,aAAa,EAAE;gBACvE,MAAM,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC;aACvD;iBAAM;gBACL,IAAI,8BAA8B,CAAC,CAAC,CAAC,IAAI,CAAC,8BAA8B,CAAC,CAAC,CAAC,EAAE;oBAC3E,6BAA6B;oBAC7B,OAAO,YAAY,CAAC;iBACrB;gBAED,yCAAyC;gBACzC,OAAO,UAAU,CAAC;aACnB;SACF;QAED,OAAO,YAAY,CAAC;KACrB;SAAM,IAAI,2BAA2B,CAAC,CAAC,CAAC,EAAE;QACzC,+BAA+B;QAC/B,OAAO,UAAU,CAAC;KACnB;SAAM;QACL,iCAAiC;QACjC,MAAM,IAAI,KAAK,CAAC,oCAAoC,aAAa,GAAG,CAAC,CAAC;KACvE;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/compositemark/errorband.d.ts b/build/src/compositemark/errorband.d.ts new file mode 100644 index 0000000000..9a3fe98af7 --- /dev/null +++ b/build/src/compositemark/errorband.d.ts @@ -0,0 +1,75 @@ +import { Interpolate, Orientation } from 'vega'; +import { Field } from '../channeldef'; +import { Encoding } from '../encoding'; +import { NormalizerParams } from '../normalize'; +import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; +import { CompositeMarkNormalizer } from './base'; +import { GenericCompositeMarkDef, PartsMixins } from './common'; +import { ErrorBarCenter, ErrorBarExtent, ErrorEncoding } from './errorbar'; +export type ErrorBandUnitSpec = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>; +export declare const ERRORBAND: "errorband"; +export type ErrorBand = typeof ERRORBAND; +export declare const ERRORBAND_PARTS: readonly ["band", "borders"]; +type ErrorBandPart = (typeof ERRORBAND_PARTS)[number]; +export type ErrorBandPartsMixins = PartsMixins; +export interface ErrorBandConfig extends ErrorBandPartsMixins { + /** + * The center of the error band. Available options include: + * - `"mean"`: the mean of the data points. + * - `"median"`: the median of the data points. + * + * __Default value:__ `"mean"`. + * @hidden + */ + center?: ErrorBarCenter; + /** + * The extent of the band. Available options include: + * - `"ci"`: Extend the band to the confidence interval of the mean. + * - `"stderr"`: The size of band are set to the value of standard error, extending from the mean. + * - `"stdev"`: The size of band are set to the value of standard deviation, extending from the mean. + * - `"iqr"`: Extend the band to the q1 and q3. + * + * __Default value:__ `"stderr"`. + */ + extent?: ErrorBarExtent; + /** + * The line interpolation method for the error band. One of the following: + * - `"linear"`: piecewise linear segments, as in a polyline. + * - `"linear-closed"`: close the linear segments to form a polygon. + * - `"step"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values. + * - `"step-before"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value. + * - `"step-after"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value. + * - `"basis"`: a B-spline, with control point duplication on the ends. + * - `"basis-open"`: an open B-spline; may not intersect the start or end. + * - `"basis-closed"`: a closed B-spline, as in a loop. + * - `"cardinal"`: a Cardinal spline, with control point duplication on the ends. + * - `"cardinal-open"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points. + * - `"cardinal-closed"`: a closed Cardinal spline, as in a loop. + * - `"bundle"`: equivalent to basis, except the tension parameter is used to straighten the spline. + * - `"monotone"`: cubic interpolation that preserves monotonicity in y. + */ + interpolate?: Interpolate; + /** + * The tension parameter for the interpolation type of the error band. + * + * @minimum 0 + * @maximum 1 + */ + tension?: number; +} +export type ErrorBandDef = GenericCompositeMarkDef & ErrorBandConfig & { + /** + * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. + */ + orient?: Orientation; +}; +export interface ErrorBandConfigMixins { + /** + * ErrorBand Config + */ + errorband?: ErrorBandConfig; +} +export declare const errorBandNormalizer: CompositeMarkNormalizer<"errorband">; +export declare function normalizeErrorBand(spec: GenericUnitSpec, ErrorBand | ErrorBandDef>, { config }: NormalizerParams): NormalizedLayerSpec; +export {}; +//# sourceMappingURL=errorband.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/errorband.d.ts.map b/build/src/compositemark/errorband.d.ts.map new file mode 100644 index 0000000000..7096765e78 --- /dev/null +++ b/build/src/compositemark/errorband.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errorband.d.ts","sourceRoot":"","sources":["../../../src/compositemark/errorband.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AAC9C,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAoB,MAAM,aAAa,CAAC;AAGxD,OAAO,EAAC,gBAAgB,EAAC,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAC,eAAe,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,uBAAuB,EAAqC,WAAW,EAAC,MAAM,UAAU,CAAC;AACjG,OAAO,EAAC,cAAc,EAAE,cAAc,EAAkB,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzF,MAAM,MAAM,iBAAiB,CAC3B,EAAE,GAAG,SAAS,IACZ,eAAe,CAAC,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;AAEzE,eAAO,MAAM,SAAS,aAAuB,CAAC;AAC9C,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAEzC,eAAO,MAAM,eAAe,8BAA+B,CAAC;AAE5D,KAAK,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,MAAM,MAAM,oBAAoB,GAAG,WAAW,CAAC,aAAa,CAAC,CAAC;AAE9D,MAAM,WAAW,eAAgB,SAAQ,oBAAoB;IAC3D;;;;;;;OAOG;IAGH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;;;;;;;;;;;;;;OAeG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,YAAY,GAAG,uBAAuB,CAAC,SAAS,CAAC,GAC3D,eAAe,GAAG;IAChB;;OAEG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEJ,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,SAAS,CAAC,EAAE,eAAe,CAAC;CAC7B;AAED,eAAO,MAAM,mBAAmB,sCAA6D,CAAC;AAE9F,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,GAAG,YAAY,CAAC,EACjE,EAAC,MAAM,EAAC,EAAE,gBAAgB,GACzB,mBAAmB,CA8ErB"} \ No newline at end of file diff --git a/build/src/compositemark/errorband.js b/build/src/compositemark/errorband.js new file mode 100644 index 0000000000..4bd31debc0 --- /dev/null +++ b/build/src/compositemark/errorband.js @@ -0,0 +1,69 @@ +import { normalizeEncoding } from '../encoding'; +import * as log from '../log'; +import { CompositeMarkNormalizer } from './base'; +import { makeCompositeAggregatePartFactory } from './common'; +import { errorBarParams } from './errorbar'; +export const ERRORBAND = 'errorband'; +export const ERRORBAND_PARTS = ['band', 'borders']; +export const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); +export function normalizeErrorBand(spec, { config }) { + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAND, config); + const errorBandDef = markDef; + const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband); + const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; + let bandMark = { type: is2D ? 'area' : 'rect' }; + let bordersMark = { type: is2D ? 'line' : 'rule' }; + const interpolate = { + ...(errorBandDef.interpolate ? { interpolate: errorBandDef.interpolate } : {}), + ...(errorBandDef.tension && errorBandDef.interpolate ? { tension: errorBandDef.tension } : {}) + }; + if (is2D) { + bandMark = { + ...bandMark, + ...interpolate, + ariaRoleDescription: 'errorband' + }; + bordersMark = { + ...bordersMark, + ...interpolate, + aria: false + }; + } + else if (errorBandDef.interpolate) { + log.warn(log.message.errorBand1DNotSupport('interpolate')); + } + else if (errorBandDef.tension) { + log.warn(log.message.errorBand1DNotSupport('tension')); + } + return { + ...outerSpec, + transform, + layer: [ + ...makeErrorBandPart({ + partName: 'band', + mark: bandMark, + positionPrefix: 'lower', + endPositionPrefix: 'upper', + extraEncoding: tooltipEncoding + }), + ...makeErrorBandPart({ + partName: 'borders', + mark: bordersMark, + positionPrefix: 'lower', + extraEncoding: tooltipEncoding + }), + ...makeErrorBandPart({ + partName: 'borders', + mark: bordersMark, + positionPrefix: 'upper', + extraEncoding: tooltipEncoding + }) + ] + }; +} +//# sourceMappingURL=errorband.js.map \ No newline at end of file diff --git a/build/src/compositemark/errorband.js.map b/build/src/compositemark/errorband.js.map new file mode 100644 index 0000000000..093ded2c6b --- /dev/null +++ b/build/src/compositemark/errorband.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errorband.js","sourceRoot":"","sources":["../../../src/compositemark/errorband.ts"],"names":[],"mappings":"AAEA,OAAO,EAAW,iBAAiB,EAAC,MAAM,aAAa,CAAC;AACxD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAI9B,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAA0B,iCAAiC,EA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;KACF,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/compositemark/errorbar.d.ts b/build/src/compositemark/errorbar.d.ts new file mode 100644 index 0000000000..fd8dd4da86 --- /dev/null +++ b/build/src/compositemark/errorbar.d.ts @@ -0,0 +1,102 @@ +import { Orientation, SignalRef, Text } from 'vega'; +import { PositionChannel } from '../channel'; +import { Field, PositionFieldDef, SecondaryFieldDef, ValueDef } from '../channeldef'; +import { Config } from '../config'; +import { Data } from '../data'; +import { Encoding } from '../encoding'; +import { ExprRef } from '../expr'; +import { NormalizerParams } from '../normalize'; +import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; +import { Step } from '../spec/base'; +import { NormalizedUnitSpec } from '../spec/unit'; +import { TitleParams } from '../title'; +import { Transform } from '../transform'; +import { CompositeMarkNormalizer } from './base'; +import { GenericCompositeMarkDef, PartsMixins } from './common'; +import { ErrorBand, ErrorBandDef } from './errorband'; +export declare const ERRORBAR: "errorbar"; +export type ErrorBar = typeof ERRORBAR; +export type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev'; +export type ErrorBarCenter = 'mean' | 'median'; +export type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error'; +export declare const ERRORBAR_PARTS: readonly ["ticks", "rule"]; +export type ErrorBarPart = (typeof ERRORBAR_PARTS)[number]; +export interface ErrorExtraEncoding { + /** + * Error value of x coordinates for error specified `"errorbar"` and `"errorband"`. + */ + xError?: SecondaryFieldDef | ValueDef; + /** + * Secondary error value of x coordinates for error specified `"errorbar"` and `"errorband"`. + */ + xError2?: SecondaryFieldDef | ValueDef; + /** + * Error value of y coordinates for error specified `"errorbar"` and `"errorband"`. + */ + yError?: SecondaryFieldDef | ValueDef; + /** + * Secondary error value of y coordinates for error specified `"errorbar"` and `"errorband"`. + */ + yError2?: SecondaryFieldDef | ValueDef; +} +export type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> & ErrorExtraEncoding; +export type ErrorBarPartsMixins = PartsMixins; +export interface ErrorBarConfig extends ErrorBarPartsMixins { + /** Size of the ticks of an error bar */ + size?: number; + /** Thickness of the ticks and the bar of an error bar */ + thickness?: number; + /** + * The center of the errorbar. Available options include: + * - `"mean"`: the mean of the data points. + * - `"median"`: the median of the data points. + * + * __Default value:__ `"mean"`. + * @hidden + */ + center?: ErrorBarCenter; + /** + * The extent of the rule. Available options include: + * - `"ci"`: Extend the rule to the confidence interval of the mean. + * - `"stderr"`: The size of rule are set to the value of standard error, extending from the mean. + * - `"stdev"`: The size of rule are set to the value of standard deviation, extending from the mean. + * - `"iqr"`: Extend the rule to the q1 and q3. + * + * __Default value:__ `"stderr"`. + */ + extent?: ErrorBarExtent; +} +export type ErrorBarDef = GenericCompositeMarkDef & ErrorBarConfig & { + /** + * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined. + */ + orient?: Orientation; +}; +export interface ErrorBarConfigMixins { + /** + * ErrorBar Config + */ + errorbar?: ErrorBarConfig; +} +export declare const errorBarNormalizer: CompositeMarkNormalizer<"errorbar">; +export declare function normalizeErrorBar(spec: GenericUnitSpec, ErrorBar | ErrorBarDef>, { config }: NormalizerParams): NormalizedLayerSpec | NormalizedUnitSpec; +export declare function errorBarParams & (ErrorBarDef | ErrorBandDef)>(spec: GenericUnitSpec, M | MD>, compositeMark: M, config: Config): { + transform: Transform[]; + groupby: string[]; + continuousAxisChannelDef: PositionFieldDef; + continuousAxis: 'x' | 'y'; + encodingWithoutContinuousAxis: ErrorEncoding; + ticksOrient: Orientation; + markDef: MD; + outerSpec: { + data?: Data; + title?: Text | TitleParams; + name?: string; + description?: string; + transform?: Transform[]; + width?: number | 'container' | Step; + height?: number | 'container' | Step; + }; + tooltipEncoding: ErrorEncoding; +}; +//# sourceMappingURL=errorbar.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/errorbar.d.ts.map b/build/src/compositemark/errorbar.d.ts.map new file mode 100644 index 0000000000..a47aa08eaa --- /dev/null +++ b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GAAG,IAAI,CAAC;QACpC,MAAM,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,IAAI,CAAC;KACtC,CAAC;IACF,eAAe,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;CACxC,CA0EA"} \ No newline at end of file diff --git a/build/src/compositemark/errorbar.js b/build/src/compositemark/errorbar.js new file mode 100644 index 0000000000..40524ed48e --- /dev/null +++ b/build/src/compositemark/errorbar.js @@ -0,0 +1,324 @@ +import { isContinuousFieldOrDatumDef, isFieldOrDatumDef, title } from '../channeldef'; +import { extractTransformsFromEncoding, normalizeEncoding } from '../encoding'; +import * as log from '../log'; +import { isMarkDef } from '../mark'; +import { replaceAll, titleCase } from '../util'; +import { CompositeMarkNormalizer } from './base'; +import { compositeMarkContinuousAxis, compositeMarkOrient, getCompositeMarkTooltip, makeCompositeAggregatePartFactory } from './common'; +export const ERRORBAR = 'errorbar'; +export const ERRORBAR_PARTS = ['ticks', 'rule']; +export const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); +export function normalizeErrorBar(spec, { config }) { + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { transform, continuousAxisChannelDef, continuousAxis, encodingWithoutContinuousAxis, ticksOrient, markDef, outerSpec, tooltipEncoding } = errorBarParams(spec, ERRORBAR, config); + delete encodingWithoutContinuousAxis['size']; + const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar); + const thickness = markDef.thickness; + const size = markDef.size; + const tick = { + type: 'tick', + orient: ticksOrient, + aria: false, + ...(thickness !== undefined ? { thickness } : {}), + ...(size !== undefined ? { size } : {}) + }; + const layer = [ + ...makeErrorBarPart({ + partName: 'ticks', + mark: tick, + positionPrefix: 'lower', + extraEncoding: tooltipEncoding + }), + ...makeErrorBarPart({ + partName: 'ticks', + mark: tick, + positionPrefix: 'upper', + extraEncoding: tooltipEncoding + }), + ...makeErrorBarPart({ + partName: 'rule', + mark: { + type: 'rule', + ariaRoleDescription: 'errorbar', + ...(thickness !== undefined ? { size: thickness } : {}) + }, + positionPrefix: 'lower', + endPositionPrefix: 'upper', + extraEncoding: tooltipEncoding + }) + ]; + return { + ...outerSpec, + transform, + ...(layer.length > 1 ? { layer } : { ...layer[0] }) + }; +} +function errorBarOrientAndInputType(spec, compositeMark) { + const { encoding } = spec; + if (errorBarIsInputTypeRaw(encoding)) { + return { + orient: compositeMarkOrient(spec, compositeMark), + inputType: 'raw' + }; + } + const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding); + const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding); + const x = encoding.x; + const y = encoding.y; + if (isTypeAggregatedUpperLower) { + // type is aggregated-upper-lower + if (isTypeAggregatedError) { + throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`); + } + const x2 = encoding.x2; + const y2 = encoding.y2; + if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { + // having both x, x2 and y, y2 + throw new Error(`${compositeMark} cannot have both x2 and y2`); + } + else if (isFieldOrDatumDef(x2)) { + if (isContinuousFieldOrDatumDef(x)) { + // having x, x2 quantitative and field y, y2 are not specified + return { orient: 'horizontal', inputType: 'aggregated-upper-lower' }; + } + else { + // having x, x2 that are not both quantitative + throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`); + } + } + else if (isFieldOrDatumDef(y2)) { + // y2 is a FieldDef + if (isContinuousFieldOrDatumDef(y)) { + // having y, y2 quantitative and field x, x2 are not specified + return { orient: 'vertical', inputType: 'aggregated-upper-lower' }; + } + else { + // having y, y2 that are not both quantitative + throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`); + } + } + throw new Error('No ranged axis'); + } + else { + // type is aggregated-error + const xError = encoding.xError; + const xError2 = encoding.xError2; + const yError = encoding.yError; + const yError2 = encoding.yError2; + if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { + // having xError2 without xError + throw new Error(`${compositeMark} cannot have xError2 without xError`); + } + if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { + // having yError2 without yError + throw new Error(`${compositeMark} cannot have yError2 without yError`); + } + if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { + // having both xError and yError + throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`); + } + else if (isFieldOrDatumDef(xError)) { + if (isContinuousFieldOrDatumDef(x)) { + // having x and xError that are all quantitative + return { orient: 'horizontal', inputType: 'aggregated-error' }; + } + else { + // having x, xError, and xError2 that are not all quantitative + throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); + } + } + else if (isFieldOrDatumDef(yError)) { + if (isContinuousFieldOrDatumDef(y)) { + // having y and yError that are all quantitative + return { orient: 'vertical', inputType: 'aggregated-error' }; + } + else { + // having y, yError, and yError2 that are not all quantitative + throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); + } + } + throw new Error('No ranged axis'); + } +} +function errorBarIsInputTypeRaw(encoding) { + return ((isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && + !isFieldOrDatumDef(encoding.x2) && + !isFieldOrDatumDef(encoding.y2) && + !isFieldOrDatumDef(encoding.xError) && + !isFieldOrDatumDef(encoding.xError2) && + !isFieldOrDatumDef(encoding.yError) && + !isFieldOrDatumDef(encoding.yError2)); +} +function errorBarIsInputTypeAggregatedUpperLower(encoding) { + return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); +} +function errorBarIsInputTypeAggregatedError(encoding) { + return (isFieldOrDatumDef(encoding.xError) || + isFieldOrDatumDef(encoding.xError2) || + isFieldOrDatumDef(encoding.yError) || + isFieldOrDatumDef(encoding.yError2)); +} +export function errorBarParams(spec, compositeMark, config) { + // TODO: use selection + const { mark, encoding, params, projection: _p, ...outerSpec } = spec; + const markDef = isMarkDef(mark) ? mark : { type: mark }; + // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support + if (params) { + log.warn(log.message.selectionNotSupported(compositeMark)); + } + const { orient, inputType } = errorBarOrientAndInputType(spec, compositeMark); + const { continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, continuousAxis } = compositeMarkContinuousAxis(spec, orient, compositeMark); + const { errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config); + const { [continuousAxis]: oldContinuousAxisChannelDef, [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2, [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError, [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2, ...oldEncodingWithoutContinuousAxis } = encoding; + const { bins, timeUnits, aggregate: oldAggregate, groupby: oldGroupBy, encoding: encodingWithoutContinuousAxis } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config); + const aggregate = [...oldAggregate, ...errorBarSpecificAggregate]; + const groupby = inputType !== 'raw' ? [] : oldGroupBy; + const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName); + return { + transform: [ + ...(outerSpec.transform ?? []), + ...bins, + ...timeUnits, + ...(aggregate.length === 0 ? [] : [{ aggregate, groupby }]), + ...postAggregateCalculates + ], + groupby, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', + markDef, + outerSpec, + tooltipEncoding + }; +} +function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) { + let errorBarSpecificAggregate = []; + let postAggregateCalculates = []; + const continuousFieldName = continuousAxisChannelDef.field; + let tooltipSummary; + let tooltipTitleWithFieldName = false; + if (inputType === 'raw') { + const center = markDef.center + ? markDef.center + : markDef.extent + ? markDef.extent === 'iqr' + ? 'median' + : 'mean' + : config.errorbar.center; + const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; + if ((center === 'median') !== (extent === 'iqr')) { + log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); + } + if (extent === 'stderr' || extent === 'stdev') { + errorBarSpecificAggregate = [ + { op: extent, field: continuousFieldName, as: `extent_${continuousFieldName}` }, + { op: center, field: continuousFieldName, as: `center_${continuousFieldName}` } + ]; + postAggregateCalculates = [ + { + calculate: `datum["center_${continuousFieldName}"] + datum["extent_${continuousFieldName}"]`, + as: `upper_${continuousFieldName}` + }, + { + calculate: `datum["center_${continuousFieldName}"] - datum["extent_${continuousFieldName}"]`, + as: `lower_${continuousFieldName}` + } + ]; + tooltipSummary = [ + { fieldPrefix: 'center_', titlePrefix: titleCase(center) }, + { fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+') }, + { fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-') } + ]; + tooltipTitleWithFieldName = true; + } + else { + let centerOp; + let lowerExtentOp; + let upperExtentOp; + if (extent === 'ci') { + centerOp = 'mean'; + lowerExtentOp = 'ci0'; + upperExtentOp = 'ci1'; + } + else { + centerOp = 'median'; + lowerExtentOp = 'q1'; + upperExtentOp = 'q3'; + } + errorBarSpecificAggregate = [ + { op: lowerExtentOp, field: continuousFieldName, as: `lower_${continuousFieldName}` }, + { op: upperExtentOp, field: continuousFieldName, as: `upper_${continuousFieldName}` }, + { op: centerOp, field: continuousFieldName, as: `center_${continuousFieldName}` } + ]; + tooltipSummary = [ + { + fieldPrefix: 'upper_', + titlePrefix: title({ field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative' }, config, { + allowDisabling: false + }) + }, + { + fieldPrefix: 'lower_', + titlePrefix: title({ field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative' }, config, { + allowDisabling: false + }) + }, + { + fieldPrefix: 'center_', + titlePrefix: title({ field: continuousFieldName, aggregate: centerOp, type: 'quantitative' }, config, { + allowDisabling: false + }) + } + ]; + } + } + else { + if (markDef.center || markDef.extent) { + log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); + } + if (inputType === 'aggregated-upper-lower') { + tooltipSummary = []; + postAggregateCalculates = [ + { calculate: `datum["${continuousAxisChannelDef2.field}"]`, as: `upper_${continuousFieldName}` }, + { calculate: `datum["${continuousFieldName}"]`, as: `lower_${continuousFieldName}` } + ]; + } + else if (inputType === 'aggregated-error') { + tooltipSummary = [{ fieldPrefix: '', titlePrefix: continuousFieldName }]; + postAggregateCalculates = [ + { + calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError.field}"]`, + as: `upper_${continuousFieldName}` + } + ]; + if (continuousAxisChannelDefError2) { + postAggregateCalculates.push({ + calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError2.field}"]`, + as: `lower_${continuousFieldName}` + }); + } + else { + postAggregateCalculates.push({ + calculate: `datum["${continuousFieldName}"] - datum["${continuousAxisChannelDefError.field}"]`, + as: `lower_${continuousFieldName}` + }); + } + } + for (const postAggregateCalculate of postAggregateCalculates) { + tooltipSummary.push({ + fieldPrefix: postAggregateCalculate.as.substring(0, 6), + titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') + }); + } + } + return { postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName }; +} +function getTitlePrefix(center, extent, operation) { + return `${titleCase(center)} ${operation} ${extent}`; +} +//# sourceMappingURL=errorbar.js.map \ No newline at end of file diff --git a/build/src/compositemark/errorbar.js.map b/build/src/compositemark/errorbar.js.map new file mode 100644 index 0000000000..4fe1b64a1b --- /dev/null +++ b/build/src/compositemark/errorbar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errorbar.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,EAAE,EAAE,EAAE,WAAW,EAAE,mBAAmB,EAAC,CAAC,CAAC;YACvE,uBAAuB,GAAG;gBACxB;oBACE,SAAS,EAAE,UAAU,mBAAmB,eAAe,6BAA6B,CAAC,KAAK,IAAI;oBAC9F,EAAE,EAAE,SAAS,mBAAmB,EAAE;iBACnC;aACF,CAAC;YAEF,IAAI,8BAA8B,EAAE;gBAClC,uBAAuB,CAAC,IAAI,CAAC;oBAC3B,SAAS,EAAE,UAAU,mBAAmB,eAAe,8BAA8B,CAAC,KAAK,IAAI;oBAC/F,EAAE,EAAE,SAAS,mBAAmB,EAAE;iBACnC,CAAC,CAAC;aACJ;iBAAM;gBACL,uBAAuB,CAAC,IAAI,CAAC;oBAC3B,SAAS,EAAE,UAAU,mBAAmB,eAAe,6BAA6B,CAAC,KAAK,IAAI;oBAC9F,EAAE,EAAE,SAAS,mBAAmB,EAAE;iBACnC,CAAC,CAAC;aACJ;SACF;QAED,KAAK,MAAM,sBAAsB,IAAI,uBAAuB,EAAE;YAC5D,cAAc,CAAC,IAAI,CAAC;gBAClB,WAAW,EAAE,sBAAsB,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;gBACtD,WAAW,EAAE,UAAU,CAAC,UAAU,CAAC,sBAAsB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC;aAC/F,CAAC,CAAC;SACJ;KACF;IACD,OAAO,EAAC,uBAAuB,EAAE,yBAAyB,EAAE,cAAc,EAAE,yBAAyB,EAAC,CAAC;AACzG,CAAC;AAED,SAAS,cAAc,CAAC,MAAsB,EAAE,MAAsB,EAAE,SAAoB;IAC1F,OAAO,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,SAAS,IAAI,MAAM,EAAE,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/build/src/compositemark/index.d.ts b/build/src/compositemark/index.d.ts new file mode 100644 index 0000000000..eac24116ac --- /dev/null +++ b/build/src/compositemark/index.d.ts @@ -0,0 +1,28 @@ +import { Field } from '../channeldef'; +import { Encoding } from '../encoding'; +import { NormalizerParams } from '../normalize'; +import { GenericUnitSpec, NormalizedLayerSpec } from '../spec'; +import { EncodingFacetMapping } from '../spec/facet'; +import { NormalizedUnitSpec } from '../spec/unit'; +import { BoxPlot, BoxPlotConfigMixins, BoxPlotDef } from './boxplot'; +import { ErrorBand, ErrorBandConfigMixins, ErrorBandDef } from './errorband'; +import { ErrorBar, ErrorBarConfigMixins, ErrorBarDef, ErrorExtraEncoding } from './errorbar'; +export type { BoxPlotConfig } from './boxplot'; +export type { ErrorBandConfigMixins } from './errorband'; +export type { ErrorBarConfigMixins } from './errorbar'; +export type CompositeMarkNormalizerRun = (spec: GenericUnitSpec, params: NormalizerParams) => NormalizedLayerSpec | NormalizedUnitSpec; +export declare function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]): void; +export declare function remove(mark: string): void; +export type CompositeEncoding = Encoding & ErrorExtraEncoding; +export type PartialIndex> = { + [t in keyof T]?: Partial; +}; +export type SharedCompositeEncoding = PartialIndex, 'detail' | 'order' | 'tooltip'>> & Pick, 'detail' | 'order' | 'tooltip'>; +export type FacetedCompositeEncoding = Encoding & ErrorExtraEncoding & EncodingFacetMapping; +export type CompositeMark = BoxPlot | ErrorBar | ErrorBand; +export declare function getAllCompositeMarks(): string[]; +export type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef; +export type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand; +export interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins { +} +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/compositemark/index.d.ts.map b/build/src/compositemark/index.d.ts.map new file mode 100644 index 0000000000..33b2e3d25b --- /dev/null +++ b/build/src/compositemark/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/compositemark/index.ts"],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,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,uBAAuB,CAAC,CAAC,SAAS,KAAK,IAAI,YAAY,CACjE,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC,CAC3D,GACC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC,CAAC;AAEpD,MAAM,MAAM,wBAAwB,CAAC,CAAC,SAAS,KAAK,IAAI,QAAQ,CAAC,CAAC,CAAC,GAAG,kBAAkB,CAAC,CAAC,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC;AAEtH,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAE3D,wBAAgB,oBAAoB,aAEnC;AAED,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,YAAY,CAAC;AAEvE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhE,MAAM,WAAW,yBAA0B,SAAQ,mBAAmB,EAAE,oBAAoB,EAAE,qBAAqB;CAAG"} \ No newline at end of file diff --git a/build/src/compositemark/index.js b/build/src/compositemark/index.js new file mode 100644 index 0000000000..950a4a1d4d --- /dev/null +++ b/build/src/compositemark/index.js @@ -0,0 +1,23 @@ +import { keys } from '../util'; +import { CompositeMarkNormalizer } from './base'; +import { BOXPLOT, BOXPLOT_PARTS, normalizeBoxPlot } from './boxplot'; +import { ERRORBAND, ERRORBAND_PARTS, normalizeErrorBand } from './errorband'; +import { ERRORBAR, ERRORBAR_PARTS, normalizeErrorBar } from './errorbar'; +/** + * Registry index for all composite mark's normalizer + */ +const compositeMarkRegistry = {}; +export function add(mark, run, parts) { + const normalizer = new CompositeMarkNormalizer(mark, run); + compositeMarkRegistry[mark] = { normalizer, parts }; +} +export function remove(mark) { + delete compositeMarkRegistry[mark]; +} +export function getAllCompositeMarks() { + return keys(compositeMarkRegistry); +} +add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); +add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); +add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/compositemark/index.js.map b/build/src/compositemark/index.js.map new file mode 100644 index 0000000000..b175a0495d --- /dev/null +++ b/build/src/compositemark/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/compositemark/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,uBAAuB,EAAC,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAC,OAAO,EAA4C,aAAa,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC7G,OAAO,EACL,SAAS,EAIT,eAAe,EACf,kBAAkB,EACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,QAAQ,EAIR,cAAc,EAEd,iBAAiB,EAClB,MAAM,YAAY,CAAC;AAWpB;;GAEG;AACH,MAAM,qBAAqB,GAKvB,EAAE,CAAC;AAEP,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,GAA+B,EAAE,KAAwB;IACzF,MAAM,UAAU,GAAG,IAAI,uBAAuB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;IAC1D,qBAAqB,CAAC,IAAI,CAAC,GAAG,EAAC,UAAU,EAAE,KAAK,EAAC,CAAC;AACpD,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAAY;IACjC,OAAO,qBAAqB,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC;AAiBD,MAAM,UAAU,oBAAoB;IAClC,OAAO,IAAI,CAAC,qBAAqB,CAAC,CAAC;AACrC,CAAC;AAQD,GAAG,CAAC,OAAO,EAAE,gBAAgB,EAAE,aAAa,CAAC,CAAC;AAC9C,GAAG,CAAC,QAAQ,EAAE,iBAAiB,EAAE,cAAc,CAAC,CAAC;AACjD,GAAG,CAAC,SAAS,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/config.d.ts b/build/src/config.d.ts new file mode 100644 index 0000000000..db8beccb90 --- /dev/null +++ b/build/src/config.d.ts @@ -0,0 +1,262 @@ +import { Color, InitSignal, Locale, NewSignal, RangeConfig, RangeScheme, SignalRef } from 'vega'; +import { Axis, AxisConfigMixins } from './axis'; +import { CompositeMarkConfigMixins } from './compositemark'; +import { ExprRef } from './expr'; +import { HeaderConfigMixins } from './header'; +import { LegendConfig } from './legend'; +import { AnyMarkConfig, MarkConfig, MarkConfigMixins } from './mark'; +import { ProjectionConfig } from './projection'; +import { ScaleConfig } from './scale'; +import { SelectionConfig } from './selection'; +import { BaseViewBackground, CompositionConfigMixins } from './spec/base'; +import { TopLevelProperties } from './spec/toplevel'; +import { TitleConfig } from './title'; +export interface ViewConfig extends BaseViewBackground { + /** + * The default width when the plot has a continuous field for x or longitude, or has arc marks. + * + * __Default value:__ `200` + */ + continuousWidth?: number; + /** + * The default width when the plot has non-arc marks and either a discrete x-field or no x-field. + * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. + * + * __Default value:__ a step size based on `config.view.step`. + */ + discreteWidth?: number | { + step: number; + }; + /** + * The default height when the plot has a continuous y-field for x or latitude, or has arc marks. + * + * __Default value:__ `200` + */ + continuousHeight?: number; + /** + * The default height when the plot has non arc marks and either a discrete y-field or no y-field. + * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. + * + * __Default value:__ a step size based on `config.view.step`. + */ + discreteHeight?: number | { + step: number; + }; + /** + * Default step size for x-/y- discrete fields. + */ + step?: number; + /** + * Whether the view should be clipped. + */ + clip?: boolean; +} +export declare function getViewConfigContinuousSize(viewConfig: ViewConfig, channel: 'width' | 'height'): any; +export declare function getViewConfigDiscreteStep(viewConfig: ViewConfig, channel: 'width' | 'height'): number; +export declare function getViewConfigDiscreteSize(viewConfig: ViewConfig, channel: 'width' | 'height'): any; +export declare const DEFAULT_STEP = 20; +export declare const defaultViewConfig: ViewConfig; +export declare function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme; +export type ColorConfig = Record; +export type FontSizeConfig = Record; +export interface FormatConfig { + /** + * If numberFormatType is not specified, + * D3 number format for guide labels, text marks, and tooltips of non-normalized fields (fields *without* `stack: "normalize"`). For example `"s"` for SI units. + * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format). + * + * If `config.numberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function. + */ + numberFormat?: string; + /** + * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type) + * for `config.numberFormat`. + * + * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format). + * __Note:__ You must also set `customFormatTypes` to `true` to use this feature. + */ + numberFormatType?: string; + /** + * If normalizedNumberFormatType is not specified, + * D3 number format for axis labels, text marks, and tooltips of normalized stacked fields (fields with `stack: "normalize"`). For example `"s"` for SI units. + * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format). + * + * If `config.normalizedNumberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function. + * __Default value:__ `%` + */ + normalizedNumberFormat?: string; + /** + * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type) + * for `config.normalizedNumberFormat`. + * + * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format). + * __Note:__ You must also set `customFormatTypes` to `true` to use this feature. + */ + normalizedNumberFormatType?: string; + /** + * Default time format for raw time values (without time units) in text marks, legend labels and header labels. + * + * __Default value:__ `"%b %d, %Y"` + * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes. + */ + timeFormat?: string; + /** + * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type) + * for `config.timeFormat`. + * + * __Default value:__ `undefined` -- This is equilvalent to call D3-time-format, which is exposed as [`timeFormat` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#timeFormat). + * __Note:__ You must also set `customFormatTypes` to `true` and there must *not* be a `timeUnit` defined to use this feature. + */ + timeFormatType?: string; +} +export interface VLOnlyConfig extends FormatConfig { + /** + * Default font for all text marks, titles, and labels. + */ + font?: string; + /** + * Default color signals. + * + * @hidden + */ + color?: boolean | ColorConfig; + /** + * Default font size signals. + * + * @hidden + */ + fontSize?: boolean | FontSizeConfig; + /** + * Default axis and legend title for count fields. + * + * __Default value:__ `'Count of Records`. + * + * @type {string} + */ + countTitle?: string; + /** + * Defines how Vega-Lite generates title for fields. There are three possible styles: + * - `"verbal"` (Default) - displays function in a verbal style (e.g., "Sum of field", "Year-month of date", "field (binned)"). + * - `"function"` - displays function using parentheses and capitalized texts (e.g., "SUM(field)", "YEARMONTH(date)", "BIN(field)"). + * - `"plain"` - displays only the field name without functions (e.g., "field", "date", "field"). + */ + fieldTitle?: 'verbal' | 'functional' | 'plain'; + /** + * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type). + */ + customFormatTypes?: boolean; + /** + * Define [custom format configuration](https://vega.github.io/vega-lite/docs/config.html#format) for tooltips. If unspecified, default format config will be applied. + */ + tooltipFormat?: FormatConfig; + /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */ + view?: ViewConfig; + /** + * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). + */ + scale?: ScaleConfig; + /** An object hash for defining default properties for each type of selections. */ + selection?: SelectionConfig; +} +export type StyleConfigIndex = Partial | Axis>> & MarkConfigMixins & { + /** + * Default style for axis, legend, and header titles. + */ + 'guide-title'?: MarkConfig; + /** + * Default style for axis, legend, and header labels. + */ + 'guide-label'?: MarkConfig; + /** + * Default style for chart titles + */ + 'group-title'?: MarkConfig; + /** + * Default style for chart subtitles + */ + 'group-subtitle'?: MarkConfig; +}; +export interface Config extends TopLevelProperties, VLOnlyConfig, MarkConfigMixins, CompositeMarkConfigMixins, AxisConfigMixins, HeaderConfigMixins, CompositionConfigMixins { + /** + * An object hash that defines default range arrays or schemes for using with scales. + * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config). + */ + range?: RangeConfig; + /** + * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config). + */ + legend?: LegendConfig; + /** + * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config). + */ + title?: TitleConfig; + /** + * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config). + */ + projection?: ProjectionConfig; + /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */ + style?: StyleConfigIndex; + /** + * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid. + */ + lineBreak?: string | ES; + /** + * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `"aria-hidden"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks. + * + * __Default value:__ `true`. + */ + aria?: boolean; + /** + * Locale definitions for string parsing and formatting of number and date values. The locale object should contain `number` and/or `time` properties with [locale definitions](https://vega.github.io/vega/docs/api/locale/). Locale definitions provided in the config block may be overridden by the View constructor locale option. + */ + locale?: Locale; + /** + * @hidden + */ + signals?: (InitSignal | NewSignal)[]; +} +export declare const defaultConfig: Config; +export declare const DEFAULT_FONT_SIZE: { + text: number; + guideLabel: number; + guideTitle: number; + groupTitle: number; + groupSubtitle: number; +}; +export declare const DEFAULT_COLOR: { + blue: string; + orange: string; + red: string; + teal: string; + green: string; + yellow: string; + purple: string; + pink: string; + brown: string; + gray0: string; + gray1: string; + gray2: string; + gray3: string; + gray4: string; + gray5: string; + gray6: string; + gray7: string; + gray8: string; + gray9: string; + gray10: string; + gray11: string; + gray12: string; + gray13: string; + gray14: string; + gray15: string; +}; +export declare function colorSignalConfig(color?: boolean | ColorConfig): Config; +export declare function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config; +export declare function fontConfig(font: string): Config; +/** + * Merge specified config with default config and config for the `color` flag, + * then replace all expressions with signals + */ +export declare function initConfig(specifiedConfig?: Config): Config; +export declare function stripAndRedirectConfig(config: Config): Config; +//# sourceMappingURL=config.d.ts.map \ No newline at end of file diff --git a/build/src/config.d.ts.map b/build/src/config.d.ts.map new file mode 100644 index 0000000000..97a6055385 --- /dev/null +++ b/build/src/config.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAc,MAAM,MAAM,CAAC;AAE5G,OAAO,EAAC,IAAI,EAAc,gBAAgB,EAAuC,MAAM,QAAQ,CAAC;AAEhG,OAAO,EAAC,yBAAyB,EAAu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,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAE1B;;OAEG;IACH,KAAK,CAAC,EAAE,WAAW,CAAC,EAAE,CAAC,CAAC;IAExB;;OAEG;IACH,UAAU,CAAC,EAAE,gBAAgB,CAAC;IAE9B,kUAAkU;IAClU,KAAK,CAAC,EAAE,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAE7B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAExB;;;;OAIG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;OAEG;IACH,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,SAAS,CAAC,EAAE,CAAC;CACtC;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,SAAS,CAoE3C,CAAC;AAgBF,eAAO,MAAM,iBAAiB;;;;;;CAM7B,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;CA0BzB,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,KAAK,GAAE,OAAO,GAAG,WAAgB,GAAG,MAAM,CAkD3E;AAED,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,OAAO,GAAG,cAAc,GAAG,MAAM,CA0B/E;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAU/C;AAuCD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,eAAe,GAAE,MAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAgE1E;AA8CD,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,CAAC,SAAS,CAAC,qBAyE/D"} \ No newline at end of file diff --git a/build/src/config.js b/build/src/config.js new file mode 100644 index 0000000000..2752eecd7d --- /dev/null +++ b/build/src/config.js @@ -0,0 +1,459 @@ +import { writeConfig } from 'vega'; +import { isObject, mergeConfig } from 'vega-util'; +import { AXIS_CONFIGS, isConditionalAxisValue } from './axis'; +import { signalOrValueRefWithCondition, signalRefOrValue } from './compile/common'; +import { getAllCompositeMarks } from './compositemark'; +import { replaceExprRef } from './expr'; +import { VL_ONLY_LEGEND_CONFIG } from './guide'; +import { HEADER_CONFIGS } from './header'; +import { defaultLegendConfig } from './legend'; +import * as mark from './mark'; +import { MARK_CONFIGS, PRIMITIVE_MARKS, VL_ONLY_MARK_CONFIG_PROPERTIES, VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX } from './mark'; +import { assembleParameterSignals } from './parameter'; +import { defaultScaleConfig } from './scale'; +import { defaultConfig as defaultSelectionConfig } from './selection'; +import { DEFAULT_SPACING, isStep } from './spec/base'; +import { extractTitleConfig } from './title'; +import { duplicate, getFirstDefined, isEmpty, keys, omit } from './util'; +export function getViewConfigContinuousSize(viewConfig, channel) { + return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility +} +export function getViewConfigDiscreteStep(viewConfig, channel) { + const size = getViewConfigDiscreteSize(viewConfig, channel); + return isStep(size) ? size.step : DEFAULT_STEP; +} +export function getViewConfigDiscreteSize(viewConfig, channel) { + const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility + return getFirstDefined(size, { step: viewConfig.step }); +} +export const DEFAULT_STEP = 20; +export const defaultViewConfig = { + continuousWidth: 200, + continuousHeight: 200, + step: DEFAULT_STEP +}; +export function isVgScheme(rangeScheme) { + return rangeScheme && !!rangeScheme['scheme']; +} +export const defaultConfig = { + background: 'white', + padding: 5, + timeFormat: '%b %d, %Y', + countTitle: 'Count of Records', + view: defaultViewConfig, + mark: mark.defaultMarkConfig, + arc: {}, + area: {}, + bar: mark.defaultBarConfig, + circle: {}, + geoshape: {}, + image: {}, + line: {}, + point: {}, + rect: mark.defaultRectConfig, + rule: { color: 'black' }, + square: {}, + text: { color: 'black' }, + tick: mark.defaultTickConfig, + trail: {}, + boxplot: { + size: 14, + extent: 1.5, + box: {}, + median: { color: 'white' }, + outliers: {}, + rule: {}, + ticks: null + }, + errorbar: { + center: 'mean', + rule: true, + ticks: false + }, + errorband: { + band: { + opacity: 0.3 + }, + borders: false + }, + scale: defaultScaleConfig, + projection: {}, + legend: defaultLegendConfig, + header: { titlePadding: 10, labelPadding: 10 }, + headerColumn: {}, + headerRow: {}, + headerFacet: {}, + selection: defaultSelectionConfig, + style: {}, + title: {}, + facet: { spacing: DEFAULT_SPACING }, + concat: { spacing: DEFAULT_SPACING }, + normalizedNumberFormat: '.0%' +}; +// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` +const tab10 = [ + '#4c78a8', + '#f58518', + '#e45756', + '#72b7b2', + '#54a24b', + '#eeca3b', + '#b279a2', + '#ff9da6', + '#9d755d', + '#bab0ac' +]; +export const DEFAULT_FONT_SIZE = { + text: 11, + guideLabel: 10, + guideTitle: 11, + groupTitle: 13, + groupSubtitle: 12 +}; +export const DEFAULT_COLOR = { + blue: tab10[0], + orange: tab10[1], + red: tab10[2], + teal: tab10[3], + green: tab10[4], + yellow: tab10[5], + purple: tab10[6], + pink: tab10[7], + brown: tab10[8], + gray0: '#000', + gray1: '#111', + gray2: '#222', + gray3: '#333', + gray4: '#444', + gray5: '#555', + gray6: '#666', + gray7: '#777', + gray8: '#888', + gray9: '#999', + gray10: '#aaa', + gray11: '#bbb', + gray12: '#ccc', + gray13: '#ddd', + gray14: '#eee', + gray15: '#fff' +}; +export function colorSignalConfig(color = {}) { + return { + signals: [ + { + name: 'color', + value: isObject(color) ? { ...DEFAULT_COLOR, ...color } : DEFAULT_COLOR + } + ], + mark: { color: { signal: 'color.blue' } }, + rule: { color: { signal: 'color.gray0' } }, + text: { + color: { signal: 'color.gray0' } + }, + style: { + 'guide-label': { + fill: { signal: 'color.gray0' } + }, + 'guide-title': { + fill: { signal: 'color.gray0' } + }, + 'group-title': { + fill: { signal: 'color.gray0' } + }, + 'group-subtitle': { + fill: { signal: 'color.gray0' } + }, + cell: { + stroke: { signal: 'color.gray8' } + } + }, + axis: { + domainColor: { signal: 'color.gray13' }, + gridColor: { signal: 'color.gray8' }, + tickColor: { signal: 'color.gray13' } + }, + range: { + category: [ + { signal: 'color.blue' }, + { signal: 'color.orange' }, + { signal: 'color.red' }, + { signal: 'color.teal' }, + { signal: 'color.green' }, + { signal: 'color.yellow' }, + { signal: 'color.purple' }, + { signal: 'color.pink' }, + { signal: 'color.brown' }, + { signal: 'color.grey8' } + ] + } + }; +} +export function fontSizeSignalConfig(fontSize) { + return { + signals: [ + { + name: 'fontSize', + value: isObject(fontSize) ? { ...DEFAULT_FONT_SIZE, ...fontSize } : DEFAULT_FONT_SIZE + } + ], + text: { + fontSize: { signal: 'fontSize.text' } + }, + style: { + 'guide-label': { + fontSize: { signal: 'fontSize.guideLabel' } + }, + 'guide-title': { + fontSize: { signal: 'fontSize.guideTitle' } + }, + 'group-title': { + fontSize: { signal: 'fontSize.groupTitle' } + }, + 'group-subtitle': { + fontSize: { signal: 'fontSize.groupSubtitle' } + } + } + }; +} +export function fontConfig(font) { + return { + text: { font }, + style: { + 'guide-label': { font }, + 'guide-title': { font }, + 'group-title': { font }, + 'group-subtitle': { font } + } + }; +} +function getAxisConfigInternal(axisConfig) { + const props = keys(axisConfig || {}); + const axisConfigInternal = {}; + for (const prop of props) { + const val = axisConfig[prop]; + axisConfigInternal[prop] = isConditionalAxisValue(val) + ? signalOrValueRefWithCondition(val) + : signalRefOrValue(val); + } + return axisConfigInternal; +} +function getStyleConfigInternal(styleConfig) { + const props = keys(styleConfig); + const styleConfigInternal = {}; + for (const prop of props) { + // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config + styleConfigInternal[prop] = getAxisConfigInternal(styleConfig[prop]); + } + return styleConfigInternal; +} +const configPropsWithExpr = [ + ...MARK_CONFIGS, + ...AXIS_CONFIGS, + ...HEADER_CONFIGS, + 'background', + 'padding', + 'legend', + 'lineBreak', + 'scale', + 'style', + 'title', + 'view' +]; +/** + * Merge specified config with default config and config for the `color` flag, + * then replace all expressions with signals + */ +export function initConfig(specifiedConfig = {}) { + const { color, font, fontSize, selection, ...restConfig } = specifiedConfig; + const mergedConfig = mergeConfig({}, duplicate(defaultConfig), font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {}); + // mergeConfig doesn't recurse and overrides object values. + if (selection) { + writeConfig(mergedConfig, 'selection', selection, true); + } + const outputConfig = omit(mergedConfig, configPropsWithExpr); + for (const prop of ['background', 'lineBreak', 'padding']) { + if (mergedConfig[prop]) { + outputConfig[prop] = signalRefOrValue(mergedConfig[prop]); + } + } + for (const markConfigType of mark.MARK_CONFIGS) { + if (mergedConfig[markConfigType]) { + // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep + outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]); + } + } + for (const axisConfigType of AXIS_CONFIGS) { + if (mergedConfig[axisConfigType]) { + outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]); + } + } + for (const headerConfigType of HEADER_CONFIGS) { + if (mergedConfig[headerConfigType]) { + outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]); + } + } + if (mergedConfig.legend) { + outputConfig.legend = replaceExprRef(mergedConfig.legend); + } + if (mergedConfig.scale) { + outputConfig.scale = replaceExprRef(mergedConfig.scale); + } + if (mergedConfig.style) { + outputConfig.style = getStyleConfigInternal(mergedConfig.style); + } + if (mergedConfig.title) { + outputConfig.title = replaceExprRef(mergedConfig.title); + } + if (mergedConfig.view) { + outputConfig.view = replaceExprRef(mergedConfig.view); + } + return outputConfig; +} +const MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]); +const VL_ONLY_CONFIG_PROPERTIES = [ + 'color', + 'fontSize', + 'background', + 'padding', + 'facet', + 'concat', + 'numberFormat', + 'numberFormatType', + 'normalizedNumberFormat', + 'normalizedNumberFormatType', + 'timeFormat', + 'countTitle', + 'header', + 'axisQuantitative', + 'axisTemporal', + 'axisDiscrete', + 'axisPoint', + 'axisXBand', + 'axisXPoint', + 'axisXDiscrete', + 'axisXQuantitative', + 'axisXTemporal', + 'axisYBand', + 'axisYPoint', + 'axisYDiscrete', + 'axisYQuantitative', + 'axisYTemporal', + 'scale', + 'selection', + 'overlay' // FIXME: Redesign and unhide this +]; +const VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { + view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'], + ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX +}; +export function stripAndRedirectConfig(config) { + config = duplicate(config); + for (const prop of VL_ONLY_CONFIG_PROPERTIES) { + delete config[prop]; + } + if (config.axis) { + // delete condition axis config + for (const prop in config.axis) { + if (isConditionalAxisValue(config.axis[prop])) { + delete config.axis[prop]; + } + } + } + if (config.legend) { + for (const prop of VL_ONLY_LEGEND_CONFIG) { + delete config.legend[prop]; + } + } + // Remove Vega-Lite only generic mark config + if (config.mark) { + for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { + delete config.mark[prop]; + } + if (config.mark.tooltip && isObject(config.mark.tooltip)) { + delete config.mark.tooltip; + } + } + if (config.params) { + config.signals = (config.signals || []).concat(assembleParameterSignals(config.params)); + delete config.params; + } + for (const markType of MARK_STYLES) { + // Remove Vega-Lite-only mark config + for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { + delete config[markType][prop]; + } + // Remove Vega-Lite only mark-specific config + const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; + if (vlOnlyMarkSpecificConfigs) { + for (const prop of vlOnlyMarkSpecificConfigs) { + delete config[markType][prop]; + } + } + // Redirect mark config to config.style so that mark config only affect its own mark type + // without affecting other marks that share the same underlying Vega marks. + // For example, config.rect should not affect bar marks. + redirectConfigToStyleConfig(config, markType); + } + for (const m of getAllCompositeMarks()) { + // Clean up the composite mark config as we don't need them in the output specs anymore + delete config[m]; + } + redirectTitleConfig(config); + // Remove empty config objects. + for (const prop in config) { + if (isObject(config[prop]) && isEmpty(config[prop])) { + delete config[prop]; + } + } + return isEmpty(config) ? undefined : config; +} +/** + * + * Redirect config.title -- so that title config do not affect header labels, + * which also uses `title` directive to implement. + * + * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. + */ +function redirectTitleConfig(config) { + const { titleMarkConfig, subtitleMarkConfig, subtitle } = extractTitleConfig(config.title); + // set config.style if title/subtitleMarkConfig is not an empty object + if (!isEmpty(titleMarkConfig)) { + config.style['group-title'] = { + ...config.style['group-title'], + ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega + }; + } + if (!isEmpty(subtitleMarkConfig)) { + config.style['group-subtitle'] = { + ...config.style['group-subtitle'], + ...subtitleMarkConfig + }; + } + // subtitle part can stay in config.title since header titles do not use subtitle + if (!isEmpty(subtitle)) { + config.title = subtitle; + } + else { + delete config.title; + } +} +function redirectConfigToStyleConfig(config, prop, // string = composite mark +toProp, compositeMarkPart) { + const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; + if (prop === 'view') { + toProp = 'cell'; // View's default style is "cell" + } + const style = { + ...propConfig, + ...config.style[toProp ?? prop] + }; + // set config.style if it is not an empty object + if (!isEmpty(style)) { + config.style[toProp ?? prop] = style; + } + if (!compositeMarkPart) { + // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. + delete config[prop]; + } +} +//# sourceMappingURL=config.js.map \ No newline at end of file diff --git a/build/src/config.js.map b/build/src/config.js.map new file mode 100644 index 0000000000..37c9e252f6 --- /dev/null +++ b/build/src/config.js.map @@ -0,0 +1 @@ +{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4E,WAAW,EAAC,MAAM,MAAM,CAAC;AAC5G,OAAO,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E,0BAA0B;AACxD,MAAe,EACf,iBAA0B;IAE1B,MAAM,UAAU,GAA0B,iBAAiB,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAE7G,IAAI,IAAI,KAAK,MAAM,EAAE;QACnB,MAAM,GAAG,MAAM,CAAC,CAAC,iCAAiC;KACnD;IAED,MAAM,KAAK,GAA0B;QACnC,GAAG,UAAU;QACb,GAAI,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAA2B;KAC3D,CAAC;IAEF,gDAAgD;IAChD,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACnB,MAAM,CAAC,KAAK,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,KAAK,CAAC;KACtC;IAED,IAAI,CAAC,iBAAiB,EAAE;QACtB,mGAAmG;QACnG,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;KACrB;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/data.d.ts b/build/src/data.d.ts new file mode 100644 index 0000000000..60eb1b1539 --- /dev/null +++ b/build/src/data.d.ts @@ -0,0 +1,200 @@ +import { Vector2 } from 'vega'; +import { FieldName } from './channeldef'; +import { VgData } from './vega.schema'; +export type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number'; +export interface Parse { + [field: string]: ParseValue; +} +export interface DataFormatBase { + /** + * If set to `null`, disable type inference based on the spec and only use type inference based on the data. + * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `"number"`, `"boolean"`, `"date"`, or null (do not parse the field)). + * For example, `"parse": {"modified_on": "date"}` parses the `modified_on` field in each input record a Date value. + * + * For `"date"`, we parse data based using JavaScript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse). + * For Specific date formats can be provided (e.g., `{foo: "date:'%m%d%Y'"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: "utc:'%m%d%Y'"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc) + */ + parse?: Parse | null; + /** + * Type of input data: `"json"`, `"csv"`, `"tsv"`, `"dsv"`. + * + * __Default value:__ The default format type is determined by the extension of the file URL. + * If no extension is detected, `"json"` will be used by default. + */ + type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson'; +} +export interface CsvDataFormat extends DataFormatBase { + type?: 'csv' | 'tsv'; +} +export interface DsvDataFormat extends DataFormatBase { + type?: 'dsv'; + /** + * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not. + * + * @minLength 1 + * @maxLength 1 + */ + delimiter: string; +} +export interface JsonDataFormat extends DataFormatBase { + type?: 'json'; + /** + * The JSON property containing the desired data. + * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data. + * For example `"property": "values.features"` is equivalent to retrieving `json.values.features` + * from the loaded JSON object. + */ + property?: string; +} +export interface TopoDataFormat extends DataFormatBase { + type?: 'topojson'; + /** + * The name of the TopoJSON object set to convert to a GeoJSON feature collection. + * For example, in a map of the world, there may be an object set named `"countries"`. + * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country. + */ + feature?: string; + /** + * The name of the TopoJSON object set to convert to mesh. + * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set. + * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features. + * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties. + */ + mesh?: string; +} +export type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat; +export type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson'; +export type DataSource = UrlData | InlineData | NamedData; +export type Data = DataSource | Generator; +export type InlineDataset = number[] | string[] | boolean[] | object[] | string | object; +export interface DataBase { + /** + * An object that specifies the format for parsing the data. + */ + format?: DataFormat; + /** + * Provide a placeholder name and bind data at runtime. + */ + name?: string; +} +export interface UrlData extends DataBase { + /** + * An URL from which to load the data set. Use the `format.type` property + * to ensure the loaded data is correctly parsed. + */ + url: string; +} +export interface InlineData extends DataBase { + /** + * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string. + * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type. + */ + values: InlineDataset; +} +export interface NamedData extends DataBase { + /** + * Provide a placeholder name and bind data at runtime. + * + * New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set [autosize](https://vega.github.io/vega-lite/docs/size.html#autosize) or explicitly use [view.resize](https://vega.github.io/vega/docs/api/view/#view_resize). + */ + name: string; +} +export declare function isUrlData(data: Partial | Partial): data is UrlData; +export declare function isInlineData(data: Partial | Partial): data is InlineData; +export declare function isNamedData(data: Partial | Partial): data is NamedData; +export declare function isGenerator(data: Partial | Partial): data is Generator; +export declare function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator; +export declare function isSphereGenerator(data: Partial | Partial): data is SphereGenerator; +export declare function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator; +export declare enum DataSourceType { + Raw = 0, + Main = 1, + Row = 2, + Column = 3, + Lookup = 4 +} +export type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator; +export interface GeneratorBase { + /** + * Provide a placeholder name and bind data at runtime. + */ + name?: string; +} +export interface SequenceGenerator extends GeneratorBase { + /** + * Generate a sequence of numbers. + */ + sequence: SequenceParams; +} +export interface SequenceParams { + /** + * The starting value of the sequence (inclusive). + */ + start: number; + /** + * The ending value of the sequence (exclusive). + */ + stop: number; + /** + * The step value between sequence entries. + * + * __Default value:__ `1` + */ + step?: number; + /** + * The name of the generated sequence field. + * + * __Default value:__ `"data"` + */ + as?: FieldName; +} +export interface SphereGenerator extends GeneratorBase { + /** + * Generate sphere GeoJSON data for the full globe. + */ + sphere: true | {}; +} +export interface GraticuleGenerator extends GeneratorBase { + /** + * Generate graticule GeoJSON data for geographic reference lines. + */ + graticule: true | GraticuleParams; +} +export interface GraticuleParams { + /** + * The major extent of the graticule as a two-element array of coordinates. + */ + extentMajor?: Vector2>; + /** + * The minor extent of the graticule as a two-element array of coordinates. + */ + extentMinor?: Vector2>; + /** + * Sets both the major and minor extents to the same values. + */ + extent?: Vector2>; + /** + * The major step angles of the graticule. + * + * + * __Default value:__ `[90, 360]` + */ + stepMajor?: Vector2; + /** + * The minor step angles of the graticule. + * + * __Default value:__ `[10, 10]` + */ + stepMinor?: Vector2; + /** + * Sets both the major and minor step angles to the same values. + */ + step?: Vector2; + /** + * The precision of the graticule in degrees. + * + * __Default value:__ `2.5` + */ + precision?: number; +} +//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/build/src/data.d.ts.map b/build/src/data.d.ts.map new file mode 100644 index 0000000000..fce10be3a1 --- /dev/null +++ b/build/src/data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AAErC,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElF,MAAM,WAAW,KAAK;IACpB,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAAC;CAC7B;AAED,MAAM,WAAW,cAAc;IAC7B;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC;IAErB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,UAAU,CAAC;CACpD;AAED,MAAM,WAAW,aAAc,SAAQ,cAAc;I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tD;;OAEG;IACH,QAAQ,EAAE,cAAc,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;;OAIG;IACH,EAAE,CAAC,EAAE,SAAS,CAAC;CAChB;AAED,MAAM,WAAW,eAAgB,SAAQ,aAAa;IACpD;;OAEG;IAEH,MAAM,EAAE,IAAI,GAAG,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,eAAe,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAEvC;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;IAElC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAE5B;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB"} \ No newline at end of file diff --git a/build/src/data.js b/build/src/data.js new file mode 100644 index 0000000000..c3845b6ff3 --- /dev/null +++ b/build/src/data.js @@ -0,0 +1,30 @@ +export function isUrlData(data) { + return 'url' in data; +} +export function isInlineData(data) { + return 'values' in data; +} +export function isNamedData(data) { + return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); +} +export function isGenerator(data) { + return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); +} +export function isSequenceGenerator(data) { + return 'sequence' in data; +} +export function isSphereGenerator(data) { + return 'sphere' in data; +} +export function isGraticuleGenerator(data) { + return 'graticule' in data; +} +export var DataSourceType; +(function (DataSourceType) { + DataSourceType[DataSourceType["Raw"] = 0] = "Raw"; + DataSourceType[DataSourceType["Main"] = 1] = "Main"; + DataSourceType[DataSourceType["Row"] = 2] = "Row"; + DataSourceType[DataSourceType["Column"] = 3] = "Column"; + DataSourceType[DataSourceType["Lookup"] = 4] = "Lookup"; +})(DataSourceType || (DataSourceType = {})); +//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/build/src/data.js.map b/build/src/data.js.map new file mode 100644 index 0000000000..eed580d2bf --- /dev/null +++ b/build/src/data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.js","sourceRoot":"","sources":["../../src/data.ts"],"names":[],"mappings":"AA4HA,MAAM,UAAU,SAAS,CAAC,IAAqC;IAC7D,OAAO,KAAK,IAAI,IAAI,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAqC;IAChE,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAqC;IAC/D,OAAO,MAAM,IAAI,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;AACzF,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,IAAqC;IAC/D,OAAO,IAAI,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,IAAI,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC;AACtG,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,IAAqC;IACvE,OAAO,UAAU,IAAI,IAAI,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAqC;IACrE,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,IAAqC;IACxE,OAAO,WAAW,IAAI,IAAI,CAAC;AAC7B,CAAC;AAED,MAAM,CAAN,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,iDAAG,CAAA;IACH,mDAAI,CAAA;IACJ,iDAAG,CAAA;IACH,uDAAM,CAAA;IACN,uDAAM,CAAA;AACR,CAAC,EANW,cAAc,KAAd,cAAc,QAMzB"} \ No newline at end of file diff --git a/build/src/datetime.d.ts b/build/src/datetime.d.ts new file mode 100644 index 0000000000..3677a5ed53 --- /dev/null +++ b/build/src/datetime.d.ts @@ -0,0 +1,129 @@ +/** + * @minimum 1 + * @maximum 12 + * @TJS-type integer + */ +export type Month = number; +/** + * @minimum 1 + * @maximum 7 + */ +export type Day = number; +/** + * Object for defining datetime in Vega-Lite Filter. + * If both month and quarter are provided, month has higher precedence. + * `day` cannot be combined with other date. + * We accept string for month and day names. + */ +export interface DateTime { + /** + * Integer value representing the year. + * @TJS-type integer + */ + year?: number; + /** + * Integer value representing the quarter of the year (from 1-4). + * @minimum 1 + * @maximum 4 + * @TJS-type integer + */ + quarter?: number; + /** + * One of: + * (1) integer value representing the month from `1`-`12`. `1` represents January; + * (2) case-insensitive month name (e.g., `"January"`); + * (3) case-insensitive, 3-character short month name (e.g., `"Jan"`). + */ + month?: Month | string; + /** + * Integer value representing the date (day of the month) from 1-31. + * @minimum 1 + * @maximum 31 + * @TJS-type integer + */ + date?: number; + /** + * Value representing the day of a week. This can be one of: + * (1) integer value -- `1` represents Monday; + * (2) case-insensitive day name (e.g., `"Monday"`); + * (3) case-insensitive, 3-character short day name (e.g., `"Mon"`). + * + * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`. + */ + day?: Day | string; + /** + * Integer value representing the hour of a day from 0-23. + * @minimum 0 + * @maximum 24 + * @TJS-type integer + */ + hours?: number; + /** + * Integer value representing the minute segment of time from 0-59. + * @minimum 0 + * @maximum 60 + * @TJS-type integer + */ + minutes?: number; + /** + * Integer value representing the second segment (0-59) of a time value + * @minimum 0 + * @maximum 60 + * @TJS-type integer + */ + seconds?: number; + /** + * Integer value representing the millisecond segment of time. + * @minimum 0 + * @maximum 1000 + * @TJS-type integer + */ + milliseconds?: number; + /** + * A boolean flag indicating if date time is in utc time. If false, the date time is in local time + */ + utc?: boolean; +} +/** + * Internal Object for defining datetime expressions. + * This is an expression version of DateTime. + * If both month and quarter are provided, month has higher precedence. + * `day` cannot be combined with other date. + */ +export interface DateTimeExpr { + year?: string; + quarter?: string; + month?: string; + date?: string; + day?: string; + hours?: string; + minutes?: string; + seconds?: string; + milliseconds?: string; + utc?: boolean; +} +export declare function isDateTime(o: any): o is DateTime; +export declare const MONTHS: string[]; +export declare const SHORT_MONTHS: string[]; +export declare const DAYS: string[]; +export declare const SHORT_DAYS: string[]; +/** + * Return Vega expression for a date time. + * + * @param d the date time. + * @returns the Vega expression. + */ +export declare function dateTimeToExpr(d: DateTime): string; +/** + * Return Vega expression for a date time expression. + * + * @param d the internal date time object with expression. + * @returns the Vega expression. + */ +export declare function dateTimeExprToExpr(d: DateTimeExpr): string; +/** + * @param d the date time. + * @returns the timestamp. + */ +export declare function dateTimeToTimestamp(d: DateTime): number; +//# sourceMappingURL=datetime.d.ts.map \ No newline at end of file diff --git a/build/src/datetime.d.ts.map b/build/src/datetime.d.ts.map new file mode 100644 index 0000000000..223c8165f0 --- /dev/null +++ b/build/src/datetime.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"datetime.d.ts","sourceRoot":"","sources":["../../src/datetime.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC;AAEzB;;;;;GAKG;AACH,MAAM,WAAW,QAAQ;IAC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UAUzC;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,YAAY,UAUjD;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,QAAQ,UAQ9C"} \ No newline at end of file diff --git a/build/src/datetime.js b/build/src/datetime.js new file mode 100644 index 0000000000..4104364150 --- /dev/null +++ b/build/src/datetime.js @@ -0,0 +1,194 @@ +// DateTime definition object +import { isNumber, isObject } from 'vega-util'; +import * as log from './log'; +import { TIMEUNIT_PARTS } from './timeunit'; +import { duplicate, isNumeric, keys } from './util'; +export function isDateTime(o) { + if (o && isObject(o)) { + for (const part of TIMEUNIT_PARTS) { + if (part in o) { + return true; + } + } + } + return false; +} +export const MONTHS = [ + 'january', + 'february', + 'march', + 'april', + 'may', + 'june', + 'july', + 'august', + 'september', + 'october', + 'november', + 'december' +]; +export const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3)); +export const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; +export const SHORT_DAYS = DAYS.map(d => d.substr(0, 3)); +function normalizeQuarter(q) { + if (isNumeric(q)) { + q = +q; + } + if (isNumber(q)) { + if (q > 4) { + log.warn(log.message.invalidTimeUnit('quarter', q)); + } + // We accept 1-based quarter, so need to readjust to 0-based quarter + return q - 1; + } + else { + // Invalid quarter + throw new Error(log.message.invalidTimeUnit('quarter', q)); + } +} +function normalizeMonth(m) { + if (isNumeric(m)) { + m = +m; + } + if (isNumber(m)) { + // We accept 1-based month, so need to readjust to 0-based month + return m - 1; + } + else { + const lowerM = m.toLowerCase(); + const monthIndex = MONTHS.indexOf(lowerM); + if (monthIndex !== -1) { + return monthIndex; // 0 for january, ... + } + const shortM = lowerM.substr(0, 3); + const shortMonthIndex = SHORT_MONTHS.indexOf(shortM); + if (shortMonthIndex !== -1) { + return shortMonthIndex; + } + // Invalid month + throw new Error(log.message.invalidTimeUnit('month', m)); + } +} +function normalizeDay(d) { + if (isNumeric(d)) { + d = +d; + } + if (isNumber(d)) { + // mod so that this can be both 0-based where 0 = sunday + // and 1-based where 7=sunday + return d % 7; + } + else { + const lowerD = d.toLowerCase(); + const dayIndex = DAYS.indexOf(lowerD); + if (dayIndex !== -1) { + return dayIndex; // 0 for january, ... + } + const shortD = lowerD.substr(0, 3); + const shortDayIndex = SHORT_DAYS.indexOf(shortD); + if (shortDayIndex !== -1) { + return shortDayIndex; + } + // Invalid day + throw new Error(log.message.invalidTimeUnit('day', d)); + } +} +/** + * @param d the date. + * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. + * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] + */ +function dateTimeParts(d, normalize) { + const parts = []; + if (normalize && d.day !== undefined) { + if (keys(d).length > 1) { + log.warn(log.message.droppedDay(d)); + d = duplicate(d); + delete d.day; + } + } + if (d.year !== undefined) { + parts.push(d.year); + } + else { + // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega + // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). + parts.push(2012); + } + if (d.month !== undefined) { + const month = normalize ? normalizeMonth(d.month) : d.month; + parts.push(month); + } + else if (d.quarter !== undefined) { + const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; + parts.push(isNumber(quarter) ? quarter * 3 : `${quarter}*3`); + } + else { + parts.push(0); // months start at zero in JS + } + if (d.date !== undefined) { + parts.push(d.date); + } + else if (d.day !== undefined) { + // HACK: Day only works as a standalone unit + // This is only correct because we always set year to 2006 for day + const day = normalize ? normalizeDay(d.day) : d.day; + parts.push(isNumber(day) ? day + 1 : `${day}+1`); + } + else { + parts.push(1); // Date starts at 1 in JS + } + // Note: can't use TimeUnit enum here as importing it will create + // circular dependency problem! + for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) { + const unit = d[timeUnit]; + parts.push(typeof unit === 'undefined' ? 0 : unit); + } + return parts; +} +/** + * Return Vega expression for a date time. + * + * @param d the date time. + * @returns the Vega expression. + */ +export function dateTimeToExpr(d) { + const parts = dateTimeParts(d, true); + const string = parts.join(', '); + if (d.utc) { + return `utc(${string})`; + } + else { + return `datetime(${string})`; + } +} +/** + * Return Vega expression for a date time expression. + * + * @param d the internal date time object with expression. + * @returns the Vega expression. + */ +export function dateTimeExprToExpr(d) { + const parts = dateTimeParts(d, false); + const string = parts.join(', '); + if (d.utc) { + return `utc(${string})`; + } + else { + return `datetime(${string})`; + } +} +/** + * @param d the date time. + * @returns the timestamp. + */ +export function dateTimeToTimestamp(d) { + const parts = dateTimeParts(d, true); + if (d.utc) { + return +new Date(Date.UTC(...parts)); + } + else { + return +new Date(...parts); + } +} +//# sourceMappingURL=datetime.js.map \ No newline at end of file diff --git a/build/src/datetime.js.map b/build/src/datetime.js.map new file mode 100644 index 0000000000..9117b5d37b --- /dev/null +++ b/build/src/datetime.js.map @@ -0,0 +1 @@ +{"version":3,"file":"datetime.js","sourceRoot":"","sources":["../../src/datetime.ts"],"names":[],"mappings":"AAAA,6BAA6B;AAE7B,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAC,cAAc,EAAC,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAC,SAAS,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,QAAQ,CAAC;AAuHlD,MAAM,UAAU,UAAU,CAAC,CAAM;IAC/B,IAAI,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;QACpB,KAAK,MAAM,IAAI,IAAI,cAAc,EAAE;YACjC,IAAI,IAAI,IAAI,CAAC,EAAE;gBACb,OAAO,IAAI,CAAC;aACb;SACF;KACF;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,SAAS;IACT,UAAU;IACV,OAAO;IACP,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAA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AAO,YAAY,MAAM,GAAG,CAAC;KAC9B;AACH,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,CAAe;IAChD,MAAM,KAAK,GAAwB,aAAa,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAE3D,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAEhC,IAAI,CAAC,CAAC,GAAG,EAAE;QACT,OAAO,OAAO,MAAM,GAAG,CAAC;KACzB;SAAM;QACL,OAAO,YAAY,MAAM,GAAG,CAAC;KAC9B;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,CAAW;IAC7C,MAAM,KAAK,GAAwB,aAAa,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IAE1D,IAAI,CAAC,CAAC,GAAG,EAAE;QACT,OAAO,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAI,KAAoB,CAAC,CAAC,CAAC;KACtD;SAAM;QACL,OAAO,CAAC,IAAI,IAAI,CAAC,GAAI,KAAe,CAAC,CAAC;KACvC;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/encoding.d.ts b/build/src/encoding.d.ts new file mode 100644 index 0000000000..86f183d082 --- /dev/null +++ b/build/src/encoding.d.ts @@ -0,0 +1,223 @@ +import { Channel } from './channel'; +import { ChannelDef, ColorDef, Field, FieldDef, FieldDefWithoutScale, LatLongDef, NumericArrayMarkPropDef, NumericMarkPropDef, OffsetDef, OrderFieldDef, OrderOnlyDef, OrderValueDef, PolarDef, Position2Def, PositionDef, ShapeDef, StringFieldDef, StringFieldDefWithCondition, StringValueDefWithCondition, TextDef, TypedFieldDef } from './channeldef'; +import { Config } from './config'; +import { Mark } from './mark'; +import { EncodingFacetMapping } from './spec/facet'; +import { AggregatedFieldDef, BinTransform, TimeUnitTransform } from './transform'; +export interface Encoding { + /** + * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. + * + * The `value` of this channel can be a number or a string `"width"` for the width of the plot. + */ + x?: PositionDef; + /** + * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. + * + * The `value` of this channel can be a number or a string `"height"` for the height of the plot. + */ + y?: PositionDef; + /** + * Offset of x-position of the marks + */ + xOffset?: OffsetDef; + /** + * Offset of y-position of the marks + */ + yOffset?: OffsetDef; + /** + * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + * + * The `value` of this channel can be a number or a string `"width"` for the width of the plot. + */ + x2?: Position2Def; + /** + * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + * + * The `value` of this channel can be a number or a string `"height"` for the height of the plot. + */ + y2?: Position2Def; + /** + * Longitude position of geographically projected marks. + */ + longitude?: LatLongDef; + /** + * Latitude position of geographically projected marks. + */ + latitude?: LatLongDef; + /** + * Longitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + */ + longitude2?: Position2Def; + /** + * Latitude-2 position for geographically projected ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + */ + latitude2?: Position2Def; + /** + * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) + * + * - For text marks, polar coordinate angle in radians. + */ + theta?: PolarDef; + /** + * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. + */ + theta2?: Position2Def; + /** + * The outer radius in pixels of arc marks. + */ + radius?: PolarDef; + /** + * The inner radius in pixels of arc marks. + */ + radius2?: Position2Def; + /** + * Color of the marks – either fill or stroke color based on the `filled` property of mark definition. + * By default, `color` represents fill color for `"area"`, `"bar"`, `"tick"`, + * `"text"`, `"trail"`, `"circle"`, and `"square"` / stroke color for `"line"` and `"point"`. + * + * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. + * + * _Note:_ + * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. + * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme). + */ + color?: ColorDef; + /** + * Fill color of the marks. + * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. + * + * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. + */ + fill?: ColorDef; + /** + * Stroke color of the marks. + * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property. + * + * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified. + */ + stroke?: ColorDef; + /** + * Opacity of the marks. + * + * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property. + */ + opacity?: NumericMarkPropDef; + /** + * Fill opacity of the marks. + * + * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property. + */ + fillOpacity?: NumericMarkPropDef; + /** + * Stroke opacity of the marks. + * + * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property. + */ + strokeOpacity?: NumericMarkPropDef; + /** + * Stroke width of the marks. + * + * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property. + */ + strokeWidth?: NumericMarkPropDef; + /** + * Stroke dash of the marks. + * + * __Default value:__ `[1,0]` (No dash). + */ + strokeDash?: NumericArrayMarkPropDef; + /** + * Size of the mark. + * - For `"point"`, `"square"` and `"circle"`, – the symbol size, or pixel area of the mark. + * - For `"bar"` and `"tick"` – the bar and tick's size. + * - For `"text"` – the text's font size. + * - Size is unsupported for `"line"`, `"area"`, and `"rect"`. (Use `"trail"` instead of line with varying size) + */ + size?: NumericMarkPropDef; + /** + * Rotation angle of point and text marks. + */ + angle?: NumericMarkPropDef; + /** + * Shape of the mark. + * + * 1. For `point` marks the supported values include: + * - plotting shapes: `"circle"`, `"square"`, `"cross"`, `"diamond"`, `"triangle-up"`, `"triangle-down"`, `"triangle-right"`, or `"triangle-left"`. + * - the line symbol `"stroke"` + * - centered directional shapes `"arrow"`, `"wedge"`, or `"triangle"` + * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.) + * + * 2. For `geoshape` marks it should be a field definition of the geojson data + * + * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`"circle"` if unset.) + */ + shape?: ShapeDef; + /** + * Additional levels of detail for grouping data in aggregate views and + * in line, trail, and area marks without mapping data to a specific visual channel. + */ + detail?: FieldDefWithoutScale | FieldDefWithoutScale[]; + /** + * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data. + */ + key?: FieldDefWithoutScale; + /** + * Text of the `text` mark. + */ + text?: TextDef; + /** + * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def). + * + * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. + */ + tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null; + /** + * A URL to load upon mouse click. + */ + href?: StringFieldDefWithCondition | StringValueDefWithCondition; + /** + * The URL of an image mark. + */ + url?: StringFieldDefWithCondition | StringValueDefWithCondition; + /** + * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `"aria-label"` attribute will be set to this description. + */ + description?: StringFieldDefWithCondition | StringValueDefWithCondition; + /** + * Order of the marks. + * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order). + * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{"value": null}` makes the line marks use the original order in the data sources. + * - Otherwise, this `order` channel encodes layer order of the marks. + * + * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping. + */ + order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef; +} +export interface EncodingWithFacet extends Encoding, EncodingFacetMapping { +} +export declare function channelHasField(encoding: EncodingWithFacet, channel: keyof EncodingWithFacet): boolean; +export declare function channelHasFieldOrDatum(encoding: EncodingWithFacet, channel: keyof EncodingWithFacet): boolean; +export declare function channelHasNestedOffsetScale(encoding: EncodingWithFacet, channel: keyof EncodingWithFacet): boolean; +export declare function isAggregate(encoding: EncodingWithFacet): boolean; +export declare function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config): { + bins: BinTransform[]; + timeUnits: TimeUnitTransform[]; + aggregate: AggregatedFieldDef[]; + groupby: string[]; + encoding: Encoding; +}; +export declare function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark): boolean; +export declare function initEncoding(encoding: Encoding, mark: Mark, filled: boolean, config: Config): Encoding; +/** + * For composite marks, we have to call initChannelDef during init so we can infer types earlier. + */ +export declare function normalizeEncoding(encoding: Encoding, config: Config): Encoding; +export declare function fieldDefs(encoding: EncodingWithFacet): FieldDef[]; +export declare function forEach>(mapping: U, f: (cd: ChannelDef, c: keyof U) => void, thisArg?: any): void; +export declare function reduce>(mapping: U, f: (acc: any, fd: TypedFieldDef, c: keyof U) => U, init: T, thisArg?: any): any; +/** + * Returns list of path grouping fields for the given encoding + */ +export declare function pathGroupingFields(mark: Mark, encoding: Encoding): string[]; +//# sourceMappingURL=encoding.d.ts.map \ No newline at end of file diff --git a/build/src/encoding.d.ts.map b/build/src/encoding.d.ts.map new file mode 100644 index 0000000000..4444a286bf --- /dev/null +++ b/build/src/encoding.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encoding.d.ts","sourceRoot":"","sources":["../../src/encoding.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,OAAO,EA2CR,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,UAAU,EACV,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,oBAAoB,EAapB,UAAU,EACV,uBAAuB,EACvB,kBAAkB,EAClB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,YAAY,EACZ,WAAW,EAEX,QAAQ,EACR,cAAc,EACd,2BAA2B,EAC3B,2BAA2B,EAC3B,OAAO,EAEP,aAAa,EAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAEhC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,oBAAoB,EAAC,MAAM,cAAc,CAAC;AAClD,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAE,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAMhF,MAAM,WAAW,QAAQ,CAAC,CAAC,SAAS,KAAK;IACvC;;;;OAIG;IACH,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnB;;;;OAIG;IACH,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAEnB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC;IAEvB;;;;OAIG;IAGH,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAErB;;;;OAIG;IAGH,EAAE,CAAC,EAAE,YAAY,CAAC,CAAC,CAAC,CAAC;IAErB;;OAEG;IACH,SAAS,CAAC,EAA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K,IAAI,EACvC,OAAO,CAAC,EAAE,GAAG,QAgBd;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAClD,OAAO,EAAE,CAAC,EACV,CAAC,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,EACzD,IAAI,EAAE,CAAC,EACP,OAAO,CAAC,EAAE,GAAG,OAgBd;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,MAAM,EAAE,CAkFnF"} \ No newline at end of file diff --git a/build/src/encoding.js b/build/src/encoding.js new file mode 100644 index 0000000000..e0fbaac6c3 --- /dev/null +++ b/build/src/encoding.js @@ -0,0 +1,424 @@ +import { array, isArray } from 'vega-util'; +import { isArgmaxDef, isArgminDef } from './aggregate'; +import { isBinned, isBinning } from './bin'; +import { ANGLE, CHANNELS, COLOR, DESCRIPTION, DETAIL, FILL, FILLOPACITY, getMainChannelFromOffsetChannel, getOffsetScaleChannel, HREF, isChannel, isNonPositionScaleChannel, isSecondaryRangeChannel, isXorY, isXorYOffset, KEY, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, OPACITY, ORDER, RADIUS, RADIUS2, SHAPE, SIZE, STROKE, STROKEDASH, STROKEOPACITY, STROKEWIDTH, supportMark, TEXT, THETA, THETA2, TOOLTIP, UNIT_CHANNELS, URL, X, X2, XOFFSET, Y, Y2, YOFFSET } from './channel'; +import { binRequiresRange, getFieldDef, getGuide, hasConditionalFieldDef, hasConditionalFieldOrDatumDef, initChannelDef, initFieldDef, isConditionalDef, isDatumDef, isFieldDef, isOrderOnlyDef, isTypedFieldDef, isValueDef, title, vgField } from './channeldef'; +import * as log from './log'; +import { isContinuous, isDiscrete, QUANTITATIVE, TEMPORAL } from './type'; +import { keys, some } from './util'; +import { isSignalRef } from './vega.schema'; +import { isBinnedTimeUnit } from './timeunit'; +export function channelHasField(encoding, channel) { + const channelDef = encoding && encoding[channel]; + if (channelDef) { + if (isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.field); + } + else { + return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); + } + } + return false; +} +export function channelHasFieldOrDatum(encoding, channel) { + const channelDef = encoding && encoding[channel]; + if (channelDef) { + if (isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.field); + } + else { + return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef); + } + } + return false; +} +export function channelHasNestedOffsetScale(encoding, channel) { + if (isXorY(channel)) { + const fieldDef = encoding[channel]; + if ((isFieldDef(fieldDef) || isDatumDef(fieldDef)) && + (isDiscrete(fieldDef.type) || (isFieldDef(fieldDef) && fieldDef.timeUnit))) { + const offsetChannel = getOffsetScaleChannel(channel); + return channelHasFieldOrDatum(encoding, offsetChannel); + } + } + return false; +} +export function isAggregate(encoding) { + return some(CHANNELS, channel => { + if (channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + if (isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.aggregate); + } + else { + const fieldDef = getFieldDef(channelDef); + return fieldDef && !!fieldDef.aggregate; + } + } + return false; + }); +} +export function extractTransformsFromEncoding(oldEncoding, config) { + const groupby = []; + const bins = []; + const timeUnits = []; + const aggregate = []; + const encoding = {}; + forEach(oldEncoding, (channelDef, channel) => { + // Extract potential embedded transformations along with remaining properties + if (isFieldDef(channelDef)) { + const { field, aggregate: aggOp, bin, timeUnit, ...remaining } = channelDef; + if (aggOp || timeUnit || bin) { + const guide = getGuide(channelDef); + const isTitleDefined = guide?.title; + let newField = vgField(channelDef, { forAs: true }); + const newFieldDef = { + // Only add title if it doesn't exist + ...(isTitleDefined ? [] : { title: title(channelDef, config, { allowDisabling: true }) }), + ...remaining, + // Always overwrite field + field: newField + }; + if (aggOp) { + let op; + if (isArgmaxDef(aggOp)) { + op = 'argmax'; + newField = vgField({ op: 'argmax', field: aggOp.argmax }, { forAs: true }); + newFieldDef.field = `${newField}.${field}`; + } + else if (isArgminDef(aggOp)) { + op = 'argmin'; + newField = vgField({ op: 'argmin', field: aggOp.argmin }, { forAs: true }); + newFieldDef.field = `${newField}.${field}`; + } + else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { + op = aggOp; + } + if (op) { + const aggregateEntry = { + op, + as: newField + }; + if (field) { + aggregateEntry.field = field; + } + aggregate.push(aggregateEntry); + } + } + else { + groupby.push(newField); + if (isTypedFieldDef(channelDef) && isBinning(bin)) { + bins.push({ bin, field, as: newField }); + // Add additional groupbys for range and end of bins + groupby.push(vgField(channelDef, { binSuffix: 'end' })); + if (binRequiresRange(channelDef, channel)) { + groupby.push(vgField(channelDef, { binSuffix: 'range' })); + } + // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively + if (isXorY(channel)) { + const secondaryChannel = { + field: `${newField}_end` + }; + encoding[`${channel}2`] = secondaryChannel; + } + newFieldDef.bin = 'binned'; + if (!isSecondaryRangeChannel(channel)) { + newFieldDef['type'] = QUANTITATIVE; + } + } + else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + timeUnits.push({ + timeUnit, + field, + as: newField + }); + // define the format type for later compilation + const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; + if (formatType) { + if (channel === TEXT || channel === TOOLTIP) { + newFieldDef['formatType'] = formatType; + } + else if (isNonPositionScaleChannel(channel)) { + newFieldDef['legend'] = { + formatType, + ...newFieldDef['legend'] + }; + } + else if (isXorY(channel)) { + newFieldDef['axis'] = { + formatType, + ...newFieldDef['axis'] + }; + } + } + } + } + // now the field should refer to post-transformed field instead + encoding[channel] = newFieldDef; + } + else { + groupby.push(field); + encoding[channel] = oldEncoding[channel]; + } + } + else { + // For value def / signal ref / datum def, just copy + encoding[channel] = oldEncoding[channel]; + } + }); + return { + bins, + timeUnits, + aggregate, + groupby, + encoding + }; +} +export function markChannelCompatible(encoding, channel, mark) { + const markSupported = supportMark(channel, mark); + if (!markSupported) { + return false; + } + else if (markSupported === 'binned') { + const primaryFieldDef = encoding[channel === X2 ? X : Y]; + // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef + // has "binned" data and thus need x2/y2 to specify the bin-end field. + if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { + return true; + } + else { + return false; + } + } + return true; +} +export function initEncoding(encoding, mark, filled, config) { + const normalizedEncoding = {}; + for (const key of keys(encoding)) { + if (!isChannel(key)) { + // Drop invalid channel + log.warn(log.message.invalidEncodingChannel(key)); + } + } + for (let channel of UNIT_CHANNELS) { + if (!encoding[channel]) { + continue; + } + const channelDef = encoding[channel]; + if (isXorYOffset(channel)) { + const mainChannel = getMainChannelFromOffsetChannel(channel); + const positionDef = normalizedEncoding[mainChannel]; + if (isFieldDef(positionDef)) { + if (isContinuous(positionDef.type)) { + if (isFieldDef(channelDef) && !positionDef.timeUnit) { + // TODO: nesting continuous field instead continuous field should + // behave like offsetting the data in data domain + log.warn(log.message.offsetNestedInsideContinuousPositionScaleDropped(mainChannel)); + continue; + } + } + } + } + if (channel === 'angle' && mark === 'arc' && !encoding.theta) { + log.warn(log.message.REPLACE_ANGLE_WITH_THETA); + channel = THETA; + } + if (!markChannelCompatible(encoding, channel, mark)) { + // Drop unsupported channel + log.warn(log.message.incompatibleChannel(channel, mark)); + continue; + } + // Drop line's size if the field is aggregated. + if (channel === SIZE && mark === 'line') { + const fieldDef = getFieldDef(encoding[channel]); + if (fieldDef?.aggregate) { + log.warn(log.message.LINE_WITH_VARYING_SIZE); + continue; + } + } + // Drop color if either fill or stroke is specified + if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { + log.warn(log.message.droppingColor('encoding', { fill: 'fill' in encoding, stroke: 'stroke' in encoding })); + continue; + } + if (channel === DETAIL || + (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) || + (channel === TOOLTIP && isArray(channelDef))) { + if (channelDef) { + if (channel === ORDER) { + const def = encoding[channel]; + if (isOrderOnlyDef(def)) { + normalizedEncoding[channel] = def; + continue; + } + } + // Array of fieldDefs for detail channel (or production rule) + normalizedEncoding[channel] = array(channelDef).reduce((defs, fieldDef) => { + if (!isFieldDef(fieldDef)) { + log.warn(log.message.emptyFieldDef(fieldDef, channel)); + } + else { + defs.push(initFieldDef(fieldDef, channel)); + } + return defs; + }, []); + } + } + else { + if (channel === TOOLTIP && channelDef === null) { + // Preserve null so we can use it to disable tooltip + normalizedEncoding[channel] = null; + } + else if (!isFieldDef(channelDef) && + !isDatumDef(channelDef) && + !isValueDef(channelDef) && + !isConditionalDef(channelDef) && + !isSignalRef(channelDef)) { + log.warn(log.message.emptyFieldDef(channelDef, channel)); + continue; + } + normalizedEncoding[channel] = initChannelDef(channelDef, channel, config); + } + } + return normalizedEncoding; +} +/** + * For composite marks, we have to call initChannelDef during init so we can infer types earlier. + */ +export function normalizeEncoding(encoding, config) { + const normalizedEncoding = {}; + for (const channel of keys(encoding)) { + const newChannelDef = initChannelDef(encoding[channel], channel, config, { compositeMark: true }); + normalizedEncoding[channel] = newChannelDef; + } + return normalizedEncoding; +} +export function fieldDefs(encoding) { + const arr = []; + for (const channel of keys(encoding)) { + if (channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + const channelDefArray = array(channelDef); + for (const def of channelDefArray) { + if (isFieldDef(def)) { + arr.push(def); + } + else if (hasConditionalFieldDef(def)) { + arr.push(def.condition); + } + } + } + } + return arr; +} +export function forEach(mapping, f, thisArg) { + if (!mapping) { + return; + } + for (const channel of keys(mapping)) { + const el = mapping[channel]; + if (isArray(el)) { + for (const channelDef of el) { + f.call(thisArg, channelDef, channel); + } + } + else { + f.call(thisArg, el, channel); + } + } +} +export function reduce(mapping, f, init, thisArg) { + if (!mapping) { + return init; + } + return keys(mapping).reduce((r, channel) => { + const map = mapping[channel]; + if (isArray(map)) { + return map.reduce((r1, channelDef) => { + return f.call(thisArg, r1, channelDef, channel); + }, r); + } + else { + return f.call(thisArg, r, map, channel); + } + }, init); +} +/** + * Returns list of path grouping fields for the given encoding + */ +export function pathGroupingFields(mark, encoding) { + return keys(encoding).reduce((details, channel) => { + switch (channel) { + // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group + case X: + case Y: + case HREF: + case DESCRIPTION: + case URL: + case X2: + case Y2: + case XOFFSET: + case YOFFSET: + case THETA: + case THETA2: + case RADIUS: + case RADIUS2: + // falls through + case LATITUDE: + case LONGITUDE: + case LATITUDE2: + case LONGITUDE2: + // TODO: case 'cursor': + // text, shape, shouldn't be a part of line/trail/area [falls through] + case TEXT: + case SHAPE: + case ANGLE: + // falls through + // tooltip fields should not be added to group by [falls through] + case TOOLTIP: + return details; + case ORDER: + // order should not group line / trail + if (mark === 'line' || mark === 'trail') { + return details; + } + // but order should group area for stacking (falls through) + case DETAIL: + case KEY: { + const channelDef = encoding[channel]; + if (isArray(channelDef) || isFieldDef(channelDef)) { + for (const fieldDef of array(channelDef)) { + if (!fieldDef.aggregate) { + details.push(vgField(fieldDef, {})); + } + } + } + return details; + } + case SIZE: + if (mark === 'trail') { + // For trail, size should not group trail lines. + return details; + } + // For line, size should group lines. + // falls through + case COLOR: + case FILL: + case STROKE: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEDASH: + case STROKEWIDTH: { + // TODO strokeDashOffset: + // falls through + const fieldDef = getFieldDef(encoding[channel]); + if (fieldDef && !fieldDef.aggregate) { + details.push(vgField(fieldDef, {})); + } + return details; + } + } + }, []); +} +//# sourceMappingURL=encoding.js.map \ No newline at end of file diff --git a/build/src/encoding.js.map b/build/src/encoding.js.map new file mode 100644 index 0000000000..92c326e14b --- /dev/null +++ b/build/src/encoding.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encoding.js","sourceRoot":"","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AAI,CAAC,QAAQ,CAAC,SAAS,EAAE;4BACvB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;yBACrC;qBACF;iBACF;gBACD,OAAO,OAAO,CAAC;aAChB;YAED,KAAK,IAAI;gBACP,IAAI,IAAI,KAAK,OAAO,EAAE;oBACpB,gDAAgD;oBAChD,OAAO,OAAO,CAAC;iBAChB;YACH,qCAAqC;YAErC,gBAAgB;YAChB,KAAK,KAAK,CAAC;YACX,KAAK,IAAI,CAAC;YACV,KAAK,MAAM,CAAC;YACZ,KAAK,OAAO,CAAC;YACb,KAAK,WAAW,CAAC;YACjB,KAAK,aAAa,CAAC;YACnB,KAAK,UAAU,CAAC;YAChB,KAAK,WAAW,CAAC,CAAC;gBAChB,yBAAyB;gBACzB,gBAAgB;gBAEhB,MAAM,QAAQ,GAAG,WAAW,CAAS,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;gBACxD,IAAI,QAAQ,IAAI,CAAC,QAAQ,CAAC,SAAS,EAAE;oBACnC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC;iBACrC;gBACD,OAAO,OAAO,CAAC;aAChB;SACF;IACH,CAAC,EAAE,EAAE,CAAC,CAAC;AACT,CAAC"} \ No newline at end of file diff --git a/build/src/expr.d.ts b/build/src/expr.d.ts new file mode 100644 index 0000000000..b15fa6af85 --- /dev/null +++ b/build/src/expr.d.ts @@ -0,0 +1,11 @@ +import { Dict } from './util'; +import { MappedExclude } from './vega.schema'; +export interface ExprRef { + /** + * Vega expression (which can refer to Vega-Lite parameters). + */ + expr: string; +} +export declare function isExprRef(o: any): o is ExprRef; +export declare function replaceExprRef>(index: T): MappedExclude; +//# sourceMappingURL=expr.d.ts.map \ No newline at end of file diff --git a/build/src/expr.d.ts.map b/build/src/expr.d.ts.map new file mode 100644 index 0000000000..f3f75087a6 --- /dev/null +++ b/build/src/expr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"expr.d.ts","sourceRoot":"","sources":["../../src/expr.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,IAAI,EAAO,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAC,aAAa,EAAC,MAAM,eAAe,CAAC;AAE5C,MAAM,WAAW,OAAO;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,OAAO,CAE9C;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,IAAI,CAAC,GAAG,CAAC,EAAE,KAAK,EAAE,CAAC,6BAO3D"} \ No newline at end of file diff --git a/build/src/expr.js b/build/src/expr.js new file mode 100644 index 0000000000..8721db31de --- /dev/null +++ b/build/src/expr.js @@ -0,0 +1,14 @@ +import { signalRefOrValue } from './compile/common'; +import { keys } from './util'; +export function isExprRef(o) { + return !!o?.expr; +} +export function replaceExprRef(index) { + const props = keys(index || {}); + const newIndex = {}; + for (const prop of props) { + newIndex[prop] = signalRefOrValue(index[prop]); + } + return newIndex; +} +//# sourceMappingURL=expr.js.map \ No newline at end of file diff --git a/build/src/expr.js.map b/build/src/expr.js.map new file mode 100644 index 0000000000..1c671ae973 --- /dev/null +++ b/build/src/expr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"expr.js","sourceRoot":"","sources":["../../src/expr.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAUlC,MAAM,UAAU,SAAS,CAAC,CAAM;IAC9B,OAAO,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,cAAc,CAAsB,KAAQ;IAC1D,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC;IAChC,MAAM,QAAQ,GAAc,EAAE,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,QAAQ,CAAC,IAAI,CAAC,GAAG,gBAAgB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;KAChD;IACD,OAAO,QAAqC,CAAC;AAC/C,CAAC"} \ No newline at end of file diff --git a/build/src/guide.d.ts b/build/src/guide.d.ts new file mode 100644 index 0000000000..6376c9be03 --- /dev/null +++ b/build/src/guide.d.ts @@ -0,0 +1,30 @@ +import { SignalRef, Text } from 'vega'; +import { ConditionValueDefMixins, FormatMixins, ValueDef } from './channeldef'; +import { LegendConfig } from './legend'; +import { VgEncodeChannel } from './vega.schema'; +export interface TitleMixins { + /** + * A title for the field. If `null`, the title will be removed. + * + * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `"Sum of Profit"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `"Profit (binned)"`, `"Transaction Date (year-month)"`). Otherwise, the title is simply the field name. + * + * __Notes__: + * + * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/usage/compile.html#field-title). + * + * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used. + */ + title?: Text | null | SignalRef; +} +export interface Guide extends TitleMixins, FormatMixins { +} +export interface VlOnlyGuideConfig { + /** + * Set to null to disable title for the axis, legend, or header. + */ + title?: null; +} +export type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins; +export type GuideEncodingEntry = Partial>; +export declare const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[]; +//# sourceMappingURL=guide.d.ts.map \ No newline at end of file diff --git a/build/src/guide.d.ts.map b/build/src/guide.d.ts.map new file mode 100644 index 0000000000..22c1b549c3 --- /dev/null +++ b/build/src/guide.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"guide.d.ts","sourceRoot":"","sources":["../../src/guide.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AACrC,OAAO,EAAC,uBAAuB,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAE9C,MAAM,WAAW,WAAW;IAC1B;;;;;;;;;;OAUG;IACH,KAAK,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,SAAS,CAAC;CACjC;AAED,MAAM,WAAW,KAAM,SAAQ,WAAW,EAAE,YAAY;CAAG;AAE3D,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,KAAK,CAAC,EAAE,IAAI,CAAC;CACd;AAED,MAAM,MAAM,gCAAgC,GAAG,QAAQ,GAAG,uBAAuB,CAAC;AAElF,MAAM,MAAM,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,gCAAgC,CAAC,CAAC,CAAC;AAEpG,eAAO,MAAM,qBAAqB,EAAE,CAAC,MAAM,YAAY,CAAC,GAAG,CAAC,CAAC,EAM5D,CAAC"} \ No newline at end of file diff --git a/build/src/guide.js b/build/src/guide.js new file mode 100644 index 0000000000..bd1deb1501 --- /dev/null +++ b/build/src/guide.js @@ -0,0 +1,8 @@ +export const VL_ONLY_LEGEND_CONFIG = [ + 'gradientHorizontalMaxLength', + 'gradientHorizontalMinLength', + 'gradientVerticalMaxLength', + 'gradientVerticalMinLength', + 'unselectedOpacity' +]; +//# sourceMappingURL=guide.js.map \ No newline at end of file diff --git a/build/src/guide.js.map b/build/src/guide.js.map new file mode 100644 index 0000000000..26c56101d8 --- /dev/null +++ b/build/src/guide.js.map @@ -0,0 +1 @@ +{"version":3,"file":"guide.js","sourceRoot":"","sources":["../../src/guide.ts"],"names":[],"mappings":"AAiCA,MAAM,CAAC,MAAM,qBAAqB,GAAgC;IAChE,6BAA6B;IAC7B,6BAA6B;IAC7B,2BAA2B;IAC3B,2BAA2B;IAC3B,mBAAmB;CACpB,CAAC"} \ No newline at end of file diff --git a/build/src/header.d.ts b/build/src/header.d.ts new file mode 100644 index 0000000000..17a14bd098 --- /dev/null +++ b/build/src/header.d.ts @@ -0,0 +1,193 @@ +import { Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig } from 'vega'; +import { FormatMixins } from './channeldef'; +import { ExprRef } from './expr'; +import { Guide, VlOnlyGuideConfig } from './guide'; +export declare const HEADER_TITLE_PROPERTIES_MAP: Partial, keyof TitleConfig>>; +export declare const HEADER_LABEL_PROPERTIES_MAP: Partial, keyof TitleConfig>>; +export declare const HEADER_TITLE_PROPERTIES: (keyof CoreHeader)[]; +export declare const HEADER_LABEL_PROPERTIES: (keyof CoreHeader)[]; +export interface CoreHeader extends FormatMixins { + /** + * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. + */ + titleAnchor?: TitleAnchor; + /** + * Horizontal text alignment (to the anchor) of header titles. + */ + titleAlign?: Align | ES; + /** + * The rotation angle of the header title. + * + * __Default value:__ `0`. + * + * @minimum -360 + * @maximum 360 + */ + titleAngle?: number; + /** + * The vertical text baseline for the header title. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. + * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. + * + * __Default value:__ `"middle"` + */ + titleBaseline?: TextBaseline | ES; + /** + * Color of the header title, can be in hex color code or regular color name. + */ + titleColor?: Color | ES; + /** + * Font of the header title. (e.g., `"Helvetica Neue"`). + */ + titleFont?: string | ES; + /** + * Font size of the header title. + * + * @minimum 0 + */ + titleFontSize?: number | ES; + /** + * The font style of the header title. + */ + titleFontStyle?: FontStyle | ES; + /** + * Font weight of the header title. + * This can be either a string (e.g `"bold"`, `"normal"`) or a number (`100`, `200`, `300`, ..., `900` where `"normal"` = `400` and `"bold"` = `700`). + */ + titleFontWeight?: FontWeight | ES; + /** + * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. + * + * __Default value:__ `0`, indicating no limit + */ + titleLimit?: number | ES; + /** + * Line height in pixels for multi-line header title text or title text with `"line-top"` or `"line-bottom"` baseline. + */ + titleLineHeight?: number | ES; + /** + * The orientation of the header title. One of `"top"`, `"bottom"`, `"left"` or `"right"`. + */ + titleOrient?: Orient; + /** + * The padding, in pixel, between facet header's title and the label. + * + * __Default value:__ `10` + */ + titlePadding?: number | ES; + /** + * A boolean flag indicating if labels should be included as part of the header. + * + * __Default value:__ `true`. + */ + labels?: boolean; + /** + * Horizontal text alignment of header labels. One of `"left"`, `"center"`, or `"right"`. + */ + labelAlign?: Align | ES; + /** + * The vertical text baseline for the header labels. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, or `"line-bottom"`. + * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone. + * + */ + labelBaseline?: TextBaseline | ES; + /** + * The anchor position for placing the labels. One of `"start"`, `"middle"`, or `"end"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label. + */ + labelAnchor?: TitleAnchor; + /** + * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. + * + * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object. + */ + labelExpr?: string; + /** + * The rotation angle of the header labels. + * + * __Default value:__ `0` for column header, `-90` for row header. + * + * @minimum -360 + * @maximum 360 + */ + labelAngle?: number; + /** + * The color of the header label, can be in hex color code or regular color name. + */ + labelColor?: Color | ES; + /** + * The font of the header label. + */ + labelFont?: string | ES; + /** + * The font size of the header label, in pixels. + * + * @minimum 0 + */ + labelFontSize?: number | ES; + /** + * The font style of the header label. + */ + labelFontStyle?: FontStyle | ES; + /** + * The font weight of the header label. + */ + labelFontWeight?: FontWeight | ES; + /** + * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit. + * + * __Default value:__ `0`, indicating no limit + */ + labelLimit?: number | ES; + /** + * Line height in pixels for multi-line header labels or title text with `"line-top"` or `"line-bottom"` baseline. + */ + labelLineHeight?: number | ES; + /** + * The orientation of the header label. One of `"top"`, `"bottom"`, `"left"` or `"right"`. + */ + labelOrient?: Orient; + /** + * The padding, in pixel, between facet header's label and the plot. + * + * __Default value:__ `10` + */ + labelPadding?: number | ES; + /** + * Shortcut for setting both labelOrient and titleOrient. + */ + orient?: Orient; +} +export interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig { +} +/** + * Headers of row / column channels for faceted plots. + */ +export interface Header extends CoreHeader, Guide { +} +export interface HeaderConfigMixins { + /** + * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html). + * + * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). + */ + header?: HeaderConfig; + /** + * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html). + * + * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). + */ + headerRow?: HeaderConfig; + /** + * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html). + * + * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). + */ + headerColumn?: HeaderConfig; + /** + * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html). + * + * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config). + */ + headerFacet?: HeaderConfig; +} +export declare const HEADER_CONFIGS: (keyof HeaderConfigMixins)[]; +//# sourceMappingURL=header.d.ts.map \ No newline at end of file diff --git a/build/src/header.d.ts.map b/build/src/header.d.ts.map new file mode 100644 index 0000000000..cc06602bde --- /dev/null +++ b/build/src/header.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"header.d.ts","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,MAAM,CAAC;AACpH,OAAO,EAAC,YAAY,EAAC,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,KAAK,EAAE,iBAAiB,EAAC,MAAM,SAAS,CAAC;AAGjD,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,WAAW,CAAC,CAcjG,CAAC;AAEF,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,EAAE,MAAM,WAAW,CAAC,CAcjG,CAAC;AAEF,eAAO,MAAM,uBAAuB,2BAAoC,CAAC;AAEzE,eAAO,MAAM,uBAAuB,2BAAoC,CAAC;AAEzE,MAAM,WAAW,UAAU,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS,CAAE,SAAQ,YAAY;IAE9E;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC;IAExB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,YAAY,GAAG,EAAE,CAAC;IAElC;;OAEG;IACH,UAAU,CAAC,EAAE,KAAK,GAAG,EAAE,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAA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AW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAE3B;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,YAAY,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS,CAAE,SAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,iBAAiB;CAAG;AAE1G;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS,CAAE,SAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,KAAK;CAAG;AAExF,MAAM,WAAW,kBAAkB,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS;IAChE;;;;OAIG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAE1B;;;;OAIG;IACH,SAAS,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAE7B;;;;OAIG;IACH,YAAY,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;IAEhC;;;;OAIG;IACH,WAAW,CAAC,EAAE,YAAY,CAAC,EAAE,CAAC,CAAC;CAChC;AASD,eAAO,MAAM,cAAc,mCAA6B,CAAC"} \ No newline at end of file diff --git a/build/src/header.js b/build/src/header.js new file mode 100644 index 0000000000..01e1b3ef7a --- /dev/null +++ b/build/src/header.js @@ -0,0 +1,41 @@ +import { keys } from './util'; +export const HEADER_TITLE_PROPERTIES_MAP = { + titleAlign: 'align', + titleAnchor: 'anchor', + titleAngle: 'angle', + titleBaseline: 'baseline', + titleColor: 'color', + titleFont: 'font', + titleFontSize: 'fontSize', + titleFontStyle: 'fontStyle', + titleFontWeight: 'fontWeight', + titleLimit: 'limit', + titleLineHeight: 'lineHeight', + titleOrient: 'orient', + titlePadding: 'offset' +}; +export const HEADER_LABEL_PROPERTIES_MAP = { + labelAlign: 'align', + labelAnchor: 'anchor', + labelAngle: 'angle', + labelBaseline: 'baseline', + labelColor: 'color', + labelFont: 'font', + labelFontSize: 'fontSize', + labelFontStyle: 'fontStyle', + labelFontWeight: 'fontWeight', + labelLimit: 'limit', + labelLineHeight: 'lineHeight', + labelOrient: 'orient', + labelPadding: 'offset' +}; +export const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); +export const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); +const HEADER_CONFIGS_INDEX = { + header: 1, + headerRow: 1, + headerColumn: 1, + headerFacet: 1 +}; +export const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX); +//# sourceMappingURL=header.js.map \ No newline at end of file diff --git a/build/src/header.js.map b/build/src/header.js.map new file mode 100644 index 0000000000..16a758276b --- /dev/null +++ b/build/src/header.js.map @@ -0,0 +1 @@ +{"version":3,"file":"header.js","sourceRoot":"","sources":["../../src/header.ts"],"names":[],"mappings":"AAIA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAElC,MAAM,CAAC,MAAM,2BAA2B,GAA8D;IACpG,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,YAAY;IAC7B,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAA8D;IACpG,UAAU,EAAE,OAAO;IACnB,WAAW,EAAE,QAAQ;IACrB,UAAU,EAAE,OAAO;IACnB,aAAa,EAAE,UAAU;IACzB,UAAU,EAAE,OAAO;IACnB,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,UAAU;IACzB,cAAc,EAAE,WAAW;IAC3B,eAAe,EAAE,YAAY;IAC7B,UAAU,EAAE,OAAO;IACnB,eAAe,EAAE,YAAY;IAC7B,WAAW,EAAE,QAAQ;IACrB,YAAY,EAAE,QAAQ;CACvB,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC;AAEzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,IAAI,CAAC,2BAA2B,CAAC,CAAC;AA6NzE,MAAM,oBAAoB,GAAwC;IAChE,MAAM,EAAE,CAAC;IACT,SAAS,EAAE,CAAC;IACZ,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;CACf,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/impute.d.ts b/build/src/impute.d.ts new file mode 100644 index 0000000000..5931fa8bdf --- /dev/null +++ b/build/src/impute.d.ts @@ -0,0 +1,31 @@ +import { ImputeSequence } from './transform'; +import { ImputeMethod } from 'vega'; +export interface ImputeParams { + /** + * The imputation method to use for the field value of imputed data objects. + * One of `"value"`, `"mean"`, `"median"`, `"max"` or `"min"`. + * + * __Default value:__ `"value"` + */ + method?: ImputeMethod; + /** + * The field value to use when the imputation `method` is `"value"`. + */ + value?: any; + /** + * Defines the key values that should be considered for imputation. + * An array of key values or an object defining a [number sequence](https://vega.github.io/vega-lite/docs/impute.html#sequence-def). + * + * If provided, this will be used in addition to the key values observed within the input data. If not provided, the values will be derived from all unique values of the `key` field. For `impute` in `encoding`, the key field is the x-field if the y-field is imputed, or vice versa. + * + * If there is no impute grouping, this property _must_ be specified. + */ + keyvals?: any[] | ImputeSequence; + /** + * A frame specification as a two-element array used to control the window over which the specified method is applied. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. For example, the value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. + * + * __Default value:__: `[null, null]` indicating that the window includes all objects. + */ + frame?: [null | number, null | number]; +} +//# sourceMappingURL=impute.d.ts.map \ No newline at end of file diff --git a/build/src/impute.d.ts.map b/build/src/impute.d.ts.map new file mode 100644 index 0000000000..91c0917628 --- /dev/null +++ b/build/src/impute.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"impute.d.ts","sourceRoot":"","sources":["../../src/impute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,YAAY,EAAC,MAAM,MAAM,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAC;IAEtB;;OAEG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,GAAG,EAAE,GAAG,cAAc,CAAC;IAEjC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,IAAI,GAAG,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC,CAAC;CACxC"} \ No newline at end of file diff --git a/build/src/impute.js b/build/src/impute.js new file mode 100644 index 0000000000..148e533701 --- /dev/null +++ b/build/src/impute.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=impute.js.map \ No newline at end of file diff --git a/build/src/impute.js.map b/build/src/impute.js.map new file mode 100644 index 0000000000..165cdf4721 --- /dev/null +++ b/build/src/impute.js.map @@ -0,0 +1 @@ +{"version":3,"file":"impute.js","sourceRoot":"","sources":["../../src/impute.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/src/index.d.ts b/build/src/index.d.ts new file mode 100644 index 0000000000..654bc6e6dd --- /dev/null +++ b/build/src/index.d.ts @@ -0,0 +1,7 @@ +export declare const version: string; +export { compile } from './compile/compile'; +export type { Config } from './config'; +export { normalize } from './normalize'; +export type { TopLevelSpec } from './spec'; +export * from './util'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/index.d.ts.map b/build/src/index.d.ts.map new file mode 100644 index 0000000000..ab356c729d --- /dev/null +++ b/build/src/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,QAAc,CAAC;AAEnC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,YAAY,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACzC,cAAc,QAAQ,CAAC"} \ No newline at end of file diff --git a/build/src/index.js b/build/src/index.js new file mode 100644 index 0000000000..adf164c4be --- /dev/null +++ b/build/src/index.js @@ -0,0 +1,6 @@ +import pkg from '../package.json'; +export const version = pkg.version; +export { compile } from './compile/compile'; +export { normalize } from './normalize'; +export * from './util'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/index.js.map b/build/src/index.js.map new file mode 100644 index 0000000000..057a3bb9ca --- /dev/null +++ b/build/src/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,GAAG,MAAM,iBAAiB,CAAC;AAClC,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;AAEnC,OAAO,EAAC,OAAO,EAAC,MAAM,mBAAmB,CAAC;AAE1C,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,cAAc,QAAQ,CAAC"} \ No newline at end of file diff --git a/build/src/legend.d.ts b/build/src/legend.d.ts new file mode 100644 index 0000000000..d8d7fa6783 --- /dev/null +++ b/build/src/legend.d.ts @@ -0,0 +1,150 @@ +import { BaseLegend, LabelOverlap, Legend as VgLegend, LegendConfig as VgLegendConfig, LegendOrient, Orientation, SignalRef } from 'vega'; +import { DateTime } from './datetime'; +import { ExprRef } from './expr'; +import { Guide, GuideEncodingEntry, VlOnlyGuideConfig } from './guide'; +import { Flag } from './util'; +import { MapExcludeValueRefAndReplaceSignalWith } from './vega.schema'; +export declare const LEGEND_SCALE_CHANNELS: readonly ["size", "shape", "fill", "stroke", "strokeDash", "strokeWidth", "opacity"]; +type BaseLegendNoValueRefs = MapExcludeValueRefAndReplaceSignalWith; +export type LegendConfig = LegendMixins & VlOnlyGuideConfig & MapExcludeValueRefAndReplaceSignalWith & { + /** + * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined. + * + * __Default value:__ `200` + */ + gradientVerticalMaxLength?: number; + /** + * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined. + * + * __Default value:__ `100` + */ + gradientVerticalMinLength?: number; + /** + * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. + * + * __Default value:__ `200` + */ + gradientHorizontalMaxLength?: number; + /** + * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined. + * + * __Default value:__ `100` + */ + gradientHorizontalMinLength?: number; + /** + * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient. + * + * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules: + * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)` + * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)` + * - For other horizontal gradients, `gradientHorizontalMinLength` + * + * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_. + * @minimum 0 + */ + gradientLength?: number; + /** + * The opacity of unselected legend entries. + * + * __Default value:__ 0.35. + */ + unselectedOpacity?: number; + /** + * Disable legend by default + */ + disable?: boolean; +}; +/** + * Properties of a legend or boolean flag for determining whether to show it. + */ +export interface Legend extends Omit, 'orient'>, LegendMixins, Guide { + /** + * Mark definitions for custom legend encoding. + * + * @hidden + */ + encoding?: LegendEncoding; + /** + * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels. + * + * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object. + */ + labelExpr?: string; + /** + * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value. + * + * __Default value__: `undefined` + */ + tickMinStep?: number | ES; + /** + * Explicitly set the visible legend values. + */ + values?: number[] | string[] | boolean[] | DateTime[] | ES; + /** + * The type of the legend. Use `"symbol"` to create a discrete legend and `"gradient"` for a continuous color gradient. + * + * __Default value:__ `"gradient"` for non-binned quantitative fields and temporal fields; `"symbol"` otherwise. + */ + type?: 'symbol' | 'gradient'; + /** + * A non-negative integer indicating the z-index of the legend. + * If zindex is 0, legend should be drawn behind all chart elements. + * To put them in front, use zindex = 1. + * + * @TJS-type integer + * @minimum 0 + */ + zindex?: number; +} +interface LegendMixins { + /** + * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `"parity"`, a strategy of removing every other label is used. If set to `"greedy"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes). + * + * __Default value:__ `"greedy"` for `log scales otherwise `true`. + */ + labelOverlap?: LabelOverlap | ES; + /** + * The direction of the legend, one of `"vertical"` or `"horizontal"`. + * + * __Default value:__ + * - For top-/bottom-`orient`ed legends, `"horizontal"` + * - For left-/right-`orient`ed legends, `"vertical"` + * - For top/bottom-left/right-`orient`ed legends, `"horizontal"` for gradient legends and `"vertical"` for symbol legends. + */ + direction?: Orientation; + /** + * The orientation of the legend, which determines how the legend is positioned within the scene. One of `"left"`, `"right"`, `"top"`, `"bottom"`, `"top-left"`, `"top-right"`, `"bottom-left"`, `"bottom-right"`, `"none"`. + * + * __Default value:__ `"right"` + */ + orient?: LegendOrient; +} +export type LegendInternal = Legend; +export interface LegendEncoding { + /** + * Custom encoding for the legend container. + * This can be useful for creating legend with custom x, y position. + */ + legend?: GuideEncodingEntry; + /** + * Custom encoding for the legend title text mark. + */ + title?: GuideEncodingEntry; + /** + * Custom encoding for legend label text marks. + */ + labels?: GuideEncodingEntry; + /** + * Custom encoding for legend symbol marks. + */ + symbols?: GuideEncodingEntry; + /** + * Custom encoding for legend gradient filled rect marks. + */ + gradient?: GuideEncodingEntry; +} +export declare const defaultLegendConfig: LegendConfig; +export declare const COMMON_LEGEND_PROPERTY_INDEX: Flag)>; +export declare const LEGEND_PROPERTIES: ("values" | "type" | "offset" | "columns" | "direction" | "padding" | "title" | "description" | "zindex" | "aria" | "cornerRadius" | "orient" | "format" | "formatType" | "tickCount" | "tickMinStep" | "symbolLimit" | "fillColor" | "strokeColor" | "legendX" | "legendY" | "titleAlign" | "titleAnchor" | "titleBaseline" | "titleColor" | "titleFont" | "titleFontSize" | "titleFontStyle" | "titleFontWeight" | "titleLimit" | "titleLineHeight" | "titleOpacity" | "titleOrient" | "titlePadding" | "gradientLength" | "gradientOpacity" | "gradientThickness" | "gradientStrokeColor" | "gradientStrokeWidth" | "clipHeight" | "columnPadding" | "rowPadding" | "gridAlign" | "symbolDash" | "symbolDashOffset" | "symbolFillColor" | "symbolOffset" | "symbolOpacity" | "symbolSize" | "symbolStrokeColor" | "symbolStrokeWidth" | "symbolType" | "labelAlign" | "labelBaseline" | "labelColor" | "labelFont" | "labelFontSize" | "labelFontStyle" | "labelFontWeight" | "labelLimit" | "labelOpacity" | "labelPadding" | "labelOffset" | "labelOverlap" | "labelSeparation")[]; +export {}; +//# sourceMappingURL=legend.d.ts.map \ No newline at end of file diff --git a/build/src/legend.d.ts.map b/build/src/legend.d.ts.map new file mode 100644 index 0000000000..e178e81bef --- /dev/null +++ b/build/src/legend.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"legend.d.ts","sourceRoot":"","sources":["../../src/legend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,YAAY,EACZ,MAAM,IAAI,QAAQ,EAClB,YAAY,IAAI,cAAc,EAC9B,YAAY,EACZ,W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000000..b289a4a7e0 --- /dev/null +++ b/build/src/legend.js @@ -0,0 +1,86 @@ +import { keys } from './util'; +export const LEGEND_SCALE_CHANNELS = [ + 'size', + 'shape', + 'fill', + 'stroke', + 'strokeDash', + 'strokeWidth', + 'opacity' +]; +export const defaultLegendConfig = { + gradientHorizontalMaxLength: 200, + gradientHorizontalMinLength: 100, + gradientVerticalMaxLength: 200, + gradientVerticalMinLength: 64, + unselectedOpacity: 0.35 +}; +export const COMMON_LEGEND_PROPERTY_INDEX = { + aria: 1, + clipHeight: 1, + columnPadding: 1, + columns: 1, + cornerRadius: 1, + description: 1, + direction: 1, + fillColor: 1, + format: 1, + formatType: 1, + gradientLength: 1, + gradientOpacity: 1, + gradientStrokeColor: 1, + gradientStrokeWidth: 1, + gradientThickness: 1, + gridAlign: 1, + labelAlign: 1, + labelBaseline: 1, + labelColor: 1, + labelFont: 1, + labelFontSize: 1, + labelFontStyle: 1, + labelFontWeight: 1, + labelLimit: 1, + labelOffset: 1, + labelOpacity: 1, + labelOverlap: 1, + labelPadding: 1, + labelSeparation: 1, + legendX: 1, + legendY: 1, + offset: 1, + orient: 1, + padding: 1, + rowPadding: 1, + strokeColor: 1, + symbolDash: 1, + symbolDashOffset: 1, + symbolFillColor: 1, + symbolLimit: 1, + symbolOffset: 1, + symbolOpacity: 1, + symbolSize: 1, + symbolStrokeColor: 1, + symbolStrokeWidth: 1, + symbolType: 1, + tickCount: 1, + tickMinStep: 1, + title: 1, + titleAlign: 1, + titleAnchor: 1, + titleBaseline: 1, + titleColor: 1, + titleFont: 1, + titleFontSize: 1, + titleFontStyle: 1, + titleFontWeight: 1, + titleLimit: 1, + titleLineHeight: 1, + titleOpacity: 1, + titleOrient: 1, + titlePadding: 1, + type: 1, + values: 1, + zindex: 1 +}; +export const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX); +//# sourceMappingURL=legend.js.map \ No newline at end of file diff --git a/build/src/legend.js.map b/build/src/legend.js.map new file mode 100644 index 0000000000..993dbc034c --- /dev/null +++ b/build/src/legend.js.map @@ -0,0 +1 @@ +{"version":3,"file":"legend.js","sourceRoot":"","sources":["../../src/legend.ts"],"names":[],"mappings":"AAYA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAGlC,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,MAAM;IACN,OAAO;IACP,MAAM;IACN,QAAQ;IACR,YAAY;IACZ,aAAa;IACb,SAAS;CACD,CAAC;AAyKX,MAAM,CAAC,MAAM,mBAAmB,GAA4B;IAC1D,2BAA2B,EAAE,GAAG;IAChC,2BAA2B,EAAE,GAAG;IAChC,yBAAyB,EAAE,GAAG;IAC9B,yBAAyB,EAAE,EAAE;IAC7B,iBAAiB,EAAE,IAAI;CACxB,CAAC;AAEF,MAAM,CAAC,MAAM,4BAA4B,GAAyC;IAChF,IAAI,EAAE,CAAC;IACP,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,CAAC;IACZ,MAAM,EAAE,CAAC;IACT,UAAU,EAAE,CAAC;IACb,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE,CAAC;IAClB,mBAAmB,EAAE,CAAC;IACtB,mBAAmB,EAAE,CAAC;IACtB,iBAAiB,EAAE,CAAC;IACpB,SAAS,EAAE,CAAC;IACZ,UAAU,EAAE,CAAC;IACb,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,YAAY,EAAE,CAAC;IACf,eAAe,EAAE,CAAC;IAClB,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;IACT,OAAO,EAAE,CAAC;IACV,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,UAAU,EAAE,CAAC;IACb,gBAAgB,EAAE,CAAC;IACnB,eAAe,EAAE,CAAC;IAClB,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,iBAAiB,EAAE,CAAC;IACpB,iBAAiB,EAAE,CAAC;IACpB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,WAAW,EAAE,CAAC;IACd,KAAK,EAAE,CAAC;IACR,UAAU,EAAE,CAAC;IACb,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;IAChB,UAAU,EAAE,CAAC;IACb,SAAS,EAAE,CAAC;IACZ,aAAa,EAAE,CAAC;IAChB,cAAc,EAAE,CAAC;IACjB,eAAe,EAAE,CAAC;IAClB,UAAU,EAAE,CAAC;IACb,eAAe,EAAE,CAAC;IAClB,YAAY,EAAE,CAAC;IACf,WAAW,EAAE,CAAC;IACd,YAAY,EAAE,CAAC;IACf,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,MAAM,EAAE,CAAC;CACV,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC,4BAA4B,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/log/index.d.ts b/build/src/log/index.d.ts new file mode 100644 index 0000000000..a65bd9782b --- /dev/null +++ b/build/src/log/index.d.ts @@ -0,0 +1,34 @@ +/** + * Vega-Lite's singleton logger utility. + */ +import { LoggerInterface } from 'vega-util'; +export * as message from './message'; +/** + * Logger tool for checking if the code throws correct warning. + */ +export declare class LocalLogger implements LoggerInterface { + #private; + warns: any[]; + infos: any[]; + debugs: any[]; + level(): number; + level(_: number): this; + warn(...args: readonly any[]): this; + info(...args: readonly any[]): this; + debug(...args: readonly any[]): this; + error(...args: readonly any[]): this; +} +export declare function wrap(f: (logger: LocalLogger) => void): () => void; +/** + * Set the singleton logger to be a custom logger. + */ +export declare function set(newLogger: LoggerInterface): LoggerInterface; +/** + * Reset the main logger to use the default Vega Logger. + */ +export declare function reset(): LoggerInterface; +export declare function error(...args: readonly any[]): void; +export declare function warn(...args: readonly any[]): void; +export declare function info(...args: readonly any[]): void; +export declare function debug(...args: readonly any[]): void; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/log/index.d.ts.map b/build/src/log/index.d.ts.map new file mode 100644 index 0000000000..659a2e6b92 --- /dev/null +++ b/build/src/log/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAA2C,eAAe,EAAO,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAQrC;;GAEG;AACH,qBAAa,WAAY,YAAW,eAAe;;IAC1C,KAAK,EAAE,GAAG,EAAE,CAAM;IAClB,KAAK,EAAE,GAAG,EAAE,CAAM;IAClB,MAAM,EAAE,GAAG,EAAE,CAAM;IAInB,KAAK,IAAI,MAAM;IACf,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,IAAI;IAStB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK5B,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK5B,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE;IAK7B,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,GAAG,IAAI;CAI5C;AAED,wBAAgB,IAAI,CAAC,CAAC,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,cAMpD;AAED;;GAEG;AACH,wBAAgB,GAAG,CAAC,SAAS,EAAE,eAAe,mBAG7C;AAED;;GAEG;AACH,wBAAgB,KAAK,oBAGpB;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE5C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE3C;AAED,wBAAgB,IAAI,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE3C;AAED,wBAAgB,KAAK,CAAC,GAAG,IAAI,EAAE,SAAS,GAAG,EAAE,QAE5C"} \ No newline at end of file diff --git a/build/src/log/index.js b/build/src/log/index.js new file mode 100644 index 0000000000..6ab6d70195 --- /dev/null +++ b/build/src/log/index.js @@ -0,0 +1,95 @@ +/** + * Vega-Lite's singleton logger utility. + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _LocalLogger_level; +import { Debug, Error as ErrorLevel, Info, logger, Warn } from 'vega-util'; +export * as message from './message'; +/** + * Main (default) Vega Logger instance for Vega-Lite. + */ +const main = logger(Warn); +let current = main; +/** + * Logger tool for checking if the code throws correct warning. + */ +export class LocalLogger { + constructor() { + this.warns = []; + this.infos = []; + this.debugs = []; + _LocalLogger_level.set(this, Warn); + } + level(_) { + if (_) { + __classPrivateFieldSet(this, _LocalLogger_level, _, "f"); + return this; + } + return __classPrivateFieldGet(this, _LocalLogger_level, "f"); + } + warn(...args) { + if (__classPrivateFieldGet(this, _LocalLogger_level, "f") >= Warn) + this.warns.push(...args); + return this; + } + info(...args) { + if (__classPrivateFieldGet(this, _LocalLogger_level, "f") >= Info) + this.infos.push(...args); + return this; + } + debug(...args) { + if (__classPrivateFieldGet(this, _LocalLogger_level, "f") >= Debug) + this.debugs.push(...args); + return this; + } + error(...args) { + if (__classPrivateFieldGet(this, _LocalLogger_level, "f") >= ErrorLevel) + throw Error(...args); + return this; + } +} +_LocalLogger_level = new WeakMap(); +export function wrap(f) { + return () => { + current = new LocalLogger(); + f(current); + reset(); + }; +} +/** + * Set the singleton logger to be a custom logger. + */ +export function set(newLogger) { + current = newLogger; + return current; +} +/** + * Reset the main logger to use the default Vega Logger. + */ +export function reset() { + current = main; + return current; +} +export function error(...args) { + current.error(...args); +} +export function warn(...args) { + current.warn(...args); +} +export function info(...args) { + current.info(...args); +} +export function debug(...args) { + current.debug(...args); +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/log/index.js.map b/build/src/log/index.js.map new file mode 100644 index 0000000000..6a99f80108 --- /dev/null +++ b/build/src/log/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/log/index.ts"],"names":[],"mappings":"AAAA;;GAEG;;;;;;;;;;;;;AAEH,OAAO,EAAC,KAAK,EAAE,KAAK,IAAI,UAAU,EAAE,IAAI,EAAE,MAAM,EAAmB,IAAI,EAAC,MAAM,WAAW,CAAC;AAC1F,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AAErC;;GAEG;AACH,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;AAC1B,IAAI,OAAO,GAAoB,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,OAAO,WAAW;IAAxB;QACS,UAAK,GAAU,EAAE,CAAC;QAClB,UAAK,GAAU,EAAE,CAAC;QAClB,WAAM,GAAU,EAA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;GAEG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,GAAG,IAAI,CAAC;IACf,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,IAAoB;IAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACzB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,IAAoB;IAC1C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,GAAG,IAAoB;IAC1C,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,KAAK,CAAC,GAAG,IAAoB;IAC3C,OAAO,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/build/src/log/message.d.ts b/build/src/log/message.d.ts new file mode 100644 index 0000000000..2048e15440 --- /dev/null +++ b/build/src/log/message.d.ts @@ -0,0 +1,106 @@ +/** + * Collection of all Vega-Lite Error Messages + */ +import { AggregateOp, SignalRef } from 'vega'; +import { Aggregate } from '../aggregate'; +import { Channel, ExtendedChannel, FacetChannel, OffsetScaleChannel, PositionScaleChannel, ScaleChannel } from '../channel'; +import { HiddenCompositeAggregate, TypedFieldDef, Value } from '../channeldef'; +import { SplitParentProperty } from '../compile/split'; +import { CompositeMark } from '../compositemark'; +import { ErrorBarCenter, ErrorBarExtent } from '../compositemark/errorbar'; +import { DateTime, DateTimeExpr } from '../datetime'; +import { ExprRef } from '../expr'; +import { Mark } from '../mark'; +import { Projection } from '../projection'; +import { ScaleType } from '../scale'; +import { GenericSpec } from '../spec'; +import { Type } from '../type'; +import { VgSortField } from '../vega.schema'; +export declare function invalidSpec(spec: GenericSpec): string; +export declare const FIT_NON_SINGLE = "Autosize \"fit\" only works for single views and layered views."; +export declare function containerSizeNonSingle(name: 'width' | 'height'): string; +export declare function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height'): string; +export declare function droppingFit(channel?: PositionScaleChannel): string; +export declare function unknownField(channel: Channel): string; +export declare function cannotProjectOnChannelWithoutField(channel: Channel): string; +export declare function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate): string; +export declare function nearestNotSupportForContinuous(mark: string): string; +export declare function selectionNotSupported(mark: CompositeMark): string; +export declare function selectionNotFound(name: string): string; +export declare const SCALE_BINDINGS_CONTINUOUS = "Scale bindings are currently only supported for scales with unbinned, continuous domains."; +export declare const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = "Legend bindings are only supported for selections over an individual field or encoding channel."; +export declare function cannotLookupVariableParameter(name: string): string; +export declare function noSameUnitLookup(name: string): string; +export declare const NEEDS_SAME_SELECTION = "The same selection must be used to override scale domains in a layered view."; +export declare const INTERVAL_INITIALIZED_WITH_POS = "Interval selections should be initialized using \"x\", \"y\", \"longitude\", or \"latitude\" keys."; +export declare function noSuchRepeatedValue(field: string): string; +export declare function columnsNotSupportByRowCol(type: 'facet' | 'repeat'): string; +export declare const CONCAT_CANNOT_SHARE_AXIS = "Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."; +export declare function unrecognizedParse(p: string): string; +export declare function differentParse(field: string, local: string, ancestor: string): string; +export declare const ADD_SAME_CHILD_TWICE = "Attempt to add the same child twice."; +export declare function invalidTransformIgnored(transform: any): string; +export declare const NO_FIELDS_NEEDS_AS = "If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source."; +export declare function customFormatTypeNotAllowed(channel: ExtendedChannel): string; +export declare function projectionOverridden(opt: { + parentProjection: Projection; + projection: Projection; +}): string; +export declare const REPLACE_ANGLE_WITH_THETA = "Arc marks uses theta channel rather than angle, replacing angle with theta."; +export declare function offsetNestedInsideContinuousPositionScaleDropped(mainChannel: PositionScaleChannel): string; +export declare function primitiveChannelDef(channel: ExtendedChannel, type: 'string' | 'number' | 'boolean', value: Exclude): string; +export declare function invalidFieldType(type: Type): string; +export declare function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string): string; +export declare function invalidAggregate(aggregate: AggregateOp | string): string; +export declare function missingFieldType(channel: Channel, newType: Type): string; +export declare function droppingColor(type: 'encoding' | 'property', opt: { + fill?: boolean; + stroke?: boolean; +}): string; +export declare function relativeBandSizeNotSupported(sizeChannel: 'width' | 'height'): string; +export declare function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel): string; +export declare const LINE_WITH_VARYING_SIZE = "Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead."; +export declare function incompatibleChannel(channel: ExtendedChannel, markOrFacet: Mark | 'facet' | CompositeMark, when?: string): string; +export declare function offsetEncodingScaleIgnored(channel: OffsetScaleChannel): string; +export declare function invalidEncodingChannel(channel: ExtendedChannel): string; +export declare function channelShouldBeDiscrete(channel: ExtendedChannel): string; +export declare function channelShouldBeDiscreteOrDiscretizing(channel: ExtendedChannel): string; +export declare function facetChannelDropped(channels: FacetChannel[]): string; +export declare function discreteChannelCannotEncode(channel: Channel, type: Type): string; +export declare function rangeMarkAlignmentCannotBeExpression(align: 'align' | 'baseline'): string; +export declare function lineWithRange(hasX2: boolean, hasY2: boolean): string; +export declare function orientOverridden(original: string, actual: string): string; +export declare const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = "Custom domain scale cannot be unioned with default field-based domain."; +export declare function cannotUseScalePropertyWithNonColor(prop: string): string; +export declare function cannotUseRelativeBandSizeWithNonBandScale(scaleType: ScaleType): string; +export declare function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef): string; +export declare function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string): string; +export declare function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef): string; +export declare function cannotApplySizeToNonOrientedMark(mark: Mark): string; +export declare function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType): string; +export declare function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType): string; +export declare function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel): string; +export declare function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType): string; +export declare function stepDropped(channel: 'width' | 'height'): string; +export declare function mergeConflictingProperty(property: string | number | symbol, propertyOf: SplitParentProperty, v1: T, v2: T): string; +export declare function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T): string; +export declare function independentScaleMeansIndependentGuide(channel: Channel): string; +export declare function domainSortDropped(sort: VgSortField): string; +export declare const MORE_THAN_ONE_SORT = "Domains that should be unioned has conflicting sort properties. Sort will be set to true."; +export declare const FACETED_INDEPENDENT_DIFFERENT_SOURCES = "Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."; +export declare const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = "Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."; +export declare const FACETED_INDEPENDENT_SAME_SOURCE = "Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect."; +export declare const INVALID_CHANNEL_FOR_AXIS = "Invalid channel for axis."; +export declare function cannotStackRangedMark(channel: Channel): string; +export declare function cannotStackNonLinearScale(scaleType: ScaleType): string; +export declare function stackNonSummativeAggregate(aggregate: Aggregate | string): string; +export declare function invalidTimeUnit(unitName: string, value: string | number): string; +export declare function droppedDay(d: DateTime | DateTimeExpr): string; +export declare function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent): string; +export declare function errorBarCenterIsUsedWithWrongExtent(center: ErrorBarCenter, extent: ErrorBarExtent, mark: 'errorbar' | 'errorband'): string; +export declare function errorBarContinuousAxisHasCustomizedAggregate(aggregate: Aggregate | string, compositeMark: CompositeMark): string; +export declare function errorBand1DNotSupport(property: 'interpolate' | 'tension'): string; +export declare function channelRequiredForBinned(channel: Channel): string; +export declare function channelShouldNotBeUsedForBinned(channel: ExtendedChannel): string; +export declare function domainRequiredForThresholdScale(channel: ScaleChannel): string; +//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/build/src/log/message.d.ts.map b/build/src/log/message.d.ts.map new file mode 100644 index 0000000000..d66a822e84 --- /dev/null +++ b/build/src/log/message.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../src/log/message.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EACL,OAAO,EACP,eAAe,EACf,YAAY,EAEZ,kBAAkB,EAClB,oBAAoB,EACpB,YAAY,EACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,wBAAwB,EAAE,aAAa,EAAE,KAAK,EAAC,MAAM,eAAe,CAAC;AAC7E,OAAO,EAAC,mBAAmB,EAAC,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAC,cAAc,EAAE,cAAc,EAAC,MAAM,2BAA2B,CAAC;AACzE,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAC,MAAM,aAAa,CAAC;AACnD,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,SAAS,EAAC,MAAM,UAAU,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,wBAAgB,WAAW,CAAC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UAAU,CAAC,CAAC,EAAE,QAAQ,GAAG,YAAY,UAEpD;AAED,wBAAgB,mCAAmC,CAAC,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,UAIjG;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,cAAc,EACtB,IAAI,EAAE,UAAU,GAAG,WAAW,UAG/B;AAED,wBAAgB,4CAA4C,CAC1D,SAAS,EAAE,SAAS,GAAG,MAAM,EAC7B,aAAa,EAAE,aAAa,UAG7B;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,GAAG,SAAS,UAExE;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,UAExD;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,eAAe,UAEvE;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,YAAY,UAEpE"} \ No newline at end of file diff --git a/build/src/log/message.js b/build/src/log/message.js new file mode 100644 index 0000000000..bf3ad2ec70 --- /dev/null +++ b/build/src/log/message.js @@ -0,0 +1,237 @@ +import { getSizeChannel } from '../channel'; +import { stringify } from '../util'; +export function invalidSpec(spec) { + return `Invalid specification ${stringify(spec)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`; +} +// FIT +export const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; +export function containerSizeNonSingle(name) { + const uName = name == 'width' ? 'Width' : 'Height'; + return `${uName} "container" only works for single views and layered views.`; +} +export function containerSizeNotCompatibleWithAutosize(name) { + const uName = name == 'width' ? 'Width' : 'Height'; + const fitDirection = name == 'width' ? 'x' : 'y'; + return `${uName} "container" only works well with autosize "fit" or "fit-${fitDirection}".`; +} +export function droppingFit(channel) { + return channel + ? `Dropping "fit-${channel}" because spec has discrete ${getSizeChannel(channel)}.` + : `Dropping "fit" because spec has discrete size.`; +} +// VIEW SIZE +export function unknownField(channel) { + return `Unknown field for ${channel}. Cannot calculate view size.`; +} +// SELECTION +export function cannotProjectOnChannelWithoutField(channel) { + return `Cannot project a selection on encoding channel "${channel}", which has no field.`; +} +export function cannotProjectAggregate(channel, aggregate) { + return `Cannot project a selection on encoding channel "${channel}" as it uses an aggregate function ("${aggregate}").`; +} +export function nearestNotSupportForContinuous(mark) { + return `The "nearest" transform is not supported for ${mark} marks.`; +} +export function selectionNotSupported(mark) { + return `Selection not supported for ${mark} yet.`; +} +export function selectionNotFound(name) { + return `Cannot find a selection named "${name}".`; +} +export const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; +export const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.'; +export function cannotLookupVariableParameter(name) { + return `Lookups can only be performed on selection parameters. "${name}" is a variable parameter.`; +} +export function noSameUnitLookup(name) { + return (`Cannot define and lookup the "${name}" selection in the same view. ` + + `Try moving the lookup into a second, layered view?`); +} +export const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; +export const INTERVAL_INITIALIZED_WITH_POS = 'Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'; +// REPEAT +export function noSuchRepeatedValue(field) { + return `Unknown repeated value "${field}".`; +} +export function columnsNotSupportByRowCol(type) { + return `The "columns" property cannot be used when "${type}" has nested row/column.`; +} +// CONCAT / REPEAT +export const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; +// DATA +export function unrecognizedParse(p) { + return `Unrecognized parse "${p}".`; +} +export function differentParse(field, local, ancestor) { + return `An ancestor parsed field "${field}" as ${ancestor} but a child wants to parse the field as ${local}.`; +} +export const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; +// TRANSFORMS +export function invalidTransformIgnored(transform) { + return `Ignoring an invalid transform: ${stringify(transform)}.`; +} +export const NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; +// ENCODING & FACET +export function customFormatTypeNotAllowed(channel) { + return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`; +} +export function projectionOverridden(opt) { + const { parentProjection, projection } = opt; + return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`; +} +export const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; +export function offsetNestedInsideContinuousPositionScaleDropped(mainChannel) { + return `${mainChannel}Offset dropped because ${mainChannel} is continuous`; +} +export function primitiveChannelDef(channel, type, value) { + return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`; +} +export function invalidFieldType(type) { + return `Invalid field type "${type}".`; +} +export function invalidFieldTypeForCountAggregate(type, aggregate) { + return `Invalid field type "${type}" for aggregate: "${aggregate}", using "quantitative" instead.`; +} +export function invalidAggregate(aggregate) { + return `Invalid aggregation operator "${aggregate}".`; +} +export function missingFieldType(channel, newType) { + return `Missing type for channel "${channel}", using "${newType}" instead.`; +} +export function droppingColor(type, opt) { + const { fill, stroke } = opt; + return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`; +} +export function relativeBandSizeNotSupported(sizeChannel) { + return `Position range does not support relative band size for ${sizeChannel}.`; +} +export function emptyFieldDef(fieldDef, channel) { + return `Dropping ${stringify(fieldDef)} from channel "${channel}" since it does not contain any data field, datum, value, or signal.`; +} +export const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; +export function incompatibleChannel(channel, markOrFacet, when) { + return `${channel} dropped as it is incompatible with "${markOrFacet}"${when ? ` when ${when}` : ''}.`; +} +export function offsetEncodingScaleIgnored(channel) { + return `${channel} encoding has no scale, so specified scale is ignored.`; +} +export function invalidEncodingChannel(channel) { + return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`; +} +export function channelShouldBeDiscrete(channel) { + return `${channel} encoding should be discrete (ordinal / nominal / binned).`; +} +export function channelShouldBeDiscreteOrDiscretizing(channel) { + return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`; +} +export function facetChannelDropped(channels) { + return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`; +} +export function discreteChannelCannotEncode(channel, type) { + return `Using discrete channel "${channel}" to encode "${type}" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`; +} +// MARK +export function rangeMarkAlignmentCannotBeExpression(align) { + return `The ${align} for range marks cannot be an expression`; +} +export function lineWithRange(hasX2, hasY2) { + const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; + return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`; +} +export function orientOverridden(original, actual) { + return `Specified orient "${original}" overridden with "${actual}".`; +} +// SCALE +export const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN = 'Custom domain scale cannot be unioned with default field-based domain.'; +export function cannotUseScalePropertyWithNonColor(prop) { + return `Cannot use the scale property "${prop}" with non-color channel.`; +} +export function cannotUseRelativeBandSizeWithNonBandScale(scaleType) { + return `Cannot use the relative band size with ${scaleType} scale.`; +} +export function unaggregateDomainHasNoEffectForRawField(fieldDef) { + return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; +} +export function unaggregateDomainWithNonSharedDomainOp(aggregate) { + return `Unaggregated domain not applicable for "${aggregate}" since it produces values outside the origin domain of the source data.`; +} +export function unaggregatedDomainWithLogScale(fieldDef) { + return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`; +} +export function cannotApplySizeToNonOrientedMark(mark) { + return `Cannot apply size to non-oriented mark "${mark}".`; +} +export function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) { + return `Channel "${channel}" does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; +} +export function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) { + return `FieldDef does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; +} +export function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) { + return `${channel}-scale's "${propName}" is dropped as it does not work with ${scaleType} scale.`; +} +export function scaleTypeNotWorkWithMark(mark, scaleType) { + return `Scale type "${scaleType}" does not work with mark "${mark}".`; +} +export function stepDropped(channel) { + return `The step for "${channel}" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`; +} +export function mergeConflictingProperty(property, propertyOf, v1, v2) { + return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`; +} +export function mergeConflictingDomainProperty(property, propertyOf, v1, v2) { + return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`; +} +export function independentScaleMeansIndependentGuide(channel) { + return `Setting the scale to be independent for "${channel}" means we also have to set the guide (axis or legend) to be independent.`; +} +export function domainSortDropped(sort) { + return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op "count", "min", and "max".`; +} +export const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; +export const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; +export const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; +export const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; +// AXIS +export const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.'; +// STACK +export function cannotStackRangedMark(channel) { + return `Cannot stack "${channel}" if there is already "${channel}2".`; +} +export function cannotStackNonLinearScale(scaleType) { + return `Cannot stack non-linear scale (${scaleType}).`; +} +export function stackNonSummativeAggregate(aggregate) { + return `Stacking is applied even though the aggregate function is non-summative ("${aggregate}").`; +} +// TIMEUNIT +export function invalidTimeUnit(unitName, value) { + return `Invalid ${unitName}: ${stringify(value)}.`; +} +export function droppedDay(d) { + return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`; +} +export function errorBarCenterAndExtentAreNotNeeded(center, extent) { + return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`; +} +export function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) { + return `${center} is not usually used with ${extent} for ${mark}.`; +} +export function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) { + return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`; +} +export function errorBand1DNotSupport(property) { + return `1D error band does not support ${property}.`; +} +// CHANNEL +export function channelRequiredForBinned(channel) { + return `Channel ${channel} is required for "binned" bin.`; +} +export function channelShouldNotBeUsedForBinned(channel) { + return `Channel ${channel} should not be used with "binned" bin.`; +} +export function domainRequiredForThresholdScale(channel) { + return `Domain for ${channel} is required for threshold scale.`; +} +//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/build/src/log/message.js.map b/build/src/log/message.js.map new file mode 100644 index 0000000000..6cc75b5326 --- /dev/null +++ b/build/src/log/message.js.map @@ -0,0 +1 @@ +{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../src/log/message.ts"],"names":[],"mappings":"AAKA,OAAO,EAIL,cAAc,EAIf,MAAM,YAAY,CAAC;AAYpB,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAGlC,MAAM,UAAU,WAAW,CAAC,IAAqC;IAC/D,OAAO,yBAAyB,SAAS,CACvC,IAAI,CACL,yJAAyJ,CAAC;AAC7J,CAAC;AAED,MAAM;AACN,MAAM,CAAC,MAAM,cAAc,GAAG,+DAA+D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,CAAC,MAAM,CAAC,CAAC,CAAC,KAC9B,sCAAsC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,mCAAmC,CACjD,MAAsB,EACtB,MAAsB,EACtB,IAA8B;IAE9B,OAAO,GAAG,MAAM,6BAA6B,MAAM,QAAQ,IAAI,GAAG,CAAC;AACrE,CAAC;AAED,MAAM,UAAU,4CAA4C,CAC1D,SAA6B,EAC7B,aAA4B;IAE5B,OAAO,mEAAmE,SAAS,KAAK,aAAa,8BAA8B,CAAC;AACtI,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAmC;IACvE,OAAO,kCAAkC,QAAQ,GAAG,CAAC;AACvD,CAAC;AAED,UAAU;AACV,MAAM,UAAU,wBAAwB,CAAC,OAAgB;IACvD,OAAO,WAAW,OAAO,gCAAgC,CAAC;AAC5D,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAwB;IACtE,OAAO,WAAW,OAAO,wCAAwC,CAAC;AACpE,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAqB;IACnE,OAAO,cAAc,OAAO,mCAAmC,CAAC;AAClE,CAAC"} \ No newline at end of file diff --git a/build/src/logical.d.ts b/build/src/logical.d.ts new file mode 100644 index 0000000000..3496a1697b --- /dev/null +++ b/build/src/logical.d.ts @@ -0,0 +1,16 @@ +export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T; +export interface LogicalOr { + or: LogicalComposition[]; +} +export interface LogicalAnd { + and: LogicalComposition[]; +} +export interface LogicalNot { + not: LogicalComposition; +} +export declare function isLogicalOr(op: LogicalComposition): op is LogicalOr; +export declare function isLogicalAnd(op: LogicalComposition): op is LogicalAnd; +export declare function isLogicalNot(op: LogicalComposition): op is LogicalNot; +export declare function forEachLeaf(op: LogicalComposition, fn: (op: T) => void): void; +export declare function normalizeLogicalComposition(op: LogicalComposition, normalizer: (o: T) => T): LogicalComposition; +//# sourceMappingURL=logical.d.ts.map \ No newline at end of file diff --git a/build/src/logical.d.ts.map b/build/src/logical.d.ts.map new file mode 100644 index 0000000000..d73f25ebc9 --- /dev/null +++ b/build/src/logical.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"logical.d.ts","sourceRoot":"","sources":["../../src/logical.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,kBAAkB,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;AAErF,MAAM,WAAW,SAAS,CAAC,CAAC;IAC1B,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,CAAC;CAC9B;AAED,MAAM,WAAW,UAAU,CAAC,CAAC;IAC3B,GAAG,EAAE,kBAAkB,CAAC,CAAC,CAAC,CAAC;CAC5B;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,SAAS,CAAC,GAAG,CAAC,CAE7E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,CAE/E;AAED,wBAAgB,YAAY,CAAC,EAAE,EAAE,kBAAkB,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,UAAU,CAAC,GAAG,CAAC,CAE/E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,KAAK,IAAI,QAc5E;AAED,wBAAgB,2BAA2B,CAAC,CAAC,EAC3C,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,EACzB,UAAU,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,GACtB,kBAAkB,CAAC,CAAC,CAAC,CAUvB"} \ No newline at end of file diff --git a/build/src/logical.js b/build/src/logical.js new file mode 100644 index 0000000000..9feef489e0 --- /dev/null +++ b/build/src/logical.js @@ -0,0 +1,42 @@ +export function isLogicalOr(op) { + return !!op.or; +} +export function isLogicalAnd(op) { + return !!op.and; +} +export function isLogicalNot(op) { + return !!op.not; +} +export function forEachLeaf(op, fn) { + if (isLogicalNot(op)) { + forEachLeaf(op.not, fn); + } + else if (isLogicalAnd(op)) { + for (const subop of op.and) { + forEachLeaf(subop, fn); + } + } + else if (isLogicalOr(op)) { + for (const subop of op.or) { + forEachLeaf(subop, fn); + } + } + else { + fn(op); + } +} +export function normalizeLogicalComposition(op, normalizer) { + if (isLogicalNot(op)) { + return { not: normalizeLogicalComposition(op.not, normalizer) }; + } + else if (isLogicalAnd(op)) { + return { and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) }; + } + else if (isLogicalOr(op)) { + return { or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) }; + } + else { + return normalizer(op); + } +} +//# sourceMappingURL=logical.js.map \ No newline at end of file diff --git a/build/src/logical.js.map b/build/src/logical.js.map new file mode 100644 index 0000000000..185f60482a --- /dev/null +++ b/build/src/logical.js.map @@ -0,0 +1 @@ +{"version":3,"file":"logical.js","sourceRoot":"","sources":["../../src/logical.ts"],"names":[],"mappings":"AAcA,MAAM,UAAU,WAAW,CAAC,EAA2B;IACrD,OAAO,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAA2B;IACtD,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,EAA2B;IACtD,OAAO,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,EAAyB,EAAE,EAAmB;IAC3E,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QACpB,WAAW,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;KACzB;SAAM,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QAC3B,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,GAAG,EAAE;YAC1B,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACxB;KACF;SAAM,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE;QAC1B,KAAK,MAAM,KAAK,IAAI,EAAE,CAAC,EAAE,EAAE;YACzB,WAAW,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;SACxB;KACF;SAAM;QACL,EAAE,CAAC,EAAE,CAAC,CAAC;KACR;AACH,CAAC;AAED,MAAM,UAAU,2BAA2B,CACzC,EAAyB,EACzB,UAAuB;IAEvB,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QACpB,OAAO,EAAC,GAAG,EAAE,2BAA2B,CAAC,EAAE,CAAC,GAAG,EAAE,UAAU,CAAC,EAAC,CAAC;KAC/D;SAAM,IAAI,YAAY,CAAC,EAAE,CAAC,EAAE;QAC3B,OAAO,EAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAC,CAAC;KAC3E;SAAM,IAAI,WAAW,CAAC,EAAE,CAAC,EAAE;QAC1B,OAAO,EAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,EAAC,CAAC;KACzE;SAAM;QACL,OAAO,UAAU,CAAC,EAAE,CAAC,CAAC;KACvB;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/mark.d.ts b/build/src/mark.d.ts new file mode 100644 index 0000000000..28d3896c4f --- /dev/null +++ b/build/src/mark.d.ts @@ -0,0 +1,476 @@ +import { Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline } from 'vega'; +import { CompositeMark, CompositeMarkDef } from './compositemark'; +import { ExprRef } from './expr'; +import { MapExcludeValueRefAndReplaceSignalWith } from './vega.schema'; +/** + * All types of primitive marks. + */ +export declare const Mark: { + readonly arc: "arc"; + readonly area: "area"; + readonly bar: "bar"; + readonly image: "image"; + readonly line: "line"; + readonly point: "point"; + readonly rect: "rect"; + readonly rule: "rule"; + readonly text: "text"; + readonly tick: "tick"; + readonly trail: "trail"; + readonly circle: "circle"; + readonly square: "square"; + readonly geoshape: "geoshape"; +}; +export declare const ARC: "arc"; +export declare const AREA: "area"; +export declare const BAR: "bar"; +export declare const IMAGE: "image"; +export declare const LINE: "line"; +export declare const POINT: "point"; +export declare const RECT: "rect"; +export declare const RULE: "rule"; +export declare const TEXT: "text"; +export declare const TICK: "tick"; +export declare const TRAIL: "trail"; +export declare const CIRCLE: "circle"; +export declare const SQUARE: "square"; +export declare const GEOSHAPE: "geoshape"; +export type Mark = keyof typeof Mark; +export declare function isMark(m: string): m is Mark; +export declare function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail'; +export declare function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc'; +export declare const PRIMITIVE_MARKS: Set<"square" | "area" | "circle" | "image" | "line" | "rect" | "text" | "point" | "arc" | "rule" | "trail" | "geoshape" | "bar" | "tick">; +export interface ColorMixins { + /** + * Default color. + * + * __Default value:__ `"#4682b4"` + * + * __Note:__ + * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). + * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`. + */ + color?: Color | Gradient | ES; +} +export interface TooltipContent { + content: 'encoding' | 'data'; +} +/** @hidden */ +export type Hide = 'hide'; +export interface MarkInvalidMixins { + /** + * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`). + * - If set to `"filter"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks). + * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes. + */ + invalid?: 'filter' | Hide | null; +} +export interface VLOnlyMarkConfig extends ColorMixins, MarkInvalidMixins { + /** + * Whether the mark's color should be used as fill color instead of stroke color. + * + * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`. + * + * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config). + * + */ + filled?: boolean; + /** + * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources. + */ + order?: null | boolean; + /** + * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step. + * If set to `0.5`, the marks will be positioned in the middle of the time unit band step. + */ + timeUnitBandPosition?: number; + /** + * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step. + * If set to `0.5`, bandwidth of the marks will be half of the time unit band step. + */ + timeUnitBandSize?: number; + /** + * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise. + */ + theta2?: number | ES; + /** + * The secondary (inner) radius in pixels of arc marks. + * + * __Default value:__ `0` + * @minimum 0 + */ + radius2?: number | ES; +} +export interface MarkConfig extends VLOnlyMarkConfig, MapExcludeValueRefAndReplaceSignalWith, ES> { + /** + * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from. + * + * - If `tooltip` is `true` or `{"content": "encoding"}`, then all fields from `encoding` will be used. + * - If `tooltip` is `{"content": "data"}`, then all fields that appear in the highlighted data point will be used. + * - If set to `null` or `false`, then no tooltip will be used. + * + * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite. + * + * __Default value:__ `null` + */ + tooltip?: number | string | boolean | TooltipContent | ES | null; + /** + * Default size for marks. + * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value. + * - For `bar`, this represents the band size of the bar, in pixels. + * - For `text`, this represents the font size, in pixels. + * + * __Default value:__ + * - `30` for point, circle, square marks; width/height's `step` + * - `2` for bar marks with discrete dimensions; + * - `5` for bar marks with continuous dimensions; + * - `11` for text marks. + * + * @minimum 0 + */ + size?: number | ES; + /** + * X coordinates of the marks, or width of horizontal `"bar"` and `"area"` without specified `x2` or `width`. + * + * The `value` of this channel can be a number or a string `"width"` for the width of the plot. + */ + x?: number | 'width' | ES; + /** + * Y coordinates of the marks, or height of vertical `"bar"` and `"area"` without specified `y2` or `height`. + * + * The `value` of this channel can be a number or a string `"height"` for the height of the plot. + */ + y?: number | 'height' | ES; + /** + * X2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + * + * The `value` of this channel can be a number or a string `"width"` for the width of the plot. + */ + x2?: number | 'width' | ES; + /** + * Y2 coordinates for ranged `"area"`, `"bar"`, `"rect"`, and `"rule"`. + * + * The `value` of this channel can be a number or a string `"height"` for the height of the plot. + */ + y2?: number | 'height' | ES; + /** + * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill. + * + * __Default value:__ (None) + * + */ + fill?: Color | Gradient | null | ES; + /** + * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke. + * + * __Default value:__ (None) + * + */ + stroke?: Color | Gradient | null | ES; + /** + * The overall opacity (value between [0,1]). + * + * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise. + * + * @minimum 0 + * @maximum 1 + */ + opacity?: number | ES; + /** + * The orientation of a non-stacked bar, tick, area, and line charts. + * The value is either horizontal (default) or vertical. + * - For bar, rule and tick, this determines whether the size of the bar and tick + * should be applied to x or y dimension. + * - For area, this property determines the orient property of the Vega output. + * - For line and trail marks, this property determines the sort order of the points in the line + * if `config.sortLineBy` is not specified. + * For stacked charts, this is always determined by the orientation of the stack; + * therefore explicitly specified value will be ignored. + */ + orient?: Orientation; + /** + * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `"left"`, `"right"`, `"center"`. + * + * __Note:__ Expression reference is *not* supported for range marks. + */ + align?: Align | ES; + /** + * For text marks, the vertical text baseline. One of `"alphabetic"` (default), `"top"`, `"middle"`, `"bottom"`, `"line-top"`, `"line-bottom"`, or an expression reference that provides one of the valid values. + * The `"line-top"` and `"line-bottom"` values operate similarly to `"top"` and `"bottom"`, + * but are calculated relative to the `lineHeight` rather than `fontSize` alone. + * + * For range marks, the vertical alignment of the marks. One of `"top"`, `"middle"`, `"bottom"`. + * + * __Note:__ Expression reference is *not* supported for range marks. + * + */ + baseline?: TextBaseline | ES; + /** + * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.) + * + * - For text marks, polar coordinate angle in radians. + * + * @minimum 0 + * @maximum 360 + */ + theta?: number | ES; + /** + * + * For arc mark, the primary (outer) radius in pixels. + * + * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties. + * + * __Default value:__ `min(plot_width, plot_height)/2` + * @minimum 0 + */ + radius?: number | ES; + /** + * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`. + * + * __Default value:__ `0` + * @minimum 0 + */ + innerRadius?: number | ES; + /** + * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`. + * + * __Default value:__ `0` + * @minimum 0 + */ + outerRadius?: number | ES; +} +export interface RectBinSpacingMixins { + /** + * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style). + * + * __Default value:__ `1` + * + * @minimum 0 + */ + binSpacing?: number; +} +export type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef; +export declare function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef; +export declare function isPrimitiveMark(mark: AnyMark): mark is Mark; +export declare const STROKE_CONFIG: readonly ["stroke", "strokeWidth", "strokeDash", "strokeDashOffset", "strokeOpacity", "strokeJoin", "strokeMiterLimit"]; +export declare const FILL_CONFIG: readonly ["fill", "fillOpacity"]; +export declare const FILL_STROKE_CONFIG: ("fill" | "stroke" | "fillOpacity" | "strokeOpacity" | "strokeWidth" | "strokeDash" | "strokeDashOffset" | "strokeJoin" | "strokeMiterLimit")[]; +export declare const VL_ONLY_MARK_CONFIG_PROPERTIES: (keyof VLOnlyMarkConfig)[]; +export declare const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: { + [k in Mark]?: (keyof Required>[k])[]; +}; +export declare const defaultMarkConfig: MarkConfig; +export type AnyMarkConfig = MarkConfig | AreaConfig | BarConfig | RectConfig | LineConfig | TickConfig; +export interface MarkConfigMixins { + /** Mark Config */ + mark?: MarkConfig; + /** Arc-specific Config */ + arc?: RectConfig; + /** Area-Specific Config */ + area?: AreaConfig; + /** Bar-Specific Config */ + bar?: BarConfig; + /** Circle-Specific Config */ + circle?: MarkConfig; + /** Image-specific Config */ + image?: RectConfig; + /** Line-Specific Config */ + line?: LineConfig; + /** Point-Specific Config */ + point?: MarkConfig; + /** Rect-Specific Config */ + rect?: RectConfig; + /** Rule-Specific Config */ + rule?: MarkConfig; + /** Square-Specific Config */ + square?: MarkConfig; + /** Text-Specific Config */ + text?: MarkConfig; + /** Tick-Specific Config */ + tick?: TickConfig; + /** Trail-Specific Config */ + trail?: LineConfig; + /** Geoshape-Specific Config */ + geoshape?: MarkConfig; +} +export declare const MARK_CONFIGS: (keyof MarkConfigMixins)[]; +export interface RectConfig extends RectBinSpacingMixins, MarkConfig { + /** + * The default size of the bars on continuous scales. + * + * __Default value:__ `5` + * + * @minimum 0 + */ + continuousBandSize?: number; + /** + * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars. + * @minimum 0 + */ + discreteBandSize?: number | RelativeBandSize; + /** + * The minimum band size for bar and rectangle marks. + * __Default value:__ `0.25` + */ + minBandSize?: number | ES; +} +export type BandSize = number | RelativeBandSize | SignalRef; +export interface RelativeBandSize { + /** + * The relative band size. For example `0.5` means half of the band scale's band width. + */ + band: number; +} +export declare function isRelativeBandSize(o: number | RelativeBandSize | ExprRef | SignalRef): o is RelativeBandSize; +export declare const BAR_CORNER_RADIUS_INDEX: Partial>; +export interface BarCornerRadiusMixins { + /** + * - For vertical bars, top-left and top-right corner radius. + * + * - For horizontal bars, top-right and bottom-right corner radius. + */ + cornerRadiusEnd?: number | ES; +} +export type BarConfig = RectConfig & BarCornerRadiusMixins; +export type OverlayMarkDef = MarkConfig & MarkDefMixins; +export interface PointOverlayMixins { + /** + * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points. + * + * - If this property is `"transparent"`, transparent points will be used (for enhancing tooltips and selections). + * + * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used. + * + * - If this property is `false`, no points would be automatically added to line or area marks. + * + * __Default value:__ `false`. + */ + point?: boolean | OverlayMarkDef | 'transparent'; +} +export interface LineConfig extends MarkConfig, PointOverlayMixins { +} +export interface LineOverlayMixins { + /** + * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines. + * + * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used. + * + * - If this value is `false`, no lines would be automatically added to area marks. + * + * __Default value:__ `false`. + */ + line?: boolean | OverlayMarkDef; +} +export interface AreaConfig extends MarkConfig, PointOverlayMixins, LineOverlayMixins { +} +export interface TickThicknessMixins { + /** + * Thickness of the tick mark. + * + * __Default value:__ `1` + * + * @minimum 0 + */ + thickness?: number | SignalRef; +} +export interface GenericMarkDef { + /** + * The mark type. This could a primitive mark type + * (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, + * `"area"`, `"point"`, `"geoshape"`, `"rule"`, and `"text"`) + * or a composite mark type (`"boxplot"`, `"errorband"`, `"errorbar"`). + */ + type: M; +} +export interface MarkDefMixins { + /** + * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default. + * + * __Default value:__ The mark's name. For example, a bar mark will have style `"bar"` by default. + * __Note:__ Any specified style will augment the default style. For example, a bar mark with `"style": "foo"` will receive from `config.style.bar` and `config.style.foo` (the specified style `"foo"` has higher precedence). + */ + style?: string | string[]; + /** + * Whether a mark be clipped to the enclosing group’s width and height. + */ + clip?: boolean; + /** + * Offset for x-position. + */ + xOffset?: number | ES; + /** + * Offset for y-position. + */ + yOffset?: number | ES; + /** + * Offset for x2-position. + */ + x2Offset?: number | ES; + /** + * Offset for y2-position. + */ + y2Offset?: number | ES; + /** + * Offset for theta. + */ + thetaOffset?: number | ES; + /** + * Offset for theta2. + */ + theta2Offset?: number | ES; + /** + * Offset for radius. + */ + radiusOffset?: number | ES; + /** + * Offset for radius2. + */ + radius2Offset?: number | ES; +} +export interface RelativeBandSize { + /** + * The relative band size. For example `0.5` means half of the band scale's band width. + */ + band: number; +} +export interface MarkDef extends GenericMarkDef, Omit & AreaConfig & BarConfig & // always extends RectConfig +LineConfig & TickConfig, 'startAngle' | 'endAngle' | 'width' | 'height'>, MarkDefMixins { + /** + * @hidden + */ + startAngle?: number | ES; + /** + * @hidden + */ + endAngle?: number | ES; + /** + * Width of the marks. One of: + * + * - A number representing a fixed pixel width. + * + * - A relative band size definition. For example, `{band: 0.5}` represents half of the band. + */ + width?: number | ES | RelativeBandSize; + /** + * Height of the marks. One of: + * + * - A number representing a fixed pixel height. + * + * - A relative band size definition. For example, `{band: 0.5}` represents half of the band + */ + height?: number | ES | RelativeBandSize; +} +export declare const defaultBarConfig: RectConfig; +export declare const defaultRectConfig: RectConfig; +export interface TickConfig extends MarkConfig, TickThicknessMixins { + /** + * The width of the ticks. + * + * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks). + * @minimum 0 + */ + bandSize?: number; +} +export declare const defaultTickConfig: TickConfig; +export declare function getMarkType(m: string | GenericMarkDef): any; +//# sourceMappingURL=mark.d.ts.map \ No newline at end of file diff --git a/build/src/mark.d.ts.map b/build/src/mark.d.ts.map new file mode 100644 index 0000000000..beaa95d709 --- /dev/null +++ b/build/src/mark.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mark.d.ts","sourceRoot":"","sources":["../../src/mark.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,IAAI,YAAY,EAAE,WAAW,EAAE,SAAS,EAAE,YAAY,EAAC,MAAM,MAAM,CAAC;AAC9G,OAAO,EAAC,aAAa,EAAE,gBAAgB,EAAC,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAC,sCAAsC,EAAC,MAAM,eAAe,CAAC;AAErE;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;CAeP,CAAC;AAEX,eAAO,MAAM,GAAG,OAAW,CAAC;AAC5B,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,GAAG,OAAW,CAAC;AAC5B,eAAO,MAAM,KAAK,SAAa,CAAC;AAChC,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,KAAK,SAAa,CAAC;AAChC,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,IAAI,QAAY,CAAC;AAC9B,eAAO,MAAM,KAAK,SAAa,CAAC;AAChC,eAAO,MAAM,MAAM,UAAc,CAAC;AAClC,eAAO,MAAM,MAAM,UAAc,CAAC;AAClC,eAAO,MAAM,QAAQ,YAAgB,CAAC;AAEtC,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,IAAI,CAAC;AAErC,wBAAgB,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,IAAI,CAE3C;AAED,wBAAgB,UAAU,CAAC,CA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,MAAM,GAAG,IAAI,GAAG,IAAI,EAAE,EAAE,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAC3G,SAAQ,cAAc,CAAC,CAAC,CAAC,EACvB,IAAI,CACF,UAAU,CAAC,EAAE,CAAC,GACZ,UAAU,CAAC,EAAE,CAAC,GACd,SAAS,CAAC,EAAE,CAAC,GAAG,4BAA4B;AAC5C,UAAU,CAAC,EAAE,CAAC,GACd,UAAU,CAAC,EAAE,CAAC,EAChB,YAAY,GAAG,UAAU,GAAG,OAAO,GAAG,QAAQ,CAC/C,EACD,aAAa,CAAC,EAAE,CAAC;IAInB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IACzB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAIvB;;;;;;OAMG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,gBAAgB,CAAC;IAEvC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,GAAG,EAAE,GAAG,gBAAgB,CAAC;CACzC;AAID,eAAO,MAAM,gBAAgB,EAAE,UAAU,CAAC,SAAS,CAKlD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,SAAS,CAKnD,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS,CAAE,SAAQ,UAAU,CAAC,EAAE,CAAC,EAAE,mBAAmB;IACrG;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,iBAAiB,EAAE,UAAU,CAAC,SAAS,CAEnD,CAAC;AAEF,wBAAgB,WAAW,CAAC,CAAC,EAAE,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,OAE1D"} \ No newline at end of file diff --git a/build/src/mark.js b/build/src/mark.js new file mode 100644 index 0000000000..1a7038dd4d --- /dev/null +++ b/build/src/mark.js @@ -0,0 +1,130 @@ +import { keys } from './util'; +/** + * All types of primitive marks. + */ +export const Mark = { + arc: 'arc', + area: 'area', + bar: 'bar', + image: 'image', + line: 'line', + point: 'point', + rect: 'rect', + rule: 'rule', + text: 'text', + tick: 'tick', + trail: 'trail', + circle: 'circle', + square: 'square', + geoshape: 'geoshape' +}; +export const ARC = Mark.arc; +export const AREA = Mark.area; +export const BAR = Mark.bar; +export const IMAGE = Mark.image; +export const LINE = Mark.line; +export const POINT = Mark.point; +export const RECT = Mark.rect; +export const RULE = Mark.rule; +export const TEXT = Mark.text; +export const TICK = Mark.tick; +export const TRAIL = Mark.trail; +export const CIRCLE = Mark.circle; +export const SQUARE = Mark.square; +export const GEOSHAPE = Mark.geoshape; +export function isMark(m) { + return m in Mark; +} +export function isPathMark(m) { + return ['line', 'area', 'trail'].includes(m); +} +export function isRectBasedMark(m) { + return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m); +} +export const PRIMITIVE_MARKS = new Set(keys(Mark)); +export function isMarkDef(mark) { + return mark['type']; +} +export function isPrimitiveMark(mark) { + const markType = isMarkDef(mark) ? mark.type : mark; + return PRIMITIVE_MARKS.has(markType); +} +export const STROKE_CONFIG = [ + 'stroke', + 'strokeWidth', + 'strokeDash', + 'strokeDashOffset', + 'strokeOpacity', + 'strokeJoin', + 'strokeMiterLimit' +]; +export const FILL_CONFIG = ['fill', 'fillOpacity']; +export const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG]; +const VL_ONLY_MARK_CONFIG_INDEX = { + color: 1, + filled: 1, + invalid: 1, + order: 1, + radius2: 1, + theta2: 1, + timeUnitBandSize: 1, + timeUnitBandPosition: 1 +}; +export const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); +export const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { + area: ['line', 'point'], + bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'], + rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'], + line: ['point'], + tick: ['bandSize', 'thickness'] +}; +export const defaultMarkConfig = { + color: '#4c78a8', + invalid: 'filter', + timeUnitBandSize: 1 +}; +const MARK_CONFIG_INDEX = { + mark: 1, + arc: 1, + area: 1, + bar: 1, + circle: 1, + image: 1, + line: 1, + point: 1, + rect: 1, + rule: 1, + square: 1, + text: 1, + tick: 1, + trail: 1, + geoshape: 1 +}; +export const MARK_CONFIGS = keys(MARK_CONFIG_INDEX); +export function isRelativeBandSize(o) { + return o && o['band'] != undefined; +} +export const BAR_CORNER_RADIUS_INDEX = { + horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], + vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] +}; +const DEFAULT_RECT_BAND_SIZE = 5; +export const defaultBarConfig = { + binSpacing: 1, + continuousBandSize: DEFAULT_RECT_BAND_SIZE, + minBandSize: 0.25, + timeUnitBandPosition: 0.5 +}; +export const defaultRectConfig = { + binSpacing: 0, + continuousBandSize: DEFAULT_RECT_BAND_SIZE, + minBandSize: 0.25, + timeUnitBandPosition: 0.5 +}; +export const defaultTickConfig = { + thickness: 1 +}; +export function getMarkType(m) { + return isMarkDef(m) ? m.type : m; +} +//# sourceMappingURL=mark.js.map \ No newline at end of file diff --git a/build/src/mark.js.map b/build/src/mark.js.map new file mode 100644 index 0000000000..70fa5a2ed5 --- /dev/null +++ b/build/src/mark.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mark.js","sourceRoot":"","sources":["../../src/mark.ts"],"names":[],"mappings":"AAGA,OAAO,EAAO,IAAI,EAAC,MAAM,QAAQ,CAAC;AAGlC;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,KAAK,EAAE,OAAO;IACd,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,IAAI,EAAE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,MAAM,gBAAgB,GAA0B;IACrD,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,sBAAsB;IAC1C,WAAW,EAAE,IAAI;IACjB,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAA0B;IACtD,UAAU,EAAE,CAAC;IACb,kBAAkB,EAAE,sBAAsB;IAC1C,WAAW,EAAE,IAAI;IACjB,oBAAoB,EAAE,GAAG;CAC1B,CAAC;AAYF,MAAM,CAAC,MAAM,iBAAiB,GAA0B;IACtD,SAAS,EAAE,CAAC;CACb,CAAC;AAEF,MAAM,UAAU,WAAW,CAAC,CAA+B;IACzD,OAAO,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/base.d.ts b/build/src/normalize/base.d.ts new file mode 100644 index 0000000000..494b959f8d --- /dev/null +++ b/build/src/normalize/base.d.ts @@ -0,0 +1,35 @@ +import type { SignalRef } from 'vega'; +import { FieldName } from '../channeldef'; +import { Config } from '../config'; +import { Encoding } from '../encoding'; +import { ParameterPredicate } from '../predicate'; +import { ExprRef } from '../expr'; +import { Projection } from '../projection'; +import { TopLevelSelectionParameter } from '../selection'; +import { GenericSpec, NormalizedSpec } from '../spec'; +import { GenericLayerSpec, NormalizedLayerSpec } from '../spec/layer'; +import { GenericUnitSpec, NormalizedUnitSpec } from '../spec/unit'; +import { Dict } from '../util'; +import { RepeaterValue } from './repeater'; +export type Normalize, NS extends NormalizedSpec> = (spec: S, params: NormalizerParams) => NS; +export interface ExtraNormalizer, // Input type +O extends NormalizedSpec, // Output Type +SN extends GenericSpec = S> { + name: string; + hasMatchingType: (spec: GenericSpec, config: Config) => spec is S; + run(spec: S, params: NormalizerParams, normalize: Normalize): O; +} +export type NonFacetUnitNormalizer> = ExtraNormalizer | GenericLayerSpec>; +export type NormalizeLayerOrUnit = Normalize | GenericLayerSpec, NormalizedUnitSpec | NormalizedLayerSpec>; +export interface NormalizerParams { + config: Config; + parentEncoding?: Encoding; + parentProjection?: Projection; + repeater?: RepeaterValue; + repeaterPrefix?: string; + selections?: TopLevelSelectionParameter[]; + emptySelections?: Dict; + selectionPredicates?: Dict; + path?: string[]; +} +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/base.d.ts.map b/build/src/normalize/base.d.ts.map new file mode 100644 index 0000000000..709ae83a26 --- /dev/null +++ b/build/src/normalize/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/normalize/base.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AACpC,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAChD,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,0BAA0B,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,SAAS,CAAC;AACpD,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AACpE,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,cAAc,CAAC;AACjE,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,aAAa,EAAC,MAAM,YAAY,CAAC;AAEzC,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,EAAE,SAAS,cA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Aa,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC1C,eAAe,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChC,mBAAmB,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,CAAC,CAAC;IACjD,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;CACjB"} \ No newline at end of file diff --git a/build/src/normalize/base.js b/build/src/normalize/base.js new file mode 100644 index 0000000000..880caea8fb --- /dev/null +++ b/build/src/normalize/base.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/build/src/normalize/base.js.map b/build/src/normalize/base.js.map new file mode 100644 index 0000000000..64c6ea736c --- /dev/null +++ b/build/src/normalize/base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/normalize/base.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/src/normalize/core.d.ts b/build/src/normalize/core.d.ts new file mode 100644 index 0000000000..299e51479f --- /dev/null +++ b/build/src/normalize/core.d.ts @@ -0,0 +1,24 @@ +import { Field, FieldName } from '../channeldef'; +import { FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec } from '../spec'; +import { GenericConcatSpec } from '../spec/concat'; +import { GenericFacetSpec, NormalizedFacetSpec } from '../spec/facet'; +import { NormalizedSpec } from '../spec/index'; +import { NormalizedLayerSpec } from '../spec/layer'; +import { SpecMapper } from '../spec/map'; +import { RepeatSpec } from '../spec/repeat'; +import { NormalizedUnitSpec } from '../spec/unit'; +import { NormalizerParams } from './base'; +export declare class CoreNormalizer extends SpecMapper, LayerSpec> { + private nonFacetUnitNormalizers; + map(spec: GenericSpec, LayerSpec, RepeatSpec, Field>, params: NormalizerParams): NormalizedUnitSpec | NormalizedFacetSpec | import("../spec").GenericLayerSpec | GenericConcatSpec, never, string>> | import("../spec").GenericVConcatSpec, never, string>> | import("../spec").GenericHConcatSpec, never, string>>; + mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec; + protected mapRepeat(spec: RepeatSpec, params: NormalizerParams): GenericConcatSpec | NormalizedLayerSpec; + private mapLayerRepeat; + private mapNonLayerRepeat; + protected mapFacet(spec: GenericFacetSpec, LayerSpec, Field>, params: NormalizerParams): GenericFacetSpec; + private mapUnitWithParentEncodingOrProjection; + private mapFacetedUnit; + private getFacetMappingAndLayout; + mapLayer(spec: LayerSpec, { parentEncoding, parentProjection, ...otherParams }: NormalizerParams): NormalizedLayerSpec; +} +//# sourceMappingURL=core.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/core.d.ts.map b/build/src/normalize/core.d.ts.map new file mode 100644 index 0000000000..10970434f8 --- /dev/null +++ b/build/src/normalize/core.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"core.d.ts","sourceRoot":"","sources":["../../../src/normalize/core.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAE,SAAS,EAA+D,MAAM,eAAe,CAAC;AAS7G,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AAE1E,OAAO,EAAC,iBAAiB,EAAC,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAIL,gBAAgB,EAEhB,mBAAmB,EACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,cAAc,EAAC,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAyD,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAa,kBAAkB,EAAC,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAyB,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAKhE,qBAAa,cAAe,SAAQ,UAAU,CAAC,gBAAgB,EAAE,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC;IACxG,OAAO,CAAC,uBAAuB,CAM7B;IAEK,GAAG,CAAC,IAAI,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,gBAAgB;IAgB5G,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,mBAAmB;IA0BzG,SAAS,CAAC,SAAS,CACjB,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,gBAAgB,GACvB,iBAAiB,CAAC,cAAc,CAAC,GAAG,mBAAmB;IAQ1D,OAAO,CAAC,cAAc;IA8CtB,OAAO,CAAC,iBAAiB;IAyDzB,SAAS,CAAC,QAAQ,CAChB,IAAI,EAAE,gBAAgB,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC,EAChE,MAAM,EAAE,gBAAgB,GACvB,gBAAgB,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,SAAS,CAAC;IAYvE,OAAO,CAAC,qCAAqC;IAsB7C,OAAO,CAAC,cAAc;IAiCtB,OAAO,CAAC,wBAAwB;IAgDzB,QAAQ,CACb,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,EACtB,EAAC,cAAc,EAAE,gBAAgB,EAAE,GAAG,WAAW,EAAC,EAAE,gBAAgB,GACnE,mBAAmB;CAiBvB"} \ No newline at end of file diff --git a/build/src/normalize/core.js b/build/src/normalize/core.js new file mode 100644 index 0000000000..42c78d75d5 --- /dev/null +++ b/build/src/normalize/core.js @@ -0,0 +1,293 @@ +import { isArray } from 'vega-util'; +import { COLUMN, FACET, ROW } from '../channel'; +import { hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef } from '../channeldef'; +import { boxPlotNormalizer } from '../compositemark/boxplot'; +import { errorBandNormalizer } from '../compositemark/errorband'; +import { errorBarNormalizer } from '../compositemark/errorbar'; +import { channelHasField } from '../encoding'; +import * as log from '../log'; +import { isFacetMapping } from '../spec/facet'; +import { SpecMapper } from '../spec/map'; +import { isLayerRepeatSpec } from '../spec/repeat'; +import { isUnitSpec } from '../spec/unit'; +import { isEmpty, keys, omit, varName } from '../util'; +import { isSignalRef } from '../vega.schema'; +import { PathOverlayNormalizer } from './pathoverlay'; +import { replaceRepeaterInEncoding, replaceRepeaterInFacet } from './repeater'; +import { RuleForRangedLineNormalizer } from './ruleforrangedline'; +export class CoreNormalizer extends SpecMapper { + constructor() { + super(...arguments); + this.nonFacetUnitNormalizers = [ + boxPlotNormalizer, + errorBarNormalizer, + errorBandNormalizer, + new PathOverlayNormalizer(), + new RuleForRangedLineNormalizer() + ]; + } + map(spec, params) { + // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. + if (isUnitSpec(spec)) { + const hasRow = channelHasField(spec.encoding, ROW); + const hasColumn = channelHasField(spec.encoding, COLUMN); + const hasFacet = channelHasField(spec.encoding, FACET); + if (hasRow || hasColumn || hasFacet) { + return this.mapFacetedUnit(spec, params); + } + } + return super.map(spec, params); + } + // This is for normalizing non-facet unit + mapUnit(spec, params) { + const { parentEncoding, parentProjection } = params; + const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); + const specWithReplacedEncoding = { + ...spec, + ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {}), + ...(encoding ? { encoding } : {}) + }; + if (parentEncoding || parentProjection) { + return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); + } + const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); + for (const unitNormalizer of this.nonFacetUnitNormalizers) { + if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { + return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); + } + } + return specWithReplacedEncoding; + } + mapRepeat(spec, params) { + if (isLayerRepeatSpec(spec)) { + return this.mapLayerRepeat(spec, params); + } + else { + return this.mapNonLayerRepeat(spec, params); + } + } + mapLayerRepeat(spec, params) { + const { repeat, spec: childSpec, ...rest } = spec; + const { row, column, layer } = repeat; + const { repeater = {}, repeaterPrefix = '' } = params; + if (row || column) { + return this.mapRepeat({ + ...spec, + repeat: { + ...(row ? { row } : {}), + ...(column ? { column } : {}) + }, + spec: { + repeat: { layer }, + spec: childSpec + } + }, params); + } + else { + return { + ...rest, + layer: layer.map(layerValue => { + const childRepeater = { + ...repeater, + layer: layerValue + }; + const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(layerValue)}`; + const child = this.mapLayerOrUnit(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName }); + child.name = childName; + return child; + }) + }; + } + } + mapNonLayerRepeat(spec, params) { + const { repeat, spec: childSpec, data, ...remainingProperties } = spec; + if (!isArray(repeat) && spec.columns) { + // is repeat with row/column + spec = omit(spec, ['columns']); + log.warn(log.message.columnsNotSupportByRowCol('repeat')); + } + const concat = []; + const { repeater = {}, repeaterPrefix = '' } = params; + const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null]; + const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null]; + const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null]; + // cross product + for (const repeatValue of repeatValues) { + for (const rowValue of row) { + for (const columnValue of column) { + const childRepeater = { + repeat: repeatValue, + row: rowValue, + column: columnValue, + layer: repeater.layer + }; + const childName = (childSpec.name ? `${childSpec.name}_` : '') + + repeaterPrefix + + 'child__' + + (isArray(repeat) + ? `${varName(repeatValue)}` + : (repeat.row ? `row_${varName(rowValue)}` : '') + + (repeat.column ? `column_${varName(columnValue)}` : '')); + const child = this.map(childSpec, { ...params, repeater: childRepeater, repeaterPrefix: childName }); + child.name = childName; + // we move data up + concat.push(omit(child, ['data'])); + } + } + } + const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; + return { + data: childSpec.data ?? data, + align: 'all', + ...remainingProperties, + columns, + concat + }; + } + mapFacet(spec, params) { + const { facet } = spec; + if (isFacetMapping(facet) && spec.columns) { + // is facet with row/column + spec = omit(spec, ['columns']); + log.warn(log.message.columnsNotSupportByRowCol('facet')); + } + return super.mapFacet(spec, params); + } + mapUnitWithParentEncodingOrProjection(spec, params) { + const { encoding, projection } = spec; + const { parentEncoding, parentProjection, config } = params; + const mergedProjection = mergeProjection({ parentProjection, projection }); + const mergedEncoding = mergeEncoding({ + parentEncoding, + encoding: replaceRepeaterInEncoding(encoding, params.repeater) + }); + return this.mapUnit({ + ...spec, + ...(mergedProjection ? { projection: mergedProjection } : {}), + ...(mergedEncoding ? { encoding: mergedEncoding } : {}) + }, { config }); + } + mapFacetedUnit(spec, normParams) { + // New encoding in the inside spec should not contain row / column + // as row/column should be moved to facet + const { row, column, facet, ...encoding } = spec.encoding; + // Mark and encoding should be moved into the inner spec + const { mark, width, projection, height, view, params, encoding: _, ...outerSpec } = spec; + const { facetMapping, layout } = this.getFacetMappingAndLayout({ row, column, facet }, normParams); + const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater); + return this.mapFacet({ + ...outerSpec, + ...layout, + // row / column has higher precedence than facet + facet: facetMapping, + spec: { + ...(width ? { width } : {}), + ...(height ? { height } : {}), + ...(view ? { view } : {}), + ...(projection ? { projection } : {}), + mark, + encoding: newEncoding, + ...(params ? { params } : {}) + } + }, normParams); + } + getFacetMappingAndLayout(facets, params) { + const { row, column, facet } = facets; + if (row || column) { + if (facet) { + log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])])); + } + const facetMapping = {}; + const layout = {}; + for (const channel of [ROW, COLUMN]) { + const def = facets[channel]; + if (def) { + const { align, center, spacing, columns, ...defWithoutLayout } = def; + facetMapping[channel] = defWithoutLayout; + for (const prop of ['align', 'center', 'spacing']) { + if (def[prop] !== undefined) { + layout[prop] ?? (layout[prop] = {}); + layout[prop][channel] = def[prop]; + } + } + } + } + return { facetMapping, layout }; + } + else { + const { align, center, spacing, columns, ...facetMapping } = facet; + return { + facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater), + layout: { + ...(align ? { align } : {}), + ...(center ? { center } : {}), + ...(spacing ? { spacing } : {}), + ...(columns ? { columns } : {}) + } + }; + } + } + mapLayer(spec, { parentEncoding, parentProjection, ...otherParams }) { + // Special handling for extended layer spec + const { encoding, projection, ...rest } = spec; + const params = { + ...otherParams, + parentEncoding: mergeEncoding({ parentEncoding, encoding, layer: true }), + parentProjection: mergeProjection({ parentProjection, projection }) + }; + return super.mapLayer({ + ...rest, + ...(spec.name ? { name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') } : {}) + }, params); + } +} +function mergeEncoding({ parentEncoding, encoding = {}, layer }) { + let merged = {}; + if (parentEncoding) { + const channels = new Set([...keys(parentEncoding), ...keys(encoding)]); + for (const channel of channels) { + const channelDef = encoding[channel]; + const parentChannelDef = parentEncoding[channel]; + if (isFieldOrDatumDef(channelDef)) { + // Field/Datum Def can inherit properties from its parent + // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. + const mergedChannelDef = { + ...parentChannelDef, + ...channelDef + }; + merged[channel] = mergedChannelDef; + } + else if (hasConditionalFieldOrDatumDef(channelDef)) { + merged[channel] = { + ...channelDef, + condition: { + ...parentChannelDef, + ...channelDef.condition + } + }; + } + else if (channelDef || channelDef === null) { + merged[channel] = channelDef; + } + else if (layer || + isValueDef(parentChannelDef) || + isSignalRef(parentChannelDef) || + isFieldOrDatumDef(parentChannelDef) || + isArray(parentChannelDef)) { + merged[channel] = parentChannelDef; + } + } + } + else { + merged = encoding; + } + return !merged || isEmpty(merged) ? undefined : merged; +} +function mergeProjection(opt) { + const { parentProjection, projection } = opt; + if (parentProjection && projection) { + log.warn(log.message.projectionOverridden({ parentProjection, projection })); + } + return projection ?? parentProjection; +} +//# sourceMappingURL=core.js.map \ No newline at end of file diff --git a/build/src/normalize/core.js.map b/build/src/normalize/core.js.map new file mode 100644 index 0000000000..c424a88c49 --- /dev/null +++ b/build/src/normalize/core.js.map @@ -0,0 +1 @@ +{"version":3,"file":"core.js","sourceRoot":"","sources":["../../../src/normalize/core.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAC,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAmB,6BAA6B,EAAE,iBAAiB,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAE7G,OAAO,EAAC,iBAAiB,EAAC,MAAM,0BAA0B,CAAC;AAC3D,OAAO,EAAC,mBAAmB,EAAC,MAAM,4BAA4B,CAAC;AAC/D,OAAO,EAAC,kBAAkB,EAAC,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAC,eAAe,EAAW,MAAM,aAAa,CAAC;AAEtD,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAK9B,OAAO,EAKL,cAAc,EAEf,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,iBAAiB,EAAkD,MAAM,gBAAgB,CAAC;AAClG,OAAO,EAAC,UAAU,EAAqB,MAAM,cAAc,CAAC;AAC5D,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AACrD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,qBAAqB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,yBAAyB,EAAE,sBAAsB,EAAC,MAAM,YAAY,CAAC;AAC7E,OAAO,EAAC,2BAA2B,EAAC,MAAM,qBAAqB,CAAC;AAEhE,MAAM,OAAO,cAAe,SAAQ,UAAsE;IAA1G;;QACU,4BAAuB,GAAkC;YAC/D,iBA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B,EAAE,UAAU,EAAC,CAAC,CAAC,CAAC;KAC5E;IACD,OAAO,UAAU,IAAI,gBAAgB,CAAC;AACxC,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/index.d.ts b/build/src/normalize/index.d.ts new file mode 100644 index 0000000000..85c7ec3e17 --- /dev/null +++ b/build/src/normalize/index.d.ts @@ -0,0 +1,14 @@ +import type { SignalRef } from 'vega'; +import { Config } from '../config'; +import { LayoutSizeMixins, NormalizedSpec, TopLevelSpec } from '../spec'; +import { AutoSizeParams, AutosizeType, TopLevel } from '../spec/toplevel'; +import { NormalizerParams } from './base'; +export declare function normalize(spec: TopLevelSpec & LayoutSizeMixins, config?: Config): TopLevel & LayoutSizeMixins; +/** + * Normalize autosize and deal with width or height == "container". + */ +export declare function normalizeAutoSize(spec: TopLevel, sizeInfo: { + autosize: AutosizeType | AutoSizeParams; +} & LayoutSizeMixins, config?: Config): AutoSizeParams; +export type { NormalizerParams }; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/index.d.ts.map b/build/src/normalize/index.d.ts.map new file mode 100644 index 0000000000..2fee2bdd46 --- /dev/null +++ b/build/src/normalize/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/normalize/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAGpC,OAAO,EAAC,MAAM,EAAa,MAAM,WAAW,CAAC;AAE7C,OAAO,EAIL,gBAAgB,EAEhB,cAAc,EAEd,YAAY,EACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,cAAc,EAAE,YAAY,EAAE,QAAQ,EAAC,MAAM,kBAAkB,CAAC;AAExE,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAKxC,wBAAgB,SAAS,CACvB,IAAI,EAAE,YAAY,GAAG,gBAAgB,EACrC,MAAM,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,GACzB,QAAQ,CAAC,cAAc,CAAC,GAAG,gBAAgB,CAc7C;AAyBD;;GAEG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,EAC9B,QAAQ,EAAE;IAAC,QAAQ,EAAE,YAAY,GAAG,cAAc,CAAA;CAAC,GAAG,gBAAgB,EACtE,MAAM,CAAC,EAAE,MAAM,kBAwDhB;AAED,YAAY,EAAC,gBAAgB,EAAC,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/index.js b/build/src/normalize/index.js new file mode 100644 index 0000000000..e2fd757e86 --- /dev/null +++ b/build/src/normalize/index.js @@ -0,0 +1,90 @@ +import { isString } from 'vega-util'; +import { initConfig } from '../config'; +import * as log from '../log'; +import { isLayerSpec, isUnitSpec } from '../spec'; +import { deepEqual } from '../util'; +import { CoreNormalizer } from './core'; +import { SelectionCompatibilityNormalizer } from './selectioncompat'; +import { TopLevelSelectionsNormalizer } from './toplevelselection'; +export function normalize(spec, config) { + if (config === undefined) { + config = initConfig(spec.config); + } + const normalizedSpec = normalizeGenericSpec(spec, config); + const { width, height } = spec; + const autosize = normalizeAutoSize(normalizedSpec, { width, height, autosize: spec.autosize }, config); + return { + ...normalizedSpec, + ...(autosize ? { autosize } : {}) + }; +} +const coreNormalizer = new CoreNormalizer(); +const selectionCompatNormalizer = new SelectionCompatibilityNormalizer(); +const topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer(); +/** + * Decompose extended unit specs into composition of pure unit specs. + * And push top-level selection definitions down to unit specs. + */ +function normalizeGenericSpec(spec, config = {}) { + const normParams = { config }; + return topLevelSelectionNormalizer.map(coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams), normParams); +} +function _normalizeAutoSize(autosize) { + return isString(autosize) ? { type: autosize } : autosize ?? {}; +} +/** + * Normalize autosize and deal with width or height == "container". + */ +export function normalizeAutoSize(spec, sizeInfo, config) { + let { width, height } = sizeInfo; + const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); + const autosizeDefault = {}; + if (!isFitCompatible) { + // If spec is not compatible with autosize == "fit", discard width/height == container + if (width == 'container') { + log.warn(log.message.containerSizeNonSingle('width')); + width = undefined; + } + if (height == 'container') { + log.warn(log.message.containerSizeNonSingle('height')); + height = undefined; + } + } + else { + // Default autosize parameters to fit when width/height is "container" + if (width == 'container' && height == 'container') { + autosizeDefault.type = 'fit'; + autosizeDefault.contains = 'padding'; + } + else if (width == 'container') { + autosizeDefault.type = 'fit-x'; + autosizeDefault.contains = 'padding'; + } + else if (height == 'container') { + autosizeDefault.type = 'fit-y'; + autosizeDefault.contains = 'padding'; + } + } + const autosize = { + type: 'pad', + ...autosizeDefault, + ...(config ? _normalizeAutoSize(config.autosize) : {}), + ..._normalizeAutoSize(spec.autosize) + }; + if (autosize.type === 'fit' && !isFitCompatible) { + log.warn(log.message.FIT_NON_SINGLE); + autosize.type = 'pad'; + } + if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { + log.warn(log.message.containerSizeNotCompatibleWithAutosize('width')); + } + if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { + log.warn(log.message.containerSizeNotCompatibleWithAutosize('height')); + } + // Delete autosize property if it's Vega's default + if (deepEqual(autosize, { type: 'pad' })) { + return undefined; + } + return autosize; +} +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/normalize/index.js.map b/build/src/normalize/index.js.map new file mode 100644 index 0000000000..2a8d61f781 --- /dev/null +++ b/build/src/normalize/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/normalize/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAS,UAAU,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAEL,WAAW,EACX,UAAU,EAMX,MAAM,SAAS,CAAC;AAEjB,O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F;IAED,MAAM,QAAQ,GAAmB;QAC/B,IAAI,EAAE,KAAK;QACX,GAAG,eAAe;QAClB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,kBAAkB,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACtD,GAAG,kBAAkB,CAAC,IAAI,CAAC,QAAQ,CAAC;KACrC,CAAC;IAEF,IAAI,QAAQ,CAAC,IAAI,KAAK,KAAK,IAAI,CAAC,eAAe,EAAE;QAC/C,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC;QACrC,QAAQ,CAAC,IAAI,GAAG,KAAK,CAAC;KACvB;IAED,IAAI,KAAK,IAAI,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE;QACjF,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sCAAsC,CAAC,OAAO,CAAC,CAAC,CAAC;KACvE;IACD,IAAI,MAAM,IAAI,WAAW,IAAI,CAAC,CAAC,QAAQ,CAAC,IAAI,IAAI,KAAK,IAAI,QAAQ,CAAC,IAAI,IAAI,OAAO,CAAC,EAAE;QAClF,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,sCAAsC,CAAC,QAAQ,CAAC,CAAC,CAAC;KACxE;IAED,kDAAkD;IAClD,IAAI,SAAS,CAAC,QAAQ,EAAE,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,EAAE;QACtC,OAAO,SAAS,CAAC;KAClB;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/pathoverlay.d.ts b/build/src/normalize/pathoverlay.d.ts new file mode 100644 index 0000000000..37129391f0 --- /dev/null +++ b/build/src/normalize/pathoverlay.d.ts @@ -0,0 +1,13 @@ +import { Config } from '../config'; +import { Encoding } from '../encoding'; +import { Mark, MarkDef } from '../mark'; +import { GenericUnitSpec, NormalizedUnitSpec } from '../spec'; +import { NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams } from './base'; +type UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>; +export declare class PathOverlayNormalizer implements NonFacetUnitNormalizer { + name: string; + hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay; + run(spec: UnitSpecWithPathOverlay, normParams: NormalizerParams, normalize: NormalizeLayerOrUnit): NormalizedUnitSpec | import("../spec").NormalizedLayerSpec; +} +export {}; +//# sourceMappingURL=pathoverlay.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/pathoverlay.d.ts.map b/build/src/normalize/pathoverlay.d.ts.map new file mode 100644 index 0000000000..8a732b5dce --- /dev/null +++ b/build/src/normalize/pathoverlay.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pathoverlay.d.ts","sourceRoot":"","sources":["../../../src/normalize/pathoverlay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,QAAQ,EAAoB,MAAM,aAAa,CAAC;AAExD,OAAO,EAAoC,IAAI,EAAc,OAAO,EAAC,MAAM,SAAS,CAAC;AACrF,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,SAAS,CAAC;AAI5D,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAGtF,KAAK,uBAAuB,GAAG,eAAe,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,GAAG,OAAO,CAAC,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;AAkErH,qBAAa,qBAAsB,YAAW,sBAAsB,CAAC,uBAAuB,CAAC;IACpF,IAAI,SAAkB;IAEtB,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,GAAG,EAAE,IAAI,GAAG,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,IAAI,uBAAuB;IAoB5G,GAAG,CAAC,IAAI,EAAE,uBAAuB,EAAE,UAAU,EAAE,gBAAgB,EAAE,SAAS,EAAE,oBAAoB;CAwFxG"} \ No newline at end of file diff --git a/build/src/normalize/pathoverlay.js b/build/src/normalize/pathoverlay.js new file mode 100644 index 0000000000..53e81c4923 --- /dev/null +++ b/build/src/normalize/pathoverlay.js @@ -0,0 +1,162 @@ +import { isObject } from 'vega-util'; +import { normalizeEncoding } from '../encoding'; +import { isMarkDef } from '../mark'; +import { isUnitSpec } from '../spec/unit'; +import { stack } from '../stack'; +import { keys, omit, pick } from '../util'; +import { initMarkdef } from '../compile/mark/init'; +function dropLineAndPoint(markDef) { + const { point: _point, line: _line, ...mark } = markDef; + return keys(mark).length > 1 ? mark : mark.type; +} +function dropLineAndPointFromConfig(config) { + for (const mark of ['line', 'area', 'rule', 'trail']) { + if (config[mark]) { + config = { + ...config, + // TODO: remove as any + [mark]: omit(config[mark], ['point', 'line']) + }; + } + } + return config; +} +function getPointOverlay(markDef, markConfig = {}, encoding) { + if (markDef.point === 'transparent') { + return { opacity: 0 }; + } + else if (markDef.point) { + // truthy : true or object + return isObject(markDef.point) ? markDef.point : {}; + } + else if (markDef.point !== undefined) { + // false or null + return null; + } + else { + // undefined (not disabled) + if (markConfig.point || encoding.shape) { + // enable point overlay if config[mark].point is truthy or if encoding.shape is provided + return isObject(markConfig.point) ? markConfig.point : {}; + } + // markDef.point is defined as falsy + return undefined; + } +} +function getLineOverlay(markDef, markConfig = {}) { + if (markDef.line) { + // true or object + return markDef.line === true ? {} : markDef.line; + } + else if (markDef.line !== undefined) { + // false or null + return null; + } + else { + // undefined (not disabled) + if (markConfig.line) { + // enable line overlay if config[mark].line is truthy + return markConfig.line === true ? {} : markConfig.line; + } + // markDef.point is defined as falsy + return undefined; + } +} +export class PathOverlayNormalizer { + constructor() { + this.name = 'path-overlay'; + } + hasMatchingType(spec, config) { + if (isUnitSpec(spec)) { + const { mark, encoding } = spec; + const markDef = isMarkDef(mark) ? mark : { type: mark }; + switch (markDef.type) { + case 'line': + case 'rule': + case 'trail': + return !!getPointOverlay(markDef, config[markDef.type], encoding); + case 'area': + return ( + // false / null are also included as we want to remove the properties + !!getPointOverlay(markDef, config[markDef.type], encoding) || + !!getLineOverlay(markDef, config[markDef.type])); + } + } + return false; + } + run(spec, normParams, normalize) { + const { config } = normParams; + const { params, projection, mark, name, encoding: e, ...outerSpec } = spec; + // Need to call normalizeEncoding because we need the inferred types to correctly determine stack + const encoding = normalizeEncoding(e, config); + const markDef = isMarkDef(mark) ? mark : { type: mark }; + const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); + const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); + const layer = [ + { + name, + ...(params ? { params } : {}), + mark: dropLineAndPoint({ + // TODO: extract this 0.7 to be shared with default opacity for point/tick/... + ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined + ? { opacity: 0.7 } + : {}), + ...markDef + }), + // drop shape from encoding as this might be used to trigger point overlay + encoding: omit(encoding, ['shape']) + } + ]; + // FIXME: determine rules for applying selections. + // Need to copy stack config to overlayed layer + // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase. + const stackProps = stack(initMarkdef(markDef, encoding, config), encoding); + let overlayEncoding = encoding; + if (stackProps) { + const { fieldChannel: stackFieldChannel, offset } = stackProps; + overlayEncoding = { + ...encoding, + [stackFieldChannel]: { + ...encoding[stackFieldChannel], + ...(offset ? { stack: offset } : {}) + } + }; + } + // overlay line layer should be on the edge of area but passing y2/x2 makes + // it as "rule" mark so that it draws unwanted vertical/horizontal lines. + // point overlay also should not have y2/x2 as it does not support. + overlayEncoding = omit(overlayEncoding, ['y2', 'x2']); + if (lineOverlay) { + layer.push({ + ...(projection ? { projection } : {}), + mark: { + type: 'line', + ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']), + ...lineOverlay + }, + encoding: overlayEncoding + }); + } + if (pointOverlay) { + layer.push({ + ...(projection ? { projection } : {}), + mark: { + type: 'point', + opacity: 1, + filled: true, + ...pick(markDef, ['clip', 'tooltip']), + ...pointOverlay + }, + encoding: overlayEncoding + }); + } + return normalize({ + ...outerSpec, + layer + }, { + ...normParams, + config: dropLineAndPointFromConfig(config) + }); + } +} +//# sourceMappingURL=pathoverlay.js.map \ No newline at end of file diff --git a/build/src/normalize/pathoverlay.js.map b/build/src/normalize/pathoverlay.js.map new file mode 100644 index 0000000000..a8053e15bb --- /dev/null +++ b/build/src/normalize/pathoverlay.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pathoverlay.js","sourceRoot":"","sources":["../../../src/normalize/pathoverlay.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,EAAW,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAExD,OAAO,EAAa,SAAS,EAAwC,MAAM,SAAS,CAAC;AAErF,OAAO,EAAC,UAAU,EAAC,MAAM,cAAc,CAAC;AACxC,OAAO,EAAC,KAAK,EAAC,MAAM,UAAU,CAAC;AAC/B,OAAO,EAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,SAAS,CAAC;AAEzC,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAIjD,SAAS,gBAAgB,CAAC,OAAgB;IACxC,MAAM,EAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,IAAI,EAAC,GAAG,OAAO,CAAC;IAEtD,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;AAClD,CAAC;AAED,SAAS,0BAA0B,CAAC,MAAyB;IAC3D,KAAK,MAAM,IAAI,IAAI,CAAC,MAAM,EAAE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E,SAAS,CAAC,CAAC;oBACrC,GAAG,YAAY;iBAChB;gBACD,QAAQ,EAAE,eAAe;aAC1B,CAAC,CAAC;SACJ;QAED,OAAO,SAAS,CACd;YACE,GAAG,SAAS;YACZ,KAAK;SACN,EACD;YACE,GAAG,UAAU;YACb,MAAM,EAAE,0BAA0B,CAAC,MAAM,CAAC;SAC3C,CACF,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/normalize/repeater.d.ts b/build/src/normalize/repeater.d.ts new file mode 100644 index 0000000000..303fc8bd47 --- /dev/null +++ b/build/src/normalize/repeater.d.ts @@ -0,0 +1,12 @@ +import { Field, FieldName } from '../channeldef'; +import { Encoding } from '../encoding'; +import { FacetFieldDef, FacetMapping } from '../spec/facet'; +export interface RepeaterValue { + row?: string; + column?: string; + repeat?: string; + layer?: string; +} +export declare function replaceRepeaterInFacet(facet: FacetFieldDef | FacetMapping, repeater: RepeaterValue): FacetFieldDef | FacetMapping; +export declare function replaceRepeaterInEncoding>(encoding: E, repeater: RepeaterValue): Encoding; +//# sourceMappingURL=repeater.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/repeater.d.ts.map b/build/src/normalize/repeater.d.ts.map new file mode 100644 index 0000000000..df9d0d8d25 --- /dev/null +++ b/build/src/normalize/repeater.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"repeater.d.ts","sourceRoot":"","sources":["../../../src/normalize/repeater.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,EAEL,SAAS,EASV,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAiB,MAAM,eAAe,CAAC;AAE1E,MAAM,WAAW,aAAa;IAC5B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC,EACjD,QAAQ,EAAE,aAAa,GACtB,aAAa,CAAC,SAAS,CAAC,GAAG,YAAY,CAAC,SAAS,CAAC,CASpD;AAED,wBAAgB,yBAAyB,CAAC,CAAC,SAAS,QAAQ,CAAC,KAAK,CAAC,EACjE,QAAQ,EAAE,CAAC,EACX,QAAQ,EAAE,aAAa,GACtB,QAAQ,CAAC,SAAS,CAAC,CAMrB"} \ No newline at end of file diff --git a/build/src/normalize/repeater.js b/build/src/normalize/repeater.js new file mode 100644 index 0000000000..b92b73c539 --- /dev/null +++ b/build/src/normalize/repeater.js @@ -0,0 +1,119 @@ +import { hasOwnProperty, isArray } from 'vega-util'; +import { hasConditionalFieldOrDatumDef, isConditionalDef, isFieldDef, isFieldOrDatumDef, isRepeatRef, isSortableFieldDef } from '../channeldef'; +import * as log from '../log'; +import { isSortField } from '../sort'; +import { isFacetMapping } from '../spec/facet'; +export function replaceRepeaterInFacet(facet, repeater) { + if (!repeater) { + return facet; + } + if (isFacetMapping(facet)) { + return replaceRepeaterInMapping(facet, repeater); + } + return replaceRepeaterInFieldDef(facet, repeater); +} +export function replaceRepeaterInEncoding(encoding, repeater) { + if (!repeater) { + return encoding; + } + return replaceRepeaterInMapping(encoding, repeater); +} +/** + * Replaces repeated value and returns if the repeated value is valid. + */ +function replaceRepeatInProp(prop, o, repeater) { + const val = o[prop]; + if (isRepeatRef(val)) { + if (val.repeat in repeater) { + return { ...o, [prop]: repeater[val.repeat] }; + } + else { + log.warn(log.message.noSuchRepeatedValue(val.repeat)); + return undefined; + } + } + return o; +} +/** + * Replace repeater values in a field def with the concrete field name. + */ +function replaceRepeaterInFieldDef(fieldDef, repeater) { + fieldDef = replaceRepeatInProp('field', fieldDef, repeater); + if (fieldDef === undefined) { + // the field def should be ignored + return undefined; + } + else if (fieldDef === null) { + return null; + } + if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { + const sort = replaceRepeatInProp('field', fieldDef.sort, repeater); + fieldDef = { + ...fieldDef, + ...(sort ? { sort } : {}) + }; + } + return fieldDef; +} +function replaceRepeaterInFieldOrDatumDef(def, repeater) { + if (isFieldDef(def)) { + return replaceRepeaterInFieldDef(def, repeater); + } + else { + const datumDef = replaceRepeatInProp('datum', def, repeater); + if (datumDef !== def && !datumDef.type) { + datumDef.type = 'nominal'; + } + return datumDef; + } +} +function replaceRepeaterInChannelDef(channelDef, repeater) { + if (isFieldOrDatumDef(channelDef)) { + const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); + if (fd) { + return fd; + } + else if (isConditionalDef(channelDef)) { + return { condition: channelDef.condition }; + } + } + else { + if (hasConditionalFieldOrDatumDef(channelDef)) { + const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); + if (fd) { + return { + ...channelDef, + condition: fd + }; + } + else { + const { condition, ...channelDefWithoutCondition } = channelDef; + return channelDefWithoutCondition; + } + } + return channelDef; + } + return undefined; +} +function replaceRepeaterInMapping(mapping, repeater) { + const out = {}; + for (const channel in mapping) { + if (hasOwnProperty(mapping, channel)) { + const channelDef = mapping[channel]; + if (isArray(channelDef)) { + // array cannot have condition + out[channel] = channelDef // somehow we need to cast it here + .map(cd => replaceRepeaterInChannelDef(cd, repeater)) + .filter(cd => cd); + } + else { + const cd = replaceRepeaterInChannelDef(channelDef, repeater); + if (cd !== undefined) { + out[channel] = cd; + } + } + } + } + return out; +} +//# sourceMappingURL=repeater.js.map \ No newline at end of file diff --git a/build/src/normalize/repeater.js.map b/build/src/normalize/repeater.js.map new file mode 100644 index 0000000000..dd1f45557b --- /dev/null +++ b/build/src/normalize/repeater.js.map @@ -0,0 +1 @@ +{"version":3,"file":"repeater.js","sourceRoot":"","sources":["../../../src/normalize/repeater.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,OAAO,EAAC,MAAM,WAAW,CAAC;A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OAAO,CAAC,GAAG,EAAE,CAAC;iBACnB;aACF;SACF;KACF;IACD,OAAO,GAAG,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/ruleforrangedline.d.ts b/build/src/normalize/ruleforrangedline.d.ts new file mode 100644 index 0000000000..2b3e879d5f --- /dev/null +++ b/build/src/normalize/ruleforrangedline.d.ts @@ -0,0 +1,21 @@ +import { Field } from '../channeldef'; +import { Encoding } from '../encoding'; +import { GenericSpec } from '../spec'; +import { GenericUnitSpec } from '../spec/unit'; +import { NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams } from './base'; +interface EncodingX2Mixins { + x2: Encoding['x2']; +} +interface EncodingY2Mixins { + y2: Encoding['y2']; +} +type RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line' | { + mark: 'line'; +}>; +export declare class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer { + name: string; + hasMatchingType(spec: GenericSpec): spec is RangedLineSpec; + run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit): import("../spec").NormalizedUnitSpec | import("../spec").NormalizedLayerSpec; +} +export {}; +//# sourceMappingURL=ruleforrangedline.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/ruleforrangedline.d.ts.map b/build/src/normalize/ruleforrangedline.d.ts.map new file mode 100644 index 0000000000..e64ef87b28 --- /dev/null +++ b/build/src/normalize/ruleforrangedline.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ruleforrangedline.d.ts","sourceRoot":"","sources":["../../../src/normalize/ruleforrangedline.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,EAAyB,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AACpC,OAAO,EAAC,eAAe,EAAa,MAAM,cAAc,CAAC;AACzD,OAAO,EAAC,sBAAsB,EAAE,oBAAoB,EAAE,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAEtF,UAAU,gBAAgB;IACxB,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,UAAU,gBAAgB;IACxB,EAAE,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,CAAC;CAC3B;AAED,KAAK,cAAc,GAAG,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,EAAE,MAAM,GAAG;IAAC,IAAI,EAAE,MAAM,CAAA;CAAC,CAAC,CAAC;AAExH,qBAAa,2BAA4B,YAAW,sBAAsB,CAAC,cAAc,CAAC;IACjF,IAAI,SAAuB;IAE3B,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,GAAG,IAAI,IAAI,cAAc;IAmB9E,GAAG,CAAC,IAAI,EAAE,cAAc,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,oBAAoB;CAY3F"} \ No newline at end of file diff --git a/build/src/normalize/ruleforrangedline.js b/build/src/normalize/ruleforrangedline.js new file mode 100644 index 0000000000..19b73f4153 --- /dev/null +++ b/build/src/normalize/ruleforrangedline.js @@ -0,0 +1,38 @@ +import { isObject } from 'vega-util'; +import { isBinned } from '../bin'; +import { getMainRangeChannel, SECONDARY_RANGE_CHANNEL } from '../channel'; +import { isDatumDef, isFieldDef } from '../channeldef'; +import * as log from '../log'; +import { isMarkDef } from '../mark'; +import { isUnitSpec } from '../spec/unit'; +export class RuleForRangedLineNormalizer { + constructor() { + this.name = 'RuleForRangedLine'; + } + hasMatchingType(spec) { + if (isUnitSpec(spec)) { + const { encoding, mark } = spec; + if (mark === 'line' || (isMarkDef(mark) && mark.type === 'line')) { + for (const channel of SECONDARY_RANGE_CHANNEL) { + const mainChannel = getMainRangeChannel(channel); + const mainChannelDef = encoding[mainChannel]; + if (encoding[channel]) { + if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) { + return true; + } + } + } + } + } + return false; + } + run(spec, params, normalize) { + const { encoding, mark } = spec; + log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2)); + return normalize({ + ...spec, + mark: isObject(mark) ? { ...mark, type: 'rule' } : 'rule' + }, params); + } +} +//# sourceMappingURL=ruleforrangedline.js.map \ No newline at end of file diff --git a/build/src/normalize/ruleforrangedline.js.map b/build/src/normalize/ruleforrangedline.js.map new file mode 100644 index 0000000000..349fedc55d --- /dev/null +++ b/build/src/normalize/ruleforrangedline.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ruleforrangedline.js","sourceRoot":"","sources":["../../../src/normalize/ruleforrangedline.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AACnC,OAAO,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAC,mBAAmB,EAAE,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACxE,OAAO,EAAQ,UAAU,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAE5D,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,OAAO,EAAkB,UAAU,EAAC,MAAM,cAAc,CAAC;AAazD,MAAM,OAAO,2BAA2B;IAAxC;QACS,SAAI,GAAG,mBAAmB,CAAC;IAiCpC,CAAC;IA/BQ,eAAe,CAAC,IAAqC;QAC1D,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE;YACpB,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC;YAC9B,IAAI,IAAI,KAAK,MAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,CAAC,EAAE;gBAChE,KAAK,MAAM,OAAO,IAAI,uBAAuB,EAAE;oBAC7C,MAAM,WAAW,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;oBACjD,MAAM,cAAc,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;oBAE7C,IAAI,QAAQ,CAAC,OAAO,CAAC,EAAE;wBACrB,IAAI,CAAC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,UAAU,CAAC,cAAc,CAAC,EAAE;4BAC/F,OAAO,IAAI,CAAC;yBACb;qBACF;iBACF;aACF;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IAEM,GAAG,CAAC,IAAoB,EAAE,MAAwB,EAAE,SAA+B;QACxF,MAAM,EAAC,QAAQ,EAAE,IAAI,EAAC,GAAG,IAAI,CAAC;QAC9B,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;QAElE,OAAO,SAAS,CACd;YACE,GAAG,IAAI;YACP,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAC,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAC,CAAC,CAAC,CAAC,MAAM;SACxD,EACD,MAAM,CACP,CAAC;IACJ,CAAC;CACF"} \ No newline at end of file diff --git a/build/src/normalize/selectioncompat.d.ts b/build/src/normalize/selectioncompat.d.ts new file mode 100644 index 0000000000..72fb8e0d3f --- /dev/null +++ b/build/src/normalize/selectioncompat.d.ts @@ -0,0 +1,10 @@ +import { Field } from '../channeldef'; +import { FacetedUnitSpec, GenericSpec, LayerSpec, RepeatSpec, UnitSpec } from '../spec'; +import { SpecMapper } from '../spec/map'; +import { NormalizerParams } from './base'; +export declare class SelectionCompatibilityNormalizer extends SpecMapper, LayerSpec, UnitSpec> { + map(spec: GenericSpec, LayerSpec, RepeatSpec, Field>, normParams: NormalizerParams): GenericSpec, import("../spec").GenericLayerSpec>, never, string>; + mapLayerOrUnit(spec: FacetedUnitSpec | LayerSpec, normParams: NormalizerParams): UnitSpec | import("../spec").GenericLayerSpec>; + mapUnit(spec: UnitSpec, normParams: NormalizerParams): any; +} +//# sourceMappingURL=selectioncompat.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/selectioncompat.d.ts.map b/build/src/normalize/selectioncompat.d.ts.map new file mode 100644 index 0000000000..2574fb16d0 --- /dev/null +++ b/build/src/normalize/selectioncompat.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"selectioncompat.d.ts","sourceRoot":"","sources":["../../../src/normalize/selectioncompat.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,KAAK,EAAgD,MAAM,eAAe,CAAC;AAE/F,OAAO,EAAC,eAAe,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAC,MAAM,SAAS,CAAC;AACtF,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAGvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAExC,qBAAa,gCAAiC,SAAQ,UAAU,CAC9D,gBAAgB,EAChB,eAAe,CAAC,KAAK,CAAC,EACtB,SAAS,CAAC,KAAK,CAAC,EAChB,QAAQ,CAAC,KAAK,CAAC,CAChB;IACQ,GAAG,CACR,IAAI,EAAE,WAAW,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAC9E,UAAU,EAAE,gBAAgB;IAQvB,cAAc,CAAC,IAAI,EAAE,eAAe,CAAC,KAAK,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,gBAAgB;IAe5F,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,gBAAgB;CA2BnE"} \ No newline at end of file diff --git a/build/src/normalize/selectioncompat.js b/build/src/normalize/selectioncompat.js new file mode 100644 index 0000000000..81a22c51a5 --- /dev/null +++ b/build/src/normalize/selectioncompat.js @@ -0,0 +1,132 @@ +import { isArray } from 'vega'; +import { isBinParams } from '../bin'; +import { isConditionalDef, isFieldDef, isScaleFieldDef } from '../channeldef'; +import { normalizeLogicalComposition } from '../logical'; +import { SpecMapper } from '../spec/map'; +import { isBin, isFilter, isLookup } from '../transform'; +import { duplicate, entries, vals } from '../util'; +export class SelectionCompatibilityNormalizer extends SpecMapper { + map(spec, normParams) { + normParams.emptySelections ?? (normParams.emptySelections = {}); + normParams.selectionPredicates ?? (normParams.selectionPredicates = {}); + spec = normalizeTransforms(spec, normParams); + return super.map(spec, normParams); + } + mapLayerOrUnit(spec, normParams) { + spec = normalizeTransforms(spec, normParams); + if (spec.encoding) { + const encoding = {}; + for (const [channel, enc] of entries(spec.encoding)) { + encoding[channel] = normalizeChannelDef(enc, normParams); + } + spec = { ...spec, encoding }; + } + return super.mapLayerOrUnit(spec, normParams); + } + mapUnit(spec, normParams) { + const { selection, ...rest } = spec; + if (selection) { + return { + ...rest, + params: entries(selection).map(([name, selDef]) => { + const { init: value, bind, empty, ...select } = selDef; + if (select.type === 'single') { + select.type = 'point'; + select.toggle = false; + } + else if (select.type === 'multi') { + select.type = 'point'; + } + // Propagate emptiness forwards and backwards + normParams.emptySelections[name] = empty !== 'none'; + for (const pred of vals(normParams.selectionPredicates[name] ?? {})) { + pred.empty = empty !== 'none'; + } + return { name, value, select, bind }; + }) + }; + } + return spec; + } +} +function normalizeTransforms(spec, normParams) { + const { transform: tx, ...rest } = spec; + if (tx) { + const transform = tx.map((t) => { + if (isFilter(t)) { + return { filter: normalizePredicate(t, normParams) }; + } + else if (isBin(t) && isBinParams(t.bin)) { + return { + ...t, + bin: normalizeBinExtent(t.bin) + }; + } + else if (isLookup(t)) { + const { selection: param, ...from } = t.from; + return param + ? { + ...t, + from: { param, ...from } + } + : t; + } + return t; + }); + return { ...rest, transform }; + } + return spec; +} +function normalizeChannelDef(obj, normParams) { + const enc = duplicate(obj); + if (isFieldDef(enc) && isBinParams(enc.bin)) { + enc.bin = normalizeBinExtent(enc.bin); + } + if (isScaleFieldDef(enc) && enc.scale?.domain?.selection) { + const { selection: param, ...domain } = enc.scale.domain; + enc.scale.domain = { ...domain, ...(param ? { param } : {}) }; + } + if (isConditionalDef(enc)) { + if (isArray(enc.condition)) { + enc.condition = enc.condition.map((c) => { + const { selection, param, test, ...cond } = c; + return param ? c : { ...cond, test: normalizePredicate(c, normParams) }; + }); + } + else { + const { selection, param, test, ...cond } = normalizeChannelDef(enc.condition, normParams); + enc.condition = param + ? enc.condition + : { + ...cond, + test: normalizePredicate(enc.condition, normParams) + }; + } + } + return enc; +} +function normalizeBinExtent(bin) { + const ext = bin.extent; + if (ext?.selection) { + const { selection: param, ...rest } = ext; + return { ...bin, extent: { ...rest, param } }; + } + return bin; +} +function normalizePredicate(op, normParams) { + // Normalize old compositions of selection names (e.g., selection: {and: ["one", "two"]}) + const normalizeSelectionComposition = (o) => { + return normalizeLogicalComposition(o, param => { + var _a; + const empty = normParams.emptySelections[param] ?? true; + const pred = { param, empty }; + (_a = normParams.selectionPredicates)[param] ?? (_a[param] = []); + normParams.selectionPredicates[param].push(pred); + return pred; + }); + }; + return op.selection + ? normalizeSelectionComposition(op.selection) + : normalizeLogicalComposition(op.test || op.filter, o => o.selection ? normalizeSelectionComposition(o.selection) : o); +} +//# sourceMappingURL=selectioncompat.js.map \ No newline at end of file diff --git a/build/src/normalize/selectioncompat.js.map b/build/src/normalize/selectioncompat.js.map new file mode 100644 index 0000000000..1aad0a59fc --- /dev/null +++ b/build/src/normalize/selectioncompat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selectioncompat.js","sourceRoot":"","sources":["../../../src/normalize/selectioncompat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,MAAM,CAAC;AAC7B,OAAO,EAAY,WAAW,EAAC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G,IAAI,EAAE,KAAK,EAAC,EAAC,CAAC;KAC3C;IAED,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,kBAAkB,CAAC,EAAO,EAAE,UAA4B;IAC/D,yFAAyF;IACzF,MAAM,6BAA6B,GAAG,CAAC,CAA6B,EAAE,EAAE;QACtE,OAAO,2BAA2B,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE;;YAC5C,MAAM,KAAK,GAAG,UAAU,CAAC,eAAe,CAAC,KAAK,CAAC,IAAI,IAAI,CAAC;YACxD,MAAM,IAAI,GAAG,EAAC,KAAK,EAAE,KAAK,EAAC,CAAC;YAC5B,MAAA,UAAU,CAAC,mBAAmB,EAAC,KAAK,SAAL,KAAK,IAAM,EAAE,EAAC;YAC7C,UAAU,CAAC,mBAAmB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YACjD,OAAO,IAAW,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC;IAEF,OAAO,EAAE,CAAC,SAAS;QACjB,CAAC,CAAC,6BAA6B,CAAC,EAAE,CAAC,SAAS,CAAC;QAC7C,CAAC,CAAC,2BAA2B,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CACpD,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAC7D,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/build/src/normalize/toplevelselection.d.ts b/build/src/normalize/toplevelselection.d.ts new file mode 100644 index 0000000000..05feafa0d9 --- /dev/null +++ b/build/src/normalize/toplevelselection.d.ts @@ -0,0 +1,9 @@ +import { Field } from '../channeldef'; +import { NormalizedLayerSpec, NormalizedSpec, NormalizedUnitSpec, TopLevel, UnitSpec } from '../spec'; +import { SpecMapper } from '../spec/map'; +import { NormalizerParams } from './base'; +export declare class TopLevelSelectionsNormalizer extends SpecMapper { + map(spec: TopLevel, normParams: NormalizerParams): TopLevel; + mapUnit(spec: UnitSpec, normParams: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec; +} +//# sourceMappingURL=toplevelselection.d.ts.map \ No newline at end of file diff --git a/build/src/normalize/toplevelselection.d.ts.map b/build/src/normalize/toplevelselection.d.ts.map new file mode 100644 index 0000000000..aeef829d74 --- /dev/null +++ b/build/src/normalize/toplevelselection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toplevelselection.d.ts","sourceRoot":"","sources":["../../../src/normalize/toplevelselection.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AAGpC,OAAO,EAGL,mBAAmB,EACnB,cAAc,EACd,kBAAkB,EAClB,QAAQ,EACR,QAAQ,EACT,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AACvC,OAAO,EAAC,gBAAgB,EAAC,MAAM,QAAQ,CAAC;AAExC,qBAAa,4BAA6B,SAAQ,UAAU,CAAC,gBAAgB,EAAE,kBAAkB,CAAC;IACzF,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,cAAc,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAG,QAAQ,CAAC,cAAc,CAAC;IAmB3F,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,CAAC,EAAE,UAAU,EAAE,gBAAgB,GAAG,kBAAkB,GAAG,mBAAmB;CA8B9G"} \ No newline at end of file diff --git a/build/src/normalize/toplevelselection.js b/build/src/normalize/toplevelselection.js new file mode 100644 index 0000000000..685ba69ece --- /dev/null +++ b/build/src/normalize/toplevelselection.js @@ -0,0 +1,66 @@ +import { isArray, isString } from 'vega'; +import { isSelectionParameter } from '../selection'; +import { isUnitSpec } from '../spec'; +import { SpecMapper } from '../spec/map'; +export class TopLevelSelectionsNormalizer extends SpecMapper { + map(spec, normParams) { + const selections = normParams.selections ?? []; + if (spec.params && !isUnitSpec(spec)) { + const params = []; + for (const param of spec.params) { + if (isSelectionParameter(param)) { + selections.push(param); + } + else { + params.push(param); + } + } + spec.params = params; + } + normParams.selections = selections; + return super.map(spec, normParams); + } + mapUnit(spec, normParams) { + const selections = normParams.selections; + if (!selections || !selections.length) + return spec; + const path = (normParams.path ?? []).concat(spec.name); + const params = []; + for (const selection of selections) { + // By default, apply selections to all unit views. + if (!selection.views || !selection.views.length) { + params.push(selection); + } + else { + for (const view of selection.views) { + // view is either a specific unit name, or a partial path through the spec tree. + if ((isString(view) && (view === spec.name || path.includes(view))) || + (isArray(view) && + // logic for backwards compatibility with view paths before we had unique names + // @ts-ignore + view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))) { + params.push(selection); + } + } + } + } + if (params.length) + spec.params = params; + return spec; + } +} +for (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) { + const proto = TopLevelSelectionsNormalizer.prototype[method]; + TopLevelSelectionsNormalizer.prototype[method] = function (spec, params) { + return proto.call(this, spec, addSpecNameToParams(spec, params)); + }; +} +function addSpecNameToParams(spec, params) { + return spec.name + ? { + ...params, + path: (params.path ?? []).concat(spec.name) + } + : params; +} +//# sourceMappingURL=toplevelselection.js.map \ No newline at end of file diff --git a/build/src/normalize/toplevelselection.js.map b/build/src/normalize/toplevelselection.js.map new file mode 100644 index 0000000000..ea96950c56 --- /dev/null +++ b/build/src/normalize/toplevelselection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toplevelselection.js","sourceRoot":"","sources":["../../../src/normalize/toplevelselection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,MAAM,CAAC;AAGvC,OAAO,EAAC,oBAAoB,EAAqB,MAAM,cAAc,CAAC;AACtE,OAAO,EAEL,UAAU,EAMX,MAAM,SAAS,CAAC;AACjB,OAAO,EAAC,UAAU,EAAC,MAAM,aAAa,CAAC;AAGvC,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E,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;SAC5C;QACH,CAAC,CAAC,MAAM,CAAC;AACb,CAAC"} \ No newline at end of file diff --git a/build/src/parameter.d.ts b/build/src/parameter.d.ts new file mode 100644 index 0000000000..92070dac2f --- /dev/null +++ b/build/src/parameter.d.ts @@ -0,0 +1,25 @@ +import { Binding, Expr, InitSignal, NewSignal } from 'vega'; +import { TopLevelSelectionParameter } from './selection'; +export type ParameterName = string; +export interface VariableParameter { + /** + * A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or "$", or "_") and may not start with a digit. Reserved keywords that may not be used as parameter names are "datum", "event", "item", and "parent". + */ + name: ParameterName; + /** + * The [initial value](http://vega.github.io/vega-lite/docs/value.html) of the parameter. + * + * __Default value:__ `undefined` + */ + value?: any; + /** + * An expression for the value of the parameter. This expression may include other parameters, in which case the parameter will automatically update in response to upstream parameter changes. + */ + expr?: Expr; + /** + * Binds the parameter to an external input element such as a slider, selection list or radio button group. + */ + bind?: Binding; +} +export declare function assembleParameterSignals(params: (VariableParameter | TopLevelSelectionParameter)[]): (NewSignal | InitSignal)[]; +//# sourceMappingURL=parameter.d.ts.map \ No newline at end of file diff --git a/build/src/parameter.d.ts.map b/build/src/parameter.d.ts.map new file mode 100644 index 0000000000..ffce6ac9aa --- /dev/null +++ b/build/src/parameter.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"parameter.d.ts","sourceRoot":"","sources":["../../src/parameter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAC1D,OAAO,EAAuB,0BAA0B,EAAC,MAAM,aAAa,CAAC;AAE7E,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,IAAI,EAAE,aAAa,CAAC;IAEpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,GAAG,CAAC;IAEZ;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB;AAED,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,CAAC,iBAAiB,GAAG,0BAA0B,CAAC,EAAE,8BA0BlG"} \ No newline at end of file diff --git a/build/src/parameter.js b/build/src/parameter.js new file mode 100644 index 0000000000..b48b3cb56d --- /dev/null +++ b/build/src/parameter.js @@ -0,0 +1,30 @@ +import { isSelectionParameter } from './selection'; +export function assembleParameterSignals(params) { + const signals = []; + for (const param of params || []) { + // Selection parameters are handled separately via assembleSelectionTopLevelSignals + // and assembleSignals methods registered on the Model. + if (isSelectionParameter(param)) + continue; + const { expr, bind, ...rest } = param; + if (bind && expr) { + // Vega's InitSignal -- apply expr to "init" + const signal = { + ...rest, + bind, + init: expr + }; + signals.push(signal); + } + else { + const signal = { + ...rest, + ...(expr ? { update: expr } : {}), + ...(bind ? { bind } : {}) + }; + signals.push(signal); + } + } + return signals; +} +//# sourceMappingURL=parameter.js.map \ No newline at end of file diff --git a/build/src/parameter.js.map b/build/src/parameter.js.map new file mode 100644 index 0000000000..50c14f2155 --- /dev/null +++ b/build/src/parameter.js.map @@ -0,0 +1 @@ +{"version":3,"file":"parameter.js","sourceRoot":"","sources":["../../src/parameter.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,oBAAoB,EAA6B,MAAM,aAAa,CAAC;AA4B7E,MAAM,UAAU,wBAAwB,CAAC,MAA0D;IACjG,MAAM,OAAO,GAA+B,EAAE,CAAC;IAC/C,KAAK,MAAM,KAAK,IAAI,MAAM,IAAI,EAAE,EAAE;QAChC,mFAAmF;QACnF,uDAAuD;QACvD,IAAI,oBAAoB,CAAC,KAAK,CAAC;YAAE,SAAS;QAC1C,MAAM,EAAC,IAAI,EAAE,IAAI,EAAE,GAAG,IAAI,EAAC,GAAG,KAAK,CAAC;QAEpC,IAAI,IAAI,IAAI,IAAI,EAAE;YAChB,4CAA4C;YAC5C,MAAM,MAAM,GAAe;gBACzB,GAAG,IAAI;gBACP,IAAI;gBACJ,IAAI,EAAE,IAAI;aACX,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtB;aAAM;YACL,MAAM,MAAM,GAAc;gBACxB,GAAG,IAAI;gBACP,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,MAAM,EAAE,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;gBAC/B,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,EAAC,IAAI,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;aACxB,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;SACtB;KACF;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/build/src/predicate.d.ts b/build/src/predicate.d.ts new file mode 100644 index 0000000000..40426ba4cf --- /dev/null +++ b/build/src/predicate.d.ts @@ -0,0 +1,96 @@ +import type { SignalRef } from 'vega'; +import { FieldName } from './channeldef'; +import { DateTime } from './datetime'; +import { ExprRef } from './expr'; +import { LogicalComposition } from './logical'; +import { ParameterName } from './parameter'; +import { TimeUnit, TimeUnitParams, BinnedTimeUnit } from './timeunit'; +export type Predicate = FieldEqualPredicate | FieldRangePredicate | FieldOneOfPredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate | FieldValidPredicate | ParameterPredicate | string; +export type FieldPredicate = FieldEqualPredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate | FieldRangePredicate | FieldOneOfPredicate | FieldValidPredicate; +export interface ParameterPredicate { + /** + * Filter using a parameter name. + */ + param: ParameterName; + /** + * For selection parameters, the predicate of empty selections returns true by default. + * Override this behavior, by setting this property `empty: false`. + */ + empty?: boolean; +} +export declare function isSelectionPredicate(predicate: LogicalComposition): predicate is ParameterPredicate; +export interface FieldPredicateBase { + /** + * Time unit for the field to be tested. + */ + timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams; + /** + * Field to be tested. + */ + field: FieldName; +} +export interface FieldEqualPredicate extends FieldPredicateBase { + /** + * The value that the field should be equal to. + */ + equal: string | number | boolean | DateTime | ExprRef | SignalRef; +} +export declare function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate; +export interface FieldLTPredicate extends FieldPredicateBase { + /** + * The value that the field should be less than. + */ + lt: string | number | DateTime | ExprRef | SignalRef; +} +export declare function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate; +export interface FieldLTEPredicate extends FieldPredicateBase { + /** + * The value that the field should be less than or equals to. + */ + lte: string | number | DateTime | ExprRef | SignalRef; +} +export declare function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate; +export interface FieldGTPredicate extends FieldPredicateBase { + /** + * The value that the field should be greater than. + */ + gt: string | number | DateTime | ExprRef | SignalRef; +} +export declare function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate; +export interface FieldGTEPredicate extends FieldPredicateBase { + /** + * The value that the field should be greater than or equals to. + */ + gte: string | number | DateTime | ExprRef | SignalRef; +} +export declare function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate; +export interface FieldRangePredicate extends FieldPredicateBase { + /** + * An array of inclusive minimum and maximum values + * for a field value of a data item to be included in the filtered data. + * @maxItems 2 + * @minItems 2 + */ + range: (number | DateTime | null | ExprRef | SignalRef)[] | ExprRef | SignalRef; +} +export declare function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate; +export interface FieldOneOfPredicate extends FieldPredicateBase { + /** + * A set of values that the `field`'s value should be a member of, + * for a data item included in the filtered data. + */ + oneOf: string[] | number[] | boolean[] | DateTime[]; +} +export interface FieldValidPredicate extends FieldPredicateBase { + /** + * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN). + */ + valid: boolean; +} +export declare function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate; +export declare function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate; +export declare function isFieldPredicate(predicate: Predicate): predicate is FieldOneOfPredicate | FieldEqualPredicate | FieldRangePredicate | FieldLTPredicate | FieldGTPredicate | FieldLTEPredicate | FieldGTEPredicate; +export declare function fieldFilterExpression(predicate: FieldPredicate, useInRange?: boolean): string; +export declare function fieldValidPredicate(fieldExpr: string, valid?: boolean): string; +export declare function normalizePredicate(f: Predicate): Predicate; +//# sourceMappingURL=predicate.d.ts.map \ No newline at end of file diff --git a/build/src/predicate.d.ts.map b/build/src/predicate.d.ts.map new file mode 100644 index 0000000000..bb8264da0b --- /dev/null +++ b/build/src/predicate.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"predicate.d.ts","sourceRoot":"","sources":["../../src/predicate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAC,SAAS,EAAqB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAC,aAAa,EAAC,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAoD,QAAQ,EAAE,cAAc,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AAIvH,MAAM,MAAM,SAAS,GAGjB,mBAAmB,GACnB,mBAAmB,GACnB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GAEnB,kBAAkB,GAElB,MAAM,CAAC;AAEX,MAAM,MAAM,cAAc,GACtB,mBAAmB,GACnB,gBAAgB,GAChB,gBAAgB,GAChB,iBAAiB,GACjB,iBAAiB,GACjB,mBAAmB,GACnB,mBAAmB,GACnB,mBA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AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,SAAS,GAAG,SAAS,CAQ1D"} \ No newline at end of file diff --git a/build/src/predicate.js b/build/src/predicate.js new file mode 100644 index 0000000000..3258029a64 --- /dev/null +++ b/build/src/predicate.js @@ -0,0 +1,130 @@ +import { isArray } from 'vega-util'; +import { valueExpr, vgField } from './channeldef'; +import { fieldExpr as timeUnitFieldExpr, normalizeTimeUnit } from './timeunit'; +import { stringify } from './util'; +import { isSignalRef } from './vega.schema'; +export function isSelectionPredicate(predicate) { + return predicate?.['param']; +} +export function isFieldEqualPredicate(predicate) { + return !!predicate?.field && predicate.equal !== undefined; +} +export function isFieldLTPredicate(predicate) { + return !!predicate?.field && predicate.lt !== undefined; +} +export function isFieldLTEPredicate(predicate) { + return !!predicate?.field && predicate.lte !== undefined; +} +export function isFieldGTPredicate(predicate) { + return !!predicate?.field && predicate.gt !== undefined; +} +export function isFieldGTEPredicate(predicate) { + return !!predicate?.field && predicate.gte !== undefined; +} +export function isFieldRangePredicate(predicate) { + if (predicate?.field) { + if (isArray(predicate.range) && predicate.range.length === 2) { + return true; + } + else if (isSignalRef(predicate.range)) { + return true; + } + } + return false; +} +export function isFieldOneOfPredicate(predicate) { + return (!!predicate?.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility + ); +} +export function isFieldValidPredicate(predicate) { + return !!predicate?.field && predicate.valid !== undefined; +} +export function isFieldPredicate(predicate) { + return (isFieldOneOfPredicate(predicate) || + isFieldEqualPredicate(predicate) || + isFieldRangePredicate(predicate) || + isFieldLTPredicate(predicate) || + isFieldGTPredicate(predicate) || + isFieldLTEPredicate(predicate) || + isFieldGTEPredicate(predicate)); +} +function predicateValueExpr(v, timeUnit) { + return valueExpr(v, { timeUnit, wrapTime: true }); +} +function predicateValuesExpr(vals, timeUnit) { + return vals.map(v => predicateValueExpr(v, timeUnit)); +} +// This method is used by Voyager. Do not change its behavior without changing Voyager. +export function fieldFilterExpression(predicate, useInRange = true) { + const { field } = predicate; + const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit); + const { unit, binned } = normalizedTimeUnit || {}; + const rawFieldExpr = vgField(predicate, { expr: 'datum' }); + const fieldExpr = unit + ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. + // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline + // TODO: support utc + `time(${!binned ? timeUnitFieldExpr(unit, field) : rawFieldExpr})` + : rawFieldExpr; + if (isFieldEqualPredicate(predicate)) { + return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`; + } + else if (isFieldLTPredicate(predicate)) { + const upper = predicate.lt; + return `${fieldExpr}<${predicateValueExpr(upper, unit)}`; + } + else if (isFieldGTPredicate(predicate)) { + const lower = predicate.gt; + return `${fieldExpr}>${predicateValueExpr(lower, unit)}`; + } + else if (isFieldLTEPredicate(predicate)) { + const upper = predicate.lte; + return `${fieldExpr}<=${predicateValueExpr(upper, unit)}`; + } + else if (isFieldGTEPredicate(predicate)) { + const lower = predicate.gte; + return `${fieldExpr}>=${predicateValueExpr(lower, unit)}`; + } + else if (isFieldOneOfPredicate(predicate)) { + return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr}) !== -1`; + } + else if (isFieldValidPredicate(predicate)) { + return fieldValidPredicate(fieldExpr, predicate.valid); + } + else if (isFieldRangePredicate(predicate)) { + const { range } = predicate; + const lower = isSignalRef(range) ? { signal: `${range.signal}[0]` } : range[0]; + const upper = isSignalRef(range) ? { signal: `${range.signal}[1]` } : range[1]; + if (lower !== null && upper !== null && useInRange) { + return ('inrange(' + fieldExpr + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])'); + } + const exprs = []; + if (lower !== null) { + exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, unit)}`); + } + if (upper !== null) { + exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, unit)}`); + } + return exprs.length > 0 ? exprs.join(' && ') : 'true'; + } + /* istanbul ignore next: it should never reach here */ + throw new Error(`Invalid field predicate: ${stringify(predicate)}`); +} +export function fieldValidPredicate(fieldExpr, valid = true) { + if (valid) { + return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`; + } + else { + return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`; + } +} +export function normalizePredicate(f) { + if (isFieldPredicate(f) && f.timeUnit) { + return { + ...f, + timeUnit: normalizeTimeUnit(f.timeUnit) + }; + } + return f; +} +//# sourceMappingURL=predicate.js.map \ No newline at end of file diff --git a/build/src/predicate.js.map b/build/src/predicate.js.map new file mode 100644 index 0000000000..95fe8e1946 --- /dev/null +++ b/build/src/predicate.js.map @@ -0,0 +1 @@ +{"version":3,"file":"predicate.js","sourceRoot":"","sources":["../../src/predicate.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAY,SAAS,EAAE,OAAO,EAAC,MAAM,cAAc,CAAC;AAK3D,OAAO,EAAC,SAAS,IAAI,iBAAiB,EAAE,iBAAiB,EAA2C,MAAM,YAAY,CAAC;AACvH,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAwC1C,MAAM,UAAU,oBAAoB,CAAC,SAAwC;IAC3E,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC;AAuBD,MAAM,UAAU,qBAAqB,CAAC,SAAc;IAClD,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,IAAI,SAAS,CAAC,KAAK,KAAK,SAAS,CAAC;AAC7D,CAAC;AASD,MAAM,UAAU,kBAAkB,CAAC,SAAc;IAC/C,OAAO,CAAC,CAAC,SAAS,EAAE,KAAK,IAAI,SAAS,CAAC,EAAE,KAAK,SAAS,CAAC;AAC1D,CAAC;AASD,MAAM,UAAU,mBAAmB,CAAC,SAAc;IAChD,OAAO,CAAC,CAAC,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I,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACrC,OAAO;YACL,GAAG,CAAC;YACJ,QAAQ,EAAE,iBAAiB,CAAC,CAAC,CAAC,QAAQ,CAAC;SACxC,CAAC;KACH;IACD,OAAO,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/build/src/projection.d.ts b/build/src/projection.d.ts new file mode 100644 index 0000000000..574fedf9ce --- /dev/null +++ b/build/src/projection.d.ts @@ -0,0 +1,25 @@ +import { BaseProjection, SignalRef, Vector2 } from 'vega'; +import { ExprRef } from './expr'; +import { MapExcludeValueRefAndReplaceSignalWith, ProjectionType } from './vega.schema'; +export interface Projection extends MapExcludeValueRefAndReplaceSignalWith { + /** + * The cartographic projection to use. This value is case-insensitive, for example `"albers"` and `"Albers"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types). + * + * __Default value:__ `equalEarth` + */ + type?: ProjectionType | ES; + /** + * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections. + */ + scale?: number | ES; + /** + * The projection’s translation offset as a two-element array `[tx, ty]`. + */ + translate?: Vector2 | ES; +} +/** + * Any property of Projection can be in config + */ +export type ProjectionConfig = Projection; +export declare const PROJECTION_PROPERTIES: (keyof Projection)[]; +//# sourceMappingURL=projection.d.ts.map \ No newline at end of file diff --git a/build/src/projection.d.ts.map b/build/src/projection.d.ts.map new file mode 100644 index 0000000000..917b0e1a72 --- /dev/null +++ b/build/src/projection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"projection.d.ts","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,MAAM,CAAC;AACxD,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,sCAAsC,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAErF,MAAM,WAAW,UAAU,CAAC,EAAE,SAAS,OAAO,GAAG,SAAS,CACxD,SAAQ,sCAAsC,CAAC,cAAc,EAAE,EAAE,CAAC;IAClE;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,GAAG,EAAE,CAAC;IAE3B;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAEpB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;AAEnD,eAAO,MAAM,qBAAqB,EAAE,CAAC,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC,EAkB9D,CAAC"} \ No newline at end of file diff --git a/build/src/projection.js b/build/src/projection.js new file mode 100644 index 0000000000..7c8dd2b514 --- /dev/null +++ b/build/src/projection.js @@ -0,0 +1,20 @@ +export const PROJECTION_PROPERTIES = [ + 'type', + 'clipAngle', + 'clipExtent', + 'center', + 'rotate', + 'precision', + 'reflectX', + 'reflectY', + 'coefficient', + 'distance', + 'fraction', + 'lobes', + 'parallel', + 'radius', + 'ratio', + 'spacing', + 'tilt' +]; +//# sourceMappingURL=projection.js.map \ No newline at end of file diff --git a/build/src/projection.js.map b/build/src/projection.js.map new file mode 100644 index 0000000000..9799fa403e --- /dev/null +++ b/build/src/projection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"projection.js","sourceRoot":"","sources":["../../src/projection.ts"],"names":[],"mappings":"AA6BA,MAAM,CAAC,MAAM,qBAAqB,GAAkC;IAClE,MAAM;IACN,WAAW;IACX,YAAY;IACZ,QAAQ;IACR,QAAQ;IACR,WAAW;IACX,UAAU;IACV,UAAU;IACV,aAAa;IACb,UAAU;IACV,UAAU;IACV,OAAO;IACP,UAAU;IACV,QAAQ;IACR,OAAO;IACP,SAAS;IACT,MAAM;CACP,CAAC"} \ No newline at end of file diff --git a/build/src/resolve.d.ts b/build/src/resolve.d.ts new file mode 100644 index 0000000000..eaa50b57e9 --- /dev/null +++ b/build/src/resolve.d.ts @@ -0,0 +1,14 @@ +import { NonPositionScaleChannel, PositionScaleChannel, ScaleChannel } from './channel'; +export type ResolveMode = 'independent' | 'shared'; +/** + * Defines how scales, axes, and legends from different specs should be combined. Resolve is a mapping from `scale`, `axis`, and `legend` to a mapping from channels to resolutions. Scales and guides can be resolved to be `"independent"` or `"shared"`. + */ +export interface Resolve { + scale?: ScaleResolveMap; + axis?: AxisResolveMap; + legend?: LegendResolveMap; +} +export type ScaleResolveMap = Partial>; +export type AxisResolveMap = Partial>; +export type LegendResolveMap = Partial>; +//# sourceMappingURL=resolve.d.ts.map \ No newline at end of file diff --git a/build/src/resolve.d.ts.map b/build/src/resolve.d.ts.map new file mode 100644 index 0000000000..c9f44f5e85 --- /dev/null +++ b/build/src/resolve.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,uBAAuB,EAAE,oBAAoB,EAAE,YAAY,EAAC,MAAM,WAAW,CAAC;AAEtF,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,QAAQ,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,OAAO;IACtB,KAAK,CAAC,EAAE,eAAe,CAAC;IAExB,IAAI,CAAC,EAAE,cAAc,CAAC;IAEtB,MAAM,CAAC,EAAE,gBAAgB,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,WAAW,CAAC,CAAC,CAAC;AAEzE,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,oBAAoB,EAAE,WAAW,CAAC,CAAC,CAAC;AAEhF,MAAM,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,uBAAuB,EAAE,WAAW,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/resolve.js b/build/src/resolve.js new file mode 100644 index 0000000000..8e68ca3704 --- /dev/null +++ b/build/src/resolve.js @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=resolve.js.map \ No newline at end of file diff --git a/build/src/resolve.js.map b/build/src/resolve.js.map new file mode 100644 index 0000000000..a01bd82b3b --- /dev/null +++ b/build/src/resolve.js.map @@ -0,0 +1 @@ +{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/build/src/scale.d.ts b/build/src/scale.d.ts new file mode 100644 index 0000000000..efa94efed4 --- /dev/null +++ b/build/src/scale.d.ts @@ -0,0 +1,497 @@ +import { RangeEnum, ScaleBins, ScaleInterpolateEnum, ScaleInterpolateParams, SignalRef, TimeInterval, TimeIntervalStep } from 'vega'; +import type { ColorScheme } from 'vega-typings'; +import { Channel } from './channel'; +import { DateTime } from './datetime'; +import { ExprRef } from './expr'; +import { ParameterExtent } from './selection'; +import { Type } from './type'; +export declare const ScaleType: { + readonly LINEAR: "linear"; + readonly LOG: "log"; + readonly POW: "pow"; + readonly SQRT: "sqrt"; + readonly SYMLOG: "symlog"; + readonly IDENTITY: "identity"; + readonly SEQUENTIAL: "sequential"; + readonly TIME: "time"; + readonly UTC: "utc"; + readonly QUANTILE: "quantile"; + readonly QUANTIZE: "quantize"; + readonly THRESHOLD: "threshold"; + readonly BIN_ORDINAL: "bin-ordinal"; + readonly ORDINAL: "ordinal"; + readonly POINT: "point"; + readonly BAND: "band"; +}; +type ValueOf = T[keyof T]; +export type ScaleType = ValueOf; +/** + * Index for scale categories -- only scale of the same categories can be merged together. + * Current implementation is trying to be conservative and avoid merging scale type that might not work together + */ +export declare const SCALE_CATEGORY_INDEX: Record; +export declare const SCALE_TYPES: ScaleType[]; +/** + * Whether the two given scale types can be merged together. + */ +export declare function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType): boolean; +/** + * Return scale categories -- only scale of the same categories can be merged together. + */ +export declare function scaleTypePrecedence(scaleType: ScaleType): number; +export declare const QUANTITATIVE_SCALES: ReadonlySet; +export declare const CONTINUOUS_TO_CONTINUOUS_SCALES: ReadonlySet; +export declare function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog'; +export declare const CONTINUOUS_TO_DISCRETE_SCALES: ReadonlySet; +export declare const CONTINUOUS_DOMAIN_SCALES: ReadonlySet; +export declare const DISCRETE_DOMAIN_SCALES: ReadonlySet; +export declare const TIME_SCALE_TYPES: ReadonlySet; +export declare function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band'; +export declare function hasContinuousDomain(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold'; +export declare function isContinuousToContinuous(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc'; +export declare function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold'; +export interface ScaleConfig { + /** + * If true, rounds numeric output values to integers. + * This can be helpful for snapping to the pixel grid. + * (Only available for `x`, `y`, and `size` scales.) + */ + round?: boolean | ES; + /** + * If true, values that exceed the data domain are clamped to either the minimum or maximum range value + */ + clamp?: boolean | ES; + /** + * Default inner padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding. + * + * __Default value:__ `0.2` + * + * @minimum 0 + * @maximum 1 + */ + bandWithNestedOffsetPaddingInner?: number | ES; + /** + * Default outer padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding. + * + * __Default value:__ `0.2` + * + * @minimum 0 + * @maximum 1 + */ + bandWithNestedOffsetPaddingOuter?: number | ES; + /** + * Default inner padding for `x` and `y` band scales. + * + * __Default value:__ + * - `nestedOffsetPaddingInner` for x/y scales with nested x/y offset scales. + * - `barBandPaddingInner` for bar marks (`0.1` by default) + * - `rectBandPaddingInner` for rect and other marks (`0` by default) + * + * @minimum 0 + * @maximum 1 + */ + bandPaddingInner?: number | ES; + /** + * Default outer padding for `x` and `y` band scales. + * + * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_) + * + * @minimum 0 + * @maximum 1 + */ + bandPaddingOuter?: number | ES; + /** + * Default inner padding for `x` and `y` band-ordinal scales of `"bar"` marks. + * + * __Default value:__ `0.1` + * + * @minimum 0 + * @maximum 1 + */ + barBandPaddingInner?: number | ES; + /** + * Default inner padding for `x` and `y` band-ordinal scales of `"rect"` marks. + * + * __Default value:__ `0` + * + * @minimum 0 + * @maximum 1 + */ + rectBandPaddingInner?: number | ES; + /** + * Default padding inner for xOffset/yOffset's band scales. + * + * __Default Value:__ `0` + */ + offsetBandPaddingInner?: number | ES; + /** + * Default padding outer for xOffset/yOffset's band scales. + * + * __Default Value:__ `0` + */ + offsetBandPaddingOuter?: number | ES; + /** + * Default padding for continuous x/y scales. + * + * __Default:__ The bar width for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise. + * + * @minimum 0 + */ + continuousPadding?: number | ES; + /** + * Default outer padding for `x` and `y` point-ordinal scales. + * + * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_) + * + * @minimum 0 + * @maximum 1 + */ + pointPadding?: number | ES; + /** + * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis. + * + * This is equivalent to setting `domain` to `"unaggregate"` for aggregated _quantitative_ fields by default. + * + * This property only works with aggregate functions that produce values within the raw data domain (`"mean"`, `"average"`, `"median"`, `"q1"`, `"q3"`, `"min"`, `"max"`). For other aggregations that produce values outside of the raw data domain (e.g. `"count"`, `"sum"`), this property is ignored. + * + * __Default value:__ `false` + */ + useUnaggregatedDomain?: boolean; + /** + * The default max value for mapping quantitative fields to bar's size/bandSize. + * + * If undefined (default), we will use the axis's size (width or height) - 1. + * @minimum 0 + */ + maxBandSize?: number; + /** + * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false. + * + * __Default value:__ `2` + * + * @minimum 0 + */ + minBandSize?: number; + /** + * The default max value for mapping quantitative fields to text's size/fontSize. + * + * __Default value:__ `40` + * + * @minimum 0 + */ + maxFontSize?: number; + /** + * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false + * + * __Default value:__ `8` + * + * @minimum 0 + */ + minFontSize?: number; + /** + * Default minimum opacity for mapping a field to opacity. + * + * __Default value:__ `0.3` + * + * @minimum 0 + * @maximum 1 + */ + minOpacity?: number; + /** + * Default max opacity for mapping a field to opacity. + * + * __Default value:__ `0.8` + * + * @minimum 0 + * @maximum 1 + */ + maxOpacity?: number; + /** + * Default minimum value for point size scale with zero=false. + * + * __Default value:__ `9` + * + * @minimum 0 + */ + minSize?: number; + /** + * Default max value for point size scale. + * @minimum 0 + */ + maxSize?: number; + /** + * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false. + * + * __Default value:__ `1` + * + * @minimum 0 + */ + minStrokeWidth?: number; + /** + * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks. + * + * __Default value:__ `4` + * + * @minimum 0 + */ + maxStrokeWidth?: number; + /** + * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale. + * + * __Default value:__ `4` + * + * @minimum 0 + */ + quantileCount?: number; + /** + * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale. + * + * __Default value:__ `4` + * + * @minimum 0 + */ + quantizeCount?: number; + /** + * Reverse x-scale by default (useful for right-to-left charts). + */ + xReverse?: boolean | ES; + /** + * Default `scale.zero` for [`continuous`](https://vega.github.io/vega-lite/docs/scale.html#continuous) scales except for (1) x/y-scales of non-ranged bar or area charts and (2) size scales. + * + * __Default value:__ `true` + * + */ + zero?: boolean; +} +export declare const defaultScaleConfig: ScaleConfig; +export interface SchemeParams { + /** + * A color scheme name for ordinal scales (e.g., `"category10"` or `"blues"`). + * + * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. + */ + name: ColorScheme | SignalRef; + /** + * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme. + */ + extent?: (number | SignalRef)[] | SignalRef; + /** + * The number of colors to use in the scheme. This can be useful for scale types such as `"quantize"`, which use the length of the scale range to determine the number of discrete bins for the scale domain. + */ + count?: number | SignalRef; +} +export type Domain = (null | string | number | boolean | DateTime | SignalRef)[] | 'unaggregated' | ParameterExtent | SignalRef | DomainUnionWith; +export type Scheme = string | SchemeParams; +export declare function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams; +export declare function isParameterDomain(domain: Domain): domain is ParameterExtent; +export interface DomainUnionWith { + /** + * Customized domain values to be union with the field's values or explicitly defined domain. + * Should be an array of valid scale domain values. + */ + unionWith: (number | string | boolean | DateTime)[]; +} +export declare function isDomainUnionWith(domain: Domain): domain is DomainUnionWith; +export interface FieldRange { + field: string; +} +export declare function isFieldRange(range: any): range is FieldRange; +export interface Scale { + /** + * The type of scale. Vega-Lite supports the following categories of scale types: + * + * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`"linear"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`"pow"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`"sqrt"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`"symlog"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`"log"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`"time"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`"utc"`](https://vega.github.io/vega-lite/docs/scale.html#utc). + * + * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`"ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`"band"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`"point"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges. + * + * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`"bin-ordinal"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`"quantile"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`"quantize"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`"threshold"`](https://vega.github.io/vega-lite/docs/scale.html#threshold). + * + * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type). + */ + type?: ScaleType; + /** + * Customized domain values in the form of constant values or dynamic values driven by a parameter. + * + * 1) Constant `domain` for _quantitative_ fields can take one of the following forms: + * + * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property. + * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). + * - A string value `"unaggregated"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation. + * + * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime). + * + * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values. + * + * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`. + * + * 5) Domain can also takes an object defining a field or encoding of a parameter that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain. + */ + domain?: (null | string | number | boolean | DateTime | ES)[] | 'unaggregated' | ParameterExtent | DomainUnionWith | ES; + /** + * An expression for an array of raw values that, if non-null, directly overrides the _domain_ property. + * This is useful for supporting interactions such as panning or zooming a scale. + * The scale may be initially determined using a data-driven domain, then modified in response to user input by setting the rawDomain value. + */ + domainRaw?: ES; + /** + * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains. + */ + domainMid?: number | ES; + /** + * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains. + */ + domainMax?: number | DateTime | ES; + /** + * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains. + */ + domainMin?: number | DateTime | ES; + /** + * If true, reverses the order of the scale range. + * __Default value:__ `false`. + */ + reverse?: boolean | ES; + /** + * The range of the scale. One of: + * + * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `"symbol"`, or `"diverging"`). + * + * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise). + * + * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: "color"}`. + * + * __Notes:__ + * + * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`. + * + * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`). + */ + range?: RangeEnum | (number | string | number[] | ES)[] | FieldRange; + /** + * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. + */ + rangeMax?: number | string | ES; + /** + * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges. + */ + rangeMin?: number | string | ES; + /** + * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `"category10"` or `"blues"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params). + * + * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales. + * + * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference. + */ + scheme?: ColorScheme | SchemeParams | ES; + /** + * The alignment of the steps within the scale range. + * + * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis. + * + * __Default value:__ `0.5` + */ + align?: number | ES; + /** + * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are: + * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements. + * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries. + * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels. + */ + bins?: ScaleBins; + /** + * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid. + * + * __Default value:__ `false`. + */ + round?: boolean | ES; + /** + * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties. + * + * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value. + * + * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`. + * + * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`. + * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_. + * + * @minimum 0 + */ + padding?: number | ES; + /** + * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1]. + * + * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands). + * + * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`. + * + * @minimum 0 + * @maximum 1 + */ + paddingInner?: number | ES; + /** + * The outer padding (spacing) at the ends of the range of band and point scales, + * as a fraction of the step size. This value must lie in the range [0,1]. + * + * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales. + * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_. + * + * @minimum 0 + * @maximum 1 + */ + paddingOuter?: number | ES; + /** + * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value + * + * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default). + */ + clamp?: boolean | ES; + /** + * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_. + * + * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain. + * + * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `"millisecond"`, `"second"`, `"minute"`, `"hour"`, `"day"`, `"week"`, `"month"`, and `"year"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{"interval": "month", "step": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries. + * + * __Default value:__ `true` for unbinned _quantitative_ fields without explicit domain bounds; `false` otherwise. + * + */ + nice?: boolean | number | TimeInterval | TimeIntervalStep | ES; + /** + * The logarithm base of the `log` scale (default `10`). + */ + base?: number | ES; + /** + * The exponent of the `pow` scale. + */ + exponent?: number | ES; + /** + * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales. + * + * __Default value:__ `1` + */ + constant?: number | ES; + /** + * If `true`, ensures that a zero baseline value is included in the scale domain. + * + * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise. + * + * __Note:__ Log, time, and utc scales do not support `zero`. + */ + zero?: boolean | ES; + /** + * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate). + * + * * __Default value:__ `hcl` + */ + interpolate?: ScaleInterpolateEnum | ES | ScaleInterpolateParams; +} +export declare const SCALE_PROPERTIES: (keyof Scale)[]; +export declare const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES: ("reverse" | "base" | "constant" | "clamp" | "padding" | "round" | "zero" | "interpolate" | "align" | "domainMin" | "domainMax" | "domainMid" | "domainRaw" | "nice" | "bins" | "exponent" | "paddingInner" | "paddingOuter")[]; +export declare function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean; +/** + * Returns undefined if the input channel supports the input scale property name + */ +export declare function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string; +export declare function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean; +export declare function channelSupportScaleType(channel: Channel, scaleType: ScaleType, hasNestedOffsetScale?: boolean): boolean; +export {}; +//# sourceMappingURL=scale.d.ts.map \ No newline at end of file diff --git a/build/src/scale.d.ts.map b/build/src/scale.d.ts.map new file mode 100644 index 0000000000..3f6d1c15a6 --- /dev/null +++ b/build/src/scale.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scale.d.ts","sourceRoot":"","sources":["../../src/scale.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,SAAS,EACT,SAAS,EACT,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,EACT,YAAY,EACZ,gBAAgB,EACjB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,cAAc,CAAC;AAE9C,OAAO,EAAC,OAAO,EAAiB,MAAM,WAAW,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AACpC,OAAO,EAAC,OAAO,EAAC,MAAM,QAAQ,CAAC;AAE/B,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAC5C,OAAO,EAA2C,IAAI,EAAC,MAAM,QAAQ,CAAC;AAGtE,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;CAyBZ,CAAC;AAEX,KAAK,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAC7B,MAAM,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,SAAS,CAAC,CAAC;AAElD;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,GAAG,SAAS,GAAG,kBAAkB,GAAG,cAAc,CAiB/G,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,SAAS,EAA+B,CAAC;AAEnE;;GAEG;AACH,wBAAgB,eAAe,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,WAQ3E;AA4BD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,SAAS,GAAG,MAAM,CAEhE;AAED,eAAO,MAAM,mBAAmB,wBAMJ,CAA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AE,MAAM,GAAG,EAAE,CAAC;IAE3B;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAG3B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,GAAG,EAAE,CAAC;IAErB;;;;;;;;;OASG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,YAAY,GAAG,gBAAgB,GAAG,EAAE,CAAC;IAE/D;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAEvB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,EAAE,CAAC;IAEvB;;;;;;OAMG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,EAAE,CAAC;IAEpB;;;;OAIG;IACH,WAAW,CAAC,EAAE,oBAAoB,GAAG,EAAE,GAAG,sBAAsB,CAAC;CAClE;AAiCD,eAAO,MAAM,gBAAgB,sBAA6B,CAAC;AAK3D,eAAO,MAAM,2CAA2C,iOAAwD,CAAC;AAEjH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,OAAO,CAoD7F;AAED;;GAEG;AACH,wBAAgB,mCAAmC,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,KAAK,GAAG,MAAM,CAgCnG;AAED,wBAAgB,wBAAwB,CAAC,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,IAAI,GAAG,OAAO,CAU9F;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,oBAAoB,UAAQ,GAAG,OAAO,CA4CrH"} \ No newline at end of file diff --git a/build/src/scale.js b/build/src/scale.js new file mode 100644 index 0000000000..71b1903586 --- /dev/null +++ b/build/src/scale.js @@ -0,0 +1,344 @@ +import { isObject } from 'vega'; +import { isString } from 'vega-util'; +import * as CHANNEL from './channel'; +import { isColorChannel } from './channel'; +import * as log from './log'; +import { NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL } from './type'; +import { contains, keys } from './util'; +export const ScaleType = { + // Continuous - Quantitative + LINEAR: 'linear', + LOG: 'log', + POW: 'pow', + SQRT: 'sqrt', + SYMLOG: 'symlog', + IDENTITY: 'identity', + SEQUENTIAL: 'sequential', + // Continuous - Time + TIME: 'time', + UTC: 'utc', + // Discretizing scales + QUANTILE: 'quantile', + QUANTIZE: 'quantize', + THRESHOLD: 'threshold', + BIN_ORDINAL: 'bin-ordinal', + // Discrete scales + ORDINAL: 'ordinal', + POINT: 'point', + BAND: 'band' +}; +/** + * Index for scale categories -- only scale of the same categories can be merged together. + * Current implementation is trying to be conservative and avoid merging scale type that might not work together + */ +export const SCALE_CATEGORY_INDEX = { + linear: 'numeric', + log: 'numeric', + pow: 'numeric', + sqrt: 'numeric', + symlog: 'numeric', + identity: 'numeric', + sequential: 'numeric', + time: 'time', + utc: 'time', + ordinal: 'ordinal', + 'bin-ordinal': 'bin-ordinal', + point: 'ordinal-position', + band: 'ordinal-position', + quantile: 'discretizing', + quantize: 'discretizing', + threshold: 'discretizing' +}; +export const SCALE_TYPES = keys(SCALE_CATEGORY_INDEX); +/** + * Whether the two given scale types can be merged together. + */ +export function scaleCompatible(scaleType1, scaleType2) { + const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; + const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; + return (scaleCategory1 === scaleCategory2 || + (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') || + (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')); +} +/** + * Index for scale precedence -- high score = higher priority for merging. + */ +const SCALE_PRECEDENCE_INDEX = { + // numeric + linear: 0, + log: 1, + pow: 1, + sqrt: 1, + symlog: 1, + identity: 1, + sequential: 1, + // time + time: 0, + utc: 0, + // ordinal-position -- these have higher precedence than continuous scales as they support more types of data + point: 10, + band: 11, + // non grouped types + ordinal: 0, + 'bin-ordinal': 0, + quantile: 0, + quantize: 0, + threshold: 0 +}; +/** + * Return scale categories -- only scale of the same categories can be merged together. + */ +export function scaleTypePrecedence(scaleType) { + return SCALE_PRECEDENCE_INDEX[scaleType]; +} +export const QUANTITATIVE_SCALES = new Set([ + 'linear', + 'log', + 'pow', + 'sqrt', + 'symlog' +]); +export const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([ + ...QUANTITATIVE_SCALES, + 'time', + 'utc' +]); +export function isQuantitative(type) { + return QUANTITATIVE_SCALES.has(type); +} +export const CONTINUOUS_TO_DISCRETE_SCALES = new Set([ + 'quantile', + 'quantize', + 'threshold' +]); +export const CONTINUOUS_DOMAIN_SCALES = new Set([ + ...CONTINUOUS_TO_CONTINUOUS_SCALES, + ...CONTINUOUS_TO_DISCRETE_SCALES, + 'sequential', + 'identity' +]); +export const DISCRETE_DOMAIN_SCALES = new Set([ + 'ordinal', + 'bin-ordinal', + 'point', + 'band' +]); +export const TIME_SCALE_TYPES = new Set(['time', 'utc']); +export function hasDiscreteDomain(type) { + return DISCRETE_DOMAIN_SCALES.has(type); +} +export function hasContinuousDomain(type) { + return CONTINUOUS_DOMAIN_SCALES.has(type); +} +export function isContinuousToContinuous(type) { + return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type); +} +export function isContinuousToDiscrete(type) { + return CONTINUOUS_TO_DISCRETE_SCALES.has(type); +} +export const defaultScaleConfig = { + pointPadding: 0.5, + barBandPaddingInner: 0.1, + rectBandPaddingInner: 0, + bandWithNestedOffsetPaddingInner: 0.2, + bandWithNestedOffsetPaddingOuter: 0.2, + minBandSize: 2, + minFontSize: 8, + maxFontSize: 40, + minOpacity: 0.3, + maxOpacity: 0.8, + // FIXME: revise if these *can* become ratios of width/height step + minSize: 9, + minStrokeWidth: 1, + maxStrokeWidth: 4, + quantileCount: 4, + quantizeCount: 4, + zero: true +}; +export function isExtendedScheme(scheme) { + return !isString(scheme) && !!scheme['name']; +} +export function isParameterDomain(domain) { + return domain?.['param']; +} +export function isDomainUnionWith(domain) { + return domain?.['unionWith']; +} +export function isFieldRange(range) { + return isObject(range) && 'field' in range; +} +const SCALE_PROPERTY_INDEX = { + type: 1, + domain: 1, + domainMax: 1, + domainMin: 1, + domainMid: 1, + domainRaw: 1, + align: 1, + range: 1, + rangeMax: 1, + rangeMin: 1, + scheme: 1, + bins: 1, + // Other properties + reverse: 1, + round: 1, + // quantitative / time + clamp: 1, + nice: 1, + // quantitative + base: 1, + exponent: 1, + constant: 1, + interpolate: 1, + zero: 1, + // band/point + padding: 1, + paddingInner: 1, + paddingOuter: 1 +}; +export const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX); +const { type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX } = SCALE_PROPERTY_INDEX; +export const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); +export function scaleTypeSupportProperty(scaleType, propName) { + switch (propName) { + case 'type': + case 'domain': + case 'reverse': + case 'range': + return true; + case 'scheme': + case 'interpolate': + return !['point', 'band', 'identity'].includes(scaleType); + case 'bins': + return !['point', 'band', 'identity', 'ordinal'].includes(scaleType); + case 'round': + return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; + case 'padding': + case 'rangeMin': + case 'rangeMax': + return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType); + case 'paddingOuter': + case 'align': + return ['point', 'band'].includes(scaleType); + case 'paddingInner': + return scaleType === 'band'; + case 'domainMax': + case 'domainMid': + case 'domainMin': + case 'domainRaw': + case 'clamp': + return isContinuousToContinuous(scaleType); + case 'nice': + return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; + case 'exponent': + return scaleType === 'pow'; + case 'base': + return scaleType === 'log'; + case 'constant': + return scaleType === 'symlog'; + case 'zero': + return (hasContinuousDomain(scaleType) && + !contains([ + 'log', + 'time', + 'utc', + 'threshold', + 'quantile' // quantile depends on distribution so zero does not matter + ], scaleType)); + } +} +/** + * Returns undefined if the input channel supports the input scale property name + */ +export function channelScalePropertyIncompatability(channel, propName) { + switch (propName) { + case 'interpolate': + case 'scheme': + case 'domainMid': + if (!isColorChannel(channel)) { + return log.message.cannotUseScalePropertyWithNonColor(propName); + } + return undefined; + case 'align': + case 'type': + case 'bins': + case 'domain': + case 'domainMax': + case 'domainMin': + case 'domainRaw': + case 'range': + case 'base': + case 'exponent': + case 'constant': + case 'nice': + case 'padding': + case 'paddingInner': + case 'paddingOuter': + case 'rangeMax': + case 'rangeMin': + case 'reverse': + case 'round': + case 'clamp': + case 'zero': + return undefined; // GOOD! + } +} +export function scaleTypeSupportDataType(specifiedType, fieldDefType) { + if (contains([ORDINAL, NOMINAL], fieldDefType)) { + return specifiedType === undefined || hasDiscreteDomain(specifiedType); + } + else if (fieldDefType === TEMPORAL) { + return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); + } + else if (fieldDefType === QUANTITATIVE) { + return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined; + } + return true; +} +export function channelSupportScaleType(channel, scaleType, hasNestedOffsetScale = false) { + if (!CHANNEL.isScaleChannel(channel)) { + return false; + } + switch (channel) { + case CHANNEL.X: + case CHANNEL.Y: + case CHANNEL.XOFFSET: + case CHANNEL.YOFFSET: + case CHANNEL.THETA: + case CHANNEL.RADIUS: + if (isContinuousToContinuous(scaleType)) { + return true; + } + else if (scaleType === 'band') { + return true; + } + else if (scaleType === 'point') { + /* + Point scale can't be use if the position has a nested offset scale + because if there is a nested scale, then it's band. + */ + return !hasNestedOffsetScale; + } + return false; + case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification + case CHANNEL.STROKEWIDTH: + case CHANNEL.OPACITY: + case CHANNEL.FILLOPACITY: + case CHANNEL.STROKEOPACITY: + case CHANNEL.ANGLE: + // Although it generally doesn't make sense to use band with size and opacity, + // it can also work since we use band: 0.5 to get midpoint. + return (isContinuousToContinuous(scaleType) || + isContinuousToDiscrete(scaleType) || + contains(['band', 'point', 'ordinal'], scaleType)); + case CHANNEL.COLOR: + case CHANNEL.FILL: + case CHANNEL.STROKE: + return scaleType !== 'band'; // band does not make sense with color + case CHANNEL.STROKEDASH: + case CHANNEL.SHAPE: + return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); + } +} +//# sourceMappingURL=scale.js.map \ No newline at end of file diff --git a/build/src/scale.js.map b/build/src/scale.js.map new file mode 100644 index 0000000000..abdcd9bd4a --- /dev/null +++ b/build/src/scale.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scale.js","sourceRoot":"","sources":["../../src/scale.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EAQT,MAAM,MAAM,CAAC;AACd,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAEnC,OAAO,KAAK,OAAO,MAAM,WAAW,CAAC;AACrC,OAAO,EAAU,cAAc,EAAC,MAAM,WAAW,CAAC;AAGlD,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAC,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAO,MAAM,QAAQ,CAAC;AACtE,OAAO,EAAC,QAAQ,EAAQ,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,4BAA4B;IAC5B,MAAM,EAAE,QAAQ;IAChB,GAAG,EAAE,KAAK;IACV,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,QAAQ;IAEhB,QAAQ,EAAE,UAAU;IACpB,UAAU,EAAE,YAAY;IAExB,oBAAoB;IACpB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IAEV,sBAAsB;IACtB,QAAQ,EAAE,UAAU;IACpB,QAAQ,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CACL,wBAAwB,CAAC,SAAS,CAAC;gBACnC,sBAAsB,CAAC,SAAS,CAAC;gBACjC,QAAQ,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,SAAS,CAAC,EAAE,SAAS,CAAC,CAClD,CAAC;QACJ,KAAK,OAAO,CAAC,KAAK,CAAC;QACnB,KAAK,OAAO,CAAC,IAAI,CAAC;QAClB,KAAK,OAAO,CAAC,MAAM;YACjB,OAAO,SAAS,KAAK,MAAM,CAAC,CAAC,sCAAsC;QACrE,KAAK,OAAO,CAAC,UAAU,CAAC;QACxB,KAAK,OAAO,CAAC,KAAK;YAChB,OAAO,SAAS,KAAK,SAAS,IAAI,sBAAsB,CAAC,SAAS,CAAC,CAAC;KACvE;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/selection.d.ts b/build/src/selection.d.ts new file mode 100644 index 0000000000..b06389bb0e --- /dev/null +++ b/build/src/selection.d.ts @@ -0,0 +1,258 @@ +import { Binding, Color, Cursor, Stream, Vector2 } from 'vega'; +import { SingleDefUnitChannel } from './channel'; +import { FieldName, PrimitiveValue } from './channeldef'; +import { DateTime } from './datetime'; +import { ParameterName } from './parameter'; +import { Dict } from './util'; +export declare const SELECTION_ID = "_vgsid_"; +export type SelectionType = 'point' | 'interval'; +export type SelectionResolution = 'global' | 'union' | 'intersect'; +export type SelectionInit = PrimitiveValue | DateTime; +export type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2; +export type SelectionInitMapping = Dict; +export type SelectionInitIntervalMapping = Dict; +export type LegendStreamBinding = { + legend: string | Stream; +}; +export type LegendBinding = 'legend' | LegendStreamBinding; +export interface BaseSelectionConfig { + /** + * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types: + * + * - `"point"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click. + * - `"interval"` -- to select a continuous range of data values on `drag`. + */ + type: T; + /** + * Clears the selection, emptying it of all values. This property can be a + * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable clear. + * + * __Default value:__ `dblclick`. + * + * __See also:__ [`clear` examples ](https://vega.github.io/vega-lite/docs/selection.html#clear) in the documentation. + */ + clear?: Stream | string | boolean; + /** + * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection. + * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters). + * + * __See also:__ [`on` examples](https://vega.github.io/vega-lite/docs/selection.html#on) in the documentation. + */ + on?: Stream | string; + /** + * With layered and multi-view displays, a strategy that determines how + * selections' data queries are resolved when applied in a filter transform, + * conditional encoding rule, or scale domain. + * + * One of: + * - `"global"` -- only one brush exists for the entire SPLOM. When the user begins to drag, any previous brushes are cleared, and a new one is constructed. + * - `"union"` -- each cell contains its own brush, and points are highlighted if they lie within _any_ of these individual brushes. + * - `"intersect"` -- each cell contains its own brush, and points are highlighted only if they fall within _all_ of these individual brushes. + * + * __Default value:__ `global`. + * + * __See also:__ [`resolve` examples](https://vega.github.io/vega-lite/docs/selection.html#resolve) in the documentation. + */ + resolve?: SelectionResolution; + /** + * An array of encoding channels. The corresponding data field values + * must match for a data tuple to fall within the selection. + * + * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation. + */ + encodings?: SingleDefUnitChannel[]; + /** + * An array of field names whose values must match for a data tuple to + * fall within the selection. + * + * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation. + */ + fields?: FieldName[]; +} +export interface PointSelectionConfig extends BaseSelectionConfig<'point'> { + /** + * Controls whether data values should be toggled (inserted or removed from a point selection) + * or only ever inserted into point selections. + * + * One of: + * - `true` -- the default behavior, which corresponds to `"event.shiftKey"`. As a result, data values are toggled when the user interacts with the shift-key pressed. + * - `false` -- disables toggling behaviour; the selection will only ever contain a single data value corresponding to the most recent interaction. + * - A [Vega expression](https://vega.github.io/vega/docs/expressions/) which is re-evaluated as the user interacts. If the expression evaluates to `true`, the data value is toggled into or out of the point selection. If the expression evaluates to `false`, the point selection is first cleared, and the data value is then inserted. For example, setting the value to the Vega expression `"true"` will toggle data values + * without the user pressing the shift-key. + * + * __Default value:__ `true` + * + * __See also:__ [`toggle` examples](https://vega.github.io/vega-lite/docs/selection.html#toggle) in the documentation. + */ + toggle?: string | boolean; + /** + * When true, an invisible voronoi diagram is computed to accelerate discrete + * selection. The data value _nearest_ the mouse cursor is added to the selection. + * + * __Default value:__ `false`, which means that data values must be interacted with directly (e.g., clicked on) to be added to the selection. + * + * __See also:__ [`nearest` examples](https://vega.github.io/vega-lite/docs/selection.html#nearest) documentation. + */ + nearest?: boolean; +} +export interface BrushConfig { + /** + * The fill color of the interval mark. + * + * __Default value:__ `"#333333"` + * + */ + fill?: Color; + /** + * The fill opacity of the interval mark (a value between `0` and `1`). + * + * __Default value:__ `0.125` + */ + fillOpacity?: number; + /** + * The stroke color of the interval mark. + * + * __Default value:__ `"#ffffff"` + */ + stroke?: Color; + /** + * The stroke opacity of the interval mark (a value between `0` and `1`). + */ + strokeOpacity?: number; + /** + * The stroke width of the interval mark. + */ + strokeWidth?: number; + /** + * An array of alternating stroke and space lengths, for creating dashed or dotted lines. + */ + strokeDash?: number[]; + /** + * The offset (in pixels) with which to begin drawing the stroke dash array. + */ + strokeDashOffset?: number; + /** + * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. + */ + cursor?: Cursor; +} +export interface IntervalSelectionConfig extends BaseSelectionConfig<'interval'> { + /** + * When truthy, allows a user to interactively move an interval selection + * back-and-forth. Can be `true`, `false` (to disable panning), or a + * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/) + * which must include a start and end event to trigger continuous panning. + * Discrete panning (e.g., pressing the left/right arrow keys) will be supported in future versions. + * + * __Default value:__ `true`, which corresponds to `[pointerdown, window:pointerup] > window:pointermove!`. + * This default allows users to clicks and drags within an interval selection to reposition it. + * + * __See also:__ [`translate` examples](https://vega.github.io/vega-lite/docs/selection.html#translate) in the documentation. + */ + translate?: string | boolean; + /** + * When truthy, allows a user to interactively resize an interval selection. + * Can be `true`, `false` (to disable zooming), or a [Vega event stream + * definition](https://vega.github.io/vega/docs/event-streams/). Currently, + * only `wheel` events are supported, + * but custom event streams can still be used to specify filters, debouncing, and throttling. + * Future versions will expand the set of events that can trigger this transformation. + * + * __Default value:__ `true`, which corresponds to `wheel!`. This default allows users to use the mouse wheel to resize an interval selection. + * + * __See also:__ [`zoom` examples](https://vega.github.io/vega-lite/docs/selection.html#zoom) in the documentation. + */ + zoom?: string | boolean; + /** + * An interval selection also adds a rectangle mark to depict the + * extents of the interval. The `mark` property can be used to customize the + * appearance of the mark. + * + * __See also:__ [`mark` examples](https://vega.github.io/vega-lite/docs/selection.html#mark) in the documentation. + */ + mark?: BrushConfig; +} +export interface SelectionParameter { + /** + * Required. A unique name for the selection parameter. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or "$", or "_") and may not start with a digit. Reserved keywords that may not be used as parameter names are "datum", "event", "item", and "parent". + */ + name: ParameterName; + /** + * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types: + * + * - `"point"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click. + * - `"interval"` -- to select a continuous range of data values on `drag`. + */ + select: T | (T extends 'point' ? PointSelectionConfig : T extends 'interval' ? IntervalSelectionConfig : never); + /** + * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/selection.html#project) and initial values. + * + * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/value.html) documentation. + */ + value?: T extends 'point' ? SelectionInit | SelectionInitMapping[] : T extends 'interval' ? SelectionInitIntervalMapping : never; + /** + * When set, a selection is populated by input elements (also known as dynamic query widgets) + * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default; + * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property. + * + * Legend bindings are restricted to selections that only specify a single field or encoding. + * + * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind) + * or can be a mapping between projected field/encodings and binding definitions. + * + * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation. + */ + bind?: T extends 'point' ? Binding | Record | LegendBinding : T extends 'interval' ? 'scales' : never; +} +export type TopLevelSelectionParameter = SelectionParameter & { + /** + * By default, top-level selections are applied to every view in the visualization. + * If this property is specified, selections will only be applied to views with the given names. + */ + views?: string[]; +}; +export type ParameterExtent = { + /** + * The name of a parameter. + */ + param: ParameterName; + /** + * If a selection parameter is specified, the field name to extract selected values for + * when the selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings. + */ + field?: FieldName; +} | { + /** + * The name of a parameter. + */ + param: ParameterName; + /** + * If a selection parameter is specified, the encoding channel to extract selected values for + * when a selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings. + */ + encoding?: SingleDefUnitChannel; +}; +export type PointSelectionConfigWithoutType = Omit; +export type IntervalSelectionConfigWithoutType = Omit; +export interface SelectionConfig { + /** + * The default definition for a [`point`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations + * for a point selection definition (except `type`) may be specified here. + * + * For instance, setting `point` to `{"on": "dblclick"}` populates point selections on double-click by default. + */ + point?: PointSelectionConfigWithoutType; + /** + * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations + * for an interval selection definition (except `type`) may be specified here. + * + * For instance, setting `interval` to `{"translate": false}` disables the ability to move + * interval selections by default. + */ + interval?: IntervalSelectionConfigWithoutType; +} +export declare const defaultConfig: SelectionConfig; +export declare function isLegendBinding(bind: any): bind is LegendBinding; +export declare function isLegendStreamBinding(bind: any): bind is LegendStreamBinding; +export declare function isSelectionParameter(param: any): param is SelectionParameter; +//# sourceMappingURL=selection.d.ts.map \ No newline at end of file diff --git a/build/src/selection.d.ts.map b/build/src/selection.d.ts.map new file mode 100644 index 0000000000..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C;AAED,eAAO,MAAM,aAAa,EAAE,eAiB3B,CAAC;AAEF,wBAAgB,eAAe,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,aAAa,CAEhE;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,GAAG,GAAG,IAAI,IAAI,mBAAmB,CAE5E;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,kBAAkB,CAE5E"} \ No newline at end of file diff --git a/build/src/selection.js b/build/src/selection.js new file mode 100644 index 0000000000..4f6b457a75 --- /dev/null +++ b/build/src/selection.js @@ -0,0 +1,30 @@ +import { isObject } from 'vega-util'; +export const SELECTION_ID = '_vgsid_'; +export const defaultConfig = { + point: { + on: 'click', + fields: [SELECTION_ID], + toggle: 'event.shiftKey', + resolve: 'global', + clear: 'dblclick' + }, + interval: { + on: '[pointerdown, window:pointerup] > window:pointermove!', + encodings: ['x', 'y'], + translate: '[pointerdown, window:pointerup] > window:pointermove!', + zoom: 'wheel!', + mark: { fill: '#333', fillOpacity: 0.125, stroke: 'white' }, + resolve: 'global', + clear: 'dblclick' + } +}; +export function isLegendBinding(bind) { + return bind === 'legend' || !!bind?.legend; +} +export function isLegendStreamBinding(bind) { + return isLegendBinding(bind) && isObject(bind); +} +export function isSelectionParameter(param) { + return !!param?.['select']; +} +//# sourceMappingURL=selection.js.map \ No newline at end of file diff --git a/build/src/selection.js.map b/build/src/selection.js.map new file mode 100644 index 0000000000..ebb05a019d --- /dev/null +++ b/build/src/selection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"selection.js","sourceRoot":"","sources":["../../src/selection.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAC,MAAM,WAAW,CAAC;AAOnC,MAAM,CAAC,MAAM,YAAY,GAAG,SAAS,CAAC;AAuStC,MAAM,CAAC,MAAM,aAAa,GAAoB;IAC5C,KAAK,EAAE;QACL,EAAE,EAAE,OAAO;QACX,MAAM,EAAE,CAAC,YAAY,CAAC;QACtB,MAAM,EAAE,gBAAgB;QACxB,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,UAAU;KAClB;IACD,QAAQ,EAAE;QACR,EAAE,EAAE,uDAAuD;QAC3D,SAAS,EAAE,CAAC,GAAG,EAAE,GAAG,CAAC;QACrB,SAAS,EAAE,uDAAuD;QAClE,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,EAAC,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAC;QACzD,OAAO,EAAE,QAAQ;QACjB,KAAK,EAAE,UAAU;KAClB;CACF,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,IAAS;IACvC,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,EAAE,MAAM,CAAC;AAC7C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAS;IAC7C,OAAO,eAAe,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,UAAU,oBAAoB,CAAC,KAAU;IAC7C,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,QAAQ,CAAC,CAAC;AAC7B,CAAC"} \ No newline at end of file diff --git a/build/src/sort.d.ts b/build/src/sort.d.ts new file mode 100644 index 0000000000..8be1f706f6 --- /dev/null +++ b/build/src/sort.d.ts @@ -0,0 +1,82 @@ +import { NonArgAggregateOp } from './aggregate'; +import { FieldName } from './channeldef'; +import { DateTime } from './datetime'; +export type SortOrder = 'ascending' | 'descending'; +/** + * A sort definition for transform + */ +export interface SortField { + /** + * The name of the field to sort. + */ + field: FieldName; + /** + * Whether to sort the field in ascending or descending order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). + */ + order?: SortOrder | null; +} +export interface SortFields { + field: FieldName[]; + order?: SortOrder[]; +} +export declare const DEFAULT_SORT_OP = "min"; +/** + * A sort definition for sorting a discrete scale in an encoding field definition. + */ +export interface EncodingSortField { + /** + * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by. + * + * __Default value:__ If unspecified, defaults to the field specified in the outer data reference. + */ + field?: F; + /** + * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `"count"`, `"mean"` and `"median"`). + * An aggregation is required when there are multiple values of the sort field for each encoded data field. + * The input data objects will be aggregated, grouped by the encoded data field. + * + * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops). + * + * __Default value:__ `"sum"` for stacked plots. Otherwise, `"min"`. + */ + op?: NonArgAggregateOp; + /** + * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). + */ + order?: SortOrder | null; +} +export interface SortByEncoding { + /** + * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `"x"`, `"y"`) + */ + encoding: SortByChannel; + /** + * The sort order. One of `"ascending"` (default), `"descending"`, or `null` (no not sort). + */ + order?: SortOrder | null; +} +export type SortArray = number[] | string[] | boolean[] | DateTime[]; +declare const SORT_BY_CHANNEL_INDEX: { + readonly x: 1; + readonly y: 1; + readonly color: 1; + readonly fill: 1; + readonly stroke: 1; + readonly strokeWidth: 1; + readonly size: 1; + readonly shape: 1; + readonly fillOpacity: 1; + readonly strokeOpacity: 1; + readonly opacity: 1; + readonly text: 1; +}; +export type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX; +export declare function isSortByChannel(c: string): c is SortByChannel; +export type SortByChannelDesc = '-x' | '-y' | '-color' | '-fill' | '-stroke' | '-strokeWidth' | '-size' | '-shape' | '-fillOpacity' | '-strokeOpacity' | '-opacity' | '-text'; +export type AllSortString = SortOrder | SortByChannel | SortByChannelDesc; +export type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null; +export declare function isSortByEncoding(sort: Sort): sort is SortByEncoding; +export declare function isSortField(sort: Sort): sort is EncodingSortField; +export declare function isSortArray(sort: Sort): sort is SortArray; +export {}; +//# sourceMappingURL=sort.d.ts.map \ No newline at end of file diff --git a/build/src/sort.d.ts.map b/build/src/sort.d.ts.map new file mode 100644 index 0000000000..d947b9aac6 --- /dev/null +++ b/build/src/sort.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sort.d.ts","sourceRoot":"","sources":["../../src/sort.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,iBAAiB,EAAC,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,YAAY,CAAC;AAEnD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,SAAS,EAAE,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,EAAE,CAAC;CACrB;AAED,eAAO,MAAM,eAAe,QAAQ,CAAC;AAErC;;GAEG;AAEH,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,CAAC;IACV;;;;;;;;OAQG;IACH,EAAE,CAAC,EAAE,iBAAiB,CAAC;IAEvB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,QAAQ,EAAE,aAAa,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CAC1B;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE,GAAG,OAAO,EAAE,GAAG,QAAQ,EAAE,CAAC;AAErE,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;CAajB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,qBAAqB,CAAC;AAE/D,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,aAAa,CAE7D;AAED,MAAM,MAAM,iBAAiB,GACzB,IAAI,GACJ,IAAI,GACJ,QAAQ,GACR,OAAO,GACP,SAAS,GACT,cAAc,GACd,OAAO,GACP,QAAQ,GACR,cAAc,GACd,gBAAgB,GAChB,UAAU,GACV,OAAO,CAAC;AAEZ,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAE1E,MAAM,MAAM,IAAI,CAAC,CAAC,IAAI,SAAS,GAAG,aAAa,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,CAAC;AAE/F,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,cAAc,CAEzE;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAE1E;AAED,wBAAgB,WAAW,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,SAAS,CAE/D"} \ No newline at end of file diff --git a/build/src/sort.js b/build/src/sort.js new file mode 100644 index 0000000000..dc568c7c17 --- /dev/null +++ b/build/src/sort.js @@ -0,0 +1,29 @@ +import { isArray } from 'vega-util'; +export const DEFAULT_SORT_OP = 'min'; +const SORT_BY_CHANNEL_INDEX = { + x: 1, + y: 1, + color: 1, + fill: 1, + stroke: 1, + strokeWidth: 1, + size: 1, + shape: 1, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + text: 1 +}; +export function isSortByChannel(c) { + return c in SORT_BY_CHANNEL_INDEX; +} +export function isSortByEncoding(sort) { + return !!sort?.['encoding']; +} +export function isSortField(sort) { + return sort && (sort['op'] === 'count' || !!sort['field']); +} +export function isSortArray(sort) { + return sort && isArray(sort); +} +//# sourceMappingURL=sort.js.map \ No newline at end of file diff --git a/build/src/sort.js.map b/build/src/sort.js.map new file mode 100644 index 0000000000..692088baf8 --- /dev/null +++ b/build/src/sort.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sort.js","sourceRoot":"","sources":["../../src/sort.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA2BlC,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,CAAC;AA4CrC,MAAM,qBAAqB,GAAG;IAC5B,CAAC,EAAE,CAAC;IACJ,CAAC,EAAE,CAAC;IACJ,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,WAAW,EAAE,CAAC;IACd,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,WAAW,EAAE,CAAC;IACd,aAAa,EAAE,CAAC;IAChB,OAAO,EAAE,CAAC;IACV,IAAI,EAAE,CAAC;CACC,CAAC;AAIX,MAAM,UAAU,eAAe,CAAC,CAAS;IACvC,OAAO,CAAC,IAAI,qBAAqB,CAAC;AACpC,CAAC;AAoBD,MAAM,UAAU,gBAAgB,CAAI,IAAa;IAC/C,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,UAAU,CAAC,CAAC;AAC9B,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,IAAa;IAC1C,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,WAAW,CAAI,IAAa;IAC1C,OAAO,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;AAC/B,CAAC"} \ No newline at end of file diff --git a/build/src/spec/base.d.ts b/build/src/spec/base.d.ts new file mode 100644 index 0000000000..d220141754 --- /dev/null +++ b/build/src/spec/base.d.ts @@ -0,0 +1,216 @@ +import { Color, Cursor, SignalRef, Text } from 'vega'; +import { NormalizedSpec } from '.'; +import { Data } from '../data'; +import { ExprRef } from '../expr'; +import { MarkConfig } from '../mark'; +import { Resolve } from '../resolve'; +import { TitleParams } from '../title'; +import { Transform } from '../transform'; +import { LayoutAlign, RowCol } from '../vega.schema'; +export type { TopLevel } from './toplevel'; +/** + * Common properties for all types of specification + */ +export interface BaseSpec { + /** + * Title for the plot. + */ + title?: Text | TitleParams; + /** + * Name of the visualization for later reference. + */ + name?: string; + /** + * Description of this mark for commenting purpose. + */ + description?: string; + /** + * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent. + */ + data?: Data | null; + /** + * An array of data transformations such as filter and new field calculation. + */ + transform?: Transform[]; +} +export interface DataMixins { + /** + * An object describing the data source. + */ + data: Data; +} +export type StepFor = 'position' | 'offset'; +export interface Step { + /** + * The size (width/height) per discrete step. + */ + step: number; + /** + * Whether to apply the step to position scale or offset scale when there are both `x` and `xOffset` or both `y` and `yOffset` encodings. + */ + for?: StepFor; +} +export declare function getStepFor({ step, offsetIsDiscrete }: { + step: Step; + offsetIsDiscrete: boolean; +}): StepFor; +export declare function isStep(size: number | Step | 'container' | 'merged'): size is Step; +/** + * Common properties for specifying width and height of unit and layer specifications. + */ +export interface LayoutSizeMixins { + /** + * The width of a visualization. + * + * - For a plot with a continuous x-field, width should be a number. + * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.) + * - To enable responsive sizing on width, it should be set to `"container"`. + * + * __Default value:__ + * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise. + * + * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `"container"` option cannot be used. + * + * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation. + */ + width?: number | 'container' | Step; + /** + * The height of a visualization. + * + * - For a plot with a continuous y-field, height should be a number. + * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.) + * - To enable responsive sizing on height, it should be set to `"container"`. + * + * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise. + * + * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `"container"` option cannot be used. + * + * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation. + */ + height?: number | 'container' | Step; +} +export declare function isFrameMixins(o: any): o is FrameMixins; +export interface FrameMixins extends LayoutSizeMixins { + /** + * An object defining the view background's fill and stroke. + * + * __Default value:__ none (transparent) + */ + view?: ViewBackground; +} +export interface ResolveMixins { + /** + * Scale, axis, and legend resolutions for view composition specifications. + */ + resolve?: Resolve; +} +export interface BaseViewBackground extends Partial, 'cornerRadius' | 'fillOpacity' | 'opacity' | 'strokeCap' | 'strokeDash' | 'strokeDashOffset' | 'strokeJoin' | 'strokeMiterLimit' | 'strokeOpacity' | 'strokeWidth'>> { + /** + * The fill color. + * + * __Default value:__ `undefined` + */ + fill?: Color | null | ES; + /** + * The stroke color. + * + * __Default value:__ `"#ddd"` + */ + stroke?: Color | null | ES; + /** + * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used. + */ + cursor?: Cursor; +} +export interface ViewBackground extends BaseViewBackground { + /** + * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. + * + * __Default value:__ `"cell"` + * __Note:__ Any specified view background properties will augment the default style. + */ + style?: string | string[]; +} +export interface BoundsMixins { + /** + * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`. + * + * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used. + * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure. + * + * __Default value:__ `"full"` + */ + bounds?: 'full' | 'flush'; +} +/** + * Base layout for FacetSpec and RepeatSpec. + * This is named "GenericComposition" layout as ConcatLayout is a GenericCompositionLayout too + * (but _not_ vice versa). + */ +export interface GenericCompositionLayout extends BoundsMixins { + /** + * The alignment to apply to grid rows and columns. + * The supported string values are `"all"`, `"each"`, and `"none"`. + * + * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. + * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. + * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. + * + * Alternatively, an object value of the form `{"row": string, "column": string}` can be used to supply different alignments for rows and columns. + * + * __Default value:__ `"all"`. + */ + align?: LayoutAlign | RowCol; + /** + * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. + * + * An object value of the form `{"row": boolean, "column": boolean}` can be used to supply different centering values for rows and columns. + * + * __Default value:__ `false` + */ + center?: boolean | RowCol; + /** + * The spacing in pixels between sub-views of the composition operator. + * An object of the form `{"row": number, "column": number}` can be used to set + * different spacing values for rows and columns. + * + * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) + */ + spacing?: number | RowCol; +} +export declare const DEFAULT_SPACING = 20; +export interface ColumnMixins { + /** + * The number of columns to include in the view composition layout. + * + * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to + * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`). + * + * __Note__: + * + * 1) This property is only for: + * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`) + * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting) + * + * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`). + */ + columns?: number; +} +export type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins; +export type CompositionConfig = ColumnMixins & { + /** + * The default spacing in pixels between composed sub-views. + * + * __Default value__: `20` + */ + spacing?: number; +}; +export interface CompositionConfigMixins { + /** Default configuration for the `facet` view composition operator */ + facet?: CompositionConfig; + /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */ + concat?: CompositionConfig; +} +export type SpecType = 'unit' | 'facet' | 'layer' | 'concat'; +export declare function extractCompositionLayout(spec: NormalizedSpec, specType: keyof CompositionConfigMixins, config: CompositionConfigMixins): GenericCompositionLayoutWithColumns; +//# sourceMappingURL=base.d.ts.map \ No newline at end of file diff --git a/build/src/spec/base.d.ts.map b/build/src/spec/base.d.ts.map new file mode 100644 index 0000000000..c2ef1e1f28 --- /dev/null +++ b/build/src/spec/base.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../../src/spec/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAC,MAAM,MAAM,CAAC;AAEpD,OAAO,EAAC,cAAc,EAAC,MAAM,GAAG,CAAC;AACjC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,WAAW,EAAC,MAAM,UAAU,CAAC;AACrC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAC,WAAW,EAAE,MAAM,EAAC,MAAM,gBAAgB,CAAC;AAInD,YAAY,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEzC;;GAEG;AACH,MAAM,WA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Ae,KAAK,CAAC;AAElC,MAAM,WAAW,YAAY;IAC3B;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,MAAM,mCAAmC,GAAG,wBAAwB,GAAG,YAAY,CAAC;AAE1F,MAAM,MAAM,iBAAiB,GAAG,YAAY,GAAG;IAC7C;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,WAAW,uBAAuB;IACtC,sEAAsE;IACtE,KAAK,CAAC,EAAE,iBAAiB,CAAC;IAE1B,uIAAuI;IACvI,MAAM,CAAC,EAAE,iBAAiB,CAAC;CAC5B;AAYD,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7D,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,cAAc,EACpB,QAAQ,EAAE,MAAM,uBAAuB,EACvC,MAAM,EAAE,uBAAuB,GAC9B,mCAAmC,CAuCrC"} \ No newline at end of file diff --git a/build/src/spec/base.js b/build/src/spec/base.js new file mode 100644 index 0000000000..b30aa52cad --- /dev/null +++ b/build/src/spec/base.js @@ -0,0 +1,63 @@ +import { isNumber, isObject } from 'vega-util'; +import { keys } from '../util'; +import { isConcatSpec, isVConcatSpec } from './concat'; +import { isFacetMapping, isFacetSpec } from './facet'; +export function getStepFor({ step, offsetIsDiscrete }) { + if (offsetIsDiscrete) { + return step.for ?? 'offset'; + } + else { + return 'position'; + } +} +export function isStep(size) { + return isObject(size) && size['step'] !== undefined; +} +export function isFrameMixins(o) { + return o['view'] || o['width'] || o['height']; +} +export const DEFAULT_SPACING = 20; +const COMPOSITION_LAYOUT_INDEX = { + align: 1, + bounds: 1, + center: 1, + columns: 1, + spacing: 1 +}; +const COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); +export function extractCompositionLayout(spec, specType, config) { + const compositionConfig = config[specType]; + const layout = {}; + // Apply config first + const { spacing: spacingConfig, columns } = compositionConfig; + if (spacingConfig !== undefined) { + layout.spacing = spacingConfig; + } + if (columns !== undefined) { + if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) { + layout.columns = columns; + } + } + if (isVConcatSpec(spec)) { + layout.columns = 1; + } + // Then copy properties from the spec + for (const prop of COMPOSITION_LAYOUT_PROPERTIES) { + if (spec[prop] !== undefined) { + if (prop === 'spacing') { + const spacing = spec[prop]; + layout[prop] = isNumber(spacing) + ? spacing + : { + row: spacing.row ?? spacingConfig, + column: spacing.column ?? spacingConfig + }; + } + else { + layout[prop] = spec[prop]; + } + } + } + return layout; +} +//# sourceMappingURL=base.js.map \ No newline at end of file diff --git a/build/src/spec/base.js.map b/build/src/spec/base.js.map new file mode 100644 index 0000000000..bb03d1649c --- /dev/null +++ b/build/src/spec/base.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base.js","sourceRoot":"","sources":["../../../src/spec/base.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAQ7C,OAAO,EAAO,IAAI,EAAC,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;AACrD,OAAO,EAAC,cAAc,EAAE,WAAW,EAAC,MAAM,SAAS,CAAC;AAuDpD,MAAM,UAAU,UAAU,CAAC,EAAC,IAAI,EAAE,gBAAgB,EAA0C;IAC1F,IAAI,gBAAgB,EAAE;QACpB,OAAO,IAAI,CAAC,GAAG,IAAI,QAAQ,CAAC;KAC7B;SAAM;QACL,OAAO,UAAU,CAAC;KACnB;AACH,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,IAA4C;IACjE,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;AACtD,CAAC;AAuCD,MAAM,UAAU,aAAa,CAAC,CAAM;IAClC,OAAO,CAAC,C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,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,OAAO,CAAC;oBAC9B,CAAC,CAAC,OAAO;oBACT,CAAC,CAAC;wBACE,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,aAAa;wBACjC,MAAM,EAAE,OAAO,CAAC,MAAM,IAAI,aAAa;qBACxC,CAAC;aACP;iBAAM;gBACJ,MAAM,CAAC,IAAI,CAAS,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;aACpC;SACF;KACF;IAED,OAAO,MAAM,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/build/src/spec/concat.d.ts b/build/src/spec/concat.d.ts new file mode 100644 index 0000000000..b4f68df6c9 --- /dev/null +++ b/build/src/spec/concat.d.ts @@ -0,0 +1,53 @@ +import { GenericSpec, NormalizedSpec } from '.'; +import { BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; +/** + * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property. + */ +export interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins { + /** + * Boolean flag indicating if subviews should be centered relative to their respective rows or columns. + * + * __Default value:__ `false` + */ + center?: boolean; + /** + * The spacing in pixels between sub-views of the concat operator. + * + * __Default value__: `10` + */ + spacing?: number; +} +/** + * Base interface for a generalized concatenation specification. + */ +export interface GenericConcatSpec> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { + /** + * A list of views to be concatenated. + */ + concat: S[]; +} +/** + * Base interface for a vertical concatenation specification. + */ +export interface GenericVConcatSpec> extends BaseSpec, OneDirectionalConcatLayout { + /** + * A list of views to be concatenated and put into a column. + */ + vconcat: S[]; +} +/** + * Base interface for a horizontal concatenation specification. + */ +export interface GenericHConcatSpec> extends BaseSpec, OneDirectionalConcatLayout { + /** + * A list of views to be concatenated and put into a row. + */ + hconcat: S[]; +} +/** A concat spec without any shortcut/expansion syntax */ +export type NormalizedConcatSpec = GenericConcatSpec | GenericVConcatSpec | GenericHConcatSpec; +export declare function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec; +export declare function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec; +export declare function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec; +export declare function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec; +//# sourceMappingURL=concat.d.ts.map \ No newline at end of file diff --git a/build/src/spec/concat.d.ts.map b/build/src/spec/concat.d.ts.map new file mode 100644 index 0000000000..efba71e801 --- /dev/null +++ b/build/src/spec/concat.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"concat.d.ts","sourceRoot":"","sources":["../../../src/spec/concat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,cAAc,EAAC,MAAM,GAAG,CAAC;AAC9C,OAAO,EAAC,QAAQ,EAAE,YAAY,EAAE,mCAAmC,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AAElG;;GAEG;AACH,MAAM,WAAW,0BAA2B,SAAQ,YAAY,EAAE,aAAa;IAC7E;;;;OAIG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAC1E,SAAQ,QAAQ,EACd,mCAAmC,EACnC,aAAa;IACf;;OAEG;IACH,MAAM,EAAE,CAAC,EAAE,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAC3E,SAAQ,QAAQ,EACd,0BAA0B;IAC5B;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAC3E,SAAQ,QAAQ,EACd,0BAA0B;IAC5B;;OAEG;IACH,OAAO,EAAE,CAAC,EAAE,CAAC;CACd;AAED,0DAA0D;AAC1D,MAAM,MAAM,oBAAoB,GAC5B,iBAAiB,CAAC,cAAc,CAAC,GACjC,kBAAkB,CAAC,cAAc,CAAC,GAClC,kBAAkB,CAAC,cAAc,CAAC,CAAC;AAEvC,wBAAgB,eAAe,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,CAEzG;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,iBAAiB,CAAC,GAAG,CAAC,CAE3E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAE7E;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,kBAAkB,CAAC,GAAG,CAAC,CAE7E"} \ No newline at end of file diff --git a/build/src/spec/concat.js b/build/src/spec/concat.js new file mode 100644 index 0000000000..4a094ac34f --- /dev/null +++ b/build/src/spec/concat.js @@ -0,0 +1,13 @@ +export function isAnyConcatSpec(spec) { + return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); +} +export function isConcatSpec(spec) { + return 'concat' in spec; +} +export function isVConcatSpec(spec) { + return 'vconcat' in spec; +} +export function isHConcatSpec(spec) { + return 'hconcat' in spec; +} +//# sourceMappingURL=concat.js.map \ No newline at end of file diff --git a/build/src/spec/concat.js.map b/build/src/spec/concat.js.map new file mode 100644 index 0000000000..db156b0632 --- /dev/null +++ b/build/src/spec/concat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"concat.js","sourceRoot":"","sources":["../../../src/spec/concat.ts"],"names":[],"mappings":"AAiEA,MAAM,UAAU,eAAe,CAAC,IAAc;IAC5C,OAAO,aAAa,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,IAAc;IAC1C,OAAO,SAAS,IAAI,IAAI,CAAC;AAC3B,CAAC"} \ No newline at end of file diff --git a/build/src/spec/facet.d.ts b/build/src/spec/facet.d.ts new file mode 100644 index 0000000000..08e62a6693 --- /dev/null +++ b/build/src/spec/facet.d.ts @@ -0,0 +1,102 @@ +import { LayoutAlign, SignalRef } from 'vega'; +import { BinParams } from '../bin'; +import { ChannelDef, Field, FieldName, TypedFieldDef } from '../channeldef'; +import { ExprRef } from '../expr'; +import { Header } from '../header'; +import { EncodingSortField, SortArray, SortOrder } from '../sort'; +import { StandardType } from '../type'; +import { BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; +import { GenericLayerSpec, NormalizedLayerSpec } from './layer'; +import { GenericUnitSpec, NormalizedUnitSpec } from './unit'; +export interface FacetFieldDef extends TypedFieldDef { + /** + * An object defining properties of a facet's header. + */ + header?: Header | null; + /** + * Sort order for the encoded field. + * + * For continuous fields (quantitative or temporal), `sort` can be either `"ascending"` or `"descending"`. + * + * For discrete fields, `sort` can be one of the following: + * - `"ascending"` or `"descending"` -- for sorting by the values' natural order in JavaScript. + * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field. + * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `"month"` and `"day"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `"Mon"`, `"Tue"`). + * - `null` indicating no sort. + * + * __Default value:__ `"ascending"` + * + * __Note:__ `null` is not supported for `row` and `column`. + */ + sort?: SortArray | SortOrder | EncodingSortField | null; +} +export type FacetEncodingFieldDef = FacetFieldDef & GenericCompositionLayoutWithColumns; +export interface RowColumnEncodingFieldDef extends FacetFieldDef { + /** + * The alignment to apply to row/column facet's subplot. + * The supported string values are `"all"`, `"each"`, and `"none"`. + * + * - For `"none"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other. + * - For `"each"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size. + * - For `"all"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns. + * + * __Default value:__ `"all"`. + */ + align?: LayoutAlign; + /** + * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns. + * + * __Default value:__ `false` + */ + center?: boolean; + /** + * The spacing in pixels between facet's sub-views. + * + * __Default value__: Depends on `"spacing"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default) + */ + spacing?: number; +} +export interface FacetMapping = FacetFieldDef> { + /** + * A field definition for the vertical facet of trellis plots. + */ + row?: FD; + /** + * A field definition for the horizontal facet of trellis plots. + */ + column?: FD; +} +export declare function isFacetMapping(f: FacetFieldDef | FacetMapping): f is FacetMapping; +/** + * Facet mapping for encoding macro + */ +export interface EncodingFacetMapping extends FacetMapping> { + /** + * A field definition for the (flexible) facet of trellis plots. + * + * If either `row` or `column` is specified, this channel will be ignored. + */ + facet?: FacetEncodingFieldDef; +} +export declare function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef; +/** + * Base interface for a facet specification. + */ +export interface GenericFacetSpec, L extends GenericLayerSpec, F extends Field> extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { + /** + * Definition for how to facet the data. One of: + * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def) + * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping) + */ + facet: FacetFieldDef | FacetMapping; + /** + * A specification of the view that gets faceted. + */ + spec: L | U; +} +/** + * A facet specification without any shortcut / expansion syntax + */ +export type NormalizedFacetSpec = GenericFacetSpec; +export declare function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec; +//# sourceMappingURL=facet.d.ts.map \ No newline at end of file diff --git a/build/src/spec/facet.d.ts.map b/build/src/spec/facet.d.ts.map new file mode 100644 index 0000000000..01986c1a2e --- /dev/null +++ b/build/src/spec/facet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"facet.d.ts","sourceRoot":"","sources":["../../../src/spec/facet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AAC5C,OAAO,EAAC,SAAS,EAAC,MAAM,QAAQ,CAAC;AACjC,OAAO,EAAC,UAAU,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAC1E,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,iBAAiB,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,SAAS,CAAC;AAChE,OAAO,EAAC,YAAY,EAAC,MAAM,SAAS,CAAC;AACrC,OAAO,EAAC,QAAQ,EAAE,mCAAmC,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AACpF,OAAO,EAAC,gBAAgB,EAAE,mBAAmB,EAAC,MAAM,SAAS,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAC,MAAM,QAAQ,CAAC;AAE3D,MAAM,WAAW,aAAa,CAAC,CAAC,SAAS,KAAK,EAAE,EAAE,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CAClG,SAAQ,aAAa,CAAC,CAAC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H,MAAM,WAAW,oBAAoB,CAAC,CAAC,SAAS,KAAK,EAAE,EAAE,SAAS,OAAO,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,CACzG,SAAQ,YAAY,CAAC,CAAC,EAAE,yBAAyB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD;;;;OAIG;IACH,KAAK,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;CACtC;AAED,wBAAgB,eAAe,CAAC,CAAC,SAAS,KAAK,EAAE,UAAU,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,UAAU,IAAI,aAAa,CAAC,CAAC,EAAE,GAAG,CAAC,CAE/G;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC,SAAS,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC,SAAS,KAAK,CACrH,SAAQ,QAAQ,EACd,mCAAmC,EACnC,aAAa;IACf;;;;OAIG;IACH,KAAK,EAAE,aAAa,CAAC,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAE/D;;OAEG;IACH,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC;CAEb;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,kBAAkB,EAAE,mBAAmB,EAAE,SAAS,CAAC,CAAC;AAEvG,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAEnF"} \ No newline at end of file diff --git a/build/src/spec/facet.js b/build/src/spec/facet.js new file mode 100644 index 0000000000..4a4ae4fa48 --- /dev/null +++ b/build/src/spec/facet.js @@ -0,0 +1,10 @@ +export function isFacetMapping(f) { + return 'row' in f || 'column' in f; +} +export function isFacetFieldDef(channelDef) { + return !!channelDef && 'header' in channelDef; +} +export function isFacetSpec(spec) { + return 'facet' in spec; +} +//# sourceMappingURL=facet.js.map \ No newline at end of file diff --git a/build/src/spec/facet.js.map b/build/src/spec/facet.js.map new file mode 100644 index 0000000000..88f8607770 --- /dev/null +++ b/build/src/spec/facet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"facet.js","sourceRoot":"","sources":["../../../src/spec/facet.ts"],"names":[],"mappings":"AAyFA,MAAM,UAAU,cAAc,CAC5B,CAAyC;IAEzC,OAAO,KAAK,IAAI,CAAC,IAAI,QAAQ,IAAI,CAAC,CAAC;AACrC,CAAC;AAeD,MAAM,UAAU,eAAe,CAAkB,UAAyB;IACxE,OAAO,CAAC,CAAC,UAAU,IAAI,QAAQ,IAAI,UAAU,CAAC;AAChD,CAAC;AA4BD,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/build/src/spec/index.d.ts b/build/src/spec/index.d.ts new file mode 100644 index 0000000000..8fbf94ed79 --- /dev/null +++ b/build/src/spec/index.d.ts @@ -0,0 +1,44 @@ +/** + * Definition for specifications in Vega-Lite. In general, there are 3 variants of specs for each type of specs: + * - Generic specs are generic versions of specs and they are parameterized differently for internal and external specs. + * - The external specs (no prefix) would allow composite marks, row/column encodings, and mark macros like point/line overlay. + * - The internal specs (with `Normalized` prefix) would only support primitive marks and support no macros/shortcuts. + */ +import { Field, FieldName } from '../channeldef'; +import { Encoding } from '../encoding'; +import { DataMixins } from './base'; +import { GenericConcatSpec, GenericHConcatSpec, GenericVConcatSpec } from './concat'; +import { GenericFacetSpec } from './facet'; +import { GenericLayerSpec, LayerSpec, NormalizedLayerSpec } from './layer'; +import { RepeatSpec } from './repeat'; +import { TopLevel } from './toplevel'; +import { FacetedUnitSpec, GenericUnitSpec, NormalizedUnitSpec, TopLevelUnitSpec, UnitSpecWithFrame } from './unit'; +export type { BaseSpec, LayoutSizeMixins } from './base'; +export type { GenericHConcatSpec, GenericVConcatSpec, NormalizedConcatSpec } from './concat'; +export { isAnyConcatSpec, isHConcatSpec, isVConcatSpec } from './concat'; +export type { GenericFacetSpec, NormalizedFacetSpec } from './facet'; +export { isFacetSpec } from './facet'; +export type { GenericLayerSpec, LayerSpec, NormalizedLayerSpec } from './layer'; +export { isLayerSpec } from './layer'; +export type { RepeatSpec } from './repeat'; +export { isRepeatSpec } from './repeat'; +export type { TopLevel } from './toplevel'; +export type { FacetedUnitSpec, GenericUnitSpec, NormalizedUnitSpec, UnitSpec } from './unit'; +export { isUnitSpec } from './unit'; +/** + * Any specification in Vega-Lite. + */ +export type GenericSpec, any>, L extends GenericLayerSpec, R extends RepeatSpec, F extends Field> = U | L | R | GenericFacetSpec | GenericConcatSpec> | GenericVConcatSpec> | GenericHConcatSpec>; +/** + * Specs with only primitive marks and without other macros. + */ +export type NormalizedSpec = GenericSpec; +export type TopLevelFacetSpec = TopLevel, LayerSpec, Field>> & DataMixins; +export type NonNormalizedSpec = GenericSpec, LayerSpec, RepeatSpec, Field>; +/** + * A Vega-Lite top-level specification. + * This is the root class for all Vega-Lite specifications. + * (The json schema is generated from this type.) + */ +export type TopLevelSpec = TopLevelUnitSpec | TopLevelFacetSpec | TopLevel> | TopLevel | TopLevel> | TopLevel> | TopLevel>; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/build/src/spec/index.d.ts.map b/build/src/spec/index.d.ts.map new file mode 100644 index 0000000000..d10ba98402 --- /dev/null +++ b/build/src/spec/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/spec/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC;AAClC,OAAO,EAAC,iBAAiB,E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index.js b/build/src/spec/index.js new file mode 100644 index 0000000000..2f3643a306 --- /dev/null +++ b/build/src/spec/index.js @@ -0,0 +1,6 @@ +export { isAnyConcatSpec, isHConcatSpec, isVConcatSpec } from './concat'; +export { isFacetSpec } from './facet'; +export { isLayerSpec } from './layer'; +export { isRepeatSpec } from './repeat'; +export { isUnitSpec } from './unit'; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/build/src/spec/index.js.map b/build/src/spec/index.js.map new file mode 100644 index 0000000000..2923c18ef4 --- /dev/null +++ b/build/src/spec/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/spec/index.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAC,eAAe,EAAE,aAAa,EAAE,aAAa,EAAC,MAAM,UAAU,CAAC;AAEvE,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAC,WAAW,EAAC,MAAM,SAAS,CAAC;AAEpC,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AAGtC,OAAO,EAAC,UAAU,EAAC,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/build/src/spec/layer.d.ts b/build/src/spec/layer.d.ts new file mode 100644 index 0000000000..1b4c7f6844 --- /dev/null +++ b/build/src/spec/layer.d.ts @@ -0,0 +1,42 @@ +import { Field } from '../channeldef'; +import { SharedCompositeEncoding } from '../compositemark'; +import { ExprRef } from '../expr'; +import { Projection } from '../projection'; +import { BaseSpec, FrameMixins, ResolveMixins } from './base'; +import { GenericUnitSpec, NormalizedUnitSpec, UnitSpec } from './unit'; +/** + * Base interface for a layer specification. + */ +export interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins { + /** + * Layer or single view specifications to be layered. + * + * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. + */ + layer: (GenericLayerSpec | U)[]; +} +/** + * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications. + */ +export interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins { + /** + * Layer or single view specifications to be layered. + * + * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet. + */ + layer: (LayerSpec | UnitSpec)[]; + /** + * A shared key-value mapping between encoding channels and definition of fields in the underlying layers. + */ + encoding?: SharedCompositeEncoding; + /** + * An object defining properties of the geographic projection shared by underlying layers. + */ + projection?: Projection; +} +/** + * A layered specification without any shortcut/expansion syntax. + */ +export type NormalizedLayerSpec = GenericLayerSpec; +export declare function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec; +//# sourceMappingURL=layer.d.ts.map \ No newline at end of file diff --git a/build/src/spec/layer.d.ts.map b/build/src/spec/layer.d.ts.map new file mode 100644 index 0000000000..c8e9aece9d --- /dev/null +++ b/build/src/spec/layer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"layer.d.ts","sourceRoot":"","sources":["../../../src/spec/layer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,uBAAuB,EAAC,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AAC5D,OAAO,EAAC,eAAe,EAAE,kBAAkB,EAAE,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC,SAAS,eAAe,CAAC,GAAG,EAAE,GAAG,CAAC,CAAE,SAAQ,QAAQ,EAAE,WAAW,EAAE,aAAa;IACjH;;;;OAIG;IACH,KAAK,EAAE,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;CACpC;AAED;;GAEG;AACH,MAAM,WAAW,SAAS,CAAC,CAAC,SAAS,KAAK,CAAE,SAAQ,QAAQ,EAAE,WAAW,EAAE,aAAa;IACtF;;;;OAIG;IACH,KAAK,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IAEtC;;OAEG;IACH,QAAQ,CAAC,EAAE,uBAAuB,CAAC,CAAC,CAAC,CAAC;IAEtC;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;CAClC;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAAG,gBAAgB,CAAC,kBAAkB,CAAC,CAAC;AAEvE,wBAAgB,WAAW,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,gBAAgB,CAAC,GAAG,CAAC,CAEzE"} \ No newline at end of file diff --git a/build/src/spec/layer.js b/build/src/spec/layer.js new file mode 100644 index 0000000000..9f44f319b8 --- /dev/null +++ b/build/src/spec/layer.js @@ -0,0 +1,4 @@ +export function isLayerSpec(spec) { + return 'layer' in spec; +} +//# sourceMappingURL=layer.js.map \ No newline at end of file diff --git a/build/src/spec/layer.js.map b/build/src/spec/layer.js.map new file mode 100644 index 0000000000..eae73fe73b --- /dev/null +++ b/build/src/spec/layer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"layer.js","sourceRoot":"","sources":["../../../src/spec/layer.ts"],"names":[],"mappings":"AA8CA,MAAM,UAAU,WAAW,CAAC,IAAc;IACxC,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC"} \ No newline at end of file diff --git a/build/src/spec/map.d.ts b/build/src/spec/map.d.ts new file mode 100644 index 0000000000..d25b1acc15 --- /dev/null +++ b/build/src/spec/map.d.ts @@ -0,0 +1,19 @@ +import { GenericSpec } from '.'; +import { Field, FieldName } from '../channeldef'; +import { GenericConcatSpec, GenericHConcatSpec, GenericVConcatSpec } from './concat'; +import { GenericFacetSpec } from './facet'; +import { GenericLayerSpec } from './layer'; +import { RepeatSpec } from './repeat'; +import { GenericUnitSpec, NormalizedUnitSpec } from './unit'; +export declare abstract class SpecMapper, LI extends GenericLayerSpec = GenericLayerSpec, UO extends GenericUnitSpec = NormalizedUnitSpec, RO extends RepeatSpec = never, FO extends Field = FieldName> { + map(spec: GenericSpec, params: P): GenericSpec, RO, FO>; + mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec; + abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec; + protected mapLayer(spec: LI, params: P): GenericLayerSpec; + protected mapHConcat(spec: GenericHConcatSpec>, params: P): GenericHConcatSpec, RO, FO>>; + protected mapVConcat(spec: GenericVConcatSpec>, params: P): GenericVConcatSpec, RO, FO>>; + protected mapConcat(spec: GenericConcatSpec>, params: P): GenericConcatSpec, RO, FO>>; + protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO>; + protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec; +} +//# sourceMappingURL=map.d.ts.map \ No newline at end of file diff --git a/build/src/spec/map.d.ts.map b/build/src/spec/map.d.ts.map new file mode 100644 index 0000000000..45f5d7ea9c --- /dev/null +++ b/build/src/spec/map.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/spec/map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,GAAG,CAAC;AAE9B,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAInB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,gBAAgB,EAAc,MAAM,SAAS,CAAC;AACtD,OAAO,EAAC,gBAAgB,EAAc,MAAM,SAAS,CAAC;AACtD,OAAO,EAAe,UAAU,EA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AAC,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAChE,MAAM,EAAE,CAAC,GACR,kBAAkB,CAAC,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IAOpE,SAAS,CAAC,SAAS,CACjB,IAAI,EAAE,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,EAAE,EAAE,UAAU,EAAE,KAAK,CAAC,CAAC,EAC/D,MAAM,EAAE,CAAC,GACR,iBAAiB,CAAC,WAAW,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC,CAAC;IASnE,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC,EAAE,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,gBAAgB,CAAC,EAAE,EAAE,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;IASpH,SAAS,CAAC,SAAS,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,EAAE,EAAE,GAAG,EAAE,EAAE,EAAE,EAAE,CAAC;CAO/E"} \ No newline at end of file diff --git a/build/src/spec/map.js b/build/src/spec/map.js new file mode 100644 index 0000000000..c09589971a --- /dev/null +++ b/build/src/spec/map.js @@ -0,0 +1,78 @@ +import * as log from '../log'; +import { isConcatSpec, isHConcatSpec, isVConcatSpec } from './concat'; +import { isFacetSpec } from './facet'; +import { isLayerSpec } from './layer'; +import { isRepeatSpec } from './repeat'; +import { isUnitSpec } from './unit'; +export class SpecMapper { + map(spec, params) { + if (isFacetSpec(spec)) { + return this.mapFacet(spec, params); + } + else if (isRepeatSpec(spec)) { + return this.mapRepeat(spec, params); + } + else if (isHConcatSpec(spec)) { + return this.mapHConcat(spec, params); + } + else if (isVConcatSpec(spec)) { + return this.mapVConcat(spec, params); + } + else if (isConcatSpec(spec)) { + return this.mapConcat(spec, params); + } + else { + return this.mapLayerOrUnit(spec, params); + } + } + mapLayerOrUnit(spec, params) { + if (isLayerSpec(spec)) { + return this.mapLayer(spec, params); + } + else if (isUnitSpec(spec)) { + return this.mapUnit(spec, params); + } + throw new Error(log.message.invalidSpec(spec)); + } + mapLayer(spec, params) { + return { + ...spec, + layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params)) + }; + } + mapHConcat(spec, params) { + return { + ...spec, + hconcat: spec.hconcat.map(subspec => this.map(subspec, params)) + }; + } + mapVConcat(spec, params) { + return { + ...spec, + vconcat: spec.vconcat.map(subspec => this.map(subspec, params)) + }; + } + mapConcat(spec, params) { + const { concat, ...rest } = spec; + return { + ...rest, + concat: concat.map(subspec => this.map(subspec, params)) + }; + } + mapFacet(spec, params) { + return { + // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef + ...spec, + // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 + spec: this.map(spec.spec, params) + }; + } + mapRepeat(spec, params) { + return { + ...spec, + // as any is required here since TS cannot infer that the output type satisfies the input type + spec: this.map(spec.spec, params) + }; + } +} +//# sourceMappingURL=map.js.map \ No newline at end of file diff --git a/build/src/spec/map.js.map b/build/src/spec/map.js.map new file mode 100644 index 0000000000..91e813e50f --- /dev/null +++ b/build/src/spec/map.js.map @@ -0,0 +1 @@ +{"version":3,"file":"map.js","sourceRoot":"","sources":["../../../src/spec/map.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAE9B,OAAO,EAIL,YAAY,EACZ,aAAa,EACb,aAAa,EACd,MAAM,UAAU,CAAC;AAClB,OAAO,EAAmB,WAAW,EAAC,MAAM,SAAS,CAAC;AACtD,OAAO,EAAmB,WAAW,EAAC,MAAM,SAAS,CAAC;AACtD,OAAO,EAAC,YAAY,EAAa,MAAM,UAAU,CAAC;AAClD,OAAO,EAAkB,UA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of file diff --git a/build/src/spec/repeat.d.ts b/build/src/spec/repeat.d.ts new file mode 100644 index 0000000000..120ddf32a3 --- /dev/null +++ b/build/src/spec/repeat.d.ts @@ -0,0 +1,51 @@ +import { LayerSpec, NonNormalizedSpec } from '.'; +import { Field } from '../channeldef'; +import { BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins } from './base'; +import { UnitSpecWithFrame } from './unit'; +export interface RepeatMapping { + /** + * An array of fields to be repeated vertically. + */ + row?: string[]; + /** + * An array of fields to be repeated horizontally. + */ + column?: string[]; +} +export interface LayerRepeatMapping extends RepeatMapping { + /** + * An array of fields to be repeated as layers. + */ + layer: string[]; +} +export type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec; +/** + * Base interface for a repeat specification. + */ +export interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { + /** + * Definition for fields to be repeated. One of: + * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. + * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. + */ + repeat: string[] | RepeatMapping; + /** + * A specification of the view that gets repeated. + */ + spec: NonNormalizedSpec; +} +export interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins { + /** + * Definition for fields to be repeated. One of: + * 1) An array of fields to be repeated. If `"repeat"` is an array, the field can be referred to as `{"repeat": "repeat"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping. + * 2) An object that maps `"row"` and/or `"column"` to the listed fields to be repeated along the particular orientations. The objects `{"repeat": "row"}` and `{"repeat": "column"}` can be used to refer to the repeated field respectively. + */ + repeat: LayerRepeatMapping; + /** + * A specification of the view that gets repeated. + */ + spec: LayerSpec | UnitSpecWithFrame; +} +export declare function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec; +export declare function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec; +//# sourceMappingURL=repeat.d.ts.map \ No newline at end of file diff --git a/build/src/spec/repeat.d.ts.map b/build/src/spec/repeat.d.ts.map new file mode 100644 index 0000000000..47e6f403e7 --- /dev/null +++ b/build/src/spec/repeat.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"repeat.d.ts","sourceRoot":"","sources":["../../../src/spec/repeat.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,SAAS,EAAE,iBAAiB,EAAC,MAAM,GAAG,CAAC;AAC/C,OAAO,EAAC,KAAK,EAAC,MAAM,eAAe,CAAC;AACpC,OAAO,EAAC,QAAQ,EAAE,mCAAmC,EAAE,aAAa,EAAC,MAAM,QAAQ,CAAC;AACpF,OAAO,EAAC,iBAAiB,EAAC,MAAM,QAAQ,CAAC;AAEzC,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IAEf;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED,MAAM,WAAW,kBAAmB,SAAQ,aAAa;IACvD;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,MAAM,UAAU,GAAG,kBAAkB,GAAG,eAAe,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,QAAQ,EAAE,mCAAmC,EAAE,aAAa;IACtG;;;;OAIG;IACH,MAAM,EAAE,MAAM,EAAE,GAAG,aAAa,CAAC;IAEjC;;OAEG;IACH,IAAI,EAAE,iBAAiB,CAAC;CACzB;AAED,MAAM,WAAW,eAAgB,SAAQ,QAAQ,EAAE,mCAAmC,EAAE,aAAa;IACnG;;;;OAIG;IACH,MAAM,EAAE,kBAAkB,CAAC;IAE3B;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC,KAAK,CAAC,GAAG,iBAAiB,CAAC,KAAK,CAAC,CAAC;CACnD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,UAAU,CAE/D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,IAAI,eAAe,CAE3E"} \ No newline at end of file diff --git a/build/src/spec/repeat.js b/build/src/spec/repeat.js new file mode 100644 index 0000000000..a02da64866 --- /dev/null +++ b/build/src/spec/repeat.js @@ -0,0 +1,8 @@ +import { isArray } from 'vega-util'; +export function isRepeatSpec(spec) { + return 'repeat' in spec; +} +export function isLayerRepeatSpec(spec) { + return !isArray(spec.repeat) && spec.repeat['layer']; +} +//# sourceMappingURL=repeat.js.map \ No newline at end of file diff --git a/build/src/spec/repeat.js.map b/build/src/spec/repeat.js.map new file mode 100644 index 0000000000..c89bc70b05 --- /dev/null +++ b/build/src/spec/repeat.js.map @@ -0,0 +1 @@ +{"version":3,"file":"repeat.js","sourceRoot":"","sources":["../../../src/spec/repeat.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AA0DlC,MAAM,UAAU,YAAY,CAAC,IAAc;IACzC,OAAO,QAAQ,IAAI,IAAI,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAgB;IAChD,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/build/src/spec/toplevel.d.ts b/build/src/spec/toplevel.d.ts new file mode 100644 index 0000000000..6a4689fff8 --- /dev/null +++ b/build/src/spec/toplevel.d.ts @@ -0,0 +1,95 @@ +import { Color, SignalRef } from 'vega'; +import { BaseSpec } from '.'; +import { Config } from '../config'; +import { InlineDataset } from '../data'; +import { ExprRef } from '../expr'; +import { VariableParameter } from '../parameter'; +import { TopLevelSelectionParameter } from '../selection'; +import { Dict } from '../util'; +/** + * @minimum 0 + */ +export type Padding = number | { + top?: number; + bottom?: number; + left?: number; + right?: number; +}; +export type Datasets = Dict; +export type TopLevelParameter = VariableParameter | TopLevelSelectionParameter; +export type TopLevel = S & TopLevelProperties & { + /** + * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v5.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema. + * @format uri + */ + $schema?: string; + /** + * Vega-Lite configuration object. This property can only be defined at the top-level of a specification. + */ + config?: Config; + /** + * A global data store for named datasets. This is a mapping from names to inline datasets. + * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property. + */ + datasets?: Datasets; + /** + * Optional metadata that will be passed to Vega. + * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata. + */ + usermeta?: Dict; +}; +/** + * Shared properties between Top-Level specs and Config + */ +export interface TopLevelProperties { + /** + * CSS color property to use as the background of the entire view. + * + * __Default value:__ `"white"` + */ + background?: Color | ES; + /** + * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides. + * If an object, the value should have the format `{"left": 5, "top": 5, "right": 5, "bottom": 5}` to specify padding for each side of the visualization. + * + * __Default value__: `5` + */ + padding?: Padding | ES; + /** + * How the visualization size should be determined. If a string, should be one of `"pad"`, `"fit"` or `"none"`. + * Object values can additionally specify parameters for content sizing and automatic resizing. + * + * __Default value__: `pad` + */ + autosize?: AutosizeType | AutoSizeParams; + /** + * Dynamic variables or selections that parameterize a visualization. + */ + params?: TopLevelParameter[]; +} +export type FitType = 'fit' | 'fit-x' | 'fit-y'; +export declare function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType; +export declare function getFitType(sizeType?: 'width' | 'height'): FitType; +export type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y'; +export interface AutoSizeParams { + /** + * The sizing format type. One of `"pad"`, `"fit"`, `"fit-x"`, `"fit-y"`, or `"none"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each. + * + * __Default value__: `"pad"` + */ + type?: AutosizeType; + /** + * A boolean flag indicating if autosize layout should be re-calculated on every view update. + * + * __Default value__: `false` + */ + resize?: boolean; + /** + * Determines how size calculation should be performed, one of `"content"` or `"padding"`. The default setting (`"content"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `"padding"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view. + * + * __Default value__: `"content"` + */ + contains?: 'content' | 'padding'; +} +export declare function extractTopLevelProperties(t: TopLevelProperties, includeParams: boolean): TopLevelProperties; +//# sourceMappingURL=toplevel.d.ts.map \ No newline at end of file diff --git a/build/src/spec/toplevel.d.ts.map b/build/src/spec/toplevel.d.ts.map new file mode 100644 index 0000000000..cfef5f3fa1 --- /dev/null +++ b/build/src/spec/toplevel.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"toplevel.d.ts","sourceRoot":"","sources":["../../../src/spec/toplevel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,MAAM,CAAC;AACtC,OAAO,EAAC,QAAQ,EAAC,MAAM,GAAG,CAAC;AAG3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,0BAA0B,EAAC,MAAM,cAAc,CAAC;AACxD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAE7B;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA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M,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC;AAQD,wBAAgB,yBAAyB,CAAC,CAAC,EAAE,kBAAkB,EAAE,aAAa,EAAE,OAAO,iCAWtF"} \ No newline at end of file diff --git a/build/src/spec/toplevel.js b/build/src/spec/toplevel.js new file mode 100644 index 0000000000..ddba9783e7 --- /dev/null +++ b/build/src/spec/toplevel.js @@ -0,0 +1,26 @@ +import { getPositionScaleChannel } from '../channel'; +import { signalRefOrValue } from '../compile/common'; +export function isFitType(autoSizeType) { + return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; +} +export function getFitType(sizeType) { + return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit'; +} +const TOP_LEVEL_PROPERTIES = [ + 'background', + 'padding' + // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized +]; +export function extractTopLevelProperties(t, includeParams) { + const o = {}; + for (const p of TOP_LEVEL_PROPERTIES) { + if (t && t[p] !== undefined) { + o[p] = signalRefOrValue(t[p]); + } + } + if (includeParams) { + o.params = t.params; + } + return o; +} +//# sourceMappingURL=toplevel.js.map \ No newline at end of file diff --git a/build/src/spec/toplevel.js.map b/build/src/spec/toplevel.js.map new file mode 100644 index 0000000000..3ca93b72f4 --- /dev/null +++ b/build/src/spec/toplevel.js.map @@ -0,0 +1 @@ +{"version":3,"file":"toplevel.js","sourceRoot":"","sources":["../../../src/spec/toplevel.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,uBAAuB,EAAC,MAAM,YAAY,CAAC;AACnD,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AA8EnD,MAAM,UAAU,SAAS,CAAC,YAA0B;IAClD,OAAO,YAAY,KAAK,KAAK,IAAI,YAAY,KAAK,OAAO,IAAI,YAAY,KAAK,OAAO,CAAC;AACxF,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,QAA6B;IACtD,OAAO,QAAQ,CAAC,CAAC,CAAE,OAAO,uBAAuB,CAAC,QAAQ,CAAC,EAAc,CAAC,CAAC,CAAC,KAAK,CAAC;AACpF,CAAC;AA2BD,MAAM,oBAAoB,GAAiC;IACzD,YAAY;IACZ,SAAS;IACT,mHAAmH;CACpH,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,CAAqB,EAAE,aAAsB;IACrF,MAAM,CAAC,GAAkC,EAAE,CAAC;IAC5C,KAAK,MAAM,CAAC,IAAI,oBAAoB,EAAE;QACpC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,SAAS,EAAE;YAC3B,CAAC,CAAC,CAAQ,CAAC,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;SACtC;KACF;IACD,IAAI,aAAa,EAAE;QACjB,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;KACrB;IACD,OAAO,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/build/src/spec/unit.d.ts b/build/src/spec/unit.d.ts new file mode 100644 index 0000000000..c200540e07 --- /dev/null +++ b/build/src/spec/unit.d.ts @@ -0,0 +1,49 @@ +import { FieldName } from '../channeldef'; +import { CompositeEncoding, FacetedCompositeEncoding } from '../compositemark'; +import { Encoding } from '../encoding'; +import { ExprRef } from '../expr'; +import { AnyMark, Mark, MarkDef } from '../mark'; +import { Projection } from '../projection'; +import { SelectionParameter } from '../selection'; +import { Field } from './../channeldef'; +import { BaseSpec, DataMixins, FrameMixins, GenericCompositionLayout, ResolveMixins } from './base'; +import { TopLevel, TopLevelParameter } from './toplevel'; +/** + * Base interface for a unit (single-view) specification. + */ +export interface GenericUnitSpec, M, P = SelectionParameter> extends BaseSpec { + /** + * A string describing the mark type (one of `"bar"`, `"circle"`, `"square"`, `"tick"`, `"line"`, + * `"area"`, `"point"`, `"rule"`, `"geoshape"`, and `"text"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def). + */ + mark: M; + /** + * A key-value mapping between encoding channels and definition of fields. + */ + encoding?: E; + /** + * An object defining properties of geographic projection, which will be applied to `shape` path for `"geoshape"` marks + * and to `latitude` and `"longitude"` channels for other marks. + */ + projection?: Projection; + /** + * An array of parameters that may either be simple variables, or more complex selections that map user input to data queries. + */ + params?: P[]; +} +/** + * A unit specification without any shortcut/expansion syntax. + */ +export type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>; +/** + * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types). + */ +export type UnitSpec = GenericUnitSpec, AnyMark>; +export type UnitSpecWithFrame = GenericUnitSpec, AnyMark> & FrameMixins; +/** + * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec). + */ +export type FacetedUnitSpec = GenericUnitSpec, AnyMark, P> & ResolveMixins & GenericCompositionLayout & FrameMixins; +export type TopLevelUnitSpec = TopLevel> & DataMixins; +export declare function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec; +//# sourceMappingURL=unit.d.ts.map \ No newline at end of file diff --git a/build/src/spec/unit.d.ts.map b/build/src/spec/unit.d.ts.map new file mode 100644 index 0000000000..bf11c2a596 --- /dev/null +++ b/build/src/spec/unit.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/spec/unit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,iBAAiB,EAAE,wBAAwB,EAAC,MAAM,kBAAkB,CAAC;AAC7E,OAAO,EAAC,QAAQ,EAAC,MAAM,aAAa,CAAC;AACrC,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAC,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAC,UAAU,EAAC,MAAM,eAAe,CAAC;AACzC,OAAO,EA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AAS,KAAK,IAAI,QAAQ,CAAC,eAAe,CAAC,CAAC,EAAE,iBAAiB,CAAC,CAAC,GAAG,UAAU,CAAC;AAE7G,wBAAgB,UAAU,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,IAAI,eAAe,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAE5F"} \ No newline at end of file diff --git a/build/src/spec/unit.js b/build/src/spec/unit.js new file mode 100644 index 0000000000..ec360a69cb --- /dev/null +++ b/build/src/spec/unit.js @@ -0,0 +1,4 @@ +export function isUnitSpec(spec) { + return 'mark' in spec; +} +//# sourceMappingURL=unit.js.map \ No newline at end of file diff --git a/build/src/spec/unit.js.map b/build/src/spec/unit.js.map new file mode 100644 index 0000000000..b111908afe --- /dev/null +++ b/build/src/spec/unit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"unit.js","sourceRoot":"","sources":["../../../src/spec/unit.ts"],"names":[],"mappings":"AA+DA,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC"} \ No newline at end of file diff --git a/build/src/stack.d.ts b/build/src/stack.d.ts new file mode 100644 index 0000000000..f2485e8174 --- /dev/null +++ b/build/src/stack.d.ts @@ -0,0 +1,37 @@ +import { NonPositionChannel } from './channel'; +import { FieldName, TypedFieldDef } from './channeldef'; +import { Encoding } from './encoding'; +import { Mark, MarkDef } from './mark'; +declare const STACK_OFFSET_INDEX: { + readonly zero: 1; + readonly center: 1; + readonly normalize: 1; +}; +export type StackOffset = keyof typeof STACK_OFFSET_INDEX; +export declare function isStackOffset(s: string): s is StackOffset; +export interface StackProperties { + /** Dimension axis of the stack. */ + groupbyChannels: ('x' | 'y' | 'theta' | 'radius' | 'xOffset' | 'yOffset')[]; + /** Field for groupbyChannel. */ + groupbyFields: Set; + /** Measure axis of the stack. */ + fieldChannel: 'x' | 'y' | 'theta' | 'radius'; + /** Stack-by fields e.g., color, detail */ + stackBy: { + fieldDef: TypedFieldDef; + channel: NonPositionChannel; + }[]; + /** + * See `stack` property of Position Field Def. + */ + offset: StackOffset; + /** + * Whether this stack will produce impute transform + */ + impute: boolean; +} +export declare const STACKABLE_MARKS: Set<"square" | "area" | "circle" | "image" | "line" | "rect" | "text" | "point" | "arc" | "rule" | "trail" | "geoshape" | "bar" | "tick">; +export declare const STACK_BY_DEFAULT_MARKS: Set<"square" | "area" | "circle" | "image" | "line" | "rect" | "text" | "point" | "arc" | "rule" | "trail" | "geoshape" | "bar" | "tick">; +export declare function stack(m: Mark | MarkDef, encoding: Encoding): StackProperties; +export {}; +//# sourceMappingURL=stack.d.ts.map \ No newline at end of file diff --git a/build/src/stack.d.ts.map b/build/src/stack.d.ts.map new file mode 100644 index 0000000000..c0fbe13aa5 --- /dev/null +++ b/build/src/stack.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"stack.d.ts","sourceRoot":"","sources":["../../src/stack.ts"],"names":[],"mappings":"AAEA,OAAO,EAA2B,kBAAkB,EAAuB,MAAM,WAAW,CAAC;AAC7F,OAAO,EAEL,SAAS,EAOT,aAAa,EAEd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAkB,QAAQ,EAAc,MAAM,YAAY,CAAC;AAElE,OAAO,EAQL,IAAI,EACJ,OAAO,EAMR,MAAM,QAAQ,CAAC;AAGhB,QAAA,MAAM,kBAAkB;;;;CAId,CAAC;AAEX,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,kBAAkB,CAAC;AAE1D,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,GAAG,CAAC,IAAI,WAAW,CAEzD;AAED,MAAM,WAAW,eAAe;IAC9B,mCAAmC;IACnC,eAAe,EAAE,CAAC,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAC,EAAE,CAAC;IAE5E,gCAAgC;IAChC,aAAa,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC;IAE9B,iCAAiC;IACjC,YAAY,EAAE,GAAG,GAAG,GAAG,GAAG,OAAO,GAAG,QAAQ,CAAC;IAE7C,0CAA0C;IAC1C,OAAO,EAAE;QACP,QAAQ,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;QAChC,OAAO,EAAE,kBAAkB,CAAC;KAC7B,EAAE,CAAC;IAEJ;;OAEG;IACH,MAAM,EAAE,WAAW,CAAC;IAEpB;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,eAAO,MAAM,eAAe,2IAAiF,CAAC;AAC9G,eAAO,MAAM,sBAAsB,2IAAkC,CAAC;AAiEtE,wBAAgB,KAAK,CAAC,CAAC,EAAE,IAAI,GAAG,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,GAAG,eAAe,CAkIpF"} \ No newline at end of file diff --git a/build/src/stack.js b/build/src/stack.js new file mode 100644 index 0000000000..673dde0d56 --- /dev/null +++ b/build/src/stack.js @@ -0,0 +1,186 @@ +import { array, isBoolean } from 'vega-util'; +import { SUM_OPS } from './aggregate'; +import { getSecondaryRangeChannel, NONPOSITION_CHANNELS } from './channel'; +import { channelDefType, getFieldDef, isFieldDef, isFieldOrDatumDef, vgField } from './channeldef'; +import { channelHasField, isAggregate } from './encoding'; +import * as log from './log'; +import { ARC, AREA, BAR, CIRCLE, isMarkDef, isPathMark, LINE, POINT, RULE, SQUARE, TEXT, TICK } from './mark'; +import { ScaleType } from './scale'; +const STACK_OFFSET_INDEX = { + zero: 1, + center: 1, + normalize: 1 +}; +export function isStackOffset(s) { + return s in STACK_OFFSET_INDEX; +} +export const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); +export const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); +function isUnbinnedQuantitative(channelDef) { + return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin; +} +function potentialStackedChannel(encoding, x, { orient, type: mark }) { + const y = x === 'x' ? 'y' : 'radius'; + const isCartesian = x === 'x'; + const xDef = encoding[x]; + const yDef = encoding[y]; + if (isFieldDef(xDef) && isFieldDef(yDef)) { + if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) { + if (xDef.stack) { + return x; + } + else if (yDef.stack) { + return y; + } + const xAggregate = isFieldDef(xDef) && !!xDef.aggregate; + const yAggregate = isFieldDef(yDef) && !!yDef.aggregate; + // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y + if (xAggregate !== yAggregate) { + return xAggregate ? x : y; + } + if (isCartesian && ['bar', 'area'].includes(mark)) { + if (orient === 'vertical') { + return y; + } + else if (orient === 'horizontal') { + return x; + } + } + } + else if (isUnbinnedQuantitative(xDef)) { + return x; + } + else if (isUnbinnedQuantitative(yDef)) { + return y; + } + } + else if (isUnbinnedQuantitative(xDef)) { + return x; + } + else if (isUnbinnedQuantitative(yDef)) { + return y; + } + return undefined; +} +function getDimensionChannel(channel) { + switch (channel) { + case 'x': + return 'y'; + case 'y': + return 'x'; + case 'theta': + return 'radius'; + case 'radius': + return 'theta'; + } +} +export function stack(m, encoding) { + const markDef = isMarkDef(m) ? m : { type: m }; + const mark = markDef.type; + // Should have stackable mark + if (!STACKABLE_MARKS.has(mark)) { + return null; + } + // Run potential stacked twice, one for Cartesian and another for Polar, + // so text marks can be stacked in any of the coordinates. + // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. + // However, since we probably never want to do that, let's just note the limitation here. + const fieldChannel = potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef); + if (!fieldChannel) { + return null; + } + const stackedFieldDef = encoding[fieldChannel]; + const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined; + const dimensionChannel = getDimensionChannel(fieldChannel); + const groupbyChannels = []; + const groupbyFields = new Set(); + if (encoding[dimensionChannel]) { + const dimensionDef = encoding[dimensionChannel]; + const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; + if (dimensionField && dimensionField !== stackedField) { + // avoid grouping by the stacked field + groupbyChannels.push(dimensionChannel); + groupbyFields.add(dimensionField); + } + } + const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset'; + const dimensionOffsetDef = encoding[dimensionOffsetChannel]; + const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined; + if (dimensionOffsetField && dimensionOffsetField !== stackedField) { + // avoid grouping by the stacked field + groupbyChannels.push(dimensionOffsetChannel); + groupbyFields.add(dimensionOffsetField); + } + // If the dimension has offset, don't stack anymore + // Should have grouping level of detail that is different from the dimension field + const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => { + // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) + if (channel !== 'tooltip' && channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + for (const cDef of array(channelDef)) { + const fieldDef = getFieldDef(cDef); + if (fieldDef.aggregate) { + continue; + } + // Check whether the channel's field is identical to x/y's field or if the channel is a repeat + const f = vgField(fieldDef, {}); + if ( + // if fielddef is a repeat, just include it in the stack by + !f || + // otherwise, the field must be different from the groupBy fields. + !groupbyFields.has(f)) { + sc.push({ channel, fieldDef }); + } + } + } + return sc; + }, []); + // Automatically determine offset + let offset; + if (stackedFieldDef.stack !== undefined) { + if (isBoolean(stackedFieldDef.stack)) { + offset = stackedFieldDef.stack ? 'zero' : null; + } + else { + offset = stackedFieldDef.stack; + } + } + else if (STACK_BY_DEFAULT_MARKS.has(mark)) { + offset = 'zero'; + } + if (!offset || !isStackOffset(offset)) { + return null; + } + if (isAggregate(encoding) && stackBy.length === 0) { + return null; + } + // warn when stacking non-linear + if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) { + if (stackedFieldDef?.stack) { + log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type)); + } + return null; + } + // Check if it is a ranged mark + if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { + if (stackedFieldDef.stack !== undefined) { + log.warn(log.message.cannotStackRangedMark(fieldChannel)); + } + return null; + } + // Warn if stacking non-summative aggregate + if (isFieldDef(stackedFieldDef) && + stackedFieldDef.aggregate && + !SUM_OPS.has(stackedFieldDef.aggregate)) { + log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate)); + } + return { + groupbyChannels, + groupbyFields, + fieldChannel, + impute: stackedFieldDef.impute === null ? false : isPathMark(mark), + stackBy, + offset + }; +} +//# sourceMappingURL=stack.js.map \ No newline at end of file diff --git a/build/src/stack.js.map b/build/src/stack.js.map new file mode 100644 index 0000000000..7916e00b13 --- /dev/null +++ b/build/src/stack.js.map @@ -0,0 +1 @@ +{"version":3,"file":"stack.js","sourceRoot":"","sources":["../../src/stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,SAAS,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAY,OAAO,EAAC,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAC,wBAAwB,EAAsB,oBAAoB,EAAC,MAAM,WAAW,CAAC;AAC7F,OAAO,EACL,cAAc,EAEd,WAAW,EACX,UAAU,EACV,iBAAiB,EAKjB,OAAO,EACR,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,eAAe,EAAY,WAAW,EAAC,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,EACL,GAAG,EACH,IAAI,EACJ,GAAG,EACH,MAAM,EACN,SAAS,EACT,UAAU,EACV,IAAI,EAGJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACL,MAAM,QAAQ,CAAC;AAChB,OAAO,EAAC,SAAS,EAAC,MAAM,SAAS,CAAC;AAElC,MAAM,kBAAkB,GAAG;IACzB,IAAI,EAAE,CAAC;IACP,MAAM,EAAE,CAAC;IACT,SAAS,EAA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AC;QAC3B,eAAe,CAAC,SAAS;QACzB,CAAE,OAA+C,CAAC,GAAG,CAAC,eAAe,CAAC,SAAS,CAAC,EAChF;QACA,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,0BAA0B,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;KAC7E;IAED,OAAO;QACL,eAAe;QACf,aAAa;QACb,YAAY;QACZ,MAAM,EAAE,eAAe,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC;QAClE,OAAO;QACP,MAAM;KACP,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/build/src/timeunit.d.ts b/build/src/timeunit.d.ts new file mode 100644 index 0000000000..d2655fbed3 --- /dev/null +++ b/build/src/timeunit.d.ts @@ -0,0 +1,238 @@ +import { DateTime } from './datetime'; +/** Time Unit that only corresponds to only one part of Date objects. */ +export declare const LOCAL_SINGLE_TIMEUNIT_INDEX: { + readonly year: 1; + readonly quarter: 1; + readonly month: 1; + readonly week: 1; + readonly day: 1; + readonly dayofyear: 1; + readonly date: 1; + readonly hours: 1; + readonly minutes: 1; + readonly seconds: 1; + readonly milliseconds: 1; +}; +export type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX; +export declare const TIMEUNIT_PARTS: ("day" | "month" | "year" | "quarter" | "week" | "hours" | "minutes" | "seconds" | "date" | "dayofyear" | "milliseconds")[]; +export declare function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit; +export declare const UTC_SINGLE_TIMEUNIT_INDEX: { + readonly utcyear: 1; + readonly utcquarter: 1; + readonly utcmonth: 1; + readonly utcweek: 1; + readonly utcday: 1; + readonly utcdayofyear: 1; + readonly utcdate: 1; + readonly utchours: 1; + readonly utcminutes: 1; + readonly utcseconds: 1; + readonly utcmilliseconds: 1; +}; +export type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX; +export type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit; +export declare const LOCAL_MULTI_TIMEUNIT_INDEX: { + readonly yearquarter: 1; + readonly yearquartermonth: 1; + readonly yearmonth: 1; + readonly yearmonthdate: 1; + readonly yearmonthdatehours: 1; + readonly yearmonthdatehoursminutes: 1; + readonly yearmonthdatehoursminutesseconds: 1; + readonly yearweek: 1; + readonly yearweekday: 1; + readonly yearweekdayhours: 1; + readonly yearweekdayhoursminutes: 1; + readonly yearweekdayhoursminutesseconds: 1; + readonly yeardayofyear: 1; + readonly quartermonth: 1; + readonly monthdate: 1; + readonly monthdatehours: 1; + readonly monthdatehoursminutes: 1; + readonly monthdatehoursminutesseconds: 1; + readonly weekday: 1; + readonly weeksdayhours: 1; + readonly weekdayhoursminutes: 1; + readonly weekdayhoursminutesseconds: 1; + readonly dayhours: 1; + readonly dayhoursminutes: 1; + readonly dayhoursminutesseconds: 1; + readonly hoursminutes: 1; + readonly hoursminutesseconds: 1; + readonly minutesseconds: 1; + readonly secondsmilliseconds: 1; +}; +export type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX; +declare const BINNED_LOCAL_TIMEUNIT_INDEX: { + readonly binnedyear: 1; + readonly binnedyearquarter: 1; + readonly binnedyearquartermonth: 1; + readonly binnedyearmonth: 1; + readonly binnedyearmonthdate: 1; + readonly binnedyearmonthdatehours: 1; + readonly binnedyearmonthdatehoursminutes: 1; + readonly binnedyearmonthdatehoursminutesseconds: 1; + readonly binnedyearweek: 1; + readonly binnedyearweekday: 1; + readonly binnedyearweekdayhours: 1; + readonly binnedyearweekdayhoursminutes: 1; + readonly binnedyearweekdayhoursminutesseconds: 1; + readonly binnedyeardayofyear: 1; +}; +type BinnedLocalTimeUnit = keyof typeof BINNED_LOCAL_TIMEUNIT_INDEX; +declare const BINNED_UTC_TIMEUNIT_INDEX: { + binnedutcyear: number; + binnedutcyearquarter: number; + binnedutcyearquartermonth: number; + binnedutcyearmonth: number; + binnedutcyearmonthdate: number; + binnedutcyearmonthdatehours: number; + binnedutcyearmonthdatehoursminutes: number; + binnedutcyearmonthdatehoursminutesseconds: number; + binnedutcyearweek: number; + binnedutcyearweekday: number; + binnedutcyearweekdayhours: number; + binnedutcyearweekdayhoursminutes: number; + binnedutcyearweekdayhoursminutesseconds: number; + binnedutcyeardayofyear: number; +}; +export declare const BINNED_TIMEUNIT_INDEX: { + binnedutcyear: number; + binnedutcyearquarter: number; + binnedutcyearquartermonth: number; + binnedutcyearmonth: number; + binnedutcyearmonthdate: number; + binnedutcyearmonthdatehours: number; + binnedutcyearmonthdatehoursminutes: number; + binnedutcyearmonthdatehoursminutesseconds: number; + binnedutcyearweek: number; + binnedutcyearweekday: number; + binnedutcyearweekdayhours: number; + binnedutcyearweekdayhoursminutes: number; + binnedutcyearweekdayhoursminutesseconds: number; + binnedutcyeardayofyear: number; + binnedyear: 1; + binnedyearquarter: 1; + binnedyearquartermonth: 1; + binnedyearmonth: 1; + binnedyearmonthdate: 1; + binnedyearmonthdatehours: 1; + binnedyearmonthdatehoursminutes: 1; + binnedyearmonthdatehoursminutesseconds: 1; + binnedyearweek: 1; + binnedyearweekday: 1; + binnedyearweekdayhours: 1; + binnedyearweekdayhoursminutes: 1; + binnedyearweekdayhoursminutesseconds: 1; + binnedyeardayofyear: 1; +}; +type BinnedUtcTimeUnit = keyof typeof BINNED_UTC_TIMEUNIT_INDEX; +export type BinnedTimeUnit = BinnedLocalTimeUnit | BinnedUtcTimeUnit; +export declare function isBinnedTimeUnit(timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams | undefined): timeUnit is BinnedTimeUnit | TimeUnitParams; +export declare function isBinnedTimeUnitString(timeUnit: TimeUnit | BinnedTimeUnit | undefined): timeUnit is BinnedTimeUnit; +export declare const UTC_MULTI_TIMEUNIT_INDEX: { + readonly utcyearquarter: 1; + readonly utcyearquartermonth: 1; + readonly utcyearmonth: 1; + readonly utcyearmonthdate: 1; + readonly utcyearmonthdatehours: 1; + readonly utcyearmonthdatehoursminutes: 1; + readonly utcyearmonthdatehoursminutesseconds: 1; + readonly utcyearweek: 1; + readonly utcyearweekday: 1; + readonly utcyearweekdayhours: 1; + readonly utcyearweekdayhoursminutes: 1; + readonly utcyearweekdayhoursminutesseconds: 1; + readonly utcyeardayofyear: 1; + readonly utcquartermonth: 1; + readonly utcmonthdate: 1; + readonly utcmonthdatehours: 1; + readonly utcmonthdatehoursminutes: 1; + readonly utcmonthdatehoursminutesseconds: 1; + readonly utcweekday: 1; + readonly utcweeksdayhours: 1; + readonly utcweekdayhoursminutes: 1; + readonly utcweekdayhoursminutesseconds: 1; + readonly utcdayhours: 1; + readonly utcdayhoursminutes: 1; + readonly utcdayhoursminutesseconds: 1; + readonly utchoursminutes: 1; + readonly utchoursminutesseconds: 1; + readonly utcminutesseconds: 1; + readonly utcsecondsmilliseconds: 1; +}; +export type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX; +export type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit; +export type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit; +export type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit; +export declare function isUTCTimeUnit(t: string): t is UtcTimeUnit; +export declare function getLocalTimeUnitFromUTCTimeUnit(t: UtcTimeUnit): LocalTimeUnit; +export type TimeUnit = SingleTimeUnit | MultiTimeUnit; +export type TimeUnitFormat = 'year' | 'year-month' | 'year-month-date' | 'quarter' | 'month' | 'date' | 'week' | 'day' | 'hours' | 'hours-minutes' | 'minutes' | 'seconds' | 'milliseconds'; +export interface TimeUnitTransformParams { + /** + * Defines how date-time values should be binned. + */ + unit?: TimeUnit; + /** + * If no `unit` is specified, maxbins is used to infer time units. + */ + maxbins?: number; + /** + * The number of steps between bins, in terms of the least + * significant unit provided. + */ + step?: number; + /** + * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`. + */ + utc?: boolean; +} +/** + * Time Unit Params for encoding predicate, which can specified if the data is already "binned". + */ +export interface TimeUnitParams extends TimeUnitTransformParams { + /** + * Whether the data has already been binned to this time unit. + * If true, Vega-Lite will only format the data, marks, and guides, + * without applying the timeUnit transform to re-bin the data again. + */ + binned?: boolean; +} +export type TimeFormatConfig = Partial>; +export declare const VEGALITE_TIMEFORMAT: TimeFormatConfig; +export declare function getTimeUnitParts(timeUnit: TimeUnit): LocalSingleTimeUnit[]; +export declare function getSmallestTimeUnitPart(timeUnit: TimeUnit): LocalSingleTimeUnit; +/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ +export declare function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit): boolean; +/** + * Returns Vega expression for a given timeUnit and fieldRef + */ +export declare function fieldExpr(fullTimeUnit: TimeUnit, field: string, { end }?: { + end: boolean; +}): string; +export declare function timeUnitSpecifierExpression(timeUnit: TimeUnit): string; +/** + * Returns the signal expression used for axis labels for a time unit. + */ +export declare function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string; +export declare function normalizeTimeUnit(timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams): TimeUnitParams; +export declare function timeUnitToString(tu: TimeUnit | TimeUnitTransformParams): string; +export declare function durationExpr(timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitTransformParams, wrap?: (x: string) => string): string; +declare const DATE_PARTS: { + readonly year: 1; + readonly month: 1; + readonly date: 1; + readonly hours: 1; + readonly minutes: 1; + readonly seconds: 1; + readonly milliseconds: 1; +}; +type DatePart = keyof typeof DATE_PARTS; +export declare function isDatePart(timeUnit: LocalSingleTimeUnit): timeUnit is DatePart; +export declare function getDateTimePartAndStep(timeUnit: LocalSingleTimeUnit, step?: number): { + part: keyof DateTime; + step: number; +}; +export {}; +//# sourceMappingURL=timeunit.d.ts.map \ No newline at end of file diff --git a/build/src/timeunit.d.ts.map b/build/src/timeunit.d.ts.map new file mode 100644 index 0000000000..d4877498e2 --- /dev/null +++ b/build/src/timeunit.d.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src/timeunit.js b/build/src/timeunit.js new file mode 100644 index 0000000000..642815dbc3 --- /dev/null +++ b/build/src/timeunit.js @@ -0,0 +1,324 @@ +import { isObject, isString } from 'vega-util'; +import { dateTimeExprToExpr, dateTimeToExpr } from './datetime'; +import { accessPathWithDatum, keys, stringify, varName } from './util'; +/** Time Unit that only corresponds to only one part of Date objects. */ +export const LOCAL_SINGLE_TIMEUNIT_INDEX = { + year: 1, + quarter: 1, + month: 1, + week: 1, + day: 1, + dayofyear: 1, + date: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1 +}; +export const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); +export function isLocalSingleTimeUnit(timeUnit) { + return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; +} +export const UTC_SINGLE_TIMEUNIT_INDEX = { + utcyear: 1, + utcquarter: 1, + utcmonth: 1, + utcweek: 1, + utcday: 1, + utcdayofyear: 1, + utcdate: 1, + utchours: 1, + utcminutes: 1, + utcseconds: 1, + utcmilliseconds: 1 +}; +export const LOCAL_MULTI_TIMEUNIT_INDEX = { + yearquarter: 1, + yearquartermonth: 1, + yearmonth: 1, + yearmonthdate: 1, + yearmonthdatehours: 1, + yearmonthdatehoursminutes: 1, + yearmonthdatehoursminutesseconds: 1, + yearweek: 1, + yearweekday: 1, + yearweekdayhours: 1, + yearweekdayhoursminutes: 1, + yearweekdayhoursminutesseconds: 1, + yeardayofyear: 1, + quartermonth: 1, + monthdate: 1, + monthdatehours: 1, + monthdatehoursminutes: 1, + monthdatehoursminutesseconds: 1, + weekday: 1, + weeksdayhours: 1, + weekdayhoursminutes: 1, + weekdayhoursminutesseconds: 1, + dayhours: 1, + dayhoursminutes: 1, + dayhoursminutesseconds: 1, + hoursminutes: 1, + hoursminutesseconds: 1, + minutesseconds: 1, + secondsmilliseconds: 1 +}; +const BINNED_LOCAL_TIMEUNIT_INDEX = { + binnedyear: 1, + binnedyearquarter: 1, + binnedyearquartermonth: 1, + binnedyearmonth: 1, + binnedyearmonthdate: 1, + binnedyearmonthdatehours: 1, + binnedyearmonthdatehoursminutes: 1, + binnedyearmonthdatehoursminutesseconds: 1, + binnedyearweek: 1, + binnedyearweekday: 1, + binnedyearweekdayhours: 1, + binnedyearweekdayhoursminutes: 1, + binnedyearweekdayhoursminutesseconds: 1, + binnedyeardayofyear: 1 +}; +const BINNED_UTC_TIMEUNIT_INDEX = { + binnedutcyear: 1, + binnedutcyearquarter: 1, + binnedutcyearquartermonth: 1, + binnedutcyearmonth: 1, + binnedutcyearmonthdate: 1, + binnedutcyearmonthdatehours: 1, + binnedutcyearmonthdatehoursminutes: 1, + binnedutcyearmonthdatehoursminutesseconds: 1, + binnedutcyearweek: 1, + binnedutcyearweekday: 1, + binnedutcyearweekdayhours: 1, + binnedutcyearweekdayhoursminutes: 1, + binnedutcyearweekdayhoursminutesseconds: 1, + binnedutcyeardayofyear: 1 +}; +export const BINNED_TIMEUNIT_INDEX = { + ...BINNED_LOCAL_TIMEUNIT_INDEX, + ...BINNED_UTC_TIMEUNIT_INDEX +}; +export function isBinnedTimeUnit(timeUnit) { + if (isObject(timeUnit)) { + return timeUnit.binned; + } + return isBinnedTimeUnitString(timeUnit); +} +export function isBinnedTimeUnitString(timeUnit) { + return timeUnit && timeUnit.startsWith('binned'); +} +export const UTC_MULTI_TIMEUNIT_INDEX = { + utcyearquarter: 1, + utcyearquartermonth: 1, + utcyearmonth: 1, + utcyearmonthdate: 1, + utcyearmonthdatehours: 1, + utcyearmonthdatehoursminutes: 1, + utcyearmonthdatehoursminutesseconds: 1, + utcyearweek: 1, + utcyearweekday: 1, + utcyearweekdayhours: 1, + utcyearweekdayhoursminutes: 1, + utcyearweekdayhoursminutesseconds: 1, + utcyeardayofyear: 1, + utcquartermonth: 1, + utcmonthdate: 1, + utcmonthdatehours: 1, + utcmonthdatehoursminutes: 1, + utcmonthdatehoursminutesseconds: 1, + utcweekday: 1, + utcweeksdayhours: 1, + utcweekdayhoursminutes: 1, + utcweekdayhoursminutesseconds: 1, + utcdayhours: 1, + utcdayhoursminutes: 1, + utcdayhoursminutesseconds: 1, + utchoursminutes: 1, + utchoursminutesseconds: 1, + utcminutesseconds: 1, + utcsecondsmilliseconds: 1 +}; +export function isUTCTimeUnit(t) { + return t.startsWith('utc'); +} +export function getLocalTimeUnitFromUTCTimeUnit(t) { + return t.substring(3); +} +// In order of increasing specificity +export const VEGALITE_TIMEFORMAT = { + 'year-month': '%b %Y ', + 'year-month-date': '%b %d, %Y ' +}; +export function getTimeUnitParts(timeUnit) { + return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part)); +} +export function getSmallestTimeUnitPart(timeUnit) { + const parts = getTimeUnitParts(timeUnit); + return parts[parts.length - 1]; +} +/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ +export function containsTimeUnit(fullTimeUnit, timeUnit) { + const index = fullTimeUnit.indexOf(timeUnit); + if (index < 0) { + return false; + } + // exclude milliseconds + if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { + return false; + } + // exclude dayofyear + if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { + return false; + } + if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { + return false; + } + return true; +} +/** + * Returns Vega expression for a given timeUnit and fieldRef + */ +export function fieldExpr(fullTimeUnit, field, { end } = { end: false }) { + const fieldRef = accessPathWithDatum(field); + const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; + function func(timeUnit) { + if (timeUnit === 'quarter') { + // quarter starting at 0 (0,3,6,9). + return `(${utc}quarter(${fieldRef})-1)`; + } + else { + return `${utc}${timeUnit}(${fieldRef})`; + } + } + let lastTimeUnit; + const dateExpr = {}; + for (const part of TIMEUNIT_PARTS) { + if (containsTimeUnit(fullTimeUnit, part)) { + dateExpr[part] = func(part); + lastTimeUnit = part; + } + } + if (end) { + dateExpr[lastTimeUnit] += '+1'; + } + return dateTimeExprToExpr(dateExpr); +} +export function timeUnitSpecifierExpression(timeUnit) { + if (!timeUnit) { + return undefined; + } + const timeUnitParts = getTimeUnitParts(timeUnit); + return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`; +} +/** + * Returns the signal expression used for axis labels for a time unit. + */ +export function formatExpression(timeUnit, field, isUTCScale) { + if (!timeUnit) { + return undefined; + } + const expr = timeUnitSpecifierExpression(timeUnit); + // We only use utcFormat for utc scale + // For utc time units, the data is already converted as a part of timeUnit transform. + // Thus, utc time units should use timeFormat to avoid shifting the time twice. + const utc = isUTCScale || isUTCTimeUnit(timeUnit); + return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`; +} +export function normalizeTimeUnit(timeUnit) { + if (!timeUnit) { + return undefined; + } + let params; + if (isString(timeUnit)) { + if (isBinnedTimeUnitString(timeUnit)) { + params = { + unit: timeUnit.substring(6), + binned: true + }; + } + else { + params = { + unit: timeUnit + }; + } + } + else if (isObject(timeUnit)) { + params = { + ...timeUnit, + ...(timeUnit.unit ? { unit: timeUnit.unit } : {}) + }; + } + if (isUTCTimeUnit(params.unit)) { + params.utc = true; + params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit); + } + return params; +} +export function timeUnitToString(tu) { + const { utc, ...rest } = normalizeTimeUnit(tu); + if (rest.unit) { + return ((utc ? 'utc' : '') + + keys(rest) + .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`)) + .join('')); + } + else { + // when maxbins is specified instead of units + return ((utc ? 'utc' : '') + + 'timeunit' + + keys(rest) + .map(p => varName(`_${p}_${rest[p]}`)) + .join('')); + } +} +export function durationExpr(timeUnit, wrap = x => x) { + const normalizedTimeUnit = normalizeTimeUnit(timeUnit); + const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit); + if (smallestUnitPart && smallestUnitPart !== 'day') { + const startDate = { + year: 2001, + month: 1, + date: 1, + hours: 0, + minutes: 0, + seconds: 0, + milliseconds: 0 + }; + const { step, part } = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step); + const endDate = { + ...startDate, + [part]: +startDate[part] + step + }; + // Calculate timestamp duration for the smallest unit listed + return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`; + } + return undefined; +} +const DATE_PARTS = { + year: 1, + month: 1, + date: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1 +}; +export function isDatePart(timeUnit) { + return !!DATE_PARTS[timeUnit]; +} +export function getDateTimePartAndStep(timeUnit, step = 1) { + if (isDatePart(timeUnit)) { + return { part: timeUnit, step }; + } + switch (timeUnit) { + case 'day': + case 'dayofyear': + return { part: 'date', step }; + case 'quarter': + return { part: 'month', step: step * 3 }; + case 'week': + return { part: 'date', step: step * 7 }; + } +} +//# sourceMappingURL=timeunit.js.map \ No newline at end of file diff --git a/build/src/timeunit.js.map b/build/src/timeunit.js.map new file mode 100644 index 0000000000..e26b26cd95 --- /dev/null +++ b/build/src/timeunit.js.map @@ -0,0 +1 @@ +{"version":3,"file":"timeunit.js","sourceRoot":"","sources":["../../src/timeunit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAyB,kBAAkB,EAAE,cAAc,EAAC,MAAM,YAAY,CAAC;AACtF,OAAO,EAAC,mBAAmB,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,QAAQ,CAAC;AAErE,wEAAwE;AACxE,MAAM,CAAC,MAAM,2BAA2B,GAAG;IACzC,IAAI,EAAE,CAAC;IACP,OAAO,EAAE,CAAC;IACV,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,CAAC;IACN,SAAS,EAAE,CAAC;IACZ,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV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,CAAC,IAAI,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,GAAG,IAAI;SAChC,CAAC;QAEF,4DAA4D;QAC5D,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;KAChF;IACD,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,GAAG;IACjB,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,CAAC;IACV,OAAO,EAAE,CAAC;IACV,YAAY,EAAE,CAAC;CACP,CAAC;AAIX,MAAM,UAAU,UAAU,CAAC,QAA6B;IACtD,OAAO,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,sBAAsB,CACpC,QAA6B,EAC7B,IAAI,GAAG,CAAC;IAKR,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE;QACxB,OAAO,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,CAAC;KAC/B;IACD,QAAQ,QAAQ,EAAE;QAChB,KAAK,KAAK,CAAC;QACX,KAAK,WAAW;YACd,OAAO,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAC,CAAC;QAC9B,KAAK,SAAS;YACZ,OAAO,EAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,EAAC,CAAC;QACzC,KAAK,MAAM;YACT,OAAO,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,CAAC,EAAC,CAAC;KACzC;AACH,CAAC"} \ No newline at end of file diff --git a/build/src/title.d.ts b/build/src/title.d.ts new file mode 100644 index 0000000000..0a177b1aa4 --- /dev/null +++ b/build/src/title.d.ts @@ -0,0 +1,57 @@ +import { BaseTitle, SignalRef, Text, TextEncodeEntry, TitleAnchor } from 'vega'; +import { ExprRef } from './expr'; +import { MarkConfig } from './mark'; +import { MapExcludeValueRefAndReplaceSignalWith, MappedExcludeValueRef } from './vega.schema'; +export type BaseTitleNoValueRefs = MapExcludeValueRefAndReplaceSignalWith, ES> & MappedExcludeValueRef>; +export type TitleConfig = BaseTitleNoValueRefs; +export interface TitleBase extends BaseTitleNoValueRefs { + /** + * The anchor position for placing the title. One of `"start"`, `"middle"`, or `"end"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title. + * + * __Default value:__ `"middle"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. + * `"start"` for other composite views. + * + * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `"start"`. + */ + anchor?: TitleAnchor; + /** + * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark. + * + * __Default value:__ `"group-title"`. + */ + style?: string | string[]; + /** + * The integer z-index indicating the layering of the title group relative to other axis, mark and legend groups. + * + * __Default value:__ `0`. + * + * @TJS-type integer + * @minimum 0 + */ + zindex?: number; + /** + * Mark definitions for custom encoding. + * + * @hidden + */ + encoding?: TextEncodeEntry; +} +export interface TitleParams extends TitleBase { + /** + * The title text. + */ + text: Text | ES; + /** + * The subtitle Text. + */ + subtitle?: Text; +} +export declare function extractTitleConfig(titleConfig: TitleConfig): { + titleMarkConfig: MarkConfig; + subtitleMarkConfig: MarkConfig; + /** These are non-mark title config that need to be hardcoded in the title directive. */ + nonMarkTitleProperties: BaseTitleNoValueRefs; + subtitle: BaseTitleNoValueRefs; +}; +export declare function isText(v: any): v is Text; +//# sourceMappingURL=title.d.ts.map \ No newline at end of file diff --git a/build/src/title.d.ts.map b/build/src/title.d.ts.map new file mode 100644 index 0000000000..6e4d7b9d8e --- /dev/null +++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B;AAED,wBAAgB,kBAAkB,CAAC,WAAW,EAAE,WAAW,CAAC,SAAS,CAAC,GAAG;IACvE,eAAe,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IACvC,kBAAkB,EAAE,UAAU,CAAC,SAAS,CAAC,CAAC;IAC1C,wFAAwF;IACxF,sBAAsB,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;IACxD,QAAQ,EAAE,oBAAoB,CAAC,SAAS,CAAC,CAAC;CAC3C,CAuDA;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAExC"} \ No newline at end of file diff --git a/build/src/title.js b/build/src/title.js new file mode 100644 index 0000000000..ea5eb773af --- /dev/null +++ b/build/src/title.js @@ -0,0 +1,42 @@ +import { isArray, isString } from 'vega-util'; +import { pick } from './util'; +export function extractTitleConfig(titleConfig) { + const { + // These are non-mark title config that need to be hardcoded + anchor, frame, offset, orient, angle, limit, + // color needs to be redirect to fill + color, + // subtitle properties + subtitleColor, subtitleFont, subtitleFontSize, subtitleFontStyle, subtitleFontWeight, subtitleLineHeight, subtitlePadding, + // The rest are mark config. + ...rest } = titleConfig; + const titleMarkConfig = { + ...rest, + ...(color ? { fill: color } : {}) + }; + // These are non-mark title config that need to be hardcoded + const nonMarkTitleProperties = { + ...(anchor ? { anchor } : {}), + ...(frame ? { frame } : {}), + ...(offset ? { offset } : {}), + ...(orient ? { orient } : {}), + ...(angle !== undefined ? { angle } : {}), + ...(limit !== undefined ? { limit } : {}) + }; + // subtitle part can stay in config.title since header titles do not use subtitle + const subtitle = { + ...(subtitleColor ? { subtitleColor } : {}), + ...(subtitleFont ? { subtitleFont } : {}), + ...(subtitleFontSize ? { subtitleFontSize } : {}), + ...(subtitleFontStyle ? { subtitleFontStyle } : {}), + ...(subtitleFontWeight ? { subtitleFontWeight } : {}), + ...(subtitleLineHeight ? { subtitleLineHeight } : {}), + ...(subtitlePadding ? { subtitlePadding } : {}) + }; + const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); + return { titleMarkConfig, subtitleMarkConfig, nonMarkTitleProperties, subtitle }; +} +export function isText(v) { + return isString(v) || (isArray(v) && isString(v[0])); +} +//# sourceMappingURL=title.js.map \ No newline at end of file diff --git a/build/src/title.js.map b/build/src/title.js.map new file mode 100644 index 0000000000..d2c643afda --- /dev/null +++ b/build/src/title.js.map @@ -0,0 +1 @@ +{"version":3,"file":"title.js","sourceRoot":"","sources":["../../src/title.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,MAAM,WAAW,CAAC;AAG5C,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AA4D5B,MAAM,UAAU,kBAAkB,CAAC,WAAmC;IAOpE,MAAM;IACJ,4DAA4D;IAC5D,MAAM,EACN,KAAK,EACL,MAAM,EACN,MAAM,EACN,KAAK,EACL,KAAK;IAEL,qCAAqC;IACrC,KAAK;IAEL,sBAAsB;IACtB,aAAa,EACb,YAAY,EACZ,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,eAAe;IAEf,4BAA4B;IAC5B,GAAG,IAAI,EACR,GAAG,WAAW,CAAC;IAEhB,MAAM,eAAe,GAA0B;QAC7C,GAAG,IAAI;QACP,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;KAChC,CAAC;IAEF,4DAA4D;IAC5D,MAAM,sBAAsB,GAAoC;QAC9D,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3B,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAC,KAAK,EAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACzB,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,EAAC,MAAM,EAAC,CAAC,CAAC,CAAC,E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C;AACjF,CAAC;AAED,MAAM,UAAU,MAAM,CAAC,CAAM;IAC3B,OAAO,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACvD,CAAC"} \ No newline at end of file diff --git a/build/src/transform.d.ts b/build/src/transform.d.ts new file mode 100644 index 0000000000..fb2cd37592 --- /dev/null +++ b/build/src/transform.d.ts @@ -0,0 +1,522 @@ +import { AggregateOp } from 'vega'; +import { BinParams } from './bin'; +import { FieldName } from './channeldef'; +import { Data } from './data'; +import { ImputeParams } from './impute'; +import { LogicalComposition } from './logical'; +import { ParameterName } from './parameter'; +import { Predicate } from './predicate'; +import { SortField } from './sort'; +import { TimeUnit, TimeUnitTransformParams } from './timeunit'; +export interface FilterTransform { + /** + * The `filter` property must be a predication definition, which can take one of the following forms: + * + * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string, + * where `datum` can be used to refer to the current data object. + * For example, `{filter: "datum.b2 > 60"}` would make the output data includes only items that have values in the field `b2` over 60. + * + * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate): + * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate), + * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate), + * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate), + * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate), + * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate), + * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate), + * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate), + * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate), + + * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections). + * + * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3). + */ + filter: LogicalComposition; +} +export declare function isFilter(t: Transform): t is FilterTransform; +export interface CalculateTransform { + /** + * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object. + */ + calculate: string; + /** + * The field for storing the computed formula value. + */ + as: FieldName; +} +export interface BinTransform { + /** + * An object indicating bin properties, or simply `true` for using default bin parameters. + */ + bin: true | BinParams; + /** + * The data field to bin. + */ + field: FieldName; + /** + * The output fields at which to write the start and end bin values. + * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively. + * If a single string (e.g., `"val"`) is provided, the end field will be `"val_end"`. + */ + as: FieldName | FieldName[]; +} +export interface TimeUnitTransform { + /** + * The timeUnit. + */ + timeUnit: TimeUnit | TimeUnitTransformParams; + /** + * The data field to apply time unit. + */ + field: FieldName; + /** + * The output field to write the timeUnit value. + */ + as: FieldName; +} +export interface AggregateTransform { + /** + * Array of objects that define fields to aggregate. + */ + aggregate: AggregatedFieldDef[]; + /** + * The data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; +} +export interface AggregatedFieldDef { + /** + * The aggregation operation to apply to the fields (e.g., `"sum"`, `"average"`, or `"count"`). + * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops) + * for more information. + */ + op: AggregateOp; + /** + * The data field for which to compute aggregate function. This is required for all aggregation operations except `"count"`. + */ + field?: FieldName; + /** + * The output field names to use for each aggregated field. + */ + as: FieldName; +} +export interface StackTransform { + /** + * The field which is stacked. + */ + stack: FieldName; + /** + * The data fields to group by. + */ + groupby: FieldName[]; + /** + * Mode for stacking marks. One of `"zero"` (default), `"center"`, or `"normalize"`. + * The `"zero"` offset will stack starting at `0`. The `"center"` offset will center the stacks. The `"normalize"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`. + * + * __Default value:__ `"zero"` + */ + offset?: 'zero' | 'center' | 'normalize'; + /** + * Field that determines the order of leaves in the stacked charts. + */ + sort?: SortField[]; + /** + * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively. + * If a single string(e.g., `"val"`) is provided, the end field will be `"val_end"`. + */ + as: FieldName | [FieldName, FieldName]; +} +export type WindowOnlyOp = 'row_number' | 'rank' | 'dense_rank' | 'percent_rank' | 'cume_dist' | 'ntile' | 'lag' | 'lead' | 'first_value' | 'last_value' | 'nth_value'; +export interface WindowFieldDef { + /** + * The window or aggregation operation to apply within a window (e.g., `"rank"`, `"lead"`, `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops). + */ + op: AggregateOp | WindowOnlyOp; + /** + * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter. + * + * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html). + */ + param?: number; + /** + * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `"count"`, `"rank"`, `"dense_rank"`. + */ + field?: FieldName; + /** + * The output name for the window operation. + */ + as: FieldName; +} +export interface WindowTransform { + /** + * The definition of the fields in the window, and what calculations to use. + */ + window: WindowFieldDef[]; + /** + * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this. + * + * __Default value:__: `[null, 0]` (includes the current object and all preceding objects) + */ + frame?: (null | number)[]; + /** + * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations. + * + * __Default value:__ `false` + */ + ignorePeers?: boolean; + /** + * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window. + */ + groupby?: FieldName[]; + /** + * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered "peer" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`). + */ + sort?: SortField[]; +} +export interface JoinAggregateFieldDef { + /** + * The aggregation operation to apply (e.g., `"sum"`, `"average"` or `"count"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops). + */ + op: AggregateOp; + /** + * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `"count"`. + */ + field?: FieldName; + /** + * The output name for the join aggregate operation. + */ + as: FieldName; +} +export interface JoinAggregateTransform { + /** + * The definition of the fields in the join aggregate, and what calculations to use. + */ + joinaggregate: JoinAggregateFieldDef[]; + /** + * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group. + */ + groupby?: FieldName[]; +} +export interface ImputeSequence { + /** + * The starting value of the sequence. + * __Default value:__ `0` + */ + start?: number; + /** + * The ending value(exclusive) of the sequence. + */ + stop: number; + /** + * The step value between sequence entries. + * __Default value:__ `1` or `-1` if `stop < start` + */ + step?: number; +} +export declare function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence; +export interface ImputeTransform extends ImputeParams { + /** + * The data field for which the missing values should be imputed. + */ + impute: FieldName; + /** + * A key field that uniquely identifies data objects within a group. + * Missing key values (those occurring in the data but not in the current group) will be imputed. + */ + key: FieldName; + /** + * An optional array of fields by which to group the values. + * Imputation will then be performed on a per-group basis. + */ + groupby?: FieldName[]; +} +export interface FlattenTransform { + /** + * An array of one or more data fields containing arrays to flatten. + * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length. + * If the lengths of parallel arrays do not match, + * the longest array will be used with `null` values added for missing entries. + */ + flatten: FieldName[]; + /** + * The output field names for extracted array values. + * + * __Default value:__ The field name of the corresponding array field + */ + as?: FieldName[]; +} +export interface SampleTransform { + /** + * The maximum number of data objects to include in the sample. + * + * __Default value:__ `1000` + */ + sample: number; +} +export interface LookupBase { + /** + * Key in data to lookup. + */ + key: FieldName; + /** + * Fields in foreign data or selection to lookup. + * If not specified, the entire object is queried. + */ + fields?: FieldName[]; +} +export interface LookupData extends LookupBase { + /** + * Secondary data source to lookup in. + */ + data: Data; +} +export interface LookupSelection extends LookupBase { + /** + * Selection parameter name to look up. + */ + param: ParameterName; +} +export interface LookupTransform { + /** + * Key in primary data source. + */ + lookup: string; + /** + * The output fields on which to store the looked up data values. + * + * For data lookups, this property may be left blank if `from.fields` + * has been specified (those field names will be used); if `from.fields` + * has not been specified, `as` must be a string. + * + * For selection lookups, this property is optional: if unspecified, + * looked up values will be stored under a property named for the selection; + * and if specified, it must correspond to `from.fields`. + */ + as?: FieldName | FieldName[]; + /** + * The default value to use if lookup fails. + * + * __Default value:__ `null` + */ + default?: any; + /** + * Data source or selection for secondary data reference. + */ + from: LookupData | LookupSelection; +} +export declare function isLookup(t: Transform): t is LookupTransform; +export declare function isLookupData(from: LookupData | LookupSelection): from is LookupData; +export declare function isLookupSelection(from: LookupData | LookupSelection): from is LookupSelection; +export interface FoldTransform { + /** + * An array of data fields indicating the properties to fold. + */ + fold: FieldName[]; + /** + * The output field names for the key and value properties produced by the fold transform. + * __Default value:__ `["key", "value"]` + */ + as?: [FieldName, FieldName]; +} +export interface ExtentTransform { + /** + * The field of which to get the extent. + */ + extent: FieldName; + /** + * The output parameter produced by the extent transform. + */ + param: ParameterName; +} +export interface PivotTransform { + /** + * The data field to pivot on. The unique values of this field become new field names in the output stream. + */ + pivot: FieldName; + /** + * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields. + */ + value: FieldName; + /** + * The optional data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; + /** + * An optional parameter indicating the maximum number of pivoted fields to generate. + * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit. + * __Default value:__ `0` + */ + limit?: number; + /** + * The aggregation operation to apply to grouped `value` field values. + * __Default value:__ `sum` + */ + op?: AggregateOp; +} +export declare function isPivot(t: Transform): t is PivotTransform; +export interface DensityTransform { + /** + * The data field for which to perform density estimation. + */ + density: FieldName; + /** + * The data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; + /** + * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true). + * + * __Default value:__ `false` + */ + cumulative?: boolean; + /** + * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true). + * + * __Default value:__ `false` + */ + counts?: boolean; + /** + * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule. + */ + bandwidth?: number; + /** + * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field. + */ + extent?: [number, number]; + /** + * The minimum number of samples to take along the extent domain for plotting the density. + * + * __Default value:__ `25` + */ + minsteps?: number; + /** + * The maximum number of samples to take along the extent domain for plotting the density. + * + * __Default value:__ `200` + */ + maxsteps?: number; + /** + * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities. + */ + steps?: number; + /** + * The output fields for the sample value and corresponding density estimate. + * + * __Default value:__ `["value", "density"]` + */ + as?: [FieldName, FieldName]; +} +export declare function isDensity(t: Transform): t is DensityTransform; +export interface QuantileTransform { + /** + * The data field for which to perform quantile estimation. + */ + quantile: FieldName; + /** + * The data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; + /** + * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used. + */ + probs?: number[]; + /** + * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided. + */ + step?: number; + /** + * The output field names for the probability and quantile values. + * + * __Default value:__ `["prob", "value"]` + */ + as?: [FieldName, FieldName]; +} +export declare function isQuantile(t: Transform): t is QuantileTransform; +export interface RegressionTransform { + /** + * The data field of the dependent variable to predict. + */ + regression: FieldName; + /** + * The data field of the independent variable to use a predictor. + */ + on: FieldName; + /** + * The data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; + /** + * The functional form of the regression model. One of `"linear"`, `"log"`, `"exp"`, `"pow"`, `"quad"`, or `"poly"`. + * + * __Default value:__ `"linear"` + */ + method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly'; + /** + * The polynomial order (number of coefficients) for the 'poly' method. + * + * __Default value:__ `3` + */ + order?: number; + /** + * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line. + */ + extent?: [number, number]; + /** + * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points. + * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order) + * and an `rSquared` value (indicating the total variance explained by the model). + * + * __Default value:__ `false` + */ + params?: boolean; + /** + * The output field names for the smoothed points generated by the regression transform. + * + * __Default value:__ The field names of the input x and y values. + */ + as?: [FieldName, FieldName]; +} +export declare function isRegression(t: Transform): t is RegressionTransform; +export interface LoessTransform { + /** + * The data field of the dependent variable to smooth. + */ + loess: FieldName; + /** + * The data field of the independent variable to use a predictor. + */ + on: FieldName; + /** + * The data fields to group by. If not specified, a single group containing all data objects will be used. + */ + groupby?: FieldName[]; + /** + * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing. + * + * __Default value:__ `0.3` + */ + bandwidth?: number; + /** + * The output field names for the smoothed points generated by the loess transform. + * + * __Default value:__ The field names of the input x and y values. + */ + as?: [FieldName, FieldName]; +} +export declare function isLoess(t: Transform): t is LoessTransform; +export declare function isSample(t: Transform): t is SampleTransform; +export declare function isWindow(t: Transform): t is WindowTransform; +export declare function isJoinAggregate(t: Transform): t is JoinAggregateTransform; +export declare function isFlatten(t: Transform): t is FlattenTransform; +export declare function isCalculate(t: Transform): t is CalculateTransform; +export declare function isBin(t: Transform): t is BinTransform; +export declare function isImpute(t: Transform): t is ImputeTransform; +export declare function isTimeUnit(t: Transform): t is TimeUnitTransform; +export declare function isAggregate(t: Transform): t is AggregateTransform; +export declare function isStack(t: Transform): t is StackTransform; +export declare function isFold(t: Transform): t is FoldTransform; +export declare function isExtent(t: Transform): t is ExtentTransform; +export type Transform = AggregateTransform | BinTransform | CalculateTransform | DensityTransform | ExtentTransform | FilterTransform | FlattenTransform | FoldTransform | ImputeTransform | JoinAggregateTransform | LoessTransform | LookupTransform | QuantileTransform | RegressionTransform | TimeUnitTransform | SampleTransform | StackTransform | WindowTransform | PivotTransform; +export declare function normalizeTransform(transform: Transform[]): (AggregateTransform | BinTransform | CalculateTransform | DensityTransform | ExtentTransform | FlattenTransform | FoldTransform | ImputeTransform | JoinAggregateTransform | LoessTransform | LookupTransform | QuantileTransform | RegressionTransform | TimeUnitTransform | SampleTransform | StackTransform | WindowTransform | PivotTransform | { + filter: LogicalComposition; +})[]; +//# sourceMappingURL=transform.d.ts.map \ No newline at end of file diff --git a/build/src/transform.d.ts.map b/build/src/transform.d.ts.map new file mode 100644 index 0000000000..6e84b98555 --- /dev/null +++ b/build/src/transform.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"transform.d.ts","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,MAAM,CAAC;AACjC,OAAO,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAChC,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,YAAY,EAAC,MAAM,UAAU,CAAC;AACtC,OAAO,EAAC,kBAAkB,EAA8B,MAAM,W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,GAAG,CAAC,IAAI,cAAc,CAEzD;AAED,wBAAgB,MAAM,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,aAAa,CAEvD;AAED,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,GAAG,CAAC,IAAI,eAAe,CAE3D;AACD,MAAM,MAAM,SAAS,GACjB,kBAAkB,GAClB,YAAY,GACZ,kBAAkB,GAClB,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,gBAAgB,GAChB,aAAa,GACb,eAAe,GACf,sBAAsB,GACtB,cAAc,GACd,eAAe,GACf,iBAAiB,GACjB,mBAAmB,GACnB,iBAAiB,GACjB,eAAe,GACf,cAAc,GACd,eAAe,GACf,cAAc,CAAC;AAEnB,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,EAAE;;KASxD"} \ No newline at end of file diff --git a/build/src/transform.js b/build/src/transform.js new file mode 100644 index 0000000000..f94de15638 --- /dev/null +++ b/build/src/transform.js @@ -0,0 +1,79 @@ +import { normalizeLogicalComposition } from './logical'; +import { normalizePredicate } from './predicate'; +export function isFilter(t) { + return 'filter' in t; +} +export function isImputeSequence(t) { + return t?.['stop'] !== undefined; +} +export function isLookup(t) { + return 'lookup' in t; +} +export function isLookupData(from) { + return 'data' in from; +} +export function isLookupSelection(from) { + return 'param' in from; +} +export function isPivot(t) { + return 'pivot' in t; +} +export function isDensity(t) { + return 'density' in t; +} +export function isQuantile(t) { + return 'quantile' in t; +} +export function isRegression(t) { + return 'regression' in t; +} +export function isLoess(t) { + return 'loess' in t; +} +export function isSample(t) { + return 'sample' in t; +} +export function isWindow(t) { + return 'window' in t; +} +export function isJoinAggregate(t) { + return 'joinaggregate' in t; +} +export function isFlatten(t) { + return 'flatten' in t; +} +export function isCalculate(t) { + return 'calculate' in t; +} +export function isBin(t) { + return 'bin' in t; +} +export function isImpute(t) { + return 'impute' in t; +} +export function isTimeUnit(t) { + return 'timeUnit' in t; +} +export function isAggregate(t) { + return 'aggregate' in t; +} +export function isStack(t) { + return 'stack' in t; +} +export function isFold(t) { + return 'fold' in t; +} +export function isExtent(t) { + return 'extent' in t && !('density' in t); +} +export function normalizeTransform(transform) { + return transform.map(t => { + if (isFilter(t)) { + return { + filter: normalizeLogicalComposition(t.filter, normalizePredicate) + }; + } + return t; + }); +} +//# sourceMappingURL=transform.js.map \ No newline at end of file diff --git a/build/src/transform.js.map b/build/src/transform.js.map new file mode 100644 index 0000000000..50b50a995f --- /dev/null +++ b/build/src/transform.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transform.js","sourceRoot":"","sources":["../../src/transform.ts"],"names":[],"mappings":"AAKA,OAAO,EAAqB,2BAA2B,EAAC,MAAM,WAAW,CAAC;AAE1E,OAAO,EAAC,kBAAkB,EAAY,MAAM,aAAa,CAAC;AA6B1D,MAAM,UAAU,QAAQ,CAAC,CAAY;IACnC,OAAO,QAAQ,IAAI,CAAC,CAAC;AACvB,CAAC;AA8ND,MAAM,UAAU,gBAAgB,CAAC,CAAqC;IACpE,OAAO,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,SAAS,CAAC;AACnC,CAAC;AAyGD,MAAM,UAAU,QAAQ,CAAC,CAAY;IACnC,OAAO,QAAQ,IAAI,CAAC,CAAC;AACvB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAkC;IAC7D,OAAO,MAAM,IAAI,IAAI,CAAC;AACxB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,IAAkC;IAClE,OAAO,OAAO,IAAI,IAAI,CAAC;AACzB,CAAC;AAyDD,MAAM,UAAU,OAAO,CAAC,CAAY;IAClC,OAAO,OAAO,IAAI,CAAC,CAAC;AACtB,CAAC;AAgED,MAAM,UAAU,SAAS,CAAC,CAAY;IACpC,OAAO,SAAS,IAAI,CAAC,CAAC;AACxB,CAAC;AA+BD,MAAM,UAAU,UAAU,CAAC,CAAY;IACrC,OAAO,UAAU,IAAI,CAAC,CAAC;AACzB,CAAC;AAsDD,MAAM,UAAU,YAAY,CA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SAAsB;IACvD,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE;QACvB,IAAI,QAAQ,CAAC,CAAC,CAAC,EAAE;YACf,OAAO;gBACL,MAAM,EAAE,2BAA2B,CAAC,CAAC,CAAC,MAAM,EAAE,kBAAkB,CAAC;aAClE,CAAC;SACH;QACD,OAAO,CAAC,CAAC;IACX,CAAC,CAAC,CAAC;AACL,CAAC"} \ No newline at end of file diff --git a/build/src/type.d.ts b/build/src/type.d.ts new file mode 100644 index 0000000000..cf54434bcb --- /dev/null +++ b/build/src/type.d.ts @@ -0,0 +1,28 @@ +/** + * Data type based on level of measurement + */ +export declare const Type: { + readonly quantitative: "quantitative"; + readonly ordinal: "ordinal"; + readonly temporal: "temporal"; + readonly nominal: "nominal"; + readonly geojson: "geojson"; +}; +export type Type = keyof typeof Type; +export declare function isType(t: any): t is Type; +export declare function isContinuous(type: Type): type is 'quantitative' | 'temporal'; +export declare function isDiscrete(type: Type): type is 'ordinal' | 'nominal'; +export declare const QUANTITATIVE: "quantitative"; +export declare const ORDINAL: "ordinal"; +export declare const TEMPORAL: "temporal"; +export declare const NOMINAL: "nominal"; +export declare const GEOJSON: "geojson"; +export type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal'; +export declare const TYPES: ("ordinal" | "geojson" | "quantitative" | "temporal" | "nominal")[]; +/** + * Get full, lowercase type name for a given type. + * @param type + * @return Full type name. + */ +export declare function getFullName(type: Type | string): Type | undefined; +//# sourceMappingURL=type.d.ts.map \ No newline at end of file diff --git a/build/src/type.d.ts.map b/build/src/type.d.ts.map new file mode 100644 index 0000000000..f02f2ca933 --- /dev/null +++ b/build/src/type.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;CAMP,CAAC;AAEX,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,IAAI,CAAC;AAErC,wBAAgB,MAAM,CAAC,CAAC,EAAE,GAAG,GAAG,CAAC,IAAI,IAAI,CAExC;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,cAAc,GAAG,UAAU,CAE5E;AACD,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,IAAI,SAAS,GAAG,SAAS,CAEpE;AAED,eAAO,MAAM,YAAY,gBAAoB,CAAC;AAC9C,eAAO,MAAM,OAAO,WAAe,CAAC;AACpC,eAAO,MAAM,QAAQ,YAAgB,CAAC;AACtC,eAAO,MAAM,OAAO,WAAe,CAAC;AAEpC,eAAO,MAAM,OAAO,WAAe,CAAC;AAEpC,MAAM,MAAM,YAAY,GAAG,cAAc,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,CAAC;AAE/E,eAAO,MAAM,KAAK,qEAAa,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAsBjE"} \ No newline at end of file diff --git a/build/src/type.js b/build/src/type.js new file mode 100644 index 0000000000..2952240cfb --- /dev/null +++ b/build/src/type.js @@ -0,0 +1,55 @@ +import { keys } from './util'; +/** + * Data type based on level of measurement + */ +export const Type = { + quantitative: 'quantitative', + ordinal: 'ordinal', + temporal: 'temporal', + nominal: 'nominal', + geojson: 'geojson' +}; +export function isType(t) { + return t in Type; +} +export function isContinuous(type) { + return type === 'quantitative' || type === 'temporal'; +} +export function isDiscrete(type) { + return type === 'ordinal' || type === 'nominal'; +} +export const QUANTITATIVE = Type.quantitative; +export const ORDINAL = Type.ordinal; +export const TEMPORAL = Type.temporal; +export const NOMINAL = Type.nominal; +export const GEOJSON = Type.geojson; +export const TYPES = keys(Type); +/** + * Get full, lowercase type name for a given type. + * @param type + * @return Full type name. + */ +export function getFullName(type) { + if (type) { + type = type.toLowerCase(); + switch (type) { + case 'q': + case QUANTITATIVE: + return 'quantitative'; + case 't': + case TEMPORAL: + return 'temporal'; + case 'o': + case ORDINAL: + return 'ordinal'; + case 'n': + case NOMINAL: + return 'nominal'; + case GEOJSON: + return 'geojson'; + } + } + // If we get invalid input, return undefined type. + return undefined; +} +//# sourceMappingURL=type.js.map \ No newline at end of file diff --git a/build/src/type.js.map b/build/src/type.js.map new file mode 100644 index 0000000000..6fdad1eb32 --- /dev/null +++ b/build/src/type.js.map @@ -0,0 +1 @@ +{"version":3,"file":"type.js","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAE5B;;GAEG;AACH,MAAM,CAAC,MAAM,IAAI,GAAG;IAClB,YAAY,EAAE,cAAc;IAC5B,OAAO,EAAE,SAAS;IAClB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAAS;IAClB,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,MAAM,UAAU,MAAM,CAAC,CAAM;IAC3B,OAAO,CAAC,IAAI,IAAI,CAAC;AACnB,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAU;IACrC,OAAO,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,UAAU,CAAC;AACxD,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,IAAU;IACnC,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,SAAS,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,YAAY,CAAC;AAC9C,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AACpC,MAAM,CAAC,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC;AACtC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAEpC,MAAM,CAAC,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;AAIpC,MAAM,CAAC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;AAEhC;;;;GAIG;AACH,MAAM,UAAU,WAAW,CAAC,IAAmB;IAC7C,IAAI,IAAI,EAAE;QACR,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC1B,QAAQ,IAAI,EAAE;YACZ,KAAK,GAAG,CAAC;YACT,KAAK,YAAY;gBACf,OAAO,cAAc,CAAC;YACxB,KAAK,GAAG,CAAC;YACT,KAAK,QAAQ;gBACX,OAAO,UAAU,CAAC;YACpB,KAAK,GAAG,CAAC;YACT,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,GAAG,CAAC;YACT,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;YACnB,KAAK,OAAO;gBACV,OAAO,SAAS,CAAC;SACpB;KACF;IACD,kDAAkD;IAClD,OAAO,SAAS,CAAC;AACnB,CAAC"} \ No newline at end of file diff --git a/build/src/util.d.ts b/build/src/util.d.ts new file mode 100644 index 0000000000..05d9336f54 --- /dev/null +++ b/build/src/util.d.ts @@ -0,0 +1,154 @@ +import { LogicalComposition } from './logical'; +export declare const duplicate: typeof structuredClone; +export declare function never(message: string): never; +/** + * Creates an object composed of the picked object properties. + * + * var object = {'a': 1, 'b': '2', 'c': 3}; + * pick(object, ['a', 'c']); + * // → {'a': 1, 'c': 3} + */ +export declare function pick(obj: T, props: readonly K[]): Pick; +/** + * The opposite of _.pick; this method creates an object composed of the own + * and inherited enumerable string keyed properties of object that are not omitted. + */ +export declare function omit(obj: T, props: readonly K[]): Omit; +/** + * Converts any object to a string of limited size, or a number. + */ +export declare function hash(a: any): string | number; +export declare function isNullOrFalse(x: any): x is false | null; +export declare function contains(array: readonly T[], item: T): boolean; +/** + * Returns true if any item returns true. + */ +export declare function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean): boolean; +/** + * Returns true if all items return true. + */ +export declare function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean): boolean; +/** + * Like TS Partial but applies recursively to all properties. + */ +export type DeepPartial = { + [P in keyof T]?: DeepPartial; +}; +/** + * recursively merges src into dest + */ +export declare function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T; +export declare function unique(values: readonly T[], f: (item: T) => string | number): T[]; +export type Dict = Record; +/** + * Returns true if the two dictionaries agree. Applies only to defined values. + */ +export declare function isEqual(dict: Dict, other: Dict): boolean; +export declare function setEqual(a: Set, b: Set): boolean; +export declare function hasIntersection(a: ReadonlySet, b: ReadonlySet): boolean; +export declare function prefixGenerator(a: ReadonlySet): ReadonlySet; +/** + * Returns true if a and b have an intersection. Also return true if a or b are undefined + * since this means we don't know what fields a node produces or depends on. + */ +export declare function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean; +export declare function isEmpty(obj: object): boolean; +export declare const keys: (o: T) => Extract[]; +export declare const vals: { + (o: { + [s: string]: T; + } | ArrayLike): T[]; + (o: {}): any[]; +}; +export declare const entries: { + (o: { + [s: string]: T; + } | ArrayLike): [string, T][]; + (o: {}): [string, any][]; +}; +export type Flag = { + [K in S]: 1; +}; +export declare function isBoolean(b: any): b is boolean; +/** + * Convert a string into a valid variable name + */ +export declare function varName(s: string): string; +export declare function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string; +/** + * Delete nested property of an object, and delete the ancestors of the property if they become empty. + */ +export declare function deleteNestedProperty(obj: any, orderedProps: string[]): boolean; +export declare function titleCase(s: string): string; +/** + * Converts a path to an access path with datum. + * @param path The field name. + * @param datum The string to use for `datum`. + */ +export declare function accessPathWithDatum(path: string, datum?: string): string; +/** + * Return access with datum to the flattened field. + * + * @param path The field name. + * @param datum The string to use for `datum`. + */ +export declare function flatAccessWithDatum(path: string, datum?: 'datum' | 'parent' | 'datum.datum'): string; +/** + * Replaces path accesses with access to non-nested field. + * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. + */ +export declare function replacePathInField(path: string): string; +/** + * Replace all occurrences of a string with another string. + * + * @param string the string to replace in + * @param find the string to replace + * @param replacement the replacement + */ +export declare function replaceAll(string: string, find: string, replacement: string): string; +/** + * Remove path accesses with access from field. + * For example, `foo["bar"].baz` becomes `foo.bar.baz`. + */ +export declare function removePathFromField(path: string): string; +/** + * Count the depth of the path. Returns 1 for fields that are not nested. + */ +export declare function accessPathDepth(path: string): number; +/** + * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. + */ +export declare function getFirstDefined(...args: readonly T[]): T | undefined; +/** + * Returns a new random id every time it gets called. + * + * Has side effect! + */ +export declare function uniqueId(prefix?: string): string | number; +/** + * Resets the id counter used in uniqueId. This can be useful for testing. + */ +export declare function resetIdCounter(): void; +export declare function internalField(name: string): string; +export declare function isInternalField(name: string): boolean; +/** + * Normalize angle to be within [0,360). + */ +export declare function normalizeAngle(angle: number): number; +/** + * Returns whether the passed in value is a valid number. + */ +export declare function isNumeric(value: number | string): boolean; +/** + * Compares two values for equality, including arrays and objects. + * + * Adapted from https://github.com/epoberezkin/fast-deep-equal. + */ +export declare function deepEqual(a: any, b: any): boolean; +/** + * Converts any object to a string representation that can be consumed by humans. + * + * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify + */ +export declare function stringify(data: any): string; +//# sourceMappingURL=util.d.ts.map \ No newline at end of file diff --git a/build/src/util.d.ts.map b/build/src/util.d.ts.map new file mode 100644 index 0000000000..48439d4652 --- /dev/null +++ b/build/src/util.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AACA,OAAO,EAA0C,kBAAkB,EAAC,MAAM,WAAW,CAAC;AAEtF,eAAO,MAAM,SAAS,wBAAkB,CAAC;AAEzC,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAE5C;AAED;;;;;;GAMG;AAEH,wBAAgB,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,IAAI,CAAC,CAAC,EA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MAAM,UAK3C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAKzD;AAID;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,WA4DvC;AAED;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,GAAG,UA0ClC"} \ No newline at end of file diff --git a/build/src/util.js b/build/src/util.js new file mode 100644 index 0000000000..11d689a8dd --- /dev/null +++ b/build/src/util.js @@ -0,0 +1,464 @@ +import { hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig } from 'vega-util'; +import { isLogicalAnd, isLogicalNot, isLogicalOr } from './logical'; +export const duplicate = structuredClone; +export function never(message) { + throw new Error(message); +} +/** + * Creates an object composed of the picked object properties. + * + * var object = {'a': 1, 'b': '2', 'c': 3}; + * pick(object, ['a', 'c']); + * // → {'a': 1, 'c': 3} + */ +// eslint-disable-next-line @typescript-eslint/ban-types +export function pick(obj, props) { + const copy = {}; + for (const prop of props) { + if (hasOwnProperty(obj, prop)) { + copy[prop] = obj[prop]; + } + } + return copy; +} +/** + * The opposite of _.pick; this method creates an object composed of the own + * and inherited enumerable string keyed properties of object that are not omitted. + */ +// eslint-disable-next-line @typescript-eslint/ban-types +export function omit(obj, props) { + const copy = { ...obj }; + for (const prop of props) { + delete copy[prop]; + } + return copy; +} +/** + * Monkey patch Set so that `stringify` produces a string representation of sets. + */ +Set.prototype['toJSON'] = function () { + return `Set(${[...this].map(x => stringify(x)).join(',')})`; +}; +/** + * Converts any object to a string of limited size, or a number. + */ +export function hash(a) { + if (isNumber(a)) { + return a; + } + const str = isString(a) ? a : stringify(a); + // short strings can be used as hash directly, longer strings are hashed to reduce memory usage + if (str.length < 250) { + return str; + } + // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ + let h = 0; + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i); + h = (h << 5) - h + char; + h = h & h; // Convert to 32bit integer + } + return h; +} +export function isNullOrFalse(x) { + return x === false || x === null; +} +export function contains(array, item) { + return array.includes(item); +} +/** + * Returns true if any item returns true. + */ +export function some(arr, f) { + let i = 0; + for (const [k, a] of arr.entries()) { + if (f(a, k, i++)) { + return true; + } + } + return false; +} +/** + * Returns true if all items return true. + */ +export function every(arr, f) { + let i = 0; + for (const [k, a] of arr.entries()) { + if (!f(a, k, i++)) { + return false; + } + } + return true; +} +/** + * recursively merges src into dest + */ +export function mergeDeep(dest, ...src) { + for (const s of src) { + deepMerge_(dest, s ?? {}); + } + return dest; +} +function deepMerge_(dest, src) { + for (const property of keys(src)) { + writeConfig(dest, property, src[property], true); + } +} +export function unique(values, f) { + const results = []; + const u = {}; + let v; + for (const val of values) { + v = f(val); + if (v in u) { + continue; + } + u[v] = 1; + results.push(val); + } + return results; +} +/** + * Returns true if the two dictionaries agree. Applies only to defined values. + */ +export function isEqual(dict, other) { + const dictKeys = keys(dict); + const otherKeys = keys(other); + if (dictKeys.length !== otherKeys.length) { + return false; + } + for (const key of dictKeys) { + if (dict[key] !== other[key]) { + return false; + } + } + return true; +} +export function setEqual(a, b) { + if (a.size !== b.size) { + return false; + } + for (const e of a) { + if (!b.has(e)) { + return false; + } + } + return true; +} +export function hasIntersection(a, b) { + for (const key of a) { + if (b.has(key)) { + return true; + } + } + return false; +} +export function prefixGenerator(a) { + const prefixes = new Set(); + for (const x of a) { + const splitField = splitAccessPath(x); + // Wrap every element other than the first in `[]` + const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`)); + const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join('')); + for (const y of computedPrefixes) { + prefixes.add(y); + } + } + return prefixes; +} +/** + * Returns true if a and b have an intersection. Also return true if a or b are undefined + * since this means we don't know what fields a node produces or depends on. + */ +export function fieldIntersection(a, b) { + if (a === undefined || b === undefined) { + return true; + } + return hasIntersection(prefixGenerator(a), prefixGenerator(b)); +} +// eslint-disable-next-line @typescript-eslint/ban-types +export function isEmpty(obj) { + return keys(obj).length === 0; +} +// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 +export const keys = Object.keys; +export const vals = Object.values; +export const entries = Object.entries; +export function isBoolean(b) { + return b === true || b === false; +} +/** + * Convert a string into a valid variable name + */ +export function varName(s) { + // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ + const alphanumericS = s.replace(/\W/g, '_'); + // Add _ if the string has leading numbers. + return (s.match(/^\d+/) ? '_' : '') + alphanumericS; +} +export function logicalExpr(op, cb) { + if (isLogicalNot(op)) { + return `!(${logicalExpr(op.not, cb)})`; + } + else if (isLogicalAnd(op)) { + return `(${op.and.map((and) => logicalExpr(and, cb)).join(') && (')})`; + } + else if (isLogicalOr(op)) { + return `(${op.or.map((or) => logicalExpr(or, cb)).join(') || (')})`; + } + else { + return cb(op); + } +} +/** + * Delete nested property of an object, and delete the ancestors of the property if they become empty. + */ +export function deleteNestedProperty(obj, orderedProps) { + if (orderedProps.length === 0) { + return true; + } + const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion + if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { + delete obj[prop]; + } + return isEmpty(obj); +} +export function titleCase(s) { + return s.charAt(0).toUpperCase() + s.substr(1); +} +/** + * Converts a path to an access path with datum. + * @param path The field name. + * @param datum The string to use for `datum`. + */ +export function accessPathWithDatum(path, datum = 'datum') { + const pieces = splitAccessPath(path); + const prefixes = []; + for (let i = 1; i <= pieces.length; i++) { + const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`; + prefixes.push(`${datum}${prefix}`); + } + return prefixes.join(' && '); +} +/** + * Return access with datum to the flattened field. + * + * @param path The field name. + * @param datum The string to use for `datum`. + */ +export function flatAccessWithDatum(path, datum = 'datum') { + return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`; +} +function escapePathAccess(string) { + return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); +} +/** + * Replaces path accesses with access to non-nested field. + * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. + */ +export function replacePathInField(path) { + return `${splitAccessPath(path).map(escapePathAccess).join('\\.')}`; +} +/** + * Replace all occurrences of a string with another string. + * + * @param string the string to replace in + * @param find the string to replace + * @param replacement the replacement + */ +export function replaceAll(string, find, replacement) { + return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); +} +/** + * Remove path accesses with access from field. + * For example, `foo["bar"].baz` becomes `foo.bar.baz`. + */ +export function removePathFromField(path) { + return `${splitAccessPath(path).join('.')}`; +} +/** + * Count the depth of the path. Returns 1 for fields that are not nested. + */ +export function accessPathDepth(path) { + if (!path) { + return 0; + } + return splitAccessPath(path).length; +} +/** + * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. + */ +export function getFirstDefined(...args) { + for (const arg of args) { + if (arg !== undefined) { + return arg; + } + } + return undefined; +} +// variable used to generate id +let idCounter = 42; +/** + * Returns a new random id every time it gets called. + * + * Has side effect! + */ +export function uniqueId(prefix) { + const id = ++idCounter; + return prefix ? String(prefix) + id : id; +} +/** + * Resets the id counter used in uniqueId. This can be useful for testing. + */ +export function resetIdCounter() { + idCounter = 42; +} +export function internalField(name) { + return isInternalField(name) ? name : `__${name}`; +} +export function isInternalField(name) { + return name.startsWith('__'); +} +/** + * Normalize angle to be within [0,360). + */ +export function normalizeAngle(angle) { + if (angle === undefined) { + return undefined; + } + return ((angle % 360) + 360) % 360; +} +/** + * Returns whether the passed in value is a valid number. + */ +export function isNumeric(value) { + if (isNumber(value)) { + return true; + } + return !isNaN(value) && !isNaN(parseFloat(value)); +} +const clonedProto = Object.getPrototypeOf(structuredClone({})); +/** + * Compares two values for equality, including arrays and objects. + * + * Adapted from https://github.com/epoberezkin/fast-deep-equal. + */ +export function deepEqual(a, b) { + if (a === b) + return true; + if (a && b && typeof a == 'object' && typeof b == 'object') { + // compare names to avoid issues with structured clone + if (a.constructor.name !== b.constructor.name) + return false; + let length; + let i; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) + return false; + for (i = length; i-- !== 0;) + if (!deepEqual(a[i], b[i])) + return false; + return true; + } + if (a instanceof Map && b instanceof Map) { + if (a.size !== b.size) + return false; + for (i of a.entries()) + if (!b.has(i[0])) + return false; + for (i of a.entries()) + if (!deepEqual(i[1], b.get(i[0]))) + return false; + return true; + } + if (a instanceof Set && b instanceof Set) { + if (a.size !== b.size) + return false; + for (i of a.entries()) + if (!b.has(i[0])) + return false; + return true; + } + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) + return false; + for (i = length; i-- !== 0;) + if (a[i] !== b[i]) + return false; + return true; + } + if (a.constructor === RegExp) + return a.source === b.source && a.flags === b.flags; + // also compare to structured clone prototype + if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf) + return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString) + return a.toString() === b.toString(); + const ks = Object.keys(a); + length = ks.length; + if (length !== Object.keys(b).length) + return false; + for (i = length; i-- !== 0;) + if (!Object.prototype.hasOwnProperty.call(b, ks[i])) + return false; + for (i = length; i-- !== 0;) { + const key = ks[i]; + if (!deepEqual(a[key], b[key])) + return false; + } + return true; + } + // true if both NaN, false otherwise + return a !== a && b !== b; +} +/** + * Converts any object to a string representation that can be consumed by humans. + * + * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify + */ +export function stringify(data) { + const seen = []; + return (function _stringify(node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + if (node === undefined) + return undefined; + if (typeof node == 'number') + return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') + return JSON.stringify(node); + let i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) + out += ','; + out += _stringify(node[i]) || 'null'; + } + return out + ']'; + } + if (node === null) + return 'null'; + if (seen.includes(node)) { + throw new TypeError('Converting circular structure to JSON'); + } + const seenIndex = seen.push(node) - 1; + const ks = Object.keys(node).sort(); + out = ''; + for (i = 0; i < ks.length; i++) { + const key = ks[i]; + const value = _stringify(node[key]); + if (!value) + continue; + if (out) + out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return `{${out}}`; + })(data); +} +//# sourceMappingURL=util.js.map \ No newline at end of file diff --git a/build/src/util.js.map b/build/src/util.js.map new file mode 100644 index 0000000000..0cfa10233b --- /dev/null +++ b/build/src/util.js.map @@ -0,0 +1 @@ +{"version":3,"file":"util.js","sourceRoot":"","sources":["../../src/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,cAAc,EAAE,QAAQ,EAAE,QAAQ,EAAE,eAAe,EAAE,WAAW,EAAE,WAAW,EAAC,MAAM,WAAW,CAAC;AACxG,OAAO,EAAC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAqB,MAAM,WAAW,CAAC;AAEtF,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC;AAEzC,MAAM,UAAU,KAAK,CAAC,OAAe;IACnC,MAAM,IAAI,KAAK,CAAC,OAAO,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;GAMG;AACH,wDAAwD;AACxD,MAAM,UAAU,IAAI,CAAsC,GAAM,EAAE,KAAmB;IACnF,MAAM,IAAI,GAAQ,EAAE,CAAC;IACrB,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,IAAI,cAAc,CAAC,GAAG,EAAE,IAAI,CAAC,EAAE;YAC7B,IAAI,CAAC,IAAI,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;SACxB;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;;;GAGG;AACH,wDAAwD;AACxD,MAAM,UAAU,IAAI,CAAsC,GAAM,EAAE,KAAmB;IACnF,MAAM,IAAI,GAAG,EAAC,GAAI,GA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,CAAC,CAAC;AACX,CAAC"} \ No newline at end of file diff --git a/build/src/vega.schema.d.ts b/build/src/vega.schema.d.ts new file mode 100644 index 0000000000..28bf2eaf7d --- /dev/null +++ b/build/src/vega.schema.d.ts @@ -0,0 +1,117 @@ +import type { AggregateOp, BandScale, BaseScale, BinOrdinalScale, ColorValueRef, Compare as VgCompare, ExprRef as VgExprRef, GeoShapeTransform as VgGeoShapeTransform, IdentityScale, LayoutAlign, LinearScale, LogScale, Mark, MarkConfig, NumericValueRef, OrdinalScale, PointScale, PowScale, ProjectionType, QuantileScale, QuantizeScale, RangeBand, RangeRaw, RangeScheme, ScaleData, ScaleDataRef, ScaledValueRef, ScaleMultiDataRef, ScaleMultiFieldsRef, SequentialScale, SignalRef, SortField as VgSortField, SqrtScale, SymLogScale, ThresholdScale, TimeInterval, TimeIntervalStep, TimeScale, Title as VgTitle, Transforms as VgTransform, UnionSortField as VgUnionSortField } from 'vega'; +import { Value } from './channeldef'; +import { ExprRef } from './expr'; +import { SortOrder } from './sort'; +import { Dict, Flag } from './util'; +export type { VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef }; +export type MappedExclude = { + [P in keyof T]: Exclude; +}; +export type MapExcludeAndKeepSignalAs = { + [P in keyof T]: SignalRef extends T[P] ? Exclude | S : Exclude; +}; +export type MappedExcludeValueRef = MappedExclude | NumericValueRef | ColorValueRef>; +export type MapExcludeValueRefAndReplaceSignalWith = MapExcludeAndKeepSignalAs | NumericValueRef | ColorValueRef, S>; +export interface VgData { + name: string; + source?: string; + values?: any; + format?: { + type?: string; + parse?: string | Dict; + property?: string; + feature?: string; + mesh?: string; + }; + url?: string; + transform?: VgTransform[]; +} +export type VgScaleDataRefWithSort = ScaleDataRef & { + sort?: VgSortField; +}; +export declare function isSignalRef(o: any): o is SignalRef; +export interface VgValueRef { + value?: Value; + field?: string | { + datum?: string; + group?: string; + parent?: string; + }; + signal?: string; + scale?: string; + mult?: number; + offset?: number | VgValueRef; + band?: boolean | number | VgValueRef; + test?: string; +} +export type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & { + fields: (any[] | VgScaleDataRefWithSort | SignalRef)[]; + sort?: VgUnionSortField; +}; +export type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & { + sort?: VgUnionSortField; +}; +export type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw; +export declare function isVgRangeStep(range: VgRange): range is VgRangeStep; +export interface VgRangeStep { + step: number | SignalRef; +} +export type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef; +export type VgDomain = BaseScale['domain']; +export type VgMarkGroup = any; +/** + * A combined type for any Vega scales that Vega-Lite can generate + */ +export type VgScale = Pick & { + range?: RangeScheme | RangeBand | ScaleData; + nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; + zero?: boolean | SignalRef; +} & Omit & Omit & Omit & Omit, 'type'> & // use partial so exponent is not required +Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit & Omit, 'range' | 'nice' | 'zero'>; +export interface RowCol { + row?: T; + column?: T; +} +export interface VgLayout { + center?: boolean | RowCol; + padding?: number | RowCol; + headerBand?: number | RowCol; + footerBand?: number | RowCol; + titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>; + offset?: number | { + rowHeader?: number; + rowFooter?: number; + rowTitle?: number; + columnHeader?: number; + columnFooter?: number; + columnTitle?: number; + }; + bounds?: 'full' | 'flush'; + columns?: number | { + signal: string; + }; + align?: LayoutAlign | RowCol; +} +export declare function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort; +export declare function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort; +export declare function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort; +export type VgEncodeChannel = 'x' | 'x2' | 'xc' | 'width' | 'y' | 'y2' | 'yc' | 'height' | 'opacity' | 'fill' | 'fillOpacity' | 'stroke' | 'strokeWidth' | 'strokeCap' | 'strokeOpacity' | 'strokeDash' | 'strokeDashOffset' | 'strokeMiterLimit' | 'strokeJoin' | 'strokeOffset' | 'strokeForeground' | 'cursor' | 'clip' | 'size' | 'shape' | 'path' | 'innerRadius' | 'outerRadius' | 'startAngle' | 'endAngle' | 'interpolate' | 'tension' | 'orient' | 'url' | 'align' | 'baseline' | 'text' | 'dir' | 'ellipsis' | 'limit' | 'dx' | 'dy' | 'radius' | 'theta' | 'angle' | 'font' | 'fontSize' | 'fontWeight' | 'fontStyle' | 'tooltip' | 'href' | 'cursor' | 'defined' | 'cornerRadius' | 'cornerRadiusTopLeft' | 'cornerRadiusTopRight' | 'cornerRadiusBottomRight' | 'cornerRadiusBottomLeft' | 'scaleX' | 'scaleY'; +export type VgEncodeEntry = Partial>; +export type VgPostEncodingTransform = VgGeoShapeTransform; +export declare const VG_MARK_CONFIGS: (keyof MarkConfig)[]; +export declare const VG_MARK_INDEX: Flag; +export declare const VG_CORNERRADIUS_CHANNELS: readonly ["cornerRadius", "cornerRadiusTopLeft", "cornerRadiusTopRight", "cornerRadiusBottomLeft", "cornerRadiusBottomRight"]; +export interface VgComparator { + field?: string | string[]; + order?: SortOrder | SortOrder[]; +} +export interface VgJoinAggregateTransform { + type: 'joinaggregate'; + as?: string[]; + ops?: AggregateOp[]; + fields?: string[]; + groupby?: string[]; +} +//# sourceMappingURL=vega.schema.d.ts.map \ No newline at end of file diff --git a/build/src/vega.schema.d.ts.map b/build/src/vega.schema.d.ts.map new file mode 100644 index 0000000000..92711340d3 --- /dev/null +++ b/build/src/vega.schema.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"vega.schema.d.ts","sourceRoot":"","sources":["../../src/vega.schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,SAAS,EACT,SAAS,EACT,eAAe,EACf,aAAa,EACb,OAAO,IAAI,SAAS,EACpB,OAAO,IAAI,SAAS,EACpB,iBAAiB,IAAI,mBAAmB,EACxC,aAAa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,OAAO,GACP,MAAM,GACN,UAAU,GACV,YAAY,GACZ,WAAW,GACX,SAAS,GACT,MAAM,GACN,QAAQ,GACR,SAAS,GACT,cAAc,GACd,qBAAqB,GACrB,sBAAsB,GACtB,yBAAyB,GACzB,wBAAwB,GACxB,QAAQ,GACR,QAAQ,CAAC;AAEb,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,UAAU,GAAG,CAAC,UAAU,GAAG;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AAU5G,MAAM,MAAM,uBAAuB,GAAG,mBAAmB,CAAC;AAyE1D,eAAO,MAAM,eAAe,sBAA6B,CAAC;AAE1D,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAa5C,CAAC;AAGF,eAAO,MAAM,wBAAwB,+HAM3B,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,SAAS,GAAG,SAAS,EAAE,CAAC;CACjC;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,eAAe,CAAC;IACtB,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC;IACd,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB"} \ No newline at end of file diff --git a/build/src/vega.schema.js b/build/src/vega.schema.js new file mode 100644 index 0000000000..972d3ae8b4 --- /dev/null +++ b/build/src/vega.schema.js @@ -0,0 +1,118 @@ +import { isArray } from 'vega-util'; +import { keys } from './util'; +export function isSignalRef(o) { + return !!o?.signal; +} +export function isVgRangeStep(range) { + return !!range['step']; +} +export function isDataRefUnionedDomain(domain) { + if (!isArray(domain)) { + return 'fields' in domain && !('data' in domain); + } + return false; +} +export function isFieldRefUnionDomain(domain) { + if (!isArray(domain)) { + return 'fields' in domain && 'data' in domain; + } + return false; +} +export function isDataRefDomain(domain) { + if (!isArray(domain)) { + return 'field' in domain && 'data' in domain; + } + return false; +} +const VG_MARK_CONFIG_INDEX = { + aria: 1, + description: 1, + ariaRole: 1, + ariaRoleDescription: 1, + blend: 1, + opacity: 1, + fill: 1, + fillOpacity: 1, + stroke: 1, + strokeCap: 1, + strokeWidth: 1, + strokeOpacity: 1, + strokeDash: 1, + strokeDashOffset: 1, + strokeJoin: 1, + strokeOffset: 1, + strokeMiterLimit: 1, + startAngle: 1, + endAngle: 1, + padAngle: 1, + innerRadius: 1, + outerRadius: 1, + size: 1, + shape: 1, + interpolate: 1, + tension: 1, + orient: 1, + align: 1, + baseline: 1, + text: 1, + dir: 1, + dx: 1, + dy: 1, + ellipsis: 1, + limit: 1, + radius: 1, + theta: 1, + angle: 1, + font: 1, + fontSize: 1, + fontWeight: 1, + fontStyle: 1, + lineBreak: 1, + lineHeight: 1, + cursor: 1, + href: 1, + tooltip: 1, + cornerRadius: 1, + cornerRadiusTopLeft: 1, + cornerRadiusTopRight: 1, + cornerRadiusBottomLeft: 1, + cornerRadiusBottomRight: 1, + aspect: 1, + width: 1, + height: 1, + url: 1, + smooth: 1 + // commented below are vg channel that do not have mark config. + // x: 1, + // y: 1, + // x2: 1, + // y2: 1, + // xc'|'yc' + // clip: 1, + // path: 1, + // url: 1, +}; +export const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); +export const VG_MARK_INDEX = { + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 +}; +// Vega's cornerRadius channels. +export const VG_CORNERRADIUS_CHANNELS = [ + 'cornerRadius', + 'cornerRadiusTopLeft', + 'cornerRadiusTopRight', + 'cornerRadiusBottomLeft', + 'cornerRadiusBottomRight' +]; +//# sourceMappingURL=vega.schema.js.map \ No newline at end of file diff --git a/build/src/vega.schema.js.map b/build/src/vega.schema.js.map new file mode 100644 index 0000000000..3527dc2b06 --- /dev/null +++ b/build/src/vega.schema.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vega.schema.js","sourceRoot":"","sources":["../../src/vega.schema.ts"],"names":[],"mappings":"AA2CA,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAIlC,OAAO,EAAa,IAAI,EAAC,MAAM,QAAQ,CAAC;AAyCxC,MAAM,UAAU,WAAW,CAAC,CAAM;IAChC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;AACrB,CAAC;AAgCD,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AACzB,CAAC;AAqED,MAAM,UAAU,sBAAsB,CAAC,MAAgB;IACrD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,QAAQ,IAAI,MAAM,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,CAAC;KAClD;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,MAAgB;IACpD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,QAAQ,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;KAC/C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,MAAsB;IACpD,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACpB,OAAO,OAAO,IAAI,MAAM,IAAI,MAAM,IAAI,MAAM,CAAC;KAC9C;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AA4ED,MAAM,oBAAoB,GAA2B;IACnD,IAAI,EAAE,CAAC;IACP,WAAW,EAAE,CAAC;IACd,QAAQ,EAAE,CAAC;IACX,mBAAmB,EAAE,CAAC;IACtB,KAAK,EAAE,CAAC;IACR,OAAO,E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AAQ;IACR,QAAQ;IACR,SAAS;IACT,SAAS;IAET,WAAW;IACX,WAAW;IACX,WAAW;IACX,UAAU;CACX,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAuB;IAC/C,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,gCAAgC;AAChC,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,cAAc;IACd,qBAAqB;IACrB,sBAAsB;IACtB,wBAAwB;IACxB,yBAAyB;CACjB,CAAC"} \ No newline at end of file diff --git a/build/vega-lite.js b/build/vega-lite.js new file mode 100644 index 0000000000..a83ecfb543 --- /dev/null +++ b/build/vega-lite.js @@ -0,0 +1,22870 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('vega')) : + typeof define === 'function' && define.amd ? define(['exports', 'vega'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.vegaLite = {}, global.vega)); +})(this, (function (exports, vega) { 'use strict'; + + var name = "vega-lite"; + var author = "Dominik Moritz, Kanit \"Ham\" Wongsuphasawat, Arvind Satyanarayan, Jeffrey Heer"; + var version$1 = "5.16.1"; + var collaborators = [ + "Kanit Wongsuphasawat (http://kanitw.yellowpigz.com)", + "Dominik Moritz (https://www.domoritz.de)", + "Arvind Satyanarayan (https://arvindsatya.com)", + "Jeffrey Heer (https://jheer.org)" + ]; + var homepage = "https://vega.github.io/vega-lite/"; + var description$1 = "Vega-Lite is a concise high-level language for interactive visualization."; + var keywords = [ + "vega", + "chart", + "visualization" + ]; + var main$1 = "build/vega-lite.js"; + var unpkg = "build/vega-lite.min.js"; + var jsdelivr = "build/vega-lite.min.js"; + var module = "build/src/index"; + var types = "build/src/index.d.ts"; + var bin = { + vl2pdf: "./bin/vl2pdf", + vl2png: "./bin/vl2png", + vl2svg: "./bin/vl2svg", + vl2vg: "./bin/vl2vg" + }; + var files = [ + "bin", + "build", + "src", + "vega-lite*", + "tsconfig.json" + ]; + var scripts = { + changelog: "conventional-changelog -p angular -r 2", + prebuild: "yarn clean:build", + build: "yarn build:only", + "build:only": "tsc -p tsconfig.build.json && rollup -c", + "prebuild:examples": "yarn build:only", + "build:examples": "yarn data && TZ=America/Los_Angeles scripts/build-examples.sh", + "prebuild:examples-full": "yarn build:only", + "build:examples-full": "TZ=America/Los_Angeles scripts/build-examples.sh 1", + "build:example": "TZ=America/Los_Angeles scripts/build-example.sh", + "build:toc": "yarn build:jekyll && scripts/generate-toc", + "build:site": "rollup -c site/rollup.config.mjs", + "build:jekyll": "pushd site && bundle exec jekyll build -q && popd", + "build:versions": "scripts/update-version.sh", + clean: "yarn clean:build && del-cli 'site/data/*' 'examples/compiled/*.png' && find site/examples ! -name 'index.md' ! -name 'data' -type f -delete", + "clean:build": "del-cli 'build/*' !build/vega-lite-schema.json", + data: "rsync -r node_modules/vega-datasets/data/* site/data", + schema: "mkdir -p build && ts-json-schema-generator -f tsconfig.json -p src/index.ts -t TopLevelSpec --no-type-check --no-ref-encode > build/vega-lite-schema.json && yarn renameschema && cp build/vega-lite-schema.json site/_data/", + renameschema: "scripts/rename-schema.sh", + presite: "yarn data && yarn schema && yarn build:site && yarn build:versions && scripts/create-example-pages.sh", + site: "yarn site:only", + "site:only": "pushd site && bundle exec jekyll serve -I -l && popd", + prettierbase: "prettier '**/*.{md,css,yml}'", + format: "eslint . --fix && yarn prettierbase --write", + lint: "eslint . && yarn prettierbase --check", + jest: "NODE_OPTIONS=--experimental-vm-modules npx jest", + test: "yarn jest test/ && yarn lint && yarn schema && yarn jest examples/ && yarn test:runtime", + "test:cover": "yarn jest --collectCoverage test/", + "test:inspect": "node --inspect-brk --experimental-vm-modules ./node_modules/.bin/jest --runInBand test", + "test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest test-runtime/ --config test-runtime/jest-config.json", + "test:runtime:generate": "yarn build:only && del-cli test-runtime/resources && VL_GENERATE_TESTS=true yarn test:runtime", + watch: "tsc -p tsconfig.build.json -w", + "watch:site": "yarn build:site -w", + "watch:test": "yarn jest --watch test/", + "watch:test:runtime": "NODE_OPTIONS=--experimental-vm-modules TZ=America/Los_Angeles npx jest --watch test-runtime/ --config test-runtime/jest-config.json", + release: "release-it" + }; + var repository = { + type: "git", + url: "https://github.com/vega/vega-lite.git" + }; + var license = "BSD-3-Clause"; + var bugs = { + url: "https://github.com/vega/vega-lite/issues" + }; + var devDependencies = { + "@babel/core": "^7.22.10", + "@babel/plugin-proposal-class-properties": "^7.18.6", + "@babel/preset-env": "^7.22.10", + "@babel/preset-typescript": "^7.22.5", + "@release-it/conventional-changelog": "^7.0.0", + "@rollup/plugin-alias": "^5.0.0", + "@rollup/plugin-babel": "^6.0.3", + "@rollup/plugin-commonjs": "^25.0.4", + "@rollup/plugin-json": "^6.0.0", + "@rollup/plugin-node-resolve": "^15.2.1", + "@rollup/plugin-terser": "^0.4.3", + "@types/chai": "^4.3.5", + "@types/d3": "^7.4.0", + "@types/jest": "^29.5.4", + "@types/pako": "^2.0.0", + "@typescript-eslint/eslint-plugin": "^6.4.1", + "@typescript-eslint/parser": "^6.4.1", + ajv: "^8.12.0", + "ajv-formats": "^2.1.1", + chai: "^4.3.7", + cheerio: "^1.0.0-rc.12", + "conventional-changelog-cli": "^4.0.0", + d3: "^7.8.5", + "del-cli": "^5.0.0", + eslint: "^8.47.0", + "eslint-config-prettier": "^9.0.0", + "eslint-plugin-jest": "^27.2.3", + "eslint-plugin-prettier": "^5.0.0", + "fast-json-stable-stringify": "~2.1.0", + "highlight.js": "^11.8.0", + jest: "^29.6.3", + "jest-dev-server": "^9.0.0", + mkdirp: "^3.0.1", + pako: "^2.1.0", + prettier: "^3.0.2", + puppeteer: "^15.0.0", + "release-it": "^16.1.5", + rollup: "^3.28.1", + "rollup-plugin-bundle-size": "^1.0.3", + "rollup-plugin-sourcemaps": "^0.6.3", + serve: "^14.2.1", + terser: "^5.19.2", + "ts-jest": "^29.1.1", + "ts-json-schema-generator": "^1.3.0", + typescript: "~5.2.2", + "vega-cli": "^5.25.0", + "vega-datasets": "^2.7.0", + "vega-embed": "^6.22.2", + "vega-tooltip": "^0.33.0", + "yaml-front-matter": "^4.1.1" + }; + var dependencies = { + "json-stringify-pretty-compact": "~3.0.0", + tslib: "~2.6.2", + "vega-event-selector": "~3.0.1", + "vega-expression": "~5.1.0", + "vega-util": "~1.17.2", + yargs: "~17.7.2" + }; + var peerDependencies = { + vega: "^5.24.0" + }; + var engines = { + node: ">=18" + }; + var pkg = { + name: name, + author: author, + version: version$1, + collaborators: collaborators, + homepage: homepage, + description: description$1, + keywords: keywords, + main: main$1, + unpkg: unpkg, + jsdelivr: jsdelivr, + module: module, + types: types, + bin: bin, + files: files, + scripts: scripts, + repository: repository, + license: license, + bugs: bugs, + devDependencies: devDependencies, + dependencies: dependencies, + peerDependencies: peerDependencies, + engines: engines + }; + + function isLogicalOr(op) { + return !!op.or; + } + function isLogicalAnd(op) { + return !!op.and; + } + function isLogicalNot(op) { + return !!op.not; + } + function forEachLeaf(op, fn) { + if (isLogicalNot(op)) { + forEachLeaf(op.not, fn); + } else if (isLogicalAnd(op)) { + for (const subop of op.and) { + forEachLeaf(subop, fn); + } + } else if (isLogicalOr(op)) { + for (const subop of op.or) { + forEachLeaf(subop, fn); + } + } else { + fn(op); + } + } + function normalizeLogicalComposition(op, normalizer) { + if (isLogicalNot(op)) { + return { + not: normalizeLogicalComposition(op.not, normalizer) + }; + } else if (isLogicalAnd(op)) { + return { + and: op.and.map(o => normalizeLogicalComposition(o, normalizer)) + }; + } else if (isLogicalOr(op)) { + return { + or: op.or.map(o => normalizeLogicalComposition(o, normalizer)) + }; + } else { + return normalizer(op); + } + } + + const duplicate = structuredClone; + function never(message) { + throw new Error(message); + } + + /** + * Creates an object composed of the picked object properties. + * + * var object = {'a': 1, 'b': '2', 'c': 3}; + * pick(object, ['a', 'c']); + * // → {'a': 1, 'c': 3} + */ + // eslint-disable-next-line @typescript-eslint/ban-types + function pick(obj, props) { + const copy = {}; + for (const prop of props) { + if (vega.hasOwnProperty(obj, prop)) { + copy[prop] = obj[prop]; + } + } + return copy; + } + + /** + * The opposite of _.pick; this method creates an object composed of the own + * and inherited enumerable string keyed properties of object that are not omitted. + */ + // eslint-disable-next-line @typescript-eslint/ban-types + function omit(obj, props) { + const copy = { + ...obj + }; + for (const prop of props) { + delete copy[prop]; + } + return copy; + } + + /** + * Monkey patch Set so that `stringify` produces a string representation of sets. + */ + Set.prototype['toJSON'] = function () { + return `Set(${[...this].map(x => stringify(x)).join(',')})`; + }; + + /** + * Converts any object to a string of limited size, or a number. + */ + function hash(a) { + if (vega.isNumber(a)) { + return a; + } + const str = vega.isString(a) ? a : stringify(a); + + // short strings can be used as hash directly, longer strings are hashed to reduce memory usage + if (str.length < 250) { + return str; + } + + // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/ + let h = 0; + for (let i = 0; i < str.length; i++) { + const char = str.charCodeAt(i); + h = (h << 5) - h + char; + h = h & h; // Convert to 32bit integer + } + + return h; + } + function isNullOrFalse(x) { + return x === false || x === null; + } + function contains(array, item) { + return array.includes(item); + } + + /** + * Returns true if any item returns true. + */ + function some(arr, f) { + let i = 0; + for (const [k, a] of arr.entries()) { + if (f(a, k, i++)) { + return true; + } + } + return false; + } + + /** + * Returns true if all items return true. + */ + function every(arr, f) { + let i = 0; + for (const [k, a] of arr.entries()) { + if (!f(a, k, i++)) { + return false; + } + } + return true; + } + + /** + * Like TS Partial but applies recursively to all properties. + */ + + /** + * recursively merges src into dest + */ + function mergeDeep(dest) { + for (var _len = arguments.length, src = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { + src[_key - 1] = arguments[_key]; + } + for (const s of src) { + deepMerge_(dest, s ?? {}); + } + return dest; + } + function deepMerge_(dest, src) { + for (const property of keys(src)) { + vega.writeConfig(dest, property, src[property], true); + } + } + function unique(values, f) { + const results = []; + const u = {}; + let v; + for (const val of values) { + v = f(val); + if (v in u) { + continue; + } + u[v] = 1; + results.push(val); + } + return results; + } + /** + * Returns true if the two dictionaries agree. Applies only to defined values. + */ + function isEqual(dict, other) { + const dictKeys = keys(dict); + const otherKeys = keys(other); + if (dictKeys.length !== otherKeys.length) { + return false; + } + for (const key of dictKeys) { + if (dict[key] !== other[key]) { + return false; + } + } + return true; + } + function setEqual(a, b) { + if (a.size !== b.size) { + return false; + } + for (const e of a) { + if (!b.has(e)) { + return false; + } + } + return true; + } + function hasIntersection(a, b) { + for (const key of a) { + if (b.has(key)) { + return true; + } + } + return false; + } + function prefixGenerator(a) { + const prefixes = new Set(); + for (const x of a) { + const splitField = vega.splitAccessPath(x); + // Wrap every element other than the first in `[]` + const wrappedWithAccessors = splitField.map((y, i) => i === 0 ? y : `[${y}]`); + const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join('')); + for (const y of computedPrefixes) { + prefixes.add(y); + } + } + return prefixes; + } + + /** + * Returns true if a and b have an intersection. Also return true if a or b are undefined + * since this means we don't know what fields a node produces or depends on. + */ + function fieldIntersection(a, b) { + if (a === undefined || b === undefined) { + return true; + } + return hasIntersection(prefixGenerator(a), prefixGenerator(b)); + } + + // eslint-disable-next-line @typescript-eslint/ban-types + function isEmpty(obj) { + return keys(obj).length === 0; + } + + // This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208 + const keys = Object.keys; + const vals = Object.values; + const entries$1 = Object.entries; + + // Using mapped type to declare a collect of flags for a string literal type S + // https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types + function isBoolean(b) { + return b === true || b === false; + } + + /** + * Convert a string into a valid variable name + */ + function varName(s) { + // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _ + const alphanumericS = s.replace(/\W/g, '_'); + + // Add _ if the string has leading numbers. + return (s.match(/^\d+/) ? '_' : '') + alphanumericS; + } + function logicalExpr(op, cb) { + if (isLogicalNot(op)) { + return `!(${logicalExpr(op.not, cb)})`; + } else if (isLogicalAnd(op)) { + return `(${op.and.map(and => logicalExpr(and, cb)).join(') && (')})`; + } else if (isLogicalOr(op)) { + return `(${op.or.map(or => logicalExpr(or, cb)).join(') || (')})`; + } else { + return cb(op); + } + } + + /** + * Delete nested property of an object, and delete the ancestors of the property if they become empty. + */ + function deleteNestedProperty(obj, orderedProps) { + if (orderedProps.length === 0) { + return true; + } + const prop = orderedProps.shift(); // eslint-disable-line @typescript-eslint/no-non-null-assertion + if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) { + delete obj[prop]; + } + return isEmpty(obj); + } + function titleCase(s) { + return s.charAt(0).toUpperCase() + s.substr(1); + } + + /** + * Converts a path to an access path with datum. + * @param path The field name. + * @param datum The string to use for `datum`. + */ + function accessPathWithDatum(path) { + let datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum'; + const pieces = vega.splitAccessPath(path); + const prefixes = []; + for (let i = 1; i <= pieces.length; i++) { + const prefix = `[${pieces.slice(0, i).map(vega.stringValue).join('][')}]`; + prefixes.push(`${datum}${prefix}`); + } + return prefixes.join(' && '); + } + + /** + * Return access with datum to the flattened field. + * + * @param path The field name. + * @param datum The string to use for `datum`. + */ + function flatAccessWithDatum(path) { + let datum = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'datum'; + return `${datum}[${vega.stringValue(vega.splitAccessPath(path).join('.'))}]`; + } + function escapePathAccess(string) { + return string.replace(/(\[|\]|\.|'|")/g, '\\$1'); + } + + /** + * Replaces path accesses with access to non-nested field. + * For example, `foo["bar"].baz` becomes `foo\\.bar\\.baz`. + */ + function replacePathInField(path) { + return `${vega.splitAccessPath(path).map(escapePathAccess).join('\\.')}`; + } + + /** + * Replace all occurrences of a string with another string. + * + * @param string the string to replace in + * @param find the string to replace + * @param replacement the replacement + */ + function replaceAll(string, find, replacement) { + return string.replace(new RegExp(find.replace(/[-/\\^$*+?.()|[\]{}]/g, '\\$&'), 'g'), replacement); + } + + /** + * Remove path accesses with access from field. + * For example, `foo["bar"].baz` becomes `foo.bar.baz`. + */ + function removePathFromField(path) { + return `${vega.splitAccessPath(path).join('.')}`; + } + + /** + * Count the depth of the path. Returns 1 for fields that are not nested. + */ + function accessPathDepth(path) { + if (!path) { + return 0; + } + return vega.splitAccessPath(path).length; + } + + /** + * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included. + */ + function getFirstDefined() { + for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { + args[_key2] = arguments[_key2]; + } + for (const arg of args) { + if (arg !== undefined) { + return arg; + } + } + return undefined; + } + + // variable used to generate id + let idCounter = 42; + + /** + * Returns a new random id every time it gets called. + * + * Has side effect! + */ + function uniqueId(prefix) { + const id = ++idCounter; + return prefix ? String(prefix) + id : id; + } + + /** + * Resets the id counter used in uniqueId. This can be useful for testing. + */ + function resetIdCounter() { + idCounter = 42; + } + function internalField(name) { + return isInternalField(name) ? name : `__${name}`; + } + function isInternalField(name) { + return name.startsWith('__'); + } + + /** + * Normalize angle to be within [0,360). + */ + function normalizeAngle(angle) { + if (angle === undefined) { + return undefined; + } + return (angle % 360 + 360) % 360; + } + + /** + * Returns whether the passed in value is a valid number. + */ + function isNumeric(value) { + if (vega.isNumber(value)) { + return true; + } + return !isNaN(value) && !isNaN(parseFloat(value)); + } + const clonedProto = Object.getPrototypeOf(structuredClone({})); + + /** + * Compares two values for equality, including arrays and objects. + * + * Adapted from https://github.com/epoberezkin/fast-deep-equal. + */ + function deepEqual(a, b) { + if (a === b) return true; + if (a && b && typeof a == 'object' && typeof b == 'object') { + // compare names to avoid issues with structured clone + if (a.constructor.name !== b.constructor.name) return false; + let length; + let i; + if (Array.isArray(a)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) if (!deepEqual(a[i], b[i])) return false; + return true; + } + if (a instanceof Map && b instanceof Map) { + if (a.size !== b.size) return false; + for (i of a.entries()) if (!b.has(i[0])) return false; + for (i of a.entries()) if (!deepEqual(i[1], b.get(i[0]))) return false; + return true; + } + if (a instanceof Set && b instanceof Set) { + if (a.size !== b.size) return false; + for (i of a.entries()) if (!b.has(i[0])) return false; + return true; + } + if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) { + length = a.length; + if (length != b.length) return false; + for (i = length; i-- !== 0;) if (a[i] !== b[i]) return false; + return true; + } + if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; + // also compare to structured clone prototype + if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf) return a.valueOf() === b.valueOf(); + if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString) return a.toString() === b.toString(); + const ks = Object.keys(a); + length = ks.length; + if (length !== Object.keys(b).length) return false; + for (i = length; i-- !== 0;) if (!Object.prototype.hasOwnProperty.call(b, ks[i])) return false; + for (i = length; i-- !== 0;) { + const key = ks[i]; + if (!deepEqual(a[key], b[key])) return false; + } + return true; + } + + // true if both NaN, false otherwise + return a !== a && b !== b; + } + + /** + * Converts any object to a string representation that can be consumed by humans. + * + * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify + */ + function stringify(data) { + const seen = []; + return function _stringify(node) { + if (node && node.toJSON && typeof node.toJSON === 'function') { + node = node.toJSON(); + } + if (node === undefined) return undefined; + if (typeof node == 'number') return isFinite(node) ? '' + node : 'null'; + if (typeof node !== 'object') return JSON.stringify(node); + let i, out; + if (Array.isArray(node)) { + out = '['; + for (i = 0; i < node.length; i++) { + if (i) out += ','; + out += _stringify(node[i]) || 'null'; + } + return out + ']'; + } + if (node === null) return 'null'; + if (seen.includes(node)) { + throw new TypeError('Converting circular structure to JSON'); + } + const seenIndex = seen.push(node) - 1; + const ks = Object.keys(node).sort(); + out = ''; + for (i = 0; i < ks.length; i++) { + const key = ks[i]; + const value = _stringify(node[key]); + if (!value) continue; + if (out) out += ','; + out += JSON.stringify(key) + ':' + value; + } + seen.splice(seenIndex, 1); + return `{${out}}`; + }(data); + } + + /* + * Constants and utilities for encoding channels (Visual variables) + * such as 'x', 'y', 'color'. + */ + + // Facet + const ROW = 'row'; + const COLUMN = 'column'; + const FACET = 'facet'; + + // Position + const X = 'x'; + const Y = 'y'; + const X2 = 'x2'; + const Y2 = 'y2'; + + // Position Offset + const XOFFSET = 'xOffset'; + const YOFFSET = 'yOffset'; + + // Arc-Position + const RADIUS = 'radius'; + const RADIUS2 = 'radius2'; + const THETA = 'theta'; + const THETA2 = 'theta2'; + + // Geo Position + const LATITUDE = 'latitude'; + const LONGITUDE = 'longitude'; + const LATITUDE2 = 'latitude2'; + const LONGITUDE2 = 'longitude2'; + + // Mark property with scale + const COLOR = 'color'; + const FILL = 'fill'; + const STROKE = 'stroke'; + const SHAPE = 'shape'; + const SIZE = 'size'; + const ANGLE = 'angle'; + const OPACITY = 'opacity'; + const FILLOPACITY = 'fillOpacity'; + const STROKEOPACITY = 'strokeOpacity'; + const STROKEWIDTH = 'strokeWidth'; + const STROKEDASH = 'strokeDash'; + + // Non-scale channel + const TEXT$1 = 'text'; + const ORDER = 'order'; + const DETAIL = 'detail'; + const KEY = 'key'; + const TOOLTIP = 'tooltip'; + const HREF = 'href'; + const URL = 'url'; + const DESCRIPTION = 'description'; + const POSITION_CHANNEL_INDEX = { + x: 1, + y: 1, + x2: 1, + y2: 1 + }; + const POLAR_POSITION_CHANNEL_INDEX = { + theta: 1, + theta2: 1, + radius: 1, + radius2: 1 + }; + function isPolarPositionChannel(c) { + return c in POLAR_POSITION_CHANNEL_INDEX; + } + const GEO_POSIITON_CHANNEL_INDEX = { + longitude: 1, + longitude2: 1, + latitude: 1, + latitude2: 1 + }; + function getPositionChannelFromLatLong(channel) { + switch (channel) { + case LATITUDE: + return 'y'; + case LATITUDE2: + return 'y2'; + case LONGITUDE: + return 'x'; + case LONGITUDE2: + return 'x2'; + } + } + function isGeoPositionChannel(c) { + return c in GEO_POSIITON_CHANNEL_INDEX; + } + const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX); + const UNIT_CHANNEL_INDEX = { + ...POSITION_CHANNEL_INDEX, + ...POLAR_POSITION_CHANNEL_INDEX, + ...GEO_POSIITON_CHANNEL_INDEX, + xOffset: 1, + yOffset: 1, + // color + color: 1, + fill: 1, + stroke: 1, + // other non-position with scale + opacity: 1, + fillOpacity: 1, + strokeOpacity: 1, + strokeWidth: 1, + strokeDash: 1, + size: 1, + angle: 1, + shape: 1, + // channels without scales + order: 1, + text: 1, + detail: 1, + key: 1, + tooltip: 1, + href: 1, + url: 1, + description: 1 + }; + function isColorChannel(channel) { + return channel === COLOR || channel === FILL || channel === STROKE; + } + const FACET_CHANNEL_INDEX = { + row: 1, + column: 1, + facet: 1 + }; + const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX); + const CHANNEL_INDEX = { + ...UNIT_CHANNEL_INDEX, + ...FACET_CHANNEL_INDEX + }; + const CHANNELS = keys(CHANNEL_INDEX); + const { + order: _o, + detail: _d, + tooltip: _tt1, + ...SINGLE_DEF_CHANNEL_INDEX + } = CHANNEL_INDEX; + const { + row: _r, + column: _c, + facet: _f, + ...SINGLE_DEF_UNIT_CHANNEL_INDEX + } = SINGLE_DEF_CHANNEL_INDEX; + function isSingleDefUnitChannel(str) { + return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str]; + } + function isChannel(str) { + return !!CHANNEL_INDEX[str]; + } + const SECONDARY_RANGE_CHANNEL = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2]; + function isSecondaryRangeChannel(c) { + const main = getMainRangeChannel(c); + return main !== c; + } + /** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ + function getMainRangeChannel(channel) { + switch (channel) { + case X2: + return X; + case Y2: + return Y; + case LATITUDE2: + return LATITUDE; + case LONGITUDE2: + return LONGITUDE; + case THETA2: + return THETA; + case RADIUS2: + return RADIUS; + } + return channel; + } + function getVgPositionChannel(channel) { + if (isPolarPositionChannel(channel)) { + switch (channel) { + case THETA: + return 'startAngle'; + case THETA2: + return 'endAngle'; + case RADIUS: + return 'outerRadius'; + case RADIUS2: + return 'innerRadius'; + } + } + return channel; + } + + /** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ + function getSecondaryRangeChannel(channel) { + switch (channel) { + case X: + return X2; + case Y: + return Y2; + case LATITUDE: + return LATITUDE2; + case LONGITUDE: + return LONGITUDE2; + case THETA: + return THETA2; + case RADIUS: + return RADIUS2; + } + return undefined; + } + function getSizeChannel(channel) { + switch (channel) { + case X: + case X2: + return 'width'; + case Y: + case Y2: + return 'height'; + } + return undefined; + } + + /** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ + function getOffsetChannel(channel) { + switch (channel) { + case X: + return 'xOffset'; + case Y: + return 'yOffset'; + case X2: + return 'x2Offset'; + case Y2: + return 'y2Offset'; + case THETA: + return 'thetaOffset'; + case RADIUS: + return 'radiusOffset'; + case THETA2: + return 'theta2Offset'; + case RADIUS2: + return 'radius2Offset'; + } + return undefined; + } + + /** + * Get the main channel for a range channel. E.g. `x` for `x2`. + */ + function getOffsetScaleChannel(channel) { + switch (channel) { + case X: + return 'xOffset'; + case Y: + return 'yOffset'; + } + return undefined; + } + function getMainChannelFromOffsetChannel(channel) { + switch (channel) { + case 'xOffset': + return 'x'; + case 'yOffset': + return 'y'; + } + } + + // CHANNELS without COLUMN, ROW + const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX); + + // NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2; + const { + x: _x, + y: _y, + // x2 and y2 share the same scale as x and y + x2: _x2, + y2: _y2, + // + xOffset: _xo, + yOffset: _yo, + latitude: _latitude, + longitude: _longitude, + latitude2: _latitude2, + longitude2: _longitude2, + theta: _theta, + theta2: _theta2, + radius: _radius, + radius2: _radius2, + // The rest of unit channels then have scale + ...NONPOSITION_CHANNEL_INDEX + } = UNIT_CHANNEL_INDEX; + const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX); + const POSITION_SCALE_CHANNEL_INDEX = { + x: 1, + y: 1 + }; + const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX); + function isXorY(channel) { + return channel in POSITION_SCALE_CHANNEL_INDEX; + } + const POLAR_POSITION_SCALE_CHANNEL_INDEX = { + theta: 1, + radius: 1 + }; + const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX); + function getPositionScaleChannel(sizeType) { + return sizeType === 'width' ? X : Y; + } + const OFFSET_SCALE_CHANNEL_INDEX = { + xOffset: 1, + yOffset: 1 + }; + function isXorYOffset(channel) { + return channel in OFFSET_SCALE_CHANNEL_INDEX; + } + + // NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset + const { + // x2 and y2 share the same scale as x and y + // text and tooltip have format instead of scale, + // href has neither format, nor scale + text: _t, + tooltip: _tt, + href: _hr, + url: _u, + description: _al, + // detail and order have no scale + detail: _dd, + key: _k, + order: _oo, + ...NONPOSITION_SCALE_CHANNEL_INDEX + } = NONPOSITION_CHANNEL_INDEX; + const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX); + function isNonPositionScaleChannel(channel) { + return !!NONPOSITION_CHANNEL_INDEX[channel]; + } + + /** + * @returns whether Vega supports legends for a particular channel + */ + function supportLegend(channel) { + switch (channel) { + case COLOR: + case FILL: + case STROKE: + case SIZE: + case SHAPE: + case OPACITY: + case STROKEWIDTH: + case STROKEDASH: + return true; + case FILLOPACITY: + case STROKEOPACITY: + case ANGLE: + return false; + } + } + + // Declare SCALE_CHANNEL_INDEX + const SCALE_CHANNEL_INDEX = { + ...POSITION_SCALE_CHANNEL_INDEX, + ...POLAR_POSITION_SCALE_CHANNEL_INDEX, + ...OFFSET_SCALE_CHANNEL_INDEX, + ...NONPOSITION_SCALE_CHANNEL_INDEX + }; + + /** List of channels with scales */ + const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX); + function isScaleChannel(channel) { + return !!SCALE_CHANNEL_INDEX[channel]; + } + /** + * Return whether a channel supports a particular mark type. + * @param channel channel name + * @param mark the mark type + * @return whether the mark supports the channel + */ + function supportMark(channel, mark) { + return getSupportedMark(channel)[mark]; + } + const ALL_MARKS = { + // all marks + arc: 'always', + area: 'always', + bar: 'always', + circle: 'always', + geoshape: 'always', + image: 'always', + line: 'always', + rule: 'always', + point: 'always', + rect: 'always', + square: 'always', + trail: 'always', + text: 'always', + tick: 'always' + }; + const { + geoshape: _g, + ...ALL_MARKS_EXCEPT_GEOSHAPE + } = ALL_MARKS; + + /** + * Return a dictionary showing whether a channel supports mark type. + * @param channel + * @return A dictionary mapping mark types to 'always', 'binned', or undefined + */ + function getSupportedMark(channel) { + switch (channel) { + case COLOR: + case FILL: + case STROKE: + // falls through + + case DESCRIPTION: + case DETAIL: + case KEY: + case TOOLTIP: + case HREF: + case ORDER: // TODO: revise (order might not support rect, which is not stackable?) + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEWIDTH: + + // falls through + + case FACET: + case ROW: // falls through + case COLUMN: + return ALL_MARKS; + case X: + case Y: + case XOFFSET: + case YOFFSET: + case LATITUDE: + case LONGITUDE: + // all marks except geoshape. geoshape does not use X, Y -- it uses a projection + return ALL_MARKS_EXCEPT_GEOSHAPE; + case X2: + case Y2: + case LATITUDE2: + case LONGITUDE2: + return { + area: 'always', + bar: 'always', + image: 'always', + rect: 'always', + rule: 'always', + circle: 'binned', + point: 'binned', + square: 'binned', + tick: 'binned', + line: 'binned', + trail: 'binned' + }; + case SIZE: + return { + point: 'always', + tick: 'always', + rule: 'always', + circle: 'always', + square: 'always', + bar: 'always', + text: 'always', + line: 'always', + trail: 'always' + }; + case STROKEDASH: + return { + line: 'always', + point: 'always', + tick: 'always', + rule: 'always', + circle: 'always', + square: 'always', + bar: 'always', + geoshape: 'always' + }; + case SHAPE: + return { + point: 'always', + geoshape: 'always' + }; + case TEXT$1: + return { + text: 'always' + }; + case ANGLE: + return { + point: 'always', + square: 'always', + text: 'always' + }; + case URL: + return { + image: 'always' + }; + case THETA: + return { + text: 'always', + arc: 'always' + }; + case RADIUS: + return { + text: 'always', + arc: 'always' + }; + case THETA2: + case RADIUS2: + return { + arc: 'always' + }; + } + } + function rangeType(channel) { + switch (channel) { + case X: + case Y: + case THETA: + case RADIUS: + case XOFFSET: + case YOFFSET: + case SIZE: + case ANGLE: + case STROKEWIDTH: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + + // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through] + case X2: + case Y2: + case THETA2: + case RADIUS2: + return undefined; + case FACET: + case ROW: + case COLUMN: + case SHAPE: + case STROKEDASH: + // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through] + case TEXT$1: + case TOOLTIP: + case HREF: + case URL: + case DESCRIPTION: + return 'discrete'; + + // Color can be either continuous or discrete, depending on scale type. + case COLOR: + case FILL: + case STROKE: + return 'flexible'; + + // No scale, no range type. + + case LATITUDE: + case LONGITUDE: + case LATITUDE2: + case LONGITUDE2: + case DETAIL: + case KEY: + case ORDER: + return undefined; + } + } + + const AGGREGATE_OP_INDEX = { + argmax: 1, + argmin: 1, + average: 1, + count: 1, + distinct: 1, + product: 1, + max: 1, + mean: 1, + median: 1, + min: 1, + missing: 1, + q1: 1, + q3: 1, + ci0: 1, + ci1: 1, + stderr: 1, + stdev: 1, + stdevp: 1, + sum: 1, + valid: 1, + values: 1, + variance: 1, + variancep: 1 + }; + const MULTIDOMAIN_SORT_OP_INDEX = { + count: 1, + min: 1, + max: 1 + }; + function isArgminDef(a) { + return !!a && !!a['argmin']; + } + function isArgmaxDef(a) { + return !!a && !!a['argmax']; + } + function isAggregateOp(a) { + return vega.isString(a) && !!AGGREGATE_OP_INDEX[a]; + } + const COUNTING_OPS = new Set(['count', 'valid', 'missing', 'distinct']); + function isCountingAggregateOp(aggregate) { + return vega.isString(aggregate) && COUNTING_OPS.has(aggregate); + } + function isMinMaxOp(aggregate) { + return vega.isString(aggregate) && contains(['min', 'max'], aggregate); + } + + /** Additive-based aggregation operations. These can be applied to stack. */ + const SUM_OPS = new Set(['count', 'sum', 'distinct', 'valid', 'missing']); + + /** + * Aggregation operators that always produce values within the range [domainMin, domainMax]. + */ + const SHARED_DOMAIN_OPS = new Set(['mean', 'average', 'median', 'q1', 'q3', 'min', 'max']); + + /** + * Binning properties or boolean flag for determining whether to bin data or not. + */ + + /** + * Create a key for the bin configuration. Not for prebinned bin. + */ + function binToString(bin) { + if (vega.isBoolean(bin)) { + bin = normalizeBin(bin, undefined); + } + return 'bin' + keys(bin).map(p => isParameterExtent(bin[p]) ? varName(`_${p}_${entries$1(bin[p])}`) : varName(`_${p}_${bin[p]}`)).join(''); + } + + /** + * Vega-Lite should bin the data. + */ + function isBinning(bin) { + return bin === true || isBinParams(bin) && !bin.binned; + } + + /** + * The data is already binned and so Vega-Lite should not bin it again. + */ + function isBinned(bin) { + return bin === 'binned' || isBinParams(bin) && bin.binned === true; + } + function isBinParams(bin) { + return vega.isObject(bin); + } + function isParameterExtent(extent) { + return extent?.['param']; + } + function autoMaxBins(channel) { + switch (channel) { + case ROW: + case COLUMN: + case SIZE: + case COLOR: + case FILL: + case STROKE: + case STROKEWIDTH: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + // Facets and Size shouldn't have too many bins + // We choose 6 like shape to simplify the rule [falls through] + case SHAPE: + return 6; + // Vega's "shape" has 6 distinct values + case STROKEDASH: + return 4; + // We only provide 5 different stroke dash values (but 4 is more effective) + default: + return 10; + } + } + + function isExprRef(o) { + return !!o?.expr; + } + function replaceExprRef(index) { + const props = keys(index || {}); + const newIndex = {}; + for (const prop of props) { + newIndex[prop] = signalRefOrValue(index[prop]); + } + return newIndex; + } + + function extractTitleConfig(titleConfig) { + const { + // These are non-mark title config that need to be hardcoded + anchor, + frame, + offset, + orient, + angle, + limit, + // color needs to be redirect to fill + color, + // subtitle properties + subtitleColor, + subtitleFont, + subtitleFontSize, + subtitleFontStyle, + subtitleFontWeight, + subtitleLineHeight, + subtitlePadding, + // The rest are mark config. + ...rest + } = titleConfig; + const titleMarkConfig = { + ...rest, + ...(color ? { + fill: color + } : {}) + }; + + // These are non-mark title config that need to be hardcoded + const nonMarkTitleProperties = { + ...(anchor ? { + anchor + } : {}), + ...(frame ? { + frame + } : {}), + ...(offset ? { + offset + } : {}), + ...(orient ? { + orient + } : {}), + ...(angle !== undefined ? { + angle + } : {}), + ...(limit !== undefined ? { + limit + } : {}) + }; + + // subtitle part can stay in config.title since header titles do not use subtitle + const subtitle = { + ...(subtitleColor ? { + subtitleColor + } : {}), + ...(subtitleFont ? { + subtitleFont + } : {}), + ...(subtitleFontSize ? { + subtitleFontSize + } : {}), + ...(subtitleFontStyle ? { + subtitleFontStyle + } : {}), + ...(subtitleFontWeight ? { + subtitleFontWeight + } : {}), + ...(subtitleLineHeight ? { + subtitleLineHeight + } : {}), + ...(subtitlePadding ? { + subtitlePadding + } : {}) + }; + const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']); + return { + titleMarkConfig, + subtitleMarkConfig, + nonMarkTitleProperties, + subtitle + }; + } + function isText(v) { + return vega.isString(v) || vega.isArray(v) && vega.isString(v[0]); + } + + // TODO: make recursive (e.g. with https://stackoverflow.com/a/64900252/214950 but needs https://github.com/vega/ts-json-schema-generator/issues/568) + + // Remove ValueRefs from mapped types + + function isSignalRef(o) { + return !!o?.signal; + } + + // TODO: add type of value (Make it VgValueRef {value?:V ...}) + + // TODO: add vg prefix + + function isVgRangeStep(range) { + return !!range['step']; + } + + // Domains that are not a union of domains + + /** + * A combined type for any Vega scales that Vega-Lite can generate + */ + + function isDataRefUnionedDomain(domain) { + if (!vega.isArray(domain)) { + return 'fields' in domain && !('data' in domain); + } + return false; + } + function isFieldRefUnionDomain(domain) { + if (!vega.isArray(domain)) { + return 'fields' in domain && 'data' in domain; + } + return false; + } + function isDataRefDomain(domain) { + if (!vega.isArray(domain)) { + return 'field' in domain && 'data' in domain; + } + return false; + } + + // TODO: make export interface VgEncodeEntry { + // x?: VgValueRef + // y?: VgValueRef + // ... + // color?: VgValueRef + // ... + // } + const VG_MARK_CONFIG_INDEX = { + aria: 1, + description: 1, + ariaRole: 1, + ariaRoleDescription: 1, + blend: 1, + opacity: 1, + fill: 1, + fillOpacity: 1, + stroke: 1, + strokeCap: 1, + strokeWidth: 1, + strokeOpacity: 1, + strokeDash: 1, + strokeDashOffset: 1, + strokeJoin: 1, + strokeOffset: 1, + strokeMiterLimit: 1, + startAngle: 1, + endAngle: 1, + padAngle: 1, + innerRadius: 1, + outerRadius: 1, + size: 1, + shape: 1, + interpolate: 1, + tension: 1, + orient: 1, + align: 1, + baseline: 1, + text: 1, + dir: 1, + dx: 1, + dy: 1, + ellipsis: 1, + limit: 1, + radius: 1, + theta: 1, + angle: 1, + font: 1, + fontSize: 1, + fontWeight: 1, + fontStyle: 1, + lineBreak: 1, + lineHeight: 1, + cursor: 1, + href: 1, + tooltip: 1, + cornerRadius: 1, + cornerRadiusTopLeft: 1, + cornerRadiusTopRight: 1, + cornerRadiusBottomLeft: 1, + cornerRadiusBottomRight: 1, + aspect: 1, + width: 1, + height: 1, + url: 1, + smooth: 1 + + // commented below are vg channel that do not have mark config. + // x: 1, + // y: 1, + // x2: 1, + // y2: 1, + + // xc'|'yc' + // clip: 1, + // path: 1, + // url: 1, + }; + + const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX); + const VG_MARK_INDEX = { + arc: 1, + area: 1, + group: 1, + image: 1, + line: 1, + path: 1, + rect: 1, + rule: 1, + shape: 1, + symbol: 1, + text: 1, + trail: 1 + }; + + // Vega's cornerRadius channels. + const VG_CORNERRADIUS_CHANNELS = ['cornerRadius', 'cornerRadiusTopLeft', 'cornerRadiusTopRight', 'cornerRadiusBottomLeft', 'cornerRadiusBottomRight']; + + function signalOrValueRefWithCondition(val) { + const condition = vega.isArray(val.condition) ? val.condition.map(conditionalSignalRefOrValue) : conditionalSignalRefOrValue(val.condition); + return { + ...signalRefOrValue(val), + condition + }; + } + function signalRefOrValue(value) { + if (isExprRef(value)) { + const { + expr, + ...rest + } = value; + return { + signal: expr, + ...rest + }; + } + return value; + } + function conditionalSignalRefOrValue(value) { + if (isExprRef(value)) { + const { + expr, + ...rest + } = value; + return { + signal: expr, + ...rest + }; + } + return value; + } + function signalOrValueRef(value) { + if (isExprRef(value)) { + const { + expr, + ...rest + } = value; + return { + signal: expr, + ...rest + }; + } + if (isSignalRef(value)) { + return value; + } + return value !== undefined ? { + value + } : undefined; + } + function exprFromSignalRefOrValue(ref) { + if (isSignalRef(ref)) { + return ref.signal; + } + return vega.stringValue(ref); + } + function exprFromValueRefOrSignalRef(ref) { + if (isSignalRef(ref)) { + return ref.signal; + } + return vega.stringValue(ref.value); + } + function signalOrStringValue(v) { + if (isSignalRef(v)) { + return v.signal; + } + return v == null ? null : vega.stringValue(v); + } + function applyMarkConfig(e, model, propsList) { + for (const property of propsList) { + const value = getMarkConfig(property, model.markDef, model.config); + if (value !== undefined) { + e[property] = signalOrValueRef(value); + } + } + return e; + } + function getStyles(mark) { + return [].concat(mark.type, mark.style ?? []); + } + function getMarkPropOrConfig(channel, mark, config) { + let opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + const { + vgChannel, + ignoreVgConfig + } = opt; + if (vgChannel && mark[vgChannel] !== undefined) { + return mark[vgChannel]; + } else if (mark[channel] !== undefined) { + return mark[channel]; + } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) { + return undefined; + } + return getMarkConfig(channel, mark, config, opt); + } + + /** + * Return property value from style or mark specific config property if exists. + * Otherwise, return general mark specific config. + */ + function getMarkConfig(channel, mark, config) { + let { + vgChannel + } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + return getFirstDefined( + // style config has highest precedence + vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined, getMarkStyleConfig(channel, mark, config.style), + // then mark-specific config + vgChannel ? config[mark.type][vgChannel] : undefined, config[mark.type][channel], + // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine + + // If there is vgChannel, skip vl channel. + // For example, vl size for text is vg fontSize, but config.mark.size is only for point size. + vgChannel ? config.mark[vgChannel] : config.mark[channel] // Need to cast for the same reason as above + ); + } + + function getMarkStyleConfig(prop, mark, styleConfigIndex) { + return getStyleConfig(prop, getStyles(mark), styleConfigIndex); + } + function getStyleConfig(p, styles, styleConfigIndex) { + styles = vega.array(styles); + let value; + for (const style of styles) { + const styleConfig = styleConfigIndex[style]; + if (styleConfig && styleConfig[p] !== undefined) { + value = styleConfig[p]; + } + } + return value; + } + + /** + * Return Vega sort parameters (tuple of field and order). + */ + function sortParams(orderDef, fieldRefOption) { + return vega.array(orderDef).reduce((s, orderChannelDef) => { + s.field.push(vgField(orderChannelDef, fieldRefOption)); + s.order.push(orderChannelDef.sort ?? 'ascending'); + return s; + }, { + field: [], + order: [] + }); + } + function mergeTitleFieldDefs(f1, f2) { + const merged = [...f1]; + f2.forEach(fdToMerge => { + for (const fieldDef1 of merged) { + // If already exists, no need to append to merged array + if (deepEqual(fieldDef1, fdToMerge)) { + return; + } + } + merged.push(fdToMerge); + }); + return merged; + } + function mergeTitle(title1, title2) { + if (deepEqual(title1, title2) || !title2) { + // if titles are the same or title2 is falsy + return title1; + } else if (!title1) { + // if title1 is falsy + return title2; + } else { + return [...vega.array(title1), ...vega.array(title2)].join(', '); + } + } + function mergeTitleComponent(v1, v2) { + const v1Val = v1.value; + const v2Val = v2.value; + if (v1Val == null || v2Val === null) { + return { + explicit: v1.explicit, + value: null + }; + } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) { + return { + explicit: v1.explicit, + value: mergeTitle(v1Val, v2Val) + }; + } else if (isText(v1Val) || isSignalRef(v1Val)) { + return { + explicit: v1.explicit, + value: v1Val + }; + } else if (isText(v2Val) || isSignalRef(v2Val)) { + return { + explicit: v1.explicit, + value: v2Val + }; + } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) { + return { + explicit: v1.explicit, + value: mergeTitleFieldDefs(v1Val, v2Val) + }; + } + /* istanbul ignore next: Condition should not happen -- only for warning in development. */ + throw new Error('It should never reach here'); + } + + function _defineProperty(obj, key, value) { + key = _toPropertyKey(key); + if (key in obj) { + Object.defineProperty(obj, key, { + value: value, + enumerable: true, + configurable: true, + writable: true + }); + } else { + obj[key] = value; + } + return obj; + } + function _toPrimitive(input, hint) { + if (typeof input !== "object" || input === null) return input; + var prim = input[Symbol.toPrimitive]; + if (prim !== undefined) { + var res = prim.call(input, hint || "default"); + if (typeof res !== "object") return res; + throw new TypeError("@@toPrimitive must return a primitive value."); + } + return (hint === "string" ? String : Number)(input); + } + function _toPropertyKey(arg) { + var key = _toPrimitive(arg, "string"); + return typeof key === "symbol" ? key : String(key); + } + function _classPrivateFieldGet(receiver, privateMap) { + var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); + return _classApplyDescriptorGet(receiver, descriptor); + } + function _classPrivateFieldSet(receiver, privateMap, value) { + var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); + _classApplyDescriptorSet(receiver, descriptor, value); + return value; + } + function _classExtractFieldDescriptor(receiver, privateMap, action) { + if (!privateMap.has(receiver)) { + throw new TypeError("attempted to " + action + " private field on non-instance"); + } + return privateMap.get(receiver); + } + function _classApplyDescriptorGet(receiver, descriptor) { + if (descriptor.get) { + return descriptor.get.call(receiver); + } + return descriptor.value; + } + function _classApplyDescriptorSet(receiver, descriptor, value) { + if (descriptor.set) { + descriptor.set.call(receiver, value); + } else { + if (!descriptor.writable) { + throw new TypeError("attempted to set read only private field"); + } + descriptor.value = value; + } + } + function _checkPrivateRedeclaration(obj, privateCollection) { + if (privateCollection.has(obj)) { + throw new TypeError("Cannot initialize the same private elements twice on an object"); + } + } + function _classPrivateFieldInitSpec(obj, privateMap, value) { + _checkPrivateRedeclaration(obj, privateMap); + privateMap.set(obj, value); + } + + /** + * Collection of all Vega-Lite Error Messages + */ + + function invalidSpec(spec) { + return `Invalid specification ${stringify(spec)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`; + } + + // FIT + const FIT_NON_SINGLE = 'Autosize "fit" only works for single views and layered views.'; + function containerSizeNonSingle(name) { + const uName = name == 'width' ? 'Width' : 'Height'; + return `${uName} "container" only works for single views and layered views.`; + } + function containerSizeNotCompatibleWithAutosize(name) { + const uName = name == 'width' ? 'Width' : 'Height'; + const fitDirection = name == 'width' ? 'x' : 'y'; + return `${uName} "container" only works well with autosize "fit" or "fit-${fitDirection}".`; + } + function droppingFit(channel) { + return channel ? `Dropping "fit-${channel}" because spec has discrete ${getSizeChannel(channel)}.` : `Dropping "fit" because spec has discrete size.`; + } + + // VIEW SIZE + + function unknownField(channel) { + return `Unknown field for ${channel}. Cannot calculate view size.`; + } + + // SELECTION + function cannotProjectOnChannelWithoutField(channel) { + return `Cannot project a selection on encoding channel "${channel}", which has no field.`; + } + function cannotProjectAggregate(channel, aggregate) { + return `Cannot project a selection on encoding channel "${channel}" as it uses an aggregate function ("${aggregate}").`; + } + function nearestNotSupportForContinuous(mark) { + return `The "nearest" transform is not supported for ${mark} marks.`; + } + function selectionNotSupported(mark) { + return `Selection not supported for ${mark} yet.`; + } + function selectionNotFound(name) { + return `Cannot find a selection named "${name}".`; + } + const SCALE_BINDINGS_CONTINUOUS = 'Scale bindings are currently only supported for scales with unbinned, continuous domains.'; + const LEGEND_BINDINGS_MUST_HAVE_PROJECTION = 'Legend bindings are only supported for selections over an individual field or encoding channel.'; + function cannotLookupVariableParameter(name) { + return `Lookups can only be performed on selection parameters. "${name}" is a variable parameter.`; + } + function noSameUnitLookup(name) { + return `Cannot define and lookup the "${name}" selection in the same view. ` + `Try moving the lookup into a second, layered view?`; + } + const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.'; + const INTERVAL_INITIALIZED_WITH_POS = 'Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'; + + // REPEAT + function noSuchRepeatedValue(field) { + return `Unknown repeated value "${field}".`; + } + function columnsNotSupportByRowCol(type) { + return `The "columns" property cannot be used when "${type}" has nested row/column.`; + } + + // CONCAT / REPEAT + const CONCAT_CANNOT_SHARE_AXIS = 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).'; + + // DATA + function unrecognizedParse(p) { + return `Unrecognized parse "${p}".`; + } + function differentParse(field, local, ancestor) { + return `An ancestor parsed field "${field}" as ${ancestor} but a child wants to parse the field as ${local}.`; + } + const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.'; + + // TRANSFORMS + function invalidTransformIgnored(transform) { + return `Ignoring an invalid transform: ${stringify(transform)}.`; + } + const NO_FIELDS_NEEDS_AS = 'If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'; + + // ENCODING & FACET + + function customFormatTypeNotAllowed(channel) { + return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`; + } + function projectionOverridden(opt) { + const { + parentProjection, + projection + } = opt; + return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(projection)}.`; + } + const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.'; + function offsetNestedInsideContinuousPositionScaleDropped(mainChannel) { + return `${mainChannel}Offset dropped because ${mainChannel} is continuous`; + } + function primitiveChannelDef(channel, type, value) { + return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`; + } + function invalidFieldType(type) { + return `Invalid field type "${type}".`; + } + function invalidFieldTypeForCountAggregate(type, aggregate) { + return `Invalid field type "${type}" for aggregate: "${aggregate}", using "quantitative" instead.`; + } + function invalidAggregate(aggregate) { + return `Invalid aggregation operator "${aggregate}".`; + } + function droppingColor(type, opt) { + const { + fill, + stroke + } = opt; + return `Dropping color ${type} as the plot also has ${fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'}.`; + } + function relativeBandSizeNotSupported(sizeChannel) { + return `Position range does not support relative band size for ${sizeChannel}.`; + } + function emptyFieldDef(fieldDef, channel) { + return `Dropping ${stringify(fieldDef)} from channel "${channel}" since it does not contain any data field, datum, value, or signal.`; + } + const LINE_WITH_VARYING_SIZE = 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.'; + function incompatibleChannel(channel, markOrFacet, when) { + return `${channel} dropped as it is incompatible with "${markOrFacet}"${when ? ` when ${when}` : ''}.`; + } + function invalidEncodingChannel(channel) { + return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`; + } + function channelShouldBeDiscrete(channel) { + return `${channel} encoding should be discrete (ordinal / nominal / binned).`; + } + function channelShouldBeDiscreteOrDiscretizing(channel) { + return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`; + } + function facetChannelDropped(channels) { + return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`; + } + function discreteChannelCannotEncode(channel, type) { + return `Using discrete channel "${channel}" to encode "${type}" field can be misleading as it does not encode ${type === 'ordinal' ? 'order' : 'magnitude'}.`; + } + + // MARK + + function rangeMarkAlignmentCannotBeExpression(align) { + return `The ${align} for range marks cannot be an expression`; + } + function lineWithRange(hasX2, hasY2) { + const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2'; + return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`; + } + function orientOverridden(original, actual) { + return `Specified orient "${original}" overridden with "${actual}".`; + } + function cannotUseScalePropertyWithNonColor(prop) { + return `Cannot use the scale property "${prop}" with non-color channel.`; + } + function cannotUseRelativeBandSizeWithNonBandScale(scaleType) { + return `Cannot use the relative band size with ${scaleType} scale.`; + } + function unaggregateDomainHasNoEffectForRawField(fieldDef) { + return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`; + } + function unaggregateDomainWithNonSharedDomainOp(aggregate) { + return `Unaggregated domain not applicable for "${aggregate}" since it produces values outside the origin domain of the source data.`; + } + function unaggregatedDomainWithLogScale(fieldDef) { + return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`; + } + function cannotApplySizeToNonOrientedMark(mark) { + return `Cannot apply size to non-oriented mark "${mark}".`; + } + function scaleTypeNotWorkWithChannel(channel, scaleType, defaultScaleType) { + return `Channel "${channel}" does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; + } + function scaleTypeNotWorkWithFieldDef(scaleType, defaultScaleType) { + return `FieldDef does not work with "${scaleType}" scale. We are using "${defaultScaleType}" scale instead.`; + } + function scalePropertyNotWorkWithScaleType(scaleType, propName, channel) { + return `${channel}-scale's "${propName}" is dropped as it does not work with ${scaleType} scale.`; + } + function stepDropped(channel) { + return `The step for "${channel}" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`; + } + function mergeConflictingProperty(property, propertyOf, v1, v2) { + return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using ${stringify(v1)}.`; + } + function mergeConflictingDomainProperty(property, propertyOf, v1, v2) { + return `Conflicting ${propertyOf.toString()} property "${property.toString()}" (${stringify(v1)} and ${stringify(v2)}). Using the union of the two domains.`; + } + function independentScaleMeansIndependentGuide(channel) { + return `Setting the scale to be independent for "${channel}" means we also have to set the guide (axis or legend) to be independent.`; + } + function domainSortDropped(sort) { + return `Dropping sort property ${stringify(sort)} as unioned domains only support boolean or op "count", "min", and "max".`; + } + const MORE_THAN_ONE_SORT = 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.'; + const FACETED_INDEPENDENT_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.'; + const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES = 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.'; + const FACETED_INDEPENDENT_SAME_SOURCE = 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.'; + + // STACK + function cannotStackRangedMark(channel) { + return `Cannot stack "${channel}" if there is already "${channel}2".`; + } + function cannotStackNonLinearScale(scaleType) { + return `Cannot stack non-linear scale (${scaleType}).`; + } + function stackNonSummativeAggregate(aggregate) { + return `Stacking is applied even though the aggregate function is non-summative ("${aggregate}").`; + } + + // TIMEUNIT + function invalidTimeUnit(unitName, value) { + return `Invalid ${unitName}: ${stringify(value)}.`; + } + function droppedDay(d) { + return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`; + } + function errorBarCenterAndExtentAreNotNeeded(center, extent) { + return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${extent && center ? 'are ' : 'is '}not needed when data are aggregated.`; + } + function errorBarCenterIsUsedWithWrongExtent(center, extent, mark) { + return `${center} is not usually used with ${extent} for ${mark}.`; + } + function errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark) { + return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`; + } + function errorBand1DNotSupport(property) { + return `1D error band does not support ${property}.`; + } + + // CHANNEL + function channelRequiredForBinned(channel) { + return `Channel ${channel} is required for "binned" bin.`; + } + function channelShouldNotBeUsedForBinned(channel) { + return `Channel ${channel} should not be used with "binned" bin.`; + } + function domainRequiredForThresholdScale(channel) { + return `Domain for ${channel} is required for threshold scale.`; + } + + /** + * Main (default) Vega Logger instance for Vega-Lite. + */ + const main = vega.logger(vega.Warn); + let current = main; + + /** + * Set the singleton logger to be a custom logger. + */ + function set(newLogger) { + current = newLogger; + return current; + } + + /** + * Reset the main logger to use the default Vega Logger. + */ + function reset() { + current = main; + return current; + } + function warn() { + current.warn(...arguments); + } + function debug() { + current.debug(...arguments); + } + + // DateTime definition object + + + /** + * @minimum 1 + * @maximum 12 + * @TJS-type integer + */ + + /** + * @minimum 1 + * @maximum 7 + */ + + /** + * Object for defining datetime in Vega-Lite Filter. + * If both month and quarter are provided, month has higher precedence. + * `day` cannot be combined with other date. + * We accept string for month and day names. + */ + + /** + * Internal Object for defining datetime expressions. + * This is an expression version of DateTime. + * If both month and quarter are provided, month has higher precedence. + * `day` cannot be combined with other date. + */ + + function isDateTime(o) { + if (o && vega.isObject(o)) { + for (const part of TIMEUNIT_PARTS) { + if (part in o) { + return true; + } + } + } + return false; + } + const MONTHS = ['january', 'february', 'march', 'april', 'may', 'june', 'july', 'august', 'september', 'october', 'november', 'december']; + const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3)); + const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday']; + const SHORT_DAYS = DAYS.map(d => d.substr(0, 3)); + function normalizeQuarter(q) { + if (isNumeric(q)) { + q = +q; + } + if (vega.isNumber(q)) { + if (q > 4) { + warn(invalidTimeUnit('quarter', q)); + } + // We accept 1-based quarter, so need to readjust to 0-based quarter + return q - 1; + } else { + // Invalid quarter + throw new Error(invalidTimeUnit('quarter', q)); + } + } + function normalizeMonth(m) { + if (isNumeric(m)) { + m = +m; + } + if (vega.isNumber(m)) { + // We accept 1-based month, so need to readjust to 0-based month + return m - 1; + } else { + const lowerM = m.toLowerCase(); + const monthIndex = MONTHS.indexOf(lowerM); + if (monthIndex !== -1) { + return monthIndex; // 0 for january, ... + } + + const shortM = lowerM.substr(0, 3); + const shortMonthIndex = SHORT_MONTHS.indexOf(shortM); + if (shortMonthIndex !== -1) { + return shortMonthIndex; + } + + // Invalid month + throw new Error(invalidTimeUnit('month', m)); + } + } + function normalizeDay(d) { + if (isNumeric(d)) { + d = +d; + } + if (vega.isNumber(d)) { + // mod so that this can be both 0-based where 0 = sunday + // and 1-based where 7=sunday + return d % 7; + } else { + const lowerD = d.toLowerCase(); + const dayIndex = DAYS.indexOf(lowerD); + if (dayIndex !== -1) { + return dayIndex; // 0 for january, ... + } + + const shortD = lowerD.substr(0, 3); + const shortDayIndex = SHORT_DAYS.indexOf(shortD); + if (shortDayIndex !== -1) { + return shortDayIndex; + } + // Invalid day + throw new Error(invalidTimeUnit('day', d)); + } + } + + /** + * @param d the date. + * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime. + * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds] + */ + function dateTimeParts(d, normalize) { + const parts = []; + if (normalize && d.day !== undefined) { + if (keys(d).length > 1) { + warn(droppedDay(d)); + d = duplicate(d); + delete d.day; + } + } + if (d.year !== undefined) { + parts.push(d.year); + } else { + // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega + // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year). + parts.push(2012); + } + if (d.month !== undefined) { + const month = normalize ? normalizeMonth(d.month) : d.month; + parts.push(month); + } else if (d.quarter !== undefined) { + const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter; + parts.push(vega.isNumber(quarter) ? quarter * 3 : `${quarter}*3`); + } else { + parts.push(0); // months start at zero in JS + } + + if (d.date !== undefined) { + parts.push(d.date); + } else if (d.day !== undefined) { + // HACK: Day only works as a standalone unit + // This is only correct because we always set year to 2006 for day + const day = normalize ? normalizeDay(d.day) : d.day; + parts.push(vega.isNumber(day) ? day + 1 : `${day}+1`); + } else { + parts.push(1); // Date starts at 1 in JS + } + + // Note: can't use TimeUnit enum here as importing it will create + // circular dependency problem! + for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds']) { + const unit = d[timeUnit]; + parts.push(typeof unit === 'undefined' ? 0 : unit); + } + return parts; + } + + /** + * Return Vega expression for a date time. + * + * @param d the date time. + * @returns the Vega expression. + */ + function dateTimeToExpr(d) { + const parts = dateTimeParts(d, true); + const string = parts.join(', '); + if (d.utc) { + return `utc(${string})`; + } else { + return `datetime(${string})`; + } + } + + /** + * Return Vega expression for a date time expression. + * + * @param d the internal date time object with expression. + * @returns the Vega expression. + */ + function dateTimeExprToExpr(d) { + const parts = dateTimeParts(d, false); + const string = parts.join(', '); + if (d.utc) { + return `utc(${string})`; + } else { + return `datetime(${string})`; + } + } + + /** + * @param d the date time. + * @returns the timestamp. + */ + function dateTimeToTimestamp(d) { + const parts = dateTimeParts(d, true); + if (d.utc) { + return +new Date(Date.UTC(...parts)); + } else { + return +new Date(...parts); + } + } + + /** Time Unit that only corresponds to only one part of Date objects. */ + const LOCAL_SINGLE_TIMEUNIT_INDEX = { + year: 1, + quarter: 1, + month: 1, + week: 1, + day: 1, + dayofyear: 1, + date: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1 + }; + const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX); + function isLocalSingleTimeUnit(timeUnit) { + return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit]; + } + function isBinnedTimeUnit(timeUnit) { + if (vega.isObject(timeUnit)) { + return timeUnit.binned; + } + return isBinnedTimeUnitString(timeUnit); + } + function isBinnedTimeUnitString(timeUnit) { + return timeUnit && timeUnit.startsWith('binned'); + } + function isUTCTimeUnit(t) { + return t.startsWith('utc'); + } + function getLocalTimeUnitFromUTCTimeUnit(t) { + return t.substring(3); + } + + /** + * Time Unit Params for encoding predicate, which can specified if the data is already "binned". + */ + + // matches vega time unit format specifier + + // In order of increasing specificity + const VEGALITE_TIMEFORMAT = { + 'year-month': '%b %Y ', + 'year-month-date': '%b %d, %Y ' + }; + function getTimeUnitParts(timeUnit) { + return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part)); + } + function getSmallestTimeUnitPart(timeUnit) { + const parts = getTimeUnitParts(timeUnit); + return parts[parts.length - 1]; + } + + /** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */ + function containsTimeUnit(fullTimeUnit, timeUnit) { + const index = fullTimeUnit.indexOf(timeUnit); + if (index < 0) { + return false; + } + + // exclude milliseconds + if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') { + return false; + } + + // exclude dayofyear + if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') { + return false; + } + if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') { + return false; + } + return true; + } + + /** + * Returns Vega expression for a given timeUnit and fieldRef + */ + function fieldExpr(fullTimeUnit, field) { + let { + end + } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : { + end: false + }; + const fieldRef = accessPathWithDatum(field); + const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : ''; + function func(timeUnit) { + if (timeUnit === 'quarter') { + // quarter starting at 0 (0,3,6,9). + return `(${utc}quarter(${fieldRef})-1)`; + } else { + return `${utc}${timeUnit}(${fieldRef})`; + } + } + let lastTimeUnit; + const dateExpr = {}; + for (const part of TIMEUNIT_PARTS) { + if (containsTimeUnit(fullTimeUnit, part)) { + dateExpr[part] = func(part); + lastTimeUnit = part; + } + } + if (end) { + dateExpr[lastTimeUnit] += '+1'; + } + return dateTimeExprToExpr(dateExpr); + } + function timeUnitSpecifierExpression(timeUnit) { + if (!timeUnit) { + return undefined; + } + const timeUnitParts = getTimeUnitParts(timeUnit); + return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`; + } + + /** + * Returns the signal expression used for axis labels for a time unit. + */ + function formatExpression(timeUnit, field, isUTCScale) { + if (!timeUnit) { + return undefined; + } + const expr = timeUnitSpecifierExpression(timeUnit); + + // We only use utcFormat for utc scale + // For utc time units, the data is already converted as a part of timeUnit transform. + // Thus, utc time units should use timeFormat to avoid shifting the time twice. + const utc = isUTCScale || isUTCTimeUnit(timeUnit); + return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`; + } + function normalizeTimeUnit(timeUnit) { + if (!timeUnit) { + return undefined; + } + let params; + if (vega.isString(timeUnit)) { + if (isBinnedTimeUnitString(timeUnit)) { + params = { + unit: timeUnit.substring(6), + binned: true + }; + } else { + params = { + unit: timeUnit + }; + } + } else if (vega.isObject(timeUnit)) { + params = { + ...timeUnit, + ...(timeUnit.unit ? { + unit: timeUnit.unit + } : {}) + }; + } + if (isUTCTimeUnit(params.unit)) { + params.utc = true; + params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit); + } + return params; + } + function timeUnitToString(tu) { + const { + utc, + ...rest + } = normalizeTimeUnit(tu); + if (rest.unit) { + return (utc ? 'utc' : '') + keys(rest).map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`)).join(''); + } else { + // when maxbins is specified instead of units + return (utc ? 'utc' : '') + 'timeunit' + keys(rest).map(p => varName(`_${p}_${rest[p]}`)).join(''); + } + } + function durationExpr(timeUnit) { + let wrap = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : x => x; + const normalizedTimeUnit = normalizeTimeUnit(timeUnit); + const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit); + if (smallestUnitPart && smallestUnitPart !== 'day') { + const startDate = { + year: 2001, + // pick a non-leap year + month: 1, + date: 1, + hours: 0, + minutes: 0, + seconds: 0, + milliseconds: 0 + }; + const { + step, + part + } = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step); + const endDate = { + ...startDate, + [part]: +startDate[part] + step + }; + + // Calculate timestamp duration for the smallest unit listed + return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`; + } + return undefined; + } + const DATE_PARTS = { + year: 1, + month: 1, + date: 1, + hours: 1, + minutes: 1, + seconds: 1, + milliseconds: 1 + }; + function isDatePart(timeUnit) { + return !!DATE_PARTS[timeUnit]; + } + function getDateTimePartAndStep(timeUnit) { + let step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1; + if (isDatePart(timeUnit)) { + return { + part: timeUnit, + step + }; + } + switch (timeUnit) { + case 'day': + case 'dayofyear': + return { + part: 'date', + step + }; + case 'quarter': + return { + part: 'month', + step: step * 3 + }; + case 'week': + return { + part: 'date', + step: step * 7 + }; + } + } + + function isSelectionPredicate(predicate) { + return predicate?.['param']; + } + function isFieldEqualPredicate(predicate) { + return !!predicate?.field && predicate.equal !== undefined; + } + function isFieldLTPredicate(predicate) { + return !!predicate?.field && predicate.lt !== undefined; + } + function isFieldLTEPredicate(predicate) { + return !!predicate?.field && predicate.lte !== undefined; + } + function isFieldGTPredicate(predicate) { + return !!predicate?.field && predicate.gt !== undefined; + } + function isFieldGTEPredicate(predicate) { + return !!predicate?.field && predicate.gte !== undefined; + } + function isFieldRangePredicate(predicate) { + if (predicate?.field) { + if (vega.isArray(predicate.range) && predicate.range.length === 2) { + return true; + } else if (isSignalRef(predicate.range)) { + return true; + } + } + return false; + } + function isFieldOneOfPredicate(predicate) { + return !!predicate?.field && (vega.isArray(predicate.oneOf) || vega.isArray(predicate.in)) // backward compatibility + ; + } + + function isFieldValidPredicate(predicate) { + return !!predicate?.field && predicate.valid !== undefined; + } + function isFieldPredicate(predicate) { + return isFieldOneOfPredicate(predicate) || isFieldEqualPredicate(predicate) || isFieldRangePredicate(predicate) || isFieldLTPredicate(predicate) || isFieldGTPredicate(predicate) || isFieldLTEPredicate(predicate) || isFieldGTEPredicate(predicate); + } + function predicateValueExpr(v, timeUnit) { + return valueExpr(v, { + timeUnit, + wrapTime: true + }); + } + function predicateValuesExpr(vals, timeUnit) { + return vals.map(v => predicateValueExpr(v, timeUnit)); + } + + // This method is used by Voyager. Do not change its behavior without changing Voyager. + function fieldFilterExpression(predicate) { + let useInRange = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + const { + field + } = predicate; + const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit); + const { + unit, + binned + } = normalizedTimeUnit || {}; + const rawFieldExpr = vgField(predicate, { + expr: 'datum' + }); + const fieldExpr$1 = unit ? + // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly. + // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline + // TODO: support utc + `time(${!binned ? fieldExpr(unit, field) : rawFieldExpr})` : rawFieldExpr; + if (isFieldEqualPredicate(predicate)) { + return `${fieldExpr$1}===${predicateValueExpr(predicate.equal, unit)}`; + } else if (isFieldLTPredicate(predicate)) { + const upper = predicate.lt; + return `${fieldExpr$1}<${predicateValueExpr(upper, unit)}`; + } else if (isFieldGTPredicate(predicate)) { + const lower = predicate.gt; + return `${fieldExpr$1}>${predicateValueExpr(lower, unit)}`; + } else if (isFieldLTEPredicate(predicate)) { + const upper = predicate.lte; + return `${fieldExpr$1}<=${predicateValueExpr(upper, unit)}`; + } else if (isFieldGTEPredicate(predicate)) { + const lower = predicate.gte; + return `${fieldExpr$1}>=${predicateValueExpr(lower, unit)}`; + } else if (isFieldOneOfPredicate(predicate)) { + return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr$1}) !== -1`; + } else if (isFieldValidPredicate(predicate)) { + return fieldValidPredicate(fieldExpr$1, predicate.valid); + } else if (isFieldRangePredicate(predicate)) { + const { + range + } = predicate; + const lower = isSignalRef(range) ? { + signal: `${range.signal}[0]` + } : range[0]; + const upper = isSignalRef(range) ? { + signal: `${range.signal}[1]` + } : range[1]; + if (lower !== null && upper !== null && useInRange) { + return 'inrange(' + fieldExpr$1 + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])'; + } + const exprs = []; + if (lower !== null) { + exprs.push(`${fieldExpr$1} >= ${predicateValueExpr(lower, unit)}`); + } + if (upper !== null) { + exprs.push(`${fieldExpr$1} <= ${predicateValueExpr(upper, unit)}`); + } + return exprs.length > 0 ? exprs.join(' && ') : 'true'; + } + + /* istanbul ignore next: it should never reach here */ + throw new Error(`Invalid field predicate: ${stringify(predicate)}`); + } + function fieldValidPredicate(fieldExpr) { + let valid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + if (valid) { + return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`; + } else { + return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`; + } + } + function normalizePredicate$1(f) { + if (isFieldPredicate(f) && f.timeUnit) { + return { + ...f, + timeUnit: normalizeTimeUnit(f.timeUnit) + }; + } + return f; + } + + /** + * Data type based on level of measurement + */ + const Type = { + quantitative: 'quantitative', + ordinal: 'ordinal', + temporal: 'temporal', + nominal: 'nominal', + geojson: 'geojson' + }; + function isContinuous(type) { + return type === 'quantitative' || type === 'temporal'; + } + function isDiscrete$1(type) { + return type === 'ordinal' || type === 'nominal'; + } + const QUANTITATIVE = Type.quantitative; + const ORDINAL = Type.ordinal; + const TEMPORAL = Type.temporal; + const NOMINAL = Type.nominal; + const GEOJSON = Type.geojson; + + /** + * Get full, lowercase type name for a given type. + * @param type + * @return Full type name. + */ + function getFullName(type) { + if (type) { + type = type.toLowerCase(); + switch (type) { + case 'q': + case QUANTITATIVE: + return 'quantitative'; + case 't': + case TEMPORAL: + return 'temporal'; + case 'o': + case ORDINAL: + return 'ordinal'; + case 'n': + case NOMINAL: + return 'nominal'; + case GEOJSON: + return 'geojson'; + } + } + // If we get invalid input, return undefined type. + return undefined; + } + + const ScaleType = { + // Continuous - Quantitative + LINEAR: 'linear', + LOG: 'log', + POW: 'pow', + SQRT: 'sqrt', + SYMLOG: 'symlog', + IDENTITY: 'identity', + SEQUENTIAL: 'sequential', + // Continuous - Time + TIME: 'time', + UTC: 'utc', + // Discretizing scales + QUANTILE: 'quantile', + QUANTIZE: 'quantize', + THRESHOLD: 'threshold', + BIN_ORDINAL: 'bin-ordinal', + // Discrete scales + ORDINAL: 'ordinal', + POINT: 'point', + BAND: 'band' + }; + /** + * Index for scale categories -- only scale of the same categories can be merged together. + * Current implementation is trying to be conservative and avoid merging scale type that might not work together + */ + const SCALE_CATEGORY_INDEX = { + linear: 'numeric', + log: 'numeric', + pow: 'numeric', + sqrt: 'numeric', + symlog: 'numeric', + identity: 'numeric', + sequential: 'numeric', + time: 'time', + utc: 'time', + ordinal: 'ordinal', + 'bin-ordinal': 'bin-ordinal', + // TODO: should bin-ordinal support merging with other + point: 'ordinal-position', + band: 'ordinal-position', + quantile: 'discretizing', + quantize: 'discretizing', + threshold: 'discretizing' + }; + + /** + * Whether the two given scale types can be merged together. + */ + function scaleCompatible(scaleType1, scaleType2) { + const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1]; + const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2]; + return scaleCategory1 === scaleCategory2 || scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time' || scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time'; + } + + /** + * Index for scale precedence -- high score = higher priority for merging. + */ + const SCALE_PRECEDENCE_INDEX = { + // numeric + linear: 0, + log: 1, + pow: 1, + sqrt: 1, + symlog: 1, + identity: 1, + sequential: 1, + // time + time: 0, + utc: 0, + // ordinal-position -- these have higher precedence than continuous scales as they support more types of data + point: 10, + band: 11, + // band has higher precedence as it is better for interaction + // non grouped types + ordinal: 0, + 'bin-ordinal': 0, + quantile: 0, + quantize: 0, + threshold: 0 + }; + + /** + * Return scale categories -- only scale of the same categories can be merged together. + */ + function scaleTypePrecedence(scaleType) { + return SCALE_PRECEDENCE_INDEX[scaleType]; + } + const QUANTITATIVE_SCALES = new Set(['linear', 'log', 'pow', 'sqrt', 'symlog']); + const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([...QUANTITATIVE_SCALES, 'time', 'utc']); + function isQuantitative(type) { + return QUANTITATIVE_SCALES.has(type); + } + const CONTINUOUS_TO_DISCRETE_SCALES = new Set(['quantile', 'quantize', 'threshold']); + const CONTINUOUS_DOMAIN_SCALES = new Set([...CONTINUOUS_TO_CONTINUOUS_SCALES, ...CONTINUOUS_TO_DISCRETE_SCALES, 'sequential', 'identity']); + const DISCRETE_DOMAIN_SCALES = new Set(['ordinal', 'bin-ordinal', 'point', 'band']); + function hasDiscreteDomain(type) { + return DISCRETE_DOMAIN_SCALES.has(type); + } + function hasContinuousDomain(type) { + return CONTINUOUS_DOMAIN_SCALES.has(type); + } + function isContinuousToContinuous(type) { + return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type); + } + function isContinuousToDiscrete(type) { + return CONTINUOUS_TO_DISCRETE_SCALES.has(type); + } + const defaultScaleConfig = { + pointPadding: 0.5, + barBandPaddingInner: 0.1, + rectBandPaddingInner: 0, + bandWithNestedOffsetPaddingInner: 0.2, + bandWithNestedOffsetPaddingOuter: 0.2, + minBandSize: 2, + minFontSize: 8, + maxFontSize: 40, + minOpacity: 0.3, + maxOpacity: 0.8, + // FIXME: revise if these *can* become ratios of width/height step + minSize: 9, + // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small! + + minStrokeWidth: 1, + maxStrokeWidth: 4, + quantileCount: 4, + quantizeCount: 4, + zero: true + }; + function isExtendedScheme(scheme) { + return !vega.isString(scheme) && !!scheme['name']; + } + function isParameterDomain(domain) { + return domain?.['param']; + } + function isDomainUnionWith(domain) { + return domain?.['unionWith']; + } + function isFieldRange(range) { + return vega.isObject(range) && 'field' in range; + } + const SCALE_PROPERTY_INDEX = { + type: 1, + domain: 1, + domainMax: 1, + domainMin: 1, + domainMid: 1, + domainRaw: 1, + align: 1, + range: 1, + rangeMax: 1, + rangeMin: 1, + scheme: 1, + bins: 1, + // Other properties + reverse: 1, + round: 1, + // quantitative / time + clamp: 1, + nice: 1, + // quantitative + base: 1, + exponent: 1, + constant: 1, + interpolate: 1, + zero: 1, + // zero depends on domain + // band/point + padding: 1, + paddingInner: 1, + paddingOuter: 1 + }; + const { + type, + domain: domain$1, + range, + rangeMax, + rangeMin, + scheme, + ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX + } = SCALE_PROPERTY_INDEX; + const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX); + function scaleTypeSupportProperty(scaleType, propName) { + switch (propName) { + case 'type': + case 'domain': + case 'reverse': + case 'range': + return true; + case 'scheme': + case 'interpolate': + return !['point', 'band', 'identity'].includes(scaleType); + case 'bins': + return !['point', 'band', 'identity', 'ordinal'].includes(scaleType); + case 'round': + return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point'; + case 'padding': + case 'rangeMin': + case 'rangeMax': + return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType); + case 'paddingOuter': + case 'align': + return ['point', 'band'].includes(scaleType); + case 'paddingInner': + return scaleType === 'band'; + case 'domainMax': + case 'domainMid': + case 'domainMin': + case 'domainRaw': + case 'clamp': + return isContinuousToContinuous(scaleType); + case 'nice': + return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold'; + case 'exponent': + return scaleType === 'pow'; + case 'base': + return scaleType === 'log'; + case 'constant': + return scaleType === 'symlog'; + case 'zero': + return hasContinuousDomain(scaleType) && !contains(['log', + // log scale cannot have zero value + 'time', 'utc', + // zero is not meaningful for time + 'threshold', + // threshold requires custom domain so zero does not matter + 'quantile' // quantile depends on distribution so zero does not matter + ], scaleType); + } + } + + /** + * Returns undefined if the input channel supports the input scale property name + */ + function channelScalePropertyIncompatability(channel, propName) { + switch (propName) { + case 'interpolate': + case 'scheme': + case 'domainMid': + if (!isColorChannel(channel)) { + return cannotUseScalePropertyWithNonColor(propName); + } + return undefined; + case 'align': + case 'type': + case 'bins': + case 'domain': + case 'domainMax': + case 'domainMin': + case 'domainRaw': + case 'range': + case 'base': + case 'exponent': + case 'constant': + case 'nice': + case 'padding': + case 'paddingInner': + case 'paddingOuter': + case 'rangeMax': + case 'rangeMin': + case 'reverse': + case 'round': + case 'clamp': + case 'zero': + return undefined; + // GOOD! + } + } + + function scaleTypeSupportDataType(specifiedType, fieldDefType) { + if (contains([ORDINAL, NOMINAL], fieldDefType)) { + return specifiedType === undefined || hasDiscreteDomain(specifiedType); + } else if (fieldDefType === TEMPORAL) { + return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType); + } else if (fieldDefType === QUANTITATIVE) { + return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined; + } + return true; + } + function channelSupportScaleType(channel, scaleType) { + let hasNestedOffsetScale = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + if (!isScaleChannel(channel)) { + return false; + } + switch (channel) { + case X: + case Y: + case XOFFSET: + case YOFFSET: + case THETA: + case RADIUS: + if (isContinuousToContinuous(scaleType)) { + return true; + } else if (scaleType === 'band') { + return true; + } else if (scaleType === 'point') { + /* + Point scale can't be use if the position has a nested offset scale + because if there is a nested scale, then it's band. + */ + return !hasNestedOffsetScale; + } + return false; + case SIZE: // TODO: size and opacity can support ordinal with more modification + case STROKEWIDTH: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case ANGLE: + // Although it generally doesn't make sense to use band with size and opacity, + // it can also work since we use band: 0.5 to get midpoint. + return isContinuousToContinuous(scaleType) || isContinuousToDiscrete(scaleType) || contains(['band', 'point', 'ordinal'], scaleType); + case COLOR: + case FILL: + case STROKE: + return scaleType !== 'band'; + // band does not make sense with color + case STROKEDASH: + case SHAPE: + return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType); + } + } + + /** + * All types of primitive marks. + */ + const Mark = { + arc: 'arc', + area: 'area', + bar: 'bar', + image: 'image', + line: 'line', + point: 'point', + rect: 'rect', + rule: 'rule', + text: 'text', + tick: 'tick', + trail: 'trail', + circle: 'circle', + square: 'square', + geoshape: 'geoshape' + }; + const ARC = Mark.arc; + const AREA = Mark.area; + const BAR = Mark.bar; + const IMAGE = Mark.image; + const LINE = Mark.line; + const POINT = Mark.point; + const RECT = Mark.rect; + const RULE = Mark.rule; + const TEXT = Mark.text; + const TICK = Mark.tick; + const TRAIL = Mark.trail; + const CIRCLE = Mark.circle; + const SQUARE = Mark.square; + const GEOSHAPE = Mark.geoshape; + function isPathMark(m) { + return ['line', 'area', 'trail'].includes(m); + } + function isRectBasedMark(m) { + return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m); + } + const PRIMITIVE_MARKS = new Set(keys(Mark)); + + /** @hidden */ + + function isMarkDef(mark) { + return mark['type']; + } + const STROKE_CONFIG = ['stroke', 'strokeWidth', 'strokeDash', 'strokeDashOffset', 'strokeOpacity', 'strokeJoin', 'strokeMiterLimit']; + const FILL_CONFIG = ['fill', 'fillOpacity']; + const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG]; + const VL_ONLY_MARK_CONFIG_INDEX = { + color: 1, + filled: 1, + invalid: 1, + order: 1, + radius2: 1, + theta2: 1, + timeUnitBandSize: 1, + timeUnitBandPosition: 1 + }; + const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX); + const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { + area: ['line', 'point'], + bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'], + rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'], + line: ['point'], + tick: ['bandSize', 'thickness'] + }; + const defaultMarkConfig = { + color: '#4c78a8', + invalid: 'filter', + timeUnitBandSize: 1 + }; + + // TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed + + const MARK_CONFIG_INDEX = { + mark: 1, + arc: 1, + area: 1, + bar: 1, + circle: 1, + image: 1, + line: 1, + point: 1, + rect: 1, + rule: 1, + square: 1, + text: 1, + tick: 1, + trail: 1, + geoshape: 1 + }; + const MARK_CONFIGS = keys(MARK_CONFIG_INDEX); + function isRelativeBandSize(o) { + return o && o['band'] != undefined; + } + const BAR_CORNER_RADIUS_INDEX = { + horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'], + vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight'] + }; + + // Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef + + const DEFAULT_RECT_BAND_SIZE = 5; + const defaultBarConfig = { + binSpacing: 1, + continuousBandSize: DEFAULT_RECT_BAND_SIZE, + minBandSize: 0.25, + timeUnitBandPosition: 0.5 + }; + const defaultRectConfig = { + binSpacing: 0, + continuousBandSize: DEFAULT_RECT_BAND_SIZE, + minBandSize: 0.25, + timeUnitBandPosition: 0.5 + }; + const defaultTickConfig = { + thickness: 1 + }; + function getMarkType(m) { + return isMarkDef(m) ? m.type : m; + } + + /** + * Utility files for producing Vega ValueRef for marks + */ + + function midPointRefWithPositionInvalidTest(params) { + const { + channel, + channelDef, + markDef, + scale, + config + } = params; + const ref = midPoint(params); + + // Wrap to check if the positional value is invalid, if so, plot the point on the min value + if ( + // Only this for field def without counting aggregate (as count wouldn't be null) + isFieldDef(channelDef) && !isCountingAggregateOp(channelDef.aggregate) && + // and only for continuous scale + scale && isContinuousToContinuous(scale.get('type'))) { + return wrapPositionInvalidTest({ + fieldDef: channelDef, + channel, + markDef, + ref, + config + }); + } + return ref; + } + function wrapPositionInvalidTest(_ref) { + let { + fieldDef, + channel, + markDef, + ref, + config + } = _ref; + if (isPathMark(markDef.type)) { + // path mark already use defined to skip points, no need to do it here. + return ref; + } + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid === null) { + // if there is no invalid filter, don't do the invalid test + return [fieldInvalidTestValueRef(fieldDef, channel), ref]; + } + return ref; + } + function fieldInvalidTestValueRef(fieldDef, channel) { + const test = fieldInvalidPredicate(fieldDef, true); + const mainChannel = getMainRangeChannel(channel); // we can cast here as the output can't be other things. + const zeroValueRef = mainChannel === 'y' ? { + field: { + group: 'height' + } + } : + // x / angle / radius can all use 0 + { + value: 0 + }; + return { + test, + ...zeroValueRef + }; + } + function fieldInvalidPredicate(field) { + let invalid = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + return fieldValidPredicate(vega.isString(field) ? field : vgField(field, { + expr: 'datum' + }), !invalid); + } + function datumDefToExpr(datumDef) { + const { + datum + } = datumDef; + if (isDateTime(datum)) { + return dateTimeToExpr(datum); + } + return `${stringify(datum)}`; + } + function valueRefForFieldOrDatumDef(fieldDef, scaleName, opt, encode) { + const ref = {}; + if (scaleName) { + ref.scale = scaleName; + } + if (isDatumDef(fieldDef)) { + const { + datum + } = fieldDef; + if (isDateTime(datum)) { + ref.signal = dateTimeToExpr(datum); + } else if (isSignalRef(datum)) { + ref.signal = datum.signal; + } else if (isExprRef(datum)) { + ref.signal = datum.expr; + } else { + ref.value = datum; + } + } else { + ref.field = vgField(fieldDef, opt); + } + if (encode) { + const { + offset, + band + } = encode; + if (offset) { + ref.offset = offset; + } + if (band) { + ref.band = band; + } + } + return ref; + } + + /** + * Signal that returns the middle of a bin from start and end field. Should only be used with x and y. + */ + function interpolatedSignalRef(_ref2) { + let { + scaleName, + fieldOrDatumDef, + fieldOrDatumDef2, + offset, + startSuffix, + endSuffix = 'end', + bandPosition = 0.5 + } = _ref2; + const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined; + const start = vgField(fieldOrDatumDef, { + expr, + suffix: startSuffix + }); + const end = fieldOrDatumDef2 !== undefined ? vgField(fieldOrDatumDef2, { + expr + }) : vgField(fieldOrDatumDef, { + suffix: endSuffix, + expr + }); + const ref = {}; + if (bandPosition === 0 || bandPosition === 1) { + ref.scale = scaleName; + const field = bandPosition === 0 ? start : end; + ref.field = field; + } else { + const datum = isSignalRef(bandPosition) ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}` : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`; + ref.signal = `scale("${scaleName}", ${datum})`; + } + if (offset) { + ref.offset = offset; + } + return ref; + } + function binSizeExpr(_ref3) { + let { + scaleName, + fieldDef + } = _ref3; + const start = vgField(fieldDef, { + expr: 'datum' + }); + const end = vgField(fieldDef, { + expr: 'datum', + suffix: 'end' + }); + return `abs(scale("${scaleName}", ${end}) - scale("${scaleName}", ${start}))`; + } + /** + * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels. + */ + function midPoint(_ref4) { + let { + channel, + channelDef, + channel2Def, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef, + bandPosition + } = _ref4; + // TODO: datum support + if (channelDef) { + /* istanbul ignore else */ + + if (isFieldOrDatumDef(channelDef)) { + const scaleType = scale?.get('type'); + if (isTypedFieldDef(channelDef)) { + bandPosition ??= getBandPosition({ + fieldDef: channelDef, + fieldDef2: channel2Def, + markDef, + config + }); + const { + bin, + timeUnit, + type + } = channelDef; + if (isBinning(bin) || bandPosition && timeUnit && type === TEMPORAL) { + // Use middle only for x an y to place marks in the center between start and end of the bin range. + // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match. + if (stack?.impute) { + // For stack, we computed bin_mid so we can impute. + return valueRefForFieldOrDatumDef(channelDef, scaleName, { + binSuffix: 'mid' + }, { + offset + }); + } + if (bandPosition && !hasDiscreteDomain(scaleType)) { + // if band = 0, no need to call interpolation + // For non-stack, we can just calculate bin mid on the fly using signal. + return interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: channelDef, + bandPosition, + offset + }); + } + return valueRefForFieldOrDatumDef(channelDef, scaleName, binRequiresRange(channelDef, channel) ? { + binSuffix: 'range' + } : {}, { + offset + }); + } else if (isBinned(bin)) { + if (isFieldDef(channel2Def)) { + return interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: channelDef, + fieldOrDatumDef2: channel2Def, + bandPosition, + offset + }); + } else { + const channel2 = channel === X ? X2 : Y2; + warn(channelRequiredForBinned(channel2)); + } + } + } + return valueRefForFieldOrDatumDef(channelDef, scaleName, hasDiscreteDomain(scaleType) ? { + binSuffix: 'range' + } : {}, + // no need for bin suffix if there is no scale + { + offset, + // For band, to get mid point, need to offset by half of the band + band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined + }); + } else if (isValueDef(channelDef)) { + const value = channelDef.value; + const offsetMixins = offset ? { + offset + } : {}; + return { + ...widthHeightValueOrSignalRef(channel, value), + ...offsetMixins + }; + } + + // If channelDef is neither field def or value def, it's a condition-only def. + // In such case, we will use default ref. + } + + if (vega.isFunction(defaultRef)) { + defaultRef = defaultRef(); + } + if (defaultRef) { + // for non-position, ref could be undefined. + return { + ...defaultRef, + // only include offset when it is non-zero (zero = no offset) + ...(offset ? { + offset + } : {}) + }; + } + return defaultRef; + } + + /** + * Convert special "width" and "height" values in Vega-Lite into Vega value ref. + */ + function widthHeightValueOrSignalRef(channel, value) { + if (contains(['x', 'x2'], channel) && value === 'width') { + return { + field: { + group: 'width' + } + }; + } else if (contains(['y', 'y2'], channel) && value === 'height') { + return { + field: { + group: 'height' + } + }; + } + return signalOrValueRef(value); + } + + function isCustomFormatType(formatType) { + return formatType && formatType !== 'number' && formatType !== 'time'; + } + function customFormatExpr(formatType, field, format) { + return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`; + } + const BIN_RANGE_DELIMITER = ' \u2013 '; + function formatSignalRef(_ref) { + let { + fieldOrDatumDef, + format, + formatType, + expr, + normalizeStack, + config + } = _ref; + if (isCustomFormatType(formatType)) { + return formatCustomType({ + fieldOrDatumDef, + format, + formatType, + expr, + config + }); + } + const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack); + const type = channelDefType(fieldOrDatumDef); + if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (type === 'quantitative') { + if (normalizeStack && config.normalizedNumberFormatType) return formatCustomType({ + fieldOrDatumDef, + format: config.normalizedNumberFormat, + formatType: config.normalizedNumberFormatType, + expr, + config + }); + if (config.numberFormatType) { + return formatCustomType({ + fieldOrDatumDef, + format: config.numberFormat, + formatType: config.numberFormatType, + expr, + config + }); + } + } + if (type === 'temporal' && config.timeFormatType && isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit === undefined) { + return formatCustomType({ + fieldOrDatumDef, + format: config.timeFormat, + formatType: config.timeFormatType, + expr, + config + }); + } + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { + const signal = timeFormatExpression({ + field, + timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined, + format, + formatType: config.timeFormatType, + rawTimeFormat: config.timeFormat, + isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC + }); + return signal ? { + signal + } : undefined; + } + format = numberFormat({ + type, + specifiedFormat: format, + config, + normalizeStack + }); + if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { + const endField = vgField(fieldOrDatumDef, { + expr, + binSuffix: 'end' + }); + return { + signal: binFormatExpression(field, endField, format, formatType, config) + }; + } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') { + return { + signal: `${formatExpr(field, format)}` + }; + } else { + return { + signal: `isValid(${field}) ? ${field} : ""+${field}` + }; + } + } + function fieldToFormat(fieldOrDatumDef, expr, normalizeStack) { + if (isFieldDef(fieldOrDatumDef)) { + if (normalizeStack) { + return `${vgField(fieldOrDatumDef, { + expr, + suffix: 'end' + })}-${vgField(fieldOrDatumDef, { + expr, + suffix: 'start' + })}`; + } else { + return vgField(fieldOrDatumDef, { + expr + }); + } + } else { + return datumDefToExpr(fieldOrDatumDef); + } + } + function formatCustomType(_ref2) { + let { + fieldOrDatumDef, + format, + formatType, + expr, + normalizeStack, + config, + field + } = _ref2; + field ??= fieldToFormat(fieldOrDatumDef, expr, normalizeStack); + if (field !== 'datum.value' && + // For axis/legend, we can't correctly know the end of the bin from `datum` + isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) { + const endField = vgField(fieldOrDatumDef, { + expr, + binSuffix: 'end' + }); + return { + signal: binFormatExpression(field, endField, format, formatType, config) + }; + } + return { + signal: customFormatExpr(formatType, field, format) + }; + } + function guideFormat(fieldOrDatumDef, type, format, formatType, config, omitTimeFormatConfig) { + if (vega.isString(formatType) && isCustomFormatType(formatType)) { + return undefined; // handled in encode block + } else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (channelDefType(fieldOrDatumDef) === 'quantitative') { + if (config.normalizedNumberFormatType && isPositionFieldOrDatumDef(fieldOrDatumDef) && fieldOrDatumDef.stack === 'normalize') { + return undefined; // handled in encode block + } + + if (config.numberFormatType) { + return undefined; // handled in encode block + } + } + } + + if (isPositionFieldOrDatumDef(fieldOrDatumDef) && fieldOrDatumDef.stack === 'normalize' && config.normalizedNumberFormat) { + return numberFormat({ + type: 'quantitative', + config, + normalizeStack: true + }); + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) { + const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; + if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) { + return undefined; // hanlded in encode block + } + + return timeFormat({ + specifiedFormat: format, + timeUnit, + config, + omitTimeFormatConfig + }); + } + return numberFormat({ + type, + specifiedFormat: format, + config + }); + } + function guideFormatType(formatType, fieldOrDatumDef, scaleType) { + if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) { + return formatType; + } + if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') { + return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time'; + } + return undefined; + } + + /** + * Returns number format for a fieldDef. + */ + function numberFormat(_ref3) { + let { + type, + specifiedFormat, + config, + normalizeStack + } = _ref3; + // Specified format in axis/legend has higher precedence than fieldDef.format + if (vega.isString(specifiedFormat)) { + return specifiedFormat; + } + if (type === QUANTITATIVE) { + // we only apply the default if the field is quantitative + return normalizeStack ? config.normalizedNumberFormat : config.numberFormat; + } + return undefined; + } + + /** + * Returns time format for a fieldDef for use in guides. + */ + function timeFormat(_ref4) { + let { + specifiedFormat, + timeUnit, + config, + omitTimeFormatConfig + } = _ref4; + if (specifiedFormat) { + return specifiedFormat; + } + if (timeUnit) { + return { + signal: timeUnitSpecifierExpression(timeUnit) + }; + } + return omitTimeFormatConfig ? undefined : config.timeFormat; + } + function formatExpr(field, format) { + return `format(${field}, "${format || ''}")`; + } + function binNumberFormatExpr(field, format, formatType, config) { + if (isCustomFormatType(formatType)) { + return customFormatExpr(formatType, field, format); + } + return formatExpr(field, (vega.isString(format) ? format : undefined) ?? config.numberFormat); + } + function binFormatExpression(startField, endField, format, formatType, config) { + if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) { + return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config); + } + const start = binNumberFormatExpr(startField, format, formatType, config); + const end = binNumberFormatExpr(endField, format, formatType, config); + return `${fieldValidPredicate(startField, false)} ? "null" : ${start} + "${BIN_RANGE_DELIMITER}" + ${end}`; + } + + /** + * Returns the time expression used for axis/legend labels or text mark for a temporal field + */ + function timeFormatExpression(_ref5) { + let { + field, + timeUnit, + format, + formatType, + rawTimeFormat, + isUTCScale + } = _ref5; + if (!timeUnit || format) { + // If there is no time unit, or if user explicitly specifies format for axis/legend/text. + if (!timeUnit && formatType) { + return `${formatType}(${field}, '${format}')`; + } + format = vega.isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit. + return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`; + } else { + return formatExpression(timeUnit, field, isUTCScale); + } + } + + /** + * A sort definition for transform + */ + + const DEFAULT_SORT_OP = 'min'; + + /** + * A sort definition for sorting a discrete scale in an encoding field definition. + */ + + const SORT_BY_CHANNEL_INDEX = { + x: 1, + y: 1, + color: 1, + fill: 1, + stroke: 1, + strokeWidth: 1, + size: 1, + shape: 1, + fillOpacity: 1, + strokeOpacity: 1, + opacity: 1, + text: 1 + }; + function isSortByChannel(c) { + return c in SORT_BY_CHANNEL_INDEX; + } + function isSortByEncoding(sort) { + return !!sort?.['encoding']; + } + function isSortField(sort) { + return sort && (sort['op'] === 'count' || !!sort['field']); + } + function isSortArray(sort) { + return sort && vega.isArray(sort); + } + + function isFacetMapping(f) { + return 'row' in f || 'column' in f; + } + + /** + * Facet mapping for encoding macro + */ + + function isFacetFieldDef(channelDef) { + return !!channelDef && 'header' in channelDef; + } + + /** + * Base interface for a facet specification. + */ + + /** + * A facet specification without any shortcut / expansion syntax + */ + + function isFacetSpec(spec) { + return 'facet' in spec; + } + + /** + * Definition object for a constant value (primitive value or gradient definition) of an encoding channel. + */ + + /** + * A ValueDef with Condition where either the condition or the value are optional. + * { + * condition: {field: ...} | {value: ...}, + * value: ..., + * } + */ + /** + * @minProperties 1 + */ + function isConditionalParameter(c) { + return c['param']; + } + + /** + * A FieldDef with Condition + * { + * condition: {value: ...}, + * field: ..., + * ... + * } + */ + + /** + * A ValueDef with optional Condition + * { + * condition: {field: ...} | {value: ...}, + * value: ..., + * } + */ + /** + * Reference to a repeated value. + */ + function isRepeatRef(field) { + return field && !vega.isString(field) && 'repeat' in field; + } + + /** @@hidden */ + + function toFieldDefBase(fieldDef) { + const { + field, + timeUnit, + bin, + aggregate + } = fieldDef; + return { + ...(timeUnit ? { + timeUnit + } : {}), + ...(bin ? { + bin + } : {}), + ...(aggregate ? { + aggregate + } : {}), + field + }; + } + + /** + * Definition object for a data field, its type and transformation of an encoding channel. + */ + + function isSortableFieldDef(fieldDef) { + return 'sort' in fieldDef; + } + + /** + * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`. + */ + // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase. + + /** + * Field Def without scale (and without bin: "binned" support). + */ + + // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase. + + function getBandPosition(_ref) { + let { + fieldDef, + fieldDef2, + markDef: mark, + config + } = _ref; + if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) { + return fieldDef.bandPosition; + } + if (isFieldDef(fieldDef)) { + const { + timeUnit, + bin + } = fieldDef; + if (timeUnit && !fieldDef2) { + return getMarkConfig('timeUnitBandPosition', mark, config); + } else if (isBinning(bin)) { + return 0.5; + } + } + return undefined; + } + function getBandSize(_ref2) { + let { + channel, + fieldDef, + fieldDef2, + markDef: mark, + config, + scaleType, + useVlSizeChannel + } = _ref2; + const sizeChannel = getSizeChannel(channel); + const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, { + vgChannel: sizeChannel + }); + if (size !== undefined) { + return size; + } + if (isFieldDef(fieldDef)) { + const { + timeUnit, + bin + } = fieldDef; + if (timeUnit && !fieldDef2) { + return { + band: getMarkConfig('timeUnitBandSize', mark, config) + }; + } else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) { + return { + band: 1 + }; + } + } + if (isRectBasedMark(mark.type)) { + if (scaleType) { + if (hasDiscreteDomain(scaleType)) { + return config[mark.type]?.discreteBandSize || { + band: 1 + }; + } else { + return config[mark.type]?.continuousBandSize; + } + } + return config[mark.type]?.discreteBandSize; + } + return undefined; + } + function hasBandEnd(fieldDef, fieldDef2, markDef, config) { + if (isBinning(fieldDef.bin) || fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal') { + // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit + // doesn't have to use bandEnd if there is no bandPosition. + return getBandPosition({ + fieldDef, + fieldDef2, + markDef, + config + }) !== undefined; + } + return false; + } + + /** + * Field definition of a mark property, which can contain a legend. + */ + + // Detail + // Order Path have no scale + function isOrderOnlyDef(orderDef) { + return orderDef && !!orderDef.sort && !orderDef['field']; + } + function isConditionalDef(channelDef) { + return channelDef && 'condition' in channelDef; + } + + /** + * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef + */ + function hasConditionalFieldDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && !vega.isArray(condition) && isFieldDef(condition); + } + function hasConditionalFieldOrDatumDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && !vega.isArray(condition) && isFieldOrDatumDef(condition); + } + function hasConditionalValueDef(channelDef) { + const condition = channelDef?.['condition']; + return !!condition && (vega.isArray(condition) || isValueDef(condition)); + } + function isFieldDef(channelDef) { + // TODO: we can't use field in channelDef here as it's somehow failing runtime test + return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count'); + } + function channelDefType(channelDef) { + return channelDef?.['type']; + } + function isDatumDef(channelDef) { + return channelDef && 'datum' in channelDef; + } + function isContinuousFieldOrDatumDef(cd) { + // TODO: make datum support DateTime object + return isTypedFieldDef(cd) && !isDiscrete(cd) || isNumericDataDef(cd); + } + function isUnbinnedQuantitativeFieldOrDatumDef(cd) { + // TODO: make datum support DateTime object + return isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin || isNumericDataDef(cd); + } + function isNumericDataDef(cd) { + return isDatumDef(cd) && vega.isNumber(cd.datum); + } + function isFieldOrDatumDef(channelDef) { + return isFieldDef(channelDef) || isDatumDef(channelDef); + } + function isTypedFieldDef(channelDef) { + return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef; + } + function isValueDef(channelDef) { + return channelDef && 'value' in channelDef && 'value' in channelDef; + } + function isScaleFieldDef(channelDef) { + return channelDef && ('scale' in channelDef || 'sort' in channelDef); + } + function isPositionFieldOrDatumDef(channelDef) { + return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef); + } + function isMarkPropFieldOrDatumDef(channelDef) { + return channelDef && 'legend' in channelDef; + } + function isStringFieldOrDatumDef(channelDef) { + return channelDef && ('format' in channelDef || 'formatType' in channelDef); + } + function toStringFieldDef(fieldDef) { + // omit properties that don't exist in string field defs + return omit(fieldDef, ['legend', 'axis', 'header', 'scale']); + } + function isOpFieldDef(fieldDef) { + return 'op' in fieldDef; + } + + /** + * Get a Vega field reference from a Vega-Lite field def. + */ + function vgField(fieldDef) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let field = fieldDef.field; + const prefix = opt.prefix; + let suffix = opt.suffix; + let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped + + if (isCount(fieldDef)) { + field = internalField('count'); + } else { + let fn; + if (!opt.nofn) { + if (isOpFieldDef(fieldDef)) { + fn = fieldDef.op; + } else { + const { + bin, + aggregate, + timeUnit + } = fieldDef; + if (isBinning(bin)) { + fn = binToString(bin); + suffix = (opt.binSuffix ?? '') + (opt.suffix ?? ''); + } else if (aggregate) { + if (isArgmaxDef(aggregate)) { + argAccessor = `["${field}"]`; + field = `argmax_${aggregate.argmax}`; + } else if (isArgminDef(aggregate)) { + argAccessor = `["${field}"]`; + field = `argmin_${aggregate.argmin}`; + } else { + fn = String(aggregate); + } + } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + fn = timeUnitToString(timeUnit); + suffix = (!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix || '') + (opt.suffix ?? ''); + } + } + } + if (fn) { + field = field ? `${fn}_${field}` : fn; + } + } + if (suffix) { + field = `${field}_${suffix}`; + } + if (prefix) { + field = `${prefix}_${field}`; + } + if (opt.forAs) { + return removePathFromField(field); + } else if (opt.expr) { + // Expression to access flattened field. No need to escape dots. + return flatAccessWithDatum(field, opt.expr) + argAccessor; + } else { + // We flattened all fields so paths should have become dot. + return replacePathInField(field) + argAccessor; + } + } + function isDiscrete(def) { + switch (def.type) { + case 'nominal': + case 'ordinal': + case 'geojson': + return true; + case 'quantitative': + return isFieldDef(def) && !!def.bin; + case 'temporal': + return false; + } + throw new Error(invalidFieldType(def.type)); + } + function isDiscretizing(def) { + return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type); + } + function isCount(fieldDef) { + return fieldDef.aggregate === 'count'; + } + function verbalTitleFormatter(fieldDef, config) { + const { + field, + bin, + timeUnit, + aggregate + } = fieldDef; + if (aggregate === 'count') { + return config.countTitle; + } else if (isBinning(bin)) { + return `${field} (binned)`; + } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + const unit = normalizeTimeUnit(timeUnit)?.unit; + if (unit) { + return `${field} (${getTimeUnitParts(unit).join('-')})`; + } + } else if (aggregate) { + if (isArgmaxDef(aggregate)) { + return `${field} for max ${aggregate.argmax}`; + } else if (isArgminDef(aggregate)) { + return `${field} for min ${aggregate.argmin}`; + } else { + return `${titleCase(aggregate)} of ${field}`; + } + } + return field; + } + function functionalTitleFormatter(fieldDef) { + const { + aggregate, + bin, + timeUnit, + field + } = fieldDef; + if (isArgmaxDef(aggregate)) { + return `${field} for argmax(${aggregate.argmax})`; + } else if (isArgminDef(aggregate)) { + return `${field} for argmin(${aggregate.argmin})`; + } + const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined; + const fn = aggregate || timeUnitParams?.unit || timeUnitParams?.maxbins && 'timeunit' || isBinning(bin) && 'bin'; + if (fn) { + return `${fn.toUpperCase()}(${field})`; + } else { + return field; + } + } + const defaultTitleFormatter = (fieldDef, config) => { + switch (config.fieldTitle) { + case 'plain': + return fieldDef.field; + case 'functional': + return functionalTitleFormatter(fieldDef); + default: + return verbalTitleFormatter(fieldDef, config); + } + }; + let titleFormatter = defaultTitleFormatter; + function setTitleFormatter(formatter) { + titleFormatter = formatter; + } + function resetTitleFormatter() { + setTitleFormatter(defaultTitleFormatter); + } + function title(fieldOrDatumDef, config, _ref3) { + let { + allowDisabling, + includeDefault = true + } = _ref3; + const guideTitle = getGuide(fieldOrDatumDef)?.title; + if (!isFieldDef(fieldOrDatumDef)) { + return guideTitle ?? fieldOrDatumDef.title; + } + const fieldDef = fieldOrDatumDef; + const def = includeDefault ? defaultTitle(fieldDef, config) : undefined; + if (allowDisabling) { + return getFirstDefined(guideTitle, fieldDef.title, def); + } else { + return guideTitle ?? fieldDef.title ?? def; + } + } + function getGuide(fieldDef) { + if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) { + return fieldDef.axis; + } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) { + return fieldDef.legend; + } else if (isFacetFieldDef(fieldDef) && fieldDef.header) { + return fieldDef.header; + } + return undefined; + } + function defaultTitle(fieldDef, config) { + return titleFormatter(fieldDef, config); + } + function getFormatMixins(fieldDef) { + if (isStringFieldOrDatumDef(fieldDef)) { + const { + format, + formatType + } = fieldDef; + return { + format, + formatType + }; + } else { + const guide = getGuide(fieldDef) ?? {}; + const { + format, + formatType + } = guide; + return { + format, + formatType + }; + } + } + function defaultType$2(fieldDef, channel) { + switch (channel) { + case 'latitude': + case 'longitude': + return 'quantitative'; + case 'row': + case 'column': + case 'facet': + case 'shape': + case 'strokeDash': + return 'nominal'; + case 'order': + return 'ordinal'; + } + if (isSortableFieldDef(fieldDef) && vega.isArray(fieldDef.sort)) { + return 'ordinal'; + } + const { + aggregate, + bin, + timeUnit + } = fieldDef; + if (timeUnit) { + return 'temporal'; + } + if (bin || aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { + return 'quantitative'; + } + if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) { + switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) { + case 'numeric': + case 'discretizing': + return 'quantitative'; + case 'time': + return 'temporal'; + } + } + return 'nominal'; + } + + /** + * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef. + * @param channelDef + */ + + function getFieldDef(channelDef) { + if (isFieldDef(channelDef)) { + return channelDef; + } else if (hasConditionalFieldDef(channelDef)) { + return channelDef.condition; + } + return undefined; + } + function getFieldOrDatumDef(channelDef) { + if (isFieldOrDatumDef(channelDef)) { + return channelDef; + } else if (hasConditionalFieldOrDatumDef(channelDef)) { + return channelDef.condition; + } + return undefined; + } + + /** + * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing. + */ + function initChannelDef(channelDef, channel, config) { + let opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + if (vega.isString(channelDef) || vega.isNumber(channelDef) || vega.isBoolean(channelDef)) { + const primitiveType = vega.isString(channelDef) ? 'string' : vega.isNumber(channelDef) ? 'number' : 'boolean'; + warn(primitiveChannelDef(channel, primitiveType, channelDef)); + return { + value: channelDef + }; + } + + // If a fieldDef contains a field, we need type. + if (isFieldOrDatumDef(channelDef)) { + return initFieldOrDatumDef(channelDef, channel, config, opt); + } else if (hasConditionalFieldOrDatumDef(channelDef)) { + return { + ...channelDef, + // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition + condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) + }; + } + return channelDef; + } + function initFieldOrDatumDef(fd, channel, config, opt) { + if (isStringFieldOrDatumDef(fd)) { + const { + format, + formatType, + ...rest + } = fd; + if (isCustomFormatType(formatType) && !config.customFormatTypes) { + warn(customFormatTypeNotAllowed(channel)); + return initFieldOrDatumDef(rest, channel, config, opt); + } + } else { + const guideType = isPositionFieldOrDatumDef(fd) ? 'axis' : isMarkPropFieldOrDatumDef(fd) ? 'legend' : isFacetFieldDef(fd) ? 'header' : null; + if (guideType && fd[guideType]) { + const { + format, + formatType, + ...newGuide + } = fd[guideType]; + if (isCustomFormatType(formatType) && !config.customFormatTypes) { + warn(customFormatTypeNotAllowed(channel)); + return initFieldOrDatumDef({ + ...fd, + [guideType]: newGuide + }, channel, config, opt); + } + } + } + if (isFieldDef(fd)) { + return initFieldDef(fd, channel, opt); + } + return initDatumDef(fd); + } + function initDatumDef(datumDef) { + let type = datumDef['type']; + if (type) { + return datumDef; + } + const { + datum + } = datumDef; + type = vega.isNumber(datum) ? 'quantitative' : vega.isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined; + return { + ...datumDef, + type + }; + } + function initFieldDef(fd, channel) { + let { + compositeMark = false + } = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + const { + aggregate, + timeUnit, + bin, + field + } = fd; + const fieldDef = { + ...fd + }; + + // Drop invalid aggregate + if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) { + warn(invalidAggregate(aggregate)); + delete fieldDef.aggregate; + } + + // Normalize Time Unit + if (timeUnit) { + fieldDef.timeUnit = normalizeTimeUnit(timeUnit); + } + if (field) { + fieldDef.field = `${field}`; + } + + // Normalize bin + if (isBinning(bin)) { + fieldDef.bin = normalizeBin(bin, channel); + } + if (isBinned(bin) && !isXorY(channel)) { + warn(channelShouldNotBeUsedForBinned(channel)); + } + + // Normalize Type + if (isTypedFieldDef(fieldDef)) { + const { + type + } = fieldDef; + const fullType = getFullName(type); + if (type !== fullType) { + // convert short type to full type + fieldDef.type = fullType; + } + if (type !== 'quantitative') { + if (isCountingAggregateOp(aggregate)) { + warn(invalidFieldTypeForCountAggregate(type, aggregate)); + fieldDef.type = 'quantitative'; + } + } + } else if (!isSecondaryRangeChannel(channel)) { + // If type is empty / invalid, then augment with default type + const newType = defaultType$2(fieldDef, channel); + fieldDef['type'] = newType; + } + if (isTypedFieldDef(fieldDef)) { + const { + compatible, + warning + } = channelCompatibility(fieldDef, channel) || {}; + if (compatible === false) { + warn(warning); + } + } + if (isSortableFieldDef(fieldDef) && vega.isString(fieldDef.sort)) { + const { + sort + } = fieldDef; + if (isSortByChannel(sort)) { + return { + ...fieldDef, + sort: { + encoding: sort + } + }; + } + const sub = sort.substr(1); + if (sort.charAt(0) === '-' && isSortByChannel(sub)) { + return { + ...fieldDef, + sort: { + encoding: sub, + order: 'descending' + } + }; + } + } + if (isFacetFieldDef(fieldDef)) { + const { + header + } = fieldDef; + if (header) { + const { + orient, + ...rest + } = header; + if (orient) { + return { + ...fieldDef, + header: { + ...rest, + labelOrient: header.labelOrient || orient, + titleOrient: header.titleOrient || orient + } + }; + } + } + } + return fieldDef; + } + function normalizeBin(bin, channel) { + if (vega.isBoolean(bin)) { + return { + maxbins: autoMaxBins(channel) + }; + } else if (bin === 'binned') { + return { + binned: true + }; + } else if (!bin.maxbins && !bin.step) { + return { + ...bin, + maxbins: autoMaxBins(channel) + }; + } else { + return bin; + } + } + const COMPATIBLE = { + compatible: true + }; + function channelCompatibility(fieldDef, channel) { + const type = fieldDef.type; + if (type === 'geojson' && channel !== 'shape') { + return { + compatible: false, + warning: `Channel ${channel} should not be used with a geojson data.` + }; + } + switch (channel) { + case ROW: + case COLUMN: + case FACET: + if (!isDiscrete(fieldDef)) { + return { + compatible: false, + warning: channelShouldBeDiscrete(channel) + }; + } + return COMPATIBLE; + case X: + case Y: + case XOFFSET: + case YOFFSET: + case COLOR: + case FILL: + case STROKE: + case TEXT$1: + case DETAIL: + case KEY: + case TOOLTIP: + case HREF: + case URL: + case ANGLE: + case THETA: + case RADIUS: + case DESCRIPTION: + return COMPATIBLE; + case LONGITUDE: + case LONGITUDE2: + case LATITUDE: + case LATITUDE2: + if (type !== QUANTITATIVE) { + return { + compatible: false, + warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.` + }; + } + return COMPATIBLE; + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEWIDTH: + case SIZE: + case THETA2: + case RADIUS2: + case X2: + case Y2: + if (type === 'nominal' && !fieldDef['sort']) { + return { + compatible: false, + warning: `Channel ${channel} should not be used with an unsorted discrete field.` + }; + } + return COMPATIBLE; + case SHAPE: + case STROKEDASH: + if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) { + return { + compatible: false, + warning: channelShouldBeDiscreteOrDiscretizing(channel) + }; + } + return COMPATIBLE; + case ORDER: + if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) { + return { + compatible: false, + warning: `Channel order is inappropriate for nominal field, which has no inherent order.` + }; + } + return COMPATIBLE; + } + } + + /** + * Check if the field def uses a time format or does not use any format but is temporal + * (this does not cover field defs that are temporal but use a number format). + */ + function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) { + const { + formatType + } = getFormatMixins(fieldOrDatumDef); + return formatType === 'time' || !formatType && isTimeFieldDef(fieldOrDatumDef); + } + + /** + * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`. + */ + function isTimeFieldDef(def) { + return def && (def['type'] === 'temporal' || isFieldDef(def) && !!def.timeUnit); + } + + /** + * Getting a value associated with a fielddef. + * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit) + */ + function valueExpr(v, _ref4) { + let { + timeUnit, + type, + wrapTime, + undefinedIfExprNotRequired + } = _ref4; + const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit; + let isTime = unit || type === 'temporal'; + let expr; + if (isExprRef(v)) { + expr = v.expr; + } else if (isSignalRef(v)) { + expr = v.signal; + } else if (isDateTime(v)) { + isTime = true; + expr = dateTimeToExpr(v); + } else if (vega.isString(v) || vega.isNumber(v)) { + if (isTime) { + expr = `datetime(${stringify(v)})`; + if (isLocalSingleTimeUnit(unit)) { + // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit + if (vega.isNumber(v) && v < 10000 || vega.isString(v) && isNaN(Date.parse(v))) { + expr = dateTimeToExpr({ + [unit]: v + }); + } + } + } + } + if (expr) { + return wrapTime && isTime ? `time(${expr})` : expr; + } + // number or boolean or normal string + return undefinedIfExprNotRequired ? undefined : stringify(v); + } + + /** + * Standardize value array -- convert each value to Vega expression if applicable + */ + function valueArray(fieldOrDatumDef, values) { + const { + type + } = fieldOrDatumDef; + return values.map(v => { + const timeUnit = isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined; + const expr = valueExpr(v, { + timeUnit, + type, + undefinedIfExprNotRequired: true + }); + // return signal for the expression if we need an expression + if (expr !== undefined) { + return { + signal: expr + }; + } + // otherwise just return the original value + return v; + }); + } + + /** + * Checks whether a fieldDef for a particular channel requires a computed bin range. + */ + function binRequiresRange(fieldDef, channel) { + if (!isBinning(fieldDef.bin)) { + console.warn('Only call this method for binned field defs.'); + return false; + } + + // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels. + // We could check whether the axis or legend exists (not disabled) but that seems overkill. + return isScaleChannel(channel) && ['ordinal', 'nominal'].includes(fieldDef.type); + } + + const CONDITIONAL_AXIS_PROP_INDEX = { + labelAlign: { + part: 'labels', + vgProp: 'align' + }, + labelBaseline: { + part: 'labels', + vgProp: 'baseline' + }, + labelColor: { + part: 'labels', + vgProp: 'fill' + }, + labelFont: { + part: 'labels', + vgProp: 'font' + }, + labelFontSize: { + part: 'labels', + vgProp: 'fontSize' + }, + labelFontStyle: { + part: 'labels', + vgProp: 'fontStyle' + }, + labelFontWeight: { + part: 'labels', + vgProp: 'fontWeight' + }, + labelOpacity: { + part: 'labels', + vgProp: 'opacity' + }, + labelOffset: null, + labelPadding: null, + // There is no fixed vgProp for tickSize, need to use signal. + gridColor: { + part: 'grid', + vgProp: 'stroke' + }, + gridDash: { + part: 'grid', + vgProp: 'strokeDash' + }, + gridDashOffset: { + part: 'grid', + vgProp: 'strokeDashOffset' + }, + gridOpacity: { + part: 'grid', + vgProp: 'opacity' + }, + gridWidth: { + part: 'grid', + vgProp: 'strokeWidth' + }, + tickColor: { + part: 'ticks', + vgProp: 'stroke' + }, + tickDash: { + part: 'ticks', + vgProp: 'strokeDash' + }, + tickDashOffset: { + part: 'ticks', + vgProp: 'strokeDashOffset' + }, + tickOpacity: { + part: 'ticks', + vgProp: 'opacity' + }, + tickSize: null, + // There is no fixed vgProp for tickSize, need to use signal. + tickWidth: { + part: 'ticks', + vgProp: 'strokeWidth' + } + }; + function isConditionalAxisValue(v) { + return v?.condition; + } + + // Vega axis config is the same as Vega axis base. If this is not the case, add specific type. + + const AXIS_PARTS = ['domain', 'grid', 'labels', 'ticks', 'title']; + + /** + * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes. + */ + const AXIS_PROPERTY_TYPE = { + grid: 'grid', + gridCap: 'grid', + gridColor: 'grid', + gridDash: 'grid', + gridDashOffset: 'grid', + gridOpacity: 'grid', + gridScale: 'grid', + gridWidth: 'grid', + orient: 'main', + bandPosition: 'both', + // Need to be applied to grid axis too, so the grid will align with ticks. + + aria: 'main', + description: 'main', + domain: 'main', + domainCap: 'main', + domainColor: 'main', + domainDash: 'main', + domainDashOffset: 'main', + domainOpacity: 'main', + domainWidth: 'main', + format: 'main', + formatType: 'main', + labelAlign: 'main', + labelAngle: 'main', + labelBaseline: 'main', + labelBound: 'main', + labelColor: 'main', + labelFlush: 'main', + labelFlushOffset: 'main', + labelFont: 'main', + labelFontSize: 'main', + labelFontStyle: 'main', + labelFontWeight: 'main', + labelLimit: 'main', + labelLineHeight: 'main', + labelOffset: 'main', + labelOpacity: 'main', + labelOverlap: 'main', + labelPadding: 'main', + labels: 'main', + labelSeparation: 'main', + maxExtent: 'main', + minExtent: 'main', + offset: 'both', + position: 'main', + tickCap: 'main', + tickColor: 'main', + tickDash: 'main', + tickDashOffset: 'main', + tickMinStep: 'both', + tickOffset: 'both', + // Need to be applied to grid axis too, so the grid will align with ticks. + tickOpacity: 'main', + tickRound: 'both', + // Apply rounding to grid and ticks so they are aligned. + ticks: 'main', + tickSize: 'main', + tickWidth: 'both', + title: 'main', + titleAlign: 'main', + titleAnchor: 'main', + titleAngle: 'main', + titleBaseline: 'main', + titleColor: 'main', + titleFont: 'main', + titleFontSize: 'main', + titleFontStyle: 'main', + titleFontWeight: 'main', + titleLimit: 'main', + titleLineHeight: 'main', + titleOpacity: 'main', + titlePadding: 'main', + titleX: 'main', + titleY: 'main', + encode: 'both', + // we hide this in Vega-Lite + scale: 'both', + tickBand: 'both', + tickCount: 'both', + tickExtra: 'both', + translate: 'both', + values: 'both', + zindex: 'both' // this is actually set afterward, so it doesn't matter + }; + + const COMMON_AXIS_PROPERTIES_INDEX = { + orient: 1, + // other things can depend on orient + + aria: 1, + bandPosition: 1, + description: 1, + domain: 1, + domainCap: 1, + domainColor: 1, + domainDash: 1, + domainDashOffset: 1, + domainOpacity: 1, + domainWidth: 1, + format: 1, + formatType: 1, + grid: 1, + gridCap: 1, + gridColor: 1, + gridDash: 1, + gridDashOffset: 1, + gridOpacity: 1, + gridWidth: 1, + labelAlign: 1, + labelAngle: 1, + labelBaseline: 1, + labelBound: 1, + labelColor: 1, + labelFlush: 1, + labelFlushOffset: 1, + labelFont: 1, + labelFontSize: 1, + labelFontStyle: 1, + labelFontWeight: 1, + labelLimit: 1, + labelLineHeight: 1, + labelOffset: 1, + labelOpacity: 1, + labelOverlap: 1, + labelPadding: 1, + labels: 1, + labelSeparation: 1, + maxExtent: 1, + minExtent: 1, + offset: 1, + position: 1, + tickBand: 1, + tickCap: 1, + tickColor: 1, + tickCount: 1, + tickDash: 1, + tickDashOffset: 1, + tickExtra: 1, + tickMinStep: 1, + tickOffset: 1, + tickOpacity: 1, + tickRound: 1, + ticks: 1, + tickSize: 1, + tickWidth: 1, + title: 1, + titleAlign: 1, + titleAnchor: 1, + titleAngle: 1, + titleBaseline: 1, + titleColor: 1, + titleFont: 1, + titleFontSize: 1, + titleFontStyle: 1, + titleFontWeight: 1, + titleLimit: 1, + titleLineHeight: 1, + titleOpacity: 1, + titlePadding: 1, + titleX: 1, + titleY: 1, + translate: 1, + values: 1, + zindex: 1 + }; + const AXIS_PROPERTIES_INDEX = { + ...COMMON_AXIS_PROPERTIES_INDEX, + style: 1, + labelExpr: 1, + encoding: 1 + }; + function isAxisProperty(prop) { + return !!AXIS_PROPERTIES_INDEX[prop]; + } + const AXIS_CONFIGS_INDEX = { + axis: 1, + axisBand: 1, + axisBottom: 1, + axisDiscrete: 1, + axisLeft: 1, + axisPoint: 1, + axisQuantitative: 1, + axisRight: 1, + axisTemporal: 1, + axisTop: 1, + axisX: 1, + axisXBand: 1, + axisXDiscrete: 1, + axisXPoint: 1, + axisXQuantitative: 1, + axisXTemporal: 1, + axisY: 1, + axisYBand: 1, + axisYDiscrete: 1, + axisYPoint: 1, + axisYQuantitative: 1, + axisYTemporal: 1 + }; + const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX); + + /** + * Base interface for a unit (single-view) specification. + */ + + /** + * A unit specification without any shortcut/expansion syntax. + */ + + /** + * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types). + */ + + /** + * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec). + */ + + function isUnitSpec(spec) { + return 'mark' in spec; + } + + // TODO: replace string with Mark + + class CompositeMarkNormalizer { + constructor(name, run) { + this.name = name; + this.run = run; + } + hasMatchingType(spec) { + if (isUnitSpec(spec)) { + return getMarkType(spec.mark) === this.name; + } + return false; + } + } + + function channelHasField(encoding, channel) { + const channelDef = encoding && encoding[channel]; + if (channelDef) { + if (vega.isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.field); + } else { + return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef); + } + } + return false; + } + function channelHasFieldOrDatum(encoding, channel) { + const channelDef = encoding && encoding[channel]; + if (channelDef) { + if (vega.isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.field); + } else { + return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef); + } + } + return false; + } + function channelHasNestedOffsetScale(encoding, channel) { + if (isXorY(channel)) { + const fieldDef = encoding[channel]; + if ((isFieldDef(fieldDef) || isDatumDef(fieldDef)) && (isDiscrete$1(fieldDef.type) || isFieldDef(fieldDef) && fieldDef.timeUnit)) { + const offsetChannel = getOffsetScaleChannel(channel); + return channelHasFieldOrDatum(encoding, offsetChannel); + } + } + return false; + } + function isAggregate$1(encoding) { + return some(CHANNELS, channel => { + if (channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + if (vega.isArray(channelDef)) { + return some(channelDef, fieldDef => !!fieldDef.aggregate); + } else { + const fieldDef = getFieldDef(channelDef); + return fieldDef && !!fieldDef.aggregate; + } + } + return false; + }); + } + function extractTransformsFromEncoding(oldEncoding, config) { + const groupby = []; + const bins = []; + const timeUnits = []; + const aggregate = []; + const encoding = {}; + forEach(oldEncoding, (channelDef, channel) => { + // Extract potential embedded transformations along with remaining properties + if (isFieldDef(channelDef)) { + const { + field, + aggregate: aggOp, + bin, + timeUnit, + ...remaining + } = channelDef; + if (aggOp || timeUnit || bin) { + const guide = getGuide(channelDef); + const isTitleDefined = guide?.title; + let newField = vgField(channelDef, { + forAs: true + }); + const newFieldDef = { + // Only add title if it doesn't exist + ...(isTitleDefined ? [] : { + title: title(channelDef, config, { + allowDisabling: true + }) + }), + ...remaining, + // Always overwrite field + field: newField + }; + if (aggOp) { + let op; + if (isArgmaxDef(aggOp)) { + op = 'argmax'; + newField = vgField({ + op: 'argmax', + field: aggOp.argmax + }, { + forAs: true + }); + newFieldDef.field = `${newField}.${field}`; + } else if (isArgminDef(aggOp)) { + op = 'argmin'; + newField = vgField({ + op: 'argmin', + field: aggOp.argmin + }, { + forAs: true + }); + newFieldDef.field = `${newField}.${field}`; + } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') { + op = aggOp; + } + if (op) { + const aggregateEntry = { + op, + as: newField + }; + if (field) { + aggregateEntry.field = field; + } + aggregate.push(aggregateEntry); + } + } else { + groupby.push(newField); + if (isTypedFieldDef(channelDef) && isBinning(bin)) { + bins.push({ + bin, + field, + as: newField + }); + // Add additional groupbys for range and end of bins + groupby.push(vgField(channelDef, { + binSuffix: 'end' + })); + if (binRequiresRange(channelDef, channel)) { + groupby.push(vgField(channelDef, { + binSuffix: 'range' + })); + } + // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively + if (isXorY(channel)) { + const secondaryChannel = { + field: `${newField}_end` + }; + encoding[`${channel}2`] = secondaryChannel; + } + newFieldDef.bin = 'binned'; + if (!isSecondaryRangeChannel(channel)) { + newFieldDef['type'] = QUANTITATIVE; + } + } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) { + timeUnits.push({ + timeUnit, + field, + as: newField + }); + + // define the format type for later compilation + const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time'; + if (formatType) { + if (channel === TEXT$1 || channel === TOOLTIP) { + newFieldDef['formatType'] = formatType; + } else if (isNonPositionScaleChannel(channel)) { + newFieldDef['legend'] = { + formatType, + ...newFieldDef['legend'] + }; + } else if (isXorY(channel)) { + newFieldDef['axis'] = { + formatType, + ...newFieldDef['axis'] + }; + } + } + } + } + + // now the field should refer to post-transformed field instead + encoding[channel] = newFieldDef; + } else { + groupby.push(field); + encoding[channel] = oldEncoding[channel]; + } + } else { + // For value def / signal ref / datum def, just copy + encoding[channel] = oldEncoding[channel]; + } + }); + return { + bins, + timeUnits, + aggregate, + groupby, + encoding + }; + } + function markChannelCompatible(encoding, channel, mark) { + const markSupported = supportMark(channel, mark); + if (!markSupported) { + return false; + } else if (markSupported === 'binned') { + const primaryFieldDef = encoding[channel === X2 ? X : Y]; + + // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef + // has "binned" data and thus need x2/y2 to specify the bin-end field. + if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) { + return true; + } else { + return false; + } + } + return true; + } + function initEncoding(encoding, mark, filled, config) { + const normalizedEncoding = {}; + for (const key of keys(encoding)) { + if (!isChannel(key)) { + // Drop invalid channel + warn(invalidEncodingChannel(key)); + } + } + for (let channel of UNIT_CHANNELS) { + if (!encoding[channel]) { + continue; + } + const channelDef = encoding[channel]; + if (isXorYOffset(channel)) { + const mainChannel = getMainChannelFromOffsetChannel(channel); + const positionDef = normalizedEncoding[mainChannel]; + if (isFieldDef(positionDef)) { + if (isContinuous(positionDef.type)) { + if (isFieldDef(channelDef) && !positionDef.timeUnit) { + // TODO: nesting continuous field instead continuous field should + // behave like offsetting the data in data domain + warn(offsetNestedInsideContinuousPositionScaleDropped(mainChannel)); + continue; + } + } + } + } + if (channel === 'angle' && mark === 'arc' && !encoding.theta) { + warn(REPLACE_ANGLE_WITH_THETA); + channel = THETA; + } + if (!markChannelCompatible(encoding, channel, mark)) { + // Drop unsupported channel + warn(incompatibleChannel(channel, mark)); + continue; + } + + // Drop line's size if the field is aggregated. + if (channel === SIZE && mark === 'line') { + const fieldDef = getFieldDef(encoding[channel]); + if (fieldDef?.aggregate) { + warn(LINE_WITH_VARYING_SIZE); + continue; + } + } + // Drop color if either fill or stroke is specified + + if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) { + warn(droppingColor('encoding', { + fill: 'fill' in encoding, + stroke: 'stroke' in encoding + })); + continue; + } + if (channel === DETAIL || channel === ORDER && !vega.isArray(channelDef) && !isValueDef(channelDef) || channel === TOOLTIP && vega.isArray(channelDef)) { + if (channelDef) { + if (channel === ORDER) { + const def = encoding[channel]; + if (isOrderOnlyDef(def)) { + normalizedEncoding[channel] = def; + continue; + } + } + // Array of fieldDefs for detail channel (or production rule) + normalizedEncoding[channel] = vega.array(channelDef).reduce((defs, fieldDef) => { + if (!isFieldDef(fieldDef)) { + warn(emptyFieldDef(fieldDef, channel)); + } else { + defs.push(initFieldDef(fieldDef, channel)); + } + return defs; + }, []); + } + } else { + if (channel === TOOLTIP && channelDef === null) { + // Preserve null so we can use it to disable tooltip + normalizedEncoding[channel] = null; + } else if (!isFieldDef(channelDef) && !isDatumDef(channelDef) && !isValueDef(channelDef) && !isConditionalDef(channelDef) && !isSignalRef(channelDef)) { + warn(emptyFieldDef(channelDef, channel)); + continue; + } + normalizedEncoding[channel] = initChannelDef(channelDef, channel, config); + } + } + return normalizedEncoding; + } + + /** + * For composite marks, we have to call initChannelDef during init so we can infer types earlier. + */ + function normalizeEncoding(encoding, config) { + const normalizedEncoding = {}; + for (const channel of keys(encoding)) { + const newChannelDef = initChannelDef(encoding[channel], channel, config, { + compositeMark: true + }); + normalizedEncoding[channel] = newChannelDef; + } + return normalizedEncoding; + } + function fieldDefs(encoding) { + const arr = []; + for (const channel of keys(encoding)) { + if (channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + const channelDefArray = vega.array(channelDef); + for (const def of channelDefArray) { + if (isFieldDef(def)) { + arr.push(def); + } else if (hasConditionalFieldDef(def)) { + arr.push(def.condition); + } + } + } + } + return arr; + } + function forEach(mapping, f, thisArg) { + if (!mapping) { + return; + } + for (const channel of keys(mapping)) { + const el = mapping[channel]; + if (vega.isArray(el)) { + for (const channelDef of el) { + f.call(thisArg, channelDef, channel); + } + } else { + f.call(thisArg, el, channel); + } + } + } + function reduce(mapping, f, init, thisArg) { + if (!mapping) { + return init; + } + return keys(mapping).reduce((r, channel) => { + const map = mapping[channel]; + if (vega.isArray(map)) { + return map.reduce((r1, channelDef) => { + return f.call(thisArg, r1, channelDef, channel); + }, r); + } else { + return f.call(thisArg, r, map, channel); + } + }, init); + } + + /** + * Returns list of path grouping fields for the given encoding + */ + function pathGroupingFields(mark, encoding) { + return keys(encoding).reduce((details, channel) => { + switch (channel) { + // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group + case X: + case Y: + case HREF: + case DESCRIPTION: + case URL: + case X2: + case Y2: + case XOFFSET: + case YOFFSET: + case THETA: + case THETA2: + case RADIUS: + case RADIUS2: + // falls through + + case LATITUDE: + case LONGITUDE: + case LATITUDE2: + case LONGITUDE2: + // TODO: case 'cursor': + + // text, shape, shouldn't be a part of line/trail/area [falls through] + case TEXT$1: + case SHAPE: + case ANGLE: + // falls through + + // tooltip fields should not be added to group by [falls through] + case TOOLTIP: + return details; + case ORDER: + // order should not group line / trail + if (mark === 'line' || mark === 'trail') { + return details; + } + // but order should group area for stacking (falls through) + + case DETAIL: + case KEY: + { + const channelDef = encoding[channel]; + if (vega.isArray(channelDef) || isFieldDef(channelDef)) { + for (const fieldDef of vega.array(channelDef)) { + if (!fieldDef.aggregate) { + details.push(vgField(fieldDef, {})); + } + } + } + return details; + } + case SIZE: + if (mark === 'trail') { + // For trail, size should not group trail lines. + return details; + } + // For line, size should group lines. + + // falls through + case COLOR: + case FILL: + case STROKE: + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + case STROKEDASH: + case STROKEWIDTH: + { + // TODO strokeDashOffset: + // falls through + + const fieldDef = getFieldDef(encoding[channel]); + if (fieldDef && !fieldDef.aggregate) { + details.push(vgField(fieldDef, {})); + } + return details; + } + } + }, []); + } + + // Parts mixins can be any mark type. We could make a more specific type for each part. + + function filterTooltipWithAggregatedField(oldEncoding) { + const { + tooltip, + ...filteredEncoding + } = oldEncoding; + if (!tooltip) { + return { + filteredEncoding + }; + } + let customTooltipWithAggregatedField; + let customTooltipWithoutAggregatedField; + if (vega.isArray(tooltip)) { + for (const t of tooltip) { + if (t.aggregate) { + if (!customTooltipWithAggregatedField) { + customTooltipWithAggregatedField = []; + } + customTooltipWithAggregatedField.push(t); + } else { + if (!customTooltipWithoutAggregatedField) { + customTooltipWithoutAggregatedField = []; + } + customTooltipWithoutAggregatedField.push(t); + } + } + if (customTooltipWithAggregatedField) { + filteredEncoding.tooltip = customTooltipWithAggregatedField; + } + } else { + if (tooltip['aggregate']) { + filteredEncoding.tooltip = tooltip; + } else { + customTooltipWithoutAggregatedField = tooltip; + } + } + if (vega.isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) { + customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0]; + } + return { + customTooltipWithoutAggregatedField, + filteredEncoding + }; + } + function getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis) { + let withFieldName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : true; + if ('tooltip' in encodingWithoutContinuousAxis) { + return { + tooltip: encodingWithoutContinuousAxis.tooltip + }; + } + const fiveSummaryTooltip = tooltipSummary.map(_ref => { + let { + fieldPrefix, + titlePrefix + } = _ref; + const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : ''; + return { + field: fieldPrefix + continuousAxisChannelDef.field, + type: continuousAxisChannelDef.type, + title: isSignalRef(titlePrefix) ? { + signal: `${titlePrefix}"${escape(mainTitle)}"` + } : titlePrefix + mainTitle + }; + }); + const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef); + return { + tooltip: [...fiveSummaryTooltip, + // need to cast because TextFieldDef supports fewer types of bin + ...unique(tooltipFieldDefs, hash)] + }; + } + function getTitle(continuousAxisChannelDef) { + const { + title, + field + } = continuousAxisChannelDef; + return getFirstDefined(title, field); + } + function makeCompositeAggregatePartFactory(compositeMarkDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, compositeMarkConfig) { + const { + scale, + axis + } = continuousAxisChannelDef; + return _ref2 => { + let { + partName, + mark, + positionPrefix, + endPositionPrefix = undefined, + extraEncoding = {} + } = _ref2; + const title = getTitle(continuousAxisChannelDef); + return partLayerMixins(compositeMarkDef, partName, compositeMarkConfig, { + mark, + // TODO better remove this method and just have mark as a parameter of the method + encoding: { + [continuousAxis]: { + field: `${positionPrefix}_${continuousAxisChannelDef.field}`, + type: continuousAxisChannelDef.type, + ...(title !== undefined ? { + title + } : {}), + ...(scale !== undefined ? { + scale + } : {}), + ...(axis !== undefined ? { + axis + } : {}) + }, + ...(vega.isString(endPositionPrefix) ? { + [`${continuousAxis}2`]: { + field: `${endPositionPrefix}_${continuousAxisChannelDef.field}` + } + } : {}), + ...sharedEncoding, + ...extraEncoding + } + }); + }; + } + function partLayerMixins(markDef, part, compositeMarkConfig, partBaseSpec) { + const { + clip, + color, + opacity + } = markDef; + const mark = markDef.type; + if (markDef[part] || markDef[part] === undefined && compositeMarkConfig[part]) { + return [{ + ...partBaseSpec, + mark: { + ...compositeMarkConfig[part], + ...(clip ? { + clip + } : {}), + ...(color ? { + color + } : {}), + ...(opacity ? { + opacity + } : {}), + ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : { + type: partBaseSpec.mark + }), + style: `${mark}-${String(part)}`, + ...(vega.isBoolean(markDef[part]) ? {} : markDef[part]) + } + }]; + } + return []; + } + function compositeMarkContinuousAxis(spec, orient, compositeMark) { + const { + encoding + } = spec; + const continuousAxis = orient === 'vertical' ? 'y' : 'x'; + const continuousAxisChannelDef = encoding[continuousAxis]; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal. + const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`]; + const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`]; + const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`]; + return { + continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark), + continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark), + continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark), + continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark), + continuousAxis + }; + } + function filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark) { + if (continuousAxisChannelDef?.aggregate) { + const { + aggregate, + ...continuousAxisWithoutAggregate + } = continuousAxisChannelDef; + if (aggregate !== compositeMark) { + warn(errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark)); + } + return continuousAxisWithoutAggregate; + } else { + return continuousAxisChannelDef; + } + } + function compositeMarkOrient(spec, compositeMark) { + const { + mark, + encoding + } = spec; + const { + x, + y + } = encoding; + if (isMarkDef(mark) && mark.orient) { + return mark.orient; + } + if (isContinuousFieldOrDatumDef(x)) { + // x is continuous + if (isContinuousFieldOrDatumDef(y)) { + // both x and y are continuous + const xAggregate = isFieldDef(x) && x.aggregate; + const yAggregate = isFieldDef(y) && y.aggregate; + if (!xAggregate && yAggregate === compositeMark) { + return 'vertical'; + } else if (!yAggregate && xAggregate === compositeMark) { + return 'horizontal'; + } else if (xAggregate === compositeMark && yAggregate === compositeMark) { + throw new Error('Both x and y cannot have aggregate'); + } else { + if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) { + // y is temporal but x is not + return 'horizontal'; + } + + // default orientation for two continuous + return 'vertical'; + } + } + return 'horizontal'; + } else if (isContinuousFieldOrDatumDef(y)) { + // y is continuous but x is not + return 'vertical'; + } else { + // Neither x nor y is continuous. + throw new Error(`Need a valid continuous axis for ${compositeMark}s`); + } + } + + const BOXPLOT = 'boxplot'; + const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks']; + const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot); + function getBoxPlotType(extent) { + if (vega.isNumber(extent)) { + return 'tukey'; + } + // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now. + return extent; + } + function normalizeBoxPlot(spec, _ref) { + let { + config + } = _ref; + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { + mark, + encoding: _encoding, + params, + projection: _p, + ...outerSpec + } = spec; + const markDef = isMarkDef(mark) ? mark : { + type: mark + }; + + // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support + if (params) { + warn(selectionNotSupported('boxplot')); + } + const extent = markDef.extent ?? config.boxplot.extent; + const sizeValue = getMarkPropOrConfig('size', markDef, + // TODO: https://github.com/vega/vega-lite/issues/6245 + config); + const invalid = markDef.invalid; + const boxPlotType = getBoxPlotType(extent); + const { + bins, + timeUnits, + transform, + continuousAxisChannelDef, + continuousAxis, + groupby, + aggregate, + encodingWithoutContinuousAxis, + ticksOrient, + boxOrient, + customTooltipWithoutAggregatedField + } = boxParams(spec, extent, config); + const { + color, + size, + ...encodingWithoutSizeColorAndContinuousAxis + } = encodingWithoutContinuousAxis; + const makeBoxPlotPart = sharedEncoding => { + return makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, sharedEncoding, config.boxplot); + }; + const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis); + const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis); + const makeBoxPlotMidTick = makeBoxPlotPart({ + ...encodingWithoutSizeColorAndContinuousAxis, + ...(size ? { + size + } : {}) + }); + const fiveSummaryTooltipEncoding = getCompositeMarkTooltip([{ + fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', + titlePrefix: 'Max' + }, { + fieldPrefix: 'upper_box_', + titlePrefix: 'Q3' + }, { + fieldPrefix: 'mid_box_', + titlePrefix: 'Median' + }, { + fieldPrefix: 'lower_box_', + titlePrefix: 'Q1' + }, { + fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', + titlePrefix: 'Min' + }], continuousAxisChannelDef, encodingWithoutContinuousAxis); + + // ## Whisker Layers + + const endTick = { + type: 'tick', + color: 'black', + opacity: 1, + orient: ticksOrient, + invalid, + aria: false + }; + const whiskerTooltipEncoding = boxPlotType === 'min-max' ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker + : + // for tukey / k-IQR, just show upper/lower-whisker + getCompositeMarkTooltip([{ + fieldPrefix: 'upper_whisker_', + titlePrefix: 'Upper Whisker' + }, { + fieldPrefix: 'lower_whisker_', + titlePrefix: 'Lower Whisker' + }], continuousAxisChannelDef, encodingWithoutContinuousAxis); + const whiskerLayers = [...makeBoxPlotExtent({ + partName: 'rule', + mark: { + type: 'rule', + invalid, + aria: false + }, + positionPrefix: 'lower_whisker', + endPositionPrefix: 'lower_box', + extraEncoding: whiskerTooltipEncoding + }), ...makeBoxPlotExtent({ + partName: 'rule', + mark: { + type: 'rule', + invalid, + aria: false + }, + positionPrefix: 'upper_box', + endPositionPrefix: 'upper_whisker', + extraEncoding: whiskerTooltipEncoding + }), ...makeBoxPlotExtent({ + partName: 'ticks', + mark: endTick, + positionPrefix: 'lower_whisker', + extraEncoding: whiskerTooltipEncoding + }), ...makeBoxPlotExtent({ + partName: 'ticks', + mark: endTick, + positionPrefix: 'upper_whisker', + extraEncoding: whiskerTooltipEncoding + })]; + + // ## Box Layers + + // TODO: support hiding certain mark parts + const boxLayers = [...(boxPlotType !== 'tukey' ? whiskerLayers : []), ...makeBoxPlotBox({ + partName: 'box', + mark: { + type: 'bar', + ...(sizeValue ? { + size: sizeValue + } : {}), + orient: boxOrient, + invalid, + ariaRoleDescription: 'box' + }, + positionPrefix: 'lower_box', + endPositionPrefix: 'upper_box', + extraEncoding: fiveSummaryTooltipEncoding + }), ...makeBoxPlotMidTick({ + partName: 'median', + mark: { + type: 'tick', + invalid, + ...(vega.isObject(config.boxplot.median) && config.boxplot.median.color ? { + color: config.boxplot.median.color + } : {}), + ...(sizeValue ? { + size: sizeValue + } : {}), + orient: ticksOrient, + aria: false + }, + positionPrefix: 'mid_box', + extraEncoding: fiveSummaryTooltipEncoding + })]; + if (boxPlotType === 'min-max') { + return { + ...outerSpec, + transform: (outerSpec.transform ?? []).concat(transform), + layer: boxLayers + }; + } + + // Tukey Box Plot + + const lowerBoxExpr = `datum["lower_box_${continuousAxisChannelDef.field}"]`; + const upperBoxExpr = `datum["upper_box_${continuousAxisChannelDef.field}"]`; + const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`; + const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`; + const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`; + const fieldExpr = `datum["${continuousAxisChannelDef.field}"]`; + const joinaggregateTransform = { + joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field), + groupby + }; + const filteredWhiskerSpec = { + transform: [{ + filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})` + }, { + aggregate: [{ + op: 'min', + field: continuousAxisChannelDef.field, + as: `lower_whisker_${continuousAxisChannelDef.field}` + }, { + op: 'max', + field: continuousAxisChannelDef.field, + as: `upper_whisker_${continuousAxisChannelDef.field}` + }, + // preserve lower_box / upper_box + { + op: 'min', + field: `lower_box_${continuousAxisChannelDef.field}`, + as: `lower_box_${continuousAxisChannelDef.field}` + }, { + op: 'max', + field: `upper_box_${continuousAxisChannelDef.field}`, + as: `upper_box_${continuousAxisChannelDef.field}` + }, ...aggregate], + groupby + }], + layer: whiskerLayers + }; + const { + tooltip, + ...encodingWithoutSizeColorContinuousAxisAndTooltip + } = encodingWithoutSizeColorAndContinuousAxis; + const { + scale, + axis + } = continuousAxisChannelDef; + const title = getTitle(continuousAxisChannelDef); + const axisWithoutTitle = omit(axis, ['title']); + const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, { + transform: [{ + filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})` + }], + mark: 'point', + encoding: { + [continuousAxis]: { + field: continuousAxisChannelDef.field, + type: continuousAxisChannelDef.type, + ...(title !== undefined ? { + title + } : {}), + ...(scale !== undefined ? { + scale + } : {}), + // add axis without title since we already added the title above + ...(isEmpty(axisWithoutTitle) ? {} : { + axis: axisWithoutTitle + }) + }, + ...encodingWithoutSizeColorContinuousAxisAndTooltip, + ...(color ? { + color + } : {}), + ...(customTooltipWithoutAggregatedField ? { + tooltip: customTooltipWithoutAggregatedField + } : {}) + } + })[0]; + let filteredLayersMixins; + const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform]; + if (outlierLayersMixins) { + filteredLayersMixins = { + transform: filteredLayersMixinsTransforms, + layer: [outlierLayersMixins, filteredWhiskerSpec] + }; + } else { + filteredLayersMixins = filteredWhiskerSpec; + filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms); + } + return { + ...outerSpec, + layer: [filteredLayersMixins, { + // boxplot + transform, + layer: boxLayers + }] + }; + } + function boxParamsQuartiles(continousAxisField) { + return [{ + op: 'q1', + field: continousAxisField, + as: `lower_box_${continousAxisField}` + }, { + op: 'q3', + field: continousAxisField, + as: `upper_box_${continousAxisField}` + }]; + } + function boxParams(spec, extent, config) { + const orient = compositeMarkOrient(spec, BOXPLOT); + const { + continuousAxisChannelDef, + continuousAxis + } = compositeMarkContinuousAxis(spec, orient, BOXPLOT); + const continuousFieldName = continuousAxisChannelDef.field; + const boxPlotType = getBoxPlotType(extent); + const boxplotSpecificAggregate = [...boxParamsQuartiles(continuousFieldName), { + op: 'median', + field: continuousFieldName, + as: `mid_box_${continuousFieldName}` + }, { + op: 'min', + field: continuousFieldName, + as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName + }, { + op: 'max', + field: continuousFieldName, + as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName + }]; + const postAggregateCalculates = boxPlotType === 'min-max' || boxPlotType === 'tukey' ? [] : [ + // This is for the original k-IQR, which we do not expose + { + calculate: `datum["upper_box_${continuousFieldName}"] - datum["lower_box_${continuousFieldName}"]`, + as: `iqr_${continuousFieldName}` + }, { + calculate: `min(datum["upper_box_${continuousFieldName}"] + datum["iqr_${continuousFieldName}"] * ${extent}, datum["max_${continuousFieldName}"])`, + as: `upper_whisker_${continuousFieldName}` + }, { + calculate: `max(datum["lower_box_${continuousFieldName}"] - datum["iqr_${continuousFieldName}"] * ${extent}, datum["min_${continuousFieldName}"])`, + as: `lower_whisker_${continuousFieldName}` + }]; + const { + [continuousAxis]: oldContinuousAxisChannelDef, + ...oldEncodingWithoutContinuousAxis + } = spec.encoding; + const { + customTooltipWithoutAggregatedField, + filteredEncoding + } = filterTooltipWithAggregatedField(oldEncodingWithoutContinuousAxis); + const { + bins, + timeUnits, + aggregate, + groupby, + encoding: encodingWithoutContinuousAxis + } = extractTransformsFromEncoding(filteredEncoding, config); + const ticksOrient = orient === 'vertical' ? 'horizontal' : 'vertical'; + const boxOrient = orient; + const transform = [...bins, ...timeUnits, { + aggregate: [...aggregate, ...boxplotSpecificAggregate], + groupby + }, ...postAggregateCalculates]; + return { + bins, + timeUnits, + transform, + groupby, + aggregate, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + ticksOrient, + boxOrient, + customTooltipWithoutAggregatedField + }; + } + + const ERRORBAR = 'errorbar'; + const ERRORBAR_PARTS = ['ticks', 'rule']; + const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar); + function normalizeErrorBar(spec, _ref) { + let { + config + } = _ref; + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { + transform, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + ticksOrient, + markDef, + outerSpec, + tooltipEncoding + } = errorBarParams(spec, ERRORBAR, config); + delete encodingWithoutContinuousAxis['size']; + const makeErrorBarPart = makeCompositeAggregatePartFactory(markDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorbar); + const thickness = markDef.thickness; + const size = markDef.size; + const tick = { + type: 'tick', + orient: ticksOrient, + aria: false, + ...(thickness !== undefined ? { + thickness + } : {}), + ...(size !== undefined ? { + size + } : {}) + }; + const layer = [...makeErrorBarPart({ + partName: 'ticks', + mark: tick, + positionPrefix: 'lower', + extraEncoding: tooltipEncoding + }), ...makeErrorBarPart({ + partName: 'ticks', + mark: tick, + positionPrefix: 'upper', + extraEncoding: tooltipEncoding + }), ...makeErrorBarPart({ + partName: 'rule', + mark: { + type: 'rule', + ariaRoleDescription: 'errorbar', + ...(thickness !== undefined ? { + size: thickness + } : {}) + }, + positionPrefix: 'lower', + endPositionPrefix: 'upper', + extraEncoding: tooltipEncoding + })]; + return { + ...outerSpec, + transform, + ...(layer.length > 1 ? { + layer + } : { + ...layer[0] + }) + }; + } + function errorBarOrientAndInputType(spec, compositeMark) { + const { + encoding + } = spec; + if (errorBarIsInputTypeRaw(encoding)) { + return { + orient: compositeMarkOrient(spec, compositeMark), + inputType: 'raw' + }; + } + const isTypeAggregatedUpperLower = errorBarIsInputTypeAggregatedUpperLower(encoding); + const isTypeAggregatedError = errorBarIsInputTypeAggregatedError(encoding); + const x = encoding.x; + const y = encoding.y; + if (isTypeAggregatedUpperLower) { + // type is aggregated-upper-lower + + if (isTypeAggregatedError) { + throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`); + } + const x2 = encoding.x2; + const y2 = encoding.y2; + if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) { + // having both x, x2 and y, y2 + throw new Error(`${compositeMark} cannot have both x2 and y2`); + } else if (isFieldOrDatumDef(x2)) { + if (isContinuousFieldOrDatumDef(x)) { + // having x, x2 quantitative and field y, y2 are not specified + return { + orient: 'horizontal', + inputType: 'aggregated-upper-lower' + }; + } else { + // having x, x2 that are not both quantitative + throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`); + } + } else if (isFieldOrDatumDef(y2)) { + // y2 is a FieldDef + if (isContinuousFieldOrDatumDef(y)) { + // having y, y2 quantitative and field x, x2 are not specified + return { + orient: 'vertical', + inputType: 'aggregated-upper-lower' + }; + } else { + // having y, y2 that are not both quantitative + throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`); + } + } + throw new Error('No ranged axis'); + } else { + // type is aggregated-error + + const xError = encoding.xError; + const xError2 = encoding.xError2; + const yError = encoding.yError; + const yError2 = encoding.yError2; + if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) { + // having xError2 without xError + throw new Error(`${compositeMark} cannot have xError2 without xError`); + } + if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) { + // having yError2 without yError + throw new Error(`${compositeMark} cannot have yError2 without yError`); + } + if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) { + // having both xError and yError + throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`); + } else if (isFieldOrDatumDef(xError)) { + if (isContinuousFieldOrDatumDef(x)) { + // having x and xError that are all quantitative + return { + orient: 'horizontal', + inputType: 'aggregated-error' + }; + } else { + // having x, xError, and xError2 that are not all quantitative + throw new Error('All x, xError, and xError2 (if exist) have to be quantitative'); + } + } else if (isFieldOrDatumDef(yError)) { + if (isContinuousFieldOrDatumDef(y)) { + // having y and yError that are all quantitative + return { + orient: 'vertical', + inputType: 'aggregated-error' + }; + } else { + // having y, yError, and yError2 that are not all quantitative + throw new Error('All y, yError, and yError2 (if exist) have to be quantitative'); + } + } + throw new Error('No ranged axis'); + } + } + function errorBarIsInputTypeRaw(encoding) { + return (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) && !isFieldOrDatumDef(encoding.x2) && !isFieldOrDatumDef(encoding.y2) && !isFieldOrDatumDef(encoding.xError) && !isFieldOrDatumDef(encoding.xError2) && !isFieldOrDatumDef(encoding.yError) && !isFieldOrDatumDef(encoding.yError2); + } + function errorBarIsInputTypeAggregatedUpperLower(encoding) { + return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2); + } + function errorBarIsInputTypeAggregatedError(encoding) { + return isFieldOrDatumDef(encoding.xError) || isFieldOrDatumDef(encoding.xError2) || isFieldOrDatumDef(encoding.yError) || isFieldOrDatumDef(encoding.yError2); + } + function errorBarParams(spec, compositeMark, config) { + // TODO: use selection + const { + mark, + encoding, + params, + projection: _p, + ...outerSpec + } = spec; + const markDef = isMarkDef(mark) ? mark : { + type: mark + }; + + // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support + if (params) { + warn(selectionNotSupported(compositeMark)); + } + const { + orient, + inputType + } = errorBarOrientAndInputType(spec, compositeMark); + const { + continuousAxisChannelDef, + continuousAxisChannelDef2, + continuousAxisChannelDefError, + continuousAxisChannelDefError2, + continuousAxis + } = compositeMarkContinuousAxis(spec, orient, compositeMark); + const { + errorBarSpecificAggregate, + postAggregateCalculates, + tooltipSummary, + tooltipTitleWithFieldName + } = errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config); + const { + [continuousAxis]: oldContinuousAxisChannelDef, + [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2, + [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError, + [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2, + ...oldEncodingWithoutContinuousAxis + } = encoding; + const { + bins, + timeUnits, + aggregate: oldAggregate, + groupby: oldGroupBy, + encoding: encodingWithoutContinuousAxis + } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config); + const aggregate = [...oldAggregate, ...errorBarSpecificAggregate]; + const groupby = inputType !== 'raw' ? [] : oldGroupBy; + const tooltipEncoding = getCompositeMarkTooltip(tooltipSummary, continuousAxisChannelDef, encodingWithoutContinuousAxis, tooltipTitleWithFieldName); + return { + transform: [...(outerSpec.transform ?? []), ...bins, ...timeUnits, ...(aggregate.length === 0 ? [] : [{ + aggregate, + groupby + }]), ...postAggregateCalculates], + groupby, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical', + markDef, + outerSpec, + tooltipEncoding + }; + } + function errorBarAggregationAndCalculation(markDef, continuousAxisChannelDef, continuousAxisChannelDef2, continuousAxisChannelDefError, continuousAxisChannelDefError2, inputType, compositeMark, config) { + let errorBarSpecificAggregate = []; + let postAggregateCalculates = []; + const continuousFieldName = continuousAxisChannelDef.field; + let tooltipSummary; + let tooltipTitleWithFieldName = false; + if (inputType === 'raw') { + const center = markDef.center ? markDef.center : markDef.extent ? markDef.extent === 'iqr' ? 'median' : 'mean' : config.errorbar.center; + const extent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr'; + if (center === 'median' !== (extent === 'iqr')) { + warn(errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark)); + } + if (extent === 'stderr' || extent === 'stdev') { + errorBarSpecificAggregate = [{ + op: extent, + field: continuousFieldName, + as: `extent_${continuousFieldName}` + }, { + op: center, + field: continuousFieldName, + as: `center_${continuousFieldName}` + }]; + postAggregateCalculates = [{ + calculate: `datum["center_${continuousFieldName}"] + datum["extent_${continuousFieldName}"]`, + as: `upper_${continuousFieldName}` + }, { + calculate: `datum["center_${continuousFieldName}"] - datum["extent_${continuousFieldName}"]`, + as: `lower_${continuousFieldName}` + }]; + tooltipSummary = [{ + fieldPrefix: 'center_', + titlePrefix: titleCase(center) + }, { + fieldPrefix: 'upper_', + titlePrefix: getTitlePrefix(center, extent, '+') + }, { + fieldPrefix: 'lower_', + titlePrefix: getTitlePrefix(center, extent, '-') + }]; + tooltipTitleWithFieldName = true; + } else { + let centerOp; + let lowerExtentOp; + let upperExtentOp; + if (extent === 'ci') { + centerOp = 'mean'; + lowerExtentOp = 'ci0'; + upperExtentOp = 'ci1'; + } else { + centerOp = 'median'; + lowerExtentOp = 'q1'; + upperExtentOp = 'q3'; + } + errorBarSpecificAggregate = [{ + op: lowerExtentOp, + field: continuousFieldName, + as: `lower_${continuousFieldName}` + }, { + op: upperExtentOp, + field: continuousFieldName, + as: `upper_${continuousFieldName}` + }, { + op: centerOp, + field: continuousFieldName, + as: `center_${continuousFieldName}` + }]; + tooltipSummary = [{ + fieldPrefix: 'upper_', + titlePrefix: title({ + field: continuousFieldName, + aggregate: upperExtentOp, + type: 'quantitative' + }, config, { + allowDisabling: false + }) + }, { + fieldPrefix: 'lower_', + titlePrefix: title({ + field: continuousFieldName, + aggregate: lowerExtentOp, + type: 'quantitative' + }, config, { + allowDisabling: false + }) + }, { + fieldPrefix: 'center_', + titlePrefix: title({ + field: continuousFieldName, + aggregate: centerOp, + type: 'quantitative' + }, config, { + allowDisabling: false + }) + }]; + } + } else { + if (markDef.center || markDef.extent) { + warn(errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent)); + } + if (inputType === 'aggregated-upper-lower') { + tooltipSummary = []; + postAggregateCalculates = [{ + calculate: `datum["${continuousAxisChannelDef2.field}"]`, + as: `upper_${continuousFieldName}` + }, { + calculate: `datum["${continuousFieldName}"]`, + as: `lower_${continuousFieldName}` + }]; + } else if (inputType === 'aggregated-error') { + tooltipSummary = [{ + fieldPrefix: '', + titlePrefix: continuousFieldName + }]; + postAggregateCalculates = [{ + calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError.field}"]`, + as: `upper_${continuousFieldName}` + }]; + if (continuousAxisChannelDefError2) { + postAggregateCalculates.push({ + calculate: `datum["${continuousFieldName}"] + datum["${continuousAxisChannelDefError2.field}"]`, + as: `lower_${continuousFieldName}` + }); + } else { + postAggregateCalculates.push({ + calculate: `datum["${continuousFieldName}"] - datum["${continuousAxisChannelDefError.field}"]`, + as: `lower_${continuousFieldName}` + }); + } + } + for (const postAggregateCalculate of postAggregateCalculates) { + tooltipSummary.push({ + fieldPrefix: postAggregateCalculate.as.substring(0, 6), + titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum["', ''), '"]', '') + }); + } + } + return { + postAggregateCalculates, + errorBarSpecificAggregate, + tooltipSummary, + tooltipTitleWithFieldName + }; + } + function getTitlePrefix(center, extent, operation) { + return `${titleCase(center)} ${operation} ${extent}`; + } + + const ERRORBAND = 'errorband'; + const ERRORBAND_PARTS = ['band', 'borders']; + const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand); + function normalizeErrorBand(spec, _ref) { + let { + config + } = _ref; + // Need to initEncoding first so we can infer type + spec = { + ...spec, + encoding: normalizeEncoding(spec.encoding, config) + }; + const { + transform, + continuousAxisChannelDef, + continuousAxis, + encodingWithoutContinuousAxis, + markDef, + outerSpec, + tooltipEncoding + } = errorBarParams(spec, ERRORBAND, config); + const errorBandDef = markDef; + const makeErrorBandPart = makeCompositeAggregatePartFactory(errorBandDef, continuousAxis, continuousAxisChannelDef, encodingWithoutContinuousAxis, config.errorband); + const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined; + let bandMark = { + type: is2D ? 'area' : 'rect' + }; + let bordersMark = { + type: is2D ? 'line' : 'rule' + }; + const interpolate = { + ...(errorBandDef.interpolate ? { + interpolate: errorBandDef.interpolate + } : {}), + ...(errorBandDef.tension && errorBandDef.interpolate ? { + tension: errorBandDef.tension + } : {}) + }; + if (is2D) { + bandMark = { + ...bandMark, + ...interpolate, + ariaRoleDescription: 'errorband' + }; + bordersMark = { + ...bordersMark, + ...interpolate, + aria: false + }; + } else if (errorBandDef.interpolate) { + warn(errorBand1DNotSupport('interpolate')); + } else if (errorBandDef.tension) { + warn(errorBand1DNotSupport('tension')); + } + return { + ...outerSpec, + transform, + layer: [...makeErrorBandPart({ + partName: 'band', + mark: bandMark, + positionPrefix: 'lower', + endPositionPrefix: 'upper', + extraEncoding: tooltipEncoding + }), ...makeErrorBandPart({ + partName: 'borders', + mark: bordersMark, + positionPrefix: 'lower', + extraEncoding: tooltipEncoding + }), ...makeErrorBandPart({ + partName: 'borders', + mark: bordersMark, + positionPrefix: 'upper', + extraEncoding: tooltipEncoding + })] + }; + } + + /** + * Registry index for all composite mark's normalizer + */ + const compositeMarkRegistry = {}; + function add(mark, run, parts) { + const normalizer = new CompositeMarkNormalizer(mark, run); + compositeMarkRegistry[mark] = { + normalizer, + parts + }; + } + function getAllCompositeMarks() { + return keys(compositeMarkRegistry); + } + add(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS); + add(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS); + add(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS); + + const VL_ONLY_LEGEND_CONFIG = ['gradientHorizontalMaxLength', 'gradientHorizontalMinLength', 'gradientVerticalMaxLength', 'gradientVerticalMinLength', 'unselectedOpacity']; + + const HEADER_TITLE_PROPERTIES_MAP = { + titleAlign: 'align', + titleAnchor: 'anchor', + titleAngle: 'angle', + titleBaseline: 'baseline', + titleColor: 'color', + titleFont: 'font', + titleFontSize: 'fontSize', + titleFontStyle: 'fontStyle', + titleFontWeight: 'fontWeight', + titleLimit: 'limit', + titleLineHeight: 'lineHeight', + titleOrient: 'orient', + titlePadding: 'offset' + }; + const HEADER_LABEL_PROPERTIES_MAP = { + labelAlign: 'align', + labelAnchor: 'anchor', + labelAngle: 'angle', + labelBaseline: 'baseline', + labelColor: 'color', + labelFont: 'font', + labelFontSize: 'fontSize', + labelFontStyle: 'fontStyle', + labelFontWeight: 'fontWeight', + labelLimit: 'limit', + labelLineHeight: 'lineHeight', + labelOrient: 'orient', + labelPadding: 'offset' + }; + const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP); + const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP); + + /** + * Headers of row / column channels for faceted plots. + */ + + const HEADER_CONFIGS_INDEX = { + header: 1, + headerRow: 1, + headerColumn: 1, + headerFacet: 1 + }; + const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX); + + const LEGEND_SCALE_CHANNELS = ['size', 'shape', 'fill', 'stroke', 'strokeDash', 'strokeWidth', 'opacity']; + + /** + * Properties of a legend or boolean flag for determining whether to show it. + */ + + // Change comments to be Vega-Lite specific + + const defaultLegendConfig = { + gradientHorizontalMaxLength: 200, + gradientHorizontalMinLength: 100, + gradientVerticalMaxLength: 200, + gradientVerticalMinLength: 64, + // This is Vega's minimum. + unselectedOpacity: 0.35 + }; + const COMMON_LEGEND_PROPERTY_INDEX = { + aria: 1, + clipHeight: 1, + columnPadding: 1, + columns: 1, + cornerRadius: 1, + description: 1, + direction: 1, + fillColor: 1, + format: 1, + formatType: 1, + gradientLength: 1, + gradientOpacity: 1, + gradientStrokeColor: 1, + gradientStrokeWidth: 1, + gradientThickness: 1, + gridAlign: 1, + labelAlign: 1, + labelBaseline: 1, + labelColor: 1, + labelFont: 1, + labelFontSize: 1, + labelFontStyle: 1, + labelFontWeight: 1, + labelLimit: 1, + labelOffset: 1, + labelOpacity: 1, + labelOverlap: 1, + labelPadding: 1, + labelSeparation: 1, + legendX: 1, + legendY: 1, + offset: 1, + orient: 1, + padding: 1, + rowPadding: 1, + strokeColor: 1, + symbolDash: 1, + symbolDashOffset: 1, + symbolFillColor: 1, + symbolLimit: 1, + symbolOffset: 1, + symbolOpacity: 1, + symbolSize: 1, + symbolStrokeColor: 1, + symbolStrokeWidth: 1, + symbolType: 1, + tickCount: 1, + tickMinStep: 1, + title: 1, + titleAlign: 1, + titleAnchor: 1, + titleBaseline: 1, + titleColor: 1, + titleFont: 1, + titleFontSize: 1, + titleFontStyle: 1, + titleFontWeight: 1, + titleLimit: 1, + titleLineHeight: 1, + titleOpacity: 1, + titleOrient: 1, + titlePadding: 1, + type: 1, + values: 1, + zindex: 1 + }; + + const SELECTION_ID = '_vgsid_'; + + // Similar to BaseMarkConfig but the field documentations are specificly for an interval mark. + + const defaultConfig$1 = { + point: { + on: 'click', + fields: [SELECTION_ID], + toggle: 'event.shiftKey', + resolve: 'global', + clear: 'dblclick' + }, + interval: { + on: '[pointerdown, window:pointerup] > window:pointermove!', + encodings: ['x', 'y'], + translate: '[pointerdown, window:pointerup] > window:pointermove!', + zoom: 'wheel!', + mark: { + fill: '#333', + fillOpacity: 0.125, + stroke: 'white' + }, + resolve: 'global', + clear: 'dblclick' + } + }; + function isLegendBinding(bind) { + return bind === 'legend' || !!bind?.legend; + } + function isLegendStreamBinding(bind) { + return isLegendBinding(bind) && vega.isObject(bind); + } + function isSelectionParameter(param) { + return !!param?.['select']; + } + + function assembleParameterSignals(params) { + const signals = []; + for (const param of params || []) { + // Selection parameters are handled separately via assembleSelectionTopLevelSignals + // and assembleSignals methods registered on the Model. + if (isSelectionParameter(param)) continue; + const { + expr, + bind, + ...rest + } = param; + if (bind && expr) { + // Vega's InitSignal -- apply expr to "init" + const signal = { + ...rest, + bind, + init: expr + }; + signals.push(signal); + } else { + const signal = { + ...rest, + ...(expr ? { + update: expr + } : {}), + ...(bind ? { + bind + } : {}) + }; + signals.push(signal); + } + } + return signals; + } + + /** + * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property. + */ + + /** + * Base interface for a generalized concatenation specification. + */ + + /** + * Base interface for a vertical concatenation specification. + */ + + /** + * Base interface for a horizontal concatenation specification. + */ + + /** A concat spec without any shortcut/expansion syntax */ + + function isAnyConcatSpec(spec) { + return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec); + } + function isConcatSpec(spec) { + return 'concat' in spec; + } + function isVConcatSpec(spec) { + return 'vconcat' in spec; + } + function isHConcatSpec(spec) { + return 'hconcat' in spec; + } + + /** + * Common properties for all types of specification + */ + + function getStepFor(_ref) { + let { + step, + offsetIsDiscrete + } = _ref; + if (offsetIsDiscrete) { + return step.for ?? 'offset'; + } else { + return 'position'; + } + } + function isStep(size) { + return vega.isObject(size) && size['step'] !== undefined; + } + + // TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing. + /** + * Common properties for specifying width and height of unit and layer specifications. + */ + function isFrameMixins(o) { + return o['view'] || o['width'] || o['height']; + } + + /** + * Base layout for FacetSpec and RepeatSpec. + * This is named "GenericComposition" layout as ConcatLayout is a GenericCompositionLayout too + * (but _not_ vice versa). + */ + + const DEFAULT_SPACING = 20; + const COMPOSITION_LAYOUT_INDEX = { + align: 1, + bounds: 1, + center: 1, + columns: 1, + spacing: 1 + }; + const COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX); + function extractCompositionLayout(spec, specType, config) { + const compositionConfig = config[specType]; + const layout = {}; + + // Apply config first + const { + spacing: spacingConfig, + columns + } = compositionConfig; + if (spacingConfig !== undefined) { + layout.spacing = spacingConfig; + } + if (columns !== undefined) { + if (isFacetSpec(spec) && !isFacetMapping(spec.facet) || isConcatSpec(spec)) { + layout.columns = columns; + } + } + if (isVConcatSpec(spec)) { + layout.columns = 1; + } + + // Then copy properties from the spec + for (const prop of COMPOSITION_LAYOUT_PROPERTIES) { + if (spec[prop] !== undefined) { + if (prop === 'spacing') { + const spacing = spec[prop]; + layout[prop] = vega.isNumber(spacing) ? spacing : { + row: spacing.row ?? spacingConfig, + column: spacing.column ?? spacingConfig + }; + } else { + layout[prop] = spec[prop]; + } + } + } + return layout; + } + + function getViewConfigContinuousSize(viewConfig, channel) { + return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility + } + + function getViewConfigDiscreteStep(viewConfig, channel) { + const size = getViewConfigDiscreteSize(viewConfig, channel); + return isStep(size) ? size.step : DEFAULT_STEP; + } + function getViewConfigDiscreteSize(viewConfig, channel) { + const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility + return getFirstDefined(size, { + step: viewConfig.step + }); + } + const DEFAULT_STEP = 20; + const defaultViewConfig = { + continuousWidth: 200, + continuousHeight: 200, + step: DEFAULT_STEP + }; + const defaultConfig = { + background: 'white', + padding: 5, + timeFormat: '%b %d, %Y', + countTitle: 'Count of Records', + view: defaultViewConfig, + mark: defaultMarkConfig, + arc: {}, + area: {}, + bar: defaultBarConfig, + circle: {}, + geoshape: {}, + image: {}, + line: {}, + point: {}, + rect: defaultRectConfig, + rule: { + color: 'black' + }, + // Need this to override default color in mark config + square: {}, + text: { + color: 'black' + }, + // Need this to override default color in mark config + tick: defaultTickConfig, + trail: {}, + boxplot: { + size: 14, + extent: 1.5, + box: {}, + median: { + color: 'white' + }, + outliers: {}, + rule: {}, + ticks: null + }, + errorbar: { + center: 'mean', + rule: true, + ticks: false + }, + errorband: { + band: { + opacity: 0.3 + }, + borders: false + }, + scale: defaultScaleConfig, + projection: {}, + legend: defaultLegendConfig, + header: { + titlePadding: 10, + labelPadding: 10 + }, + headerColumn: {}, + headerRow: {}, + headerFacet: {}, + selection: defaultConfig$1, + style: {}, + title: {}, + facet: { + spacing: DEFAULT_SPACING + }, + concat: { + spacing: DEFAULT_SPACING + }, + normalizedNumberFormat: '.0%' + }; + + // Tableau10 color palette, copied from `vegaScale.scheme('tableau10')` + const tab10 = ['#4c78a8', '#f58518', '#e45756', '#72b7b2', '#54a24b', '#eeca3b', '#b279a2', '#ff9da6', '#9d755d', '#bab0ac']; + const DEFAULT_FONT_SIZE = { + text: 11, + guideLabel: 10, + guideTitle: 11, + groupTitle: 13, + groupSubtitle: 12 + }; + const DEFAULT_COLOR = { + blue: tab10[0], + orange: tab10[1], + red: tab10[2], + teal: tab10[3], + green: tab10[4], + yellow: tab10[5], + purple: tab10[6], + pink: tab10[7], + brown: tab10[8], + gray0: '#000', + gray1: '#111', + gray2: '#222', + gray3: '#333', + gray4: '#444', + gray5: '#555', + gray6: '#666', + gray7: '#777', + gray8: '#888', + gray9: '#999', + gray10: '#aaa', + gray11: '#bbb', + gray12: '#ccc', + gray13: '#ddd', + gray14: '#eee', + gray15: '#fff' + }; + function colorSignalConfig() { + let color = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return { + signals: [{ + name: 'color', + value: vega.isObject(color) ? { + ...DEFAULT_COLOR, + ...color + } : DEFAULT_COLOR + }], + mark: { + color: { + signal: 'color.blue' + } + }, + rule: { + color: { + signal: 'color.gray0' + } + }, + text: { + color: { + signal: 'color.gray0' + } + }, + style: { + 'guide-label': { + fill: { + signal: 'color.gray0' + } + }, + 'guide-title': { + fill: { + signal: 'color.gray0' + } + }, + 'group-title': { + fill: { + signal: 'color.gray0' + } + }, + 'group-subtitle': { + fill: { + signal: 'color.gray0' + } + }, + cell: { + stroke: { + signal: 'color.gray8' + } + } + }, + axis: { + domainColor: { + signal: 'color.gray13' + }, + gridColor: { + signal: 'color.gray8' + }, + tickColor: { + signal: 'color.gray13' + } + }, + range: { + category: [{ + signal: 'color.blue' + }, { + signal: 'color.orange' + }, { + signal: 'color.red' + }, { + signal: 'color.teal' + }, { + signal: 'color.green' + }, { + signal: 'color.yellow' + }, { + signal: 'color.purple' + }, { + signal: 'color.pink' + }, { + signal: 'color.brown' + }, { + signal: 'color.grey8' + }] + } + }; + } + function fontSizeSignalConfig(fontSize) { + return { + signals: [{ + name: 'fontSize', + value: vega.isObject(fontSize) ? { + ...DEFAULT_FONT_SIZE, + ...fontSize + } : DEFAULT_FONT_SIZE + }], + text: { + fontSize: { + signal: 'fontSize.text' + } + }, + style: { + 'guide-label': { + fontSize: { + signal: 'fontSize.guideLabel' + } + }, + 'guide-title': { + fontSize: { + signal: 'fontSize.guideTitle' + } + }, + 'group-title': { + fontSize: { + signal: 'fontSize.groupTitle' + } + }, + 'group-subtitle': { + fontSize: { + signal: 'fontSize.groupSubtitle' + } + } + } + }; + } + function fontConfig(font) { + return { + text: { + font + }, + style: { + 'guide-label': { + font + }, + 'guide-title': { + font + }, + 'group-title': { + font + }, + 'group-subtitle': { + font + } + } + }; + } + function getAxisConfigInternal(axisConfig) { + const props = keys(axisConfig || {}); + const axisConfigInternal = {}; + for (const prop of props) { + const val = axisConfig[prop]; + axisConfigInternal[prop] = isConditionalAxisValue(val) ? signalOrValueRefWithCondition(val) : signalRefOrValue(val); + } + return axisConfigInternal; + } + function getStyleConfigInternal(styleConfig) { + const props = keys(styleConfig); + const styleConfigInternal = {}; + for (const prop of props) { + // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config + styleConfigInternal[prop] = getAxisConfigInternal(styleConfig[prop]); + } + return styleConfigInternal; + } + const configPropsWithExpr = [...MARK_CONFIGS, ...AXIS_CONFIGS, ...HEADER_CONFIGS, 'background', 'padding', 'legend', 'lineBreak', 'scale', 'style', 'title', 'view']; + + /** + * Merge specified config with default config and config for the `color` flag, + * then replace all expressions with signals + */ + function initConfig() { + let specifiedConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + const { + color, + font, + fontSize, + selection, + ...restConfig + } = specifiedConfig; + const mergedConfig = vega.mergeConfig({}, duplicate(defaultConfig), font ? fontConfig(font) : {}, color ? colorSignalConfig(color) : {}, fontSize ? fontSizeSignalConfig(fontSize) : {}, restConfig || {}); + + // mergeConfig doesn't recurse and overrides object values. + if (selection) { + vega.writeConfig(mergedConfig, 'selection', selection, true); + } + const outputConfig = omit(mergedConfig, configPropsWithExpr); + for (const prop of ['background', 'lineBreak', 'padding']) { + if (mergedConfig[prop]) { + outputConfig[prop] = signalRefOrValue(mergedConfig[prop]); + } + } + for (const markConfigType of MARK_CONFIGS) { + if (mergedConfig[markConfigType]) { + // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep + outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]); + } + } + for (const axisConfigType of AXIS_CONFIGS) { + if (mergedConfig[axisConfigType]) { + outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]); + } + } + for (const headerConfigType of HEADER_CONFIGS) { + if (mergedConfig[headerConfigType]) { + outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]); + } + } + if (mergedConfig.legend) { + outputConfig.legend = replaceExprRef(mergedConfig.legend); + } + if (mergedConfig.scale) { + outputConfig.scale = replaceExprRef(mergedConfig.scale); + } + if (mergedConfig.style) { + outputConfig.style = getStyleConfigInternal(mergedConfig.style); + } + if (mergedConfig.title) { + outputConfig.title = replaceExprRef(mergedConfig.title); + } + if (mergedConfig.view) { + outputConfig.view = replaceExprRef(mergedConfig.view); + } + return outputConfig; + } + const MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]); + const VL_ONLY_CONFIG_PROPERTIES = ['color', 'fontSize', 'background', + // We apply background to the spec directly. + 'padding', 'facet', 'concat', 'numberFormat', 'numberFormatType', 'normalizedNumberFormat', 'normalizedNumberFormatType', 'timeFormat', 'countTitle', 'header', 'axisQuantitative', 'axisTemporal', 'axisDiscrete', 'axisPoint', 'axisXBand', 'axisXPoint', 'axisXDiscrete', 'axisXQuantitative', 'axisXTemporal', 'axisYBand', 'axisYPoint', 'axisYDiscrete', 'axisYQuantitative', 'axisYTemporal', 'scale', 'selection', 'overlay' // FIXME: Redesign and unhide this + ]; + + const VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = { + view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'], + ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX + }; + function stripAndRedirectConfig(config) { + config = duplicate(config); + for (const prop of VL_ONLY_CONFIG_PROPERTIES) { + delete config[prop]; + } + if (config.axis) { + // delete condition axis config + for (const prop in config.axis) { + if (isConditionalAxisValue(config.axis[prop])) { + delete config.axis[prop]; + } + } + } + if (config.legend) { + for (const prop of VL_ONLY_LEGEND_CONFIG) { + delete config.legend[prop]; + } + } + + // Remove Vega-Lite only generic mark config + if (config.mark) { + for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { + delete config.mark[prop]; + } + if (config.mark.tooltip && vega.isObject(config.mark.tooltip)) { + delete config.mark.tooltip; + } + } + if (config.params) { + config.signals = (config.signals || []).concat(assembleParameterSignals(config.params)); + delete config.params; + } + for (const markType of MARK_STYLES) { + // Remove Vega-Lite-only mark config + for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) { + delete config[markType][prop]; + } + + // Remove Vega-Lite only mark-specific config + const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType]; + if (vlOnlyMarkSpecificConfigs) { + for (const prop of vlOnlyMarkSpecificConfigs) { + delete config[markType][prop]; + } + } + + // Redirect mark config to config.style so that mark config only affect its own mark type + // without affecting other marks that share the same underlying Vega marks. + // For example, config.rect should not affect bar marks. + redirectConfigToStyleConfig(config, markType); + } + for (const m of getAllCompositeMarks()) { + // Clean up the composite mark config as we don't need them in the output specs anymore + delete config[m]; + } + redirectTitleConfig(config); + + // Remove empty config objects. + for (const prop in config) { + if (vega.isObject(config[prop]) && isEmpty(config[prop])) { + delete config[prop]; + } + } + return isEmpty(config) ? undefined : config; + } + + /** + * + * Redirect config.title -- so that title config do not affect header labels, + * which also uses `title` directive to implement. + * + * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles. + */ + function redirectTitleConfig(config) { + const { + titleMarkConfig, + subtitleMarkConfig, + subtitle + } = extractTitleConfig(config.title); + + // set config.style if title/subtitleMarkConfig is not an empty object + if (!isEmpty(titleMarkConfig)) { + config.style['group-title'] = { + ...config.style['group-title'], + ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega + }; + } + + if (!isEmpty(subtitleMarkConfig)) { + config.style['group-subtitle'] = { + ...config.style['group-subtitle'], + ...subtitleMarkConfig + }; + } + + // subtitle part can stay in config.title since header titles do not use subtitle + if (!isEmpty(subtitle)) { + config.title = subtitle; + } else { + delete config.title; + } + } + function redirectConfigToStyleConfig(config, prop, + // string = composite mark + toProp, compositeMarkPart) { + const propConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop]; + if (prop === 'view') { + toProp = 'cell'; // View's default style is "cell" + } + + const style = { + ...propConfig, + ...config.style[toProp ?? prop] + }; + + // set config.style if it is not an empty object + if (!isEmpty(style)) { + config.style[toProp ?? prop] = style; + } + if (!compositeMarkPart) { + // For composite mark, so don't delete the whole config yet as we have to do multiple redirections. + delete config[prop]; + } + } + + /** + * Base interface for a layer specification. + */ + + /** + * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications. + */ + + /** + * A layered specification without any shortcut/expansion syntax. + */ + + function isLayerSpec(spec) { + return 'layer' in spec; + } + + /** + * Base interface for a repeat specification. + */ + + function isRepeatSpec(spec) { + return 'repeat' in spec; + } + function isLayerRepeatSpec(spec) { + return !vega.isArray(spec.repeat) && spec.repeat['layer']; + } + + class SpecMapper { + map(spec, params) { + if (isFacetSpec(spec)) { + return this.mapFacet(spec, params); + } else if (isRepeatSpec(spec)) { + return this.mapRepeat(spec, params); + } else if (isHConcatSpec(spec)) { + return this.mapHConcat(spec, params); + } else if (isVConcatSpec(spec)) { + return this.mapVConcat(spec, params); + } else if (isConcatSpec(spec)) { + return this.mapConcat(spec, params); + } else { + return this.mapLayerOrUnit(spec, params); + } + } + mapLayerOrUnit(spec, params) { + if (isLayerSpec(spec)) { + return this.mapLayer(spec, params); + } else if (isUnitSpec(spec)) { + return this.mapUnit(spec, params); + } + throw new Error(invalidSpec(spec)); + } + mapLayer(spec, params) { + return { + ...spec, + layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params)) + }; + } + mapHConcat(spec, params) { + return { + ...spec, + hconcat: spec.hconcat.map(subspec => this.map(subspec, params)) + }; + } + mapVConcat(spec, params) { + return { + ...spec, + vconcat: spec.vconcat.map(subspec => this.map(subspec, params)) + }; + } + mapConcat(spec, params) { + const { + concat, + ...rest + } = spec; + return { + ...rest, + concat: concat.map(subspec => this.map(subspec, params)) + }; + } + mapFacet(spec, params) { + return { + // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef + ...spec, + // TODO: remove "any" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760 + spec: this.map(spec.spec, params) + }; + } + mapRepeat(spec, params) { + return { + ...spec, + // as any is required here since TS cannot infer that the output type satisfies the input type + spec: this.map(spec.spec, params) + }; + } + } + + const STACK_OFFSET_INDEX = { + zero: 1, + center: 1, + normalize: 1 + }; + function isStackOffset(s) { + return s in STACK_OFFSET_INDEX; + } + const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]); + const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]); + function isUnbinnedQuantitative(channelDef) { + return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin; + } + function potentialStackedChannel(encoding, x, _ref) { + let { + orient, + type: mark + } = _ref; + const y = x === 'x' ? 'y' : 'radius'; + const isCartesian = x === 'x'; + const xDef = encoding[x]; + const yDef = encoding[y]; + if (isFieldDef(xDef) && isFieldDef(yDef)) { + if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) { + if (xDef.stack) { + return x; + } else if (yDef.stack) { + return y; + } + const xAggregate = isFieldDef(xDef) && !!xDef.aggregate; + const yAggregate = isFieldDef(yDef) && !!yDef.aggregate; + // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y + if (xAggregate !== yAggregate) { + return xAggregate ? x : y; + } + if (isCartesian && ['bar', 'area'].includes(mark)) { + if (orient === 'vertical') { + return y; + } else if (orient === 'horizontal') { + return x; + } + } + } else if (isUnbinnedQuantitative(xDef)) { + return x; + } else if (isUnbinnedQuantitative(yDef)) { + return y; + } + } else if (isUnbinnedQuantitative(xDef)) { + return x; + } else if (isUnbinnedQuantitative(yDef)) { + return y; + } + return undefined; + } + function getDimensionChannel(channel) { + switch (channel) { + case 'x': + return 'y'; + case 'y': + return 'x'; + case 'theta': + return 'radius'; + case 'radius': + return 'theta'; + } + } + function stack(m, encoding) { + const markDef = isMarkDef(m) ? m : { + type: m + }; + const mark = markDef.type; + + // Should have stackable mark + if (!STACKABLE_MARKS.has(mark)) { + return null; + } + + // Run potential stacked twice, one for Cartesian and another for Polar, + // so text marks can be stacked in any of the coordinates. + + // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking. + // However, since we probably never want to do that, let's just note the limitation here. + const fieldChannel = potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef); + if (!fieldChannel) { + return null; + } + const stackedFieldDef = encoding[fieldChannel]; + const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined; + const dimensionChannel = getDimensionChannel(fieldChannel); + const groupbyChannels = []; + const groupbyFields = new Set(); + if (encoding[dimensionChannel]) { + const dimensionDef = encoding[dimensionChannel]; + const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined; + if (dimensionField && dimensionField !== stackedField) { + // avoid grouping by the stacked field + groupbyChannels.push(dimensionChannel); + groupbyFields.add(dimensionField); + } + } + const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset'; + const dimensionOffsetDef = encoding[dimensionOffsetChannel]; + const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined; + if (dimensionOffsetField && dimensionOffsetField !== stackedField) { + // avoid grouping by the stacked field + groupbyChannels.push(dimensionOffsetChannel); + groupbyFields.add(dimensionOffsetField); + } + + // If the dimension has offset, don't stack anymore + + // Should have grouping level of detail that is different from the dimension field + const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => { + // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001) + if (channel !== 'tooltip' && channelHasField(encoding, channel)) { + const channelDef = encoding[channel]; + for (const cDef of vega.array(channelDef)) { + const fieldDef = getFieldDef(cDef); + if (fieldDef.aggregate) { + continue; + } + + // Check whether the channel's field is identical to x/y's field or if the channel is a repeat + const f = vgField(fieldDef, {}); + if ( + // if fielddef is a repeat, just include it in the stack by + !f || + // otherwise, the field must be different from the groupBy fields. + !groupbyFields.has(f)) { + sc.push({ + channel, + fieldDef + }); + } + } + } + return sc; + }, []); + + // Automatically determine offset + let offset; + if (stackedFieldDef.stack !== undefined) { + if (vega.isBoolean(stackedFieldDef.stack)) { + offset = stackedFieldDef.stack ? 'zero' : null; + } else { + offset = stackedFieldDef.stack; + } + } else if (STACK_BY_DEFAULT_MARKS.has(mark)) { + offset = 'zero'; + } + if (!offset || !isStackOffset(offset)) { + return null; + } + if (isAggregate$1(encoding) && stackBy.length === 0) { + return null; + } + + // warn when stacking non-linear + if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) { + if (stackedFieldDef?.stack) { + warn(cannotStackNonLinearScale(stackedFieldDef.scale.type)); + } + return null; + } + + // Check if it is a ranged mark + if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) { + if (stackedFieldDef.stack !== undefined) { + warn(cannotStackRangedMark(fieldChannel)); + } + return null; + } + + // Warn if stacking non-summative aggregate + if (isFieldDef(stackedFieldDef) && stackedFieldDef.aggregate && !SUM_OPS.has(stackedFieldDef.aggregate)) { + warn(stackNonSummativeAggregate(stackedFieldDef.aggregate)); + } + return { + groupbyChannels, + groupbyFields, + fieldChannel, + impute: stackedFieldDef.impute === null ? false : isPathMark(mark), + stackBy, + offset + }; + } + + function initMarkdef(originalMarkDef, encoding, config) { + // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level + const markDef = replaceExprRef(originalMarkDef); + + // set orient, which can be overridden by rules as sometimes the specified orient is invalid. + const specifiedOrient = getMarkPropOrConfig('orient', markDef, config); + markDef.orient = orient(markDef.type, encoding, specifiedOrient); + if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) { + warn(orientOverridden(markDef.orient, specifiedOrient)); + } + if (markDef.type === 'bar' && markDef.orient) { + const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config); + if (cornerRadiusEnd !== undefined) { + const newProps = markDef.orient === 'horizontal' && encoding.x2 || markDef.orient === 'vertical' && encoding.y2 ? ['cornerRadius'] : BAR_CORNER_RADIUS_INDEX[markDef.orient]; + for (const newProp of newProps) { + markDef[newProp] = cornerRadiusEnd; + } + if (markDef.cornerRadiusEnd !== undefined) { + delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius + } + } + } + + // set opacity and filled if not specified in mark config + const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config); + if (specifiedOpacity === undefined) { + markDef.opacity = opacity(markDef.type, encoding); + } + + // set cursor, which should be pointer if href channel is present unless otherwise specified + const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config); + if (specifiedCursor === undefined) { + markDef.cursor = cursor(markDef, encoding, config); + } + return markDef; + } + function cursor(markDef, encoding, config) { + if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) { + return 'pointer'; + } + return markDef.cursor; + } + function opacity(mark, encoding) { + if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) { + // point-based marks + if (!isAggregate$1(encoding)) { + return 0.7; + } + } + return undefined; + } + function defaultFilled(markDef, config, _ref) { + let { + graticule + } = _ref; + if (graticule) { + return false; + } + const filledConfig = getMarkConfig('filled', markDef, config); + const mark = markDef.type; + return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE); + } + function orient(mark, encoding, specifiedOrient) { + switch (mark) { + case POINT: + case CIRCLE: + case SQUARE: + case TEXT: + case RECT: + case IMAGE: + // orient is meaningless for these marks. + return undefined; + } + const { + x, + y, + x2, + y2 + } = encoding; + switch (mark) { + case BAR: + if (isFieldDef(x) && (isBinned(x.bin) || isFieldDef(y) && y.aggregate && !x.aggregate)) { + return 'vertical'; + } + if (isFieldDef(y) && (isBinned(y.bin) || isFieldDef(x) && x.aggregate && !y.aggregate)) { + return 'horizontal'; + } + if (y2 || x2) { + // Ranged bar does not always have clear orientation, so we allow overriding + if (specifiedOrient) { + return specifiedOrient; + } + + // If y is range and x is non-range, non-bin Q + if (!x2) { + if (isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin) || isNumericDataDef(x)) { + if (isFieldDef(y) && isBinned(y.bin)) { + return 'horizontal'; + } + } + return 'vertical'; + } + + // If x is range and y is non-range, non-bin Q + if (!y2) { + if (isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin) || isNumericDataDef(y)) { + if (isFieldDef(x) && isBinned(x.bin)) { + return 'vertical'; + } + } + return 'horizontal'; + } + } + + // falls through + case RULE: + // return undefined for line segment rule and bar with both axis ranged + // we have to ignore the case that the data are already binned + if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) { + return undefined; + } + + // falls through + case AREA: + // If there are range for both x and y, y (vertical) has higher precedence. + if (y2) { + if (isFieldDef(y) && isBinned(y.bin)) { + return 'horizontal'; + } else { + return 'vertical'; + } + } else if (x2) { + if (isFieldDef(x) && isBinned(x.bin)) { + return 'vertical'; + } else { + return 'horizontal'; + } + } else if (mark === RULE) { + if (x && !y) { + return 'vertical'; + } else if (y && !x) { + return 'horizontal'; + } + } + + // falls through + case LINE: + case TICK: + { + const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x); + const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y); + if (specifiedOrient) { + return specifiedOrient; + } else if (xIsMeasure && !yIsMeasure) { + // Tick is opposite to bar, line, area + return mark !== 'tick' ? 'horizontal' : 'vertical'; + } else if (!xIsMeasure && yIsMeasure) { + // Tick is opposite to bar, line, area + return mark !== 'tick' ? 'vertical' : 'horizontal'; + } else if (xIsMeasure && yIsMeasure) { + return 'vertical'; + } else { + const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL; + const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL; + + // x: T, y: N --> vertical tick + if (xIsTemporal && !yIsTemporal) { + return 'vertical'; + } else if (!xIsTemporal && yIsTemporal) { + return 'horizontal'; + } + } + return undefined; + } + } + return 'vertical'; + } + + function dropLineAndPoint(markDef) { + const { + point: _point, + line: _line, + ...mark + } = markDef; + return keys(mark).length > 1 ? mark : mark.type; + } + function dropLineAndPointFromConfig(config) { + for (const mark of ['line', 'area', 'rule', 'trail']) { + if (config[mark]) { + config = { + ...config, + // TODO: remove as any + [mark]: omit(config[mark], ['point', 'line']) + }; + } + } + return config; + } + function getPointOverlay(markDef) { + let markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let encoding = arguments.length > 2 ? arguments[2] : undefined; + if (markDef.point === 'transparent') { + return { + opacity: 0 + }; + } else if (markDef.point) { + // truthy : true or object + return vega.isObject(markDef.point) ? markDef.point : {}; + } else if (markDef.point !== undefined) { + // false or null + return null; + } else { + // undefined (not disabled) + if (markConfig.point || encoding.shape) { + // enable point overlay if config[mark].point is truthy or if encoding.shape is provided + return vega.isObject(markConfig.point) ? markConfig.point : {}; + } + // markDef.point is defined as falsy + return undefined; + } + } + function getLineOverlay(markDef) { + let markConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + if (markDef.line) { + // true or object + return markDef.line === true ? {} : markDef.line; + } else if (markDef.line !== undefined) { + // false or null + return null; + } else { + // undefined (not disabled) + if (markConfig.line) { + // enable line overlay if config[mark].line is truthy + return markConfig.line === true ? {} : markConfig.line; + } + // markDef.point is defined as falsy + return undefined; + } + } + class PathOverlayNormalizer { + constructor() { + _defineProperty(this, "name", 'path-overlay'); + } + hasMatchingType(spec, config) { + if (isUnitSpec(spec)) { + const { + mark, + encoding + } = spec; + const markDef = isMarkDef(mark) ? mark : { + type: mark + }; + switch (markDef.type) { + case 'line': + case 'rule': + case 'trail': + return !!getPointOverlay(markDef, config[markDef.type], encoding); + case 'area': + return ( + // false / null are also included as we want to remove the properties + !!getPointOverlay(markDef, config[markDef.type], encoding) || !!getLineOverlay(markDef, config[markDef.type]) + ); + } + } + return false; + } + run(spec, normParams, normalize) { + const { + config + } = normParams; + const { + params, + projection, + mark, + name, + encoding: e, + ...outerSpec + } = spec; + + // Need to call normalizeEncoding because we need the inferred types to correctly determine stack + const encoding = normalizeEncoding(e, config); + const markDef = isMarkDef(mark) ? mark : { + type: mark + }; + const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding); + const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]); + const layer = [{ + name, + ...(params ? { + params + } : {}), + mark: dropLineAndPoint({ + // TODO: extract this 0.7 to be shared with default opacity for point/tick/... + ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined ? { + opacity: 0.7 + } : {}), + ...markDef + }), + // drop shape from encoding as this might be used to trigger point overlay + encoding: omit(encoding, ['shape']) + }]; + + // FIXME: determine rules for applying selections. + + // Need to copy stack config to overlayed layer + // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase. + const stackProps = stack(initMarkdef(markDef, encoding, config), encoding); + let overlayEncoding = encoding; + if (stackProps) { + const { + fieldChannel: stackFieldChannel, + offset + } = stackProps; + overlayEncoding = { + ...encoding, + [stackFieldChannel]: { + ...encoding[stackFieldChannel], + ...(offset ? { + stack: offset + } : {}) + } + }; + } + + // overlay line layer should be on the edge of area but passing y2/x2 makes + // it as "rule" mark so that it draws unwanted vertical/horizontal lines. + // point overlay also should not have y2/x2 as it does not support. + overlayEncoding = omit(overlayEncoding, ['y2', 'x2']); + if (lineOverlay) { + layer.push({ + ...(projection ? { + projection + } : {}), + mark: { + type: 'line', + ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']), + ...lineOverlay + }, + encoding: overlayEncoding + }); + } + if (pointOverlay) { + layer.push({ + ...(projection ? { + projection + } : {}), + mark: { + type: 'point', + opacity: 1, + filled: true, + ...pick(markDef, ['clip', 'tooltip']), + ...pointOverlay + }, + encoding: overlayEncoding + }); + } + return normalize({ + ...outerSpec, + layer + }, { + ...normParams, + config: dropLineAndPointFromConfig(config) + }); + } + } + + function replaceRepeaterInFacet(facet, repeater) { + if (!repeater) { + return facet; + } + if (isFacetMapping(facet)) { + return replaceRepeaterInMapping(facet, repeater); + } + return replaceRepeaterInFieldDef(facet, repeater); + } + function replaceRepeaterInEncoding(encoding, repeater) { + if (!repeater) { + return encoding; + } + return replaceRepeaterInMapping(encoding, repeater); + } + + /** + * Replaces repeated value and returns if the repeated value is valid. + */ + function replaceRepeatInProp(prop, o, repeater) { + const val = o[prop]; + if (isRepeatRef(val)) { + if (val.repeat in repeater) { + return { + ...o, + [prop]: repeater[val.repeat] + }; + } else { + warn(noSuchRepeatedValue(val.repeat)); + return undefined; + } + } + return o; + } + + /** + * Replace repeater values in a field def with the concrete field name. + */ + + function replaceRepeaterInFieldDef(fieldDef, repeater) { + fieldDef = replaceRepeatInProp('field', fieldDef, repeater); + if (fieldDef === undefined) { + // the field def should be ignored + return undefined; + } else if (fieldDef === null) { + return null; + } + if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) { + const sort = replaceRepeatInProp('field', fieldDef.sort, repeater); + fieldDef = { + ...fieldDef, + ...(sort ? { + sort + } : {}) + }; + } + return fieldDef; + } + function replaceRepeaterInFieldOrDatumDef(def, repeater) { + if (isFieldDef(def)) { + return replaceRepeaterInFieldDef(def, repeater); + } else { + const datumDef = replaceRepeatInProp('datum', def, repeater); + if (datumDef !== def && !datumDef.type) { + datumDef.type = 'nominal'; + } + return datumDef; + } + } + function replaceRepeaterInChannelDef(channelDef, repeater) { + if (isFieldOrDatumDef(channelDef)) { + const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater); + if (fd) { + return fd; + } else if (isConditionalDef(channelDef)) { + return { + condition: channelDef.condition + }; + } + } else { + if (hasConditionalFieldOrDatumDef(channelDef)) { + const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater); + if (fd) { + return { + ...channelDef, + condition: fd + }; + } else { + const { + condition, + ...channelDefWithoutCondition + } = channelDef; + return channelDefWithoutCondition; + } + } + return channelDef; + } + return undefined; + } + function replaceRepeaterInMapping(mapping, repeater) { + const out = {}; + for (const channel in mapping) { + if (vega.hasOwnProperty(mapping, channel)) { + const channelDef = mapping[channel]; + if (vega.isArray(channelDef)) { + // array cannot have condition + out[channel] = channelDef // somehow we need to cast it here + .map(cd => replaceRepeaterInChannelDef(cd, repeater)).filter(cd => cd); + } else { + const cd = replaceRepeaterInChannelDef(channelDef, repeater); + if (cd !== undefined) { + out[channel] = cd; + } + } + } + } + return out; + } + + class RuleForRangedLineNormalizer { + constructor() { + _defineProperty(this, "name", 'RuleForRangedLine'); + } + hasMatchingType(spec) { + if (isUnitSpec(spec)) { + const { + encoding, + mark + } = spec; + if (mark === 'line' || isMarkDef(mark) && mark.type === 'line') { + for (const channel of SECONDARY_RANGE_CHANNEL) { + const mainChannel = getMainRangeChannel(channel); + const mainChannelDef = encoding[mainChannel]; + if (encoding[channel]) { + if (isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin) || isDatumDef(mainChannelDef)) { + return true; + } + } + } + } + } + return false; + } + run(spec, params, normalize) { + const { + encoding, + mark + } = spec; + warn(lineWithRange(!!encoding.x2, !!encoding.y2)); + return normalize({ + ...spec, + mark: vega.isObject(mark) ? { + ...mark, + type: 'rule' + } : 'rule' + }, params); + } + } + + class CoreNormalizer extends SpecMapper { + constructor() { + super(...arguments); + _defineProperty(this, "nonFacetUnitNormalizers", [boxPlotNormalizer, errorBarNormalizer, errorBandNormalizer, new PathOverlayNormalizer(), new RuleForRangedLineNormalizer()]); + } + map(spec, params) { + // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec. + if (isUnitSpec(spec)) { + const hasRow = channelHasField(spec.encoding, ROW); + const hasColumn = channelHasField(spec.encoding, COLUMN); + const hasFacet = channelHasField(spec.encoding, FACET); + if (hasRow || hasColumn || hasFacet) { + return this.mapFacetedUnit(spec, params); + } + } + return super.map(spec, params); + } + + // This is for normalizing non-facet unit + mapUnit(spec, params) { + const { + parentEncoding, + parentProjection + } = params; + const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater); + const specWithReplacedEncoding = { + ...spec, + ...(spec.name ? { + name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') + } : {}), + ...(encoding ? { + encoding + } : {}) + }; + if (parentEncoding || parentProjection) { + return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params); + } + const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this); + for (const unitNormalizer of this.nonFacetUnitNormalizers) { + if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) { + return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit); + } + } + return specWithReplacedEncoding; + } + mapRepeat(spec, params) { + if (isLayerRepeatSpec(spec)) { + return this.mapLayerRepeat(spec, params); + } else { + return this.mapNonLayerRepeat(spec, params); + } + } + mapLayerRepeat(spec, params) { + const { + repeat, + spec: childSpec, + ...rest + } = spec; + const { + row, + column, + layer + } = repeat; + const { + repeater = {}, + repeaterPrefix = '' + } = params; + if (row || column) { + return this.mapRepeat({ + ...spec, + repeat: { + ...(row ? { + row + } : {}), + ...(column ? { + column + } : {}) + }, + spec: { + repeat: { + layer + }, + spec: childSpec + } + }, params); + } else { + return { + ...rest, + layer: layer.map(layerValue => { + const childRepeater = { + ...repeater, + layer: layerValue + }; + const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(layerValue)}`; + const child = this.mapLayerOrUnit(childSpec, { + ...params, + repeater: childRepeater, + repeaterPrefix: childName + }); + child.name = childName; + return child; + }) + }; + } + } + mapNonLayerRepeat(spec, params) { + const { + repeat, + spec: childSpec, + data, + ...remainingProperties + } = spec; + if (!vega.isArray(repeat) && spec.columns) { + // is repeat with row/column + spec = omit(spec, ['columns']); + warn(columnsNotSupportByRowCol('repeat')); + } + const concat = []; + const { + repeater = {}, + repeaterPrefix = '' + } = params; + const row = !vega.isArray(repeat) && repeat.row || [repeater ? repeater.row : null]; + const column = !vega.isArray(repeat) && repeat.column || [repeater ? repeater.column : null]; + const repeatValues = vega.isArray(repeat) && repeat || [repeater ? repeater.repeat : null]; + + // cross product + for (const repeatValue of repeatValues) { + for (const rowValue of row) { + for (const columnValue of column) { + const childRepeater = { + repeat: repeatValue, + row: rowValue, + column: columnValue, + layer: repeater.layer + }; + const childName = (childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix + 'child__' + (vega.isArray(repeat) ? `${varName(repeatValue)}` : (repeat.row ? `row_${varName(rowValue)}` : '') + (repeat.column ? `column_${varName(columnValue)}` : '')); + const child = this.map(childSpec, { + ...params, + repeater: childRepeater, + repeaterPrefix: childName + }); + child.name = childName; + + // we move data up + concat.push(omit(child, ['data'])); + } + } + } + const columns = vega.isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1; + return { + data: childSpec.data ?? data, + // data from child spec should have precedence + align: 'all', + ...remainingProperties, + columns, + concat + }; + } + mapFacet(spec, params) { + const { + facet + } = spec; + if (isFacetMapping(facet) && spec.columns) { + // is facet with row/column + spec = omit(spec, ['columns']); + warn(columnsNotSupportByRowCol('facet')); + } + return super.mapFacet(spec, params); + } + mapUnitWithParentEncodingOrProjection(spec, params) { + const { + encoding, + projection + } = spec; + const { + parentEncoding, + parentProjection, + config + } = params; + const mergedProjection = mergeProjection({ + parentProjection, + projection + }); + const mergedEncoding = mergeEncoding({ + parentEncoding, + encoding: replaceRepeaterInEncoding(encoding, params.repeater) + }); + return this.mapUnit({ + ...spec, + ...(mergedProjection ? { + projection: mergedProjection + } : {}), + ...(mergedEncoding ? { + encoding: mergedEncoding + } : {}) + }, { + config + }); + } + mapFacetedUnit(spec, normParams) { + // New encoding in the inside spec should not contain row / column + // as row/column should be moved to facet + const { + row, + column, + facet, + ...encoding + } = spec.encoding; + + // Mark and encoding should be moved into the inner spec + const { + mark, + width, + projection, + height, + view, + params, + encoding: _, + ...outerSpec + } = spec; + const { + facetMapping, + layout + } = this.getFacetMappingAndLayout({ + row, + column, + facet + }, normParams); + const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater); + return this.mapFacet({ + ...outerSpec, + ...layout, + // row / column has higher precedence than facet + facet: facetMapping, + spec: { + ...(width ? { + width + } : {}), + ...(height ? { + height + } : {}), + ...(view ? { + view + } : {}), + ...(projection ? { + projection + } : {}), + mark, + encoding: newEncoding, + ...(params ? { + params + } : {}) + } + }, normParams); + } + getFacetMappingAndLayout(facets, params) { + const { + row, + column, + facet + } = facets; + if (row || column) { + if (facet) { + warn(facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])])); + } + const facetMapping = {}; + const layout = {}; + for (const channel of [ROW, COLUMN]) { + const def = facets[channel]; + if (def) { + const { + align, + center, + spacing, + columns, + ...defWithoutLayout + } = def; + facetMapping[channel] = defWithoutLayout; + for (const prop of ['align', 'center', 'spacing']) { + if (def[prop] !== undefined) { + layout[prop] ??= {}; + layout[prop][channel] = def[prop]; + } + } + } + } + return { + facetMapping, + layout + }; + } else { + const { + align, + center, + spacing, + columns, + ...facetMapping + } = facet; + return { + facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater), + layout: { + ...(align ? { + align + } : {}), + ...(center ? { + center + } : {}), + ...(spacing ? { + spacing + } : {}), + ...(columns ? { + columns + } : {}) + } + }; + } + } + mapLayer(spec, _ref) { + let { + parentEncoding, + parentProjection, + ...otherParams + } = _ref; + // Special handling for extended layer spec + + const { + encoding, + projection, + ...rest + } = spec; + const params = { + ...otherParams, + parentEncoding: mergeEncoding({ + parentEncoding, + encoding, + layer: true + }), + parentProjection: mergeProjection({ + parentProjection, + projection + }) + }; + return super.mapLayer({ + ...rest, + ...(spec.name ? { + name: [params.repeaterPrefix, spec.name].filter(n => n).join('_') + } : {}) + }, params); + } + } + function mergeEncoding(_ref2) { + let { + parentEncoding, + encoding = {}, + layer + } = _ref2; + let merged = {}; + if (parentEncoding) { + const channels = new Set([...keys(parentEncoding), ...keys(encoding)]); + for (const channel of channels) { + const channelDef = encoding[channel]; + const parentChannelDef = parentEncoding[channel]; + if (isFieldOrDatumDef(channelDef)) { + // Field/Datum Def can inherit properties from its parent + // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one. + const mergedChannelDef = { + ...parentChannelDef, + ...channelDef + }; + merged[channel] = mergedChannelDef; + } else if (hasConditionalFieldOrDatumDef(channelDef)) { + merged[channel] = { + ...channelDef, + condition: { + ...parentChannelDef, + ...channelDef.condition + } + }; + } else if (channelDef || channelDef === null) { + merged[channel] = channelDef; + } else if (layer || isValueDef(parentChannelDef) || isSignalRef(parentChannelDef) || isFieldOrDatumDef(parentChannelDef) || vega.isArray(parentChannelDef)) { + merged[channel] = parentChannelDef; + } + } + } else { + merged = encoding; + } + return !merged || isEmpty(merged) ? undefined : merged; + } + function mergeProjection(opt) { + const { + parentProjection, + projection + } = opt; + if (parentProjection && projection) { + warn(projectionOverridden({ + parentProjection, + projection + })); + } + return projection ?? parentProjection; + } + + function isFilter(t) { + return 'filter' in t; + } + function isImputeSequence(t) { + return t?.['stop'] !== undefined; + } + function isLookup(t) { + return 'lookup' in t; + } + function isLookupData(from) { + return 'data' in from; + } + function isLookupSelection(from) { + return 'param' in from; + } + function isPivot(t) { + return 'pivot' in t; + } + function isDensity(t) { + return 'density' in t; + } + function isQuantile(t) { + return 'quantile' in t; + } + function isRegression(t) { + return 'regression' in t; + } + function isLoess(t) { + return 'loess' in t; + } + function isSample(t) { + return 'sample' in t; + } + function isWindow(t) { + return 'window' in t; + } + function isJoinAggregate(t) { + return 'joinaggregate' in t; + } + function isFlatten(t) { + return 'flatten' in t; + } + function isCalculate(t) { + return 'calculate' in t; + } + function isBin(t) { + return 'bin' in t; + } + function isImpute(t) { + return 'impute' in t; + } + function isTimeUnit(t) { + return 'timeUnit' in t; + } + function isAggregate(t) { + return 'aggregate' in t; + } + function isStack(t) { + return 'stack' in t; + } + function isFold(t) { + return 'fold' in t; + } + function isExtent(t) { + return 'extent' in t && !('density' in t); + } + function normalizeTransform(transform) { + return transform.map(t => { + if (isFilter(t)) { + return { + filter: normalizeLogicalComposition(t.filter, normalizePredicate$1) + }; + } + return t; + }); + } + + class SelectionCompatibilityNormalizer extends SpecMapper { + map(spec, normParams) { + normParams.emptySelections ??= {}; + normParams.selectionPredicates ??= {}; + spec = normalizeTransforms(spec, normParams); + return super.map(spec, normParams); + } + mapLayerOrUnit(spec, normParams) { + spec = normalizeTransforms(spec, normParams); + if (spec.encoding) { + const encoding = {}; + for (const [channel, enc] of entries$1(spec.encoding)) { + encoding[channel] = normalizeChannelDef(enc, normParams); + } + spec = { + ...spec, + encoding + }; + } + return super.mapLayerOrUnit(spec, normParams); + } + mapUnit(spec, normParams) { + const { + selection, + ...rest + } = spec; + if (selection) { + return { + ...rest, + params: entries$1(selection).map(_ref => { + let [name, selDef] = _ref; + const { + init: value, + bind, + empty, + ...select + } = selDef; + if (select.type === 'single') { + select.type = 'point'; + select.toggle = false; + } else if (select.type === 'multi') { + select.type = 'point'; + } + + // Propagate emptiness forwards and backwards + normParams.emptySelections[name] = empty !== 'none'; + for (const pred of vals(normParams.selectionPredicates[name] ?? {})) { + pred.empty = empty !== 'none'; + } + return { + name, + value, + select, + bind + }; + }) + }; + } + return spec; + } + } + function normalizeTransforms(spec, normParams) { + const { + transform: tx, + ...rest + } = spec; + if (tx) { + const transform = tx.map(t => { + if (isFilter(t)) { + return { + filter: normalizePredicate(t, normParams) + }; + } else if (isBin(t) && isBinParams(t.bin)) { + return { + ...t, + bin: normalizeBinExtent(t.bin) + }; + } else if (isLookup(t)) { + const { + selection: param, + ...from + } = t.from; + return param ? { + ...t, + from: { + param, + ...from + } + } : t; + } + return t; + }); + return { + ...rest, + transform + }; + } + return spec; + } + function normalizeChannelDef(obj, normParams) { + const enc = duplicate(obj); + if (isFieldDef(enc) && isBinParams(enc.bin)) { + enc.bin = normalizeBinExtent(enc.bin); + } + if (isScaleFieldDef(enc) && enc.scale?.domain?.selection) { + const { + selection: param, + ...domain + } = enc.scale.domain; + enc.scale.domain = { + ...domain, + ...(param ? { + param + } : {}) + }; + } + if (isConditionalDef(enc)) { + if (vega.isArray(enc.condition)) { + enc.condition = enc.condition.map(c => { + const { + selection, + param, + test, + ...cond + } = c; + return param ? c : { + ...cond, + test: normalizePredicate(c, normParams) + }; + }); + } else { + const { + selection, + param, + test, + ...cond + } = normalizeChannelDef(enc.condition, normParams); + enc.condition = param ? enc.condition : { + ...cond, + test: normalizePredicate(enc.condition, normParams) + }; + } + } + return enc; + } + function normalizeBinExtent(bin) { + const ext = bin.extent; + if (ext?.selection) { + const { + selection: param, + ...rest + } = ext; + return { + ...bin, + extent: { + ...rest, + param + } + }; + } + return bin; + } + function normalizePredicate(op, normParams) { + // Normalize old compositions of selection names (e.g., selection: {and: ["one", "two"]}) + const normalizeSelectionComposition = o => { + return normalizeLogicalComposition(o, param => { + const empty = normParams.emptySelections[param] ?? true; + const pred = { + param, + empty + }; + normParams.selectionPredicates[param] ??= []; + normParams.selectionPredicates[param].push(pred); + return pred; + }); + }; + return op.selection ? normalizeSelectionComposition(op.selection) : normalizeLogicalComposition(op.test || op.filter, o => o.selection ? normalizeSelectionComposition(o.selection) : o); + } + + class TopLevelSelectionsNormalizer extends SpecMapper { + map(spec, normParams) { + const selections = normParams.selections ?? []; + if (spec.params && !isUnitSpec(spec)) { + const params = []; + for (const param of spec.params) { + if (isSelectionParameter(param)) { + selections.push(param); + } else { + params.push(param); + } + } + spec.params = params; + } + normParams.selections = selections; + return super.map(spec, normParams); + } + mapUnit(spec, normParams) { + const selections = normParams.selections; + if (!selections || !selections.length) return spec; + const path = (normParams.path ?? []).concat(spec.name); + const params = []; + for (const selection of selections) { + // By default, apply selections to all unit views. + if (!selection.views || !selection.views.length) { + params.push(selection); + } else { + for (const view of selection.views) { + // view is either a specific unit name, or a partial path through the spec tree. + if (vega.isString(view) && (view === spec.name || path.includes(view)) || vega.isArray(view) && + // logic for backwards compatibility with view paths before we had unique names + // @ts-ignore + view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1]))) { + params.push(selection); + } + } + } + } + if (params.length) spec.params = params; + return spec; + } + } + for (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) { + const proto = TopLevelSelectionsNormalizer.prototype[method]; + TopLevelSelectionsNormalizer.prototype[method] = function (spec, params) { + return proto.call(this, spec, addSpecNameToParams(spec, params)); + }; + } + function addSpecNameToParams(spec, params) { + return spec.name ? { + ...params, + path: (params.path ?? []).concat(spec.name) + } : params; + } + + function normalize(spec, config) { + if (config === undefined) { + config = initConfig(spec.config); + } + const normalizedSpec = normalizeGenericSpec(spec, config); + const { + width, + height + } = spec; + const autosize = normalizeAutoSize(normalizedSpec, { + width, + height, + autosize: spec.autosize + }, config); + return { + ...normalizedSpec, + ...(autosize ? { + autosize + } : {}) + }; + } + const coreNormalizer = new CoreNormalizer(); + const selectionCompatNormalizer = new SelectionCompatibilityNormalizer(); + const topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer(); + + /** + * Decompose extended unit specs into composition of pure unit specs. + * And push top-level selection definitions down to unit specs. + */ + function normalizeGenericSpec(spec) { + let config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const normParams = { + config + }; + return topLevelSelectionNormalizer.map(coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams), normParams); + } + function _normalizeAutoSize(autosize) { + return vega.isString(autosize) ? { + type: autosize + } : autosize ?? {}; + } + + /** + * Normalize autosize and deal with width or height == "container". + */ + function normalizeAutoSize(spec, sizeInfo, config) { + let { + width, + height + } = sizeInfo; + const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec); + const autosizeDefault = {}; + if (!isFitCompatible) { + // If spec is not compatible with autosize == "fit", discard width/height == container + if (width == 'container') { + warn(containerSizeNonSingle('width')); + width = undefined; + } + if (height == 'container') { + warn(containerSizeNonSingle('height')); + height = undefined; + } + } else { + // Default autosize parameters to fit when width/height is "container" + if (width == 'container' && height == 'container') { + autosizeDefault.type = 'fit'; + autosizeDefault.contains = 'padding'; + } else if (width == 'container') { + autosizeDefault.type = 'fit-x'; + autosizeDefault.contains = 'padding'; + } else if (height == 'container') { + autosizeDefault.type = 'fit-y'; + autosizeDefault.contains = 'padding'; + } + } + const autosize = { + type: 'pad', + ...autosizeDefault, + ...(config ? _normalizeAutoSize(config.autosize) : {}), + ..._normalizeAutoSize(spec.autosize) + }; + if (autosize.type === 'fit' && !isFitCompatible) { + warn(FIT_NON_SINGLE); + autosize.type = 'pad'; + } + if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) { + warn(containerSizeNotCompatibleWithAutosize('width')); + } + if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) { + warn(containerSizeNotCompatibleWithAutosize('height')); + } + + // Delete autosize property if it's Vega's default + if (deepEqual(autosize, { + type: 'pad' + })) { + return undefined; + } + return autosize; + } + + /** + * @minimum 0 + */ + + /** + * Shared properties between Top-Level specs and Config + */ + + function isFitType(autoSizeType) { + return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y'; + } + function getFitType(sizeType) { + return sizeType ? `fit-${getPositionScaleChannel(sizeType)}` : 'fit'; + } + const TOP_LEVEL_PROPERTIES = ['background', 'padding' + // We do not include "autosize" here as it is supported by only unit and layer specs and thus need to be normalized + ]; + + function extractTopLevelProperties(t, includeParams) { + const o = {}; + for (const p of TOP_LEVEL_PROPERTIES) { + if (t && t[p] !== undefined) { + o[p] = signalRefOrValue(t[p]); + } + } + if (includeParams) { + o.params = t.params; + } + return o; + } + + /** + * Generic class for storing properties that are explicitly specified + * and implicitly determined by the compiler. + * This is important for scale/axis/legend merging as + * we want to prioritize properties that users explicitly specified. + */ + // eslint-disable-next-line @typescript-eslint/ban-types + class Split { + constructor() { + let explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + this.explicit = explicit; + this.implicit = implicit; + } + clone() { + return new Split(duplicate(this.explicit), duplicate(this.implicit)); + } + combine() { + return { + ...this.explicit, + // Explicit properties comes first + ...this.implicit + }; + } + get(key) { + // Explicit has higher precedence + return getFirstDefined(this.explicit[key], this.implicit[key]); + } + getWithExplicit(key) { + // Explicit has higher precedence + if (this.explicit[key] !== undefined) { + return { + explicit: true, + value: this.explicit[key] + }; + } else if (this.implicit[key] !== undefined) { + return { + explicit: false, + value: this.implicit[key] + }; + } + return { + explicit: false, + value: undefined + }; + } + setWithExplicit(key, _ref) { + let { + value, + explicit + } = _ref; + if (value !== undefined) { + this.set(key, value, explicit); + } + } + set(key, value, explicit) { + delete this[explicit ? 'implicit' : 'explicit'][key]; + this[explicit ? 'explicit' : 'implicit'][key] = value; + return this; + } + copyKeyFromSplit(key, _ref2) { + let { + explicit, + implicit + } = _ref2; + // Explicit has higher precedence + if (explicit[key] !== undefined) { + this.set(key, explicit[key], true); + } else if (implicit[key] !== undefined) { + this.set(key, implicit[key], false); + } + } + copyKeyFromObject(key, s) { + // Explicit has higher precedence + if (s[key] !== undefined) { + this.set(key, s[key], true); + } + } + + /** + * Merge split object into this split object. Properties from the other split + * overwrite properties from this split. + */ + copyAll(other) { + for (const key of keys(other.combine())) { + const val = other.getWithExplicit(key); + this.setWithExplicit(key, val); + } + } + } + function makeExplicit(value) { + return { + explicit: true, + value + }; + } + function makeImplicit(value) { + return { + explicit: false, + value + }; + } + function tieBreakByComparing(compare) { + return (v1, v2, property, propertyOf) => { + const diff = compare(v1.value, v2.value); + if (diff > 0) { + return v1; + } else if (diff < 0) { + return v2; + } + return defaultTieBreaker(v1, v2, property, propertyOf); + }; + } + function defaultTieBreaker(v1, v2, property, propertyOf) { + if (v1.explicit && v2.explicit) { + warn(mergeConflictingProperty(property, propertyOf, v1.value, v2.value)); + } + // If equal score, prefer v1. + return v1; + } + function mergeValuesWithExplicit(v1, v2, property, propertyOf) { + let tieBreaker = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : defaultTieBreaker; + if (v1 === undefined || v1.value === undefined) { + // For first run + return v2; + } + if (v1.explicit && !v2.explicit) { + return v1; + } else if (v2.explicit && !v1.explicit) { + return v2; + } else if (deepEqual(v1.value, v2.value)) { + return v1; + } else { + return tieBreaker(v1, v2, property, propertyOf); + } + } + + /** + * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf) + * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the + * same field again (or differently). + */ + class AncestorParse extends Split { + constructor() { + let explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let parseNothing = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + super(explicit, implicit); + this.explicit = explicit; + this.implicit = implicit; + this.parseNothing = parseNothing; + } + clone() { + const clone = super.clone(); + clone.parseNothing = this.parseNothing; + return clone; + } + } + + /* + * Constants and utilities for data. + */ + + // eslint-disable-next-line @typescript-eslint/ban-types + + function isUrlData(data) { + return 'url' in data; + } + function isInlineData(data) { + return 'values' in data; + } + function isNamedData(data) { + return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data); + } + function isGenerator(data) { + return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data)); + } + function isSequenceGenerator(data) { + return 'sequence' in data; + } + function isSphereGenerator(data) { + return 'sphere' in data; + } + function isGraticuleGenerator(data) { + return 'graticule' in data; + } + let DataSourceType = /*#__PURE__*/function (DataSourceType) { + DataSourceType[DataSourceType["Raw"] = 0] = "Raw"; + DataSourceType[DataSourceType["Main"] = 1] = "Main"; + DataSourceType[DataSourceType["Row"] = 2] = "Row"; + DataSourceType[DataSourceType["Column"] = 3] = "Column"; + DataSourceType[DataSourceType["Lookup"] = 4] = "Lookup"; + return DataSourceType; + }({}); + + function assembleProjection(proj) { + const { + signals, + hasLegend, + index, + ...rest + } = proj; + rest.field = replacePathInField(rest.field); + return rest; + } + function assembleInit(init) { + let isExpr = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; + let wrap = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : vega.identity; + if (vega.isArray(init)) { + const assembled = init.map(v => assembleInit(v, isExpr, wrap)); + return isExpr ? `[${assembled.join(', ')}]` : assembled; + } else if (isDateTime(init)) { + if (isExpr) { + return wrap(dateTimeToExpr(init)); + } else { + return wrap(dateTimeToTimestamp(init)); + } + } + return isExpr ? wrap(stringify(init)) : init; + } + function assembleUnitSelectionSignals(model, signals) { + for (const selCmpt of vals(model.component.selection ?? {})) { + const name = selCmpt.name; + let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`; + for (const c of selectionCompilers) { + if (!c.defined(selCmpt)) continue; + if (c.signals) signals = c.signals(model, selCmpt, signals); + if (c.modifyExpr) modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr); + } + signals.push({ + name: name + MODIFY, + on: [{ + events: { + signal: selCmpt.name + TUPLE + }, + update: `modify(${vega.stringValue(selCmpt.name + STORE)}, ${modifyExpr})` + }] + }); + } + return cleanupEmptyOnArray(signals); + } + function assembleFacetSignals(model, signals) { + if (model.component.selection && keys(model.component.selection).length) { + const name = vega.stringValue(model.getName('cell')); + signals.unshift({ + name: 'facet', + value: {}, + on: [{ + events: vega.parseSelector('pointermove', 'scope'), + update: `isTuple(facet) ? facet : group(${name}).datum` + }] + }); + } + return cleanupEmptyOnArray(signals); + } + function assembleTopLevelSignals(model, signals) { + let hasSelections = false; + for (const selCmpt of vals(model.component.selection ?? {})) { + const name = selCmpt.name; + const store = vega.stringValue(name + STORE); + const hasSg = signals.filter(s => s.name === name); + if (hasSg.length === 0) { + const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve; + const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')'; + signals.push({ + name: selCmpt.name, + update: `${VL_SELECTION_RESOLVE}(${store}, ${vega.stringValue(resolve)}${isPoint}` + }); + } + hasSelections = true; + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.topLevelSignals) { + signals = c.topLevelSignals(model, selCmpt, signals); + } + } + } + if (hasSelections) { + const hasUnit = signals.filter(s => s.name === 'unit'); + if (hasUnit.length === 0) { + signals.unshift({ + name: 'unit', + value: {}, + on: [{ + events: 'pointermove', + update: 'isTuple(group()) ? group() : unit' + }] + }); + } + } + return cleanupEmptyOnArray(signals); + } + function assembleUnitSelectionData(model, data) { + const dataCopy = [...data]; + const unit = unitName(model, { + escape: false + }); + for (const selCmpt of vals(model.component.selection ?? {})) { + const store = { + name: selCmpt.name + STORE + }; + if (selCmpt.project.hasSelectionId) { + store.transform = [{ + type: 'collect', + sort: { + field: SELECTION_ID + } + }]; + } + if (selCmpt.init) { + const fields = selCmpt.project.items.map(assembleProjection); + store.values = selCmpt.project.hasSelectionId ? selCmpt.init.map(i => ({ + unit, + [SELECTION_ID]: assembleInit(i, false)[0] + })) : selCmpt.init.map(i => ({ + unit, + fields, + values: assembleInit(i, false) + })); + } + const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE); + if (!contains.length) { + dataCopy.push(store); + } + } + return dataCopy; + } + function assembleUnitSelectionMarks(model, marks) { + for (const selCmpt of vals(model.component.selection ?? {})) { + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.marks) { + marks = c.marks(model, selCmpt, marks); + } + } + } + return marks; + } + function assembleLayerSelectionMarks(model, marks) { + for (const child of model.children) { + if (isUnitModel(child)) { + marks = assembleUnitSelectionMarks(child, marks); + } + } + return marks; + } + function assembleSelectionScaleDomain(model, extent, scaleCmpt, domain) { + const parsedExtent = parseSelectionExtent(model, extent.param, extent); + return { + signal: hasContinuousDomain(scaleCmpt.get('type')) && vega.isArray(domain) && domain[0] > domain[1] ? `isValid(${parsedExtent}) && reverse(${parsedExtent})` : parsedExtent + }; + } + function cleanupEmptyOnArray(signals) { + return signals.map(s => { + if (s.on && !s.on.length) delete s.on; + return s; + }); + } + + /** + * A node in the dataflow tree. + */ + class DataFlowNode { + constructor(parent, debugName) { + this.debugName = debugName; + _defineProperty(this, "_children", []); + _defineProperty(this, "_parent", null); + _defineProperty(this, "_hash", void 0); + if (parent) { + this.parent = parent; + } + } + + /** + * Clone this node with a deep copy but don't clone links to children or parents. + */ + clone() { + throw new Error('Cannot clone node'); + } + + /** + * Return a hash of the node. + */ + + /** + * Set of fields that this node depends on. + */ + + /** + * Set of fields that are being created by this node. + */ + + get parent() { + return this._parent; + } + + /** + * Set the parent of the node and also add this node to the parent's children. + */ + set parent(parent) { + this._parent = parent; + if (parent) { + parent.addChild(this); + } + } + get children() { + return this._children; + } + numChildren() { + return this._children.length; + } + addChild(child, loc) { + // do not add the same child twice + if (this._children.includes(child)) { + warn(ADD_SAME_CHILD_TWICE); + return; + } + if (loc !== undefined) { + this._children.splice(loc, 0, child); + } else { + this._children.push(child); + } + } + removeChild(oldChild) { + const loc = this._children.indexOf(oldChild); + this._children.splice(loc, 1); + return loc; + } + + /** + * Remove node from the dataflow. + */ + remove() { + let loc = this._parent.removeChild(this); + for (const child of this._children) { + // do not use the set method because we want to insert at a particular location + child._parent = this._parent; + this._parent.addChild(child, loc++); + } + } + + /** + * Insert another node as a parent of this node. + */ + insertAsParentOf(other) { + const parent = other.parent; + parent.removeChild(this); + this.parent = parent; + other.parent = this; + } + swapWithParent() { + const parent = this._parent; + const newParent = parent.parent; + + // reconnect the children + for (const child of this._children) { + child.parent = parent; + } + + // remove old links + this._children = []; // equivalent to removing every child link one by one + parent.removeChild(this); + const loc = parent.parent.removeChild(parent); + + // swap two nodes but maintain order in children + this._parent = newParent; + newParent.addChild(this, loc); + parent.parent = this; + } + } + class OutputNode extends DataFlowNode { + clone() { + const cloneObj = new this.constructor(); + cloneObj.debugName = `clone_${this.debugName}`; + cloneObj._source = this._source; + cloneObj._name = `clone_${this._name}`; + cloneObj.type = this.type; + cloneObj.refCounts = this.refCounts; + cloneObj.refCounts[cloneObj._name] = 0; + return cloneObj; + } + + /** + * @param source The name of the source. Will change in assemble. + * @param type The type of the output node. + * @param refCounts A global ref counter map. + */ + constructor(parent, source, type, refCounts) { + super(parent, source); + this.type = type; + this.refCounts = refCounts; + _defineProperty(this, "_source", void 0); + _defineProperty(this, "_name", void 0); + this._source = this._name = source; + if (this.refCounts && !(this._name in this.refCounts)) { + this.refCounts[this._name] = 0; + } + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set(); + } + hash() { + if (this._hash === undefined) { + this._hash = `Output ${uniqueId()}`; + } + return this._hash; + } + + /** + * Request the datasource name and increase the ref counter. + * + * During the parsing phase, this will return the simple name such as 'main' or 'raw'. + * It is crucial to request the name from an output node to mark it as a required node. + * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase. + * + * In the assemble phase, this will return the correct name. + */ + getSource() { + this.refCounts[this._name]++; + return this._source; + } + isRequired() { + return !!this.refCounts[this._name]; + } + setSource(source) { + this._source = source; + } + } + + function isTimeUnitTransformComponent(timeUnitComponent) { + return timeUnitComponent.as !== undefined; + } + function offsetAs(field) { + return `${field}_end`; + } + class TimeUnitNode extends DataFlowNode { + clone() { + return new TimeUnitNode(null, duplicate(this.timeUnits)); + } + constructor(parent, timeUnits) { + super(parent); + this.timeUnits = timeUnits; + } + static makeFromEncoding(parent, model) { + const formula = model.reduceFieldDef((timeUnitComponent, fieldDef, channel) => { + const { + field, + timeUnit + } = fieldDef; + if (timeUnit) { + let component; + if (isBinnedTimeUnit(timeUnit)) { + // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs "range". + + if (isUnitModel(model)) { + const { + mark, + markDef, + config + } = model; + const bandPosition = getBandPosition({ + fieldDef, + markDef, + config + }); + if (isRectBasedMark(mark) || !!bandPosition) { + component = { + timeUnit: normalizeTimeUnit(timeUnit), + field + }; + } + } + } else { + component = { + as: vgField(fieldDef, { + forAs: true + }), + field, + timeUnit + }; + } + if (isUnitModel(model)) { + const { + mark, + markDef, + config + } = model; + const bandPosition = getBandPosition({ + fieldDef, + markDef, + config + }); + if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) { + component.rectBandPosition = bandPosition; + } + } + if (component) { + timeUnitComponent[hash(component)] = component; + } + } + return timeUnitComponent; + }, {}); + if (isEmpty(formula)) { + return null; + } + return new TimeUnitNode(parent, formula); + } + static makeFromTransform(parent, t) { + const { + timeUnit, + ...other + } = { + ...t + }; + const normalizedTimeUnit = normalizeTimeUnit(timeUnit); + const component = { + ...other, + timeUnit: normalizedTimeUnit + }; + return new TimeUnitNode(parent, { + [hash(component)]: component + }); + } + + /** + * Merge together TimeUnitNodes assigning the children of `other` to `this` + * and removing `other`. + */ + merge(other) { + this.timeUnits = { + ...this.timeUnits + }; + + // if the same hash happen twice, merge + for (const key in other.timeUnits) { + if (!this.timeUnits[key]) { + // copy if it's not a duplicate + this.timeUnits[key] = other.timeUnits[key]; + } + } + for (const child of other.children) { + other.removeChild(child); + child.parent = this; + } + other.remove(); + } + + /** + * Remove time units coming from the other node. + */ + removeFormulas(fields) { + const newFormula = {}; + for (const [key, timeUnitComponent] of entries$1(this.timeUnits)) { + const fieldAs = isTimeUnitTransformComponent(timeUnitComponent) ? timeUnitComponent.as : `${timeUnitComponent.field}_end`; + if (!fields.has(fieldAs)) { + newFormula[key] = timeUnitComponent; + } + } + this.timeUnits = newFormula; + } + producedFields() { + return new Set(vals(this.timeUnits).map(f => { + return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field); + })); + } + dependentFields() { + return new Set(vals(this.timeUnits).map(f => f.field)); + } + hash() { + return `TimeUnit ${hash(this.timeUnits)}`; + } + assemble() { + const transforms = []; + for (const f of vals(this.timeUnits)) { + const { + rectBandPosition + } = f; + const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit); + if (isTimeUnitTransformComponent(f)) { + const { + field, + as + } = f; + const { + unit, + utc, + ...params + } = normalizedTimeUnit; + const startEnd = [as, `${as}_end`]; + transforms.push({ + field: replacePathInField(field), + type: 'timeunit', + ...(unit ? { + units: getTimeUnitParts(unit) + } : {}), + ...(utc ? { + timezone: 'utc' + } : {}), + ...params, + as: startEnd + }); + transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit)); + } else if (f) { + const { + field: escapedField + } = f; + // since this is a expression, we want the unescaped field name + const field = escapedField.replaceAll('\\.', '.'); + const expr = offsetExpr({ + timeUnit: normalizedTimeUnit, + field + }); + const endAs = offsetAs(field); + transforms.push({ + type: 'formula', + expr, + as: endAs + }); + transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit)); + } + } + return transforms; + } + } + const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start'; + const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end'; + function offsetExpr(_ref) { + let { + timeUnit, + field, + reverse + } = _ref; + const { + unit, + utc + } = timeUnit; + const smallestUnit = getSmallestTimeUnitPart(unit); + const { + part, + step + } = getDateTimePartAndStep(smallestUnit, timeUnit.step); + const offsetFn = utc ? 'utcOffset' : 'timeOffset'; + const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`; + return expr; + } + function offsetedRectFormulas(_ref2, rectBandPosition, timeUnit) { + let [startField, endField] = _ref2; + if (rectBandPosition !== undefined && rectBandPosition !== 0.5) { + const startExpr = `datum['${startField}']`; + const endExpr = `datum['${endField}']`; + return [{ + type: 'formula', + expr: interpolateExpr([offsetExpr({ + timeUnit, + field: startField, + reverse: true + }), startExpr], rectBandPosition + 0.5), + as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}` + }, { + type: 'formula', + expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5), + as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}` + }]; + } + return []; + } + function interpolateExpr(_ref3, fraction) { + let [start, end] = _ref3; + return `${1 - fraction} * ${start} + ${fraction} * ${end}`; + } + + const TUPLE_FIELDS = '_tuple_fields'; + + /** + * Whether the selection tuples hold enumerated or ranged values for a field. + */ + + class SelectionProjectionComponent { + constructor() { + _defineProperty(this, "hasChannel", void 0); + _defineProperty(this, "hasField", void 0); + _defineProperty(this, "hasSelectionId", void 0); + _defineProperty(this, "timeUnit", void 0); + _defineProperty(this, "items", void 0); + for (var _len = arguments.length, items = new Array(_len), _key = 0; _key < _len; _key++) { + items[_key] = arguments[_key]; + } + this.items = items; + this.hasChannel = {}; + this.hasField = {}; + this.hasSelectionId = false; + } + } + const project = { + defined: () => { + return true; // This transform handles its own defaults, so always run parse. + }, + + parse: (model, selCmpt, selDef) => { + const name = selCmpt.name; + const proj = selCmpt.project ??= new SelectionProjectionComponent(); + const parsed = {}; + const timeUnits = {}; + const signals = new Set(); + const signalName = (p, range) => { + const suffix = range === 'visual' ? p.channel : p.field; + let sg = varName(`${name}_${suffix}`); + for (let counter = 1; signals.has(sg); counter++) { + sg = varName(`${name}_${suffix}_${counter}`); + } + signals.add(sg); + return { + [range]: sg + }; + }; + const type = selCmpt.type; + const cfg = model.config.selection[type]; + const init = selDef.value !== undefined ? vega.array(selDef.value) : null; + + // If no explicit projection (either fields or encodings) is specified, set some defaults. + // If an initial value is set, try to infer projections. + let { + fields, + encodings + } = vega.isObject(selDef.select) ? selDef.select : {}; + if (!fields && !encodings && init) { + for (const initVal of init) { + // initVal may be a scalar value to smoothen varParam -> pointSelection gradient. + if (!vega.isObject(initVal)) { + continue; + } + for (const key of keys(initVal)) { + if (isSingleDefUnitChannel(key)) { + (encodings || (encodings = [])).push(key); + } else { + if (type === 'interval') { + warn(INTERVAL_INITIALIZED_WITH_POS); + encodings = cfg.encodings; + } else { + (fields ??= []).push(key); + } + } + } + } + } + + // If no initial value is specified, use the default configuration. + // We break this out as a separate if block (instead of an else condition) + // to account for unprojected point selections that have scalar initial values + if (!fields && !encodings) { + encodings = cfg.encodings; + if ('fields' in cfg) { + fields = cfg.fields; + } + } + for (const channel of encodings ?? []) { + const fieldDef = model.fieldDef(channel); + if (fieldDef) { + let field = fieldDef.field; + if (fieldDef.aggregate) { + warn(cannotProjectAggregate(channel, fieldDef.aggregate)); + continue; + } else if (!field) { + warn(cannotProjectOnChannelWithoutField(channel)); + continue; + } + if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) { + field = model.vgField(channel); + // Construct TimeUnitComponents which will be combined into a + // TimeUnitNode. This node may need to be inserted into the + // dataflow if the selection is used across views that do not + // have these time units defined. + const component = { + timeUnit: fieldDef.timeUnit, + as: field, + field: fieldDef.field + }; + timeUnits[hash(component)] = component; + } + + // Prevent duplicate projections on the same field. + // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag). + if (!parsed[field]) { + // Determine whether the tuple will store enumerated or ranged values. + // Interval selections store ranges for continuous scales, and enumerations otherwise. + // Single/multi selections store ranges for binned fields, and enumerations otherwise. + const tplType = type === 'interval' && isScaleChannel(channel) && hasContinuousDomain(model.getScaleComponent(channel).get('type')) ? 'R' : fieldDef.bin ? 'R-RE' : 'E'; + const p = { + field, + channel, + type: tplType, + index: proj.items.length + }; + p.signals = { + ...signalName(p, 'data'), + ...signalName(p, 'visual') + }; + proj.items.push(parsed[field] = p); + proj.hasField[field] = parsed[field]; + proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID; + if (isGeoPositionChannel(channel)) { + p.geoChannel = channel; + p.channel = getPositionChannelFromLatLong(channel); + proj.hasChannel[p.channel] = parsed[field]; + } else { + proj.hasChannel[channel] = parsed[field]; + } + } + } else { + warn(cannotProjectOnChannelWithoutField(channel)); + } + } + for (const field of fields ?? []) { + if (proj.hasField[field]) continue; + const p = { + type: 'E', + field, + index: proj.items.length + }; + p.signals = { + ...signalName(p, 'data') + }; + proj.items.push(p); + proj.hasField[field] = p; + proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID; + } + if (init) { + selCmpt.init = init.map(v => { + // Selections can be initialized either with a full object that maps projections to values + // or scalar values to smoothen the abstraction gradient from variable params to point selections. + return proj.items.map(p => vega.isObject(v) ? v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field] : v); + }); + } + if (!isEmpty(timeUnits)) { + proj.timeUnit = new TimeUnitNode(null, timeUnits); + } + }, + signals: (model, selCmpt, allSignals) => { + const name = selCmpt.name + TUPLE_FIELDS; + const hasSignal = allSignals.filter(s => s.name === name); + return hasSignal.length > 0 || selCmpt.project.hasSelectionId ? allSignals : allSignals.concat({ + name, + value: selCmpt.project.items.map(assembleProjection) + }); + } + }; + + const scaleBindings = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales'; + }, + parse: (model, selCmpt) => { + const bound = selCmpt.scales = []; + for (const proj of selCmpt.project.items) { + const channel = proj.channel; + if (!isScaleChannel(channel)) { + continue; + } + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + if (!scale || !hasContinuousDomain(scaleType)) { + warn(SCALE_BINDINGS_CONTINUOUS); + continue; + } + scale.set('selectionExtent', { + param: selCmpt.name, + field: proj.field + }, true); + bound.push(proj); + } + }, + topLevelSignals: (model, selCmpt, signals) => { + const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0); + + // Top-level signals are only needed for multiview displays and if this + // view's top-level signals haven't already been generated. + if (!model.parent || isTopLevelLayer(model) || bound.length === 0) { + return signals; + } + + // vlSelectionResolve does not account for the behavior of bound scales in + // multiview displays. Each unit view adds a tuple to the store, but the + // state of the selection is the unit selection most recently updated. This + // state is captured by the top-level signals that we insert and "push + // outer" to from within the units. We need to reassemble this state into + // the top-level named signal, except no single selCmpt has a global view. + const namedSg = signals.filter(s => s.name === selCmpt.name)[0]; + let update = namedSg.update; + if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) { + namedSg.update = `{${bound.map(proj => `${vega.stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`).join(', ')}}`; + } else { + for (const proj of bound) { + const mapping = `${vega.stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`; + if (!update.includes(mapping)) { + update = `${update.substring(0, update.length - 1)}, ${mapping}}`; + } + } + namedSg.update = update; + } + return signals.concat(bound.map(proj => ({ + name: proj.signals.data + }))); + }, + signals: (model, selCmpt, signals) => { + // Nested signals need only push to top-level signals with multiview displays. + if (model.parent && !isTopLevelLayer(model)) { + for (const proj of selCmpt.scales) { + const signal = signals.filter(s => s.name === proj.signals.data)[0]; + signal.push = 'outer'; + delete signal.value; + delete signal.update; + } + } + return signals; + } + }; + function domain(model, channel) { + const scale = vega.stringValue(model.scaleName(channel)); + return `domain(${scale})`; + } + function isTopLevelLayer(model) { + return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent)); + } + + const BRUSH = '_brush'; + const SCALE_TRIGGER = '_scale_trigger'; + const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481 + const INIT = '_init'; + const CENTER = '_center'; + + // Separate type because the "fields" property is only used internally and we don't want to leak it to the schema. + + const interval = { + defined: selCmpt => selCmpt.type === 'interval', + parse: (model, selCmpt, selDef) => { + if (model.hasProjection) { + const def = { + ...(vega.isObject(selDef.select) ? selDef.select : {}) + }; + def.fields = [SELECTION_ID]; + if (!def.encodings) { + // Remap default x/y projection + def.encodings = selDef.value ? keys(selDef.value) : [LONGITUDE, LATITUDE]; + } + selDef.select = { + type: 'interval', + ...def + }; + } + if (selCmpt.translate && !scaleBindings.defined(selCmpt)) { + const filterExpr = `!event.item || event.item.mark.name !== ${vega.stringValue(selCmpt.name + BRUSH)}`; + for (const evt of selCmpt.events) { + if (!evt.between) { + warn(`${evt} is not an ordered event stream for interval selections.`); + continue; + } + const filters = vega.array(evt.between[0].filter ??= []); + if (filters.indexOf(filterExpr) < 0) { + filters.push(filterExpr); + } + } + } + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const tupleSg = name + TUPLE; + const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y); + const init = selCmpt.init ? selCmpt.init[0] : null; + signals.push(...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), [])); + if (!model.hasProjection) { + // Proxy scale reactions to ensure that an infinite loop doesn't occur + // when an interval selection filter touches the scale. + if (!scaleBindings.defined(selCmpt)) { + const triggerSg = name + SCALE_TRIGGER; + const scaleTriggers = channels.map(proj => { + const channel = proj.channel; + const { + data: dname, + visual: vname + } = proj.signals; + const scaleName = vega.stringValue(model.scaleName(channel)); + const scaleType = model.getScaleComponent(channel).get('type'); + const toNum = hasContinuousDomain(scaleType) ? '+' : ''; + return `(!isArray(${dname}) || ` + `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` + `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`; + }); + if (scaleTriggers.length) { + signals.push({ + name: triggerSg, + value: {}, + on: [{ + events: channels.map(proj => ({ + scale: model.scaleName(proj.channel) + })), + update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}` + }] + }); + } + } + + // Only add an interval to the store if it has valid data extents. Data extents + // are set to null if pixel extents are equal to account for intervals over + // ordinal/nominal domains which, when inverted, will still produce a valid datum. + const dataSignals = channels.map(proj => proj.signals.data); + const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`; + return signals.concat({ + name: tupleSg, + ...(init ? { + init: `{${update}: ${assembleInit(init)}}` + } : {}), + ...(dataSignals.length ? { + on: [{ + events: [{ + signal: dataSignals.join(' || ') + }], + // Prevents double invocation, see https://github.com/vega/vega/issues/1672. + update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null` + }] + } : {}) + }); + } else { + const projection = vega.stringValue(model.projectionName()); + const centerSg = model.projectionName() + CENTER; + const { + x, + y + } = selCmpt.project.hasChannel; + const xvname = x && x.signals.visual; + const yvname = y && y.signals.visual; + const xinit = x ? init && init[x.index] : `${centerSg}[0]`; + const yinit = y ? init && init[y.index] : `${centerSg}[1]`; + const sizeSg = layout => model.getSizeSignalRef(layout).signal; + const bbox = `[` + `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` + `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` + `${yvname ? yvname + '[1]' : sizeSg('height')}]` + `]`; + if (init) { + signals.unshift({ + name: name + INIT, + init: `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` + `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]` + }); + if (!x || !y) { + // If initializing a uni-dimensional brush, use the center of the view to determine the other coord + const hasCenterSg = signals.find(s => s.name === centerSg); + if (!hasCenterSg) { + signals.unshift({ + name: centerSg, + update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])` + }); + } + } + } + const intersect = `intersect(${bbox}, {markname: ${vega.stringValue(model.getName('marks'))}}, unit.mark)`; + const base = `{unit: ${unitName(model)}}`; + const update = `vlSelectionTuples(${intersect}, ${base})`; + const visualSignals = channels.map(proj => proj.signals.visual); + return signals.concat({ + name: tupleSg, + on: [{ + events: [...(visualSignals.length ? [{ + signal: visualSignals.join(' || ') + }] : []), ...(init ? [{ + signal: GEO_INIT_TICK + }] : [])], + update + }] + }); + } + }, + topLevelSignals: (model, selCmpt, signals) => { + if (isUnitModel(model) && model.hasProjection && selCmpt.init) { + // Workaround for https://github.com/vega/vega/issues/3481 + // The scenegraph isn't populated on the first pulse. So we use a timer signal + // to re-pulse the dataflow as soon as possible. We return an object to ensure + // this only occurs once. + const hasTick = signals.filter(s => s.name === GEO_INIT_TICK); + if (!hasTick.length) { + signals.unshift({ + name: GEO_INIT_TICK, + value: null, + on: [{ + events: 'timer{1}', + update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}` + }] + }); + } + } + return signals; + }, + marks: (model, selCmpt, marks) => { + const name = selCmpt.name; + const { + x, + y + } = selCmpt.project.hasChannel; + const xvname = x?.signals.visual; + const yvname = y?.signals.visual; + const store = `data(${vega.stringValue(selCmpt.name + STORE)})`; + + // Do not add a brush if we're binding to scales + // or we don't have a valid interval projection + if (scaleBindings.defined(selCmpt) || !x && !y) { + return marks; + } + const update = { + x: x !== undefined ? { + signal: `${xvname}[0]` + } : { + value: 0 + }, + y: y !== undefined ? { + signal: `${yvname}[0]` + } : { + value: 0 + }, + x2: x !== undefined ? { + signal: `${xvname}[1]` + } : { + field: { + group: 'width' + } + }, + y2: y !== undefined ? { + signal: `${yvname}[1]` + } : { + field: { + group: 'height' + } + } + }; + + // If the selection is resolved to global, only a single interval is in + // the store. Wrap brush mark's encodings with a production rule to test + // this based on the `unit` property. Hide the brush mark if it corresponds + // to a unit different from the one in the store. + if (selCmpt.resolve === 'global') { + for (const key of keys(update)) { + update[key] = [{ + test: `${store}.length && ${store}[0].unit === ${unitName(model)}`, + ...update[key] + }, { + value: 0 + }]; + } + } + + // Two brush marks ensure that fill colors and other aesthetic choices do + // not interefere with the core marks, but that the brushed region can still + // be interacted with (e.g., dragging it around). + const { + fill, + fillOpacity, + cursor, + ...stroke + } = selCmpt.mark; + const vgStroke = keys(stroke).reduce((def, k) => { + def[k] = [{ + test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`].filter(t => t).join(' && '), + value: stroke[k] + }, { + value: null + }]; + return def; + }, {}); + return [{ + name: `${name + BRUSH}_bg`, + type: 'rect', + clip: true, + encode: { + enter: { + fill: { + value: fill + }, + fillOpacity: { + value: fillOpacity + } + }, + update + } + }, ...marks, { + name: name + BRUSH, + type: 'rect', + clip: true, + encode: { + enter: { + ...(cursor ? { + cursor: { + value: cursor + } + } : {}), + fill: { + value: 'transparent' + } + }, + update: { + ...update, + ...vgStroke + } + } + }]; + } + }; + + /** + * Returns the visual and data signals for an interval selection. + */ + function channelSignals(model, selCmpt, proj, init) { + const scaledInterval = !model.hasProjection; + const channel = proj.channel; + const vname = proj.signals.visual; + const scaleName = vega.stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName()); + const scaled = str => `scale(${scaleName}, ${str})`; + const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal; + const coord = `${channel}(unit)`; + const von = selCmpt.events.reduce((def, evt) => { + return [...def, { + events: evt.between[0], + update: `[${coord}, ${coord}]` + }, + // Brush Start + { + events: evt, + update: `[${vname}[0], clamp(${coord}, 0, ${size})]` + } // Brush End + ]; + }, []); + if (scaledInterval) { + const dname = proj.signals.data; + const hasScales = scaleBindings.defined(selCmpt); + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + const vinit = init ? { + init: assembleInit(init, true, scaled) + } : { + value: [] + }; + + // React to pan/zooms of continuous scales. Non-continuous scales + // (band, point) cannot be pan/zoomed and any other changes + // to their domains (e.g., filtering) should clear the brushes. + von.push({ + events: { + signal: selCmpt.name + SCALE_TRIGGER + }, + update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]` + }); + return hasScales ? [{ + name: dname, + on: [] + }] : [{ + name: vname, + ...vinit, + on: von + }, { + name: dname, + ...(init ? { + init: assembleInit(init) + } : {}), + // Cannot be `value` as `init` may require datetime exprs. + on: [{ + events: { + signal: vname + }, + update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})` + }] + }]; + } else { + const initIdx = channel === X ? 0 : 1; + const initSg = selCmpt.name + INIT; + const vinit = init ? { + init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]` + } : { + value: [] + }; + return [{ + name: vname, + ...vinit, + on: von + }]; + } + } + + const point$1 = { + defined: selCmpt => selCmpt.type === 'point', + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const fieldsSg = name + TUPLE_FIELDS; + const project = selCmpt.project; + const datum = '(item().isVoronoi ? datum.datum : datum)'; + + // Only add a discrete selection to the store if a datum is present _and_ + // the interaction isn't occurring on a group mark. This guards against + // polluting interactive state with invalid values in faceted displays + // as the group marks are also data-driven. We force the update to account + // for constant null states but varying toggles (e.g., shift-click in + // whitespace followed by a click in whitespace; the store should only + // be cleared on the second click). + const brushes = vals(model.component.selection ?? {}).reduce((acc, cmpt) => { + return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc; + }, []).map(b => `indexof(item().mark.name, '${b}') < 0`).join(' && '); + const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${brushes ? ` && ${brushes}` : ''}`; + let update = `unit: ${unitName(model)}, `; + if (selCmpt.project.hasSelectionId) { + update += `${SELECTION_ID}: ${datum}[${vega.stringValue(SELECTION_ID)}]`; + } else { + const values = project.items.map(p => { + const fieldDef = model.fieldDef(p.channel); + // Binned fields should capture extents, for a range test against the raw field. + return fieldDef?.bin ? `[${datum}[${vega.stringValue(model.vgField(p.channel, {}))}], ` + `${datum}[${vega.stringValue(model.vgField(p.channel, { + binSuffix: 'end' + }))}]]` : `${datum}[${vega.stringValue(p.field)}]`; + }).join(', '); + update += `fields: ${fieldsSg}, values: [${values}]`; + } + const events = selCmpt.events; + return signals.concat([{ + name: name + TUPLE, + on: events ? [{ + events, + update: `${test} ? {${update}} : null`, + force: true + }] : [] + }]); + } + }; + + /** + * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition + * or a simple mixin if channel def has no condition. + */ + function wrapCondition(model, channelDef, vgChannel, refFn) { + const condition = isConditionalDef(channelDef) && channelDef.condition; + const valueRef = refFn(channelDef); + if (condition) { + const conditions = vega.array(condition); + const vgConditions = conditions.map(c => { + const conditionValueRef = refFn(c); + if (isConditionalParameter(c)) { + const { + param, + empty + } = c; + const test = parseSelectionPredicate(model, { + param, + empty + }); + return { + test, + ...conditionValueRef + }; + } else { + const test = expression(model, c.test); // FIXME: remove casting once TS is no longer dumb about it + return { + test, + ...conditionValueRef + }; + } + }); + return { + [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])] + }; + } else { + return valueRef !== undefined ? { + [vgChannel]: valueRef + } : {}; + } + } + + function text$1(model) { + let channel = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'text'; + const channelDef = model.encoding[channel]; + return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config)); + } + function textRef(channelDef, config) { + let expr = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'datum'; + // text + if (channelDef) { + if (isValueDef(channelDef)) { + return signalOrValueRef(channelDef.value); + } + if (isFieldOrDatumDef(channelDef)) { + const { + format, + formatType + } = getFormatMixins(channelDef); + return formatSignalRef({ + fieldOrDatumDef: channelDef, + format, + formatType, + expr, + config + }); + } + } + return undefined; + } + + function tooltip(model) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const { + encoding, + markDef, + config, + stack + } = model; + const channelDef = encoding.tooltip; + if (vega.isArray(channelDef)) { + return { + tooltip: tooltipRefForEncoding({ + tooltip: channelDef + }, stack, config, opt) + }; + } else { + const datum = opt.reactiveGeom ? 'datum.datum' : 'datum'; + return wrapCondition(model, channelDef, 'tooltip', cDef => { + // use valueRef based on channelDef first + const tooltipRefFromChannelDef = textRef(cDef, config, datum); + if (tooltipRefFromChannelDef) { + return tooltipRefFromChannelDef; + } + if (cDef === null) { + // Allow using encoding.tooltip = null to disable tooltip + return undefined; + } + let markTooltip = getMarkPropOrConfig('tooltip', markDef, config); + if (markTooltip === true) { + markTooltip = { + content: 'encoding' + }; + } + if (vega.isString(markTooltip)) { + return { + value: markTooltip + }; + } else if (vega.isObject(markTooltip)) { + // `tooltip` is `{fields: 'encodings' | 'fields'}` + if (isSignalRef(markTooltip)) { + return markTooltip; + } else if (markTooltip.content === 'encoding') { + return tooltipRefForEncoding(encoding, stack, config, opt); + } else { + return { + signal: datum + }; + } + } + return undefined; + }); + } + } + function tooltipData(encoding, stack, config) { + let { + reactiveGeom + } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + const formatConfig = { + ...config, + ...config.tooltipFormat + }; + const toSkip = {}; + const expr = reactiveGeom ? 'datum.datum' : 'datum'; + const tuples = []; + function add(fDef, channel) { + const mainChannel = getMainRangeChannel(channel); + const fieldDef = isTypedFieldDef(fDef) ? fDef : { + ...fDef, + type: encoding[mainChannel].type // for secondary field def, copy type from main channel + }; + + const title = fieldDef.title || defaultTitle(fieldDef, formatConfig); + const key = vega.array(title).join(', ').replaceAll(/"/g, '\\"'); + let value; + if (isXorY(channel)) { + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef2 = getFieldDef(encoding[channel2]); + if (isBinned(fieldDef.bin) && fieldDef2) { + const startField = vgField(fieldDef, { + expr + }); + const endField = vgField(fieldDef2, { + expr + }); + const { + format, + formatType + } = getFormatMixins(fieldDef); + value = binFormatExpression(startField, endField, format, formatType, formatConfig); + toSkip[channel2] = true; + } + } + if ((isXorY(channel) || channel === THETA || channel === RADIUS) && stack && stack.fieldChannel === channel && stack.offset === 'normalize') { + const { + format, + formatType + } = getFormatMixins(fieldDef); + value = formatSignalRef({ + fieldOrDatumDef: fieldDef, + format, + formatType, + expr, + config: formatConfig, + normalizeStack: true + }).signal; + } + value ??= textRef(fieldDef, formatConfig, expr).signal; + tuples.push({ + channel, + key, + value + }); + } + forEach(encoding, (channelDef, channel) => { + if (isFieldDef(channelDef)) { + add(channelDef, channel); + } else if (hasConditionalFieldDef(channelDef)) { + add(channelDef.condition, channel); + } + }); + const out = {}; + for (const { + channel, + key, + value + } of tuples) { + if (!toSkip[channel] && !out[key]) { + out[key] = value; + } + } + return out; + } + function tooltipRefForEncoding(encoding, stack, config) { + let { + reactiveGeom + } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + const data = tooltipData(encoding, stack, config, { + reactiveGeom + }); + const keyValues = entries$1(data).map(_ref => { + let [key, value] = _ref; + return `"${key}": ${value}`; + }); + return keyValues.length > 0 ? { + signal: `{${keyValues.join(', ')}}` + } : undefined; + } + + function aria(model) { + const { + markDef, + config + } = model; + const enableAria = getMarkPropOrConfig('aria', markDef, config); + + // We can ignore other aria properties if ariaHidden is true. + if (enableAria === false) { + // getMarkGroups sets aria to false already so we don't have to set it in the encode block + return {}; + } + return { + ...(enableAria ? { + aria: enableAria + } : {}), + ...ariaRoleDescription(model), + ...description(model) + }; + } + function ariaRoleDescription(model) { + const { + mark, + markDef, + config + } = model; + if (config.aria === false) { + return {}; + } + const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config); + if (ariaRoleDesc != null) { + return { + ariaRoleDescription: { + value: ariaRoleDesc + } + }; + } + return mark in VG_MARK_INDEX ? {} : { + ariaRoleDescription: { + value: mark + } + }; + } + function description(model) { + const { + encoding, + markDef, + config, + stack + } = model; + const channelDef = encoding.description; + if (channelDef) { + return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config)); + } + + // Use default from mark def or config if defined. + // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here. + const descriptionValue = getMarkPropOrConfig('description', markDef, config); + if (descriptionValue != null) { + return { + description: signalOrValueRef(descriptionValue) + }; + } + if (config.aria === false) { + return {}; + } + const data = tooltipData(encoding, stack, config); + if (isEmpty(data)) { + return undefined; + } + return { + description: { + signal: entries$1(data).map((_ref, index) => { + let [key, value] = _ref; + return `"${index > 0 ? '; ' : ''}${key}: " + (${value})`; + }).join(' + ') + } + }; + } + + /** + * Return encode for non-positional channels with scales. (Text doesn't have scale.) + */ + function nonPosition(channel, model) { + let opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + const { + markDef, + encoding, + config + } = model; + const { + vgChannel + } = opt; + let { + defaultRef, + defaultValue + } = opt; + if (defaultRef === undefined) { + // prettier-ignore + defaultValue ??= getMarkPropOrConfig(channel, markDef, config, { + vgChannel, + ignoreVgConfig: true + }); + if (defaultValue !== undefined) { + defaultRef = signalOrValueRef(defaultValue); + } + } + const channelDef = encoding[channel]; + return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => { + return midPoint({ + channel, + channelDef: cDef, + markDef, + config, + scaleName: model.scaleName(channel), + scale: model.getScaleComponent(channel), + stack: null, + // No need to provide stack for non-position as it does not affect mid point + defaultRef + }); + }); + } + + function color(model) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + filled: undefined + }; + const { + markDef, + encoding, + config + } = model; + const { + type: markType + } = markDef; + + // Allow filled to be overridden (for trail's "filled") + const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config); + const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType) ? 'transparent' : undefined; + const defaultFill = getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, { + vgChannel: 'fill' + }) ?? + // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified + config.mark[filled === true && 'color'] ?? + // If there is no fill, always fill symbols, bar, geoshape + // with transparent fills https://github.com/vega/vega-lite/issues/1316 + transparentIfNeeded; + const defaultStroke = getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, { + vgChannel: 'stroke' + }) ?? + // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified + config.mark[filled === false && 'color']; + const colorVgChannel = filled ? 'fill' : 'stroke'; + const fillStrokeMarkDefAndConfig = { + ...(defaultFill ? { + fill: signalOrValueRef(defaultFill) + } : {}), + ...(defaultStroke ? { + stroke: signalOrValueRef(defaultStroke) + } : {}) + }; + if (markDef.color && (filled ? markDef.fill : markDef.stroke)) { + warn(droppingColor('property', { + fill: 'fill' in markDef, + stroke: 'stroke' in markDef + })); + } + return { + ...fillStrokeMarkDefAndConfig, + ...nonPosition('color', model, { + vgChannel: colorVgChannel, + defaultValue: filled ? defaultFill : defaultStroke + }), + ...nonPosition('fill', model, { + // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding + defaultValue: encoding.fill ? defaultFill : undefined + }), + ...nonPosition('stroke', model, { + // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding + defaultValue: encoding.stroke ? defaultStroke : undefined + }) + }; + } + + function zindex(model) { + const { + encoding, + mark + } = model; + const order = encoding.order; + if (!isPathMark(mark) && isValueDef(order)) { + return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value)); + } + return {}; + } + + /** + * Utility files for producing Vega ValueRef for marks + */ + + function positionOffset(_ref) { + let { + channel: baseChannel, + markDef, + encoding = {}, + model, + bandPosition + } = _ref; + const channel = `${baseChannel}Offset`; // Need to cast as the type can't be inferred automatically + + const defaultValue = markDef[channel]; + const channelDef = encoding[channel]; + if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) { + const ref = midPoint({ + channel: channel, + channelDef, + markDef, + config: model?.config, + scaleName: model.scaleName(channel), + scale: model.getScaleComponent(channel), + stack: null, + defaultRef: signalOrValueRef(defaultValue), + bandPosition + }); + return { + offsetType: 'encoding', + offset: ref + }; + } + const markDefOffsetValue = markDef[channel]; + if (markDefOffsetValue) { + return { + offsetType: 'visual', + offset: markDefOffsetValue + }; + } + return {}; + } + + /** + * Return encode for point (non-band) position channels. + */ + function pointPosition(channel, model, _ref) { + let { + defaultPos, + vgChannel + } = _ref; + const { + encoding, + markDef, + config, + stack + } = model; + const channelDef = encoding[channel]; + const channel2Def = encoding[getSecondaryRangeChannel(channel)]; + const scaleName = model.scaleName(channel); + const scale = model.getScaleComponent(channel); + const { + offset, + offsetType + } = positionOffset({ + channel, + markDef, + encoding, + model, + bandPosition: 0.5 + }); + + // Get default position or position from mark def + const defaultRef = pointPositionDefaultRef({ + model, + defaultPos, + channel, + scaleName, + scale + }); + const valueRef = !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude) ? + // use geopoint output if there are lat/long and there is no point position overriding lat/long. + { + field: model.getName(channel) + } : positionRef({ + channel, + channelDef, + channel2Def, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef, + bandPosition: offsetType === 'encoding' ? 0 : undefined + }); + return valueRef ? { + [vgChannel || channel]: valueRef + } : undefined; + } + + // TODO: we need to find a way to refactor these so that scaleName is a part of scale + // but that's complicated. For now, this is a huge step moving forward. + + /** + * @return Vega ValueRef for normal x- or y-position without projection + */ + function positionRef(params) { + const { + channel, + channelDef, + scaleName, + stack, + offset, + markDef + } = params; + + // This isn't a part of midPoint because we use midPoint for non-position too + if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) { + if (isFieldDef(channelDef)) { + let bandPosition = channelDef.bandPosition; + if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) { + // theta and radius of text mark should use bandPosition = 0.5 by default + // so that labels for arc marks are centered automatically + bandPosition = 0.5; + } + if (bandPosition !== undefined) { + return interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: channelDef, + // positionRef always have type + startSuffix: 'start', + bandPosition, + offset + }); + } + } + // x or y use stack_end so that stacked line's point mark use stack_end too. + return valueRefForFieldOrDatumDef(channelDef, scaleName, { + suffix: 'end' + }, { + offset + }); + } + return midPointRefWithPositionInvalidTest(params); + } + function pointPositionDefaultRef(_ref2) { + let { + model, + defaultPos, + channel, + scaleName, + scale + } = _ref2; + const { + markDef, + config + } = model; + return () => { + const mainChannel = getMainRangeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, { + vgChannel + }); + if (definedValueOrConfig !== undefined) { + return widthHeightValueOrSignalRef(channel, definedValueOrConfig); + } + switch (defaultPos) { + case 'zeroOrMin': + case 'zeroOrMax': + if (scaleName) { + const scaleType = scale.get('type'); + if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) ; else { + if (scale.domainDefinitelyIncludesZero()) { + return { + scale: scaleName, + value: 0 + }; + } + } + } + if (defaultPos === 'zeroOrMin') { + return mainChannel === 'y' ? { + field: { + group: 'height' + } + } : { + value: 0 + }; + } else { + // zeroOrMax + switch (mainChannel) { + case 'radius': + // max of radius is min(width, height) / 2 + return { + signal: `min(${model.width.signal},${model.height.signal})/2` + }; + case 'theta': + return { + signal: '2*PI' + }; + case 'x': + return { + field: { + group: 'width' + } + }; + case 'y': + return { + value: 0 + }; + } + } + break; + case 'mid': + { + const sizeRef = model[getSizeChannel(channel)]; + return { + ...sizeRef, + mult: 0.5 + }; + } + } + // defaultPos === null + return undefined; + }; + } + + const ALIGNED_X_CHANNEL = { + left: 'x', + center: 'xc', + right: 'x2' + }; + const BASELINED_Y_CHANNEL = { + top: 'y', + middle: 'yc', + bottom: 'y2' + }; + function vgAlignedPositionChannel(channel, markDef, config) { + let defaultAlign = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'middle'; + if (channel === 'radius' || channel === 'theta') { + return getVgPositionChannel(channel); + } + const alignChannel = channel === 'x' ? 'align' : 'baseline'; + const align = getMarkPropOrConfig(alignChannel, markDef, config); + let alignExcludingSignal; + if (isSignalRef(align)) { + warn(rangeMarkAlignmentCannotBeExpression(alignChannel)); + alignExcludingSignal = undefined; + } else { + alignExcludingSignal = align; + } + if (channel === 'x') { + return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')]; + } else { + return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign]; + } + } + + /** + * Utility for area/rule position, which can be either point or range. + * (One of the axes should be point and the other should be range.) + */ + function pointOrRangePosition(channel, model, _ref) { + let { + defaultPos, + defaultPos2, + range + } = _ref; + if (range) { + return rangePosition(channel, model, { + defaultPos, + defaultPos2 + }); + } + return pointPosition(channel, model, { + defaultPos + }); + } + function rangePosition(channel, model, _ref2) { + let { + defaultPos, + defaultPos2 + } = _ref2; + const { + markDef, + config + } = model; + const channel2 = getSecondaryRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2); + const vgChannel = pos2Mixins[sizeChannel] ? + // If there is width/height, we need to position the marks based on the alignment. + vgAlignedPositionChannel(channel, markDef, config) : + // Otherwise, make sure to apply to the right Vg Channel (for arc mark) + getVgPositionChannel(channel); + return { + ...pointPosition(channel, model, { + defaultPos, + vgChannel + }), + ...pos2Mixins + }; + } + + /** + * Return encode for x2, y2. + * If channel is not specified, return one channel based on orientation. + */ + function pointPosition2OrSize(model, defaultPos, channel) { + const { + encoding, + mark, + markDef, + stack, + config + } = model; + const baseChannel = getMainRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const channelDef = encoding[baseChannel]; + const scaleName = model.scaleName(baseChannel); + const scale = model.getScaleComponent(baseChannel); + const { + offset + } = channel in encoding || channel in markDef ? positionOffset({ + channel, + markDef, + encoding, + model + }) : positionOffset({ + channel: baseChannel, + markDef, + encoding, + model + }); + if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) { + const vgSizeChannel = getSizeChannel(channel); + const size = model.markDef[vgSizeChannel]; + if (size != null) { + return { + [vgSizeChannel]: { + value: size + } + }; + } else { + return { + [vgChannel]: { + field: model.getName(channel) + } + }; + } + } + const valueRef = position2Ref({ + channel, + channelDef, + channel2Def: encoding[channel], + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef: undefined + }); + if (valueRef !== undefined) { + return { + [vgChannel]: valueRef + }; + } + + // TODO: check width/height encoding here once we add them + + // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence: + // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark) + + return position2orSize(channel, markDef) || position2orSize(channel, { + [channel]: getMarkStyleConfig(channel, markDef, config.style), + [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style) + }) || position2orSize(channel, config[mark]) || position2orSize(channel, config.mark) || { + [vgChannel]: pointPositionDefaultRef({ + model, + defaultPos, + channel, + scaleName, + scale + })() + }; + } + function position2Ref(_ref3) { + let { + channel, + channelDef, + channel2Def, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef + } = _ref3; + if (isFieldOrDatumDef(channelDef) && stack && + // If fieldChannel is X and channel is X2 (or Y and Y2) + channel.charAt(0) === stack.fieldChannel.charAt(0)) { + return valueRefForFieldOrDatumDef(channelDef, scaleName, { + suffix: 'start' + }, { + offset + }); + } + return midPointRefWithPositionInvalidTest({ + channel, + channelDef: channel2Def, + scaleName, + scale, + stack, + markDef, + config, + offset, + defaultRef + }); + } + function position2orSize(channel, markDef) { + const sizeChannel = getSizeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + if (markDef[vgChannel] !== undefined) { + return { + [vgChannel]: widthHeightValueOrSignalRef(channel, markDef[vgChannel]) + }; + } else if (markDef[channel] !== undefined) { + return { + [vgChannel]: widthHeightValueOrSignalRef(channel, markDef[channel]) + }; + } else if (markDef[sizeChannel]) { + const dimensionSize = markDef[sizeChannel]; + if (isRelativeBandSize(dimensionSize)) { + warn(relativeBandSizeNotSupported(sizeChannel)); + } else { + return { + [sizeChannel]: widthHeightValueOrSignalRef(channel, dimensionSize) + }; + } + } + return undefined; + } + + function rectPosition(model, channel) { + const { + config, + encoding, + markDef + } = model; + const mark = markDef.type; + const channel2 = getSecondaryRangeChannel(channel); + const sizeChannel = getSizeChannel(channel); + const channelDef = encoding[channel]; + const channelDef2 = encoding[channel2]; + const scale = model.getScaleComponent(channel); + const scaleType = scale ? scale.get('type') : undefined; + const orient = markDef.orient; + const hasSizeDef = encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, { + vgChannel: sizeChannel + }); + const offsetScaleChannel = getOffsetChannel(channel); + const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal'); + + // x, x2, and width -- we must specify two of these in all conditions + if (isFieldDef(channelDef) && (isBinning(channelDef.bin) || isBinned(channelDef.bin) || channelDef.timeUnit && !channelDef2) && !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) && !encoding[offsetScaleChannel] && !hasDiscreteDomain(scaleType)) { + return rectBinPosition({ + fieldDef: channelDef, + fieldDef2: channelDef2, + channel, + model + }); + } else if ((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType) || isBarBand) && !channelDef2) { + return positionAndSize(channelDef, channel, model); + } else { + return rangePosition(channel, model, { + defaultPos: 'zeroOrMax', + defaultPos2: 'zeroOrMin' + }); + } + } + function defaultSizeRef(sizeChannel, scaleName, scale, config, bandSize, hasFieldDef, mark) { + if (isRelativeBandSize(bandSize)) { + if (scale) { + const scaleType = scale.get('type'); + if (scaleType === 'band') { + let bandWidth = `bandwidth('${scaleName}')`; + if (bandSize.band !== 1) { + bandWidth = `${bandSize.band} * ${bandWidth}`; + } + const minBandSize = getMarkConfig('minBandSize', { + type: mark + }, config); + return { + signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth + }; + } else if (bandSize.band !== 1) { + warn(cannotUseRelativeBandSizeWithNonBandScale(scaleType)); + bandSize = undefined; + } + } else { + return { + mult: bandSize.band, + field: { + group: sizeChannel + } + }; + } + } else if (isSignalRef(bandSize)) { + return bandSize; + } else if (bandSize) { + return { + value: bandSize + }; + } + + // no valid band size + if (scale) { + const scaleRange = scale.get('range'); + if (isVgRangeStep(scaleRange) && vega.isNumber(scaleRange.step)) { + return { + value: scaleRange.step - 2 + }; + } + } + if (!hasFieldDef) { + const { + bandPaddingInner, + barBandPaddingInner, + rectBandPaddingInner + } = config.scale; + const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts + if (isSignalRef(padding)) { + return { + signal: `(1 - (${padding.signal})) * ${sizeChannel}` + }; + } else if (vega.isNumber(padding)) { + return { + signal: `${1 - padding} * ${sizeChannel}` + }; + } + } + const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel); + return { + value: defaultStep - 2 + }; + } + + /** + * Output position encoding and its size encoding for continuous, point, and band scales. + */ + function positionAndSize(fieldDef, channel, model) { + const { + markDef, + encoding, + config, + stack + } = model; + const orient = markDef.orient; + const scaleName = model.scaleName(channel); + const scale = model.getScaleComponent(channel); + const vgSizeChannel = getSizeChannel(channel); + const channel2 = getSecondaryRangeChannel(channel); + const offsetScaleChannel = getOffsetChannel(channel); + const offsetScaleName = model.scaleName(offsetScaleChannel); + const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel)); + + // use "size" channel for bars, if there is orient and the channel matches the right orientation + const useVlSizeChannel = orient === 'horizontal' && channel === 'y' || orient === 'vertical' && channel === 'x'; + + // Use size encoding / mark property / config if it exists + let sizeMixins; + if (encoding.size || markDef.size) { + if (useVlSizeChannel) { + sizeMixins = nonPosition('size', model, { + vgChannel: vgSizeChannel, + defaultRef: signalOrValueRef(markDef.size) + }); + } else { + warn(cannotApplySizeToNonOrientedMark(markDef.type)); + } + } + const hasSizeFromMarkOrEncoding = !!sizeMixins; + + // Otherwise, apply default value + const bandSize = getBandSize({ + channel, + fieldDef, + markDef, + config, + scaleType: (scale || offsetScale)?.get('type'), + useVlSizeChannel + }); + sizeMixins = sizeMixins || { + [vgSizeChannel]: defaultSizeRef(vgSizeChannel, offsetScaleName || scaleName, offsetScale || scale, config, bandSize, !!fieldDef, markDef.type) + }; + + /* + Band scales with size value and all point scales, use xc/yc + band=0.5 + Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2. + In this case, size_band is the band specified in the x/y-encoding. + By default band is 1, so `(1 - band) / 2` = 0. + If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2 + */ + + const defaultBandAlign = (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding ? 'top' : 'middle'; + const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign); + const center = vgChannel === 'xc' || vgChannel === 'yc'; + const { + offset, + offsetType + } = positionOffset({ + channel, + markDef, + encoding, + model, + bandPosition: center ? 0.5 : 0 + }); + const posRef = midPointRefWithPositionInvalidTest({ + channel, + channelDef: fieldDef, + markDef, + config, + scaleName, + scale, + stack, + offset, + defaultRef: pointPositionDefaultRef({ + model, + defaultPos: 'mid', + channel, + scaleName, + scale + }), + bandPosition: center ? offsetType === 'encoding' ? 0 : 0.5 : isSignalRef(bandSize) ? { + signal: `(1-${bandSize})/2` + } : isRelativeBandSize(bandSize) ? (1 - bandSize.band) / 2 : 0 + }); + if (vgSizeChannel) { + return { + [vgChannel]: posRef, + ...sizeMixins + }; + } else { + // otherwise, we must simulate size by setting position2 = position + size + // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth) + const vgChannel2 = getVgPositionChannel(channel2); + const sizeRef = sizeMixins[vgSizeChannel]; + const sizeOffset = offset ? { + ...sizeRef, + offset + } : sizeRef; + return { + [vgChannel]: posRef, + // posRef might be an array that wraps position invalid test + [vgChannel2]: vega.isArray(posRef) ? [posRef[0], { + ...posRef[1], + offset: sizeOffset + }] : { + ...posRef, + offset: sizeOffset + } + }; + } + } + function getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr) { + if (isPolarPositionChannel(channel)) { + return 0; + } + const isEnd = channel === 'x' || channel === 'y2'; + const spacingOffset = isEnd ? -spacing / 2 : spacing / 2; + if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) { + const reverseExpr = signalOrStringValue(reverse); + const offsetExpr = signalOrStringValue(offset); + const axisTranslateExpr = signalOrStringValue(axisTranslate); + const minBandSizeExpr = signalOrStringValue(minBandSize); + const sign = isEnd ? '' : '-'; + const spacingAndSizeOffset = minBandSize ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})` : spacingOffset; + const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : ''; + const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : ''; + const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset; + return { + signal: t + r + o + }; + } else { + offset = offset || 0; + return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset); + } + } + function rectBinPosition(_ref) { + let { + fieldDef, + fieldDef2, + channel, + model + } = _ref; + const { + config, + markDef, + encoding + } = model; + const scale = model.getScaleComponent(channel); + const scaleName = model.scaleName(channel); + const scaleType = scale ? scale.get('type') : undefined; + const reverse = scale.get('reverse'); + const bandSize = getBandSize({ + channel, + fieldDef, + markDef, + config, + scaleType + }); + const axis = model.component.axes[channel]?.[0]; + const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5 + + const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0; + const channel2 = getSecondaryRangeChannel(channel); + const vgChannel = getVgPositionChannel(channel); + const vgChannel2 = getVgPositionChannel(channel2); + const minBandSize = getMarkConfig('minBandSize', markDef, config); + const { + offset + } = positionOffset({ + channel, + markDef, + encoding, + model, + bandPosition: 0 + }); + const { + offset: offset2 + } = positionOffset({ + channel: channel2, + markDef, + encoding, + model, + bandPosition: 0 + }); + const bandSizeExpr = binSizeExpr({ + fieldDef, + scaleName + }); + const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr); + const binSpacingOffset2 = getBinSpacing(channel2, spacing, reverse, axisTranslate, offset2 ?? offset, minBandSize, bandSizeExpr); + const bandPositionForBandSize = isSignalRef(bandSize) ? { + signal: `(1-${bandSize.signal})/2` + } : isRelativeBandSize(bandSize) ? (1 - bandSize.band) / 2 : 0.5; + const bandPosition = getBandPosition({ + fieldDef, + fieldDef2, + markDef, + config + }); + if (isBinning(fieldDef.bin) || fieldDef.timeUnit) { + const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5; + return { + [vgChannel2]: rectBinRef({ + fieldDef, + scaleName, + bandPosition: bandPositionForBandSize, + offset: binSpacingOffset2, + useRectOffsetField + }), + [vgChannel]: rectBinRef({ + fieldDef, + scaleName, + bandPosition: isSignalRef(bandPositionForBandSize) ? { + signal: `1-${bandPositionForBandSize.signal}` + } : 1 - bandPositionForBandSize, + offset: binSpacingOffset, + useRectOffsetField + }) + }; + } else if (isBinned(fieldDef.bin)) { + const startRef = valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, { + offset: binSpacingOffset2 + }); + if (isFieldDef(fieldDef2)) { + return { + [vgChannel2]: startRef, + [vgChannel]: valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, { + offset: binSpacingOffset + }) + }; + } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) { + return { + [vgChannel2]: startRef, + [vgChannel]: { + signal: `scale("${scaleName}", ${vgField(fieldDef, { + expr: 'datum' + })} + ${fieldDef.bin.step})`, + offset: binSpacingOffset + } + }; + } + } + warn(channelRequiredForBinned(channel2)); + return undefined; + } + + /** + * Value Ref for binned fields + */ + function rectBinRef(_ref2) { + let { + fieldDef, + scaleName, + bandPosition, + offset, + useRectOffsetField + } = _ref2; + return interpolatedSignalRef({ + scaleName, + fieldOrDatumDef: fieldDef, + bandPosition, + offset, + ...(useRectOffsetField ? { + startSuffix: OFFSETTED_RECT_START_SUFFIX, + endSuffix: OFFSETTED_RECT_END_SUFFIX + } : {}) + }); + } + + const ALWAYS_IGNORE = new Set(['aria', 'width', 'height']); + function baseEncodeEntry(model, ignore) { + const { + fill = undefined, + stroke = undefined + } = ignore.color === 'include' ? color(model) : {}; + return { + ...markDefProperties(model.markDef, ignore), + ...wrapAllFieldsInvalid(model, 'fill', fill), + ...wrapAllFieldsInvalid(model, 'stroke', stroke), + ...nonPosition('opacity', model), + ...nonPosition('fillOpacity', model), + ...nonPosition('strokeOpacity', model), + ...nonPosition('strokeWidth', model), + ...nonPosition('strokeDash', model), + ...zindex(model), + ...tooltip(model), + ...text$1(model, 'href'), + ...aria(model) + }; + } + + // TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987 + function wrapAllFieldsInvalid(model, channel, valueRef) { + const { + config, + mark, + markDef + } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid === 'hide' && valueRef && !isPathMark(mark)) { + // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains. + // For path marks, we will use "defined" property and skip these values instead. + const test = allFieldsInvalidPredicate$1(model, { + invalid: true, + channels: SCALE_CHANNELS + }); + if (test) { + return { + [channel]: [ + // prepend the invalid case + // TODO: support custom value + { + test, + value: null + }, ...vega.array(valueRef)] + }; + } + } + return valueRef ? { + [channel]: valueRef + } : {}; + } + function markDefProperties(mark, ignore) { + return VG_MARK_CONFIGS.reduce((m, prop) => { + if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') { + m[prop] = signalOrValueRef(mark[prop]); + } + return m; + }, {}); + } + function allFieldsInvalidPredicate$1(model, _ref) { + let { + invalid = false, + channels + } = _ref; + const filterIndex = channels.reduce((aggregator, channel) => { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const field = model.vgField(channel, { + expr: 'datum' + }); + + // While discrete domain scales can handle invalid values, continuous scales can't. + if (field && hasContinuousDomain(scaleType)) { + aggregator[field] = true; + } + } + return aggregator; + }, {}); + const fields = keys(filterIndex); + if (fields.length > 0) { + const op = invalid ? '||' : '&&'; + return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); + } + return undefined; + } + + function defined(model) { + const { + config, + markDef + } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid) { + const signal = allFieldsInvalidPredicate(model, { + channels: POSITION_SCALE_CHANNELS + }); + if (signal) { + return { + defined: { + signal + } + }; + } + } + return {}; + } + function allFieldsInvalidPredicate(model, _ref) { + let { + invalid = false, + channels + } = _ref; + const filterIndex = channels.reduce((aggregator, channel) => { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const field = model.vgField(channel, { + expr: 'datum', + binSuffix: model.stack?.impute ? 'mid' : undefined + }); + + // While discrete domain scales can handle invalid values, continuous scales can't. + if (field && hasContinuousDomain(scaleType)) { + aggregator[field] = true; + } + } + return aggregator; + }, {}); + const fields = keys(filterIndex); + if (fields.length > 0) { + const op = invalid ? '||' : '&&'; + return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `); + } + return undefined; + } + function valueIfDefined(prop, value) { + if (value !== undefined) { + return { + [prop]: signalOrValueRef(value) + }; + } + return undefined; + } + + const VORONOI = 'voronoi'; + const nearest = { + defined: selCmpt => { + return selCmpt.type === 'point' && selCmpt.nearest; + }, + parse: (model, selCmpt) => { + // Scope selection events to the voronoi mark to prevent capturing + // events that occur on the group mark (https://github.com/vega/vega/issues/2112). + if (selCmpt.events) { + for (const s of selCmpt.events) { + s.markname = model.getName(VORONOI); + } + } + }, + marks: (model, selCmpt, marks) => { + const { + x, + y + } = selCmpt.project.hasChannel; + const markType = model.mark; + if (isPathMark(markType)) { + warn(nearestNotSupportForContinuous(markType)); + return marks; + } + const cellDef = { + name: model.getName(VORONOI), + type: 'path', + interactive: true, + from: { + data: model.getName('marks') + }, + encode: { + update: { + fill: { + value: 'transparent' + }, + strokeWidth: { + value: 0.35 + }, + stroke: { + value: 'transparent' + }, + isVoronoi: { + value: true + }, + ...tooltip(model, { + reactiveGeom: true + }) + } + }, + transform: [{ + type: 'voronoi', + x: { + expr: x || !y ? 'datum.datum.x || 0' : '0' + }, + y: { + expr: y || !x ? 'datum.datum.y || 0' : '0' + }, + size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] + }] + }; + let index = 0; + let exists = false; + marks.forEach((mark, i) => { + const name = mark.name ?? ''; + if (name === model.component.mark[0].name) { + index = i; + } else if (name.indexOf(VORONOI) >= 0) { + exists = true; + } + }); + if (!exists) { + marks.splice(index + 1, 0, cellDef); + } + return marks; + } + }; + + const inputBindings = { + defined: selCmpt => { + return selCmpt.type === 'point' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind !== 'scales' && !isLegendBinding(selCmpt.bind); + }, + parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef), + topLevelSignals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const bind = selCmpt.bind; + const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value). + const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum'; + proj.items.forEach((p, i) => { + const sgname = varName(`${name}_${p.field}`); + const hasSignal = signals.filter(s => s.name === sgname); + if (!hasSignal.length) { + signals.unshift({ + name: sgname, + ...(init ? { + init: assembleInit(init[i]) + } : { + value: null + }), + on: selCmpt.events ? [{ + events: selCmpt.events, + update: `datum && item().mark.marktype !== 'group' ? ${datum}[${vega.stringValue(p.field)}] : null` + }] : [], + bind: bind[p.field] ?? bind[p.channel] ?? bind + }); + } + }); + return signals; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const signal = signals.filter(s => s.name === name + TUPLE)[0]; + const fields = name + TUPLE_FIELDS; + const values = proj.items.map(p => varName(`${name}_${p.field}`)); + const valid = values.map(v => `${v} !== null`).join(' && '); + if (values.length) { + signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; + } + delete signal.value; + delete signal.on; + return signals; + } + }; + + const TOGGLE = '_toggle'; + const toggle = { + defined: selCmpt => { + return selCmpt.type === 'point' && !!selCmpt.toggle; + }, + signals: (model, selCmpt, signals) => { + return signals.concat({ + name: selCmpt.name + TOGGLE, + value: false, + on: [{ + events: selCmpt.events, + update: selCmpt.toggle + }] + }); + }, + modifyExpr: (model, selCmpt) => { + const tpl = selCmpt.name + TUPLE; + const signal = selCmpt.name + TOGGLE; + return `${signal} ? null : ${tpl}, ` + (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) + `${signal} ? ${tpl} : null`; + } + }; + + const clear = { + defined: selCmpt => { + return selCmpt.clear !== undefined && selCmpt.clear !== false; + }, + parse: (model, selCmpt) => { + if (selCmpt.clear) { + selCmpt.clear = vega.isString(selCmpt.clear) ? vega.parseSelector(selCmpt.clear, 'view') : selCmpt.clear; + } + }, + topLevelSignals: (model, selCmpt, signals) => { + if (inputBindings.defined(selCmpt)) { + for (const proj of selCmpt.project.items) { + const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`)); + if (idx !== -1) { + signals[idx].on.push({ + events: selCmpt.clear, + update: 'null' + }); + } + } + } + return signals; + }, + signals: (model, selCmpt, signals) => { + function addClear(idx, update) { + if (idx !== -1 && signals[idx].on) { + signals[idx].on.push({ + events: selCmpt.clear, + update + }); + } + } + + // Be as minimalist as possible when adding clear triggers to minimize dataflow execution. + if (selCmpt.type === 'interval') { + for (const proj of selCmpt.project.items) { + const vIdx = signals.findIndex(n => n.name === proj.signals.visual); + addClear(vIdx, '[0, 0]'); + if (vIdx === -1) { + const dIdx = signals.findIndex(n => n.name === proj.signals.data); + addClear(dIdx, 'null'); + } + } + } else { + let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE); + addClear(tIdx, 'null'); + if (toggle.defined(selCmpt)) { + tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE); + addClear(tIdx, 'false'); + } + } + return signals; + } + }; + + const legendBindings = { + defined: selCmpt => { + const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind); + const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID; + if (spec && !projLen) { + warn(LEGEND_BINDINGS_MUST_HAVE_PROJECTION); + } + return spec && projLen; + }, + parse: (model, selCmpt, selDef) => { + // Allow legend items to be toggleable by default even though direct manipulation is disabled. + const selDef_ = duplicate(selDef); + selDef_.select = vega.isString(selDef_.select) ? { + type: selDef_.select, + toggle: selCmpt.toggle + } : { + ...selDef_.select, + toggle: selCmpt.toggle + }; + disableDirectManipulation(selCmpt, selDef_); + if (vega.isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) { + const legendFilter = 'event.item && indexof(event.item.mark.role, "legend") < 0'; + for (const evt of selCmpt.events) { + evt.filter = vega.array(evt.filter ?? []); + if (!evt.filter.includes(legendFilter)) { + evt.filter.push(legendFilter); + } + } + } + const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click'; + const stream = vega.isString(evt) ? vega.parseSelector(evt, 'view') : vega.array(evt); + selCmpt.bind = { + legend: { + merge: stream + } + }; + }, + topLevelSignals: (model, selCmpt, signals) => { + const selName = selCmpt.name; + const stream = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; + const markName = name => s => { + const ds = duplicate(s); + ds.markname = name; + return ds; + }; + for (const proj of selCmpt.project.items) { + if (!proj.hasLegend) continue; + const prefix = `${varName(proj.field)}_legend`; + const sgName = `${selName}_${prefix}`; + const hasSignal = signals.filter(s => s.name === sgName); + if (hasSignal.length === 0) { + const events = stream.merge.map(markName(`${prefix}_symbols`)).concat(stream.merge.map(markName(`${prefix}_labels`))).concat(stream.merge.map(markName(`${prefix}_entries`))); + signals.unshift({ + name: sgName, + ...(!selCmpt.init ? { + value: null + } : {}), + on: [ + // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum. + { + events, + update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value', + force: true + }, { + events: stream.merge, + update: `!event.item || !datum ? null : ${sgName}`, + force: true + }] + }); + } + } + return signals; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const proj = selCmpt.project; + const tuple = signals.find(s => s.name === name + TUPLE); + const fields = name + TUPLE_FIELDS; + const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`)); + const valid = values.map(v => `${v} !== null`).join(' && '); + const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`; + if (selCmpt.events && values.length > 0) { + tuple.on.push({ + events: values.map(signal => ({ + signal + })), + update + }); + } else if (values.length > 0) { + tuple.update = update; + delete tuple.value; + delete tuple.on; + } + const toggle = signals.find(s => s.name === name + TOGGLE); + const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend; + if (toggle) { + if (!selCmpt.events) toggle.on[0].events = events;else toggle.on.push({ + ...toggle.on[0], + events + }); + } + return signals; + } + }; + function parseInteractiveLegend(model, channel, legendCmpt) { + const field = model.fieldDef(channel)?.field; + for (const selCmpt of vals(model.component.selection ?? {})) { + const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel]; + if (proj && legendBindings.defined(selCmpt)) { + const legendSelections = legendCmpt.get('selections') ?? []; + legendSelections.push(selCmpt.name); + legendCmpt.set('selections', legendSelections, false); + proj.hasLegend = true; + } + } + } + + const ANCHOR$1 = '_translate_anchor'; + const DELTA$1 = '_translate_delta'; + const translate = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.translate; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const boundScales = scaleBindings.defined(selCmpt); + const anchor = name + ANCHOR$1; + const { + x, + y + } = selCmpt.project.hasChannel; + let events = vega.parseSelector(selCmpt.translate, 'scope'); + if (!boundScales) { + events = events.map(e => (e.between[0].markname = name + BRUSH, e)); + } + signals.push({ + name: anchor, + value: {}, + on: [{ + events: events.map(e => e.between[0]), + update: '{x: x(unit), y: y(unit)' + (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') + (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') + '}' + }] + }, { + name: name + DELTA$1, + value: {}, + on: [{ + events, + update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}` + }] + }); + if (x !== undefined) { + onDelta$1(model, selCmpt, x, 'width', signals); + } + if (y !== undefined) { + onDelta$1(model, selCmpt, y, 'height', signals); + } + return signals; + } + }; + function onDelta$1(model, selCmpt, proj, size, signals) { + const name = selCmpt.name; + const anchor = name + ANCHOR$1; + const delta = name + DELTA$1; + const channel = proj.channel; + const boundScales = scaleBindings.defined(selCmpt); + const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0]; + const sizeSg = model.getSizeSignalRef(size).signal; + const scaleCmpt = model.getScaleComponent(channel); + const scaleType = scaleCmpt && scaleCmpt.get('type'); + const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort + const sign = !boundScales ? '' : channel === X ? reversed ? '' : '-' : reversed ? '-' : ''; + const extent = `${anchor}.extent_${channel}`; + const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`; + const panFn = !boundScales || !scaleCmpt ? 'panLinear' : scaleType === 'log' ? 'panLog' : scaleType === 'symlog' ? 'panSymlog' : scaleType === 'pow' ? 'panPow' : 'panLinear'; + const arg = !boundScales ? '' : scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : scaleType === 'symlog' ? `, ${scaleCmpt.get('constant') ?? 1}` : ''; + const update = `${panFn}(${extent}, ${offset}${arg})`; + signal.on.push({ + events: { + signal: delta + }, + update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})` + }); + } + + const ANCHOR = '_zoom_anchor'; + const DELTA = '_zoom_delta'; + const zoom = { + defined: selCmpt => { + return selCmpt.type === 'interval' && selCmpt.zoom; + }, + signals: (model, selCmpt, signals) => { + const name = selCmpt.name; + const boundScales = scaleBindings.defined(selCmpt); + const delta = name + DELTA; + const { + x, + y + } = selCmpt.project.hasChannel; + const sx = vega.stringValue(model.scaleName(X)); + const sy = vega.stringValue(model.scaleName(Y)); + let events = vega.parseSelector(selCmpt.zoom, 'scope'); + if (!boundScales) { + events = events.map(e => (e.markname = name + BRUSH, e)); + } + signals.push({ + name: name + ANCHOR, + on: [{ + events, + update: !boundScales ? `{x: x(unit), y: y(unit)}` : '{' + [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : ''].filter(expr => expr).join(', ') + '}' + }] + }, { + name: delta, + on: [{ + events, + force: true, + update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))' + }] + }); + if (x !== undefined) { + onDelta(model, selCmpt, x, 'width', signals); + } + if (y !== undefined) { + onDelta(model, selCmpt, y, 'height', signals); + } + return signals; + } + }; + function onDelta(model, selCmpt, proj, size, signals) { + const name = selCmpt.name; + const channel = proj.channel; + const boundScales = scaleBindings.defined(selCmpt); + const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0]; + const sizeSg = model.getSizeSignalRef(size).signal; + const scaleCmpt = model.getScaleComponent(channel); + const scaleType = scaleCmpt && scaleCmpt.get('type'); + const base = boundScales ? domain(model, channel) : signal.name; + const delta = name + DELTA; + const anchor = `${name}${ANCHOR}.${channel}`; + const zoomFn = !boundScales || !scaleCmpt ? 'zoomLinear' : scaleType === 'log' ? 'zoomLog' : scaleType === 'symlog' ? 'zoomSymlog' : scaleType === 'pow' ? 'zoomPow' : 'zoomLinear'; + const arg = !boundScales ? '' : scaleType === 'pow' ? `, ${scaleCmpt.get('exponent') ?? 1}` : scaleType === 'symlog' ? `, ${scaleCmpt.get('constant') ?? 1}` : ''; + const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`; + signal.on.push({ + events: { + signal: delta + }, + update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})` + }); + } + + const STORE = '_store'; + const TUPLE = '_tuple'; + const MODIFY = '_modify'; + const VL_SELECTION_RESOLVE = 'vlSelectionResolve'; + // Order matters for parsing and assembly. + const selectionCompilers = [point$1, interval, project, toggle, + // Bindings may disable direct manipulation. + inputBindings, scaleBindings, legendBindings, clear, translate, zoom, nearest]; + function getFacetModel(model) { + let parent = model.parent; + while (parent) { + if (isFacetModel(parent)) break; + parent = parent.parent; + } + return parent; + } + function unitName(model) { + let { + escape + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + escape: true + }; + let name = escape ? vega.stringValue(model.name) : model.name; + const facetModel = getFacetModel(model); + if (facetModel) { + const { + facet + } = facetModel; + for (const channel of FACET_CHANNELS) { + if (facet[channel]) { + name += ` + '__facet_${channel}_' + (facet[${vega.stringValue(facetModel.vgField(channel))}])`; + } + } + } + return name; + } + function requiresSelectionId(model) { + return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => { + return identifier || selCmpt.project.hasSelectionId; + }, false); + } + + // Binding a point selection to query widgets or legends disables default direct manipulation interaction. + // A user can choose to re-enable it by explicitly specifying triggering input events. + function disableDirectManipulation(selCmpt, selDef) { + if (vega.isString(selDef.select) || !selDef.select.on) delete selCmpt.events; + if (vega.isString(selDef.select) || !selDef.select.clear) delete selCmpt.clear; + if (vega.isString(selDef.select) || !selDef.select.toggle) delete selCmpt.toggle; + } + + function getName(node) { + const name = []; + if (node.type === 'Identifier') { + return [node.name]; + } + if (node.type === 'Literal') { + return [node.value]; + } + if (node.type === 'MemberExpression') { + name.push(...getName(node.object)); + name.push(...getName(node.property)); + } + return name; + } + function startsWithDatum(node) { + if (node.object.type === 'MemberExpression') { + return startsWithDatum(node.object); + } + return node.object.name === 'datum'; + } + function getDependentFields(expression) { + const ast = vega.parseExpression(expression); + const dependents = new Set(); + // visit is missing in types https://github.com/vega/vega/issues/3298 + ast.visit(node => { + if (node.type === 'MemberExpression' && startsWithDatum(node)) { + dependents.add(getName(node).slice(1).join('.')); + } + }); + return dependents; + } + + class FilterNode extends DataFlowNode { + clone() { + return new FilterNode(null, this.model, duplicate(this.filter)); + } + constructor(parent, model, filter) { + super(parent); + + // TODO: refactor this to not take a node and + // then add a static function makeFromOperand and make the constructor take only an expression + this.model = model; + this.filter = filter; + _defineProperty(this, "expr", void 0); + _defineProperty(this, "_dependentFields", void 0); + this.expr = expression(this.model, this.filter, this); + this._dependentFields = getDependentFields(this.expr); + } + dependentFields() { + return this._dependentFields; + } + producedFields() { + return new Set(); // filter does not produce any new fields + } + + assemble() { + return { + type: 'filter', + expr: this.expr + }; + } + hash() { + return `Filter ${this.expr}`; + } + } + + function parseUnitSelection(model, selDefs) { + const selCmpts = {}; + const selectionConfig = model.config.selection; + if (!selDefs || !selDefs.length) return selCmpts; + for (const def of selDefs) { + const name = varName(def.name); + const selDef = def.select; + const type = vega.isString(selDef) ? selDef : selDef.type; + const defaults = vega.isObject(selDef) ? duplicate(selDef) : { + type + }; + + // Set default values from config if a property hasn't been specified, + // or if it is true. E.g., "translate": true should use the default + // event handlers for translate. However, true may be a valid value for + // a property (e.g., "nearest": true). + const cfg = selectionConfig[type]; + for (const key in cfg) { + // Project transform applies its defaults. + if (key === 'fields' || key === 'encodings') { + continue; + } + if (key === 'mark') { + defaults[key] = { + ...cfg[key], + ...defaults[key] + }; + } + if (defaults[key] === undefined || defaults[key] === true) { + defaults[key] = duplicate(cfg[key] ?? defaults[key]); + } + } + const selCmpt = selCmpts[name] = { + ...defaults, + name, + type, + init: def.value, + bind: def.bind, + events: vega.isString(defaults.on) ? vega.parseSelector(defaults.on, 'scope') : vega.array(duplicate(defaults.on)) + }; + const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects + for (const c of selectionCompilers) { + if (c.defined(selCmpt) && c.parse) { + c.parse(model, selCmpt, def_); + } + } + } + return selCmpts; + } + function parseSelectionPredicate(model, pred, dfnode) { + let datum = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'datum'; + const name = vega.isString(pred) ? pred : pred.param; + const vname = varName(name); + const store = vega.stringValue(vname + STORE); + let selCmpt; + try { + selCmpt = model.getSelectionComponent(vname, name); + } catch (e) { + // If a selection isn't found, treat as a variable parameter and coerce to boolean. + return `!!${vname}`; + } + if (selCmpt.project.timeUnit) { + const child = dfnode ?? model.component.data.raw; + const tunode = selCmpt.project.timeUnit.clone(); + if (child.parent) { + tunode.insertAsParentOf(child); + } else { + child.parent = tunode; + } + } + const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest('; + const resolve = selCmpt.resolve === 'global' ? ')' : `, ${vega.stringValue(selCmpt.resolve)})`; + const test = `${fn}${store}, ${datum}${resolve}`; + const length = `length(data(${store}))`; + return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`; + } + function parseSelectionExtent(model, name, extent) { + const vname = varName(name); + const encoding = extent['encoding']; + let field = extent['field']; + let selCmpt; + try { + selCmpt = model.getSelectionComponent(vname, name); + } catch (e) { + // If a selection isn't found, treat it as a variable parameter. + return vname; + } + if (!encoding && !field) { + field = selCmpt.project.items[0].field; + if (selCmpt.project.items.length > 1) { + warn('A "field" or "encoding" must be specified when using a selection as a scale domain. ' + `Using "field": ${vega.stringValue(field)}.`); + } + } else if (encoding && !field) { + const encodings = selCmpt.project.items.filter(p => p.channel === encoding); + if (!encodings.length || encodings.length > 1) { + field = selCmpt.project.items[0].field; + warn((!encodings.length ? 'No ' : 'Multiple ') + `matching ${vega.stringValue(encoding)} encoding found for selection ${vega.stringValue(extent.param)}. ` + `Using "field": ${vega.stringValue(field)}.`); + } else { + field = encodings[0].field; + } + } + return `${selCmpt.name}[${vega.stringValue(replacePathInField(field))}]`; + } + function materializeSelections(model, main) { + for (const [selection, selCmpt] of entries$1(model.component.selection ?? {})) { + const lookupName = model.getName(`lookup_${selection}`); + model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(new FilterNode(main, model, { + param: selection + }), lookupName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); + } + } + + /** + * Converts a predicate into an expression. + */ + // model is only used for selection filters. + function expression(model, filterOp, node) { + return logicalExpr(filterOp, predicate => { + if (vega.isString(predicate)) { + return predicate; + } else if (isSelectionPredicate(predicate)) { + return parseSelectionPredicate(model, predicate, node); + } else { + // Filter Object + return fieldFilterExpression(predicate); + } + }); + } + + function assembleTitle(title, config) { + if (!title) { + return undefined; + } + if (vega.isArray(title) && !isText(title)) { + return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', '); + } + return title; + } + function setAxisEncode(axis, part, vgProp, vgRef) { + axis.encode ??= {}; + axis.encode[part] ??= {}; + axis.encode[part].update ??= {}; + // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 + axis.encode[part].update[vgProp] = vgRef; + } + function assembleAxis(axisCmpt, kind, config) { + let opt = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : { + header: false + }; + const { + disable, + orient, + scale, + labelExpr, + title, + zindex, + ...axis + } = axisCmpt.combine(); + if (disable) { + return undefined; + } + for (const prop in axis) { + const propType = AXIS_PROPERTY_TYPE[prop]; + const propValue = axis[prop]; + if (propType && propType !== kind && propType !== 'both') { + // Remove properties that are not valid for this kind of axis + delete axis[prop]; + } else if (isConditionalAxisValue(propValue)) { + // deal with conditional axis value + + const { + condition, + ...valueOrSignalRef + } = propValue; + const conditions = vega.array(condition); + const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; + if (propIndex) { + const { + vgProp, + part + } = propIndex; + // If there is a corresponding Vega property for the channel, + // use Vega's custom axis encoding and delete the original axis property to avoid conflicts + + const vgRef = [...conditions.map(c => { + const { + test, + ...valueOrSignalCRef + } = c; + return { + test: expression(null, test), + ...valueOrSignalCRef + }; + }), valueOrSignalRef]; + setAxisEncode(axis, part, vgProp, vgRef); + delete axis[prop]; + } else if (propIndex === null) { + // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead. + const signalRef = { + signal: conditions.map(c => { + const { + test, + ...valueOrSignalCRef + } = c; + return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `; + }).join('') + exprFromValueRefOrSignalRef(valueOrSignalRef) + }; + axis[prop] = signalRef; + } + } else if (isSignalRef(propValue)) { + const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop]; + if (propIndex) { + const { + vgProp, + part + } = propIndex; + setAxisEncode(axis, part, vgProp, propValue); + delete axis[prop]; + } // else do nothing since the property already supports signal + } + + // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema + // Note that we need to use null so the default labelAlign is preserved. + if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) { + delete axis[prop]; + } + } + if (kind === 'grid') { + if (!axis.grid) { + return undefined; + } + + // Remove unnecessary encode block + if (axis.encode) { + // Only need to keep encode block for grid + const { + grid + } = axis.encode; + axis.encode = { + ...(grid ? { + grid + } : {}) + }; + if (isEmpty(axis.encode)) { + delete axis.encode; + } + } + return { + scale, + orient, + ...axis, + domain: false, + labels: false, + aria: false, + // always hide grid axis + + // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent` + // would not affect gridAxis + maxExtent: 0, + minExtent: 0, + ticks: false, + zindex: getFirstDefined(zindex, 0) // put grid behind marks by default + }; + } else { + // kind === 'main' + + if (!opt.header && axisCmpt.mainExtracted) { + // if mainExtracted has been extracted to a separate facet + return undefined; + } + if (labelExpr !== undefined) { + let expr = labelExpr; + if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) { + expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal); + } + setAxisEncode(axis, 'labels', 'text', { + signal: expr + }); + } + if (axis.labelAlign === null) { + delete axis.labelAlign; + } + + // Remove unnecessary encode block + if (axis.encode) { + for (const part of AXIS_PARTS) { + if (!axisCmpt.hasAxisPart(part)) { + delete axis.encode[part]; + } + } + if (isEmpty(axis.encode)) { + delete axis.encode; + } + } + const titleString = assembleTitle(title, config); + return { + scale, + orient, + grid: false, + ...(titleString ? { + title: titleString + } : {}), + ...axis, + ...(config.aria === false ? { + aria: false + } : {}), + zindex: getFirstDefined(zindex, 0) // put axis line above marks by default + }; + } + } + + /** + * Add axis signals so grid line works correctly + * (Fix https://github.com/vega/vega-lite/issues/4226) + */ + function assembleAxisSignals(model) { + const { + axes + } = model.component; + const signals = []; + for (const channel of POSITION_SCALE_CHANNELS) { + if (axes[channel]) { + for (const axis of axes[channel]) { + if (!axis.get('disable') && !axis.get('gridScale')) { + // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width. + + const sizeType = channel === 'x' ? 'height' : 'width'; + const update = model.getSizeSignalRef(sizeType).signal; + if (sizeType !== update) { + signals.push({ + name: sizeType, + update + }); + } + } + } + } + } + return signals; + } + function assembleAxes(axisComponents, config) { + const { + x = [], + y = [] + } = axisComponents; + return [...x.map(a => assembleAxis(a, 'grid', config)), ...y.map(a => assembleAxis(a, 'grid', config)), ...x.map(a => assembleAxis(a, 'main', config)), ...y.map(a => assembleAxis(a, 'main', config))].filter(a => a); // filter undefined + } + + function getAxisConfigFromConfigTypes(configTypes, config, channel, orient) { + // TODO: add special casing to add conditional value based on orient signal + return Object.assign.apply(null, [{}, ...configTypes.map(configType => { + if (configType === 'axisOrient') { + const orient1 = channel === 'x' ? 'bottom' : 'left'; + const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {}; + const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {}; + const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]); + const conditionalOrientAxisConfig = {}; + for (const prop of props.values()) { + conditionalOrientAxisConfig[prop] = { + // orient is surely signal in this case + signal: `${orient['signal']} === "${orient1}" ? ${signalOrStringValue(orientConfig1[prop])} : ${signalOrStringValue(orientConfig2[prop])}` + }; + } + return conditionalOrientAxisConfig; + } + return config[configType]; + })]); + } + function getAxisConfigs(channel, scaleType, orient, config) { + const typeBasedConfigTypes = scaleType === 'band' ? ['axisDiscrete', 'axisBand'] : scaleType === 'point' ? ['axisDiscrete', 'axisPoint'] : isQuantitative(scaleType) ? ['axisQuantitative'] : scaleType === 'time' || scaleType === 'utc' ? ['axisTemporal'] : []; + const axisChannel = channel === 'x' ? 'axisX' : 'axisY'; + const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ... + + const vlOnlyConfigTypes = [ + // technically Vega does have axisBand, but if we make another separation here, + // it will further introduce complexity in the code + ...typeBasedConfigTypes, ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))]; + const vgConfigTypes = ['axis', axisOrient, axisChannel]; + return { + vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient), + vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient), + axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config) + }; + } + function getAxisConfigStyle(axisConfigTypes, config) { + const toMerge = [{}]; + for (const configType of axisConfigTypes) { + // TODO: add special casing to add conditional value based on orient signal + let style = config[configType]?.style; + if (style) { + style = vega.array(style); + for (const s of style) { + toMerge.push(config.style[s]); + } + } + } + return Object.assign.apply(null, toMerge); + } + function getAxisConfig(property, styleConfigIndex, style) { + let axisConfigs = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + const styleConfig = getStyleConfig(property, style, styleConfigIndex); + if (styleConfig !== undefined) { + return { + configFrom: 'style', + configValue: styleConfig + }; + } + for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) { + if (axisConfigs[configFrom]?.[property] !== undefined) { + return { + configFrom, + configValue: axisConfigs[configFrom][property] + }; + } + } + return {}; + } + + const axisRules = { + scale: _ref => { + let { + model, + channel + } = _ref; + return model.scaleName(channel); + }, + format: _ref2 => { + let { + format + } = _ref2; + return format; + }, + // we already calculate this in parse + + formatType: _ref3 => { + let { + formatType + } = _ref3; + return formatType; + }, + // we already calculate this in parse + + grid: _ref4 => { + let { + fieldOrDatumDef, + axis, + scaleType + } = _ref4; + return axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef); + }, + gridScale: _ref5 => { + let { + model, + channel + } = _ref5; + return gridScale(model, channel); + }, + labelAlign: _ref6 => { + let { + axis, + labelAngle, + orient, + channel + } = _ref6; + return axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel); + }, + labelAngle: _ref7 => { + let { + labelAngle + } = _ref7; + return labelAngle; + }, + // we already calculate this in parse + + labelBaseline: _ref8 => { + let { + axis, + labelAngle, + orient, + channel + } = _ref8; + return axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel); + }, + labelFlush: _ref9 => { + let { + axis, + fieldOrDatumDef, + channel + } = _ref9; + return axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel); + }, + labelOverlap: _ref10 => { + let { + axis, + fieldOrDatumDef, + scaleType + } = _ref10; + return axis.labelOverlap ?? defaultLabelOverlap$1(fieldOrDatumDef.type, scaleType, isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit, isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined); + }, + // we already calculate orient in parse + orient: _ref11 => { + let { + orient + } = _ref11; + return orient; + }, + // Need to cast until Vega supports signal + + tickCount: _ref12 => { + let { + channel, + model, + axis, + fieldOrDatumDef, + scaleType + } = _ref12; + const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined; + const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined; + return axis.tickCount ?? defaultTickCount({ + fieldOrDatumDef, + scaleType, + size, + values: axis.values + }); + }, + tickMinStep: _ref13 => { + let { + axis, + format, + fieldOrDatumDef + } = _ref13; + return axis.tickMinStep ?? defaultTickMinStep({ + format, + fieldOrDatumDef + }); + }, + title: _ref14 => { + let { + axis, + model, + channel + } = _ref14; + if (axis.title !== undefined) { + return axis.title; + } + const fieldDefTitle = getFieldDefTitle(model, channel); + if (fieldDefTitle !== undefined) { + return fieldDefTitle; + } + const fieldDef = model.typedFieldDef(channel); + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef2 = model.fieldDef(channel2); + + // If title not specified, store base parts of fieldDef (and fieldDef2 if exists) + return mergeTitleFieldDefs(fieldDef ? [toFieldDefBase(fieldDef)] : [], isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []); + }, + values: _ref15 => { + let { + axis, + fieldOrDatumDef + } = _ref15; + return values$1(axis, fieldOrDatumDef); + }, + zindex: _ref16 => { + let { + axis, + fieldOrDatumDef, + mark + } = _ref16; + return axis.zindex ?? defaultZindex(mark, fieldOrDatumDef); + } + }; + + // TODO: we need to refactor this method after we take care of config refactoring + /** + * Default rules for whether to show a grid should be shown for a channel. + * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned + */ + + function defaultGrid(scaleType, fieldDef) { + return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin); + } + function gridScale(model, channel) { + const gridChannel = channel === 'x' ? 'y' : 'x'; + if (model.getScaleComponent(gridChannel)) { + return model.scaleName(gridChannel); + } + return undefined; + } + function getLabelAngle(fieldOrDatumDef, axis, channel, styleConfig, axisConfigs) { + const labelAngle = axis?.labelAngle; + // try axis value + if (labelAngle !== undefined) { + return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle); + } else { + // try axis config value + const { + configValue: angle + } = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs); + if (angle !== undefined) { + return normalizeAngle(angle); + } else { + // get default value + if (channel === X && contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) && !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)) { + return 270; + } + // no default + return undefined; + } + } + } + function normalizeAngleExpr(angle) { + return `(((${angle.signal} % 360) + 360) % 360)`; + } + function defaultLabelBaseline(angle, orient, channel, alwaysIncludeMiddle) { + if (angle !== undefined) { + if (channel === 'x') { + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === "top")` : orient === 'top'; + return { + signal: `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? "middle" :` + `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? "bottom" : "top"` + }; + } + if (45 < angle && angle < 135 || 225 < angle && angle < 315) { + return 'middle'; + } + if (isSignalRef(orient)) { + const op = angle <= 45 || 315 <= angle ? '===' : '!=='; + return { + signal: `${orient.signal} ${op} "top" ? "bottom" : "top"` + }; + } + return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top'; + } else { + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === "left")` : orient === 'left'; + const middle = alwaysIncludeMiddle ? '"middle"' : 'null'; + return { + signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? "top" : "bottom"` + }; + } + if (angle <= 45 || 315 <= angle || 135 <= angle && angle <= 225) { + return alwaysIncludeMiddle ? 'middle' : null; + } + if (isSignalRef(orient)) { + const op = 45 <= angle && angle <= 135 ? '===' : '!=='; + return { + signal: `${orient.signal} ${op} "left" ? "top" : "bottom"` + }; + } + return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom'; + } + } + return undefined; + } + function defaultLabelAlign(angle, orient, channel) { + if (angle === undefined) { + return undefined; + } + const isX = channel === 'x'; + const startAngle = isX ? 0 : 90; + const mainOrient = isX ? 'bottom' : 'left'; + if (isSignalRef(angle)) { + const a = normalizeAngleExpr(angle); + const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === "${mainOrient}")` : orient === mainOrient; + return { + signal: `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '"center"'} :` + `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? "left" : "right"` + }; + } + if ((angle + startAngle) % 180 === 0) { + // For bottom, use default label align so label flush still works + return isX ? null : 'center'; + } + if (isSignalRef(orient)) { + const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!=='; + const orientIsMain = `${orient.signal} ${op} "${mainOrient}"`; + return { + signal: `${orientIsMain} ? "left" : "right"` + }; + } + if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) { + return 'left'; + } + return 'right'; + } + function defaultLabelFlush(type, channel) { + if (channel === 'x' && contains(['quantitative', 'temporal'], type)) { + return true; + } + return undefined; + } + function defaultLabelOverlap$1(type, scaleType, hasTimeUnit, sort) { + // do not prevent overlap for nominal data because there is no way to infer what the missing labels are + if (hasTimeUnit && !vega.isObject(sort) || type !== 'nominal' && type !== 'ordinal') { + if (scaleType === 'log' || scaleType === 'symlog') { + return 'greedy'; + } + return true; + } + return undefined; + } + function defaultOrient(channel) { + return channel === 'x' ? 'bottom' : 'left'; + } + function defaultTickCount(_ref17) { + let { + fieldOrDatumDef, + scaleType, + size, + values: vals + } = _ref17; + if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') { + if (isFieldDef(fieldOrDatumDef)) { + if (isBinning(fieldOrDatumDef.bin)) { + // for binned data, we don't want more ticks than maxbins + return { + signal: `ceil(${size.signal}/10)` + }; + } + if (fieldOrDatumDef.timeUnit && contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)) { + return undefined; + } + } + return { + signal: `ceil(${size.signal}/40)` + }; + } + return undefined; + } + function defaultTickMinStep(_ref18) { + let { + format, + fieldOrDatumDef + } = _ref18; + if (format === 'd') { + return 1; + } + if (isFieldDef(fieldOrDatumDef)) { + const { + timeUnit + } = fieldOrDatumDef; + if (timeUnit) { + const signal = durationExpr(timeUnit); + if (signal) { + return { + signal + }; + } + } + } + return undefined; + } + function getFieldDefTitle(model, channel) { + const channel2 = channel === 'x' ? 'x2' : 'y2'; + const fieldDef = model.fieldDef(channel); + const fieldDef2 = model.fieldDef(channel2); + const title1 = fieldDef ? fieldDef.title : undefined; + const title2 = fieldDef2 ? fieldDef2.title : undefined; + if (title1 && title2) { + return mergeTitle(title1, title2); + } else if (title1) { + return title1; + } else if (title2) { + return title2; + } else if (title1 !== undefined) { + // falsy value to disable config + return title1; + } else if (title2 !== undefined) { + // falsy value to disable config + return title2; + } + return undefined; + } + function values$1(axis, fieldOrDatumDef) { + const vals = axis.values; + if (vega.isArray(vals)) { + return valueArray(fieldOrDatumDef, vals); + } else if (isSignalRef(vals)) { + return vals; + } + return undefined; + } + function defaultZindex(mark, fieldDef) { + if (mark === 'rect' && isDiscrete(fieldDef)) { + return 1; + } + return 0; + } + + class CalculateNode extends DataFlowNode { + clone() { + return new CalculateNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + _defineProperty(this, "_dependentFields", void 0); + this._dependentFields = getDependentFields(this.transform.calculate); + } + static parseAllForSortIndex(parent, model) { + // get all the encoding with sort fields from model + model.forEachFieldDef((fieldDef, channel) => { + if (!isScaleFieldDef(fieldDef)) { + return; + } + if (isSortArray(fieldDef.sort)) { + const { + field, + timeUnit + } = fieldDef; + const sort = fieldDef.sort; + // generate `datum["a"] === val0 ? 0 : datum["a"] === val1 ? 1 : ... : n` via FieldEqualPredicate + const calculate = sort.map((sortValue, i) => { + return `${fieldFilterExpression({ + field, + timeUnit, + equal: sortValue + })} ? ${i} : `; + }).join('') + sort.length; + parent = new CalculateNode(parent, { + calculate, + as: sortArrayIndexField(fieldDef, channel, { + forAs: true + }) + }); + } + }); + return parent; + } + producedFields() { + return new Set([this.transform.as]); + } + dependentFields() { + return this._dependentFields; + } + assemble() { + return { + type: 'formula', + expr: this.transform.calculate, + as: this.transform.as + }; + } + hash() { + return `Calculate ${hash(this.transform)}`; + } + } + function sortArrayIndexField(fieldDef, channel, opt) { + return vgField(fieldDef, { + prefix: channel, + suffix: 'sort_index', + ...(opt ?? {}) + }); + } + + /** + * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet. + */ + function getHeaderChannel(channel, orient) { + if (contains(['top', 'bottom'], orient)) { + return 'column'; + } else if (contains(['left', 'right'], orient)) { + return 'row'; + } + return channel === 'row' ? 'row' : 'column'; + } + function getHeaderProperty(prop, header, config, channel) { + const headerSpecificConfig = channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet; + return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]); + } + function getHeaderProperties(properties, header, config, channel) { + const props = {}; + for (const prop of properties) { + const value = getHeaderProperty(prop, header || {}, config, channel); + if (value !== undefined) { + props[prop] = value; + } + } + return props; + } + + /** + * Utility for generating row / column headers + */ + + const HEADER_CHANNELS = ['row', 'column']; + const HEADER_TYPES = ['header', 'footer']; + + /** + * A component that represents all header, footers and title of a Vega group with layout directive. + */ + + /** + * A component that represents one group of row/column-header/footer. + */ + + /** + * Utility for generating row / column headers + */ + + + // TODO: rename to assembleHeaderTitleGroup + function assembleTitleGroup(model, channel) { + const title = model.component.layoutHeaders[channel].title; + const config = model.config ? model.config : undefined; + const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef ? model.component.layoutHeaders[channel].facetFieldDef : undefined; + const { + titleAnchor, + titleAngle: ta, + titleOrient + } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel); + const headerChannel = getHeaderChannel(channel, titleOrient); + const titleAngle = normalizeAngle(ta); + return { + name: `${channel}-title`, + type: 'group', + role: `${headerChannel}-title`, + title: { + text: title, + ...(channel === 'row' ? { + orient: 'left' + } : {}), + style: 'guide-title', + ...defaultHeaderGuideBaseline(titleAngle, headerChannel), + ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor), + ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP) + } + }; + } + function defaultHeaderGuideAlign(headerChannel, angle) { + let anchor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'middle'; + switch (anchor) { + case 'start': + return { + align: 'left' + }; + case 'end': + return { + align: 'right' + }; + } + const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x'); + return align ? { + align + } : {}; + } + function defaultHeaderGuideBaseline(angle, channel) { + const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true); + return baseline ? { + baseline + } : {}; + } + function assembleHeaderGroups(model, channel) { + const layoutHeader = model.component.layoutHeaders[channel]; + const groups = []; + for (const headerType of HEADER_TYPES) { + if (layoutHeader[headerType]) { + for (const headerComponent of layoutHeader[headerType]) { + const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent); + if (group != null) { + groups.push(group); + } + } + } + } + return groups; + } + function getSort$1(facetFieldDef, channel) { + const { + sort + } = facetFieldDef; + if (isSortField(sort)) { + return { + field: vgField(sort, { + expr: 'datum' + }), + order: sort.order ?? 'ascending' + }; + } else if (vega.isArray(sort)) { + return { + field: sortArrayIndexField(facetFieldDef, channel, { + expr: 'datum' + }), + order: 'ascending' + }; + } else { + return { + field: vgField(facetFieldDef, { + expr: 'datum' + }), + order: sort ?? 'ascending' + }; + } + } + function assembleLabelTitle(facetFieldDef, channel, config) { + const { + format, + formatType, + labelAngle, + labelAnchor, + labelOrient, + labelExpr + } = getHeaderProperties(['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'], facetFieldDef.header, config, channel); + const titleTextExpr = formatSignalRef({ + fieldOrDatumDef: facetFieldDef, + format, + formatType, + expr: 'parent', + config + }).signal; + const headerChannel = getHeaderChannel(channel, labelOrient); + return { + text: { + signal: labelExpr ? replaceAll(replaceAll(labelExpr, 'datum.label', titleTextExpr), 'datum.value', vgField(facetFieldDef, { + expr: 'parent' + })) : titleTextExpr + }, + ...(channel === 'row' ? { + orient: 'left' + } : {}), + style: 'guide-label', + frame: 'group', + ...defaultHeaderGuideBaseline(labelAngle, headerChannel), + ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor), + ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP) + }; + } + function assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent) { + if (headerComponent) { + let title = null; + const { + facetFieldDef + } = layoutHeader; + const config = model.config ? model.config : undefined; + if (facetFieldDef && headerComponent.labels) { + const { + labelOrient + } = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel); + + // Include label title in the header if orient aligns with the channel + if (channel === 'row' && !contains(['top', 'bottom'], labelOrient) || channel === 'column' && !contains(['left', 'right'], labelOrient)) { + title = assembleLabelTitle(facetFieldDef, channel, config); + } + } + const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet); + const axes = headerComponent.axes; + const hasAxes = axes?.length > 0; + if (title || hasAxes) { + const sizeChannel = channel === 'row' ? 'height' : 'width'; + return { + name: model.getName(`${channel}_${headerType}`), + type: 'group', + role: `${channel}-${headerType}`, + ...(layoutHeader.facetFieldDef ? { + from: { + data: model.getName(`${channel}_domain`) + }, + sort: getSort$1(facetFieldDef, channel) + } : {}), + ...(hasAxes && isFacetWithoutRowCol ? { + from: { + data: model.getName(`facet_domain_${channel}`) + } + } : {}), + ...(title ? { + title + } : {}), + ...(headerComponent.sizeSignal ? { + encode: { + update: { + [sizeChannel]: headerComponent.sizeSignal + } + } + } : {}), + ...(hasAxes ? { + axes + } : {}) + }; + } + } + return null; + } + const LAYOUT_TITLE_BAND = { + column: { + start: 0, + end: 1 + }, + row: { + start: 1, + end: 0 + } + }; + function getLayoutTitleBand(titleAnchor, headerChannel) { + return LAYOUT_TITLE_BAND[headerChannel][titleAnchor]; + } + function assembleLayoutTitleBand(headerComponentIndex, config) { + const titleBand = {}; + for (const channel of FACET_CHANNELS) { + const headerComponent = headerComponentIndex[channel]; + if (headerComponent?.facetFieldDef) { + const { + titleAnchor, + titleOrient + } = getHeaderProperties(['titleAnchor', 'titleOrient'], headerComponent.facetFieldDef.header, config, channel); + const headerChannel = getHeaderChannel(channel, titleOrient); + const band = getLayoutTitleBand(titleAnchor, headerChannel); + if (band !== undefined) { + titleBand[headerChannel] = band; + } + } + } + return isEmpty(titleBand) ? undefined : titleBand; + } + function assembleHeaderProperties(config, facetFieldDef, channel, properties, propertiesMap) { + const props = {}; + for (const prop of properties) { + if (!propertiesMap[prop]) { + continue; + } + const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel); + if (value !== undefined) { + props[propertiesMap[prop]] = value; + } + } + return props; + } + + function assembleLayoutSignals(model) { + return [...sizeSignals(model, 'width'), ...sizeSignals(model, 'height'), ...sizeSignals(model, 'childWidth'), ...sizeSignals(model, 'childHeight')]; + } + function sizeSignals(model, sizeType) { + const channel = sizeType === 'width' ? 'x' : 'y'; + const size = model.component.layoutSize.get(sizeType); + if (!size || size === 'merged') { + return []; + } + + // Read size signal name from name map, just in case it is the top-level size signal that got renamed. + const name = model.getSizeSignalRef(sizeType).signal; + if (size === 'step') { + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const type = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const scaleName = model.scaleName(channel); + if (isFacetModel(model.parent)) { + // If parent is facet and this is an independent scale, return only signal signal + // as the width/height will be calculated using the cardinality from + // facet's aggregate rather than reading from scale domain + const parentResolve = model.parent.component.resolve; + if (parentResolve.scale[channel] === 'independent') { + return [stepSignal(scaleName, range)]; + } + } + return [stepSignal(scaleName, range), { + name, + update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`) + }]; + } + } + /* istanbul ignore next: Condition should not happen -- only for warning in development. */ + throw new Error('layout size is step although width/height is not step.'); + } else if (size == 'container') { + const isWidth = name.endsWith('width'); + const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]'; + const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height'); + const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`; + return [{ + name, + init: safeExpr, + on: [{ + update: safeExpr, + events: 'window:resize' + }] + }]; + } else { + return [{ + name, + value: size + }]; + } + } + function stepSignal(scaleName, range) { + const name = `${scaleName}_step`; + if (isSignalRef(range.step)) { + return { + name, + update: range.step.signal + }; + } else { + return { + name, + value: range.step + }; + } + } + function sizeExpr(scaleName, scaleComponent, cardinality) { + const type = scaleComponent.get('type'); + const padding = scaleComponent.get('padding'); + const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding); + let paddingInner = scaleComponent.get('paddingInner'); + paddingInner = type === 'band' ? + // only band has real paddingInner + paddingInner !== undefined ? paddingInner : padding : + // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128, + // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points. + 1; + return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(paddingOuter)}) * ${scaleName}_step`; + } + + function getSizeTypeFromLayoutSizeType(layoutSizeType) { + return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType; + } + + function guideEncodeEntry(encoding, model) { + return keys(encoding).reduce((encode, channel) => { + const valueDef = encoding[channel]; + return { + ...encode, + ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value)) + }; + }, {}); + } + + function defaultScaleResolve(channel, model) { + if (isFacetModel(model)) { + return channel === 'theta' ? 'independent' : 'shared'; + } else if (isLayerModel(model)) { + return 'shared'; + } else if (isConcatModel(model)) { + return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared'; + } + /* istanbul ignore next: should never reach here. */ + throw new Error('invalid model type for resolve'); + } + function parseGuideResolve(resolve, channel) { + const channelScaleResolve = resolve.scale[channel]; + const guide = isXorY(channel) ? 'axis' : 'legend'; + if (channelScaleResolve === 'independent') { + if (resolve[guide][channel] === 'shared') { + warn(independentScaleMeansIndependentGuide(channel)); + } + return 'independent'; + } + return resolve[guide][channel] || 'shared'; + } + + const LEGEND_COMPONENT_PROPERTY_INDEX = { + ...COMMON_LEGEND_PROPERTY_INDEX, + disable: 1, + labelExpr: 1, + selections: 1, + // channel scales + opacity: 1, + shape: 1, + stroke: 1, + fill: 1, + size: 1, + strokeWidth: 1, + strokeDash: 1, + // encode + encode: 1 + }; + const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX); + class LegendComponent extends Split {} + + const legendEncodeRules = { + symbols, + gradient, + labels: labels$1, + entries + }; + function symbols(symbolsSpec, _ref) { + let { + fieldOrDatumDef, + model, + channel, + legendCmpt, + legendType + } = _ref; + if (legendType !== 'symbol') { + return undefined; + } + const { + markDef, + encoding, + config, + mark + } = model; + const filled = markDef.filled && mark !== 'trail'; + let out = { + ...applyMarkConfig({}, model, FILL_STROKE_CONFIG), + ...color(model, { + filled + }) + }; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry + + const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity; + const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor; + const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor; + const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined; + if (out.fill) { + // for fill legend, we don't want any fill in symbol + if (channel === 'fill' || filled && channel === COLOR) { + delete out.fill; + } else { + if (out.fill['field']) { + // For others, set fill to some opaque value (or nothing if a color is already set) + if (symbolFillColor) { + delete out.fill; + } else { + out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black'); + out.fillOpacity = signalOrValueRef(opacity ?? 1); + } + } else if (vega.isArray(out.fill)) { + const fill = getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color); + if (fill) { + out.fill = signalOrValueRef(fill); + } + } + } + } + if (out.stroke) { + if (channel === 'stroke' || !filled && channel === COLOR) { + delete out.stroke; + } else { + if (out.stroke['field'] || symbolStrokeColor) { + // For others, remove stroke field + delete out.stroke; + } else if (vega.isArray(out.stroke)) { + const stroke = getFirstDefined(getFirstConditionValue(encoding.stroke || encoding.color), markDef.stroke, filled ? markDef.color : undefined); + if (stroke) { + out.stroke = { + value: stroke + }; + } + } + } + } + if (channel !== OPACITY) { + const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef); + if (condition) { + out.opacity = [{ + test: condition, + ...signalOrValueRef(opacity ?? 1) + }, signalOrValueRef(config.legend.unselectedOpacity)]; + } else if (opacity) { + out.opacity = signalOrValueRef(opacity); + } + } + out = { + ...out, + ...symbolsSpec + }; + return isEmpty(out) ? undefined : out; + } + function gradient(gradientSpec, _ref2) { + let { + model, + legendType, + legendCmpt + } = _ref2; + if (legendType !== 'gradient') { + return undefined; + } + const { + config, + markDef, + encoding + } = model; + let out = {}; + const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity; + const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined; + if (opacity) { + // only apply opacity if it is neither zero or undefined + out.opacity = signalOrValueRef(opacity); + } + out = { + ...out, + ...gradientSpec + }; + return isEmpty(out) ? undefined : out; + } + function labels$1(specifiedlabelsSpec, _ref3) { + let { + fieldOrDatumDef, + model, + channel, + legendCmpt + } = _ref3; + const legend = model.legend(channel) || {}; + const config = model.config; + const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined; + const opacity = condition ? [{ + test: condition, + value: 1 + }, { + value: config.legend.unselectedOpacity + }] : undefined; + const { + format, + formatType + } = legend; + let text = undefined; + if (isCustomFormatType(formatType)) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format, + formatType, + config + }); + } else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.numberFormat, + formatType: config.numberFormatType, + config + }); + } else if (fieldOrDatumDef.type === 'temporal' && config.timeFormatType && isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit === undefined) { + text = formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.timeFormat, + formatType: config.timeFormatType, + config + }); + } + } + const labelsSpec = { + ...(opacity ? { + opacity + } : {}), + ...(text ? { + text + } : {}), + ...specifiedlabelsSpec + }; + return isEmpty(labelsSpec) ? undefined : labelsSpec; + } + function entries(entriesSpec, _ref4) { + let { + legendCmpt + } = _ref4; + const selections = legendCmpt.get('selections'); + return selections?.length ? { + ...entriesSpec, + fill: { + value: 'transparent' + } + } : entriesSpec; + } + function getMaxValue(channelDef) { + return getConditionValue(channelDef, (v, conditionalDef) => Math.max(v, conditionalDef.value)); + } + function getFirstConditionValue(channelDef) { + return getConditionValue(channelDef, (v, conditionalDef) => { + return getFirstDefined(v, conditionalDef.value); + }); + } + function getConditionValue(channelDef, reducer) { + if (hasConditionalValueDef(channelDef)) { + return vega.array(channelDef.condition).reduce(reducer, channelDef.value); + } else if (isValueDef(channelDef)) { + return channelDef.value; + } + return undefined; + } + function selectedCondition(model, legendCmpt, fieldDef) { + const selections = legendCmpt.get('selections'); + if (!selections?.length) return undefined; + const field = vega.stringValue(fieldDef.field); + return selections.map(name => { + const store = vega.stringValue(varName(name) + STORE); + return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`; + }).join(' || '); + } + + const legendRules = { + direction: _ref => { + let { + direction + } = _ref; + return direction; + }, + format: _ref2 => { + let { + fieldOrDatumDef, + legend, + config + } = _ref2; + const { + format, + formatType + } = legend; + return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false); + }, + formatType: _ref3 => { + let { + legend, + fieldOrDatumDef, + scaleType + } = _ref3; + const { + formatType + } = legend; + return guideFormatType(formatType, fieldOrDatumDef, scaleType); + }, + gradientLength: params => { + const { + legend, + legendConfig + } = params; + return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params); + }, + labelOverlap: _ref4 => { + let { + legend, + legendConfig, + scaleType + } = _ref4; + return legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType); + }, + symbolType: _ref5 => { + let { + legend, + markDef, + channel, + encoding + } = _ref5; + return legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape); + }, + title: _ref6 => { + let { + fieldOrDatumDef, + config + } = _ref6; + return title(fieldOrDatumDef, config, { + allowDisabling: true + }); + }, + type: _ref7 => { + let { + legendType, + scaleType, + channel + } = _ref7; + if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) { + if (legendType === 'gradient') { + return undefined; + } + } else if (legendType === 'symbol') { + return undefined; + } + return legendType; + }, + // depended by other property, let's define upfront + + values: _ref8 => { + let { + fieldOrDatumDef, + legend + } = _ref8; + return values(legend, fieldOrDatumDef); + } + }; + function values(legend, fieldOrDatumDef) { + const vals = legend.values; + if (vega.isArray(vals)) { + return valueArray(fieldOrDatumDef, vals); + } else if (isSignalRef(vals)) { + return vals; + } + return undefined; + } + function defaultSymbolType(mark, channel, shapeChannelDef, markShape) { + if (channel !== 'shape') { + // use the value from the shape encoding or the mark config if they exist + const shape = getFirstConditionValue(shapeChannelDef) ?? markShape; + if (shape) { + return shape; + } + } + switch (mark) { + case 'bar': + case 'rect': + case 'image': + case 'square': + return 'square'; + case 'line': + case 'trail': + case 'rule': + return 'stroke'; + case 'arc': + case 'point': + case 'circle': + case 'tick': + case 'geoshape': + case 'area': + case 'text': + return 'circle'; + } + } + function getLegendType(params) { + const { + legend + } = params; + return getFirstDefined(legend.type, defaultType$1(params)); + } + function defaultType$1(_ref9) { + let { + channel, + timeUnit, + scaleType + } = _ref9; + // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js + + if (isColorChannel(channel)) { + if (contains(['quarter', 'month', 'day'], timeUnit)) { + return 'symbol'; + } + if (isContinuousToContinuous(scaleType)) { + return 'gradient'; + } + } + return 'symbol'; + } + function getDirection(_ref10) { + let { + legendConfig, + legendType, + orient, + legend + } = _ref10; + return legend.direction ?? legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ?? defaultDirection(orient, legendType); + } + function defaultDirection(orient, legendType) { + switch (orient) { + case 'top': + case 'bottom': + return 'horizontal'; + case 'left': + case 'right': + case 'none': + case undefined: + // undefined = "right" in Vega + return undefined; + // vertical is Vega's default + default: + // top-left / ... + // For inner legend, uses compact layout like Tableau + return legendType === 'gradient' ? 'horizontal' : undefined; + } + } + function defaultGradientLength(_ref11) { + let { + legendConfig, + model, + direction, + orient, + scaleType + } = _ref11; + const { + gradientHorizontalMaxLength, + gradientHorizontalMinLength, + gradientVerticalMaxLength, + gradientVerticalMinLength + } = legendConfig; + if (isContinuousToContinuous(scaleType)) { + if (direction === 'horizontal') { + if (orient === 'top' || orient === 'bottom') { + return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength); + } else { + return gradientHorizontalMinLength; + } + } else { + // vertical / undefined (Vega uses vertical by default) + return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength); + } + } + return undefined; + } + function gradientLengthSignal(model, sizeType, min, max) { + const sizeSignal = model.getSizeSignalRef(sizeType).signal; + return { + signal: `clamp(${sizeSignal}, ${min}, ${max})` + }; + } + function defaultLabelOverlap(scaleType) { + if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) { + return 'greedy'; + } + return undefined; + } + + function parseLegend(model) { + const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model); + model.component.legends = legendComponent; + return legendComponent; + } + function parseUnitLegend(model) { + const { + encoding + } = model; + const legendComponent = {}; + for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) { + const def = getFieldOrDatumDef(encoding[channel]); + if (!def || !model.getScaleComponent(channel)) { + continue; + } + if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) { + continue; + } + legendComponent[channel] = parseLegendForChannel(model, channel); + } + return legendComponent; + } + function getLegendDefWithScale(model, channel) { + const scale = model.scaleName(channel); + if (model.mark === 'trail') { + if (channel === 'color') { + // trail is a filled mark, but its default symbolType ("stroke") should use "stroke" + return { + stroke: scale + }; + } else if (channel === 'size') { + return { + strokeWidth: scale + }; + } + } + if (channel === 'color') { + return model.markDef.filled ? { + fill: scale + } : { + stroke: scale + }; + } + return { + [channel]: scale + }; + } + + // eslint-disable-next-line @typescript-eslint/ban-types + function isExplicit$1(value, property, legend, fieldDef) { + switch (property) { + case 'disable': + return legend !== undefined; + // if axis is specified or null/false, then its enable/disable state is explicit + case 'values': + // specified legend.values is already respected, but may get transformed. + return !!legend?.values; + case 'title': + // title can be explicit if fieldDef.title is set + if (property === 'title' && value === fieldDef?.title) { + return true; + } + } + // Otherwise, things are explicit if the returned value matches the specified property + return value === (legend || {})[property]; + } + function parseLegendForChannel(model, channel) { + let legend = model.legend(channel); + const { + markDef, + encoding, + config + } = model; + const legendConfig = config.legend; + const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel)); + parseInteractiveLegend(model, channel, legendCmpt); + const disable = legend !== undefined ? !legend : legendConfig.disable; + legendCmpt.set('disable', disable, legend !== undefined); + if (disable) { + return legendCmpt; + } + legend = legend || {}; + const scaleType = model.getScaleComponent(channel).get('type'); + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined; + const orient = legend.orient || config.legend.orient || 'right'; + const legendType = getLegendType({ + legend, + channel, + timeUnit, + scaleType + }); + const direction = getDirection({ + legend, + legendType, + orient, + legendConfig + }); + const ruleParams = { + legend, + channel, + model, + markDef, + encoding, + fieldOrDatumDef, + legendConfig, + config, + scaleType, + orient, + legendType, + direction + }; + for (const property of LEGEND_COMPONENT_PROPERTIES) { + if (legendType === 'gradient' && property.startsWith('symbol') || legendType === 'symbol' && property.startsWith('gradient')) { + continue; + } + const value = property in legendRules ? legendRules[property](ruleParams) : legend[property]; + if (value !== undefined) { + const explicit = isExplicit$1(value, property, legend, model.fieldDef(channel)); + if (explicit || config.legend[property] === undefined) { + legendCmpt.set(property, value, explicit); + } + } + } + const legendEncoding = legend?.encoding ?? {}; + const selections = legendCmpt.get('selections'); + const legendEncode = {}; + const legendEncodeParams = { + fieldOrDatumDef, + model, + channel, + legendCmpt, + legendType + }; + for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) { + const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model); + const value = part in legendEncodeRules ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule + : legendEncodingPart; // no rule -- just default values + + if (value !== undefined && !isEmpty(value)) { + legendEncode[part] = { + ...(selections?.length && isFieldDef(fieldOrDatumDef) ? { + name: `${varName(fieldOrDatumDef.field)}_legend_${part}` + } : {}), + ...(selections?.length ? { + interactive: !!selections + } : {}), + update: value + }; + } + } + if (!isEmpty(legendEncode)) { + legendCmpt.set('encode', legendEncode, !!legend?.encoding); + } + return legendCmpt; + } + function parseNonUnitLegend(model) { + const { + legends, + resolve + } = model.component; + for (const child of model.children) { + parseLegend(child); + for (const channel of keys(child.component.legends)) { + resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel); + if (resolve.legend[channel] === 'shared') { + // If the resolve says shared (and has not been overridden) + // We will try to merge and see if there is a conflict + + legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]); + if (!legends[channel]) { + // If merge returns nothing, there is a conflict so we cannot make the legend shared. + // Thus, mark legend as independent and remove the legend component. + resolve.legend[channel] = 'independent'; + delete legends[channel]; + } + } + } + } + for (const channel of keys(legends)) { + for (const child of model.children) { + if (!child.component.legends[channel]) { + // skip if the child does not have a particular legend + continue; + } + if (resolve.legend[channel] === 'shared') { + // After merging shared legend, make sure to remove legend from child + delete child.component.legends[channel]; + } + } + } + return legends; + } + function mergeLegendComponent(mergedLegend, childLegend) { + if (!mergedLegend) { + return childLegend.clone(); + } + const mergedOrient = mergedLegend.getWithExplicit('orient'); + const childOrient = childLegend.getWithExplicit('orient'); + if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { + // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) + // Cannot merge due to inconsistent orient + return undefined; + } + let typeMerged = false; + // Otherwise, let's merge + for (const prop of LEGEND_COMPONENT_PROPERTIES) { + const mergedValueWithExplicit = mergeValuesWithExplicit(mergedLegend.getWithExplicit(prop), childLegend.getWithExplicit(prop), prop, 'legend', + // Tie breaker function + (v1, v2) => { + switch (prop) { + case 'symbolType': + return mergeSymbolType(v1, v2); + case 'title': + return mergeTitleComponent(v1, v2); + case 'type': + // There are only two types. If we have different types, then prefer symbol over gradient. + typeMerged = true; + return makeImplicit('symbol'); + } + return defaultTieBreaker(v1, v2, prop, 'legend'); + }); + mergedLegend.setWithExplicit(prop, mergedValueWithExplicit); + } + if (typeMerged) { + if (mergedLegend.implicit?.encode?.gradient) { + deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']); + } + if (mergedLegend.explicit?.encode?.gradient) { + deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']); + } + } + return mergedLegend; + } + function mergeSymbolType(st1, st2) { + if (st2.value === 'circle') { + // prefer "circle" over "stroke" + return st2; + } + return st1; + } + + function setLegendEncode(legend, part, vgProp, vgRef) { + legend.encode ??= {}; + legend.encode[part] ??= {}; + legend.encode[part].update ??= {}; + // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291 + legend.encode[part].update[vgProp] = vgRef; + } + function assembleLegends(model) { + const legendComponentIndex = model.component.legends; + const legendByDomain = {}; + for (const channel of keys(legendComponentIndex)) { + const scaleComponent = model.getScaleComponent(channel); + const domainHash = stringify(scaleComponent.get('domains')); + if (legendByDomain[domainHash]) { + for (const mergedLegendComponent of legendByDomain[domainHash]) { + const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]); + if (!merged) { + // If cannot merge, need to add this legend separately + legendByDomain[domainHash].push(legendComponentIndex[channel]); + } + } + } else { + legendByDomain[domainHash] = [legendComponentIndex[channel].clone()]; + } + } + const legends = vals(legendByDomain).flat().map(l => assembleLegend(l, model.config)).filter(l => l !== undefined); + return legends; + } + function assembleLegend(legendCmpt, config) { + const { + disable, + labelExpr, + selections, + ...legend + } = legendCmpt.combine(); + if (disable) { + return undefined; + } + if (config.aria === false && legend.aria == undefined) { + legend.aria = false; + } + if (legend.encode?.symbols) { + const out = legend.encode.symbols.update; + if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) { + // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used. + out.stroke = { + value: 'transparent' + }; + } + + // Remove properties that the legend is encoding. + for (const property of LEGEND_SCALE_CHANNELS) { + if (legend[property]) { + delete out[property]; + } + } + } + if (!legend.title) { + // title schema doesn't include null, '' + delete legend.title; + } + if (labelExpr !== undefined) { + let expr = labelExpr; + if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) { + expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal); + } + setLegendEncode(legend, 'labels', 'text', { + signal: expr + }); + } + return legend; + } + + function assembleProjections(model) { + if (isLayerModel(model) || isConcatModel(model)) { + return assembleProjectionsForModelAndChildren(model); + } else { + return assembleProjectionForModel(model); + } + } + function assembleProjectionsForModelAndChildren(model) { + return model.children.reduce((projections, child) => { + return projections.concat(child.assembleProjections()); + }, assembleProjectionForModel(model)); + } + function assembleProjectionForModel(model) { + const component = model.component.projection; + if (!component || component.merged) { + return []; + } + const projection = component.combine(); + const { + name + } = projection; // we need to extract name so that it is always present in the output and pass TS type validation + + if (!component.data) { + // generate custom projection, no automatic fitting + return [{ + name, + // translate to center by default + ...{ + translate: { + signal: '[width / 2, height / 2]' + } + }, + // parameters, overwrite default translate if specified + ...projection + }]; + } else { + // generate projection that uses extent fitting + const size = { + signal: `[${component.size.map(ref => ref.signal).join(', ')}]` + }; + const fits = component.data.reduce((sources, data) => { + const source = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`; + if (!contains(sources, source)) { + // build a unique list of sources + sources.push(source); + } + return sources; + }, []); + if (fits.length <= 0) { + throw new Error("Projection's fit didn't find any data sources"); + } + return [{ + name, + size, + fit: { + signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0] + }, + ...projection + }]; + } + } + + /** + * Any property of Projection can be in config + */ + + const PROJECTION_PROPERTIES = ['type', 'clipAngle', 'clipExtent', 'center', 'rotate', 'precision', 'reflectX', 'reflectY', 'coefficient', 'distance', 'fraction', 'lobes', 'parallel', 'radius', 'ratio', 'spacing', 'tilt']; + + class ProjectionComponent extends Split { + constructor(name, specifiedProjection, size, data) { + super({ + ...specifiedProjection + }, + // all explicit properties of projection + { + name + } // name as initial implicit property + ); + this.specifiedProjection = specifiedProjection; + this.size = size; + this.data = data; + _defineProperty(this, "merged", false); + } + + /** + * Whether the projection parameters should fit provided data. + */ + get isFit() { + return !!this.data; + } + } + + function parseProjection(model) { + model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model); + } + function parseUnitProjection(model) { + if (model.hasProjection) { + const proj = replaceExprRef(model.specifiedProjection); + const fit = !(proj && (proj.scale != null || proj.translate != null)); + const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined; + const data = fit ? gatherFitData(model) : undefined; + const projComp = new ProjectionComponent(model.projectionName(true), { + ...(replaceExprRef(model.config.projection) ?? {}), + ...(proj ?? {}) + }, size, data); + if (!projComp.get('type')) { + projComp.set('type', 'equalEarth', false); + } + return projComp; + } + return undefined; + } + function gatherFitData(model) { + const data = []; + const { + encoding + } = model; + for (const posssiblePair of [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]) { + if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) { + data.push({ + signal: model.getName(`geojson_${data.length}`) + }); + } + } + if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) { + data.push({ + signal: model.getName(`geojson_${data.length}`) + }); + } + if (data.length === 0) { + // main source is geojson, so we can just use that + data.push(model.requestDataName(DataSourceType.Main)); + } + return data; + } + function mergeIfNoConflict(first, second) { + const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => { + // neither has the property + if (!vega.hasOwnProperty(first.explicit, prop) && !vega.hasOwnProperty(second.explicit, prop)) { + return true; + } + // both have property and an equal value for property + if (vega.hasOwnProperty(first.explicit, prop) && vega.hasOwnProperty(second.explicit, prop) && + // some properties might be signals or objects and require hashing for comparison + deepEqual(first.get(prop), second.get(prop))) { + return true; + } + return false; + }); + const size = deepEqual(first.size, second.size); + if (size) { + if (allPropertiesShared) { + return first; + } else if (deepEqual(first.explicit, {})) { + return second; + } else if (deepEqual(second.explicit, {})) { + return first; + } + } + + // if all properties don't match, let each unit spec have its own projection + return null; + } + function parseNonUnitProjections(model) { + if (model.children.length === 0) { + return undefined; + } + let nonUnitProjection; + + // parse all children first + for (const child of model.children) { + parseProjection(child); + } + + // analyze parsed projections, attempt to merge + const mergable = every(model.children, child => { + const projection = child.component.projection; + if (!projection) { + // child layer does not use a projection + return true; + } else if (!nonUnitProjection) { + // cached 'projection' is null, cache this one + nonUnitProjection = projection; + return true; + } else { + const merge = mergeIfNoConflict(nonUnitProjection, projection); + if (merge) { + nonUnitProjection = merge; + } + return !!merge; + } + }); + + // if cached one and all other children share the same projection, + if (nonUnitProjection && mergable) { + // so we can elevate it to the layer level + const name = model.projectionName(true); + const modelProjection = new ProjectionComponent(name, nonUnitProjection.specifiedProjection, nonUnitProjection.size, duplicate(nonUnitProjection.data)); + + // rename and assign all others as merged + for (const child of model.children) { + const projection = child.component.projection; + if (projection) { + if (projection.isFit) { + modelProjection.data.push(...child.component.projection.data); + } + child.renameProjection(projection.get('name'), name); + projection.merged = true; + } + } + return modelProjection; + } + return undefined; + } + + function rangeFormula(model, fieldDef, channel, config) { + if (binRequiresRange(fieldDef, channel)) { + // read format from axis or legend, if there is no format then use config.numberFormat + + const guide = isUnitModel(model) ? model.axis(channel) ?? model.legend(channel) ?? {} : {}; + const startField = vgField(fieldDef, { + expr: 'datum' + }); + const endField = vgField(fieldDef, { + expr: 'datum', + binSuffix: 'end' + }); + return { + formulaAs: vgField(fieldDef, { + binSuffix: 'range', + forAs: true + }), + formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config) + }; + } + return {}; + } + function binKey(bin, field) { + return `${binToString(bin)}_${field}`; + } + function getSignalsFromModel(model, key) { + return { + signal: model.getName(`${key}_bins`), + extentSignal: model.getName(`${key}_extent`) + }; + } + function getBinSignalName(model, field, bin) { + const normalizedBin = normalizeBin(bin, undefined) ?? {}; + const key = binKey(normalizedBin, field); + return model.getName(`${key}_bins`); + } + function isBinTransform(t) { + return 'as' in t; + } + function createBinComponent(t, bin, model) { + let as; + let span; + if (isBinTransform(t)) { + as = vega.isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]]; + } else { + as = [vgField(t, { + forAs: true + }), vgField(t, { + binSuffix: 'end', + forAs: true + })]; + } + const normalizedBin = { + ...normalizeBin(bin, undefined) + }; + const key = binKey(normalizedBin, t.field); + const { + signal, + extentSignal + } = getSignalsFromModel(model, key); + if (isParameterExtent(normalizedBin.extent)) { + const ext = normalizedBin.extent; + span = parseSelectionExtent(model, ext.param, ext); + delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property. + } + + const binComponent = { + bin: normalizedBin, + field: t.field, + as: [as], + ...(signal ? { + signal + } : {}), + ...(extentSignal ? { + extentSignal + } : {}), + ...(span ? { + span + } : {}) + }; + return { + key, + binComponent + }; + } + class BinNode extends DataFlowNode { + clone() { + return new BinNode(null, duplicate(this.bins)); + } + constructor(parent, bins) { + super(parent); + this.bins = bins; + } + static makeFromEncoding(parent, model) { + const bins = model.reduceFieldDef((binComponentIndex, fieldDef, channel) => { + if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) { + const { + key, + binComponent + } = createBinComponent(fieldDef, fieldDef.bin, model); + binComponentIndex[key] = { + ...binComponent, + ...binComponentIndex[key], + ...rangeFormula(model, fieldDef, channel, model.config) + }; + } + return binComponentIndex; + }, {}); + if (isEmpty(bins)) { + return null; + } + return new BinNode(parent, bins); + } + + /** + * Creates a bin node from BinTransform. + * The optional parameter should provide + */ + static makeFromTransform(parent, t, model) { + const { + key, + binComponent + } = createBinComponent(t, t.bin, model); + return new BinNode(parent, { + [key]: binComponent + }); + } + + /** + * Merge bin nodes. This method either integrates the bin config from the other node + * or if this node already has a bin config, renames the corresponding signal in the model. + */ + merge(other, renameSignal) { + for (const key of keys(other.bins)) { + if (key in this.bins) { + renameSignal(other.bins[key].signal, this.bins[key].signal); + // Ensure that we don't have duplicate names for signal pairs + this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash); + } else { + this.bins[key] = other.bins[key]; + } + } + for (const child of other.children) { + other.removeChild(child); + child.parent = this; + } + other.remove(); + } + producedFields() { + return new Set(vals(this.bins).map(c => c.as).flat(2)); + } + dependentFields() { + return new Set(vals(this.bins).map(c => c.field)); + } + hash() { + return `Bin ${hash(this.bins)}`; + } + assemble() { + return vals(this.bins).flatMap(bin => { + const transform = []; + const [binAs, ...remainingAs] = bin.as; + const { + extent, + ...params + } = bin.bin; + const binTrans = { + type: 'bin', + field: replacePathInField(bin.field), + as: binAs, + signal: bin.signal, + ...(!isParameterExtent(extent) ? { + extent + } : { + extent: null + }), + ...(bin.span ? { + span: { + signal: `span(${bin.span})` + } + } : {}), + ...params + }; + if (!extent && bin.extentSignal) { + transform.push({ + type: 'extent', + field: replacePathInField(bin.field), + signal: bin.extentSignal + }); + binTrans.extent = { + signal: bin.extentSignal + }; + } + transform.push(binTrans); + for (const as of remainingAs) { + for (let i = 0; i < 2; i++) { + transform.push({ + type: 'formula', + expr: vgField({ + field: binAs[i] + }, { + expr: 'datum' + }), + as: as[i] + }); + } + } + if (bin.formula) { + transform.push({ + type: 'formula', + expr: bin.formula, + as: bin.formulaAs + }); + } + return transform; + }); + } + } + + function addDimension(dims, channel, fieldDef, model) { + const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined; + if (isTypedFieldDef(fieldDef) && isUnitModel(model) && hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)) { + dims.add(vgField(fieldDef, {})); + dims.add(vgField(fieldDef, { + suffix: 'end' + })); + const { + mark, + markDef, + config + } = model; + const bandPosition = getBandPosition({ + fieldDef, + markDef, + config + }); + if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) { + dims.add(vgField(fieldDef, { + suffix: OFFSETTED_RECT_START_SUFFIX + })); + dims.add(vgField(fieldDef, { + suffix: OFFSETTED_RECT_END_SUFFIX + })); + } + if (fieldDef.bin && binRequiresRange(fieldDef, channel)) { + dims.add(vgField(fieldDef, { + binSuffix: 'range' + })); + } + } else if (isGeoPositionChannel(channel)) { + const posChannel = getPositionChannelFromLatLong(channel); + dims.add(model.getName(posChannel)); + } else { + dims.add(vgField(fieldDef)); + } + if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) { + dims.add(fieldDef.scale.range.field); + } + return dims; + } + function mergeMeasures(parentMeasures, childMeasures) { + for (const field of keys(childMeasures)) { + // when we merge a measure, we either have to add an aggregation operator or even a new field + const ops = childMeasures[field]; + for (const op of keys(ops)) { + if (field in parentMeasures) { + // add operator to existing measure field + parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]); + } else { + parentMeasures[field] = { + [op]: ops[op] + }; + } + } + } + } + class AggregateNode extends DataFlowNode { + clone() { + return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures)); + } + + /** + * @param dimensions string set for dimensions + * @param measures dictionary mapping field name => dict of aggregation functions and names to use + */ + constructor(parent, dimensions, measures) { + super(parent); + this.dimensions = dimensions; + this.measures = measures; + } + get groupBy() { + return this.dimensions; + } + static makeFromEncoding(parent, model) { + let isAggregate = false; + model.forEachFieldDef(fd => { + if (fd.aggregate) { + isAggregate = true; + } + }); + const meas = {}; + const dims = new Set(); + if (!isAggregate) { + // no need to create this node if the model has no aggregation + return null; + } + model.forEachFieldDef((fieldDef, channel) => { + const { + aggregate, + field + } = fieldDef; + if (aggregate) { + if (aggregate === 'count') { + meas['*'] ??= {}; + meas['*']['count'] = new Set([vgField(fieldDef, { + forAs: true + })]); + } else { + if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { + const op = isArgminDef(aggregate) ? 'argmin' : 'argmax'; + const argField = aggregate[op]; + meas[argField] ??= {}; + meas[argField][op] = new Set([vgField({ + op, + field: argField + }, { + forAs: true + })]); + } else { + meas[field] ??= {}; + meas[field][aggregate] = new Set([vgField(fieldDef, { + forAs: true + })]); + } + + // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain + if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') { + meas[field] ??= {}; + meas[field]['min'] = new Set([vgField({ + field, + aggregate: 'min' + }, { + forAs: true + })]); + meas[field]['max'] = new Set([vgField({ + field, + aggregate: 'max' + }, { + forAs: true + })]); + } + } + } else { + addDimension(dims, channel, fieldDef, model); + } + }); + if (dims.size + keys(meas).length === 0) { + return null; + } + return new AggregateNode(parent, dims, meas); + } + static makeFromTransform(parent, t) { + const dims = new Set(); + const meas = {}; + for (const s of t.aggregate) { + const { + op, + field, + as + } = s; + if (op) { + if (op === 'count') { + meas['*'] ??= {}; + meas['*']['count'] = new Set([as ? as : vgField(s, { + forAs: true + })]); + } else { + meas[field] ??= {}; + meas[field][op] = new Set([as ? as : vgField(s, { + forAs: true + })]); + } + } + } + for (const s of t.groupby ?? []) { + dims.add(s); + } + if (dims.size + keys(meas).length === 0) { + return null; + } + return new AggregateNode(parent, dims, meas); + } + merge(other) { + if (setEqual(this.dimensions, other.dimensions)) { + mergeMeasures(this.measures, other.measures); + return true; + } + debug('different dimensions, cannot merge'); + return false; + } + addDimensions(fields) { + fields.forEach(this.dimensions.add, this.dimensions); + } + dependentFields() { + return new Set([...this.dimensions, ...keys(this.measures)]); + } + producedFields() { + const out = new Set(); + for (const field of keys(this.measures)) { + for (const op of keys(this.measures[field])) { + const m = this.measures[field][op]; + if (m.size === 0) { + out.add(`${op}_${field}`); + } else { + m.forEach(out.add, out); + } + } + } + return out; + } + hash() { + return `Aggregate ${hash({ + dimensions: this.dimensions, + measures: this.measures + })}`; + } + assemble() { + const ops = []; + const fields = []; + const as = []; + for (const field of keys(this.measures)) { + for (const op of keys(this.measures[field])) { + for (const alias of this.measures[field][op]) { + as.push(alias); + ops.push(op); + fields.push(field === '*' ? null : replacePathInField(field)); + } + } + } + const result = { + type: 'aggregate', + groupby: [...this.dimensions].map(replacePathInField), + ops, + fields, + as + }; + return result; + } + } + + /** + * A node that helps us track what fields we are faceting by. + */ + class FacetNode extends DataFlowNode { + /** + * @param model The facet model. + * @param name The name that this facet source will have. + * @param data The source data for this facet data. + */ + constructor(parent, model, name, data) { + super(parent); + this.model = model; + this.name = name; + this.data = data; + _defineProperty(this, "column", void 0); + _defineProperty(this, "row", void 0); + _defineProperty(this, "facet", void 0); + _defineProperty(this, "childModel", void 0); + for (const channel of FACET_CHANNELS) { + const fieldDef = model.facet[channel]; + if (fieldDef) { + const { + bin, + sort + } = fieldDef; + this[channel] = { + name: model.getName(`${channel}_domain`), + fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, { + binSuffix: 'end' + })] : [])], + ...(isSortField(sort) ? { + sortField: sort + } : vega.isArray(sort) ? { + sortIndexField: sortArrayIndexField(fieldDef, channel) + } : {}) + }; + } + } + this.childModel = model.child; + } + hash() { + let out = `Facet`; + for (const channel of FACET_CHANNELS) { + if (this[channel]) { + out += ` ${channel.charAt(0)}:${hash(this[channel])}`; + } + } + return out; + } + get fields() { + const f = []; + for (const channel of FACET_CHANNELS) { + if (this[channel]?.fields) { + f.push(...this[channel].fields); + } + } + return f; + } + dependentFields() { + const depFields = new Set(this.fields); + for (const channel of FACET_CHANNELS) { + if (this[channel]) { + if (this[channel].sortField) { + depFields.add(this[channel].sortField.field); + } + if (this[channel].sortIndexField) { + depFields.add(this[channel].sortIndexField); + } + } + } + return depFields; + } + producedFields() { + return new Set(); // facet does not produce any new fields + } + + /** + * The name to reference this source is its name. + */ + getSource() { + return this.name; + } + getChildIndependentFieldsWithStep() { + const childIndependentFieldsWithStep = {}; + for (const channel of POSITION_SCALE_CHANNELS) { + const childScaleComponent = this.childModel.component.scales[channel]; + if (childScaleComponent && !childScaleComponent.merged) { + // independent scale + const type = childScaleComponent.get('type'); + const range = childScaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const domain = assembleDomain(this.childModel, channel); + const field = getFieldFromDomain(domain); + if (field) { + childIndependentFieldsWithStep[channel] = field; + } else { + warn(unknownField(channel)); + } + } + } + } + return childIndependentFieldsWithStep; + } + assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep) { + const childChannel = { + row: 'y', + column: 'x', + facet: undefined + }[channel]; + const fields = []; + const ops = []; + const as = []; + if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) { + if (crossedDataName) { + // If there is a crossed data, calculate max + fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); + ops.push('max'); + } else { + // If there is no crossed data, just calculate distinct + fields.push(childIndependentFieldsWithStep[childChannel]); + ops.push('distinct'); + } + // Although it is technically a max, just name it distinct so it's easier to refer to it + as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`); + } + const { + sortField, + sortIndexField + } = this[channel]; + if (sortField) { + const { + op = DEFAULT_SORT_OP, + field + } = sortField; + fields.push(field); + ops.push(op); + as.push(vgField(sortField, { + forAs: true + })); + } else if (sortIndexField) { + fields.push(sortIndexField); + ops.push('max'); + as.push(sortIndexField); + } + return { + name: this[channel].name, + // Use data from the crossed one if it exist + source: crossedDataName ?? this.data, + transform: [{ + type: 'aggregate', + groupby: this[channel].fields, + ...(fields.length ? { + fields, + ops, + as + } : {}) + }] + }; + } + assembleFacetHeaderData(childIndependentFieldsWithStep) { + const { + columns + } = this.model.layout; + const { + layoutHeaders + } = this.model.component; + const data = []; + const hasSharedAxis = {}; + for (const headerChannel of HEADER_CHANNELS) { + for (const headerType of HEADER_TYPES) { + const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? []; + for (const header of headers) { + if (header.axes?.length > 0) { + hasSharedAxis[headerChannel] = true; + break; + } + } + } + if (hasSharedAxis[headerChannel]) { + const cardinality = `length(data("${this.facet.name}"))`; + const stop = headerChannel === 'row' ? columns ? { + signal: `ceil(${cardinality} / ${columns})` + } : 1 : columns ? { + signal: `min(${cardinality}, ${columns})` + } : { + signal: cardinality + }; + data.push({ + name: `${this.facet.name}_${headerChannel}`, + transform: [{ + type: 'sequence', + start: 0, + stop + }] + }); + } + } + const { + row, + column + } = hasSharedAxis; + if (row || column) { + data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep)); + } + return data; + } + assemble() { + const data = []; + let crossedDataName = null; + const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep(); + const { + column, + row, + facet + } = this; + if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) { + // Need to create a cross dataset to correctly calculate cardinality + crossedDataName = `cross_${this.column.name}_${this.row.name}`; + const fields = [].concat(childIndependentFieldsWithStep.x ?? [], childIndependentFieldsWithStep.y ?? []); + const ops = fields.map(() => 'distinct'); + data.push({ + name: crossedDataName, + source: this.data, + transform: [{ + type: 'aggregate', + groupby: this.fields, + fields, + ops + }] + }); + } + for (const channel of [COLUMN, ROW]) { + if (this[channel]) { + data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep)); + } + } + if (facet) { + const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep); + if (facetData) { + data.push(...facetData); + } + } + return data; + } + } + + /** + * Remove quotes from a string. + */ + function unquote(pattern) { + if (pattern.startsWith("'") && pattern.endsWith("'") || pattern.startsWith('"') && pattern.endsWith('"')) { + return pattern.slice(1, -1); + } + return pattern; + } + + /** + * @param field The field. + * @param parse What to parse the field as. + */ + function parseExpression(field, parse) { + const f = accessPathWithDatum(field); + if (parse === 'number') { + return `toNumber(${f})`; + } else if (parse === 'boolean') { + return `toBoolean(${f})`; + } else if (parse === 'string') { + return `toString(${f})`; + } else if (parse === 'date') { + return `toDate(${f})`; + } else if (parse === 'flatten') { + return f; + } else if (parse.startsWith('date:')) { + const specifier = unquote(parse.slice(5, parse.length)); + return `timeParse(${f},'${specifier}')`; + } else if (parse.startsWith('utc:')) { + const specifier = unquote(parse.slice(4, parse.length)); + return `utcParse(${f},'${specifier}')`; + } else { + warn(unrecognizedParse(parse)); + return null; + } + } + function getImplicitFromFilterTransform(transform) { + const implicit = {}; + forEachLeaf(transform.filter, filter => { + if (isFieldPredicate(filter)) { + // Automatically add a parse node for filters with filter objects + let val = null; + + // For EqualFilter, just use the equal property. + // For RangeFilter and OneOfFilter, all array members should have + // the same type, so we only use the first one. + if (isFieldEqualPredicate(filter)) { + val = signalRefOrValue(filter.equal); + } else if (isFieldLTEPredicate(filter)) { + val = signalRefOrValue(filter.lte); + } else if (isFieldLTPredicate(filter)) { + val = signalRefOrValue(filter.lt); + } else if (isFieldGTPredicate(filter)) { + val = signalRefOrValue(filter.gt); + } else if (isFieldGTEPredicate(filter)) { + val = signalRefOrValue(filter.gte); + } else if (isFieldRangePredicate(filter)) { + val = filter.range[0]; + } else if (isFieldOneOfPredicate(filter)) { + val = (filter.oneOf ?? filter['in'])[0]; + } // else -- for filter expression, we can't infer anything + + if (val) { + if (isDateTime(val)) { + implicit[filter.field] = 'date'; + } else if (vega.isNumber(val)) { + implicit[filter.field] = 'number'; + } else if (vega.isString(val)) { + implicit[filter.field] = 'string'; + } + } + if (filter.timeUnit) { + implicit[filter.field] = 'date'; + } + } + }); + return implicit; + } + + /** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ + function getImplicitFromEncoding(model) { + const implicit = {}; + function add(fieldDef) { + if (isFieldOrDatumDefForTimeFormat(fieldDef)) { + implicit[fieldDef.field] = 'date'; + } else if (fieldDef.type === 'quantitative' && isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max + ) { + implicit[fieldDef.field] = 'number'; + } else if (accessPathDepth(fieldDef.field) > 1) { + // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field. + // (Parsing numbers / dates already flattens numeric and temporal fields.) + if (!(fieldDef.field in implicit)) { + implicit[fieldDef.field] = 'flatten'; + } + } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) { + // Flatten fields that we sort by but that are not otherwise flattened. + if (!(fieldDef.sort.field in implicit)) { + implicit[fieldDef.sort.field] = 'flatten'; + } + } + } + if (isUnitModel(model) || isFacetModel(model)) { + // Parse encoded fields + model.forEachFieldDef((fieldDef, channel) => { + if (isTypedFieldDef(fieldDef)) { + add(fieldDef); + } else { + const mainChannel = getMainRangeChannel(channel); + const mainFieldDef = model.fieldDef(mainChannel); + add({ + ...fieldDef, + type: mainFieldDef.type + }); + } + }); + } + + // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly. + if (isUnitModel(model)) { + const { + mark, + markDef, + encoding + } = model; + if (isPathMark(mark) && + // No need to sort by dimension if we have a connected scatterplot (order channel is present) + !model.encoding.order) { + const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; + const dimensionChannelDef = encoding[dimensionChannel]; + if (isFieldDef(dimensionChannelDef) && dimensionChannelDef.type === 'quantitative' && !(dimensionChannelDef.field in implicit)) { + implicit[dimensionChannelDef.field] = 'number'; + } + } + } + return implicit; + } + + /** + * Creates a parse node for implicit parsing from a model and updates ancestorParse. + */ + function getImplicitFromSelection(model) { + const implicit = {}; + if (isUnitModel(model) && model.component.selection) { + for (const name of keys(model.component.selection)) { + const selCmpt = model.component.selection[name]; + for (const proj of selCmpt.project.items) { + if (!proj.channel && accessPathDepth(proj.field) > 1) { + implicit[proj.field] = 'flatten'; + } + } + } + } + return implicit; + } + class ParseNode extends DataFlowNode { + clone() { + return new ParseNode(null, duplicate(this._parse)); + } + constructor(parent, parse) { + super(parent); + _defineProperty(this, "_parse", void 0); + this._parse = parse; + } + hash() { + return `Parse ${hash(this._parse)}`; + } + + /** + * Creates a parse node from a data.format.parse and updates ancestorParse. + */ + static makeExplicit(parent, model, ancestorParse) { + // Custom parse + let explicit = {}; + const data = model.data; + if (!isGenerator(data) && data?.format?.parse) { + explicit = data.format.parse; + } + return this.makeWithAncestors(parent, explicit, {}, ancestorParse); + } + + /** + * Creates a parse node from "explicit" parse and "implicit" parse and updates ancestorParse. + */ + static makeWithAncestors(parent, explicit, implicit, ancestorParse) { + // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as "derived"). We also don't need to flatten a field that has already been parsed. + for (const field of keys(implicit)) { + const parsedAs = ancestorParse.getWithExplicit(field); + if (parsedAs.value !== undefined) { + // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types. + if (parsedAs.explicit || parsedAs.value === implicit[field] || parsedAs.value === 'derived' || implicit[field] === 'flatten') { + delete implicit[field]; + } else { + warn(differentParse(field, implicit[field], parsedAs.value)); + } + } + } + for (const field of keys(explicit)) { + const parsedAs = ancestorParse.get(field); + if (parsedAs !== undefined) { + // Don't parse a field again if it has been parsed with the same type already. + if (parsedAs === explicit[field]) { + delete explicit[field]; + } else { + warn(differentParse(field, explicit[field], parsedAs)); + } + } + } + const parse = new Split(explicit, implicit); + + // add the format parse from this model so that children don't parse the same field again + ancestorParse.copyAll(parse); + + // copy only non-null parses + const p = {}; + for (const key of keys(parse.combine())) { + const val = parse.get(key); + if (val !== null) { + p[key] = val; + } + } + if (keys(p).length === 0 || ancestorParse.parseNothing) { + return null; + } + return new ParseNode(parent, p); + } + get parse() { + return this._parse; + } + merge(other) { + this._parse = { + ...this._parse, + ...other.parse + }; + other.remove(); + } + + /** + * Assemble an object for Vega's format.parse property. + */ + assembleFormatParse() { + const formatParse = {}; + for (const field of keys(this._parse)) { + const p = this._parse[field]; + if (accessPathDepth(field) === 1) { + formatParse[field] = p; + } + } + return formatParse; + } + + // format parse depends and produces all fields in its parse + producedFields() { + return new Set(keys(this._parse)); + } + dependentFields() { + return new Set(keys(this._parse)); + } + assembleTransforms() { + let onlyNested = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; + return keys(this._parse).filter(field => onlyNested ? accessPathDepth(field) > 1 : true).map(field => { + const expr = parseExpression(field, this._parse[field]); + if (!expr) { + return null; + } + const formula = { + type: 'formula', + expr, + as: removePathFromField(field) // Vega output is always flattened + }; + + return formula; + }).filter(t => t !== null); + } + } + + class IdentifierNode extends DataFlowNode { + clone() { + return new IdentifierNode(null); + } + constructor(parent) { + super(parent); + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set([SELECTION_ID]); + } + hash() { + return 'Identifier'; + } + assemble() { + return { + type: 'identifier', + as: SELECTION_ID + }; + } + } + + class GraticuleNode extends DataFlowNode { + clone() { + return new GraticuleNode(null, this.params); + } + constructor(parent, params) { + super(parent); + this.params = params; + } + dependentFields() { + return new Set(); + } + producedFields() { + return undefined; // there should never be a node before graticule + } + + hash() { + return `Graticule ${hash(this.params)}`; + } + assemble() { + return { + type: 'graticule', + ...(this.params === true ? {} : this.params) + }; + } + } + + class SequenceNode extends DataFlowNode { + clone() { + return new SequenceNode(null, this.params); + } + constructor(parent, params) { + super(parent); + this.params = params; + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set([this.params.as ?? 'data']); + } + hash() { + return `Hash ${hash(this.params)}`; + } + assemble() { + return { + type: 'sequence', + ...this.params + }; + } + } + + class SourceNode extends DataFlowNode { + constructor(data) { + super(null); // source cannot have parent + _defineProperty(this, "_data", void 0); + _defineProperty(this, "_name", void 0); + _defineProperty(this, "_generator", void 0); + data ??= { + name: 'source' + }; + let format; + if (!isGenerator(data)) { + format = data.format ? { + ...omit(data.format, ['parse']) + } : {}; + } + if (isInlineData(data)) { + this._data = { + values: data.values + }; + } else if (isUrlData(data)) { + this._data = { + url: data.url + }; + if (!format.type) { + // Extract extension from URL using snippet from + // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript + let defaultExtension = /(?:\.([^.]+))?$/.exec(data.url)[1]; + if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) { + defaultExtension = 'json'; + } + + // defaultExtension has type string but we ensure that it is DataFormatType above + format.type = defaultExtension; + } + } else if (isSphereGenerator(data)) { + // hardwire GeoJSON sphere data into output specification + this._data = { + values: [{ + type: 'Sphere' + }] + }; + } else if (isNamedData(data) || isGenerator(data)) { + this._data = {}; + } + + // set flag to check if generator + this._generator = isGenerator(data); + + // any dataset can be named + if (data.name) { + this._name = data.name; + } + if (format && !isEmpty(format)) { + this._data.format = format; + } + } + dependentFields() { + return new Set(); + } + producedFields() { + return undefined; // we don't know what this source produces + } + + get data() { + return this._data; + } + hasName() { + return !!this._name; + } + get isGenerator() { + return this._generator; + } + get dataName() { + return this._name; + } + set dataName(name) { + this._name = name; + } + set parent(parent) { + throw new Error('Source nodes have to be roots.'); + } + remove() { + throw new Error('Source nodes are roots and cannot be removed.'); + } + hash() { + throw new Error('Cannot hash sources'); + } + assemble() { + return { + name: this._name, + ...this._data, + transform: [] + }; + } + } + + /** + * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator. + */ + function isDataSourceNode(node) { + return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode; + } + + /** + * Abstract base class for Dataflow optimizers. + * Contains only mutation handling logic. Subclasses need to implement iteration logic. + */ + var _modified = /*#__PURE__*/new WeakMap(); + class Optimizer { + constructor() { + _classPrivateFieldInitSpec(this, _modified, { + writable: true, + value: void 0 + }); + _classPrivateFieldSet(this, _modified, false); + } + + // Once true, #modified is never set to false + setModified() { + _classPrivateFieldSet(this, _modified, true); + } + get modifiedFlag() { + return _classPrivateFieldGet(this, _modified); + } + + /** + * Run the optimization for the tree with the provided root. + */ + } + + /** + * Starts from a node and runs the optimization function (the "run" method) upwards to the root, + * depending on the continue and modified flag values returned by the optimization function. + */ + class BottomUpOptimizer extends Optimizer { + /** + * Run the optimizer at the node. This method should not change the parent of the passed in node (it should only affect children). + */ + + /** + * Compute a map of node depths that we can use to determine a topological sort order. + */ + getNodeDepths(node, depth, depths) { + depths.set(node, depth); + for (const child of node.children) { + this.getNodeDepths(child, depth + 1, depths); + } + return depths; + } + + /** + * Run the optimizer on all nodes starting from the leaves. + */ + optimize(node) { + const depths = this.getNodeDepths(node, 0, new Map()); + const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]); + for (const tuple of topologicalSort) { + this.run(tuple[0]); + } + return this.modifiedFlag; + } + } + + /** + * The optimizer function (the "run" method), is invoked on the given node and then continues recursively. + */ + class TopDownOptimizer extends Optimizer { + /** + * Run the optimizer at the node. + */ + + /** + * Run the optimizer depth first on all nodes starting from the roots. + */ + optimize(node) { + this.run(node); + for (const child of node.children) { + this.optimize(child); + } + return this.modifiedFlag; + } + } + + /** + * Merge identical nodes at forks by comparing hashes. + * + * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler. + */ + class MergeIdenticalNodes extends TopDownOptimizer { + mergeNodes(parent, nodes) { + const mergedNode = nodes.shift(); + for (const node of nodes) { + parent.removeChild(node); + node.parent = mergedNode; + node.remove(); + } + } + run(node) { + const hashes = node.children.map(x => x.hash()); + const buckets = {}; + for (let i = 0; i < hashes.length; i++) { + if (buckets[hashes[i]] === undefined) { + buckets[hashes[i]] = [node.children[i]]; + } else { + buckets[hashes[i]].push(node.children[i]); + } + } + for (const k of keys(buckets)) { + if (buckets[k].length > 1) { + this.setModified(); + this.mergeNodes(node, buckets[k]); + } + } + } + } + + /** + * Optimizer that removes identifier nodes that are not needed for selections. + */ + class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer { + constructor(model) { + super(); + _defineProperty(this, "requiresSelectionId", void 0); + this.requiresSelectionId = model && requiresSelectionId(model); + } + run(node) { + if (node instanceof IdentifierNode) { + // Only preserve IdentifierNodes if we have default discrete selections + // in our model tree, and if the nodes come after tuple producing nodes. + if (!(this.requiresSelectionId && (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode))) { + this.setModified(); + node.remove(); + } + } + } + } + + /** + * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to + * selections projected over time units. Only keeps the first time unit in any branch. + * + * This optimizer is a custom top down optimizer that keep track of produced fields in a branch. + */ + class RemoveDuplicateTimeUnits extends Optimizer { + optimize(node) { + this.run(node, new Set()); + return this.modifiedFlag; + } + run(node, timeUnitFields) { + let producedFields = new Set(); + if (node instanceof TimeUnitNode) { + producedFields = node.producedFields(); + if (hasIntersection(producedFields, timeUnitFields)) { + this.setModified(); + node.removeFormulas(timeUnitFields); + if (node.producedFields.length === 0) { + node.remove(); + } + } + } + for (const child of node.children) { + this.run(child, new Set([...timeUnitFields, ...producedFields])); + } + } + } + + /** + * Remove output nodes that are not required. + */ + class RemoveUnnecessaryOutputNodes extends TopDownOptimizer { + constructor() { + super(); + } + run(node) { + if (node instanceof OutputNode && !node.isRequired()) { + this.setModified(); + node.remove(); + } + } + } + + /** + * Move parse nodes up to forks and merges them if possible. + */ + class MoveParseUp extends BottomUpOptimizer { + run(node) { + if (isDataSourceNode(node)) { + return; + } + if (node.numChildren() > 1) { + // Don't move parse further up but continue with parent. + return; + } + for (const child of node.children) { + if (child instanceof ParseNode) { + if (node instanceof ParseNode) { + this.setModified(); + node.merge(child); + } else { + // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup). + if (fieldIntersection(node.producedFields(), child.dependentFields())) { + continue; + } + this.setModified(); + child.swapWithParent(); + } + } + } + return; + } + } + + /** + * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes. + * + * We assume that dependent paths that do not have a parse node can be just merged. + */ + class MergeParse extends BottomUpOptimizer { + run(node) { + const originalChildren = [...node.children]; + const parseChildren = node.children.filter(child => child instanceof ParseNode); + if (node.numChildren() > 1 && parseChildren.length >= 1) { + const commonParse = {}; + const conflictingParse = new Set(); + for (const parseNode of parseChildren) { + const parse = parseNode.parse; + for (const k of keys(parse)) { + if (!(k in commonParse)) { + commonParse[k] = parse[k]; + } else if (commonParse[k] !== parse[k]) { + conflictingParse.add(k); + } + } + } + for (const field of conflictingParse) { + delete commonParse[field]; + } + if (!isEmpty(commonParse)) { + this.setModified(); + const mergedParseNode = new ParseNode(node, commonParse); + for (const childNode of originalChildren) { + if (childNode instanceof ParseNode) { + for (const key of keys(commonParse)) { + delete childNode.parse[key]; + } + } + node.removeChild(childNode); + childNode.parent = mergedParseNode; + + // remove empty parse nodes + if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) { + childNode.remove(); + } + } + } + } + } + } + + /** + * Repeatedly remove leaf nodes that are not output or facet nodes. + * The reason is that we don't need subtrees that don't have any output nodes. + * Facet nodes are needed for the row or column domains. + */ + class RemoveUnusedSubtrees extends BottomUpOptimizer { + run(node) { + if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) ; else if (node instanceof SourceNode) ; else { + this.setModified(); + node.remove(); + } + } + } + + /** + * Merge adjacent time unit nodes. + */ + class MergeTimeUnits extends BottomUpOptimizer { + run(node) { + const timeUnitChildren = node.children.filter(x => x instanceof TimeUnitNode); + const combination = timeUnitChildren.pop(); + for (const timeUnit of timeUnitChildren) { + this.setModified(); + combination.merge(timeUnit); + } + } + } + class MergeAggregates extends BottomUpOptimizer { + run(node) { + const aggChildren = node.children.filter(child => child instanceof AggregateNode); + + // Object which we'll use to map the fields which an aggregate is grouped by to + // the set of aggregates with that grouping. This is useful as only aggregates + // with the same group by can be merged + const groupedAggregates = {}; + + // Build groupedAggregates + for (const agg of aggChildren) { + const groupBys = hash(agg.groupBy); + if (!(groupBys in groupedAggregates)) { + groupedAggregates[groupBys] = []; + } + groupedAggregates[groupBys].push(agg); + } + + // Merge aggregateNodes with same key in groupedAggregates + for (const group of keys(groupedAggregates)) { + const mergeableAggs = groupedAggregates[group]; + if (mergeableAggs.length > 1) { + const mergedAggs = mergeableAggs.pop(); + for (const agg of mergeableAggs) { + if (mergedAggs.merge(agg)) { + node.removeChild(agg); + agg.parent = mergedAggs; + agg.remove(); + this.setModified(); + } + } + } + } + } + } + + /** + * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node. + */ + class MergeBins extends BottomUpOptimizer { + constructor(model) { + super(); + this.model = model; + } + run(node) { + const moveBinsUp = !(isDataSourceNode(node) || node instanceof FilterNode || node instanceof ParseNode || node instanceof IdentifierNode); + const promotableBins = []; + const remainingBins = []; + for (const child of node.children) { + if (child instanceof BinNode) { + if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) { + promotableBins.push(child); + } else { + remainingBins.push(child); + } + } + } + if (promotableBins.length > 0) { + const promotedBin = promotableBins.pop(); + for (const bin of promotableBins) { + promotedBin.merge(bin, this.model.renameSignal.bind(this.model)); + } + this.setModified(); + if (node instanceof BinNode) { + node.merge(promotedBin, this.model.renameSignal.bind(this.model)); + } else { + promotedBin.swapWithParent(); + } + } + if (remainingBins.length > 1) { + const remainingBin = remainingBins.pop(); + for (const bin of remainingBins) { + remainingBin.merge(bin, this.model.renameSignal.bind(this.model)); + } + this.setModified(); + } + } + } + + /** + * This optimizer takes output nodes that are at a fork and moves them before the fork. + * + * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes. + * It then moves all output nodes before that main output node. All other children (and the children of the output nodes) + * are inserted after the main output node. + */ + class MergeOutputs extends BottomUpOptimizer { + run(node) { + const children = [...node.children]; + const hasOutputChild = some(children, child => child instanceof OutputNode); + if (!hasOutputChild || node.numChildren() <= 1) { + return; + } + const otherChildren = []; + + // The output node we will connect all other nodes to. + // Output nodes will be added before the new node, other nodes after. + let mainOutput; + for (const child of children) { + if (child instanceof OutputNode) { + let lastOutput = child; + while (lastOutput.numChildren() === 1) { + const [theChild] = lastOutput.children; + if (theChild instanceof OutputNode) { + lastOutput = theChild; + } else { + break; + } + } + otherChildren.push(...lastOutput.children); + if (mainOutput) { + // Move the output nodes before the mainOutput. We do this by setting + // the parent of the first not to the parent of the main output and + // the main output's parent to the last output. + + // note: the child is the first output + node.removeChild(child); + child.parent = mainOutput.parent; + mainOutput.parent.removeChild(mainOutput); + mainOutput.parent = lastOutput; + this.setModified(); + } else { + mainOutput = lastOutput; + } + } else { + otherChildren.push(child); + } + } + if (otherChildren.length) { + this.setModified(); + for (const child of otherChildren) { + child.parent.removeChild(child); + child.parent = mainOutput; + } + } + } + } + + /** + * A class for the join aggregate transform nodes. + */ + class JoinAggregateTransformNode extends DataFlowNode { + clone() { + return new JoinAggregateTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); + } + dependentFields() { + const out = new Set(); + if (this.transform.groupby) { + this.transform.groupby.forEach(out.add, out); + } + this.transform.joinaggregate.map(w => w.field).filter(f => f !== undefined).forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this.transform.joinaggregate.map(this.getDefaultName)); + } + getDefaultName(joinAggregateFieldDef) { + return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef); + } + hash() { + return `JoinAggregateTransform ${hash(this.transform)}`; + } + assemble() { + const fields = []; + const ops = []; + const as = []; + for (const joinaggregate of this.transform.joinaggregate) { + ops.push(joinaggregate.op); + as.push(this.getDefaultName(joinaggregate)); + fields.push(joinaggregate.field === undefined ? null : joinaggregate.field); + } + const groupby = this.transform.groupby; + return { + type: 'joinaggregate', + as, + ops, + fields, + ...(groupby !== undefined ? { + groupby + } : {}) + }; + } + } + + function getStackByFields(model) { + return model.stack.stackBy.reduce((fields, by) => { + const fieldDef = by.fieldDef; + const _field = vgField(fieldDef); + if (_field) { + fields.push(_field); + } + return fields; + }, []); + } + function isValidAsArray(as) { + return vega.isArray(as) && as.every(s => vega.isString(s)) && as.length > 1; + } + class StackNode extends DataFlowNode { + clone() { + return new StackNode(null, duplicate(this._stack)); + } + constructor(parent, stack) { + super(parent); + _defineProperty(this, "_stack", void 0); + this._stack = stack; + } + static makeFromTransform(parent, stackTransform) { + const { + stack, + groupby, + as, + offset = 'zero' + } = stackTransform; + const sortFields = []; + const sortOrder = []; + if (stackTransform.sort !== undefined) { + for (const sortField of stackTransform.sort) { + sortFields.push(sortField.field); + sortOrder.push(getFirstDefined(sortField.order, 'ascending')); + } + } + const sort = { + field: sortFields, + order: sortOrder + }; + let normalizedAs; + if (isValidAsArray(as)) { + normalizedAs = as; + } else if (vega.isString(as)) { + normalizedAs = [as, `${as}_end`]; + } else { + normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`]; + } + return new StackNode(parent, { + dimensionFieldDefs: [], + stackField: stack, + groupby, + offset, + sort, + facetby: [], + as: normalizedAs + }); + } + static makeFromEncoding(parent, model) { + const stackProperties = model.stack; + const { + encoding + } = model; + if (!stackProperties) { + return null; + } + const { + groupbyChannels, + fieldChannel, + offset, + impute + } = stackProperties; + const dimensionFieldDefs = groupbyChannels.map(groupbyChannel => { + const cDef = encoding[groupbyChannel]; + return getFieldDef(cDef); + }).filter(def => !!def); + const stackby = getStackByFields(model); + const orderDef = model.encoding.order; + let sort; + if (vega.isArray(orderDef) || isFieldDef(orderDef)) { + sort = sortParams(orderDef); + } else { + const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending'; + // default = descending by stackFields + // FIXME is the default here correct for binned fields? + sort = stackby.reduce((s, field) => { + s.field.push(field); + s.order.push(sortOrder); + return s; + }, { + field: [], + order: [] + }); + } + return new StackNode(parent, { + dimensionFieldDefs, + stackField: model.vgField(fieldChannel), + facetby: [], + stackby, + sort, + offset, + impute, + as: [model.vgField(fieldChannel, { + suffix: 'start', + forAs: true + }), model.vgField(fieldChannel, { + suffix: 'end', + forAs: true + })] + }); + } + get stack() { + return this._stack; + } + addDimensions(fields) { + this._stack.facetby.push(...fields); + } + dependentFields() { + const out = new Set(); + out.add(this._stack.stackField); + this.getGroupbyFields().forEach(out.add, out); + this._stack.facetby.forEach(out.add, out); + this._stack.sort.field.forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this._stack.as); + } + hash() { + return `Stack ${hash(this._stack)}`; + } + getGroupbyFields() { + const { + dimensionFieldDefs, + impute, + groupby + } = this._stack; + if (dimensionFieldDefs.length > 0) { + return dimensionFieldDefs.map(dimensionFieldDef => { + if (dimensionFieldDef.bin) { + if (impute) { + // For binned group by field with impute, we calculate bin_mid + // as we cannot impute two fields simultaneously + return [vgField(dimensionFieldDef, { + binSuffix: 'mid' + })]; + } + return [ + // For binned group by field without impute, we need both bin (start) and bin_end + vgField(dimensionFieldDef, {}), vgField(dimensionFieldDef, { + binSuffix: 'end' + })]; + } + return [vgField(dimensionFieldDef)]; + }).flat(); + } + return groupby ?? []; + } + assemble() { + const transform = []; + const { + facetby, + dimensionFieldDefs, + stackField: field, + stackby, + sort, + offset, + impute, + as + } = this._stack; + + // Impute + if (impute) { + for (const dimensionFieldDef of dimensionFieldDefs) { + const { + bandPosition = 0.5, + bin + } = dimensionFieldDef; + if (bin) { + // As we can only impute one field at a time, we need to calculate + // mid point for a binned field + + const binStart = vgField(dimensionFieldDef, { + expr: 'datum' + }); + const binEnd = vgField(dimensionFieldDef, { + expr: 'datum', + binSuffix: 'end' + }); + transform.push({ + type: 'formula', + expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`, + as: vgField(dimensionFieldDef, { + binSuffix: 'mid', + forAs: true + }) + }); + } + transform.push({ + type: 'impute', + field, + groupby: [...stackby, ...facetby], + key: vgField(dimensionFieldDef, { + binSuffix: 'mid' + }), + method: 'value', + value: 0 + }); + } + } + + // Stack + transform.push({ + type: 'stack', + groupby: [...this.getGroupbyFields(), ...facetby], + field, + sort, + as, + offset + }); + return transform; + } + } + + /** + * A class for the window transform nodes + */ + class WindowTransformNode extends DataFlowNode { + clone() { + return new WindowTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d); + } + dependentFields() { + const out = new Set(); + (this.transform.groupby ?? []).forEach(out.add, out); + (this.transform.sort ?? []).forEach(m => out.add(m.field)); + this.transform.window.map(w => w.field).filter(f => f !== undefined).forEach(out.add, out); + return out; + } + producedFields() { + return new Set(this.transform.window.map(this.getDefaultName)); + } + getDefaultName(windowFieldDef) { + return windowFieldDef.as ?? vgField(windowFieldDef); + } + hash() { + return `WindowTransform ${hash(this.transform)}`; + } + assemble() { + const fields = []; + const ops = []; + const as = []; + const params = []; + for (const window of this.transform.window) { + ops.push(window.op); + as.push(this.getDefaultName(window)); + params.push(window.param === undefined ? null : window.param); + fields.push(window.field === undefined ? null : window.field); + } + const frame = this.transform.frame; + const groupby = this.transform.groupby; + if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) { + // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate + return { + type: 'joinaggregate', + as, + ops: ops, + fields, + ...(groupby !== undefined ? { + groupby + } : {}) + }; + } + const sortFields = []; + const sortOrder = []; + if (this.transform.sort !== undefined) { + for (const sortField of this.transform.sort) { + sortFields.push(sortField.field); + sortOrder.push(sortField.order ?? 'ascending'); + } + } + const sort = { + field: sortFields, + order: sortOrder + }; + const ignorePeers = this.transform.ignorePeers; + return { + type: 'window', + params, + as, + ops, + fields, + sort, + ...(ignorePeers !== undefined ? { + ignorePeers + } : {}), + ...(groupby !== undefined ? { + groupby + } : {}), + ...(frame !== undefined ? { + frame + } : {}) + }; + } + } + + /** + * Clones the subtree and ignores output nodes except for the leaves, which are renamed. + */ + function cloneSubtree(facet) { + function clone(node) { + if (!(node instanceof FacetNode)) { + const copy = node.clone(); + if (copy instanceof OutputNode) { + const newName = FACET_SCALE_PREFIX + copy.getSource(); + copy.setSource(newName); + facet.model.component.data.outputNodes[newName] = copy; + } else if (copy instanceof AggregateNode || copy instanceof StackNode || copy instanceof WindowTransformNode || copy instanceof JoinAggregateTransformNode) { + copy.addDimensions(facet.fields); + } + for (const n of node.children.flatMap(clone)) { + n.parent = copy; + } + return [copy]; + } + return node.children.flatMap(clone); + } + return clone; + } + + /** + * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node. + * After moving down the facet node, make a copy of the subtree and make it a child of the main output. + */ + function moveFacetDown(node) { + if (node instanceof FacetNode) { + if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) { + // move down until we hit a fork or output node + const child = node.children[0]; + if (child instanceof AggregateNode || child instanceof StackNode || child instanceof WindowTransformNode || child instanceof JoinAggregateTransformNode) { + child.addDimensions(node.fields); + } + child.swapWithParent(); + moveFacetDown(node); + } else { + // move main to facet + + const facetMain = node.model.component.data.main; + moveMainDownToFacet(facetMain); + + // replicate the subtree and place it before the facet's main node + const cloner = cloneSubtree(node); + const copy = node.children.map(cloner).flat(); + for (const c of copy) { + c.parent = facetMain; + } + } + } else { + node.children.map(moveFacetDown); + } + } + function moveMainDownToFacet(node) { + if (node instanceof OutputNode && node.type === DataSourceType.Main) { + if (node.numChildren() === 1) { + const child = node.children[0]; + if (!(child instanceof FacetNode)) { + child.swapWithParent(); + moveMainDownToFacet(node); + } + } + } + } + + const FACET_SCALE_PREFIX = 'scale_'; + const MAX_OPTIMIZATION_RUNS = 5; + + /** + * Iterates over a dataflow graph and checks whether all links are consistent. + */ + function checkLinks(nodes) { + for (const node of nodes) { + for (const child of node.children) { + if (child.parent !== node) { + // log.error('Dataflow graph is inconsistent.', node, child); + return false; + } + } + if (!checkLinks(node.children)) { + return false; + } + } + return true; + } + + /** + * Run the specified optimizer on the provided nodes. + * + * @param optimizer The optimizer instance to run. + * @param nodes A set of nodes to optimize. + */ + function runOptimizer(optimizer, nodes) { + let modified = false; + for (const node of nodes) { + modified = optimizer.optimize(node) || modified; + } + return modified; + } + function optimizationDataflowHelper(dataComponent, model, firstPass) { + let roots = dataComponent.sources; + let modified = false; + modified = runOptimizer(new RemoveUnnecessaryOutputNodes(), roots) || modified; + modified = runOptimizer(new RemoveUnnecessaryIdentifierNodes(model), roots) || modified; + + // remove source nodes that don't have any children because they also don't have output nodes + roots = roots.filter(r => r.numChildren() > 0); + modified = runOptimizer(new RemoveUnusedSubtrees(), roots) || modified; + roots = roots.filter(r => r.numChildren() > 0); + if (!firstPass) { + // Only run these optimizations after the optimizer has moved down the facet node. + // With this change, we can be more aggressive in the optimizations. + modified = runOptimizer(new MoveParseUp(), roots) || modified; + modified = runOptimizer(new MergeBins(model), roots) || modified; + modified = runOptimizer(new RemoveDuplicateTimeUnits(), roots) || modified; + modified = runOptimizer(new MergeParse(), roots) || modified; + modified = runOptimizer(new MergeAggregates(), roots) || modified; + modified = runOptimizer(new MergeTimeUnits(), roots) || modified; + modified = runOptimizer(new MergeIdenticalNodes(), roots) || modified; + modified = runOptimizer(new MergeOutputs(), roots) || modified; + } + dataComponent.sources = roots; + return modified; + } + + /** + * Optimizes the dataflow of the passed in data component. + */ + function optimizeDataflow(data, model) { + // check before optimizations + checkLinks(data.sources); + let firstPassCounter = 0; + let secondPassCounter = 0; + for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { + if (!optimizationDataflowHelper(data, model, true)) { + break; + } + firstPassCounter++; + } + + // move facets down and make a copy of the subtree so that we can have scales at the top level + data.sources.map(moveFacetDown); + for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) { + if (!optimizationDataflowHelper(data, model, false)) { + break; + } + secondPassCounter++; + } + + // check after optimizations + checkLinks(data.sources); + if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) { + warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`); + } + } + + /** + * A class that behaves like a SignalRef but lazily generates the signal. + * The provided generator function should use `Model.getSignalName` to use the correct signal name. + */ + class SignalRefWrapper { + constructor(exprGenerator) { + _defineProperty(this, "signal", void 0); + Object.defineProperty(this, 'signal', { + enumerable: true, + get: exprGenerator + }); + } + // for ts + + static fromName(rename, signalName) { + return new SignalRefWrapper(() => rename(signalName)); + } + } + + function parseScaleDomain(model) { + if (isUnitModel(model)) { + parseUnitScaleDomain(model); + } else { + parseNonUnitScaleDomain(model); + } + } + function parseUnitScaleDomain(model) { + const localScaleComponents = model.component.scales; + for (const channel of keys(localScaleComponents)) { + const domains = parseDomainForChannel(model, channel); + const localScaleCmpt = localScaleComponents[channel]; + localScaleCmpt.setWithExplicit('domains', domains); + parseSelectionDomain(model, channel); + if (model.component.data.isFaceted) { + // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not + let facetParent = model; + while (!isFacetModel(facetParent) && facetParent.parent) { + facetParent = facetParent.parent; + } + const resolve = facetParent.component.resolve.scale[channel]; + if (resolve === 'shared') { + for (const domain of domains.value) { + // Replace the scale domain with data output from a cloned subtree after the facet. + if (isDataRefDomain(domain)) { + // use data from cloned subtree (which is the same as data but with a prefix added once) + domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, ''); + } + } + } + } + } + } + function parseNonUnitScaleDomain(model) { + for (const child of model.children) { + parseScaleDomain(child); + } + const localScaleComponents = model.component.scales; + for (const channel of keys(localScaleComponents)) { + let domains; + let selectionExtent = null; + for (const child of model.children) { + const childComponent = child.component.scales[channel]; + if (childComponent) { + if (domains === undefined) { + domains = childComponent.getWithExplicit('domains'); + } else { + domains = mergeValuesWithExplicit(domains, childComponent.getWithExplicit('domains'), 'domains', 'scale', domainsTieBreaker); + } + const se = childComponent.get('selectionExtent'); + if (selectionExtent && se && selectionExtent.param !== se.param) { + warn(NEEDS_SAME_SELECTION); + } + selectionExtent = se; + } + } + localScaleComponents[channel].setWithExplicit('domains', domains); + if (selectionExtent) { + localScaleComponents[channel].set('selectionExtent', selectionExtent, true); + } + } + } + + /** + * Remove unaggregated domain if it is not applicable + * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true. + */ + function normalizeUnaggregatedDomain(domain, fieldDef, scaleType, scaleConfig) { + if (domain === 'unaggregated') { + const { + valid, + reason + } = canUseUnaggregatedDomain(fieldDef, scaleType); + if (!valid) { + warn(reason); + return undefined; + } + } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) { + // Apply config if domain is not specified. + const { + valid + } = canUseUnaggregatedDomain(fieldDef, scaleType); + if (valid) { + return 'unaggregated'; + } + } + return domain; + } + function parseDomainForChannel(model, channel) { + const scaleType = model.getScaleComponent(channel).get('type'); + const { + encoding + } = model; + const domain = normalizeUnaggregatedDomain(model.scaleDomain(channel), model.typedFieldDef(channel), scaleType, model.config.scale); + if (domain !== model.scaleDomain(channel)) { + model.specifiedScales[channel] = { + ...model.specifiedScales[channel], + domain + }; + } + + // If channel is either X or Y then union them with X2 & Y2 if they exist + if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) { + if (getFieldOrDatumDef(encoding.x)) { + return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'x'), parseSingleChannelDomain(scaleType, domain, model, 'x2'), 'domain', 'scale', domainsTieBreaker); + } else { + return parseSingleChannelDomain(scaleType, domain, model, 'x2'); + } + } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) { + if (getFieldOrDatumDef(encoding.y)) { + return mergeValuesWithExplicit(parseSingleChannelDomain(scaleType, domain, model, 'y'), parseSingleChannelDomain(scaleType, domain, model, 'y2'), 'domain', 'scale', domainsTieBreaker); + } else { + return parseSingleChannelDomain(scaleType, domain, model, 'y2'); + } + } + return parseSingleChannelDomain(scaleType, domain, model, channel); + } + function mapDomainToDataSignal(domain, type, timeUnit) { + return domain.map(v => { + const data = valueExpr(v, { + timeUnit, + type + }); + return { + signal: `{data: ${data}}` + }; + }); + } + function convertDomainIfItIsDateTime(domain, type, timeUnit) { + // explicit value + const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit; + if (type === 'temporal' || normalizedTimeUnit) { + return mapDomainToDataSignal(domain, type, normalizedTimeUnit); + } + return [domain]; // Date time won't make sense + } + + function parseSingleChannelDomain(scaleType, domain, model, channel) { + const { + encoding, + markDef, + mark, + config, + stack + } = model; + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const { + type + } = fieldOrDatumDef; + const timeUnit = fieldOrDatumDef['timeUnit']; + if (isDomainUnionWith(domain)) { + const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel); + const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit); + return makeExplicit([...unionWith, ...defaultDomain.value]); + } else if (isSignalRef(domain)) { + return makeExplicit([domain]); + } else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) { + return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit)); + } + if (stack && channel === stack.fieldChannel) { + if (stack.offset === 'normalize') { + return makeImplicit([[0, 1]]); + } + const data = model.requestDataName(DataSourceType.Main); + return makeImplicit([{ + data, + field: model.vgField(channel, { + suffix: 'start' + }) + }, { + data, + field: model.vgField(channel, { + suffix: 'end' + }) + }]); + } + const sort = isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined; + if (isDatumDef(fieldOrDatumDef)) { + const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit); + return makeImplicit(d); + } + const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef + if (domain === 'unaggregated') { + const data = model.requestDataName(DataSourceType.Main); + const { + field + } = fieldOrDatumDef; + return makeImplicit([{ + data, + field: vgField({ + field, + aggregate: 'min' + }) + }, { + data, + field: vgField({ + field, + aggregate: 'max' + }) + }]); + } else if (isBinning(fieldDef.bin)) { + if (hasDiscreteDomain(scaleType)) { + if (scaleType === 'bin-ordinal') { + // we can omit the domain as it is inferred from the `bins` property + return makeImplicit([]); + } + + // ordinal bin scale takes domain from bin_range, ordered by bin start + // This is useful for both axis-based scale (x/y) and legend-based scale (other channels). + return makeImplicit([{ + // If sort by aggregation of a specified sort field, we need to use RAW table, + // so we can aggregate values for the scale independently from the main aggregation. + data: isBoolean(sort) ? model.requestDataName(DataSourceType.Main) : model.requestDataName(DataSourceType.Raw), + // Use range if we added it and the scale does not support computing a range as a signal. + field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? { + binSuffix: 'range' + } : {}), + // we have to use a sort object if sort = true to make the sort correct by bin start + sort: sort === true || !vega.isObject(sort) ? { + field: model.vgField(channel, {}), + op: 'min' // min or max doesn't matter since we sort by the start of the bin range + } : sort + }]); + } else { + // continuous scales + const { + bin + } = fieldDef; + if (isBinning(bin)) { + const binSignal = getBinSignalName(model, fieldDef.field, bin); + return makeImplicit([new SignalRefWrapper(() => { + const signal = model.getSignalName(binSignal); + return `[${signal}.start, ${signal}.stop]`; + })]); + } else { + return makeImplicit([{ + data: model.requestDataName(DataSourceType.Main), + field: model.vgField(channel, {}) + }]); + } + } + } else if (fieldDef.timeUnit && contains(['time', 'utc'], scaleType)) { + const fieldDef2 = encoding[getSecondaryRangeChannel(channel)]; + if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) { + const data = model.requestDataName(DataSourceType.Main); + const bandPosition = getBandPosition({ + fieldDef, + fieldDef2, + markDef, + config + }); + const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5; + return makeImplicit([{ + data, + field: model.vgField(channel, isRectWithOffset ? { + suffix: OFFSETTED_RECT_START_SUFFIX + } : {}) + }, { + data, + field: model.vgField(channel, { + suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end' + }) + }]); + } + } + if (sort) { + return makeImplicit([{ + // If sort by aggregation of a specified sort field, we need to use RAW table, + // so we can aggregate values for the scale independently from the main aggregation. + data: isBoolean(sort) ? model.requestDataName(DataSourceType.Main) : model.requestDataName(DataSourceType.Raw), + field: model.vgField(channel), + sort + }]); + } else { + return makeImplicit([{ + data: model.requestDataName(DataSourceType.Main), + field: model.vgField(channel) + }]); + } + } + function normalizeSortField(sort, isStackedMeasure) { + const { + op, + field, + order + } = sort; + return { + // Apply default op + op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP), + // flatten nested fields + ...(field ? { + field: replacePathInField(field) + } : {}), + ...(order ? { + order + } : {}) + }; + } + function parseSelectionDomain(model, channel) { + const scale = model.component.scales[channel]; + const spec = model.specifiedScales[channel].domain; + const bin = model.fieldDef(channel)?.bin; + const domain = isParameterDomain(spec) && spec; + const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent; + if (domain || extent) { + // As scale parsing occurs before selection parsing, we cannot set + // domainRaw directly. So instead, we store the selectionExtent on + // the scale component, and then add domainRaw during scale assembly. + scale.set('selectionExtent', domain ?? extent, true); + } + } + function domainSort(model, channel, scaleType) { + if (!hasDiscreteDomain(scaleType)) { + return undefined; + } + + // save to cast as the only exception is the geojson type for shape, which would not generate a scale + const fieldDef = model.fieldDef(channel); + const sort = fieldDef.sort; + + // if the sort is specified with array, use the derived sort index field + if (isSortArray(sort)) { + return { + op: 'min', + field: sortArrayIndexField(fieldDef, channel), + order: 'ascending' + }; + } + const { + stack + } = model; + const stackDimensions = stack ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)]) : undefined; + + // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale) + if (isSortField(sort)) { + const isStackedMeasure = stack && !stackDimensions.has(sort.field); + return normalizeSortField(sort, isStackedMeasure); + } else if (isSortByEncoding(sort)) { + const { + encoding, + order + } = sort; + const fieldDefToSortBy = model.fieldDef(encoding); + const { + aggregate, + field + } = fieldDefToSortBy; + const isStackedMeasure = stack && !stackDimensions.has(field); + if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) { + return normalizeSortField({ + field: vgField(fieldDefToSortBy), + order + }, isStackedMeasure); + } else if (isAggregateOp(aggregate) || !aggregate) { + return normalizeSortField({ + op: aggregate, + // can't be argmin/argmax since we don't support them in encoding field def + field, + order + }, isStackedMeasure); + } + } else if (sort === 'descending') { + return { + op: 'min', + field: model.vgField(channel), + order: 'descending' + }; + } else if (contains(['ascending', undefined /* default =ascending*/], sort)) { + return true; + } + + // sort == null + return undefined; + } + + /** + * Determine if a scale can use unaggregated domain. + * @return {Boolean} Returns true if all of the following conditions apply: + * 1. `scale.domain` is `unaggregated` + * 2. Aggregation function is not `count` or `sum` + * 3. The scale is quantitative or time scale. + */ + function canUseUnaggregatedDomain(fieldDef, scaleType) { + const { + aggregate, + type + } = fieldDef; + if (!aggregate) { + return { + valid: false, + reason: unaggregateDomainHasNoEffectForRawField(fieldDef) + }; + } + if (vega.isString(aggregate) && !SHARED_DOMAIN_OPS.has(aggregate)) { + return { + valid: false, + reason: unaggregateDomainWithNonSharedDomainOp(aggregate) + }; + } + if (type === 'quantitative') { + if (scaleType === 'log') { + return { + valid: false, + reason: unaggregatedDomainWithLogScale(fieldDef) + }; + } + } + return { + valid: true + }; + } + + /** + * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values. + */ + function domainsTieBreaker(v1, v2, property, propertyOf) { + if (v1.explicit && v2.explicit) { + warn(mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value)); + } + // If equal score, concat the domains so that we union them later. + return { + explicit: v1.explicit, + value: [...v1.value, ...v2.value] + }; + } + + /** + * Converts an array of domains to a single Vega scale domain. + */ + function mergeDomains(domains) { + const uniqueDomains = unique(domains.map(domain => { + // ignore sort property when computing the unique domains + if (isDataRefDomain(domain)) { + const { + sort: _s, + ...domainWithoutSort + } = domain; + return domainWithoutSort; + } + return domain; + }), hash); + const sorts = unique(domains.map(d => { + if (isDataRefDomain(d)) { + const s = d.sort; + if (s !== undefined && !isBoolean(s)) { + if ('op' in s && s.op === 'count') { + // let's make sure that if op is count, we don't use a field + delete s.field; + } + if (s.order === 'ascending') { + // drop order: ascending as it is the default + delete s.order; + } + } + return s; + } + return undefined; + }).filter(s => s !== undefined), hash); + if (uniqueDomains.length === 0) { + return undefined; + } else if (uniqueDomains.length === 1) { + const domain = domains[0]; + if (isDataRefDomain(domain) && sorts.length > 0) { + let sort = sorts[0]; + if (sorts.length > 1) { + warn(MORE_THAN_ONE_SORT); + // Get sorts with non-default ops + const filteredSorts = sorts.filter(s => vega.isObject(s) && 'op' in s && s.op !== 'min'); + if (sorts.every(s => vega.isObject(s) && 'op' in s) && filteredSorts.length === 1) { + sort = filteredSorts[0]; + } else { + sort = true; + } + } else { + // Simplify domain sort by removing field and op when the field is the same as the domain field. + if (vega.isObject(sort) && 'field' in sort) { + const sortField = sort.field; + if (domain.field === sortField) { + sort = sort.order ? { + order: sort.order + } : true; + } + } + } + return { + ...domain, + sort + }; + } + return domain; + } + + // only keep sort properties that work with unioned domains + const unionDomainSorts = unique(sorts.map(s => { + if (isBoolean(s) || !('op' in s) || vega.isString(s.op) && s.op in MULTIDOMAIN_SORT_OP_INDEX) { + return s; + } + warn(domainSortDropped(s)); + return true; + }), hash); + let sort; + if (unionDomainSorts.length === 1) { + sort = unionDomainSorts[0]; + } else if (unionDomainSorts.length > 1) { + warn(MORE_THAN_ONE_SORT); + sort = true; + } + const allData = unique(domains.map(d => { + if (isDataRefDomain(d)) { + return d.data; + } + return null; + }), x => x); + if (allData.length === 1 && allData[0] !== null) { + // create a union domain of different fields with a single data source + const domain = { + data: allData[0], + fields: uniqueDomains.map(d => d.field), + ...(sort ? { + sort + } : {}) + }; + return domain; + } + return { + fields: uniqueDomains, + ...(sort ? { + sort + } : {}) + }; + } + + /** + * Return a field if a scale uses a single field. + * Return `undefined` otherwise. + */ + function getFieldFromDomain(domain) { + if (isDataRefDomain(domain) && vega.isString(domain.field)) { + return domain.field; + } else if (isDataRefUnionedDomain(domain)) { + let field; + for (const nonUnionDomain of domain.fields) { + if (isDataRefDomain(nonUnionDomain) && vega.isString(nonUnionDomain.field)) { + if (!field) { + field = nonUnionDomain.field; + } else if (field !== nonUnionDomain.field) { + warn(FACETED_INDEPENDENT_DIFFERENT_SOURCES); + return field; + } + } + } + warn(FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES); + return field; + } else if (isFieldRefUnionDomain(domain)) { + warn(FACETED_INDEPENDENT_SAME_SOURCE); + const field = domain.fields[0]; + return vega.isString(field) ? field : undefined; + } + return undefined; + } + function assembleDomain(model, channel) { + const scaleComponent = model.component.scales[channel]; + const domains = scaleComponent.get('domains').map(domain => { + // Correct references to data as the original domain's data was determined + // in parseScale, which happens before parseData. Thus the original data + // reference can be incorrect. + if (isDataRefDomain(domain)) { + domain.data = model.lookupDataSource(domain.data); + } + return domain; + }); + + // domains is an array that has to be merged into a single vega domain + return mergeDomains(domains); + } + + function assembleScales(model) { + if (isLayerModel(model) || isConcatModel(model)) { + // For concat and layer, include scales of children too + return model.children.reduce((scales, child) => { + return scales.concat(assembleScales(child)); + }, assembleScalesForModel(model)); + } else { + // For facet, child scales would not be included in the parent's scope. + // For unit, there is no child. + return assembleScalesForModel(model); + } + } + function assembleScalesForModel(model) { + return keys(model.component.scales).reduce((scales, channel) => { + const scaleComponent = model.component.scales[channel]; + if (scaleComponent.merged) { + // Skipped merged scales + return scales; + } + const scale = scaleComponent.combine(); + const { + name, + type, + selectionExtent, + domains: _d, + range: _r, + reverse, + ...otherScaleProps + } = scale; + const range = assembleScaleRange(scale.range, name, channel, model); + const domain = assembleDomain(model, channel); + const domainRaw = selectionExtent ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain) : null; + scales.push({ + name, + type, + ...(domain ? { + domain + } : {}), + ...(domainRaw ? { + domainRaw + } : {}), + range, + ...(reverse !== undefined ? { + reverse: reverse + } : {}), + ...otherScaleProps + }); + return scales; + }, []); + } + function assembleScaleRange(scaleRange, scaleName, channel, model) { + // add signals to x/y range + if (isXorY(channel)) { + if (isVgRangeStep(scaleRange)) { + // For width/height step, use a signal created in layout assemble instead of a constant step. + return { + step: { + signal: `${scaleName}_step` + } + }; + } + } else if (vega.isObject(scaleRange) && isDataRefDomain(scaleRange)) { + return { + ...scaleRange, + data: model.lookupDataSource(scaleRange.data) + }; + } + return scaleRange; + } + + /** + * All VgDomain property except domain. + * (We exclude domain as we have a special "domains" array that allow us merge them all at once in assemble.) + */ + + class ScaleComponent extends Split { + constructor(name, typeWithExplicit) { + super({}, + // no initial explicit property + { + name + } // name as initial implicit property + ); + _defineProperty(this, "merged", false); + this.setWithExplicit('type', typeWithExplicit); + } + + /** + * Whether the scale definitely includes zero in the domain + */ + domainDefinitelyIncludesZero() { + if (this.get('zero') !== false) { + return true; + } + return some(this.get('domains'), d => vega.isArray(d) && d.length === 2 && vega.isNumber(d[0]) && d[0] <= 0 && vega.isNumber(d[1]) && d[1] >= 0); + } + } + + const RANGE_PROPERTIES = ['range', 'scheme']; + function parseUnitScaleRange(model) { + const localScaleComponents = model.component.scales; + + // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first! + for (const channel of SCALE_CHANNELS) { + const localScaleCmpt = localScaleComponents[channel]; + if (!localScaleCmpt) { + continue; + } + const rangeWithExplicit = parseRangeForChannel(channel, model); + localScaleCmpt.setWithExplicit('range', rangeWithExplicit); + } + } + function getBinStepSignal(model, channel) { + const fieldDef = model.fieldDef(channel); + if (fieldDef?.bin) { + const { + bin, + field + } = fieldDef; + const sizeType = getSizeChannel(channel); + const sizeSignal = model.getName(sizeType); + if (vega.isObject(bin) && bin.binned && bin.step !== undefined) { + return new SignalRefWrapper(() => { + const scaleName = model.scaleName(channel); + const binCount = `(domain("${scaleName}")[1] - domain("${scaleName}")[0]) / ${bin.step}`; + return `${model.getSignalName(sizeSignal)} / (${binCount})`; + }); + } else if (isBinning(bin)) { + const binSignal = getBinSignalName(model, field, bin); + + // TODO: extract this to be range step signal + return new SignalRefWrapper(() => { + const updatedName = model.getSignalName(binSignal); + const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`; + return `${model.getSignalName(sizeSignal)} / (${binCount})`; + }); + } + } + return undefined; + } + + /** + * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme). + */ + function parseRangeForChannel(channel, model) { + const specifiedScale = model.specifiedScales[channel]; + const { + size + } = model; + const mergedScaleCmpt = model.getScaleComponent(channel); + const scaleType = mergedScaleCmpt.get('type'); + + // Check if any of the range properties is specified. + // If so, check if it is compatible and make sure that we only output one of the properties + for (const property of RANGE_PROPERTIES) { + if (specifiedScale[property] !== undefined) { + const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); + const channelIncompatability = channelScalePropertyIncompatability(channel, property); + if (!supportedByScaleType) { + warn(scalePropertyNotWorkWithScaleType(scaleType, property, channel)); + } else if (channelIncompatability) { + // channel + warn(channelIncompatability); + } else { + switch (property) { + case 'range': + { + const range = specifiedScale.range; + if (vega.isArray(range)) { + if (isXorY(channel)) { + return makeExplicit(range.map(v => { + if (v === 'width' || v === 'height') { + // get signal for width/height + + // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames. + + const sizeSignal = model.getName(v); + const getSignalName = model.getSignalName.bind(model); + return SignalRefWrapper.fromName(getSignalName, sizeSignal); + } + return v; + })); + } + } else if (vega.isObject(range)) { + return makeExplicit({ + data: model.requestDataName(DataSourceType.Main), + field: range.field, + sort: { + op: 'min', + field: model.vgField(channel) + } + }); + } + return makeExplicit(range); + } + case 'scheme': + return makeExplicit(parseScheme(specifiedScale[property])); + } + } + } + } + const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height'; + const sizeValue = size[sizeChannel]; + if (isStep(sizeValue)) { + if (isXorY(channel)) { + if (hasDiscreteDomain(scaleType)) { + const step = getPositionStep(sizeValue, model, channel); + // Need to be explicit so layer with step wins over layer without step + if (step) { + return makeExplicit({ + step + }); + } + } else { + warn(stepDropped(sizeChannel)); + } + } else if (isXorYOffset(channel)) { + const positionChannel = channel === XOFFSET ? 'x' : 'y'; + const positionScaleCmpt = model.getScaleComponent(positionChannel); + const positionScaleType = positionScaleCmpt.get('type'); + if (positionScaleType === 'band') { + const step = getOffsetStep(sizeValue, scaleType); + if (step) { + return makeExplicit(step); + } + } + } + } + const { + rangeMin, + rangeMax + } = specifiedScale; + const d = defaultRange(channel, model); + if ((rangeMin !== undefined || rangeMax !== undefined) && + // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same + scaleTypeSupportProperty(scaleType, 'rangeMin') && vega.isArray(d) && d.length === 2) { + return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]); + } + return makeImplicit(d); + } + function parseScheme(scheme) { + if (isExtendedScheme(scheme)) { + return { + scheme: scheme.name, + ...omit(scheme, ['name']) + }; + } + return { + scheme + }; + } + function fullWidthOrHeightRange(channel, model, scaleType) { + let { + center + } = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + // If step is null, use zero to width or height. + // Note that we use SignalRefWrapper to account for potential merges and renames. + const sizeType = getSizeChannel(channel); + const sizeSignal = model.getName(sizeType); + const getSignalName = model.getSignalName.bind(model); + if (channel === Y && hasContinuousDomain(scaleType)) { + // For y continuous scale, we have to start from the height as the bottom part has the max value. + return center ? [SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal), SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal)] : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0]; + } else { + return center ? [SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal), SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal)] : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)]; + } + } + function defaultRange(channel, model) { + const { + size, + config, + mark, + encoding + } = model; + const { + type + } = getFieldOrDatumDef(encoding[channel]); + const mergedScaleCmpt = model.getScaleComponent(channel); + const scaleType = mergedScaleCmpt.get('type'); + const { + domain, + domainMid + } = model.specifiedScales[channel]; + switch (channel) { + case X: + case Y: + { + // If there is no explicit width/height for discrete x/y scales + if (contains(['point', 'band'], scaleType)) { + const positionSize = getDiscretePositionSize(channel, size, config.view); + if (isStep(positionSize)) { + const step = getPositionStep(positionSize, model, channel); + return { + step + }; + } + } + return fullWidthOrHeightRange(channel, model, scaleType); + } + case XOFFSET: + case YOFFSET: + return getOffsetRange(channel, model, scaleType); + case SIZE: + { + // TODO: support custom rangeMin, rangeMax + const zero = model.component.scales[channel].get('zero'); + const rangeMin = sizeRangeMin(mark, zero, config); + const rangeMax = sizeRangeMax(mark, size, model, config); + if (isContinuousToDiscrete(scaleType)) { + return interpolateRange(rangeMin, rangeMax, defaultContinuousToDiscreteCount(scaleType, config, domain, channel)); + } else { + return [rangeMin, rangeMax]; + } + } + case THETA: + return [0, Math.PI * 2]; + case ANGLE: + // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks. + // (It's weird to add just config.scale.min/maxAngleDegree for now) + return [0, 360]; + case RADIUS: + { + // max radius = half od min(width,height) + return [0, new SignalRefWrapper(() => { + const w = model.getSignalName('width'); + const h = model.getSignalName('height'); + return `min(${w},${h})/2`; + })]; + } + case STROKEWIDTH: + // TODO: support custom rangeMin, rangeMax + return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth]; + case STROKEDASH: + return [ + // TODO: add this to Vega's config.range? + [1, 0], [4, 2], [2, 1], [1, 1], [1, 2, 4, 2]]; + case SHAPE: + return 'symbol'; + case COLOR: + case FILL: + case STROKE: + if (scaleType === 'ordinal') { + // Only nominal data uses ordinal scale by default + return type === 'nominal' ? 'category' : 'ordinal'; + } else { + if (domainMid !== undefined) { + return 'diverging'; + } else { + return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp'; + } + } + case OPACITY: + case FILLOPACITY: + case STROKEOPACITY: + // TODO: support custom rangeMin, rangeMax + return [config.scale.minOpacity, config.scale.maxOpacity]; + } + } + function getPositionStep(step, model, channel) { + const { + encoding + } = model; + const mergedScaleCmpt = model.getScaleComponent(channel); + const offsetChannel = getOffsetScaleChannel(channel); + const offsetDef = encoding[offsetChannel]; + const stepFor = getStepFor({ + step, + offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete$1(offsetDef.type) + }); + if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) { + const offsetScaleCmpt = model.getScaleComponent(offsetChannel); + const offsetScaleName = model.scaleName(offsetChannel); + let stepCount = `domain('${offsetScaleName}').length`; + if (offsetScaleCmpt.get('type') === 'band') { + const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0; + const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0; + stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`; + } + const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding'); + return { + signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})` + }; + } else { + return step.step; + } + } + function getOffsetStep(step, offsetScaleType) { + const stepFor = getStepFor({ + step, + offsetIsDiscrete: hasDiscreteDomain(offsetScaleType) + }); + if (stepFor === 'offset') { + return { + step: step.step + }; + } + return undefined; + } + function getOffsetRange(channel, model, offsetScaleType) { + const positionChannel = channel === XOFFSET ? 'x' : 'y'; + const positionScaleCmpt = model.getScaleComponent(positionChannel); + if (!positionScaleCmpt) { + return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, { + center: true + }); + } + const positionScaleType = positionScaleCmpt.get('type'); + const positionScaleName = model.scaleName(positionChannel); + const { + markDef, + config + } = model; + if (positionScaleType === 'band') { + const size = getDiscretePositionSize(positionChannel, model.size, model.config.view); + if (isStep(size)) { + // step is for offset + const step = getOffsetStep(size, offsetScaleType); + if (step) { + return step; + } + } + // otherwise use the position + return [0, { + signal: `bandwidth('${positionScaleName}')` + }]; + } else { + // continuous scale + const positionDef = model.encoding[positionChannel]; + if (isFieldDef(positionDef) && positionDef.timeUnit) { + const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`); + const padding = model.config.scale.bandWithNestedOffsetPaddingInner; + const bandPositionOffset = getBandPosition({ + fieldDef: positionDef, + markDef, + config + }) - 0.5; + const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : ''; + if (padding) { + const startRatio = isSignalRef(padding) ? `${padding.signal}/2` + bandPositionOffsetExpr : `${padding / 2 + bandPositionOffset}`; + const endRatio = isSignalRef(padding) ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr : `${1 - padding / 2 + bandPositionOffset}`; + return [{ + signal: `${startRatio} * (${duration})` + }, { + signal: `${endRatio} * (${duration})` + }]; + } + return [0, { + signal: duration + }]; + } + return never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`); + } + } + function getDiscretePositionSize(channel, size, viewConfig) { + const sizeChannel = channel === X ? 'width' : 'height'; + const sizeValue = size[sizeChannel]; + if (sizeValue) { + return sizeValue; + } + return getViewConfigDiscreteSize(viewConfig, sizeChannel); + } + function defaultContinuousToDiscreteCount(scaleType, config, domain, channel) { + switch (scaleType) { + case 'quantile': + return config.scale.quantileCount; + case 'quantize': + return config.scale.quantizeCount; + case 'threshold': + if (domain !== undefined && vega.isArray(domain)) { + return domain.length + 1; + } else { + warn(domainRequiredForThresholdScale(channel)); + // default threshold boundaries for threshold scale since domain has cardinality of 2 + return 3; + } + } + } + + /** + * Returns the linear interpolation of the range according to the cardinality + * + * @param rangeMin start of the range + * @param rangeMax end of the range + * @param cardinality number of values in the output range + */ + function interpolateRange(rangeMin, rangeMax, cardinality) { + // always return a signal since it's better to compute the sequence in Vega later + const f = () => { + const rMax = signalOrStringValue(rangeMax); + const rMin = signalOrStringValue(rangeMin); + const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`; + return `sequence(${rMin}, ${rMax} + ${step}, ${step})`; + }; + if (isSignalRef(rangeMax)) { + return new SignalRefWrapper(f); + } else { + return { + signal: f() + }; + } + } + function sizeRangeMin(mark, zero, config) { + if (zero) { + if (isSignalRef(zero)) { + return { + signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}` + }; + } else { + return 0; + } + } + switch (mark) { + case 'bar': + case 'tick': + return config.scale.minBandSize; + case 'line': + case 'trail': + case 'rule': + return config.scale.minStrokeWidth; + case 'text': + return config.scale.minFontSize; + case 'point': + case 'square': + case 'circle': + return config.scale.minSize; + } + /* istanbul ignore next: should never reach here */ + // sizeRangeMin not implemented for the mark + throw new Error(incompatibleChannel('size', mark)); + } + const MAX_SIZE_RANGE_STEP_RATIO = 0.95; + function sizeRangeMax(mark, size, model, config) { + const xyStepSignals = { + x: getBinStepSignal(model, 'x'), + y: getBinStepSignal(model, 'y') + }; + switch (mark) { + case 'bar': + case 'tick': + { + if (config.scale.maxBandSize !== undefined) { + return config.scale.maxBandSize; + } + const min = minXYStep(size, xyStepSignals, config.view); + if (vega.isNumber(min)) { + return min - 1; + } else { + return new SignalRefWrapper(() => `${min.signal} - 1`); + } + } + case 'line': + case 'trail': + case 'rule': + return config.scale.maxStrokeWidth; + case 'text': + return config.scale.maxFontSize; + case 'point': + case 'square': + case 'circle': + { + if (config.scale.maxSize) { + return config.scale.maxSize; + } + const pointStep = minXYStep(size, xyStepSignals, config.view); + if (vega.isNumber(pointStep)) { + return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2); + } else { + return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`); + } + } + } + /* istanbul ignore next: should never reach here */ + // sizeRangeMax not implemented for the mark + throw new Error(incompatibleChannel('size', mark)); + } + + /** + * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale. + */ + function minXYStep(size, xyStepSignals, viewConfig) { + const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width'); + const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height'); + if (xyStepSignals.x || xyStepSignals.y) { + return new SignalRefWrapper(() => { + const exprs = [xyStepSignals.x ? xyStepSignals.x.signal : widthStep, xyStepSignals.y ? xyStepSignals.y.signal : heightStep]; + return `min(${exprs.join(', ')})`; + }); + } + return Math.min(widthStep, heightStep); + } + + function parseScaleProperty(model, property) { + if (isUnitModel(model)) { + parseUnitScaleProperty(model, property); + } else { + parseNonUnitScaleProperty(model, property); + } + } + function parseUnitScaleProperty(model, property) { + const localScaleComponents = model.component.scales; + const { + config, + encoding, + markDef, + specifiedScales + } = model; + for (const channel of keys(localScaleComponents)) { + const specifiedScale = specifiedScales[channel]; + const localScaleCmpt = localScaleComponents[channel]; + const mergedScaleCmpt = model.getScaleComponent(channel); + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + const specifiedValue = specifiedScale[property]; + const scaleType = mergedScaleCmpt.get('type'); + const scalePadding = mergedScaleCmpt.get('padding'); + const scalePaddingInner = mergedScaleCmpt.get('paddingInner'); + const supportedByScaleType = scaleTypeSupportProperty(scaleType, property); + const channelIncompatability = channelScalePropertyIncompatability(channel, property); + if (specifiedValue !== undefined) { + // If there is a specified value, check if it is compatible with scale type and channel + if (!supportedByScaleType) { + warn(scalePropertyNotWorkWithScaleType(scaleType, property, channel)); + } else if (channelIncompatability) { + // channel + warn(channelIncompatability); + } + } + if (supportedByScaleType && channelIncompatability === undefined) { + if (specifiedValue !== undefined) { + const timeUnit = fieldOrDatumDef['timeUnit']; + const type = fieldOrDatumDef.type; + switch (property) { + // domainMax/Min to signal if the value is a datetime object + case 'domainMax': + case 'domainMin': + if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) { + localScaleCmpt.set(property, { + signal: valueExpr(specifiedScale[property], { + type, + timeUnit + }) + }, true); + } else { + localScaleCmpt.set(property, specifiedScale[property], true); + } + break; + default: + localScaleCmpt.copyKeyFromObject(property, specifiedScale); + } + } else { + const value = property in scaleRules ? scaleRules[property]({ + model, + channel, + fieldOrDatumDef, + scaleType, + scalePadding, + scalePaddingInner, + domain: specifiedScale.domain, + domainMin: specifiedScale.domainMin, + domainMax: specifiedScale.domainMax, + markDef, + config, + hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel), + hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)] + }) : config.scale[property]; + if (value !== undefined) { + localScaleCmpt.set(property, value, false); + } + } + } + } + } + const scaleRules = { + bins: _ref => { + let { + model, + fieldOrDatumDef + } = _ref; + return isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined; + }, + interpolate: _ref2 => { + let { + channel, + fieldOrDatumDef + } = _ref2; + return interpolate(channel, fieldOrDatumDef.type); + }, + nice: _ref3 => { + let { + scaleType, + channel, + domain, + domainMin, + domainMax, + fieldOrDatumDef + } = _ref3; + return nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef); + }, + padding: _ref4 => { + let { + channel, + scaleType, + fieldOrDatumDef, + markDef, + config + } = _ref4; + return padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar); + }, + paddingInner: _ref5 => { + let { + scalePadding, + channel, + markDef, + scaleType, + config, + hasNestedOffsetScale + } = _ref5; + return paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale); + }, + paddingOuter: _ref6 => { + let { + scalePadding, + channel, + scaleType, + scalePaddingInner, + config, + hasNestedOffsetScale + } = _ref6; + return paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale); + }, + reverse: _ref7 => { + let { + fieldOrDatumDef, + scaleType, + channel, + config + } = _ref7; + const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined; + return reverse(scaleType, sort, channel, config.scale); + }, + zero: _ref8 => { + let { + channel, + fieldOrDatumDef, + domain, + markDef, + scaleType, + config, + hasSecondaryRangeChannel + } = _ref8; + return zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel); + } + }; + + // This method is here rather than in range.ts to avoid circular dependency. + function parseScaleRange(model) { + if (isUnitModel(model)) { + parseUnitScaleRange(model); + } else { + parseNonUnitScaleProperty(model, 'range'); + } + } + function parseNonUnitScaleProperty(model, property) { + const localScaleComponents = model.component.scales; + for (const child of model.children) { + if (property === 'range') { + parseScaleRange(child); + } else { + parseScaleProperty(child, property); + } + } + for (const channel of keys(localScaleComponents)) { + let valueWithExplicit; + for (const child of model.children) { + const childComponent = child.component.scales[channel]; + if (childComponent) { + const childValueWithExplicit = childComponent.getWithExplicit(property); + valueWithExplicit = mergeValuesWithExplicit(valueWithExplicit, childValueWithExplicit, property, 'scale', tieBreakByComparing((v1, v2) => { + switch (property) { + case 'range': + // For step, prefer larger step + if (v1.step && v2.step) { + return v1.step - v2.step; + } + return 0; + // TODO: precedence rule for other properties + } + + return 0; + })); + } + } + localScaleComponents[channel].setWithExplicit(property, valueWithExplicit); + } + } + function bins(model, fieldDef) { + const bin = fieldDef.bin; + if (isBinning(bin)) { + const binSignal = getBinSignalName(model, fieldDef.field, bin); + return new SignalRefWrapper(() => { + return model.getSignalName(binSignal); + }); + } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) { + // start and stop will be determined from the scale domain + return { + step: bin.step + }; + } + return undefined; + } + function interpolate(channel, type) { + if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') { + return 'hcl'; + } + return undefined; + } + function nice(scaleType, channel, specifiedDomain, domainMin, domainMax, fieldOrDatumDef) { + if (getFieldDef(fieldOrDatumDef)?.bin || vega.isArray(specifiedDomain) || domainMax != null || domainMin != null || contains([ScaleType.TIME, ScaleType.UTC], scaleType)) { + return undefined; + } + return isXorY(channel) ? true : undefined; + } + function padding(channel, scaleType, scaleConfig, fieldOrDatumDef, markDef, barConfig) { + if (isXorY(channel)) { + if (isContinuousToContinuous(scaleType)) { + if (scaleConfig.continuousPadding !== undefined) { + return scaleConfig.continuousPadding; + } + const { + type, + orient + } = markDef; + if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) { + if (orient === 'vertical' && channel === 'x' || orient === 'horizontal' && channel === 'y') { + return barConfig.continuousBandSize; + } + } + } + if (scaleType === ScaleType.POINT) { + return scaleConfig.pointPadding; + } + } + return undefined; + } + function paddingInner(paddingValue, channel, mark, scaleType, scaleConfig) { + let hasNestedOffsetScale = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; + if (paddingValue !== undefined) { + // If user has already manually specified "padding", no need to add default paddingInner. + return undefined; + } + if (isXorY(channel)) { + // Padding is only set for X and Y by default. + // Basically it doesn't make sense to add padding for color and size. + + // paddingOuter would only be called if it's a band scale, just return the default for bandScale. + const { + bandPaddingInner, + barBandPaddingInner, + rectBandPaddingInner, + bandWithNestedOffsetPaddingInner + } = scaleConfig; + if (hasNestedOffsetScale) { + return bandWithNestedOffsetPaddingInner; + } + return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); + } else if (isXorYOffset(channel)) { + if (scaleType === ScaleType.BAND) { + return scaleConfig.offsetBandPaddingInner; + } + } + return undefined; + } + function paddingOuter(paddingValue, channel, scaleType, paddingInnerValue, scaleConfig) { + let hasNestedOffsetScale = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false; + if (paddingValue !== undefined) { + // If user has already manually specified "padding", no need to add default paddingOuter. + return undefined; + } + if (isXorY(channel)) { + const { + bandPaddingOuter, + bandWithNestedOffsetPaddingOuter + } = scaleConfig; + if (hasNestedOffsetScale) { + return bandWithNestedOffsetPaddingOuter; + } + // Padding is only set for X and Y by default. + // Basically it doesn't make sense to add padding for color and size. + if (scaleType === ScaleType.BAND) { + return getFirstDefined(bandPaddingOuter, + /* By default, paddingOuter is paddingInner / 2. The reason is that + size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter). + and we want the width/height to be integer by default. + Note that step (by default) and cardinality are integers.) */ + isSignalRef(paddingInnerValue) ? { + signal: `${paddingInnerValue.signal}/2` + } : paddingInnerValue / 2); + } + } else if (isXorYOffset(channel)) { + if (scaleType === ScaleType.POINT) { + return 0.5; // so the point positions align with centers of band scales. + } else if (scaleType === ScaleType.BAND) { + return scaleConfig.offsetBandPaddingOuter; + } + } + return undefined; + } + function reverse(scaleType, sort, channel, scaleConfig) { + if (channel === 'x' && scaleConfig.xReverse !== undefined) { + if (hasContinuousDomain(scaleType) && sort === 'descending') { + if (isSignalRef(scaleConfig.xReverse)) { + return { + signal: `!${scaleConfig.xReverse.signal}` + }; + } else { + return !scaleConfig.xReverse; + } + } + return scaleConfig.xReverse; + } + if (hasContinuousDomain(scaleType) && sort === 'descending') { + // For continuous domain scales, Vega does not support domain sort. + // Thus, we reverse range instead if sort is descending + return true; + } + return undefined; + } + function zero(channel, fieldDef, specifiedDomain, markDef, scaleType, scaleConfig, hasSecondaryRangeChannel) { + // If users explicitly provide a domain, we should not augment zero as that will be unexpected. + const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated'; + if (hasCustomDomain) { + if (hasContinuousDomain(scaleType)) { + if (vega.isArray(specifiedDomain)) { + const first = specifiedDomain[0]; + const last = specifiedDomain[specifiedDomain.length - 1]; + if (vega.isNumber(first) && first <= 0 && vega.isNumber(last) && last >= 0) { + // if the domain includes zero, make zero remain true + return true; + } + } + return false; + } + } + + // If there is no custom domain, return configZero value (=`true` as default) only for the following cases: + + // 1) using quantitative field with size + // While this can be either ratio or interval fields, our assumption is that + // ratio are more common. However, if the scaleType is discretizing scale, we want to return + // false so that range doesn't start at zero + if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) { + return true; + } + + // 2) non-binned, quantitative x-scale or y-scale + // (For binning, we should not include zero by default because binning are calculated without zero.) + // (For area/bar charts with ratio scale chart, we should always include zero.) + if (!(isFieldDef(fieldDef) && fieldDef.bin) && contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)) { + const { + orient, + type + } = markDef; + if (contains(['bar', 'area', 'line', 'trail'], type)) { + if (orient === 'horizontal' && channel === 'y' || orient === 'vertical' && channel === 'x') { + return false; + } + } + if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) { + return true; + } + return scaleConfig?.zero; + } + return false; + } + + /** + * Determine if there is a specified scale type and if it is appropriate, + * or determine default type if type is unspecified or inappropriate. + */ // NOTE: CompassQL uses this method. + function scaleType(specifiedScale, channel, fieldDef, mark) { + let hasNestedOffsetScale = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; + const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale); + const { + type + } = specifiedScale; + if (!isScaleChannel(channel)) { + // There is no scale for these channels + return null; + } + if (type !== undefined) { + // Check if explicitly specified scale type is supported by the channel + if (!channelSupportScaleType(channel, type)) { + warn(scaleTypeNotWorkWithChannel(channel, type, defaultScaleType)); + return defaultScaleType; + } + + // Check if explicitly specified scale type is supported by the data type + if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) { + warn(scaleTypeNotWorkWithFieldDef(type, defaultScaleType)); + return defaultScaleType; + } + return type; + } + return defaultScaleType; + } + + /** + * Determine appropriate default scale type. + */ + // NOTE: Voyager uses this method. + function defaultType(channel, fieldDef, mark, hasNestedOffsetScale) { + switch (fieldDef.type) { + case 'nominal': + case 'ordinal': + { + if (isColorChannel(channel) || rangeType(channel) === 'discrete') { + if (channel === 'shape' && fieldDef.type === 'ordinal') { + warn(discreteChannelCannotEncode(channel, 'ordinal')); + } + return 'ordinal'; + } + if (isXorY(channel) || isXorYOffset(channel)) { + if (contains(['rect', 'bar', 'image', 'rule'], mark.type)) { + // The rect/bar mark should fit into a band. + // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429 + return 'band'; + } + if (hasNestedOffsetScale) { + // If there is a nested offset scale, then there is a "band" for the span of the nested scale. + return 'band'; + } + } else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) { + return 'band'; + } + const dimensionSize = mark[getSizeChannel(channel)]; + if (isRelativeBandSize(dimensionSize)) { + return 'band'; + } + if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) { + return 'band'; + } + // Otherwise, use ordinal point scale so we can easily get center positions of the marks. + return 'point'; + } + case 'temporal': + if (isColorChannel(channel)) { + return 'time'; + } else if (rangeType(channel) === 'discrete') { + warn(discreteChannelCannotEncode(channel, 'temporal')); + // TODO: consider using quantize (equivalent to binning) once we have it + return 'ordinal'; + } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) { + return 'utc'; + } + return 'time'; + case 'quantitative': + if (isColorChannel(channel)) { + if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) { + return 'bin-ordinal'; + } + return 'linear'; + } else if (rangeType(channel) === 'discrete') { + warn(discreteChannelCannotEncode(channel, 'quantitative')); + // TODO: consider using quantize (equivalent to binning) once we have it + return 'ordinal'; + } + return 'linear'; + case 'geojson': + return undefined; + } + + /* istanbul ignore next: should never reach this */ + throw new Error(invalidFieldType(fieldDef.type)); + } + + function parseScales(model) { + let { + ignoreRange + } = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + parseScaleCore(model); + parseScaleDomain(model); + for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) { + parseScaleProperty(model, prop); + } + if (!ignoreRange) { + // range depends on zero + parseScaleRange(model); + } + } + function parseScaleCore(model) { + if (isUnitModel(model)) { + model.component.scales = parseUnitScaleCore(model); + } else { + model.component.scales = parseNonUnitScaleCore(model); + } + } + + /** + * Parse scales for all channels of a model. + */ + function parseUnitScaleCore(model) { + const { + encoding, + mark, + markDef + } = model; + const scaleComponents = {}; + for (const channel of SCALE_CHANNELS) { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); // must be typed def to have scale + + // Don't generate scale for shape of geoshape + if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) { + continue; + } + let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale']; + if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) { + specifiedScale ??= {}; + const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel); + const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale); + scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), { + value: sType, + explicit: specifiedScale.type === sType + }); + } + } + return scaleComponents; + } + const scaleTypeTieBreaker = tieBreakByComparing((st1, st2) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)); + function parseNonUnitScaleCore(model) { + const scaleComponents = model.component.scales = {}; + const scaleTypeWithExplicitIndex = {}; + const resolve = model.component.resolve; + + // Parse each child scale and determine if a particular channel can be merged. + for (const child of model.children) { + parseScaleCore(child); + + // Instead of always merging right away -- check if it is compatible to merge first! + for (const channel of keys(child.component.scales)) { + // if resolve is undefined, set default first + resolve.scale[channel] ??= defaultScaleResolve(channel, model); + if (resolve.scale[channel] === 'shared') { + const explicitScaleType = scaleTypeWithExplicitIndex[channel]; + const childScaleType = child.component.scales[channel].getWithExplicit('type'); + if (explicitScaleType) { + if (scaleCompatible(explicitScaleType.value, childScaleType.value)) { + // merge scale component if type are compatible + scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(explicitScaleType, childScaleType, 'type', 'scale', scaleTypeTieBreaker); + } else { + // Otherwise, update conflicting channel to be independent + resolve.scale[channel] = 'independent'; + // Remove from the index so they don't get merged + delete scaleTypeWithExplicitIndex[channel]; + } + } else { + scaleTypeWithExplicitIndex[channel] = childScaleType; + } + } + } + } + + // Merge each channel listed in the index + for (const channel of keys(scaleTypeWithExplicitIndex)) { + // Create new merged scale component + const name = model.scaleName(channel, true); + const typeWithExplicit = scaleTypeWithExplicitIndex[channel]; + scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit); + + // rename each child and mark them as merged + for (const child of model.children) { + const childScale = child.component.scales[channel]; + if (childScale) { + child.renameScale(childScale.get('name'), name); + childScale.merged = true; + } + } + } + return scaleComponents; + } + + /** + * Composable Components that are intermediate results of the parsing phase of the + * compilations. The components represents parts of the specification in a form that + * can be easily merged (during parsing for composite specs). + * In addition, these components are easily transformed into Vega specifications + * during the "assemble" phase, which is the last phase of the compilation step. + */ + + class NameMap { + constructor() { + _defineProperty(this, "nameMap", void 0); + this.nameMap = {}; + } + rename(oldName, newName) { + this.nameMap[oldName] = newName; + } + has(name) { + return this.nameMap[name] !== undefined; + } + get(name) { + // If the name appears in the _nameMap, we need to read its new name. + // We have to loop over the dict just in case the new name also gets renamed. + while (this.nameMap[name] && name !== this.nameMap[name]) { + name = this.nameMap[name]; + } + return name; + } + } + + /* + We use type guards instead of `instanceof` as `instanceof` makes + different parts of the compiler depend on the actual implementation of + the model classes, which in turn depend on different parts of the compiler. + Thus, `instanceof` leads to circular dependency problems. + + On the other hand, type guards only make different parts of the compiler + depend on the type of the model classes, but not the actual implementation. + */ + + function isUnitModel(model) { + return model?.type === 'unit'; + } + function isFacetModel(model) { + return model?.type === 'facet'; + } + function isConcatModel(model) { + return model?.type === 'concat'; + } + function isLayerModel(model) { + return model?.type === 'layer'; + } + class Model { + constructor(spec, type, parent, parentGivenName, config, resolve, view) { + this.type = type; + this.parent = parent; + this.config = config; + _defineProperty(this, "name", void 0); + _defineProperty(this, "size", void 0); + _defineProperty(this, "title", void 0); + _defineProperty(this, "description", void 0); + _defineProperty(this, "data", void 0); + _defineProperty(this, "transforms", void 0); + _defineProperty(this, "layout", void 0); + /** Name map for scales, which can be renamed by a model's parent. */ + _defineProperty(this, "scaleNameMap", void 0); + /** Name map for projections, which can be renamed by a model's parent. */ + _defineProperty(this, "projectionNameMap", void 0); + /** Name map for signals, which can be renamed by a model's parent. */ + _defineProperty(this, "signalNameMap", void 0); + _defineProperty(this, "component", void 0); + _defineProperty(this, "view", void 0); + _defineProperty(this, "children", void 0); + /** + * Corrects the data references in marks after assemble. + */ + _defineProperty(this, "correctDataNames", mark => { + // TODO: make this correct + + // for normal data references + if (mark.from?.data) { + mark.from.data = this.lookupDataSource(mark.from.data); + } + + // for access to facet data + if (mark.from?.facet?.data) { + mark.from.facet.data = this.lookupDataSource(mark.from.facet.data); + } + return mark; + }); + this.parent = parent; + this.config = config; + this.view = replaceExprRef(view); + + // If name is not provided, always use parent's givenName to avoid name conflicts. + this.name = spec.name ?? parentGivenName; + this.title = isText(spec.title) ? { + text: spec.title + } : spec.title ? replaceExprRef(spec.title) : undefined; + + // Shared name maps + this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap(); + this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap(); + this.signalNameMap = parent ? parent.signalNameMap : new NameMap(); + this.data = spec.data; + this.description = spec.description; + this.transforms = normalizeTransform(spec.transform ?? []); + this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config); + this.component = { + data: { + sources: parent ? parent.component.data.sources : [], + outputNodes: parent ? parent.component.data.outputNodes : {}, + outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {}, + // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined + isFaceted: isFacetSpec(spec) || parent?.component.data.isFaceted && spec.data === undefined + }, + layoutSize: new Split(), + layoutHeaders: { + row: {}, + column: {}, + facet: {} + }, + mark: null, + resolve: { + scale: {}, + axis: {}, + legend: {}, + ...(resolve ? duplicate(resolve) : {}) + }, + selection: null, + scales: null, + projection: null, + axes: {}, + legends: {} + }; + } + get width() { + return this.getSizeSignalRef('width'); + } + get height() { + return this.getSizeSignalRef('height'); + } + parse() { + this.parseScale(); + this.parseLayoutSize(); // depends on scale + this.renameTopLevelLayoutSizeSignal(); + this.parseSelections(); + this.parseProjection(); + this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name. + this.parseAxesAndHeaders(); // depends on scale and layout size + this.parseLegends(); // depends on scale, markDef + this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark. + } + + parseScale() { + parseScales(this); + } + parseProjection() { + parseProjection(this); + } + /** + * Rename top-level spec's size to be just width / height, ignoring model name. + * This essentially merges the top-level spec's width/height signals with the width/height signals + * to help us reduce redundant signals declaration. + */ + renameTopLevelLayoutSizeSignal() { + if (this.getName('width') !== 'width') { + this.renameSignal(this.getName('width'), 'width'); + } + if (this.getName('height') !== 'height') { + this.renameSignal(this.getName('height'), 'height'); + } + } + parseLegends() { + parseLegend(this); + } + assembleEncodeFromView(view) { + // Exclude "style" + const { + style: _, + ...baseView + } = view; + const e = {}; + for (const property of keys(baseView)) { + const value = baseView[property]; + if (value !== undefined) { + e[property] = signalOrValueRef(value); + } + } + return e; + } + assembleGroupEncodeEntry(isTopLevel) { + let encodeEntry = {}; + if (this.view) { + encodeEntry = this.assembleEncodeFromView(this.view); + } + if (!isTopLevel) { + // Descriptions are already added to the top-level description so we only need to add them to the inner views. + if (this.description) { + encodeEntry['description'] = signalOrValueRef(this.description); + } + + // For top-level spec, we can set the global width and height signal to adjust the group size. + // For other child specs, we have to manually set width and height in the encode entry. + if (this.type === 'unit' || this.type === 'layer') { + return { + width: this.getSizeSignalRef('width'), + height: this.getSizeSignalRef('height'), + ...(encodeEntry ?? {}) + }; + } + } + return isEmpty(encodeEntry) ? undefined : encodeEntry; + } + assembleLayout() { + if (!this.layout) { + return undefined; + } + const { + spacing, + ...layout + } = this.layout; + const { + component, + config + } = this; + const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config); + return { + padding: spacing, + ...this.assembleDefaultLayout(), + ...layout, + ...(titleBand ? { + titleBand + } : {}) + }; + } + assembleDefaultLayout() { + return {}; + } + assembleHeaderMarks() { + const { + layoutHeaders + } = this.component; + let headerMarks = []; + for (const channel of FACET_CHANNELS) { + if (layoutHeaders[channel].title) { + headerMarks.push(assembleTitleGroup(this, channel)); + } + } + for (const channel of HEADER_CHANNELS) { + headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel)); + } + return headerMarks; + } + assembleAxes() { + return assembleAxes(this.component.axes, this.config); + } + assembleLegends() { + return assembleLegends(this); + } + assembleProjections() { + return assembleProjections(this); + } + assembleTitle() { + const { + encoding, + ...titleNoEncoding + } = this.title ?? {}; + const title = { + ...extractTitleConfig(this.config.title).nonMarkTitleProperties, + ...titleNoEncoding, + ...(encoding ? { + encode: { + update: encoding + } + } : {}) + }; + if (title.text) { + if (contains(['unit', 'layer'], this.type)) { + // Unit/Layer + if (contains(['middle', undefined], title.anchor)) { + title.frame ??= 'group'; + } + } else { + // composition with Vega layout + + // Set title = "start" by default for composition as "middle" does not look nice + // https://github.com/vega/vega/issues/960#issuecomment-471360328 + title.anchor ??= 'start'; + } + return isEmpty(title) ? undefined : title; + } + return undefined; + } + + /** + * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals. + */ + assembleGroup() { + let signals = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; + const group = {}; + signals = signals.concat(this.assembleSignals()); + if (signals.length > 0) { + group.signals = signals; + } + const layout = this.assembleLayout(); + if (layout) { + group.layout = layout; + } + group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks()); + + // Only include scales if this spec is top-level or if parent is facet. + // (Otherwise, it will be merged with upper-level's scope.) + const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : []; + if (scales.length > 0) { + group.scales = scales; + } + const axes = this.assembleAxes(); + if (axes.length > 0) { + group.axes = axes; + } + const legends = this.assembleLegends(); + if (legends.length > 0) { + group.legends = legends; + } + return group; + } + getName(text) { + return varName((this.name ? `${this.name}_` : '') + text); + } + getDataName(type) { + return this.getName(DataSourceType[type].toLowerCase()); + } + + /** + * Request a data source name for the given data source type and mark that data source as required. + * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData(). + * You can lookup the correct dataset name in assemble with `lookupDataSource`. + */ + requestDataName(name) { + const fullName = this.getDataName(name); + + // Increase ref count. This is critical because otherwise we won't create a data source. + // We also increase the ref counts on OutputNode.getSource() calls. + const refCounts = this.component.data.outputNodeRefCounts; + refCounts[fullName] = (refCounts[fullName] || 0) + 1; + return fullName; + } + getSizeSignalRef(layoutSizeType) { + if (isFacetModel(this.parent)) { + const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); + const channel = getPositionScaleChannel(sizeType); + const scaleComponent = this.component.scales[channel]; + if (scaleComponent && !scaleComponent.merged) { + // independent scale + const type = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const scaleName = scaleComponent.get('name'); + const domain = assembleDomain(this, channel); + const field = getFieldFromDomain(domain); + if (field) { + const fieldRef = vgField({ + aggregate: 'distinct', + field + }, { + expr: 'datum' + }); + return { + signal: sizeExpr(scaleName, scaleComponent, fieldRef) + }; + } else { + warn(unknownField(channel)); + return null; + } + } + } + } + return { + signal: this.signalNameMap.get(this.getName(layoutSizeType)) + }; + } + + /** + * Lookup the name of the datasource for an output node. You probably want to call this in assemble. + */ + lookupDataSource(name) { + const node = this.component.data.outputNodes[name]; + if (!node) { + // Name not found in map so let's just return what we got. + // This can happen if we already have the correct name. + return name; + } + return node.getSource(); + } + getSignalName(oldSignalName) { + return this.signalNameMap.get(oldSignalName); + } + renameSignal(oldName, newName) { + this.signalNameMap.rename(oldName, newName); + } + renameScale(oldName, newName) { + this.scaleNameMap.rename(oldName, newName); + } + renameProjection(oldName, newName) { + this.projectionNameMap.rename(oldName, newName); + } + + /** + * @return scale name for a given channel after the scale has been parsed and named. + */ + scaleName(originalScaleName, parse) { + if (parse) { + // During the parse phase always return a value + // No need to refer to rename map because a scale can't be renamed + // before it has the original name. + return this.getName(originalScaleName); + } + + // If there is a scale for the channel, it should either + // be in the scale component or exist in the name map + if ( + // If there is a scale for the channel, there should be a local scale component for it + isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName] || + // in the scale name map (the scale get merged by its parent) + this.scaleNameMap.has(this.getName(originalScaleName))) { + return this.scaleNameMap.get(this.getName(originalScaleName)); + } + return undefined; + } + + /** + * @return projection name after the projection has been parsed and named. + */ + projectionName(parse) { + if (parse) { + // During the parse phase always return a value + // No need to refer to rename map because a projection can't be renamed + // before it has the original name. + return this.getName('projection'); + } + if (this.component.projection && !this.component.projection.merged || this.projectionNameMap.has(this.getName('projection'))) { + return this.projectionNameMap.get(this.getName('projection')); + } + return undefined; + } + /** + * Traverse a model's hierarchy to get the scale component for a particular channel. + */ + getScaleComponent(channel) { + /* istanbul ignore next: This is warning for debugging test */ + if (!this.component.scales) { + throw new Error('getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'); + } + const localScaleComponent = this.component.scales[channel]; + if (localScaleComponent && !localScaleComponent.merged) { + return localScaleComponent; + } + return this.parent ? this.parent.getScaleComponent(channel) : undefined; + } + + /** + * Traverse a model's hierarchy to get a particular selection component. + */ + getSelectionComponent(variableName, origName) { + let sel = this.component.selection[variableName]; + if (!sel && this.parent) { + sel = this.parent.getSelectionComponent(variableName, origName); + } + if (!sel) { + throw new Error(selectionNotFound(origName)); + } + return sel; + } + + /** + * Returns true if the model has a signalRef for an axis orient. + */ + hasAxisOrientSignalRef() { + return this.component.axes.x?.some(a => a.hasOrientSignalRef()) || this.component.axes.y?.some(a => a.hasOrientSignalRef()); + } + } + + /** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */ + class ModelWithField extends Model { + /** Get "field" reference for Vega */ + vgField(channel) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + const fieldDef = this.fieldDef(channel); + if (!fieldDef) { + return undefined; + } + return vgField(fieldDef, opt); + } + reduceFieldDef(f, init) { + return reduce(this.getMapping(), (acc, cd, c) => { + const fieldDef = getFieldDef(cd); + if (fieldDef) { + return f(acc, fieldDef, c); + } + return acc; + }, init); + } + forEachFieldDef(f, t) { + forEach(this.getMapping(), (cd, c) => { + const fieldDef = getFieldDef(cd); + if (fieldDef) { + f(fieldDef, c); + } + }, t); + } + } + + /** + * A class for density transform nodes + */ + class DensityTransformNode extends DataFlowNode { + clone() { + return new DensityTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density']; + } + dependentFields() { + return new Set([this.transform.density, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `DensityTransform ${hash(this.transform)}`; + } + assemble() { + const { + density, + ...rest + } = this.transform; + const result = { + type: 'kde', + field: density, + ...rest + }; + if (this.transform.groupby) { + result.resolve = 'shared'; + } + return result; + } + } + + /** + * A class for flatten transform nodes + */ + class ExtentTransformNode extends DataFlowNode { + clone() { + return new ExtentTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); + } + dependentFields() { + return new Set([this.transform.extent]); + } + producedFields() { + return new Set([]); + } + hash() { + return `ExtentTransform ${hash(this.transform)}`; + } + assemble() { + const { + extent, + param + } = this.transform; + const result = { + type: 'extent', + field: extent, + signal: param + }; + return result; + } + } + + class FilterInvalidNode extends DataFlowNode { + clone() { + return new FilterInvalidNode(null, { + ...this.filter + }); + } + constructor(parent, filter) { + super(parent); + this.filter = filter; + } + static make(parent, model) { + const { + config, + mark, + markDef + } = model; + const invalid = getMarkPropOrConfig('invalid', markDef, config); + if (invalid !== 'filter') { + return null; + } + const filter = model.reduceFieldDef((aggregator, fieldDef, channel) => { + const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + + // While discrete domain scales can handle invalid values, continuous scales can't. + // Thus, for non-path marks, we have to filter null for scales with continuous domains. + // (For path marks, we will use "defined" property and skip these values instead.) + if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) { + aggregator[fieldDef.field] = fieldDef; // we know that the fieldDef is a typed field def + } + } + + return aggregator; + }, {}); + if (!keys(filter).length) { + return null; + } + return new FilterInvalidNode(parent, filter); + } + dependentFields() { + return new Set(keys(this.filter)); + } + producedFields() { + return new Set(); // filter does not produce any new fields + } + + hash() { + return `FilterInvalid ${hash(this.filter)}`; + } + + /** + * Create the VgTransforms for each of the filtered fields. + */ + assemble() { + const filters = keys(this.filter).reduce((vegaFilters, field) => { + const fieldDef = this.filter[field]; + const ref = vgField(fieldDef, { + expr: 'datum' + }); + if (fieldDef !== null) { + if (fieldDef.type === 'temporal') { + vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`); + } else if (fieldDef.type === 'quantitative') { + vegaFilters.push(`isValid(${ref})`); + vegaFilters.push(`isFinite(+${ref})`); + } else ; + } + return vegaFilters; + }, []); + return filters.length > 0 ? { + type: 'filter', + expr: filters.join(' && ') + } : null; + } + } + + /** + * A class for flatten transform nodes + */ + class FlattenTransformNode extends DataFlowNode { + clone() { + return new FlattenTransformNode(this.parent, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const { + flatten, + as = [] + } = this.transform; + this.transform.as = flatten.map((f, i) => as[i] ?? f); + } + dependentFields() { + return new Set(this.transform.flatten); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `FlattenTransform ${hash(this.transform)}`; + } + assemble() { + const { + flatten: fields, + as + } = this.transform; + const result = { + type: 'flatten', + fields, + as + }; + return result; + } + } + + /** + * A class for flatten transform nodes + */ + class FoldTransformNode extends DataFlowNode { + clone() { + return new FoldTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value']; + } + dependentFields() { + return new Set(this.transform.fold); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `FoldTransform ${hash(this.transform)}`; + } + assemble() { + const { + fold, + as + } = this.transform; + const result = { + type: 'fold', + fields: fold, + as + }; + return result; + } + } + + class GeoJSONNode extends DataFlowNode { + clone() { + return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal); + } + static parseAll(parent, model) { + if (model.component.projection && !model.component.projection.isFit) { + return parent; + } + let geoJsonCounter = 0; + for (const coordinates of [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]) { + const pair = coordinates.map(channel => { + const def = getFieldOrDatumDef(model.encoding[channel]); + return isFieldDef(def) ? def.field : isDatumDef(def) ? { + expr: `${def.datum}` + } : isValueDef(def) ? { + expr: `${def['value']}` + } : undefined; + }); + if (pair[0] || pair[1]) { + parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`)); + } + } + if (model.channelHasField(SHAPE)) { + const fieldDef = model.typedFieldDef(SHAPE); + if (fieldDef.type === GEOJSON) { + parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`)); + } + } + return parent; + } + constructor(parent, fields, geojson, signal) { + super(parent); + this.fields = fields; + this.geojson = geojson; + this.signal = signal; + } + dependentFields() { + const fields = (this.fields ?? []).filter(vega.isString); + return new Set([...(this.geojson ? [this.geojson] : []), ...fields]); + } + producedFields() { + return new Set(); + } + hash() { + return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`; + } + assemble() { + return [...(this.geojson ? [{ + type: 'filter', + expr: `isValid(datum["${this.geojson}"])` + }] : []), { + type: 'geojson', + ...(this.fields ? { + fields: this.fields + } : {}), + ...(this.geojson ? { + geojson: this.geojson + } : {}), + signal: this.signal + }]; + } + } + + class GeoPointNode extends DataFlowNode { + clone() { + return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as)); + } + constructor(parent, projection, fields, as) { + super(parent); + this.projection = projection; + this.fields = fields; + this.as = as; + } + static parseAll(parent, model) { + if (!model.projectionName()) { + return parent; + } + for (const coordinates of [[LONGITUDE, LATITUDE], [LONGITUDE2, LATITUDE2]]) { + const pair = coordinates.map(channel => { + const def = getFieldOrDatumDef(model.encoding[channel]); + return isFieldDef(def) ? def.field : isDatumDef(def) ? { + expr: `${def.datum}` + } : isValueDef(def) ? { + expr: `${def['value']}` + } : undefined; + }); + const suffix = coordinates[0] === LONGITUDE2 ? '2' : ''; + if (pair[0] || pair[1]) { + parent = new GeoPointNode(parent, model.projectionName(), pair, [model.getName(`x${suffix}`), model.getName(`y${suffix}`)]); + } + } + return parent; + } + dependentFields() { + return new Set(this.fields.filter(vega.isString)); + } + producedFields() { + return new Set(this.as); + } + hash() { + return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`; + } + assemble() { + return { + type: 'geopoint', + projection: this.projection, + fields: this.fields, + as: this.as + }; + } + } + + class ImputeNode extends DataFlowNode { + clone() { + return new ImputeNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + dependentFields() { + return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set([this.transform.impute]); + } + processSequence(keyvals) { + const { + start = 0, + stop, + step + } = keyvals; + const result = [start, stop, ...(step ? [step] : [])].join(','); + return { + signal: `sequence(${result})` + }; + } + static makeFromTransform(parent, imputeTransform) { + return new ImputeNode(parent, imputeTransform); + } + static makeFromEncoding(parent, model) { + const encoding = model.encoding; + const xDef = encoding.x; + const yDef = encoding.y; + if (isFieldDef(xDef) && isFieldDef(yDef)) { + const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined; + if (imputedChannel === undefined) { + return undefined; + } + const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined; + const { + method, + value, + frame, + keyvals + } = imputedChannel.impute; + const groupbyFields = pathGroupingFields(model.mark, encoding); + return new ImputeNode(parent, { + impute: imputedChannel.field, + key: keyChannel.field, + ...(method ? { + method + } : {}), + ...(value !== undefined ? { + value + } : {}), + ...(frame ? { + frame + } : {}), + ...(keyvals !== undefined ? { + keyvals + } : {}), + ...(groupbyFields.length ? { + groupby: groupbyFields + } : {}) + }); + } + return null; + } + hash() { + return `Impute ${hash(this.transform)}`; + } + assemble() { + const { + impute, + key, + keyvals, + method, + groupby, + value, + frame = [null, null] + } = this.transform; + const imputeTransform = { + type: 'impute', + field: impute, + key, + ...(keyvals ? { + keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals + } : {}), + method: 'value', + ...(groupby ? { + groupby + } : {}), + value: !method || method === 'value' ? value : null + }; + if (method && method !== 'value') { + const deriveNewField = { + type: 'window', + as: [`imputed_${impute}_value`], + ops: [method], + fields: [impute], + frame, + ignorePeers: false, + ...(groupby ? { + groupby + } : {}) + }; + const replaceOriginal = { + type: 'formula', + expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`, + as: impute + }; + return [imputeTransform, deriveNewField, replaceOriginal]; + } else { + return [imputeTransform]; + } + } + } + + /** + * A class for loess transform nodes + */ + class LoessTransformNode extends DataFlowNode { + clone() { + return new LoessTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess]; + } + dependentFields() { + return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `LoessTransform ${hash(this.transform)}`; + } + assemble() { + const { + loess, + on, + ...rest + } = this.transform; + const result = { + type: 'loess', + x: on, + y: loess, + ...rest + }; + return result; + } + } + + class LookupNode extends DataFlowNode { + clone() { + return new LookupNode(null, duplicate(this.transform), this.secondary); + } + constructor(parent, transform, secondary) { + super(parent); + this.transform = transform; + this.secondary = secondary; + } + static make(parent, model, transform, counter) { + const sources = model.component.data.sources; + const { + from + } = transform; + let fromOutputNode = null; + if (isLookupData(from)) { + let fromSource = findSource(from.data, sources); + if (!fromSource) { + fromSource = new SourceNode(from.data); + sources.push(fromSource); + } + const fromOutputName = model.getName(`lookup_${counter}`); + fromOutputNode = new OutputNode(fromSource, fromOutputName, DataSourceType.Lookup, model.component.data.outputNodeRefCounts); + model.component.data.outputNodes[fromOutputName] = fromOutputNode; + } else if (isLookupSelection(from)) { + const selName = from.param; + transform = { + as: selName, + ...transform + }; + let selCmpt; + try { + selCmpt = model.getSelectionComponent(varName(selName), selName); + } catch (e) { + throw new Error(cannotLookupVariableParameter(selName)); + } + fromOutputNode = selCmpt.materialized; + if (!fromOutputNode) { + throw new Error(noSameUnitLookup(selName)); + } + } + return new LookupNode(parent, transform, fromOutputNode.getSource()); + } + dependentFields() { + return new Set([this.transform.lookup]); + } + producedFields() { + return new Set(this.transform.as ? vega.array(this.transform.as) : this.transform.from.fields); + } + hash() { + return `Lookup ${hash({ + transform: this.transform, + secondary: this.secondary + })}`; + } + assemble() { + let foreign; + if (this.transform.from.fields) { + // lookup a few fields and add create a flat output + foreign = { + values: this.transform.from.fields, + ...(this.transform.as ? { + as: vega.array(this.transform.as) + } : {}) + }; + } else { + // lookup full record and nest it + let asName = this.transform.as; + if (!vega.isString(asName)) { + warn(NO_FIELDS_NEEDS_AS); + asName = '_lookup'; + } + foreign = { + as: [asName] + }; + } + return { + type: 'lookup', + from: this.secondary, + key: this.transform.from.key, + fields: [this.transform.lookup], + ...foreign, + ...(this.transform.default ? { + default: this.transform.default + } : {}) + }; + } + } + + /** + * A class for quantile transform nodes + */ + class QuantileTransformNode extends DataFlowNode { + clone() { + return new QuantileTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value']; + } + dependentFields() { + return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `QuantileTransform ${hash(this.transform)}`; + } + assemble() { + const { + quantile, + ...rest + } = this.transform; + const result = { + type: 'quantile', + field: quantile, + ...rest + }; + return result; + } + } + + /** + * A class for regression transform nodes + */ + class RegressionTransformNode extends DataFlowNode { + clone() { + return new RegressionTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + this.transform = duplicate(transform); // duplicate to prevent side effects + const specifiedAs = this.transform.as ?? [undefined, undefined]; + this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression]; + } + dependentFields() { + return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]); + } + producedFields() { + return new Set(this.transform.as); + } + hash() { + return `RegressionTransform ${hash(this.transform)}`; + } + assemble() { + const { + regression, + on, + ...rest + } = this.transform; + const result = { + type: 'regression', + x: on, + y: regression, + ...rest + }; + return result; + } + } + + /** + * A class for pivot transform nodes. + */ + class PivotTransformNode extends DataFlowNode { + clone() { + return new PivotTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + addDimensions(fields) { + this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d); + } + producedFields() { + return undefined; // return undefined so that potentially everything can depend on the pivot + } + + dependentFields() { + return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]); + } + hash() { + return `PivotTransform ${hash(this.transform)}`; + } + assemble() { + const { + pivot, + value, + groupby, + limit, + op + } = this.transform; + return { + type: 'pivot', + field: pivot, + value, + ...(limit !== undefined ? { + limit + } : {}), + ...(op !== undefined ? { + op + } : {}), + ...(groupby !== undefined ? { + groupby + } : {}) + }; + } + } + + /** + * A class for the sample transform nodes + */ + class SampleTransformNode extends DataFlowNode { + clone() { + return new SampleTransformNode(null, duplicate(this.transform)); + } + constructor(parent, transform) { + super(parent); + this.transform = transform; + } + dependentFields() { + return new Set(); + } + producedFields() { + return new Set(); + } + hash() { + return `SampleTransform ${hash(this.transform)}`; + } + assemble() { + return { + type: 'sample', + size: this.transform.sample + }; + } + } + + function makeWalkTree(data) { + // to name datasources + let datasetIndex = 0; + + /** + * Recursively walk down the tree. + */ + function walkTree(node, dataSource) { + if (node instanceof SourceNode) { + // If the source is a named data source or a data source with values, we need + // to put it in a different data source. Otherwise, Vega may override the data. + if (!node.isGenerator && !isUrlData(node.data)) { + data.push(dataSource); + const newData = { + name: null, + source: dataSource.name, + transform: [] + }; + dataSource = newData; + } + } + if (node instanceof ParseNode) { + if (node.parent instanceof SourceNode && !dataSource.source) { + // If node's parent is a root source and the data source does not refer to another data source, use normal format parse + dataSource.format = { + ...(dataSource.format ?? {}), + parse: node.assembleFormatParse() + }; + + // add calculates for all nested fields + dataSource.transform.push(...node.assembleTransforms(true)); + } else { + // Otherwise use Vega expression to parse + dataSource.transform.push(...node.assembleTransforms()); + } + } + if (node instanceof FacetNode) { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + if (!dataSource.source || dataSource.transform.length > 0) { + data.push(dataSource); + node.data = dataSource.name; + } else { + node.data = dataSource.source; + } + data.push(...node.assemble()); + + // break here because the rest of the tree has to be taken care of by the facet. + return; + } + if (node instanceof GraticuleNode || node instanceof SequenceNode || node instanceof FilterInvalidNode || node instanceof FilterNode || node instanceof CalculateNode || node instanceof GeoPointNode || node instanceof AggregateNode || node instanceof LookupNode || node instanceof WindowTransformNode || node instanceof JoinAggregateTransformNode || node instanceof FoldTransformNode || node instanceof FlattenTransformNode || node instanceof DensityTransformNode || node instanceof LoessTransformNode || node instanceof QuantileTransformNode || node instanceof RegressionTransformNode || node instanceof IdentifierNode || node instanceof SampleTransformNode || node instanceof PivotTransformNode || node instanceof ExtentTransformNode) { + dataSource.transform.push(node.assemble()); + } + if (node instanceof BinNode || node instanceof TimeUnitNode || node instanceof ImputeNode || node instanceof StackNode || node instanceof GeoJSONNode) { + dataSource.transform.push(...node.assemble()); + } + if (node instanceof OutputNode) { + if (dataSource.source && dataSource.transform.length === 0) { + node.setSource(dataSource.source); + } else if (node.parent instanceof OutputNode) { + // Note that an output node may be required but we still do not assemble a + // separate data source for it. + node.setSource(dataSource.name); + } else { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + + // Here we set the name of the datasource we generated. From now on + // other assemblers can use it. + node.setSource(dataSource.name); + + // if this node has more than one child, we will add a datasource automatically + if (node.numChildren() === 1) { + data.push(dataSource); + const newData = { + name: null, + source: dataSource.name, + transform: [] + }; + dataSource = newData; + } + } + } + switch (node.numChildren()) { + case 0: + // done + if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) { + // do not push empty datasources that are simply references + data.push(dataSource); + } + break; + case 1: + walkTree(node.children[0], dataSource); + break; + default: + { + if (!dataSource.name) { + dataSource.name = `data_${datasetIndex++}`; + } + let source = dataSource.name; + if (!dataSource.source || dataSource.transform.length > 0) { + data.push(dataSource); + } else { + source = dataSource.source; + } + for (const child of node.children) { + const newData = { + name: null, + source, + transform: [] + }; + walkTree(child, newData); + } + break; + } + } + } + return walkTree; + } + + /** + * Assemble data sources that are derived from faceted data. + */ + function assembleFacetData(root) { + const data = []; + const walkTree = makeWalkTree(data); + for (const child of root.children) { + walkTree(child, { + source: root.name, + name: null, + transform: [] + }); + } + return data; + } + + /** + * Create Vega data array from a given compiled model and append all of them to the given array + * + * @param model + * @param data array + * @return modified data array + */ + function assembleRootData(dataComponent, datasets) { + const data = []; + + // dataComponent.sources.forEach(debug); + // draw(dataComponent.sources); + + const walkTree = makeWalkTree(data); + let sourceIndex = 0; + for (const root of dataComponent.sources) { + // assign a name if the source does not have a name yet + if (!root.hasName()) { + root.dataName = `source_${sourceIndex++}`; + } + const newData = root.assemble(); + walkTree(root, newData); + } + + // remove empty transform arrays for cleaner output + for (const d of data) { + if (d.transform.length === 0) { + delete d.transform; + } + } + + // move sources without transforms (the ones that are potentially used in lookups) to the beginning + let whereTo = 0; + for (const [i, d] of data.entries()) { + if ((d.transform ?? []).length === 0 && !d.source) { + data.splice(whereTo++, 0, data.splice(i, 1)[0]); + } + } + + // now fix the from references in lookup transforms + for (const d of data) { + for (const t of d.transform ?? []) { + if (t.type === 'lookup') { + t.from = dataComponent.outputNodes[t.from].getSource(); + } + } + } + + // inline values for datasets that are in the datastore + for (const d of data) { + if (d.name in datasets) { + d.values = datasets[d.name]; + } + } + return data; + } + + function getHeaderType(orient) { + if (orient === 'top' || orient === 'left' || isSignalRef(orient)) { + // we always use header for orient signal since we can't dynamically make header becomes footer + return 'header'; + } + return 'footer'; + } + function parseFacetHeaders(model) { + for (const channel of FACET_CHANNELS) { + parseFacetHeader(model, channel); + } + mergeChildAxis(model, 'x'); + mergeChildAxis(model, 'y'); + } + function parseFacetHeader(model, channel) { + const { + facet, + config, + child, + component + } = model; + if (model.channelHasField(channel)) { + const fieldDef = facet[channel]; + const titleConfig = getHeaderProperty('title', null, config, channel); + let title$1 = title(fieldDef, config, { + allowDisabling: true, + includeDefault: titleConfig === undefined || !!titleConfig + }); + if (child.component.layoutHeaders[channel].title) { + // TODO: better handle multiline titles + title$1 = vega.isArray(title$1) ? title$1.join(', ') : title$1; + + // merge title with child to produce "Title / Subtitle / Sub-subtitle" + title$1 += ` / ${child.component.layoutHeaders[channel].title}`; + child.component.layoutHeaders[channel].title = null; + } + const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel); + const labels = fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false; + const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header'; + component.layoutHeaders[channel] = { + title: fieldDef.header !== null ? title$1 : null, + facetFieldDef: fieldDef, + [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)] + }; + } + } + function makeHeaderComponent(model, channel, labels) { + const sizeType = channel === 'row' ? 'height' : 'width'; + return { + labels, + sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined, + axes: [] + }; + } + function mergeChildAxis(model, channel) { + const { + child + } = model; + if (child.component.axes[channel]) { + const { + layoutHeaders, + resolve + } = model.component; + resolve.axis[channel] = parseGuideResolve(resolve, channel); + if (resolve.axis[channel] === 'shared') { + // For shared axis, move the axes to facet's header or footer + const headerChannel = channel === 'x' ? 'column' : 'row'; + const layoutHeader = layoutHeaders[headerChannel]; + for (const axisComponent of child.component.axes[channel]) { + const headerType = getHeaderType(axisComponent.get('orient')); + layoutHeader[headerType] ??= [makeHeaderComponent(model, headerChannel, false)]; + + // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes + const mainAxis = assembleAxis(axisComponent, 'main', model.config, { + header: true + }); + if (mainAxis) { + // LayoutHeader no longer keep track of property precedence, thus let's combine. + layoutHeader[headerType][0].axes.push(mainAxis); + } + axisComponent.mainExtracted = true; + } + } + } + } + + function parseLayerLayoutSize(model) { + parseChildrenLayoutSize(model); + parseNonUnitLayoutSizeForChannel(model, 'width'); + parseNonUnitLayoutSizeForChannel(model, 'height'); + } + function parseConcatLayoutSize(model) { + parseChildrenLayoutSize(model); + + // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth. + const widthType = model.layout.columns === 1 ? 'width' : 'childWidth'; + + // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight. + const heightType = model.layout.columns === undefined ? 'height' : 'childHeight'; + parseNonUnitLayoutSizeForChannel(model, widthType); + parseNonUnitLayoutSizeForChannel(model, heightType); + } + function parseChildrenLayoutSize(model) { + for (const child of model.children) { + child.parseLayoutSize(); + } + } + + /** + * Merge child layout size (width or height). + */ + function parseNonUnitLayoutSizeForChannel(model, layoutSizeType) { + /* + * For concat, the parent width or height might not be the same as the children's shared height. + * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width. + * + * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height) + * while the sizeType represents the properties of the child. + */ + const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType); + const channel = getPositionScaleChannel(sizeType); + const resolve = model.component.resolve; + const layoutSizeCmpt = model.component.layoutSize; + let mergedSize; + // Try to merge layout size + for (const child of model.children) { + const childSize = child.component.layoutSize.getWithExplicit(sizeType); + const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model); + if (scaleResolve === 'independent' && childSize.value === 'step') { + // Do not merge independent scales with range-step as their size depends + // on the scale domains, which can be different between scales. + mergedSize = undefined; + break; + } + if (mergedSize) { + if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) { + // For independent scale, only merge if all the sizes are the same. + // If the values are different, abandon the merge! + mergedSize = undefined; + break; + } + mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, ''); + } else { + mergedSize = childSize; + } + } + if (mergedSize) { + // If merged, rename size and set size of all children. + for (const child of model.children) { + model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType)); + child.component.layoutSize.set(sizeType, 'merged', false); + } + layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize); + } else { + layoutSizeCmpt.setWithExplicit(layoutSizeType, { + explicit: false, + value: undefined + }); + } + } + function parseUnitLayoutSize(model) { + const { + size, + component + } = model; + for (const channel of POSITION_SCALE_CHANNELS) { + const sizeType = getSizeChannel(channel); + if (size[sizeType]) { + const specifiedSize = size[sizeType]; + component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true); + } else { + const defaultSize = defaultUnitSize(model, sizeType); + component.layoutSize.set(sizeType, defaultSize, false); + } + } + } + function defaultUnitSize(model, sizeType) { + const channel = sizeType === 'width' ? 'x' : 'y'; + const config = model.config; + const scaleComponent = model.getScaleComponent(channel); + if (scaleComponent) { + const scaleType = scaleComponent.get('type'); + const range = scaleComponent.get('range'); + if (hasDiscreteDomain(scaleType)) { + const size = getViewConfigDiscreteSize(config.view, sizeType); + if (isVgRangeStep(range) || isStep(size)) { + // For discrete domain with range.step, use dynamic width/height + return 'step'; + } else { + return size; + } + } else { + return getViewConfigContinuousSize(config.view, sizeType); + } + } else if (model.hasProjection || model.mark === 'arc') { + // arc should use continuous size by default otherwise the pie is extremely small + return getViewConfigContinuousSize(config.view, sizeType); + } else { + const size = getViewConfigDiscreteSize(config.view, sizeType); + return isStep(size) ? size.step : size; + } + } + + function facetSortFieldName(fieldDef, sort, opt) { + return vgField(sort, { + suffix: `by_${vgField(fieldDef)}`, + ...(opt ?? {}) + }); + } + class FacetModel extends ModelWithField { + constructor(spec, parent, parentGivenName, config) { + super(spec, 'facet', parent, parentGivenName, config, spec.resolve); + _defineProperty(this, "facet", void 0); + _defineProperty(this, "child", void 0); + _defineProperty(this, "children", void 0); + this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config); + this.children = [this.child]; + this.facet = this.initFacet(spec.facet); + } + initFacet(facet) { + // clone to prevent side effect to the original spec + if (!isFacetMapping(facet)) { + return { + facet: this.initFacetFieldDef(facet, 'facet') + }; + } + const channels = keys(facet); + const normalizedFacet = {}; + for (const channel of channels) { + if (![ROW, COLUMN].includes(channel)) { + // Drop unsupported channel + warn(incompatibleChannel(channel, 'facet')); + break; + } + const fieldDef = facet[channel]; + if (fieldDef.field === undefined) { + warn(emptyFieldDef(fieldDef, channel)); + break; + } + normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel); + } + return normalizedFacet; + } + initFacetFieldDef(fieldDef, channel) { + // Cast because we call initFieldDef, which assumes general FieldDef. + // However, FacetFieldDef is a bit more constrained than the general FieldDef + const facetFieldDef = initFieldDef(fieldDef, channel); + if (facetFieldDef.header) { + facetFieldDef.header = replaceExprRef(facetFieldDef.header); + } else if (facetFieldDef.header === null) { + facetFieldDef.header = null; + } + return facetFieldDef; + } + channelHasField(channel) { + return !!this.facet[channel]; + } + fieldDef(channel) { + return this.facet[channel]; + } + parseData() { + this.component.data = parseData(this); + this.child.parseData(); + } + parseLayoutSize() { + parseChildrenLayoutSize(this); + } + parseSelections() { + // As a facet has a single child, the selection components are the same. + // The child maintains its selections to assemble signals, which remain + // within its unit. + this.child.parseSelections(); + this.component.selection = this.child.component.selection; + } + parseMarkGroup() { + this.child.parseMarkGroup(); + } + parseAxesAndHeaders() { + this.child.parseAxesAndHeaders(); + parseFacetHeaders(this); + } + assembleSelectionTopLevelSignals(signals) { + return this.child.assembleSelectionTopLevelSignals(signals); + } + assembleSignals() { + this.child.assembleSignals(); + return []; + } + assembleSelectionData(data) { + return this.child.assembleSelectionData(data); + } + getHeaderLayoutMixins() { + const layoutMixins = {}; + for (const channel of FACET_CHANNELS) { + for (const headerType of HEADER_TYPES) { + const layoutHeaderComponent = this.component.layoutHeaders[channel]; + const headerComponent = layoutHeaderComponent[headerType]; + const { + facetFieldDef + } = layoutHeaderComponent; + if (facetFieldDef) { + const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel); + if (['right', 'bottom'].includes(titleOrient)) { + const headerChannel = getHeaderChannel(channel, titleOrient); + layoutMixins.titleAnchor ??= {}; + layoutMixins.titleAnchor[headerChannel] = 'end'; + } + } + if (headerComponent?.[0]) { + // set header/footerBand + const sizeType = channel === 'row' ? 'height' : 'width'; + const bandType = headerType === 'header' ? 'headerBand' : 'footerBand'; + if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) { + // If facet child does not have size signal, then apply headerBand + layoutMixins[bandType] ??= {}; + layoutMixins[bandType][channel] = 0.5; + } + if (layoutHeaderComponent.title) { + layoutMixins.offset ??= {}; + layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10; + } + } + } + } + return layoutMixins; + } + assembleDefaultLayout() { + const { + column, + row + } = this.facet; + const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined; + let align = 'all'; + + // Do not align the cells if the scale corresponding to the direction is indepent. + // We always align when we facet into both row and column. + if (!row && this.component.resolve.scale.x === 'independent') { + align = 'none'; + } else if (!column && this.component.resolve.scale.y === 'independent') { + align = 'none'; + } + return { + ...this.getHeaderLayoutMixins(), + ...(columns ? { + columns + } : {}), + bounds: 'full', + align + }; + } + assembleLayoutSignals() { + // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales. + return this.child.assembleLayoutSignals(); + } + columnDistinctSignal() { + if (this.parent && this.parent instanceof FacetModel) { + // For nested facet, we will add columns to group mark instead + // See discussion in https://github.com/vega/vega/issues/952 + // and https://github.com/vega/vega-view/releases/tag/v1.2.6 + return undefined; + } else { + // In facetNode.assemble(), the name is always this.getName('column') + '_layout'. + const facetLayoutDataName = this.getName('column_domain'); + return { + signal: `length(data('${facetLayoutDataName}'))` + }; + } + } + assembleGroupStyle() { + return undefined; + } + assembleGroup(signals) { + if (this.parent && this.parent instanceof FacetModel) { + // Provide number of columns for layout. + // See discussion in https://github.com/vega/vega/issues/952 + // and https://github.com/vega/vega-view/releases/tag/v1.2.6 + return { + ...(this.channelHasField('column') ? { + encode: { + update: { + // TODO(https://github.com/vega/vega-lite/issues/2759): + // Correct the signal for facet of concat of facet_column + columns: { + field: vgField(this.facet.column, { + prefix: 'distinct' + }) + } + } + } + } : {}), + ...super.assembleGroup(signals) + }; + } + return super.assembleGroup(signals); + } + + /** + * Aggregate cardinality for calculating size + */ + getCardinalityAggregateForChild() { + const fields = []; + const ops = []; + const as = []; + if (this.child instanceof FacetModel) { + if (this.child.channelHasField('column')) { + const field = vgField(this.child.facet.column); + fields.push(field); + ops.push('distinct'); + as.push(`distinct_${field}`); + } + } else { + for (const channel of POSITION_SCALE_CHANNELS) { + const childScaleComponent = this.child.component.scales[channel]; + if (childScaleComponent && !childScaleComponent.merged) { + const type = childScaleComponent.get('type'); + const range = childScaleComponent.get('range'); + if (hasDiscreteDomain(type) && isVgRangeStep(range)) { + const domain = assembleDomain(this.child, channel); + const field = getFieldFromDomain(domain); + if (field) { + fields.push(field); + ops.push('distinct'); + as.push(`distinct_${field}`); + } else { + warn(unknownField(channel)); + } + } + } + } + } + return { + fields, + ops, + as + }; + } + assembleFacet() { + const { + name, + data + } = this.component.data.facetRoot; + const { + row, + column + } = this.facet; + const { + fields, + ops, + as + } = this.getCardinalityAggregateForChild(); + const groupby = []; + for (const channel of FACET_CHANNELS) { + const fieldDef = this.facet[channel]; + if (fieldDef) { + groupby.push(vgField(fieldDef)); + const { + bin, + sort + } = fieldDef; + if (isBinning(bin)) { + groupby.push(vgField(fieldDef, { + binSuffix: 'end' + })); + } + if (isSortField(sort)) { + const { + field, + op = DEFAULT_SORT_OP + } = sort; + const outputName = facetSortFieldName(fieldDef, sort); + if (row && column) { + // For crossed facet, use pre-calculate field as it requires a different groupby + // For each calculated field, apply max and assign them to the same name as + // all values of the same group should be the same anyway. + fields.push(outputName); + ops.push('max'); + as.push(outputName); + } else { + fields.push(field); + ops.push(op); + as.push(outputName); + } + } else if (vega.isArray(sort)) { + const outputName = sortArrayIndexField(fieldDef, channel); + fields.push(outputName); + ops.push('max'); + as.push(outputName); + } + } + } + const cross = !!row && !!column; + return { + name, + data, + groupby, + ...(cross || fields.length > 0 ? { + aggregate: { + ...(cross ? { + cross + } : {}), + ...(fields.length ? { + fields, + ops, + as + } : {}) + } + } : {}) + }; + } + facetSortFields(channel) { + const { + facet + } = this; + const fieldDef = facet[channel]; + if (fieldDef) { + if (isSortField(fieldDef.sort)) { + return [facetSortFieldName(fieldDef, fieldDef.sort, { + expr: 'datum' + })]; + } else if (vega.isArray(fieldDef.sort)) { + return [sortArrayIndexField(fieldDef, channel, { + expr: 'datum' + })]; + } + return [vgField(fieldDef, { + expr: 'datum' + })]; + } + return []; + } + facetSortOrder(channel) { + const { + facet + } = this; + const fieldDef = facet[channel]; + if (fieldDef) { + const { + sort + } = fieldDef; + const order = (isSortField(sort) ? sort.order : !vega.isArray(sort) && sort) || 'ascending'; + return [order]; + } + return []; + } + assembleLabelTitle() { + const { + facet, + config + } = this; + if (facet.facet) { + // Facet always uses title to display labels + return assembleLabelTitle(facet.facet, 'facet', config); + } + const ORTHOGONAL_ORIENT = { + row: ['top', 'bottom'], + column: ['left', 'right'] + }; + for (const channel of HEADER_CHANNELS) { + if (facet[channel]) { + const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel); + if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) { + // Row/Column with orthogonal labelOrient must use title to display labels + return assembleLabelTitle(facet[channel], channel, config); + } + } + } + return undefined; + } + assembleMarks() { + const { + child + } = this; + + // If we facet by two dimensions, we need to add a cross operator to the aggregation + // so that we create all groups + const facetRoot = this.component.data.facetRoot; + const data = assembleFacetData(facetRoot); + const encodeEntry = child.assembleGroupEncodeEntry(false); + const title = this.assembleLabelTitle() || child.assembleTitle(); + const style = child.assembleGroupStyle(); + const markGroup = { + name: this.getName('cell'), + type: 'group', + ...(title ? { + title + } : {}), + ...(style ? { + style + } : {}), + from: { + facet: this.assembleFacet() + }, + // TODO: move this to after data + sort: { + field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(), + order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat() + }, + ...(data.length > 0 ? { + data + } : {}), + ...(encodeEntry ? { + encode: { + update: encodeEntry + } + } : {}), + ...child.assembleGroup(assembleFacetSignals(this, [])) + }; + return [markGroup]; + } + getMapping() { + return this.facet; + } + } + + function makeJoinAggregateFromFacet(parent, facet) { + const { + row, + column + } = facet; + if (row && column) { + let newParent = null; + // only need to make one for crossed facet + for (const fieldDef of [row, column]) { + if (isSortField(fieldDef.sort)) { + const { + field, + op = DEFAULT_SORT_OP + } = fieldDef.sort; + parent = newParent = new JoinAggregateTransformNode(parent, { + joinaggregate: [{ + op, + field, + as: facetSortFieldName(fieldDef, fieldDef.sort, { + forAs: true + }) + }], + groupby: [vgField(fieldDef)] + }); + } + } + return newParent; + } + return null; + } + + function findSource(data, sources) { + for (const other of sources) { + const otherData = other.data; + + // if both datasets have a name defined, we cannot merge + if (data.name && other.hasName() && data.name !== other.dataName) { + continue; + } + const formatMesh = data['format']?.mesh; + const otherFeature = otherData.format?.feature; + + // feature and mesh are mutually exclusive + if (formatMesh && otherFeature) { + continue; + } + + // we have to extract the same feature or mesh + const formatFeature = data['format']?.feature; + if ((formatFeature || otherFeature) && formatFeature !== otherFeature) { + continue; + } + const otherMesh = otherData.format?.mesh; + if ((formatMesh || otherMesh) && formatMesh !== otherMesh) { + continue; + } + if (isInlineData(data) && isInlineData(otherData)) { + if (deepEqual(data.values, otherData.values)) { + return other; + } + } else if (isUrlData(data) && isUrlData(otherData)) { + if (data.url === otherData.url) { + return other; + } + } else if (isNamedData(data)) { + if (data.name === other.dataName) { + return other; + } + } + } + return null; + } + function parseRoot(model, sources) { + if (model.data || !model.parent) { + // if the model defines a data source or is the root, create a source node + + if (model.data === null) { + // data: null means we should ignore the parent's data so we just create a new data source + const source = new SourceNode({ + values: [] + }); + sources.push(source); + return source; + } + const existingSource = findSource(model.data, sources); + if (existingSource) { + if (!isGenerator(model.data)) { + existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format); + } + + // if the new source has a name but the existing one does not, we can set it + if (!existingSource.hasName() && model.data.name) { + existingSource.dataName = model.data.name; + } + return existingSource; + } else { + const source = new SourceNode(model.data); + sources.push(source); + return source; + } + } else { + // If we don't have a source defined (overriding parent's data), use the parent's facet root or main. + return model.parent.component.data.facetRoot ? model.parent.component.data.facetRoot : model.parent.component.data.main; + } + } + + /** + * Parses a transform array into a chain of connected dataflow nodes. + */ + function parseTransformArray(head, model, ancestorParse) { + let lookupCounter = 0; + for (const t of model.transforms) { + let derivedType = undefined; + let transformNode; + if (isCalculate(t)) { + transformNode = head = new CalculateNode(head, t); + derivedType = 'derived'; + } else if (isFilter(t)) { + const implicit = getImplicitFromFilterTransform(t); + transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head; + head = new FilterNode(head, model, t.filter); + } else if (isBin(t)) { + transformNode = head = BinNode.makeFromTransform(head, t, model); + derivedType = 'number'; + } else if (isTimeUnit(t)) { + derivedType = 'date'; + const parsedAs = ancestorParse.getWithExplicit(t.field); + // Create parse node because the input to time unit is always date. + if (parsedAs.value === undefined) { + head = new ParseNode(head, { + [t.field]: derivedType + }); + ancestorParse.set(t.field, derivedType, false); + } + transformNode = head = TimeUnitNode.makeFromTransform(head, t); + } else if (isAggregate(t)) { + transformNode = head = AggregateNode.makeFromTransform(head, t); + derivedType = 'number'; + if (requiresSelectionId(model)) { + head = new IdentifierNode(head); + } + } else if (isLookup(t)) { + transformNode = head = LookupNode.make(head, model, t, lookupCounter++); + derivedType = 'derived'; + } else if (isWindow(t)) { + transformNode = head = new WindowTransformNode(head, t); + derivedType = 'number'; + } else if (isJoinAggregate(t)) { + transformNode = head = new JoinAggregateTransformNode(head, t); + derivedType = 'number'; + } else if (isStack(t)) { + transformNode = head = StackNode.makeFromTransform(head, t); + derivedType = 'derived'; + } else if (isFold(t)) { + transformNode = head = new FoldTransformNode(head, t); + derivedType = 'derived'; + } else if (isExtent(t)) { + transformNode = head = new ExtentTransformNode(head, t); + derivedType = 'derived'; + } else if (isFlatten(t)) { + transformNode = head = new FlattenTransformNode(head, t); + derivedType = 'derived'; + } else if (isPivot(t)) { + transformNode = head = new PivotTransformNode(head, t); + derivedType = 'derived'; + } else if (isSample(t)) { + head = new SampleTransformNode(head, t); + } else if (isImpute(t)) { + transformNode = head = ImputeNode.makeFromTransform(head, t); + derivedType = 'derived'; + } else if (isDensity(t)) { + transformNode = head = new DensityTransformNode(head, t); + derivedType = 'derived'; + } else if (isQuantile(t)) { + transformNode = head = new QuantileTransformNode(head, t); + derivedType = 'derived'; + } else if (isRegression(t)) { + transformNode = head = new RegressionTransformNode(head, t); + derivedType = 'derived'; + } else if (isLoess(t)) { + transformNode = head = new LoessTransformNode(head, t); + derivedType = 'derived'; + } else { + warn(invalidTransformIgnored(t)); + continue; + } + if (transformNode && derivedType !== undefined) { + for (const field of transformNode.producedFields() ?? []) { + ancestorParse.set(field, derivedType, false); + } + } + } + return head; + } + + /* + Description of the dataflow (http://asciiflow.com/): + +--------+ + | Source | + +---+----+ + | + v + FormatParse + (explicit) + | + v + Transforms + (Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...) + | + v + FormatParse + (implicit) + | + v + Binning (in `encoding`) + | + v + Timeunit (in `encoding`) + | + v + Formula From Sort Array + | + v + +--+--+ + | Raw | + +-----+ + | + v + Aggregate (in `encoding`) + | + v + Stack (in `encoding`) + | + v + Invalid Filter + | + v + +----------+ + | Main | + +----------+ + | + v + +-------+ + | Facet |----> "column", "column-layout", and "row" + +-------+ + | + v + ...Child data... + */ + + function parseData(model) { + let head = parseRoot(model, model.component.data.sources); + const { + outputNodes, + outputNodeRefCounts + } = model.component.data; + const data = model.data; + const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data)); + const ancestorParse = !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse(); + if (isGenerator(data)) { + // insert generator transform + if (isSequenceGenerator(data)) { + head = new SequenceNode(head, data.sequence); + } else if (isGraticuleGenerator(data)) { + head = new GraticuleNode(head, data.graticule); + } + // no parsing necessary for generator + ancestorParse.parseNothing = true; + } else if (data?.format?.parse === null) { + // format.parse: null means disable parsing + ancestorParse.parseNothing = true; + } + head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head; + + // Default discrete selections require an identifer transform to + // uniquely identify data points. Add this transform at the head of + // the pipeline such that the identifier field is available for all + // subsequent datasets. During optimization, we will remove this + // transform if it proves to be unnecessary. Additional identifier + // transforms will be necessary when new tuples are constructed + // (e.g., post-aggregation). + head = new IdentifierNode(head); + + // HACK: This is equivalent for merging bin extent for union scale. + // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale + const parentIsLayer = model.parent && isLayerModel(model.parent); + if (isUnitModel(model) || isFacetModel(model)) { + if (parentIsLayer) { + head = BinNode.makeFromEncoding(head, model) ?? head; + } + } + if (model.transforms.length > 0) { + head = parseTransformArray(head, model, ancestorParse); + } + + // create parse nodes for fields that need to be parsed (or flattened) implicitly + const implicitSelection = getImplicitFromSelection(model); + const implicitEncoding = getImplicitFromEncoding(model); + head = ParseNode.makeWithAncestors(head, {}, { + ...implicitSelection, + ...implicitEncoding + }, ancestorParse) ?? head; + if (isUnitModel(model)) { + head = GeoJSONNode.parseAll(head, model); + head = GeoPointNode.parseAll(head, model); + } + if (isUnitModel(model) || isFacetModel(model)) { + if (!parentIsLayer) { + head = BinNode.makeFromEncoding(head, model) ?? head; + } + head = TimeUnitNode.makeFromEncoding(head, model) ?? head; + head = CalculateNode.parseAllForSortIndex(head, model); + } + + // add an output node pre aggregation + const rawName = model.getDataName(DataSourceType.Raw); + const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts); + outputNodes[rawName] = raw; + head = raw; + if (isUnitModel(model)) { + const agg = AggregateNode.makeFromEncoding(head, model); + if (agg) { + head = agg; + if (requiresSelectionId(model)) { + head = new IdentifierNode(head); + } + } + head = ImputeNode.makeFromEncoding(head, model) ?? head; + head = StackNode.makeFromEncoding(head, model) ?? head; + } + if (isUnitModel(model)) { + head = FilterInvalidNode.make(head, model) ?? head; + } + + // output node for marks + const mainName = model.getDataName(DataSourceType.Main); + const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts); + outputNodes[mainName] = main; + head = main; + if (isUnitModel(model)) { + materializeSelections(model, main); + } + + // add facet marker + let facetRoot = null; + if (isFacetModel(model)) { + const facetName = model.getName('facet'); + + // Derive new aggregate for facet's sort field + // augment data source with new fields for crossed facet + head = makeJoinAggregateFromFacet(head, model.facet) ?? head; + facetRoot = new FacetNode(head, model, facetName, main.getSource()); + outputNodes[facetName] = facetRoot; + } + return { + ...model.component.data, + outputNodes, + outputNodeRefCounts, + raw, + main, + facetRoot, + ancestorParse + }; + } + + class ConcatModel extends Model { + constructor(spec, parent, parentGivenName, config) { + super(spec, 'concat', parent, parentGivenName, config, spec.resolve); + _defineProperty(this, "children", void 0); + if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') { + warn(CONCAT_CANNOT_SHARE_AXIS); + } + this.children = this.getChildren(spec).map((child, i) => { + return buildModel(child, this, this.getName(`concat_${i}`), undefined, config); + }); + } + parseData() { + this.component.data = parseData(this); + for (const child of this.children) { + child.parseData(); + } + } + parseSelections() { + // Merge selections up the hierarchy so that they may be referenced + // across unit specs. Persist their definitions within each child + // to assemble signals which remain within output Vega unit groups. + this.component.selection = {}; + for (const child of this.children) { + child.parseSelections(); + for (const key of keys(child.component.selection)) { + this.component.selection[key] = child.component.selection[key]; + } + } + } + parseMarkGroup() { + for (const child of this.children) { + child.parseMarkGroup(); + } + } + parseAxesAndHeaders() { + for (const child of this.children) { + child.parseAxesAndHeaders(); + } + + // TODO(#2415): support shared axes + } + + getChildren(spec) { + if (isVConcatSpec(spec)) { + return spec.vconcat; + } else if (isHConcatSpec(spec)) { + return spec.hconcat; + } + return spec.concat; + } + parseLayoutSize() { + parseConcatLayoutSize(this); + } + parseAxisGroup() { + return null; + } + assembleSelectionTopLevelSignals(signals) { + return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); + } + assembleSignals() { + this.children.forEach(child => child.assembleSignals()); + return []; + } + assembleLayoutSignals() { + const layoutSignals = assembleLayoutSignals(this); + for (const child of this.children) { + layoutSignals.push(...child.assembleLayoutSignals()); + } + return layoutSignals; + } + assembleSelectionData(data) { + return this.children.reduce((db, child) => child.assembleSelectionData(db), data); + } + assembleMarks() { + // only children have marks + return this.children.map(child => { + const title = child.assembleTitle(); + const style = child.assembleGroupStyle(); + const encodeEntry = child.assembleGroupEncodeEntry(false); + return { + type: 'group', + name: child.getName('group'), + ...(title ? { + title + } : {}), + ...(style ? { + style + } : {}), + ...(encodeEntry ? { + encode: { + update: encodeEntry + } + } : {}), + ...child.assembleGroup() + }; + }); + } + assembleGroupStyle() { + return undefined; + } + assembleDefaultLayout() { + const columns = this.layout.columns; + return { + ...(columns != null ? { + columns + } : {}), + bounds: 'full', + // Use align each so it can work with multiple plots with different size + align: 'each' + }; + } + } + + function isFalseOrNull(v) { + return v === false || v === null; + } + const AXIS_COMPONENT_PROPERTIES_INDEX = { + disable: 1, + gridScale: 1, + scale: 1, + ...COMMON_AXIS_PROPERTIES_INDEX, + labelExpr: 1, + encode: 1 + }; + const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX); + class AxisComponent extends Split { + constructor() { + let explicit = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + let implicit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + let mainExtracted = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; + super(); + this.explicit = explicit; + this.implicit = implicit; + this.mainExtracted = mainExtracted; + } + clone() { + return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted); + } + hasAxisPart(part) { + // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme. + + if (part === 'axis') { + // always has the axis container part + return true; + } + if (part === 'grid' || part === 'title') { + return !!this.get(part); + } + // Other parts are enabled by default, so they should not be false or null. + return !isFalseOrNull(this.get(part)); + } + hasOrientSignalRef() { + return isSignalRef(this.explicit.orient); + } + } + + function labels(model, channel, specifiedLabelsSpec) { + const { + encoding, + config + } = model; + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]); + const axis = model.axis(channel) || {}; + const { + format, + formatType + } = axis; + if (isCustomFormatType(formatType)) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format, + formatType, + config + }), + ...specifiedLabelsSpec + }; + } else if (format === undefined && formatType === undefined && config.customFormatTypes) { + if (channelDefType(fieldOrDatumDef) === 'quantitative') { + if (isPositionFieldOrDatumDef(fieldOrDatumDef) && fieldOrDatumDef.stack === 'normalize' && config.normalizedNumberFormatType) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.normalizedNumberFormat, + formatType: config.normalizedNumberFormatType, + config + }), + ...specifiedLabelsSpec + }; + } else if (config.numberFormatType) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.numberFormat, + formatType: config.numberFormatType, + config + }), + ...specifiedLabelsSpec + }; + } + } + if (channelDefType(fieldOrDatumDef) === 'temporal' && config.timeFormatType && isFieldDef(fieldOrDatumDef) && !fieldOrDatumDef.timeUnit) { + return { + text: formatCustomType({ + fieldOrDatumDef, + field: 'datum.value', + format: config.timeFormat, + formatType: config.timeFormatType, + config + }), + ...specifiedLabelsSpec + }; + } + } + return specifiedLabelsSpec; + } + + function parseUnitAxes(model) { + return POSITION_SCALE_CHANNELS.reduce((axis, channel) => { + if (model.component.scales[channel]) { + axis[channel] = [parseAxis(channel, model)]; + } + return axis; + }, {}); + } + const OPPOSITE_ORIENT = { + bottom: 'top', + top: 'bottom', + left: 'right', + right: 'left' + }; + function parseLayerAxes(model) { + const { + axes, + resolve + } = model.component; + const axisCount = { + top: 0, + bottom: 0, + right: 0, + left: 0 + }; + for (const child of model.children) { + child.parseAxesAndHeaders(); + for (const channel of keys(child.component.axes)) { + resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel); + if (resolve.axis[channel] === 'shared') { + // If the resolve says shared (and has not been overridden) + // We will try to merge and see if there is a conflict + + axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]); + if (!axes[channel]) { + // If merge returns nothing, there is a conflict so we cannot make the axis shared. + // Thus, mark axis as independent and remove the axis component. + resolve.axis[channel] = 'independent'; + delete axes[channel]; + } + } + } + } + + // Move axes to layer's axis component and merge shared axes + for (const channel of POSITION_SCALE_CHANNELS) { + for (const child of model.children) { + if (!child.component.axes[channel]) { + // skip if the child does not have a particular axis + continue; + } + if (resolve.axis[channel] === 'independent') { + // If axes are independent, concat the axisComponent array. + axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]); + + // Automatically adjust orient + for (const axisComponent of child.component.axes[channel]) { + const { + value: orient, + explicit + } = axisComponent.getWithExplicit('orient'); + if (isSignalRef(orient)) { + continue; + } + if (axisCount[orient] > 0 && !explicit) { + // Change axis orient if the number do not match + const oppositeOrient = OPPOSITE_ORIENT[orient]; + if (axisCount[orient] > axisCount[oppositeOrient]) { + axisComponent.set('orient', oppositeOrient, false); + } + } + axisCount[orient]++; + + // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset? + } + } + + // After merging, make sure to remove axes from child + delete child.component.axes[channel]; + } + + // Show gridlines for first axis only for dual-axis chart + if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) { + for (const [index, axisCmpt] of (axes[channel] || []).entries()) { + if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) { + axisCmpt.implicit.grid = false; + } + } + } + } + } + function mergeAxisComponents(mergedAxisCmpts, childAxisCmpts) { + if (mergedAxisCmpts) { + // FIXME: this is a bit wrong once we support multiple axes + if (mergedAxisCmpts.length !== childAxisCmpts.length) { + return undefined; // Cannot merge axis component with different number of axes. + } + + const length = mergedAxisCmpts.length; + for (let i = 0; i < length; i++) { + const merged = mergedAxisCmpts[i]; + const child = childAxisCmpts[i]; + if (!!merged !== !!child) { + return undefined; + } else if (merged && child) { + const mergedOrient = merged.getWithExplicit('orient'); + const childOrient = child.getWithExplicit('orient'); + if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) { + // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.) + + // Cannot merge due to inconsistent orient + return undefined; + } else { + mergedAxisCmpts[i] = mergeAxisComponent(merged, child); + } + } + } + } else { + // For first one, return a copy of the child + return childAxisCmpts.map(axisComponent => axisComponent.clone()); + } + return mergedAxisCmpts; + } + function mergeAxisComponent(merged, child) { + for (const prop of AXIS_COMPONENT_PROPERTIES) { + const mergedValueWithExplicit = mergeValuesWithExplicit(merged.getWithExplicit(prop), child.getWithExplicit(prop), prop, 'axis', + // Tie breaker function + (v1, v2) => { + switch (prop) { + case 'title': + return mergeTitleComponent(v1, v2); + case 'gridScale': + return { + explicit: v1.explicit, + // keep the old explicit + value: getFirstDefined(v1.value, v2.value) + }; + } + return defaultTieBreaker(v1, v2, prop, 'axis'); + }); + merged.setWithExplicit(prop, mergedValueWithExplicit); + } + return merged; + } + function isExplicit(value, property, axis, model, channel) { + if (property === 'disable') { + return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit + } + + axis = axis || {}; + switch (property) { + case 'titleAngle': + case 'labelAngle': + return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle)); + case 'values': + return !!axis.values; + // specified axis.values is already respected, but may get transformed. + case 'encode': + // both VL axis.encoding and axis.labelAngle affect VG axis.encode + return !!axis.encoding || !!axis.labelAngle; + case 'title': + // title can be explicit if fieldDef.title is set + if (value === getFieldDefTitle(model, channel)) { + return true; + } + } + // Otherwise, things are explicit if the returned value matches the specified property + return value === axis[property]; + } + + /** + * Properties to always include values from config + */ + const propsToAlwaysIncludeConfig = new Set(['grid', + // Grid is an exception because we need to set grid = true to generate another grid axis + 'translate', + // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know. + // the rest are not axis configs in Vega, but are in VL, so we need to set too. + 'format', 'formatType', 'orient', 'labelExpr', 'tickCount', 'position', 'tickMinStep']); + function parseAxis(channel, model) { + let axis = model.axis(channel); + const axisComponent = new AxisComponent(); + const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]); + const { + mark, + config + } = model; + const orient = axis?.orient || config[channel === 'x' ? 'axisX' : 'axisY']?.orient || config.axis?.orient || defaultOrient(channel); + const scaleType = model.getScaleComponent(channel).get('type'); + const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config); + const disable = axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue; + axisComponent.set('disable', disable, axis !== undefined); + if (disable) { + return axisComponent; + } + axis = axis || {}; + const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs); + const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType); + const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true); + const ruleParams = { + fieldOrDatumDef, + axis, + channel, + model, + scaleType, + orient, + labelAngle, + format, + formatType, + mark, + config + }; + // 1.2. Add properties + for (const property of AXIS_COMPONENT_PROPERTIES) { + const value = property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined; + const hasValue = value !== undefined; + const explicit = isExplicit(value, property, axis, model, channel); + if (hasValue && explicit) { + axisComponent.set(property, value, explicit); + } else { + const { + configValue = undefined, + configFrom = undefined + } = isAxisProperty(property) && property !== 'values' ? getAxisConfig(property, config.style, axis.style, axisConfigs) : {}; + const hasConfigValue = configValue !== undefined; + if (hasValue && !hasConfigValue) { + // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config) + axisComponent.set(property, value, explicit); + } else if ( + // Cases need implicit values + // 1. Axis config that aren't available in Vega + !(configFrom === 'vgAxisConfig') || + // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details) + propsToAlwaysIncludeConfig.has(property) && hasConfigValue || + // 3. Conditional axis values and signals + isConditionalAxisValue(configValue) || isSignalRef(configValue)) { + // If a config is specified and is conditional, copy conditional value from axis config + axisComponent.set(property, configValue, false); + } + } + } + + // 2) Add guide encode definition groups + const axisEncoding = axis.encoding ?? {}; + const axisEncode = AXIS_PARTS.reduce((e, part) => { + if (!axisComponent.hasAxisPart(part)) { + // No need to create encode for a disabled part. + return e; + } + const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model); + const value = part === 'labels' ? labels(model, channel, axisEncodingPart) : axisEncodingPart; + if (value !== undefined && !isEmpty(value)) { + e[part] = { + update: value + }; + } + return e; + }, {}); + + // FIXME: By having encode as one property, we won't have fine grained encode merging. + if (!isEmpty(axisEncode)) { + axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined); + } + return axisComponent; + } + + function initLayoutSize(_ref) { + let { + encoding, + size + } = _ref; + for (const channel of POSITION_SCALE_CHANNELS) { + const sizeType = getSizeChannel(channel); + if (isStep(size[sizeType])) { + if (isContinuousFieldOrDatumDef(encoding[channel])) { + delete size[sizeType]; + warn(stepDropped(sizeType)); + } + } + } + return size; + } + + const arc = { + vgMark: 'arc', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }), + ...pointPosition('x', model, { + defaultPos: 'mid' + }), + ...pointPosition('y', model, { + defaultPos: 'mid' + }), + // arcs are rectangles in polar coordinates + ...rectPosition(model, 'radius'), + ...rectPosition(model, 'theta') + }; + } + }; + + const area = { + vgMark: 'area', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'include', + size: 'ignore', + theta: 'ignore' + }), + ...pointOrRangePosition('x', model, { + defaultPos: 'zeroOrMin', + defaultPos2: 'zeroOrMin', + range: model.markDef.orient === 'horizontal' + }), + ...pointOrRangePosition('y', model, { + defaultPos: 'zeroOrMin', + defaultPos2: 'zeroOrMin', + range: model.markDef.orient === 'vertical' + }), + ...defined(model) + }; + } + }; + + const bar = { + vgMark: 'rect', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...rectPosition(model, 'x'), + ...rectPosition(model, 'y') + }; + } + }; + + const geoshape = { + vgMark: 'shape', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }) + }; + }, + postEncodingTransform: model => { + const { + encoding + } = model; + const shapeDef = encoding.shape; + const transform = { + type: 'geoshape', + projection: model.projectionName(), + // as: 'shape', + ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON ? { + field: vgField(shapeDef, { + expr: 'datum' + }) + } : {}) + }; + return [transform]; + } + }; + + const image = { + vgMark: 'image', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'ignore', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...rectPosition(model, 'x'), + ...rectPosition(model, 'y'), + ...text$1(model, 'url') + }; + } + }; + + const line = { + vgMark: 'line', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'ignore' + }), + ...pointPosition('x', model, { + defaultPos: 'mid' + }), + ...pointPosition('y', model, { + defaultPos: 'mid' + }), + ...nonPosition('size', model, { + vgChannel: 'strokeWidth' // VL's line size is strokeWidth + }), + + ...defined(model) + }; + } + }; + const trail = { + vgMark: 'trail', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'include', + orient: 'ignore', + theta: 'ignore' + }), + ...pointPosition('x', model, { + defaultPos: 'mid' + }), + ...pointPosition('y', model, { + defaultPos: 'mid' + }), + ...nonPosition('size', model), + ...defined(model) + }; + } + }; + + function encodeEntry(model, fixedShape) { + const { + config + } = model; + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + size: 'include', + orient: 'ignore', + theta: 'ignore' + }), + ...pointPosition('x', model, { + defaultPos: 'mid' + }), + ...pointPosition('y', model, { + defaultPos: 'mid' + }), + ...nonPosition('size', model), + ...nonPosition('angle', model), + ...shapeMixins(model, config, fixedShape) + }; + } + function shapeMixins(model, config, fixedShape) { + if (fixedShape) { + return { + shape: { + value: fixedShape + } + }; + } + return nonPosition('shape', model); + } + const point = { + vgMark: 'symbol', + encodeEntry: model => { + return encodeEntry(model); + } + }; + const circle = { + vgMark: 'symbol', + encodeEntry: model => { + return encodeEntry(model, 'circle'); + } + }; + const square = { + vgMark: 'symbol', + encodeEntry: model => { + return encodeEntry(model, 'square'); + } + }; + + const rect = { + vgMark: 'rect', + encodeEntry: model => { + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...rectPosition(model, 'x'), + ...rectPosition(model, 'y') + }; + } + }; + + const rule = { + vgMark: 'rule', + encodeEntry: model => { + const { + markDef + } = model; + const orient = markDef.orient; + if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) { + // Show nothing if we have none of x, y, lat, and long. + return {}; + } + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...pointOrRangePosition('x', model, { + defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid', + defaultPos2: 'zeroOrMin', + range: orient !== 'vertical' // include x2 for horizontal or line segment rule + }), + + ...pointOrRangePosition('y', model, { + defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid', + defaultPos2: 'zeroOrMin', + range: orient !== 'horizontal' // include y2 for vertical or line segment rule + }), + + ...nonPosition('size', model, { + vgChannel: 'strokeWidth' // VL's rule size is strokeWidth + }) + }; + } + }; + + const text = { + vgMark: 'text', + encodeEntry: model => { + const { + config, + encoding + } = model; + return { + ...baseEncodeEntry(model, { + align: 'include', + baseline: 'include', + color: 'include', + size: 'ignore', + orient: 'ignore', + theta: 'include' + }), + ...pointPosition('x', model, { + defaultPos: 'mid' + }), + ...pointPosition('y', model, { + defaultPos: 'mid' + }), + ...text$1(model), + ...nonPosition('size', model, { + vgChannel: 'fontSize' // VL's text size is fontSize + }), + + ...nonPosition('angle', model), + ...valueIfDefined('align', align(model.markDef, encoding, config)), + ...valueIfDefined('baseline', baseline(model.markDef, encoding, config)), + ...pointPosition('radius', model, { + defaultPos: null + }), + ...pointPosition('theta', model, { + defaultPos: null + }) + }; + } + }; + function align(markDef, encoding, config) { + const a = getMarkPropOrConfig('align', markDef, config); + if (a === undefined) { + return 'center'; + } + // If there is a config, Vega-parser will process this already. + return undefined; + } + function baseline(markDef, encoding, config) { + const b = getMarkPropOrConfig('baseline', markDef, config); + if (b === undefined) { + return 'middle'; + } + // If there is a config, Vega-parser will process this already. + return undefined; + } + + const tick = { + vgMark: 'rect', + encodeEntry: model => { + const { + config, + markDef + } = model; + const orient = markDef.orient; + const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; + const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width'; + return { + ...baseEncodeEntry(model, { + align: 'ignore', + baseline: 'ignore', + color: 'include', + orient: 'ignore', + size: 'ignore', + theta: 'ignore' + }), + ...pointPosition('x', model, { + defaultPos: 'mid', + vgChannel: 'xc' + }), + ...pointPosition('y', model, { + defaultPos: 'mid', + vgChannel: 'yc' + }), + // size / thickness => width / height + ...nonPosition('size', model, { + defaultValue: defaultSize(model), + vgChannel: vgSizeChannel + }), + [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config)) + }; + } + }; + function defaultSize(model) { + const { + config, + markDef + } = model; + const { + orient + } = markDef; + const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height'; + const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y'); + const markPropOrConfig = getMarkPropOrConfig('size', markDef, config, { + vgChannel: vgSizeChannel + }) ?? config.tick.bandSize; + if (markPropOrConfig !== undefined) { + return markPropOrConfig; + } else { + const scaleRange = scale ? scale.get('range') : undefined; + if (scaleRange && isVgRangeStep(scaleRange) && vega.isNumber(scaleRange.step)) { + return scaleRange.step * 3 / 4; + } + const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel); + return defaultViewStep * 3 / 4; + } + } + + const markCompiler = { + arc, + area, + bar, + circle, + geoshape, + image, + line, + point, + rect, + rule, + square, + text, + tick, + trail + }; + function parseMarkGroups(model) { + if (contains([LINE, AREA, TRAIL], model.mark)) { + const details = pathGroupingFields(model.mark, model.encoding); + if (details.length > 0) { + return getPathGroups(model, details); + } + // otherwise use standard mark groups + } else if (model.mark === BAR) { + const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop => getMarkPropOrConfig(prop, model.markDef, model.config)); + if (model.stack && !model.fieldDef('size') && hasCornerRadius) { + return getGroupsForStackedBarWithCornerRadius(model); + } + } + return getMarkGroup(model); + } + const FACETED_PATH_PREFIX = 'faceted_path_'; + function getPathGroups(model, details) { + // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?) + + return [{ + name: model.getName('pathgroup'), + type: 'group', + from: { + facet: { + name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main), + data: model.requestDataName(DataSourceType.Main), + groupby: details + } + }, + encode: { + update: { + width: { + field: { + group: 'width' + } + }, + height: { + field: { + group: 'height' + } + } + } + }, + // With subfacet for line/area group, need to use faceted data from above. + marks: getMarkGroup(model, { + fromPrefix: FACETED_PATH_PREFIX + }) + }]; + } + const STACK_GROUP_PREFIX = 'stack_group_'; + + /** + * We need to put stacked bars into groups in order to enable cornerRadius for stacks. + * If stack is used and the model doesn't have size encoding, we put the mark into groups, + * and apply cornerRadius properties at the group. + */ + function getGroupsForStackedBarWithCornerRadius(model) { + // Generate the mark + const [mark] = getMarkGroup(model, { + fromPrefix: STACK_GROUP_PREFIX + }); + + // Get the scale for the stacked field + const fieldScale = model.scaleName(model.stack.fieldChannel); + const stackField = function () { + let opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; + return model.vgField(model.stack.fieldChannel, opt); + }; + // Find the min/max of the pixel value on the stacked direction + const stackFieldGroup = (func, expr) => { + const vgFieldMinMax = [stackField({ + prefix: 'min', + suffix: 'start', + expr + }), stackField({ + prefix: 'max', + suffix: 'start', + expr + }), stackField({ + prefix: 'min', + suffix: 'end', + expr + }), stackField({ + prefix: 'max', + suffix: 'end', + expr + })]; + return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`; + }; + let groupUpdate; + let innerGroupUpdate; + + // Build the encoding for group and an inner group + if (model.stack.fieldChannel === 'x') { + // Move cornerRadius, y/yc/y2/height properties to group + // Group x/x2 should be the min/max of the marks within + groupUpdate = { + ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]), + x: { + signal: stackFieldGroup('min', 'datum') + }, + x2: { + signal: stackFieldGroup('max', 'datum') + }, + clip: { + value: true + } + }; + // Inner group should revert the x translation, and pass height through + innerGroupUpdate = { + x: { + field: { + group: 'x' + }, + mult: -1 + }, + height: { + field: { + group: 'height' + } + } + }; + // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group) + // This is why size encoding is not supported yet + mark.encode.update = { + ...omit(mark.encode.update, ['y', 'yc', 'y2']), + height: { + field: { + group: 'height' + } + } + }; + } else { + groupUpdate = { + ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']), + y: { + signal: stackFieldGroup('min', 'datum') + }, + y2: { + signal: stackFieldGroup('max', 'datum') + }, + clip: { + value: true + } + }; + innerGroupUpdate = { + y: { + field: { + group: 'y' + }, + mult: -1 + }, + width: { + field: { + group: 'width' + } + } + }; + mark.encode.update = { + ...omit(mark.encode.update, ['x', 'xc', 'x2']), + width: { + field: { + group: 'width' + } + } + }; + } + + // Deal with cornerRadius properties + for (const key of VG_CORNERRADIUS_CHANNELS) { + const configValue = getMarkConfig(key, model.markDef, model.config); + // Move from mark to group + if (mark.encode.update[key]) { + groupUpdate[key] = mark.encode.update[key]; + delete mark.encode.update[key]; + } else if (configValue) { + groupUpdate[key] = signalOrValueRef(configValue); + } + // Overwrite any cornerRadius on mark set by config --- they are already moved to the group + if (configValue) { + mark.encode.update[key] = { + value: 0 + }; + } + } + const groupby = []; + if (model.stack.groupbyChannels?.length > 0) { + for (const groupbyChannel of model.stack.groupbyChannels) { + // For bin and time unit, we have to add bin/timeunit -end channels. + const groupByField = model.fieldDef(groupbyChannel); + const field = vgField(groupByField); + if (field) { + groupby.push(field); + } + if (groupByField?.bin || groupByField?.timeUnit) { + groupby.push(vgField(groupByField, { + binSuffix: 'end' + })); + } + } + } + const strokeProperties = ['stroke', 'strokeWidth', 'strokeJoin', 'strokeCap', 'strokeDash', 'strokeDashOffset', 'strokeMiterLimit', 'strokeOpacity']; + + // Generate stroke properties for the group + groupUpdate = strokeProperties.reduce((encode, prop) => { + if (mark.encode.update[prop]) { + return { + ...encode, + [prop]: mark.encode.update[prop] + }; + } else { + const configValue = getMarkConfig(prop, model.markDef, model.config); + if (configValue !== undefined) { + return { + ...encode, + [prop]: signalOrValueRef(configValue) + }; + } else { + return encode; + } + } + }, groupUpdate); + + // Apply strokeForeground and strokeOffset if stroke is used + if (groupUpdate.stroke) { + groupUpdate.strokeForeground = { + value: true + }; + groupUpdate.strokeOffset = { + value: 0 + }; + } + return [{ + type: 'group', + from: { + facet: { + data: model.requestDataName(DataSourceType.Main), + name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main), + groupby, + aggregate: { + fields: [stackField({ + suffix: 'start' + }), stackField({ + suffix: 'start' + }), stackField({ + suffix: 'end' + }), stackField({ + suffix: 'end' + })], + ops: ['min', 'max', 'min', 'max'] + } + } + }, + encode: { + update: groupUpdate + }, + marks: [{ + type: 'group', + encode: { + update: innerGroupUpdate + }, + marks: [mark] + }] + }]; + } + function getSort(model) { + const { + encoding, + stack, + mark, + markDef, + config + } = model; + const order = encoding.order; + if (!vega.isArray(order) && isValueDef(order) && isNullOrFalse(order.value) || !order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config))) { + return undefined; + } else if ((vega.isArray(order) || isFieldDef(order)) && !stack) { + // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.) + return sortParams(order, { + expr: 'datum' + }); + } else if (isPathMark(mark)) { + // For both line and area, we sort values based on dimension by default + const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x'; + const dimensionChannelDef = encoding[dimensionChannel]; + if (isFieldDef(dimensionChannelDef)) { + const s = dimensionChannelDef.sort; + if (vega.isArray(s)) { + return { + field: vgField(dimensionChannelDef, { + prefix: dimensionChannel, + suffix: 'sort_index', + expr: 'datum' + }) + }; + } else if (isSortField(s)) { + return { + field: vgField({ + // FIXME: this op might not already exist? + // FIXME: what if dimensionChannel (x or y) contains custom domain? + aggregate: isAggregate$1(model.encoding) ? s.op : undefined, + field: s.field + }, { + expr: 'datum' + }) + }; + } else if (isSortByEncoding(s)) { + const fieldDefToSort = model.fieldDef(s.encoding); + return { + field: vgField(fieldDefToSort, { + expr: 'datum' + }), + order: s.order + }; + } else if (s === null) { + return undefined; + } else { + return { + field: vgField(dimensionChannelDef, { + // For stack with imputation, we only have bin_mid + binSuffix: model.stack?.impute ? 'mid' : undefined, + expr: 'datum' + }) + }; + } + } + return undefined; + } + return undefined; + } + function getMarkGroup(model) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { + fromPrefix: '' + }; + const { + mark, + markDef, + encoding, + config + } = model; + const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model)); + const style = getStyles(markDef); + const key = encoding.key; + const sort = getSort(model); + const interactive = interactiveFlag(model); + const aria = getMarkPropOrConfig('aria', markDef, config); + const postEncodingTransform = markCompiler[mark].postEncodingTransform ? markCompiler[mark].postEncodingTransform(model) : null; + return [{ + name: model.getName('marks'), + type: markCompiler[mark].vgMark, + ...(clip ? { + clip: true + } : {}), + ...(style ? { + style + } : {}), + ...(key ? { + key: key.field + } : {}), + ...(sort ? { + sort + } : {}), + ...(interactive ? interactive : {}), + ...(aria === false ? { + aria + } : {}), + from: { + data: opt.fromPrefix + model.requestDataName(DataSourceType.Main) + }, + encode: { + update: markCompiler[mark].encodeEntry(model) + }, + ...(postEncodingTransform ? { + transform: postEncodingTransform + } : {}) + }]; + } + + /** + * If scales are bound to interval selections, we want to automatically clip + * marks to account for panning/zooming interactions. We identify bound scales + * by the selectionExtent property, which gets added during scale parsing. + */ + function scaleClip(model) { + const xScale = model.getScaleComponent('x'); + const yScale = model.getScaleComponent('y'); + return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined; + } + + /** + * If we use a custom projection with auto-fitting to the geodata extent, + * we need to clip to ensure the chart size doesn't explode. + */ + function projectionClip(model) { + const projection = model.component.projection; + return projection && !projection.isFit ? true : undefined; + } + + /** + * Only output interactive flags if we have selections defined somewhere in our model hierarchy. + */ + function interactiveFlag(model) { + if (!model.component.selection) return null; + const unitCount = keys(model.component.selection).length; + let parentCount = unitCount; + let parent = model.parent; + while (parent && parentCount === 0) { + parentCount = keys(parent.component.selection).length; + parent = parent.parent; + } + return parentCount ? { + interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip + } : null; + } + + /** + * Internal model of Vega-Lite specification for the compiler. + */ + class UnitModel extends ModelWithField { + constructor(spec, parent, parentGivenName) { + let parentGivenSize = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {}; + let config = arguments.length > 4 ? arguments[4] : undefined; + super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined); + _defineProperty(this, "markDef", void 0); + _defineProperty(this, "encoding", void 0); + _defineProperty(this, "specifiedScales", {}); + _defineProperty(this, "stack", void 0); + _defineProperty(this, "specifiedAxes", {}); + _defineProperty(this, "specifiedLegends", {}); + _defineProperty(this, "specifiedProjection", {}); + _defineProperty(this, "selection", []); + _defineProperty(this, "children", []); + const markDef = isMarkDef(spec.mark) ? { + ...spec.mark + } : { + type: spec.mark + }; + const mark = markDef.type; + + // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding + if (markDef.filled === undefined) { + markDef.filled = defaultFilled(markDef, config, { + graticule: spec.data && isGraticuleGenerator(spec.data) + }); + } + const encoding = this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config); + this.markDef = initMarkdef(markDef, encoding, config); + this.size = initLayoutSize({ + encoding, + size: isFrameMixins(spec) ? { + ...parentGivenSize, + ...(spec.width ? { + width: spec.width + } : {}), + ...(spec.height ? { + height: spec.height + } : {}) + } : parentGivenSize + }); + + // calculate stack properties + this.stack = stack(this.markDef, encoding); + this.specifiedScales = this.initScales(mark, encoding); + this.specifiedAxes = this.initAxes(encoding); + this.specifiedLegends = this.initLegends(encoding); + this.specifiedProjection = spec.projection; + + // Selections will be initialized upon parse. + this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p)); + } + get hasProjection() { + const { + encoding + } = this; + const isGeoShapeMark = this.mark === GEOSHAPE; + const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel])); + return isGeoShapeMark || hasGeoPosition; + } + + /** + * Return specified Vega-Lite scale domain for a particular channel + * @param channel + */ + scaleDomain(channel) { + const scale = this.specifiedScales[channel]; + return scale ? scale.domain : undefined; + } + axis(channel) { + return this.specifiedAxes[channel]; + } + legend(channel) { + return this.specifiedLegends[channel]; + } + initScales(mark, encoding) { + return SCALE_CHANNELS.reduce((scales, channel) => { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + if (fieldOrDatumDef) { + scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {}); + } + return scales; + }, {}); + } + initScale(scale) { + const { + domain, + range + } = scale; + // TODO: we could simplify this function if we had a recursive replace function + const scaleInternal = replaceExprRef(scale); + if (vega.isArray(domain)) { + scaleInternal.domain = domain.map(signalRefOrValue); + } + if (vega.isArray(range)) { + scaleInternal.range = range.map(signalRefOrValue); + } + return scaleInternal; + } + initAxes(encoding) { + return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => { + // Position Axis + + // TODO: handle ConditionFieldDef + const channelDef = encoding[channel]; + if (isFieldOrDatumDef(channelDef) || channel === X && isFieldOrDatumDef(encoding.x2) || channel === Y && isFieldOrDatumDef(encoding.y2)) { + const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined; + _axis[channel] = axisSpec ? this.initAxis({ + ...axisSpec + }) // convert truthy value to object + : axisSpec; + } + return _axis; + }, {}); + } + initAxis(axis) { + const props = keys(axis); + const axisInternal = {}; + for (const prop of props) { + const val = axis[prop]; + axisInternal[prop] = isConditionalAxisValue(val) ? signalOrValueRefWithCondition(val) : signalRefOrValue(val); + } + return axisInternal; + } + initLegends(encoding) { + return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => { + const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]); + if (fieldOrDatumDef && supportLegend(channel)) { + const legend = fieldOrDatumDef.legend; + _legend[channel] = legend ? replaceExprRef(legend) // convert truthy value to object + : legend; + } + return _legend; + }, {}); + } + parseData() { + this.component.data = parseData(this); + } + parseLayoutSize() { + parseUnitLayoutSize(this); + } + parseSelections() { + this.component.selection = parseUnitSelection(this, this.selection); + } + parseMarkGroup() { + this.component.mark = parseMarkGroups(this); + } + parseAxesAndHeaders() { + this.component.axes = parseUnitAxes(this); + } + assembleSelectionTopLevelSignals(signals) { + return assembleTopLevelSignals(this, signals); + } + assembleSignals() { + return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])]; + } + assembleSelectionData(data) { + return assembleUnitSelectionData(this, data); + } + assembleLayout() { + return null; + } + assembleLayoutSignals() { + return assembleLayoutSignals(this); + } + assembleMarks() { + let marks = this.component.mark ?? []; + + // If this unit is part of a layer, selections should augment + // all in concert rather than each unit individually. This + // ensures correct interleaving of clipping and brushed marks. + if (!this.parent || !isLayerModel(this.parent)) { + marks = assembleUnitSelectionMarks(this, marks); + } + return marks.map(this.correctDataNames); + } + assembleGroupStyle() { + const { + style + } = this.view || {}; + if (style !== undefined) { + return style; + } + if (this.encoding.x || this.encoding.y) { + return 'cell'; + } else { + return 'view'; + } + } + getMapping() { + return this.encoding; + } + get mark() { + return this.markDef.type; + } + channelHasField(channel) { + return channelHasField(this.encoding, channel); + } + fieldDef(channel) { + const channelDef = this.encoding[channel]; + return getFieldDef(channelDef); + } + typedFieldDef(channel) { + const fieldDef = this.fieldDef(channel); + if (isTypedFieldDef(fieldDef)) { + return fieldDef; + } + return null; + } + } + + class LayerModel extends Model { + constructor(spec, parent, parentGivenName, parentGivenSize, config) { + super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view); + // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error. + // So I'm just putting generic Model for now + _defineProperty(this, "children", void 0); + const layoutSize = { + ...parentGivenSize, + ...(spec.width ? { + width: spec.width + } : {}), + ...(spec.height ? { + height: spec.height + } : {}) + }; + this.children = spec.layer.map((layer, i) => { + if (isLayerSpec(layer)) { + return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config); + } else if (isUnitSpec(layer)) { + return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config); + } + throw new Error(invalidSpec(layer)); + }); + } + parseData() { + this.component.data = parseData(this); + for (const child of this.children) { + child.parseData(); + } + } + parseLayoutSize() { + parseLayerLayoutSize(this); + } + parseSelections() { + // Merge selections up the hierarchy so that they may be referenced + // across unit specs. Persist their definitions within each child + // to assemble signals which remain within output Vega unit groups. + this.component.selection = {}; + for (const child of this.children) { + child.parseSelections(); + for (const key of keys(child.component.selection)) { + this.component.selection[key] = child.component.selection[key]; + } + } + } + parseMarkGroup() { + for (const child of this.children) { + child.parseMarkGroup(); + } + } + parseAxesAndHeaders() { + parseLayerAxes(this); + } + assembleSelectionTopLevelSignals(signals) { + return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals); + } + + // TODO: Support same named selections across children. + assembleSignals() { + return this.children.reduce((signals, child) => { + return signals.concat(child.assembleSignals()); + }, assembleAxisSignals(this)); + } + assembleLayoutSignals() { + return this.children.reduce((signals, child) => { + return signals.concat(child.assembleLayoutSignals()); + }, assembleLayoutSignals(this)); + } + assembleSelectionData(data) { + return this.children.reduce((db, child) => child.assembleSelectionData(db), data); + } + assembleGroupStyle() { + const uniqueStyles = new Set(); + for (const child of this.children) { + for (const style of vega.array(child.assembleGroupStyle())) { + uniqueStyles.add(style); + } + } + const styles = Array.from(uniqueStyles); + return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined; + } + assembleTitle() { + let title = super.assembleTitle(); + if (title) { + return title; + } + // If title does not provide layer, look into children + for (const child of this.children) { + title = child.assembleTitle(); + if (title) { + return title; + } + } + return undefined; + } + assembleLayout() { + return null; + } + assembleMarks() { + return assembleLayerSelectionMarks(this, this.children.flatMap(child => { + return child.assembleMarks(); + })); + } + assembleLegends() { + return this.children.reduce((legends, child) => { + return legends.concat(child.assembleLegends()); + }, assembleLegends(this)); + } + } + + function buildModel(spec, parent, parentGivenName, unitSize, config) { + if (isFacetSpec(spec)) { + return new FacetModel(spec, parent, parentGivenName, config); + } else if (isLayerSpec(spec)) { + return new LayerModel(spec, parent, parentGivenName, unitSize, config); + } else if (isUnitSpec(spec)) { + return new UnitModel(spec, parent, parentGivenName, unitSize, config); + } else if (isAnyConcatSpec(spec)) { + return new ConcatModel(spec, parent, parentGivenName, config); + } + throw new Error(invalidSpec(spec)); + } + + /** + * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec. + * + * At a high-level, we make the following transformations in different phases: + * + * Input spec + * | + * | (Normalization) + * v + * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.) + * | + * | (Build Model) + * v + * A model tree of the spec + * | + * | (Parse) + * v + * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged) + * | + * | (Optimize) + * v + * A model tree with parsed components with the data component optimized + * | + * | (Assemble) + * v + * Vega spec + * + * @param inputSpec The Vega-Lite specification. + * @param opt Optional arguments passed to the Vega-Lite compiler. + * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec. + */ + function compile(inputSpec) { + let opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; + // 0. Augment opt with default opts + if (opt.logger) { + // set the singleton logger to the provided logger + set(opt.logger); + } + if (opt.fieldTitle) { + // set the singleton field title formatter + setTitleFormatter(opt.fieldTitle); + } + try { + // 1. Initialize config by deep merging default config with the config provided via option and the input spec. + const config = initConfig(vega.mergeConfig(opt.config, inputSpec.config)); + + // 2. Normalize: Convert input spec -> normalized spec + + // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec. + // - Normalize autosize and width or height spec + const spec = normalize(inputSpec, config); + + // 3. Build Model: normalized spec -> Model (a tree structure) + + // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors. + // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models. + const model = buildModel(spec, null, '', undefined, config); + + // 4 Parse: Model --> Model with components + + // Note that components = intermediate representations that are equivalent to Vega specs. + // We need these intermediate representation because we need to merge many visualization "components" like projections, scales, axes, and legends. + // We will later convert these components into actual Vega specs in the assemble phase. + + // In this phase, we do a bottom-up traversal over the whole tree to + // parse for each type of components once (e.g., data, layout, mark, scale). + // By doing bottom-up traversal, we start parsing components of unit specs and + // then merge child components of parent composite specs. + // + // Please see inside model.parse() for order of different components parsed. + model.parse(); + + // drawDataflow(model.component.data.sources); + + // 5. Optimize the dataflow. This will modify the data component of the model. + optimizeDataflow(model.component.data, model); + + // drawDataflow(model.component.data.sources); + + // 6. Assemble: convert model components --> Vega Spec. + const vgSpec = assembleTopLevelModel(model, getTopLevelProperties(inputSpec, spec.autosize, config, model), inputSpec.datasets, inputSpec.usermeta); + return { + spec: vgSpec, + normalized: spec + }; + } finally { + // Reset the singleton logger if a logger is provided + if (opt.logger) { + reset(); + } + // Reset the singleton field title formatter if provided + if (opt.fieldTitle) { + resetTitleFormatter(); + } + } + } + function getTopLevelProperties(inputSpec, autosize, config, model) { + const width = model.component.layoutSize.get('width'); + const height = model.component.layoutSize.get('height'); + if (autosize === undefined) { + autosize = { + type: 'pad' + }; + if (model.hasAxisOrientSignalRef()) { + autosize.resize = true; + } + } else if (vega.isString(autosize)) { + autosize = { + type: autosize + }; + } + if (width && height && isFitType(autosize.type)) { + if (width === 'step' && height === 'step') { + warn(droppingFit()); + autosize.type = 'pad'; + } else if (width === 'step' || height === 'step') { + // effectively XOR, because else if + + // get step dimension + const sizeType = width === 'step' ? 'width' : 'height'; + // log that we're dropping fit for respective channel + warn(droppingFit(getPositionScaleChannel(sizeType))); + + // setting type to inverse fit (so if we dropped fit-x, type is now fit-y) + const inverseSizeType = sizeType === 'width' ? 'height' : 'width'; + autosize.type = getFitType(inverseSizeType); + } + } + return { + ...(keys(autosize).length === 1 && autosize.type ? autosize.type === 'pad' ? {} : { + autosize: autosize.type + } : { + autosize + }), + ...extractTopLevelProperties(config, false), + ...extractTopLevelProperties(inputSpec, true) + }; + } + + /* + * Assemble the top-level model to a Vega spec. + * + * Note: this couldn't be `model.assemble()` since the top-level model + * needs some special treatment to generate top-level properties. + */ + function assembleTopLevelModel(model, topLevelProperties) { + let datasets = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; + let usermeta = arguments.length > 3 ? arguments[3] : undefined; + // Config with Vega-Lite only config removed. + const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined; + const data = [].concat(model.assembleSelectionData([]), + // only assemble data in the root + assembleRootData(model.component.data, datasets)); + const projections = model.assembleProjections(); + const title = model.assembleTitle(); + const style = model.assembleGroupStyle(); + const encodeEntry = model.assembleGroupEncodeEntry(true); + let layoutSignals = model.assembleLayoutSignals(); + + // move width and height signals with values to top level + layoutSignals = layoutSignals.filter(signal => { + if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) { + topLevelProperties[signal.name] = +signal.value; + return false; + } + return true; + }); + const { + params, + ...otherTopLevelProps + } = topLevelProperties; + return { + $schema: 'https://vega.github.io/schema/vega/v5.json', + ...(model.description ? { + description: model.description + } : {}), + ...otherTopLevelProps, + ...(title ? { + title + } : {}), + ...(style ? { + style + } : {}), + ...(encodeEntry ? { + encode: { + update: encodeEntry + } + } : {}), + data, + ...(projections.length > 0 ? { + projections + } : {}), + ...model.assembleGroup([...layoutSignals, ...model.assembleSelectionTopLevelSignals([]), ...assembleParameterSignals(params)]), + ...(vgConfig ? { + config: vgConfig + } : {}), + ...(usermeta ? { + usermeta + } : {}) + }; + } + + const version = pkg.version; + + exports.accessPathDepth = accessPathDepth; + exports.accessPathWithDatum = accessPathWithDatum; + exports.compile = compile; + exports.contains = contains; + exports.deepEqual = deepEqual; + exports.deleteNestedProperty = deleteNestedProperty; + exports.duplicate = duplicate; + exports.entries = entries$1; + exports.every = every; + exports.fieldIntersection = fieldIntersection; + exports.flatAccessWithDatum = flatAccessWithDatum; + exports.getFirstDefined = getFirstDefined; + exports.hasIntersection = hasIntersection; + exports.hash = hash; + exports.internalField = internalField; + exports.isBoolean = isBoolean; + exports.isEmpty = isEmpty; + exports.isEqual = isEqual; + exports.isInternalField = isInternalField; + exports.isNullOrFalse = isNullOrFalse; + exports.isNumeric = isNumeric; + exports.keys = keys; + exports.logicalExpr = logicalExpr; + exports.mergeDeep = mergeDeep; + exports.never = never; + exports.normalize = normalize; + exports.normalizeAngle = normalizeAngle; + exports.omit = omit; + exports.pick = pick; + exports.prefixGenerator = prefixGenerator; + exports.removePathFromField = removePathFromField; + exports.replaceAll = replaceAll; + exports.replacePathInField = replacePathInField; + exports.resetIdCounter = resetIdCounter; + exports.setEqual = setEqual; + exports.some = some; + exports.stringify = stringify; + exports.titleCase = titleCase; + exports.unique = unique; + exports.uniqueId = uniqueId; + exports.vals = vals; + exports.varName = varName; + exports.version = version; + +})); +//# sourceMappingURL=vega-lite.js.map diff --git a/build/vega-lite.js.map b/build/vega-lite.js.map new file mode 100644 index 0000000000..dfd831c8ee --- /dev/null +++ b/build/vega-lite.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vega-lite.js","sources":["../src/logical.ts","../src/util.ts","../src/channel.ts","../src/aggregate.ts","../src/bin.ts","../src/expr.ts","../src/title.ts","../src/vega.schema.ts","../src/compile/common.ts","../src/log/message.ts","../src/log/index.ts","../src/datetime.ts","../src/timeunit.ts","../src/predicate.ts","../src/type.ts","../src/scale.ts","../src/mark.ts","../src/compile/mark/encode/valueref.ts","../src/compile/format.ts","../src/sort.ts","../src/spec/facet.ts","../src/channeldef.ts","../src/axis.ts","../src/spec/unit.ts","../src/compositemark/base.ts","../src/encoding.ts","../src/compositemark/common.ts","../src/compositemark/boxplot.ts","../src/compositemark/errorbar.ts","../src/compositemark/errorband.ts","../src/compositemark/index.ts","../src/guide.ts","../src/header.ts","../src/legend.ts","../src/selection.ts","../src/parameter.ts","../src/spec/concat.ts","../src/spec/base.ts","../src/config.ts","../src/spec/layer.ts","../src/spec/repeat.ts","../src/spec/map.ts","../src/stack.ts","../src/compile/mark/init.ts","../src/normalize/pathoverlay.ts","../src/normalize/repeater.ts","../src/normalize/ruleforrangedline.ts","../src/normalize/core.ts","../src/transform.ts","../src/normalize/selectioncompat.ts","../src/normalize/toplevelselection.ts","../src/normalize/index.ts","../src/spec/toplevel.ts","../src/compile/split.ts","../src/compile/data/index.ts","../src/data.ts","../src/compile/selection/assemble.ts","../src/compile/data/dataflow.ts","../src/compile/data/timeunit.ts","../src/compile/selection/project.ts","../src/compile/selection/scales.ts","../src/compile/selection/interval.ts","../src/compile/selection/point.ts","../src/compile/mark/encode/conditional.ts","../src/compile/mark/encode/text.ts","../src/compile/mark/encode/tooltip.ts","../src/compile/mark/encode/aria.ts","../src/compile/mark/encode/nonposition.ts","../src/compile/mark/encode/color.ts","../src/compile/mark/encode/zindex.ts","../src/compile/mark/encode/offset.ts","../src/compile/mark/encode/position-point.ts","../src/compile/mark/encode/position-align.ts","../src/compile/mark/encode/position-range.ts","../src/compile/mark/encode/position-rect.ts","../src/compile/mark/encode/base.ts","../src/compile/mark/encode/defined.ts","../src/compile/selection/nearest.ts","../src/compile/selection/inputs.ts","../src/compile/selection/toggle.ts","../src/compile/selection/clear.ts","../src/compile/selection/legends.ts","../src/compile/selection/translate.ts","../src/compile/selection/zoom.ts","../src/compile/selection/index.ts","../src/compile/data/expressions.ts","../src/compile/data/filter.ts","../src/compile/selection/parse.ts","../src/compile/predicate.ts","../src/compile/axis/assemble.ts","../src/compile/axis/config.ts","../src/compile/axis/properties.ts","../src/compile/data/calculate.ts","../src/compile/header/common.ts","../src/compile/header/component.ts","../src/compile/header/assemble.ts","../src/compile/layoutsize/assemble.ts","../src/compile/layoutsize/component.ts","../src/compile/guide.ts","../src/compile/resolve.ts","../src/compile/legend/component.ts","../src/compile/legend/encode.ts","../src/compile/legend/properties.ts","../src/compile/legend/parse.ts","../src/compile/legend/assemble.ts","../src/compile/projection/assemble.ts","../src/projection.ts","../src/compile/projection/component.ts","../src/compile/projection/parse.ts","../src/compile/data/bin.ts","../src/compile/data/aggregate.ts","../src/compile/data/facet.ts","../src/compile/data/formatparse.ts","../src/compile/data/identifier.ts","../src/compile/data/graticule.ts","../src/compile/data/sequence.ts","../src/compile/data/source.ts","../src/compile/data/optimizer.ts","../src/compile/data/optimizers.ts","../src/compile/data/joinaggregate.ts","../src/compile/data/stack.ts","../src/compile/data/window.ts","../src/compile/data/subtree.ts","../src/compile/data/optimize.ts","../src/compile/signal.ts","../src/compile/scale/domain.ts","../src/compile/scale/assemble.ts","../src/compile/scale/component.ts","../src/compile/scale/range.ts","../src/compile/scale/properties.ts","../src/compile/scale/type.ts","../src/compile/scale/parse.ts","../src/compile/model.ts","../src/compile/data/density.ts","../src/compile/data/extent.ts","../src/compile/data/filterinvalid.ts","../src/compile/data/flatten.ts","../src/compile/data/fold.ts","../src/compile/data/geojson.ts","../src/compile/data/geopoint.ts","../src/compile/data/impute.ts","../src/compile/data/loess.ts","../src/compile/data/lookup.ts","../src/compile/data/quantile.ts","../src/compile/data/regression.ts","../src/compile/data/pivot.ts","../src/compile/data/sample.ts","../src/compile/data/assemble.ts","../src/compile/header/parse.ts","../src/compile/layoutsize/parse.ts","../src/compile/facet.ts","../src/compile/data/joinaggregatefacet.ts","../src/compile/data/parse.ts","../src/compile/concat.ts","../src/compile/axis/component.ts","../src/compile/axis/encode.ts","../src/compile/axis/parse.ts","../src/compile/layoutsize/init.ts","../src/compile/mark/arc.ts","../src/compile/mark/area.ts","../src/compile/mark/bar.ts","../src/compile/mark/geoshape.ts","../src/compile/mark/image.ts","../src/compile/mark/line.ts","../src/compile/mark/point.ts","../src/compile/mark/rect.ts","../src/compile/mark/rule.ts","../src/compile/mark/text.ts","../src/compile/mark/tick.ts","../src/compile/mark/mark.ts","../src/compile/unit.ts","../src/compile/layer.ts","../src/compile/buildmodel.ts","../src/compile/compile.ts","../src/index.ts"],"sourcesContent":["export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T;\n\nexport interface LogicalOr {\n or: LogicalComposition[];\n}\n\nexport interface LogicalAnd {\n and: LogicalComposition[];\n}\n\nexport interface LogicalNot {\n not: LogicalComposition;\n}\n\nexport function isLogicalOr(op: LogicalComposition): op is LogicalOr {\n return !!op.or;\n}\n\nexport function isLogicalAnd(op: LogicalComposition): op is LogicalAnd {\n return !!op.and;\n}\n\nexport function isLogicalNot(op: LogicalComposition): op is LogicalNot {\n return !!op.not;\n}\n\nexport function forEachLeaf(op: LogicalComposition, fn: (op: T) => void) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n } else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n } else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n } else {\n fn(op);\n }\n}\n\nexport function normalizeLogicalComposition(\n op: LogicalComposition,\n normalizer: (o: T) => T\n): LogicalComposition {\n if (isLogicalNot(op)) {\n return {not: normalizeLogicalComposition(op.not, normalizer)};\n } else if (isLogicalAnd(op)) {\n return {and: op.and.map(o => normalizeLogicalComposition(o, normalizer))};\n } else if (isLogicalOr(op)) {\n return {or: op.or.map(o => normalizeLogicalComposition(o, normalizer))};\n } else {\n return normalizer(op);\n }\n}\n","import {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util';\nimport {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical';\n\nexport const duplicate = structuredClone;\n\nexport function never(message: string): never {\n throw new Error(message);\n}\n\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj: T, props: readonly K[]): Pick {\n const copy: any = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj: T, props: readonly K[]): Omit {\n const copy = {...(obj as any)};\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stringify(x)).join(',')})`;\n};\n\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a: any): string | number {\n if (isNumber(a)) {\n return a;\n }\n\n const str = isString(a) ? a : stringify(a);\n\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\n\nexport function isNullOrFalse(x: any): x is false | null {\n return x === false || x === null;\n}\n\nexport function contains(array: readonly T[], item: T) {\n return array.includes(item);\n}\n\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns true if all items return true.\n */\nexport function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Like TS Partial but applies recursively to all properties.\n */\nexport type DeepPartial = {[P in keyof T]?: DeepPartial};\n\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\n\nfunction deepMerge_(dest: any, src: any) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nexport function unique(values: readonly T[], f: (item: T) => string | number): T[] {\n const results: T[] = [];\n const u = {};\n let v: string | number;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n\nexport type Dict = Record;\n\n/**\n * Returns true if the two dictionaries agree. Applies only to defined values.\n */\nexport function isEqual(dict: Dict, other: Dict) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\n\nexport function setEqual(a: Set, b: Set) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\n\nexport function hasIntersection(a: ReadonlySet, b: ReadonlySet) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\n\nexport function prefixGenerator(a: ReadonlySet): ReadonlySet {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj: object) {\n return keys(obj).length === 0;\n}\n\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys as (o: T) => Extract[];\n\nexport const vals = Object.values;\n\nexport const entries = Object.entries;\n\n// Using mapped type to declare a collect of flags for a string literal type S\n// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types\nexport type Flag = {[K in S]: 1};\n\nexport function isBoolean(b: any): b is boolean {\n return b === true || b === false;\n}\n\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s: string): string {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\n\nexport function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string {\n if (isLogicalNot(op)) {\n return `!(${logicalExpr(op.not, cb)})`;\n } else if (isLogicalAnd(op)) {\n return `(${op.and.map((and: LogicalComposition) => logicalExpr(and, cb)).join(') && (')})`;\n } else if (isLogicalOr(op)) {\n return `(${op.or.map((or: LogicalComposition) => logicalExpr(or, cb)).join(') || (')})`;\n } else {\n return cb(op);\n }\n}\n\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj: any, orderedProps: string[]) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\n\nexport function titleCase(s: string) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path: string, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path: string, datum: 'datum' | 'parent' | 'datum.datum' = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\n\nfunction escapePathAccess(string: string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path: string) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string: string, find: string, replacement: string) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path: string) {\n return `${splitAccessPath(path).join('.')}`;\n}\n\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path: string) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args: readonly T[]): T | undefined {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n\n// variable used to generate id\nlet idCounter = 42;\n\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix?: string) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\n\nexport function internalField(name: string) {\n return isInternalField(name) ? name : `__${name}`;\n}\n\nexport function isInternalField(name: string) {\n return name.startsWith('__');\n}\n\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle: number) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value: number | string): boolean {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value as any) && !isNaN(parseFloat(value));\n}\n\nconst clonedProto = Object.getPrototypeOf(structuredClone({}));\n\n/**\n * Compares two values for equality, including arrays and objects.\n *\n * Adapted from https://github.com/epoberezkin/fast-deep-equal.\n */\nexport function deepEqual(a: any, b: any) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n // compare names to avoid issues with structured clone\n if (a.constructor.name !== b.constructor.name) return false;\n\n let length;\n let i;\n\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0; ) if (!deepEqual(a[i], b[i])) return false;\n return true;\n }\n\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n for (i of a.entries()) if (!b.has(i[0])) return false;\n for (i of a.entries()) if (!deepEqual(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n for (i of a.entries()) if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = (a as any).length;\n if (length != (b as any).length) return false;\n for (i = length; i-- !== 0; ) if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n // also compare to structured clone prototype\n if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString)\n return a.toString() === b.toString();\n\n const ks = Object.keys(a);\n length = ks.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, ks[i])) return false;\n\n for (i = length; i-- !== 0; ) {\n const key = ks[i];\n\n if (!deepEqual(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n}\n\n/**\n * Converts any object to a string representation that can be consumed by humans.\n *\n * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify\n */\nexport function stringify(data: any) {\n const seen: any[] = [];\n\n return (function _stringify(node: any) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return undefined;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n let i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += _stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.includes(node)) {\n throw new TypeError('Converting circular structure to JSON');\n }\n\n const seenIndex = seen.push(node) - 1;\n const ks = Object.keys(node).sort();\n out = '';\n for (i = 0; i < ks.length; i++) {\n const key = ks[i];\n const value = _stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return `{${out}}`;\n })(data);\n}\n","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\n\nimport {RangeType} from './compile/scale/type';\nimport {Encoding} from './encoding';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {Flag, keys} from './util';\n\nexport type Channel = keyof Encoding;\nexport type ExtendedChannel = Channel | FacetChannel;\n\n// Facet\nexport const ROW = 'row' as const;\nexport const COLUMN = 'column' as const;\n\nexport const FACET = 'facet' as const;\n\n// Position\nexport const X = 'x' as const;\nexport const Y = 'y' as const;\nexport const X2 = 'x2' as const;\nexport const Y2 = 'y2' as const;\n\n// Position Offset\nexport const XOFFSET = 'xOffset' as const;\nexport const YOFFSET = 'yOffset' as const;\n\n// Arc-Position\nexport const RADIUS = 'radius' as const;\nexport const RADIUS2 = 'radius2' as const;\nexport const THETA = 'theta' as const;\nexport const THETA2 = 'theta2' as const;\n\n// Geo Position\nexport const LATITUDE = 'latitude' as const;\nexport const LONGITUDE = 'longitude' as const;\nexport const LATITUDE2 = 'latitude2' as const;\nexport const LONGITUDE2 = 'longitude2' as const;\n\n// Mark property with scale\nexport const COLOR = 'color' as const;\n\nexport const FILL = 'fill' as const;\n\nexport const STROKE = 'stroke' as const;\n\nexport const SHAPE = 'shape' as const;\nexport const SIZE = 'size' as const;\n\nexport const ANGLE = 'angle' as const;\n\nexport const OPACITY = 'opacity' as const;\nexport const FILLOPACITY = 'fillOpacity' as const;\n\nexport const STROKEOPACITY = 'strokeOpacity' as const;\n\nexport const STROKEWIDTH = 'strokeWidth' as const;\nexport const STROKEDASH = 'strokeDash' as const;\n\n// Non-scale channel\nexport const TEXT = 'text' as const;\nexport const ORDER = 'order' as const;\nexport const DETAIL = 'detail' as const;\nexport const KEY = 'key' as const;\n\nexport const TOOLTIP = 'tooltip' as const;\nexport const HREF = 'href' as const;\n\nexport const URL = 'url' as const;\nexport const DESCRIPTION = 'description' as const;\n\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n} as const;\n\nexport type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX;\n\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n} as const;\n\nexport type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX;\n\nexport function isPolarPositionChannel(c: Channel): c is PolarPositionChannel {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\n\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n} as const;\n\nexport type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX;\n\nexport function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\n\nexport function isGeoPositionChannel(c: Channel): c is GeoPositionChannel {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\n\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\n\nconst UNIT_CHANNEL_INDEX: Flag = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n\n ...GEO_POSIITON_CHANNEL_INDEX,\n xOffset: 1,\n yOffset: 1,\n\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\n\nexport type ColorChannel = 'color' | 'fill' | 'stroke';\n\nexport function isColorChannel(channel: Channel): channel is ColorChannel {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\n\nexport type FacetChannel = keyof EncodingFacetMapping;\n\nconst FACET_CHANNEL_INDEX: Flag> = {\n row: 1,\n column: 1,\n facet: 1\n};\n\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\n\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\n\nexport const CHANNELS = keys(CHANNEL_INDEX);\n\nconst {order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX} = CHANNEL_INDEX;\nconst {row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX} = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\n\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\n\nexport type SingleDefChannel = (typeof SINGLE_DEF_CHANNELS)[number];\n\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\n\nexport type SingleDefUnitChannel = (typeof SINGLE_DEF_UNIT_CHANNELS)[number];\n\nexport function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\n\nexport function isChannel(str: string): str is Channel {\n return !!CHANNEL_INDEX[str];\n}\n\nexport type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2';\n\nexport const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[] = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\n\nexport function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n\nexport type MainChannelOf = C extends 'x2'\n ? 'x'\n : C extends 'y2'\n ? 'y'\n : C extends 'latitude2'\n ? 'latitude'\n : C extends 'longitude2'\n ? 'longitude'\n : C extends 'theta2'\n ? 'theta'\n : C extends 'radius2'\n ? 'radius'\n : C;\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel: C): MainChannelOf {\n switch (channel) {\n case X2:\n return X as MainChannelOf;\n case Y2:\n return Y as MainChannelOf;\n case LATITUDE2:\n return LATITUDE as MainChannelOf;\n case LONGITUDE2:\n return LONGITUDE as MainChannelOf;\n case THETA2:\n return THETA as MainChannelOf;\n case RADIUS2:\n return RADIUS as MainChannelOf;\n }\n return channel as MainChannelOf;\n}\n\nexport type SecondaryChannelOf = C extends 'x'\n ? 'x2'\n : C extends 'y'\n ? 'y2'\n : C extends 'latitude'\n ? 'latitude2'\n : C extends 'longitude'\n ? 'longitude2'\n : C extends 'theta'\n ? 'theta2'\n : C extends 'radius'\n ? 'radius2'\n : undefined;\n\nexport function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined {\n switch (channel) {\n case X:\n return X2 as SecondaryChannelOf;\n case Y:\n return Y2 as SecondaryChannelOf;\n case LATITUDE:\n return LATITUDE2 as SecondaryChannelOf;\n case LONGITUDE:\n return LONGITUDE2 as SecondaryChannelOf;\n case THETA:\n return THETA2 as SecondaryChannelOf;\n case RADIUS:\n return RADIUS2 as SecondaryChannelOf;\n }\n return undefined;\n}\n\nexport function getSizeChannel(channel: PositionChannel): 'width' | 'height';\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined;\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel: Channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetScaleChannel(channel: Channel): OffsetScaleChannel {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n }\n return undefined;\n}\n\nexport function getMainChannelFromOffsetChannel(channel: OffsetScaleChannel): PositionScaleChannel {\n switch (channel) {\n case 'xOffset':\n return 'x';\n case 'yOffset':\n return 'y';\n }\n}\n\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst {\n x: _x,\n y: _y,\n // x2 and y2 share the same scale as x and y\n x2: _x2,\n y2: _y2,\n //\n xOffset: _xo,\n yOffset: _yo,\n latitude: _latitude,\n longitude: _longitude,\n latitude2: _latitude2,\n longitude2: _longitude2,\n theta: _theta,\n theta2: _theta2,\n radius: _radius,\n radius2: _radius2,\n // The rest of unit channels then have scale\n ...NONPOSITION_CHANNEL_INDEX\n} = UNIT_CHANNEL_INDEX;\n\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nexport type NonPositionChannel = (typeof NONPOSITION_CHANNELS)[number];\n\nconst POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n} as const;\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX;\n\nexport function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\n\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n} as const;\n\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX;\n\nexport function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel {\n return sizeType === 'width' ? X : Y;\n}\n\nconst OFFSET_SCALE_CHANNEL_INDEX: {xOffset: 1; yOffset: 1} = {xOffset: 1, yOffset: 1};\n\nexport const OFFSET_SCALE_CHANNELS = keys(OFFSET_SCALE_CHANNEL_INDEX);\n\nexport type OffsetScaleChannel = (typeof OFFSET_SCALE_CHANNELS)[0];\n\nexport function isXorYOffset(channel: Channel): channel is OffsetScaleChannel {\n return channel in OFFSET_SCALE_CHANNEL_INDEX;\n}\n\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset\nconst {\n // x2 and y2 share the same scale as x and y\n // text and tooltip have format instead of scale,\n // href has neither format, nor scale\n text: _t,\n tooltip: _tt,\n href: _hr,\n url: _u,\n description: _al,\n // detail and order have no scale\n detail: _dd,\n key: _k,\n order: _oo,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n} = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport type NonPositionScaleChannel = (typeof NONPOSITION_SCALE_CHANNELS)[number];\n\nexport function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel: NonPositionScaleChannel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...OFFSET_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport type ScaleChannel = (typeof SCALE_CHANNELS)[number];\n\nexport function isScaleChannel(channel: Channel): channel is ScaleChannel {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n\nexport type SupportedMark = Partial>;\n\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel: ExtendedChannel, mark: Mark) {\n return getSupportedMark(channel)[mark];\n}\n\nconst ALL_MARKS: Record = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\n\nconst {geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE} = ALL_MARKS;\n\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel: ExtendedChannel): SupportedMark {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n\n // falls through\n\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return {point: 'always', geoshape: 'always'};\n case TEXT:\n return {text: 'always'};\n case ANGLE:\n return {point: 'always', square: 'always', text: 'always'};\n case URL:\n return {image: 'always'};\n case THETA:\n return {text: 'always', arc: 'always'};\n case RADIUS:\n return {text: 'always', arc: 'always'};\n case THETA2:\n case RADIUS2:\n return {arc: 'always'};\n }\n}\n\nexport function rangeType(channel: ExtendedChannel): RangeType {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case XOFFSET:\n case YOFFSET:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n\n // No scale, no range type.\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isString} from 'vega-util';\nimport {FieldName} from './channeldef';\nimport {contains, Flag} from './util';\n\nconst AGGREGATE_OP_INDEX: Flag = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\n\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\n\nexport interface ArgminDef {\n argmin: FieldName;\n}\n\nexport interface ArgmaxDef {\n argmax: FieldName;\n}\n\nexport type NonArgAggregateOp = Exclude;\n\nexport type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef;\n\nexport function isArgminDef(a: Aggregate | string): a is ArgminDef {\n return !!a && !!a['argmin'];\n}\n\nexport function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef {\n return !!a && !!a['argmax'];\n}\n\nexport function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\n\nexport const COUNTING_OPS = new Set([\n 'count',\n 'valid',\n 'missing',\n 'distinct'\n]) as ReadonlySet;\n\nexport function isCountingAggregateOp(aggregate?: string | Aggregate): boolean {\n return isString(aggregate) && COUNTING_OPS.has(aggregate as any);\n}\n\nexport function isMinMaxOp(aggregate?: Aggregate | string): boolean {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS = new Set([\n 'count',\n 'sum',\n 'distinct',\n 'valid',\n 'missing'\n]) as ReadonlySet;\n\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS = new Set([\n 'mean',\n 'average',\n 'median',\n 'q1',\n 'q3',\n 'min',\n 'max'\n]) as ReadonlySet;\n","import {isBoolean, isObject} from 'vega-util';\nimport {\n COLOR,\n COLUMN,\n ExtendedChannel,\n FILL,\n FILLOPACITY,\n OPACITY,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH\n} from './channel';\nimport {normalizeBin} from './channeldef';\nimport {ParameterExtent} from './selection';\nimport {entries, keys, varName} from './util';\n\nexport interface BaseBin {\n /**\n * The number base to use for automatic bin determination (default is base 10).\n *\n * __Default value:__ `10`\n *\n */\n base?: number;\n /**\n * An exact step size to use between bins.\n *\n * __Note:__ If provided, options such as maxbins will be ignored.\n */\n step?: number;\n /**\n * An array of allowable step sizes to choose from.\n * @minItems 1\n */\n steps?: number[];\n /**\n * A minimum allowable step size (particularly useful for integer values).\n */\n minstep?: number;\n /**\n * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.\n *\n * __Default value:__ `[5, 2]`\n *\n * @minItems 1\n */\n divide?: [number, number];\n /**\n * Maximum number of bins.\n *\n * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels\n *\n * @minimum 2\n */\n maxbins?: number;\n /**\n * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.\n *\n * __Default value:__ the minimum bin extent value\n */\n anchor?: number;\n /**\n * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.\n *\n * __Default value:__ `true`\n */\n nice?: boolean;\n}\n\n/**\n * Binning properties or boolean flag for determining whether to bin data or not.\n */\nexport interface BinParams extends BaseBin {\n /**\n * A two-element (`[min, max]`) array indicating the range of desired bin values.\n */\n extent?: BinExtent; // VgBinTransform uses a different extent so we need to pull this out.\n\n /**\n * When set to `true`, Vega-Lite treats the input data as already binned.\n */\n binned?: boolean;\n}\n\nexport type Bin = boolean | BinParams | 'binned' | null;\n\nexport type BinExtent = [number, number] | ParameterExtent;\n\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin: BinParams | true) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return (\n 'bin' +\n keys(bin)\n .map(p => (isParameterExtent(bin[p]) ? varName(`_${p}_${entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join('')\n );\n}\n\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\n\nexport function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams {\n return isObject(bin);\n}\n\nexport function isParameterExtent(extent: BinExtent): extent is ParameterExtent {\n return extent?.['param'];\n}\n\nexport function autoMaxBins(channel?: ExtendedChannel): number {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n","import {signalRefOrValue} from './compile/common';\nimport {Dict, keys} from './util';\nimport {MappedExclude} from './vega.schema';\n\nexport interface ExprRef {\n /**\n * Vega expression (which can refer to Vega-Lite parameters).\n */\n expr: string;\n}\n\nexport function isExprRef(o: any): o is ExprRef {\n return !!o?.expr;\n}\n\nexport function replaceExprRef>(index: T) {\n const props = keys(index || {});\n const newIndex: Dict = {};\n for (const prop of props) {\n newIndex[prop] = signalRefOrValue(index[prop]);\n }\n return newIndex as MappedExclude;\n}\n","import {BaseTitle, SignalRef, Text, TextEncodeEntry, TitleAnchor} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {ExprRef} from './expr';\nimport {MarkConfig} from './mark';\nimport {pick} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith, MappedExcludeValueRef} from './vega.schema';\n\nexport type BaseTitleNoValueRefs = MapExcludeValueRefAndReplaceSignalWith<\n Omit,\n ES\n> &\n // Since some logic depends on align/baseline, Vega-Lite does NOT allow signal for them.\n MappedExcludeValueRef>;\n\nexport type TitleConfig = BaseTitleNoValueRefs;\n\nexport interface TitleBase extends BaseTitleNoValueRefs {\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n *\n * __Default value:__ `\"middle\"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views.\n * `\"start\"` for other composite views.\n *\n * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `\"start\"`.\n */\n anchor?: TitleAnchor;\n\n /**\n * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark.\n *\n * __Default value:__ `\"group-title\"`.\n */\n style?: string | string[];\n\n /**\n * \tThe integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.\n *\n * __Default value:__ `0`.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n\n /**\n * Mark definitions for custom encoding.\n *\n * @hidden\n */\n encoding?: TextEncodeEntry;\n}\n\nexport interface TitleParams extends TitleBase {\n /**\n * The title text.\n */\n text: Text | ES;\n\n /**\n * The subtitle Text.\n */\n subtitle?: Text;\n}\n\nexport function extractTitleConfig(titleConfig: TitleConfig): {\n titleMarkConfig: MarkConfig;\n subtitleMarkConfig: MarkConfig;\n /** These are non-mark title config that need to be hardcoded in the title directive. */\n nonMarkTitleProperties: BaseTitleNoValueRefs;\n subtitle: BaseTitleNoValueRefs;\n} {\n const {\n // These are non-mark title config that need to be hardcoded\n anchor,\n frame,\n offset,\n orient,\n angle,\n limit,\n\n // color needs to be redirect to fill\n color,\n\n // subtitle properties\n subtitleColor,\n subtitleFont,\n subtitleFontSize,\n subtitleFontStyle,\n subtitleFontWeight,\n subtitleLineHeight,\n subtitlePadding,\n\n // The rest are mark config.\n ...rest\n } = titleConfig;\n\n const titleMarkConfig: MarkConfig = {\n ...rest,\n ...(color ? {fill: color} : {})\n };\n\n // These are non-mark title config that need to be hardcoded\n const nonMarkTitleProperties: BaseTitleNoValueRefs = {\n ...(anchor ? {anchor} : {}),\n ...(frame ? {frame} : {}),\n ...(offset ? {offset} : {}),\n ...(orient ? {orient} : {}),\n ...(angle !== undefined ? {angle} : {}),\n ...(limit !== undefined ? {limit} : {})\n };\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle: BaseTitleNoValueRefs = {\n ...(subtitleColor ? {subtitleColor} : {}),\n ...(subtitleFont ? {subtitleFont} : {}),\n ...(subtitleFontSize ? {subtitleFontSize} : {}),\n ...(subtitleFontStyle ? {subtitleFontStyle} : {}),\n ...(subtitleFontWeight ? {subtitleFontWeight} : {}),\n ...(subtitleLineHeight ? {subtitleLineHeight} : {}),\n ...(subtitlePadding ? {subtitlePadding} : {})\n };\n\n const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n\n return {titleMarkConfig, subtitleMarkConfig, nonMarkTitleProperties, subtitle};\n}\n\nexport function isText(v: any): v is Text {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n","import type {\n AggregateOp,\n BandScale,\n BaseScale,\n BinOrdinalScale,\n ColorValueRef,\n Compare as VgCompare,\n ExprRef as VgExprRef,\n GeoShapeTransform as VgGeoShapeTransform,\n IdentityScale,\n LayoutAlign,\n LinearScale,\n LogScale,\n Mark,\n MarkConfig,\n NumericValueRef,\n OrdinalScale,\n PointScale,\n PowScale,\n ProjectionType,\n QuantileScale,\n QuantizeScale,\n RangeBand,\n RangeRaw,\n RangeScheme,\n ScaleData,\n ScaleDataRef,\n ScaledValueRef,\n ScaleMultiDataRef,\n ScaleMultiFieldsRef,\n SequentialScale,\n SignalRef,\n SortField as VgSortField,\n SqrtScale,\n SymLogScale,\n ThresholdScale,\n TimeInterval,\n TimeIntervalStep,\n TimeScale,\n Title as VgTitle,\n Transforms as VgTransform,\n UnionSortField as VgUnionSortField\n} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Value} from './channeldef';\nimport {ExprRef} from './expr';\nimport {SortOrder} from './sort';\nimport {Dict, Flag, keys} from './util';\n\nexport type {VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef};\n\n// TODO: make recursive (e.g. with https://stackoverflow.com/a/64900252/214950 but needs https://github.com/vega/ts-json-schema-generator/issues/568)\nexport type MappedExclude = {\n [P in keyof T]: Exclude;\n};\n\nexport type MapExcludeAndKeepSignalAs = {\n [P in keyof T]: SignalRef extends T[P] ? Exclude | S : Exclude;\n};\n\n// Remove ValueRefs from mapped types\nexport type MappedExcludeValueRef = MappedExclude | NumericValueRef | ColorValueRef>;\n\nexport type MapExcludeValueRefAndReplaceSignalWith = MapExcludeAndKeepSignalAs<\n T,\n ScaledValueRef | NumericValueRef | ColorValueRef,\n S\n>;\n\nexport interface VgData {\n name: string;\n source?: string;\n values?: any;\n format?: {\n type?: string;\n parse?: string | Dict;\n property?: string;\n feature?: string;\n mesh?: string;\n };\n url?: string;\n transform?: VgTransform[];\n}\n\nexport type VgScaleDataRefWithSort = ScaleDataRef & {\n sort?: VgSortField;\n};\n\nexport function isSignalRef(o: any): o is SignalRef {\n return !!o?.signal;\n}\n\n// TODO: add type of value (Make it VgValueRef {value?:V ...})\nexport interface VgValueRef {\n value?: Value; // value should never be a signal so we use never\n field?:\n | string\n | {\n datum?: string;\n group?: string;\n parent?: string;\n };\n signal?: string;\n scale?: string; // TODO: object\n mult?: number;\n offset?: number | VgValueRef;\n band?: boolean | number | VgValueRef;\n test?: string;\n}\n\n// TODO: add vg prefix\nexport type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & {\n fields: (any[] | VgScaleDataRefWithSort | SignalRef)[];\n sort?: VgUnionSortField;\n};\n\nexport type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & {\n sort?: VgUnionSortField;\n};\n\nexport type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw;\n\nexport function isVgRangeStep(range: VgRange): range is VgRangeStep {\n return !!range['step'];\n}\n\nexport interface VgRangeStep {\n step: number | SignalRef;\n}\n// Domains that are not a union of domains\nexport type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef;\n\nexport type VgDomain = BaseScale['domain'];\n\nexport type VgMarkGroup = any;\n\n/**\n * A combined type for any Vega scales that Vega-Lite can generate\n */\nexport type VgScale = Pick & {\n range?: RangeScheme | RangeBand | ScaleData; // different Vega scales have conflicting range, need to union them here\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; // different Vega scales have conflicting range, need to union them here\n zero?: boolean | SignalRef; // LogScale only allow false, making the intersection type overly strict\n} & Omit<\n // Continuous\n Omit &\n Omit &\n Omit &\n Omit, 'type'> & // use partial so exponent is not required\n Omit &\n Omit &\n Omit &\n // Discretizing\n Omit &\n Omit &\n Omit &\n Omit &\n // Sequential\n Omit &\n // Discrete\n Omit &\n Omit &\n Omit,\n 'range' | 'nice' | 'zero'\n >;\n\nexport interface RowCol {\n row?: T;\n column?: T;\n}\n\nexport interface VgLayout {\n center?: boolean | RowCol;\n padding?: number | RowCol;\n headerBand?: number | RowCol;\n footerBand?: number | RowCol;\n\n titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>;\n offset?:\n | number\n | {\n rowHeader?: number;\n rowFooter?: number;\n rowTitle?: number;\n columnHeader?: number;\n columnFooter?: number;\n columnTitle?: number;\n };\n bounds?: 'full' | 'flush';\n columns?: number | {signal: string};\n align?: LayoutAlign | RowCol;\n}\n\nexport function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\n\nexport function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport type VgEncodeChannel =\n | 'x'\n | 'x2'\n | 'xc'\n | 'width'\n | 'y'\n | 'y2'\n | 'yc'\n | 'height'\n | 'opacity'\n | 'fill'\n | 'fillOpacity'\n | 'stroke'\n | 'strokeWidth'\n | 'strokeCap'\n | 'strokeOpacity'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeMiterLimit'\n | 'strokeJoin'\n | 'strokeOffset'\n | 'strokeForeground'\n | 'cursor'\n | 'clip'\n | 'size'\n | 'shape'\n | 'path'\n | 'innerRadius'\n | 'outerRadius'\n | 'startAngle'\n | 'endAngle'\n | 'interpolate'\n | 'tension'\n | 'orient'\n | 'url'\n | 'align'\n | 'baseline'\n | 'text'\n | 'dir'\n | 'ellipsis'\n | 'limit'\n | 'dx'\n | 'dy'\n | 'radius'\n | 'theta'\n | 'angle'\n | 'font'\n | 'fontSize'\n | 'fontWeight'\n | 'fontStyle'\n | 'tooltip'\n | 'href'\n | 'cursor'\n | 'defined'\n | 'cornerRadius'\n | 'cornerRadiusTopLeft'\n | 'cornerRadiusTopRight'\n | 'cornerRadiusBottomRight'\n | 'cornerRadiusBottomLeft'\n | 'scaleX'\n | 'scaleY';\n\nexport type VgEncodeEntry = Partial>;\n\n// TODO: make export interface VgEncodeEntry {\n// x?: VgValueRef\n// y?: VgValueRef\n// ...\n// color?: VgValueRef\n// ...\n// }\n\nexport type VgPostEncodingTransform = VgGeoShapeTransform;\n\nconst VG_MARK_CONFIG_INDEX: Flag = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1,\n url: 1,\n smooth: 1\n\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\n\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\n\nexport const VG_MARK_INDEX: Flag = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n] as const;\n\nexport interface VgComparator {\n field?: string | string[];\n order?: SortOrder | SortOrder[];\n}\n\nexport interface VgJoinAggregateTransform {\n type: 'joinaggregate';\n as?: string[];\n ops?: AggregateOp[];\n fields?: string[];\n groupby?: string[];\n}\n","import {ExprRef, SignalRef, Text} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {AxisConfig, ConditionalAxisProperty} from '../axis';\nimport {\n ConditionalPredicate,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldRefOption,\n OrderFieldDef,\n Value,\n ValueDef,\n vgField\n} from '../channeldef';\nimport {Config, StyleConfigIndex} from '../config';\nimport {isExprRef} from '../expr';\nimport {Mark, MarkConfig, MarkDef} from '../mark';\nimport {SortFields} from '../sort';\nimport {isText} from '../title';\nimport {deepEqual, getFirstDefined} from '../util';\nimport {isSignalRef, VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../vega.schema';\nimport {AxisComponentProps} from './axis/component';\nimport {Explicit} from './split';\nimport {UnitModel} from './unit';\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function signalOrValueRefWithCondition(\n val: ConditionalAxisProperty\n): ConditionalAxisProperty {\n const condition = isArray(val.condition)\n ? (val.condition as ConditionalPredicate | ExprRef | SignalRef>[]).map(conditionalSignalRefOrValue)\n : conditionalSignalRefOrValue(val.condition);\n\n return {\n ...signalRefOrValue>(val),\n condition\n };\n}\n\nexport function signalRefOrValue(value: T | SignalRef | ExprRef): T | SignalRef {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n return value;\n}\n\nexport function conditionalSignalRefOrValue | DatumDef | ValueDef>(\n value: ConditionalPredicate\n): ConditionalPredicate {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n return value;\n}\n\nexport function signalOrValueRef(value: T | SignalRef | ExprRef): {value: T} | SignalRef {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? {value} : undefined;\n}\n\nexport function exprFromSignalRefOrValue(ref: Value | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref);\n}\nexport function exprFromValueRefOrSignalRef(ref: VgValueRef | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\n\nexport function signalOrStringValue(v: SignalRef | any) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\n\nexport function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\n\nexport function getStyles(mark: MarkDef): string[] {\n return [].concat(mark.type, mark.style ?? []);\n}\n\nexport function getMarkPropOrConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n opt: {\n vgChannel?: VgEncodeChannel;\n ignoreVgConfig?: boolean;\n } = {}\n): MarkDef[P] {\n const {vgChannel, ignoreVgConfig} = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n } else if (mark[channel] !== undefined) {\n return mark[channel];\n } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n\n return getMarkConfig(channel, mark, config, opt);\n}\n\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n {vgChannel}: {vgChannel?: VgEncodeChannel} = {}\n): MarkDef[P] {\n return getFirstDefined[P]>(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined,\n getMarkStyleConfig(channel, mark, config.style),\n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined,\n\n config[mark.type][channel as any], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel as any] // Need to cast for the same reason as above\n );\n}\n\nexport function getMarkStyleConfig

(\n prop: P,\n mark: MarkDef,\n styleConfigIndex: StyleConfigIndex\n) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\n\nexport function getStyleConfig

>(\n p: P,\n styles: string | string[],\n styleConfigIndex: StyleConfigIndex\n) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n\n if (styleConfig && styleConfig[p as string] !== undefined) {\n value = styleConfig[p as string];\n }\n }\n return value;\n}\n\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(\n orderDef: OrderFieldDef | OrderFieldDef[],\n fieldRefOption?: FieldRefOption\n): SortFields {\n return array(orderDef).reduce(\n (s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n}\n\nexport type AxisTitleComponent = AxisComponentProps['title'];\n\nexport function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]) {\n const merged = [...f1];\n\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\n\nexport function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n } else if (!title1) {\n // if title1 is falsy\n return title2;\n } else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\n\nexport function mergeTitleComponent(v1: Explicit, v2: Explicit) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n } else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n } else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n","/**\n * Collection of all Vega-Lite Error Messages\n */\nimport {AggregateOp, SignalRef} from 'vega';\nimport {Aggregate} from '../aggregate';\nimport {\n Channel,\n ExtendedChannel,\n FacetChannel,\n getSizeChannel,\n OffsetScaleChannel,\n PositionScaleChannel,\n ScaleChannel\n} from '../channel';\nimport {HiddenCompositeAggregate, TypedFieldDef, Value} from '../channeldef';\nimport {SplitParentProperty} from '../compile/split';\nimport {CompositeMark} from '../compositemark';\nimport {ErrorBarCenter, ErrorBarExtent} from '../compositemark/errorbar';\nimport {DateTime, DateTimeExpr} from '../datetime';\nimport {ExprRef} from '../expr';\nimport {Mark} from '../mark';\nimport {Projection} from '../projection';\nimport {ScaleType} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {Type} from '../type';\nimport {stringify} from '../util';\nimport {VgSortField} from '../vega.schema';\n\nexport function invalidSpec(spec: GenericSpec) {\n return `Invalid specification ${stringify(\n spec\n )}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\n\nexport function containerSizeNonSingle(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\n\nexport function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\n\nexport function droppingFit(channel?: PositionScaleChannel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n\n// VIEW SIZE\n\nexport function unknownField(channel: Channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel: Channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\n\nexport function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\n\nexport function nearestNotSupportForContinuous(mark: string) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\n\nexport function selectionNotSupported(mark: CompositeMark) {\n return `Selection not supported for ${mark} yet.`;\n}\n\nexport function selectionNotFound(name: string) {\n return `Cannot find a selection named \"${name}\".`;\n}\n\nexport const SCALE_BINDINGS_CONTINUOUS =\n 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\n\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION =\n 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function cannotLookupVariableParameter(name: string) {\n return `Lookups can only be performed on selection parameters. \"${name}\" is a variable parameter.`;\n}\n\nexport function noSameUnitLookup(name: string) {\n return (\n `Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`\n );\n}\n\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\n\nexport const INTERVAL_INITIALIZED_WITH_POS =\n 'Interval selections should be initialized using \"x\", \"y\", \"longitude\", or \"latitude\" keys.';\n\n// REPEAT\nexport function noSuchRepeatedValue(field: string) {\n return `Unknown repeated value \"${field}\".`;\n}\n\nexport function columnsNotSupportByRowCol(type: 'facet' | 'repeat') {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS =\n 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n\n// DATA\nexport function unrecognizedParse(p: string) {\n return `Unrecognized parse \"${p}\".`;\n}\n\nexport function differentParse(field: string, local: string, ancestor: string) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\n\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n\n// TRANSFORMS\nexport function invalidTransformIgnored(transform: any) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\n\nexport const NO_FIELDS_NEEDS_AS =\n 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n\n// ENCODING & FACET\n\nexport function customFormatTypeNotAllowed(channel: ExtendedChannel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\n\nexport function projectionOverridden(opt: {\n parentProjection: Projection;\n projection: Projection;\n}) {\n const {parentProjection, projection} = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(\n projection\n )}.`;\n}\n\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\n\nexport function offsetNestedInsideContinuousPositionScaleDropped(mainChannel: PositionScaleChannel) {\n return `${mainChannel}Offset dropped because ${mainChannel} is continuous`;\n}\n\nexport function primitiveChannelDef(\n channel: ExtendedChannel,\n type: 'string' | 'number' | 'boolean',\n value: Exclude\n) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\n\nexport function invalidFieldType(type: Type) {\n return `Invalid field type \"${type}\".`;\n}\n\nexport function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\n\nexport function invalidAggregate(aggregate: AggregateOp | string) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\n\nexport function missingFieldType(channel: Channel, newType: Type) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolean; stroke?: boolean}) {\n const {fill, stroke} = opt;\n return `Dropping color ${type} as the plot also has ${\n fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'\n }.`;\n}\n\nexport function relativeBandSizeNotSupported(sizeChannel: 'width' | 'height') {\n return `Position range does not support relative band size for ${sizeChannel}.`;\n}\n\nexport function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) {\n return `Dropping ${stringify(\n fieldDef\n )} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\n\nexport const LINE_WITH_VARYING_SIZE =\n 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\n\nexport function incompatibleChannel(\n channel: ExtendedChannel,\n markOrFacet: Mark | 'facet' | CompositeMark,\n when?: string\n) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\n\nexport function offsetEncodingScaleIgnored(channel: OffsetScaleChannel) {\n return `${channel} encoding has no scale, so specified scale is ignored.`;\n}\n\nexport function invalidEncodingChannel(channel: ExtendedChannel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\n\nexport function channelShouldBeDiscrete(channel: ExtendedChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\n\nexport function channelShouldBeDiscreteOrDiscretizing(channel: ExtendedChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`;\n}\n\nexport function facetChannelDropped(channels: FacetChannel[]) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\n\nexport function discreteChannelCannotEncode(channel: Channel, type: Type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${\n type === 'ordinal' ? 'order' : 'magnitude'\n }.`;\n}\n\n// MARK\n\nexport function rangeMarkAlignmentCannotBeExpression(align: 'align' | 'baseline') {\n return `The ${align} for range marks cannot be an expression`;\n}\n\nexport function lineWithRange(hasX2: boolean, hasY2: boolean) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\n\nexport function orientOverridden(original: string, actual: string) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN =\n 'Custom domain scale cannot be unioned with default field-based domain.';\n\nexport function cannotUseScalePropertyWithNonColor(prop: string) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\n\nexport function cannotUseRelativeBandSizeWithNonBandScale(scaleType: ScaleType) {\n return `Cannot use the relative band size with ${scaleType} scale.`;\n}\n\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\n\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\n\nexport function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\n\nexport function cannotApplySizeToNonOrientedMark(mark: Mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\n\nexport function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\n\nexport function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\n\nexport function stepDropped(channel: 'width' | 'height') {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\n\nexport function mergeConflictingProperty(\n property: string | number | symbol,\n propertyOf: SplitParentProperty,\n v1: T,\n v2: T\n) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using ${stringify(v1)}.`;\n}\n\nexport function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using the union of the two domains.`;\n}\n\nexport function independentScaleMeansIndependentGuide(channel: Channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\n\nexport function domainSortDropped(sort: VgSortField) {\n return `Dropping sort property ${stringify(\n sort\n )} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\n\nexport const MORE_THAN_ONE_SORT =\n 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\n\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_SOURCE =\n 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n\n// STACK\nexport function cannotStackRangedMark(channel: Channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\n\nexport function cannotStackNonLinearScale(scaleType: ScaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\n\nexport function stackNonSummativeAggregate(aggregate: Aggregate | string) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n\n// TIMEUNIT\nexport function invalidTimeUnit(unitName: string, value: string | number) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\n\nexport function droppedDay(d: DateTime | DateTimeExpr) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\n\nexport function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${\n extent && center ? 'are ' : 'is '\n }not needed when data are aggregated.`;\n}\n\nexport function errorBarCenterIsUsedWithWrongExtent(\n center: ErrorBarCenter,\n extent: ErrorBarExtent,\n mark: 'errorbar' | 'errorband'\n) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\n\nexport function errorBarContinuousAxisHasCustomizedAggregate(\n aggregate: Aggregate | string,\n compositeMark: CompositeMark\n) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\n\nexport function errorBand1DNotSupport(property: 'interpolate' | 'tension') {\n return `1D error band does not support ${property}.`;\n}\n\n// CHANNEL\nexport function channelRequiredForBinned(channel: Channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\n\nexport function channelShouldNotBeUsedForBinned(channel: ExtendedChannel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\n\nexport function domainRequiredForThresholdScale(channel: ScaleChannel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n","/**\n * Vega-Lite's singleton logger utility.\n */\n\nimport {Debug, Error as ErrorLevel, Info, logger, LoggerInterface, Warn} from 'vega-util';\nexport * as message from './message';\n\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current: LoggerInterface = main;\n\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger implements LoggerInterface {\n public warns: any[] = [];\n public infos: any[] = [];\n public debugs: any[] = [];\n\n #level: number = Warn;\n\n public level(): number;\n public level(_: number): this;\n public level(_?: number) {\n if (_) {\n this.#level = _;\n return this;\n }\n return this.#level;\n }\n\n public warn(...args: readonly any[]) {\n if (this.#level >= Warn) this.warns.push(...args);\n return this;\n }\n\n public info(...args: readonly any[]) {\n if (this.#level >= Info) this.infos.push(...args);\n return this;\n }\n\n public debug(...args: readonly any[]) {\n if (this.#level >= Debug) this.debugs.push(...args);\n return this;\n }\n\n public error(...args: readonly any[]): this {\n if (this.#level >= ErrorLevel) throw Error(...args);\n return this;\n }\n}\n\nexport function wrap(f: (logger: LocalLogger) => void) {\n return () => {\n current = new LocalLogger();\n f(current as LocalLogger);\n reset();\n };\n}\n\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger: LoggerInterface) {\n current = newLogger;\n return current;\n}\n\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\n\nexport function error(...args: readonly any[]) {\n current.error(...args);\n}\n\nexport function warn(...args: readonly any[]) {\n current.warn(...args);\n}\n\nexport function info(...args: readonly any[]) {\n current.info(...args);\n}\n\nexport function debug(...args: readonly any[]) {\n current.debug(...args);\n}\n","// DateTime definition object\n\nimport {isNumber, isObject} from 'vega-util';\nimport * as log from './log';\nimport {TIMEUNIT_PARTS} from './timeunit';\nimport {duplicate, isNumeric, keys} from './util';\n\n/**\n * @minimum 1\n * @maximum 12\n * @TJS-type integer\n */\nexport type Month = number;\n\n/**\n * @minimum 1\n * @maximum 7\n */\nexport type Day = number;\n\n/**\n * Object for defining datetime in Vega-Lite Filter.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n * We accept string for month and day names.\n */\nexport interface DateTime {\n /**\n * Integer value representing the year.\n * @TJS-type integer\n */\n year?: number;\n\n /**\n * Integer value representing the quarter of the year (from 1-4).\n * @minimum 1\n * @maximum 4\n * @TJS-type integer\n */\n quarter?: number;\n\n /**\n * One of:\n * (1) integer value representing the month from `1`-`12`. `1` represents January;\n * (2) case-insensitive month name (e.g., `\"January\"`);\n * (3) case-insensitive, 3-character short month name (e.g., `\"Jan\"`).\n */\n month?: Month | string;\n\n /**\n * Integer value representing the date (day of the month) from 1-31.\n * @minimum 1\n * @maximum 31\n * @TJS-type integer\n */\n date?: number;\n\n /**\n * Value representing the day of a week. This can be one of:\n * (1) integer value -- `1` represents Monday;\n * (2) case-insensitive day name (e.g., `\"Monday\"`);\n * (3) case-insensitive, 3-character short day name (e.g., `\"Mon\"`).\n *\n * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`.\n */\n day?: Day | string;\n\n /**\n * Integer value representing the hour of a day from 0-23.\n * @minimum 0\n * @maximum 24\n * @TJS-type integer\n */\n hours?: number;\n\n /**\n * Integer value representing the minute segment of time from 0-59.\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n minutes?: number;\n\n /**\n * Integer value representing the second segment (0-59) of a time value\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n seconds?: number;\n\n /**\n * Integer value representing the millisecond segment of time.\n * @minimum 0\n * @maximum 1000\n * @TJS-type integer\n */\n milliseconds?: number;\n\n /**\n * A boolean flag indicating if date time is in utc time. If false, the date time is in local time\n */\n utc?: boolean;\n}\n\n/**\n * Internal Object for defining datetime expressions.\n * This is an expression version of DateTime.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n */\nexport interface DateTimeExpr {\n year?: string;\n quarter?: string;\n month?: string;\n date?: string;\n day?: string;\n hours?: string;\n minutes?: string;\n seconds?: string;\n milliseconds?: string;\n utc?: boolean;\n}\n\nexport function isDateTime(o: any): o is DateTime {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\n\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\n\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\n\nfunction normalizeQuarter(q: number | string): number {\n if (isNumeric(q)) {\n q = +q;\n }\n\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n } else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\n\nfunction normalizeMonth(m: string | number): number {\n if (isNumeric(m)) {\n m = +m;\n }\n\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n } else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\n\nfunction normalizeDay(d: string | number): number {\n if (isNumeric(d)) {\n d = +d;\n }\n\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n } else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d: DateTime | DateTimeExpr, normalize: boolean) {\n const parts: (string | number)[] = [];\n\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n\n if (d.year !== undefined) {\n parts.push(d.year);\n } else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n } else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : `${quarter}*3`);\n } else {\n parts.push(0); // months start at zero in JS\n }\n\n if (d.date !== undefined) {\n parts.push(d.date);\n } else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : `${day}+1`);\n } else {\n parts.push(1); // Date starts at 1 in JS\n }\n\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds'] as const) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n\n return parts;\n}\n\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d: DateTimeExpr) {\n const parts: (string | number)[] = dateTimeParts(d, false);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n if (d.utc) {\n return +new Date(Date.UTC(...(parts as [any, any])));\n } else {\n return +new Date(...(parts as [any]));\n }\n}\n","import {isObject, isString} from 'vega-util';\nimport {DateTime, DateTimeExpr, dateTimeExprToExpr, dateTimeToExpr} from './datetime';\nimport {accessPathWithDatum, keys, stringify, varName} from './util';\n\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\nexport type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX;\n\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\n\nexport function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\n\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n} as const;\n\nexport type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX;\n\nexport type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit;\n\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n\n yeardayofyear: 1,\n\n quartermonth: 1,\n\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n\n hoursminutes: 1,\n hoursminutesseconds: 1,\n\n minutesseconds: 1,\n\n secondsmilliseconds: 1\n} as const;\n\nexport type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX;\n\nconst BINNED_LOCAL_TIMEUNIT_INDEX = {\n binnedyear: 1,\n binnedyearquarter: 1,\n binnedyearquartermonth: 1,\n\n binnedyearmonth: 1,\n binnedyearmonthdate: 1,\n binnedyearmonthdatehours: 1,\n binnedyearmonthdatehoursminutes: 1,\n binnedyearmonthdatehoursminutesseconds: 1,\n\n binnedyearweek: 1,\n binnedyearweekday: 1,\n binnedyearweekdayhours: 1,\n binnedyearweekdayhoursminutes: 1,\n binnedyearweekdayhoursminutesseconds: 1,\n\n binnedyeardayofyear: 1\n} as const;\n\ntype BinnedLocalTimeUnit = keyof typeof BINNED_LOCAL_TIMEUNIT_INDEX;\n\nconst BINNED_UTC_TIMEUNIT_INDEX = {\n binnedutcyear: 1,\n binnedutcyearquarter: 1,\n binnedutcyearquartermonth: 1,\n\n binnedutcyearmonth: 1,\n binnedutcyearmonthdate: 1,\n binnedutcyearmonthdatehours: 1,\n binnedutcyearmonthdatehoursminutes: 1,\n binnedutcyearmonthdatehoursminutesseconds: 1,\n\n binnedutcyearweek: 1,\n binnedutcyearweekday: 1,\n binnedutcyearweekdayhours: 1,\n binnedutcyearweekdayhoursminutes: 1,\n binnedutcyearweekdayhoursminutesseconds: 1,\n\n binnedutcyeardayofyear: 1\n};\n\nexport const BINNED_TIMEUNIT_INDEX = {\n ...BINNED_LOCAL_TIMEUNIT_INDEX,\n ...BINNED_UTC_TIMEUNIT_INDEX\n};\n\ntype BinnedUtcTimeUnit = keyof typeof BINNED_UTC_TIMEUNIT_INDEX;\n\nexport type BinnedTimeUnit = BinnedLocalTimeUnit | BinnedUtcTimeUnit;\n\nexport function isBinnedTimeUnit(\n timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams | undefined\n): timeUnit is BinnedTimeUnit | TimeUnitParams {\n if (isObject(timeUnit)) {\n return timeUnit.binned;\n }\n return isBinnedTimeUnitString(timeUnit);\n}\n\nexport function isBinnedTimeUnitString(timeUnit: TimeUnit | BinnedTimeUnit | undefined): timeUnit is BinnedTimeUnit {\n return timeUnit && timeUnit.startsWith('binned');\n}\n\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n\n utcyeardayofyear: 1,\n\n utcquartermonth: 1,\n\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n\n utcminutesseconds: 1,\n\n utcsecondsmilliseconds: 1\n} as const;\n\nexport type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX;\n\nexport type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit;\n\nexport type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit;\nexport type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit;\n\nexport function isUTCTimeUnit(t: string): t is UtcTimeUnit {\n return t.startsWith('utc');\n}\n\nexport function getLocalTimeUnitFromUTCTimeUnit(t: UtcTimeUnit): LocalTimeUnit {\n return t.substring(3) as LocalTimeUnit;\n}\n\nexport type TimeUnit = SingleTimeUnit | MultiTimeUnit;\n\nexport type TimeUnitFormat =\n | 'year'\n | 'year-month'\n | 'year-month-date'\n | 'quarter'\n | 'month'\n | 'date'\n | 'week'\n | 'day'\n | 'hours'\n | 'hours-minutes'\n | 'minutes'\n | 'seconds'\n | 'milliseconds';\n\nexport interface TimeUnitTransformParams {\n /**\n * Defines how date-time values should be binned.\n */\n unit?: TimeUnit;\n\n /**\n * If no `unit` is specified, maxbins is used to infer time units.\n */\n maxbins?: number;\n\n /**\n * The number of steps between bins, in terms of the least\n * significant unit provided.\n */\n step?: number;\n\n /**\n * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.\n */\n utc?: boolean;\n}\n\n/**\n * Time Unit Params for encoding predicate, which can specified if the data is already \"binned\".\n */\nexport interface TimeUnitParams extends TimeUnitTransformParams {\n /**\n * Whether the data has already been binned to this time unit.\n * If true, Vega-Lite will only format the data, marks, and guides,\n * without applying the timeUnit transform to re-bin the data again.\n */\n binned?: boolean;\n}\n\n// matches vega time unit format specifier\nexport type TimeFormatConfig = Partial>;\n\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT: TimeFormatConfig = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\n\nexport function getTimeUnitParts(timeUnit: TimeUnit): LocalSingleTimeUnit[] {\n return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part));\n}\n\nexport function getSmallestTimeUnitPart(timeUnit: TimeUnit): LocalSingleTimeUnit {\n const parts = getTimeUnitParts(timeUnit);\n return parts[parts.length - 1];\n}\n\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n\n if (index < 0) {\n return false;\n }\n\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit: TimeUnit, field: string, {end}: {end: boolean} = {end: false}): string {\n const fieldRef = accessPathWithDatum(field);\n\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n\n function func(timeUnit: TimeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n } else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n\n let lastTimeUnit: TimeUnit;\n\n const dateExpr: DateTimeExpr = {};\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n\n return dateTimeExprToExpr(dateExpr);\n}\n\nexport function timeUnitSpecifierExpression(timeUnit: TimeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string {\n if (!timeUnit) {\n return undefined;\n }\n\n const expr = timeUnitSpecifierExpression(timeUnit);\n\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\n\nexport function normalizeTimeUnit(timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams): TimeUnitParams {\n if (!timeUnit) {\n return undefined;\n }\n\n let params: TimeUnitParams;\n if (isString(timeUnit)) {\n if (isBinnedTimeUnitString(timeUnit)) {\n params = {\n unit: timeUnit.substring(6) as TimeUnit,\n binned: true\n };\n } else {\n params = {\n unit: timeUnit\n };\n }\n } else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? {unit: timeUnit.unit} : {})\n };\n }\n\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit);\n }\n\n return params;\n}\n\nexport function timeUnitToString(tu: TimeUnit | TimeUnitTransformParams) {\n const {utc, ...rest} = normalizeTimeUnit(tu);\n\n if (rest.unit) {\n return (\n (utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join('')\n );\n } else {\n // when maxbins is specified instead of units\n return (\n (utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join('')\n );\n }\n}\n\nexport function durationExpr(\n timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitTransformParams,\n wrap: (x: string) => string = x => x\n) {\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit);\n if (smallestUnitPart && smallestUnitPart !== 'day') {\n const startDate: DateTime = {\n year: 2001, // pick a non-leap year\n month: 1,\n date: 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0\n };\n const {step, part} = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step);\n const endDate: DateTime = {\n ...startDate,\n [part]: +startDate[part] + step\n };\n\n // Calculate timestamp duration for the smallest unit listed\n return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`;\n }\n return undefined;\n}\n\nconst DATE_PARTS = {\n year: 1,\n month: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\ntype DatePart = keyof typeof DATE_PARTS;\n\nexport function isDatePart(timeUnit: LocalSingleTimeUnit): timeUnit is DatePart {\n return !!DATE_PARTS[timeUnit];\n}\n\nexport function getDateTimePartAndStep(\n timeUnit: LocalSingleTimeUnit,\n step = 1\n): {\n part: keyof DateTime;\n step: number;\n} {\n if (isDatePart(timeUnit)) {\n return {part: timeUnit, step};\n }\n switch (timeUnit) {\n case 'day':\n case 'dayofyear':\n return {part: 'date', step};\n case 'quarter':\n return {part: 'month', step: step * 3};\n case 'week':\n return {part: 'date', step: step * 7};\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FieldName, valueExpr, vgField} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {LogicalComposition} from './logical';\nimport {ParameterName} from './parameter';\nimport {fieldExpr as timeUnitFieldExpr, normalizeTimeUnit, TimeUnit, TimeUnitParams, BinnedTimeUnit} from './timeunit';\nimport {stringify} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type Predicate =\n // a) FieldPredicate (but we don't type FieldFilter here so the schema has no nesting\n // and thus the documentation shows all of the types clearly)\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldValidPredicate\n // b) Selection Predicate\n | ParameterPredicate\n // c) Vega Expression string\n | string;\n\nexport type FieldPredicate =\n | FieldEqualPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldValidPredicate;\n\nexport interface ParameterPredicate {\n /**\n * Filter using a parameter name.\n */\n param: ParameterName;\n /**\n * For selection parameters, the predicate of empty selections returns true by default.\n * Override this behavior, by setting this property `empty: false`.\n */\n empty?: boolean;\n}\n\nexport function isSelectionPredicate(predicate: LogicalComposition): predicate is ParameterPredicate {\n return predicate?.['param'];\n}\n\nexport interface FieldPredicateBase {\n // TODO: support aggregate\n\n /**\n * Time unit for the field to be tested.\n */\n timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams;\n\n /**\n * Field to be tested.\n */\n field: FieldName;\n}\n\nexport interface FieldEqualPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be equal to.\n */\n equal: string | number | boolean | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate {\n return !!predicate?.field && predicate.equal !== undefined;\n}\n\nexport interface FieldLTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than.\n */\n lt: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate {\n return !!predicate?.field && predicate.lt !== undefined;\n}\n\nexport interface FieldLTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than or equals to.\n */\n lte: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate {\n return !!predicate?.field && predicate.lte !== undefined;\n}\n\nexport interface FieldGTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than.\n */\n gt: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate {\n return !!predicate?.field && predicate.gt !== undefined;\n}\n\nexport interface FieldGTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than or equals to.\n */\n gte: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate {\n return !!predicate?.field && predicate.gte !== undefined;\n}\n\nexport interface FieldRangePredicate extends FieldPredicateBase {\n /**\n * An array of inclusive minimum and maximum values\n * for a field value of a data item to be included in the filtered data.\n * @maxItems 2\n * @minItems 2\n */\n range: (number | DateTime | null | ExprRef | SignalRef)[] | ExprRef | SignalRef;\n}\n\nexport function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate {\n if (predicate?.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n } else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\n\nexport interface FieldOneOfPredicate extends FieldPredicateBase {\n /**\n * A set of values that the `field`'s value should be a member of,\n * for a data item included in the filtered data.\n */\n oneOf: string[] | number[] | boolean[] | DateTime[];\n}\n\nexport interface FieldValidPredicate extends FieldPredicateBase {\n /**\n * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).\n */\n valid: boolean;\n}\n\nexport function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate {\n return (\n !!predicate?.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\n\nexport function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate {\n return !!predicate?.field && predicate.valid !== undefined;\n}\n\nexport function isFieldPredicate(\n predicate: Predicate\n): predicate is\n | FieldOneOfPredicate\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate {\n return (\n isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate)\n );\n}\n\nfunction predicateValueExpr(v: number | string | boolean | DateTime | ExprRef | SignalRef, timeUnit: TimeUnit) {\n return valueExpr(v, {timeUnit, wrapTime: true});\n}\n\nfunction predicateValuesExpr(vals: (number | string | boolean | DateTime)[], timeUnit: TimeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate: FieldPredicate, useInRange = true) {\n const {field} = predicate;\n const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit);\n const {unit, binned} = normalizedTimeUnit || {};\n const rawFieldExpr = vgField(predicate, {expr: 'datum'});\n const fieldExpr = unit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n `time(${!binned ? timeUnitFieldExpr(unit, field) : rawFieldExpr})`\n : rawFieldExpr;\n\n if (isFieldEqualPredicate(predicate)) {\n return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`;\n } else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, unit)}`;\n } else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, unit)}`;\n } else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, unit)}`;\n } else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, unit)}`;\n } else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr}) !== -1`;\n } else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n } else if (isFieldRangePredicate(predicate)) {\n const {range} = predicate;\n const lower = isSignalRef(range) ? {signal: `${range.signal}[0]`} : range[0];\n const upper = isSignalRef(range) ? {signal: `${range.signal}[1]`} : range[1];\n\n if (lower !== null && upper !== null && useInRange) {\n return (\n 'inrange(' + fieldExpr + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])'\n );\n }\n\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, unit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, unit)}`);\n }\n\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${stringify(predicate)}`);\n}\n\nexport function fieldValidPredicate(fieldExpr: string, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n } else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\n\nexport function normalizePredicate(f: Predicate): Predicate {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)\n };\n }\n return f;\n}\n","import {keys} from './util';\n\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n} as const;\n\nexport type Type = keyof typeof Type;\n\nexport function isType(t: any): t is Type {\n return t in Type;\n}\n\nexport function isContinuous(type: Type): type is 'quantitative' | 'temporal' {\n return type === 'quantitative' || type === 'temporal';\n}\nexport function isDiscrete(type: Type): type is 'ordinal' | 'nominal' {\n return type === 'ordinal' || type === 'nominal';\n}\n\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\n\nexport const GEOJSON = Type.geojson;\n\nexport type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal';\n\nexport const TYPES = keys(Type);\n\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type: Type | string): Type | undefined {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n","import {\n isObject,\n RangeEnum,\n ScaleBins,\n ScaleInterpolateEnum,\n ScaleInterpolateParams,\n SignalRef,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {isString} from 'vega-util';\nimport type {ColorScheme} from 'vega-typings';\nimport * as CHANNEL from './channel';\nimport {Channel, isColorChannel} from './channel';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport * as log from './log';\nimport {ParameterExtent} from './selection';\nimport {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type';\nimport {contains, Flag, keys} from './util';\n\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n} as const;\n\ntype ValueOf = T[keyof T];\nexport type ScaleType = ValueOf;\n\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX: Record = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal', // TODO: should bin-ordinal support merging with other\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\n\nexport const SCALE_TYPES: ScaleType[] = keys(SCALE_CATEGORY_INDEX);\n\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (\n scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')\n );\n}\n\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX: Record = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11, // band has higher precedence as it is better for interaction\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType: ScaleType): number {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\n\nexport const QUANTITATIVE_SCALES = new Set([\n 'linear',\n 'log',\n 'pow',\n 'sqrt',\n 'symlog'\n]) as ReadonlySet;\n\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([\n ...QUANTITATIVE_SCALES,\n 'time',\n 'utc'\n]) as ReadonlySet;\n\nexport function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' {\n return QUANTITATIVE_SCALES.has(type);\n}\n\nexport const CONTINUOUS_TO_DISCRETE_SCALES = new Set([\n 'quantile',\n 'quantize',\n 'threshold'\n]) as ReadonlySet;\n\nexport const CONTINUOUS_DOMAIN_SCALES = new Set([\n ...CONTINUOUS_TO_CONTINUOUS_SCALES,\n ...CONTINUOUS_TO_DISCRETE_SCALES,\n 'sequential',\n 'identity'\n]) as ReadonlySet;\n\nexport const DISCRETE_DOMAIN_SCALES = new Set([\n 'ordinal',\n 'bin-ordinal',\n 'point',\n 'band'\n]) as ReadonlySet;\n\nexport const TIME_SCALE_TYPES = new Set(['time', 'utc']) as ReadonlySet;\n\nexport function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' {\n return DISCRETE_DOMAIN_SCALES.has(type);\n}\n\nexport function hasContinuousDomain(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold' {\n return CONTINUOUS_DOMAIN_SCALES.has(type);\n}\n\nexport function isContinuousToContinuous(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' {\n return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type);\n}\n\nexport function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold' {\n return CONTINUOUS_TO_DISCRETE_SCALES.has(type);\n}\n\nexport interface ScaleConfig {\n /**\n * If true, rounds numeric output values to integers.\n * This can be helpful for snapping to the pixel grid.\n * (Only available for `x`, `y`, and `size` scales.)\n */\n round?: boolean | ES;\n\n /**\n * If true, values that exceed the data domain are clamped to either the minimum or maximum range value\n */\n clamp?: boolean | ES;\n\n /**\n * Default inner padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding.\n *\n * __Default value:__ `0.2`\n *\n * @minimum 0\n * @maximum 1\n */\n bandWithNestedOffsetPaddingInner?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding.\n *\n * __Default value:__ `0.2`\n *\n * @minimum 0\n * @maximum 1\n */\n // Note: nested offset always uses band scale, so we don't need \"band\" in the name for brevity.\n bandWithNestedOffsetPaddingOuter?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band scales.\n *\n * __Default value:__\n * - `nestedOffsetPaddingInner` for x/y scales with nested x/y offset scales.\n * - `barBandPaddingInner` for bar marks (`0.1` by default)\n * - `rectBandPaddingInner` for rect and other marks (`0` by default)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingInner?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` band scales.\n *\n * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingOuter?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"bar\"` marks.\n *\n * __Default value:__ `0.1`\n *\n * @minimum 0\n * @maximum 1\n */\n barBandPaddingInner?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"rect\"` marks.\n *\n * __Default value:__ `0`\n *\n * @minimum 0\n * @maximum 1\n */\n rectBandPaddingInner?: number | ES;\n\n /**\n * Default padding inner for xOffset/yOffset's band scales.\n *\n * __Default Value:__ `0`\n */\n offsetBandPaddingInner?: number | ES;\n\n /**\n * Default padding outer for xOffset/yOffset's band scales.\n *\n * __Default Value:__ `0`\n */\n offsetBandPaddingOuter?: number | ES;\n\n /**\n * Default padding for continuous x/y scales.\n *\n * __Default:__ The bar width for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.\n *\n * @minimum 0\n */\n continuousPadding?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` point-ordinal scales.\n *\n * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n pointPadding?: number | ES;\n\n /**\n * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n *\n * This is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n *\n * This property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n *\n * __Default value:__ `false`\n */\n useUnaggregatedDomain?: boolean;\n\n // nice should depends on type (quantitative or temporal), so\n // let's not make a config.\n\n // Configs for Range\n\n /**\n * The default max value for mapping quantitative fields to bar's size/bandSize.\n *\n * If undefined (default), we will use the axis's size (width or height) - 1.\n * @minimum 0\n */\n maxBandSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false.\n *\n * __Default value:__ `2`\n *\n * @minimum 0\n */\n minBandSize?: number;\n\n /**\n * The default max value for mapping quantitative fields to text's size/fontSize.\n *\n * __Default value:__ `40`\n *\n * @minimum 0\n */\n maxFontSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false\n *\n * __Default value:__ `8`\n *\n * @minimum 0\n */\n minFontSize?: number;\n\n /**\n * Default minimum opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.3`\n *\n * @minimum 0\n * @maximum 1\n */\n minOpacity?: number;\n\n /**\n * Default max opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.8`\n *\n * @minimum 0\n * @maximum 1\n */\n maxOpacity?: number;\n\n /**\n * Default minimum value for point size scale with zero=false.\n *\n * __Default value:__ `9`\n *\n * @minimum 0\n */\n minSize?: number;\n\n /**\n * Default max value for point size scale.\n * @minimum 0\n */\n maxSize?: number;\n\n /**\n * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n minStrokeWidth?: number;\n\n /**\n * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n maxStrokeWidth?: number;\n\n /**\n * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantileCount?: number;\n\n /**\n * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantizeCount?: number;\n\n /**\n * Reverse x-scale by default (useful for right-to-left charts).\n */\n xReverse?: boolean | ES;\n\n /**\n * Default `scale.zero` for [`continuous`](https://vega.github.io/vega-lite/docs/scale.html#continuous) scales except for (1) x/y-scales of non-ranged bar or area charts and (2) size scales.\n *\n * __Default value:__ `true`\n *\n */\n zero?: boolean;\n}\n\nexport const defaultScaleConfig: ScaleConfig = {\n pointPadding: 0.5,\n\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n bandWithNestedOffsetPaddingInner: 0.2,\n bandWithNestedOffsetPaddingOuter: 0.2,\n\n minBandSize: 2,\n\n minFontSize: 8,\n maxFontSize: 40,\n\n minOpacity: 0.3,\n maxOpacity: 0.8,\n\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9, // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small!\n\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4,\n\n zero: true\n};\n\nexport interface SchemeParams {\n /**\n * A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n name: ColorScheme | SignalRef;\n\n /**\n * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme.\n */\n extent?: (number | SignalRef)[] | SignalRef;\n\n /**\n * The number of colors to use in the scheme. This can be useful for scale types such as `\"quantize\"`, which use the length of the scale range to determine the number of discrete bins for the scale domain.\n */\n count?: number | SignalRef;\n}\n\nexport type Domain =\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | ParameterExtent\n | SignalRef\n | DomainUnionWith;\n\nexport type Scheme = string | SchemeParams;\n\nexport function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams {\n return !isString(scheme) && !!scheme['name'];\n}\n\nexport function isParameterDomain(domain: Domain): domain is ParameterExtent {\n return domain?.['param'];\n}\n\nexport interface DomainUnionWith {\n /**\n * Customized domain values to be union with the field's values or explicitly defined domain.\n * Should be an array of valid scale domain values.\n */\n unionWith: (number | string | boolean | DateTime)[];\n}\n\nexport function isDomainUnionWith(domain: Domain): domain is DomainUnionWith {\n return domain?.['unionWith'];\n}\n\nexport interface FieldRange {\n field: string;\n}\n\nexport function isFieldRange(range: any): range is FieldRange {\n return isObject(range) && 'field' in range;\n}\n\nexport interface Scale {\n /**\n * The type of scale. Vega-Lite supports the following categories of scale types:\n *\n * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`\"linear\"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`\"pow\"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`\"sqrt\"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`\"symlog\"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`\"log\"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`\"time\"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`\"utc\"`](https://vega.github.io/vega-lite/docs/scale.html#utc).\n *\n * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`\"ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`\"band\"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`\"point\"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges.\n *\n * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`\"bin-ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`\"quantile\"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`\"quantize\"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`\"threshold\"`](https://vega.github.io/vega-lite/docs/scale.html#threshold).\n *\n * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type).\n */\n type?: ScaleType;\n\n /**\n * Customized domain values in the form of constant values or dynamic values driven by a parameter.\n *\n * 1) Constant `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property.\n * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n * - A string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n *\n * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`.\n *\n * 5) Domain can also takes an object defining a field or encoding of a parameter that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain.\n */\n domain?:\n | (null | string | number | boolean | DateTime | ES)[]\n | 'unaggregated'\n | ParameterExtent\n | DomainUnionWith\n | ES;\n\n /**\n * An expression for an array of raw values that, if non-null, directly overrides the _domain_ property.\n * This is useful for supporting interactions such as panning or zooming a scale.\n * The scale may be initially determined using a data-driven domain, then modified in response to user input by setting the rawDomain value.\n */\n domainRaw?: ES;\n\n /**\n * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains.\n */\n domainMid?: number | ES;\n\n /**\n * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains.\n */\n domainMax?: number | DateTime | ES;\n\n /**\n * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.\n */\n domainMin?: number | DateTime | ES;\n\n /**\n * If true, reverses the order of the scale range.\n * __Default value:__ `false`.\n */\n reverse?: boolean | ES;\n\n /**\n * The range of the scale. One of:\n *\n * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `\"symbol\"`, or `\"diverging\"`).\n *\n * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n *\n * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: \"color\"}`.\n *\n * __Notes:__\n *\n * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`.\n *\n * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`).\n */\n range?: RangeEnum | (number | string | number[] | ES)[] | FieldRange;\n\n /**\n * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMax?: number | string | ES;\n\n /**\n * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMin?: number | string | ES;\n\n // ordinal\n\n /**\n * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `\"category10\"` or `\"blues\"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params).\n *\n * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales.\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n scheme?: ColorScheme | SchemeParams | ES;\n\n /**\n * The alignment of the steps within the scale range.\n *\n * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.\n *\n * __Default value:__ `0.5`\n */\n align?: number | ES;\n\n /**\n * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:\n * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.\n * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries.\n * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.\n */\n // TODO: add - A [signal reference](../types/#Signal) that resolves to either an array or bin specification object.\n bins?: ScaleBins;\n\n /**\n * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.\n *\n * __Default value:__ `false`.\n */\n round?: boolean | ES;\n\n /**\n * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties.\n *\n * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n *\n * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`.\n *\n * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`.\n * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n */\n padding?: number | ES;\n\n /**\n * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n *\n * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingInner?: number | ES;\n\n /**\n * The outer padding (spacing) at the ends of the range of band and point scales,\n * as a fraction of the step size. This value must lie in the range [0,1].\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales.\n * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingOuter?: number | ES;\n\n // typical\n /**\n * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default).\n */\n clamp?: boolean | ES;\n\n /**\n * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_.\n *\n * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.\n *\n * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.\n *\n * __Default value:__ `true` for unbinned _quantitative_ fields without explicit domain bounds; `false` otherwise.\n *\n */\n nice?: boolean | number | TimeInterval | TimeIntervalStep | ES;\n\n /**\n * The logarithm base of the `log` scale (default `10`).\n */\n base?: number | ES;\n\n /**\n * The exponent of the `pow` scale.\n */\n exponent?: number | ES;\n\n /**\n * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales.\n *\n * __Default value:__ `1`\n */\n constant?: number | ES;\n\n /**\n * If `true`, ensures that a zero baseline value is included in the scale domain.\n *\n * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise.\n *\n * __Note:__ Log, time, and utc scales do not support `zero`.\n */\n zero?: boolean | ES;\n\n /**\n * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate).\n *\n * * __Default value:__ `hcl`\n */\n interpolate?: ScaleInterpolateEnum | ES | ScaleInterpolateParams;\n}\n\nconst SCALE_PROPERTY_INDEX: Flag> = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n domainRaw: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1, // zero depends on domain\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\n\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\n\nconst {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} =\n SCALE_PROPERTY_INDEX;\n\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\n\nexport function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !['point', 'band', 'identity'].includes(scaleType);\n case 'bins':\n return !['point', 'band', 'identity', 'ordinal'].includes(scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType);\n case 'paddingOuter':\n case 'align':\n return ['point', 'band'].includes(scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'domainRaw':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (\n hasContinuousDomain(scaleType) &&\n !contains(\n [\n 'log', // log scale cannot have zero value\n 'time',\n 'utc', // zero is not meaningful for time\n 'threshold', // threshold requires custom domain so zero does not matter\n 'quantile' // quantile depends on distribution so zero does not matter\n ],\n scaleType\n )\n );\n }\n}\n\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(propName);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'domainRaw':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\n\nexport function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n } else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n } else if (fieldDefType === QUANTITATIVE) {\n return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined;\n }\n\n return true;\n}\n\nexport function channelSupportScaleType(channel: Channel, scaleType: ScaleType, hasNestedOffsetScale = false): boolean {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.XOFFSET:\n case CHANNEL.YOFFSET:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n if (isContinuousToContinuous(scaleType)) {\n return true;\n } else if (scaleType === 'band') {\n return true;\n } else if (scaleType === 'point') {\n /*\n Point scale can't be use if the position has a nested offset scale\n because if there is a nested scale, then it's band.\n */\n return !hasNestedOffsetScale;\n }\n return false;\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (\n isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType)\n );\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n }\n}\n","import {Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline} from 'vega';\nimport {CompositeMark, CompositeMarkDef} from './compositemark';\nimport {ExprRef} from './expr';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema';\n\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n} as const;\n\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\n\nexport type Mark = keyof typeof Mark;\n\nexport function isMark(m: string): m is Mark {\n return m in Mark;\n}\n\nexport function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' {\n return ['line', 'area', 'trail'].includes(m);\n}\n\nexport function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc' {\n return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m);\n}\n\nexport const PRIMITIVE_MARKS = new Set(keys(Mark));\n\nexport interface ColorMixins {\n /**\n * Default color.\n *\n * __Default value:__ `\"#4682b4\"`\n *\n * __Note:__\n * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`.\n */\n color?: Color | Gradient | ES;\n}\n\nexport interface TooltipContent {\n content: 'encoding' | 'data';\n}\n\n/** @hidden */\nexport type Hide = 'hide';\n\nexport interface MarkInvalidMixins {\n /**\n * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n * - If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.\n */\n invalid?: 'filter' | Hide | null;\n}\n\nexport interface VLOnlyMarkConfig extends ColorMixins, MarkInvalidMixins {\n /**\n * Whether the mark's color should be used as fill color instead of stroke color.\n *\n * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n *\n * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n *\n */\n filled?: boolean;\n\n /**\n * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.\n */\n order?: null | boolean;\n\n /**\n * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\n * If set to `0.5`, the marks will be positioned in the middle of the time unit band step.\n */\n timeUnitBandPosition?: number;\n\n /**\n * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\n * If set to `0.5`, bandwidth of the marks will be half of the time unit band step.\n */\n timeUnitBandSize?: number;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: number | ES; // In Vega, this is called endAngle\n\n /**\n * The secondary (inner) radius in pixels of arc marks.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n radius2?: number | ES; // In Vega, this is called innerRadius\n}\n\nexport interface MarkConfig\n extends VLOnlyMarkConfig,\n MapExcludeValueRefAndReplaceSignalWith, ES> {\n // ========== Overriding Vega ==========\n\n /**\n * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n *\n * - If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n * - If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n * - If set to `null` or `false`, then no tooltip will be used.\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n *\n * __Default value:__ `null`\n */\n tooltip?: number | string | boolean | TooltipContent | ES | null; // VL has a special object form for tooltip content\n\n /**\n * Default size for marks.\n * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n * - For `bar`, this represents the band size of the bar, in pixels.\n * - For `text`, this represents the font size, in pixels.\n *\n * __Default value:__\n * - `30` for point, circle, square marks; width/height's `step`\n * - `2` for bar marks with discrete dimensions;\n * - `5` for bar marks with continuous dimensions;\n * - `11` for text marks.\n *\n * @minimum 0\n */\n size?: number | ES; // size works beyond symbol marks in VL\n\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: number | 'width' | ES; // Vega doesn't have 'width'\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: number | 'height' | ES; // Vega doesn't have 'height'\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x2?: number | 'width' | ES; // Vega doesn't have 'width'\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y2?: number | 'height' | ES; // Vega doesn't have 'height'\n\n /**\n * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n *\n * __Default value:__ (None)\n *\n */\n fill?: Color | Gradient | null | ES; // docs: Vega doesn't have config.color\n\n /**\n * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n *\n * __Default value:__ (None)\n *\n */\n stroke?: Color | Gradient | null | ES; // docs: Vega doesn't have config.color\n\n /**\n * The overall opacity (value between [0,1]).\n *\n * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number | ES; // docs (different defaults)\n\n /**\n * The orientation of a non-stacked bar, tick, area, and line charts.\n * The value is either horizontal (default) or vertical.\n * - For bar, rule and tick, this determines whether the size of the bar and tick\n * should be applied to x or y dimension.\n * - For area, this property determines the orient property of the Vega output.\n * - For line and trail marks, this property determines the sort order of the points in the line\n * if `config.sortLineBy` is not specified.\n * For stacked charts, this is always determined by the orientation of the stack;\n * therefore explicitly specified value will be ignored.\n */\n orient?: Orientation; // Vega orient doesn't apply to bar/tick/line. Since some logic depends on this property, Vega-Lite does NOT allow signal for orient.\n\n /**\n * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`.\n *\n * __Note:__ Expression reference is *not* supported for range marks.\n */\n align?: Align | ES;\n\n /**\n * For text marks, the vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, `\"line-bottom\"`, or an expression reference that provides one of the valid values.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`,\n * but are calculated relative to the `lineHeight` rather than `fontSize` alone.\n *\n * For range marks, the vertical alignment of the marks. One of `\"top\"`, `\"middle\"`, `\"bottom\"`.\n *\n * __Note:__ Expression reference is *not* supported for range marks.\n *\n */\n baseline?: TextBaseline | ES;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n *\n * @minimum 0\n * @maximum 360\n */\n theta?: number | ES; // overriding VG\n\n /**\n *\n * For arc mark, the primary (outer) radius in pixels.\n *\n * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.\n *\n * __Default value:__ `min(plot_width, plot_height)/2`\n * @minimum 0\n */\n radius?: number | ES; // overriding VG\n\n /**\n * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n innerRadius?: number | ES;\n\n /**\n * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n outerRadius?: number | ES;\n}\n\nexport interface RectBinSpacingMixins {\n /**\n * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n binSpacing?: number;\n}\n\nexport type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef;\n\nexport function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef {\n return mark['type'];\n}\n\nexport function isPrimitiveMark(mark: AnyMark): mark is Mark {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return (PRIMITIVE_MARKS as Set).has(markType);\n}\n\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n] as const;\n\nexport const FILL_CONFIG = ['fill', 'fillOpacity'] as const;\n\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\n\nconst VL_ONLY_MARK_CONFIG_INDEX: Flag> = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBandSize: 1,\n timeUnitBandPosition: 1\n};\n\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\n\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: {\n [k in Mark]?: (keyof Required>[k])[];\n} = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\n\nexport const defaultMarkConfig: MarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBandSize: 1\n};\n\n// TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed\nexport type AnyMarkConfig =\n | MarkConfig\n | AreaConfig\n | BarConfig\n | RectConfig\n | LineConfig\n | TickConfig;\n\nexport interface MarkConfigMixins {\n /** Mark Config */\n mark?: MarkConfig;\n\n // MARK-SPECIFIC CONFIGS\n\n /** Arc-specific Config */\n arc?: RectConfig;\n\n /** Area-Specific Config */\n area?: AreaConfig;\n\n /** Bar-Specific Config */\n bar?: BarConfig;\n\n /** Circle-Specific Config */\n circle?: MarkConfig;\n\n /** Image-specific Config */\n image?: RectConfig;\n\n /** Line-Specific Config */\n line?: LineConfig;\n\n /** Point-Specific Config */\n point?: MarkConfig;\n\n /** Rect-Specific Config */\n rect?: RectConfig;\n\n /** Rule-Specific Config */\n rule?: MarkConfig;\n\n /** Square-Specific Config */\n square?: MarkConfig;\n\n /** Text-Specific Config */\n text?: MarkConfig;\n\n /** Tick-Specific Config */\n tick?: TickConfig;\n\n /** Trail-Specific Config */\n trail?: LineConfig;\n\n /** Geoshape-Specific Config */\n geoshape?: MarkConfig;\n}\n\nconst MARK_CONFIG_INDEX: Flag> = {\n mark: 1,\n arc: 1,\n area: 1,\n bar: 1,\n circle: 1,\n image: 1,\n line: 1,\n point: 1,\n rect: 1,\n rule: 1,\n square: 1,\n text: 1,\n tick: 1,\n trail: 1,\n geoshape: 1\n};\n\nexport const MARK_CONFIGS = keys(MARK_CONFIG_INDEX);\n\nexport interface RectConfig extends RectBinSpacingMixins, MarkConfig {\n /**\n * The default size of the bars on continuous scales.\n *\n * __Default value:__ `5`\n *\n * @minimum 0\n */\n continuousBandSize?: number;\n\n /**\n * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.\n * @minimum 0\n */\n discreteBandSize?: number | RelativeBandSize;\n\n /**\n * The minimum band size for bar and rectangle marks.\n * __Default value:__ `0.25`\n */\n minBandSize?: number | ES;\n}\n\nexport type BandSize = number | RelativeBandSize | SignalRef;\n\nexport interface RelativeBandSize {\n /**\n * The relative band size. For example `0.5` means half of the band scale's band width.\n */\n band: number;\n}\n\nexport function isRelativeBandSize(o: number | RelativeBandSize | ExprRef | SignalRef): o is RelativeBandSize {\n return o && o['band'] != undefined;\n}\n\nexport const BAR_CORNER_RADIUS_INDEX: Partial<\n Record<\n Orientation,\n ('cornerRadiusTopLeft' | 'cornerRadiusTopRight' | 'cornerRadiusBottomLeft' | 'cornerRadiusBottomRight')[]\n >\n> = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\n\nexport interface BarCornerRadiusMixins {\n /**\n * - For vertical bars, top-left and top-right corner radius.\n *\n * - For horizontal bars, top-right and bottom-right corner radius.\n */\n cornerRadiusEnd?: number | ES;\n}\n\nexport type BarConfig = RectConfig & BarCornerRadiusMixins;\n\nexport type OverlayMarkDef = MarkConfig & MarkDefMixins;\n\nexport interface PointOverlayMixins {\n /**\n * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n *\n * - If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n *\n * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n *\n * - If this property is `false`, no points would be automatically added to line or area marks.\n *\n * __Default value:__ `false`.\n */\n point?: boolean | OverlayMarkDef | 'transparent';\n}\n\nexport interface LineConfig extends MarkConfig, PointOverlayMixins {}\n\nexport interface LineOverlayMixins {\n /**\n * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n *\n * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n *\n * - If this value is `false`, no lines would be automatically added to area marks.\n *\n * __Default value:__ `false`.\n */\n line?: boolean | OverlayMarkDef;\n}\n\nexport interface AreaConfig\n extends MarkConfig,\n PointOverlayMixins,\n LineOverlayMixins {}\n\nexport interface TickThicknessMixins {\n /**\n * Thickness of the tick mark.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n thickness?: number | SignalRef;\n}\n\nexport interface GenericMarkDef {\n /**\n * The mark type. This could a primitive mark type\n * (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\n * or a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`).\n */\n type: M;\n}\n\nexport interface MarkDefMixins {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n *\n * __Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n * __Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n\n /**\n * Whether a mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n\n // Offset properties should not be a part of config\n\n /**\n * Offset for x-position.\n */\n xOffset?: number | ES;\n\n /**\n * Offset for y-position.\n */\n yOffset?: number | ES;\n\n /**\n * Offset for x2-position.\n */\n x2Offset?: number | ES;\n\n /**\n * Offset for y2-position.\n */\n y2Offset?: number | ES;\n\n /**\n * Offset for theta.\n */\n thetaOffset?: number | ES;\n\n /**\n * Offset for theta2.\n */\n theta2Offset?: number | ES;\n\n /**\n * Offset for radius.\n */\n radiusOffset?: number | ES;\n\n /**\n * Offset for radius2.\n */\n radius2Offset?: number | ES;\n}\n\nexport interface RelativeBandSize {\n /**\n * The relative band size. For example `0.5` means half of the band scale's band width.\n */\n band: number;\n}\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\nexport interface MarkDef\n extends GenericMarkDef,\n Omit<\n MarkConfig &\n AreaConfig &\n BarConfig & // always extends RectConfig\n LineConfig &\n TickConfig,\n 'startAngle' | 'endAngle' | 'width' | 'height'\n >,\n MarkDefMixins {\n // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion\n // We still support start/endAngle only in config, just in case people use Vega config with Vega-Lite.\n\n /**\n * @hidden\n */\n startAngle?: number | ES;\n /**\n * @hidden\n */\n endAngle?: number | ES;\n\n // Replace width / height to include relative band size\n\n /**\n * Width of the marks. One of:\n *\n * - A number representing a fixed pixel width.\n *\n * - A relative band size definition. For example, `{band: 0.5}` represents half of the band.\n */\n width?: number | ES | RelativeBandSize;\n\n /**\n * Height of the marks. One of:\n *\n * - A number representing a fixed pixel height.\n *\n * - A relative band size definition. For example, `{band: 0.5}` represents half of the band\n */\n height?: number | ES | RelativeBandSize;\n}\n\nconst DEFAULT_RECT_BAND_SIZE = 5;\n\nexport const defaultBarConfig: RectConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\n\nexport const defaultRectConfig: RectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\n\nexport interface TickConfig extends MarkConfig, TickThicknessMixins {\n /**\n * The width of the ticks.\n *\n * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).\n * @minimum 0\n */\n bandSize?: number;\n}\n\nexport const defaultTickConfig: TickConfig = {\n thickness: 1\n};\n\nexport function getMarkType(m: string | GenericMarkDef) {\n return isMarkDef(m) ? m.type : m;\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport type {SignalRef} from 'vega';\nimport {isFunction, isString} from 'vega-util';\nimport {isCountingAggregateOp} from '../../../aggregate';\nimport {isBinned, isBinning} from '../../../bin';\nimport {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel';\nimport {\n binRequiresRange,\n ChannelDef,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldName,\n FieldRefOption,\n getBandPosition,\n isDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n isValueDef,\n SecondaryChannelDef,\n SecondaryFieldDef,\n TypedFieldDef,\n Value,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {dateTimeToExpr, isDateTime} from '../../../datetime';\nimport {isExprRef} from '../../../expr';\nimport * as log from '../../../log';\nimport {isPathMark, Mark, MarkDef} from '../../../mark';\nimport {fieldValidPredicate} from '../../../predicate';\nimport {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale';\nimport {StackProperties} from '../../../stack';\nimport {TEMPORAL} from '../../../type';\nimport {contains, stringify} from '../../../util';\nimport {isSignalRef, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\n\nexport function midPointRefWithPositionInvalidTest(\n params: MidPointParams & {\n channel: PositionChannel | PolarPositionChannel;\n }\n) {\n const {channel, channelDef, markDef, scale, config} = params;\n const ref = midPoint(params);\n\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale\n scale &&\n isContinuousToContinuous(scale.get('type'))\n ) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\n\nexport function wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref,\n config\n}: {\n fieldDef: FieldDef;\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n ref: VgValueRef;\n config: Config;\n}): VgValueRef | VgValueRef[] {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n }\n return ref;\n}\n\nexport function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n\n const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things.\n const zeroValueRef =\n mainChannel === 'y'\n ? {field: {group: 'height'}}\n : // x / angle / radius can all use 0\n {value: 0};\n\n return {test, ...zeroValueRef};\n}\n\nexport function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid);\n}\n\nexport function datumDefToExpr(datumDef: DatumDef) {\n const {datum} = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${stringify(datum)}`;\n}\n\nexport function valueRefForFieldOrDatumDef(\n fieldDef: FieldDefBase | DatumDef,\n scaleName: string,\n opt: FieldRefOption,\n encode: {offset?: number | VgValueRef; band?: number | boolean | SignalRef}\n): VgValueRef {\n const ref: VgValueRef = {};\n\n if (scaleName) {\n ref.scale = scaleName;\n }\n\n if (isDatumDef(fieldDef)) {\n const {datum} = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n } else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n } else if (isExprRef(datum)) {\n ref.signal = datum.expr;\n } else {\n ref.value = datum;\n }\n } else {\n ref.field = vgField(fieldDef, opt);\n }\n\n if (encode) {\n const {offset, band} = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef,\n fieldOrDatumDef2,\n offset,\n startSuffix,\n endSuffix = 'end',\n bandPosition = 0.5\n}: {\n scaleName: string;\n fieldOrDatumDef: TypedFieldDef;\n fieldOrDatumDef2?: SecondaryFieldDef;\n startSuffix?: string;\n endSuffix?: string;\n offset: number | SignalRef | VgValueRef;\n bandPosition: number | SignalRef;\n}): VgValueRef {\n const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix});\n const end =\n fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, {expr})\n : vgField(fieldOrDatumDef, {suffix: endSuffix, expr});\n\n const ref: VgValueRef = {};\n\n if (bandPosition === 0 || bandPosition === 1) {\n ref.scale = scaleName;\n const field = bandPosition === 0 ? start : end;\n ref.field = field;\n } else {\n const datum = isSignalRef(bandPosition)\n ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}`\n : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\n\nexport function binSizeExpr({scaleName, fieldDef}: {scaleName: string; fieldDef: TypedFieldDef}) {\n const start = vgField(fieldDef, {expr: 'datum'});\n const end = vgField(fieldDef, {expr: 'datum', suffix: 'end'});\n return `abs(scale(\"${scaleName}\", ${end}) - scale(\"${scaleName}\", ${start}))`;\n}\n\nexport interface MidPointParams {\n channel: Channel;\n channelDef: ChannelDef;\n channel2Def?: SecondaryChannelDef;\n\n markDef: MarkDef;\n config: Config;\n\n scaleName: string;\n scale: ScaleComponent;\n stack?: StackProperties;\n offset?: number | SignalRef | VgValueRef;\n defaultRef: VgValueRef | (() => VgValueRef);\n\n bandPosition?: number | SignalRef;\n}\n\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition\n}: MidPointParams): VgValueRef {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n\n if (isFieldOrDatumDef(channelDef)) {\n const scaleType = scale?.get('type');\n if (isTypedFieldDef(channelDef)) {\n bandPosition ??= getBandPosition({\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n config\n });\n const {bin, timeUnit, type} = channelDef;\n\n if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack?.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset});\n }\n\n if (bandPosition && !hasDiscreteDomain(scaleType)) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, bandPosition, offset});\n }\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n binRequiresRange(channelDef, channel) ? {binSuffix: 'range'} : {},\n {\n offset\n }\n );\n } else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n bandPosition,\n offset\n });\n } else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n hasDiscreteDomain(scaleType) ? {binSuffix: 'range'} : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined\n }\n );\n } else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? {offset} : {};\n\n return {...widthHeightValueOrSignalRef(channel, value), ...offsetMixins};\n }\n\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? {offset} : {})\n };\n }\n return defaultRef;\n}\n\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return {field: {group: 'width'}};\n } else if (contains(['y', 'y2'], channel) && value === 'height') {\n return {field: {group: 'height'}};\n }\n return signalOrValueRef(value);\n}\n","import type {SignalRef} from 'vega';\nimport {isString} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {\n channelDefType,\n DatumDef,\n FieldDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isPositionFieldOrDatumDef,\n isScaleFieldDef,\n vgField\n} from '../channeldef';\nimport {Config} from '../config';\nimport {fieldValidPredicate} from '../predicate';\nimport {ScaleType} from '../scale';\nimport {formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression} from '../timeunit';\nimport {QUANTITATIVE, Type} from '../type';\nimport {Dict, stringify} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {TimeUnit} from './../timeunit';\nimport {datumDefToExpr} from './mark/encode/valueref';\n\nexport function isCustomFormatType(formatType: string) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\n\nfunction customFormatExpr(formatType: string, field: string, format: string | Dict) {\n return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`;\n}\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function formatSignalRef({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n}) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n const type = channelDefType(fieldOrDatumDef);\n\n if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (type === 'quantitative') {\n if (normalizeStack && config.normalizedNumberFormatType)\n return formatCustomType({\n fieldOrDatumDef,\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n expr,\n config\n });\n if (config.numberFormatType) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.numberFormat,\n formatType: config.numberFormatType,\n expr,\n config\n });\n }\n }\n if (\n type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined\n ) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.timeFormat,\n formatType: config.timeFormatType,\n expr,\n config\n });\n }\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression({\n field,\n timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n formatType: config.timeFormatType,\n rawTimeFormat: config.timeFormat,\n isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n });\n return signal ? {signal} : undefined;\n }\n\n format = numberFormat({type, specifiedFormat: format, config, normalizeStack});\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n } else {\n return {signal: `isValid(${field}) ? ${field} : \"\"+${field}`};\n }\n}\n\nfunction fieldToFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n expr: 'datum' | 'parent' | 'datum.datum',\n normalizeStack: boolean\n) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, {expr, suffix: 'end'})}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n } else {\n return vgField(fieldOrDatumDef, {expr});\n }\n } else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\n\nexport function formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config,\n field\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n field?: string; // axis/legend \"use datum.value\"\n}) {\n field ??= fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (\n field !== 'datum.value' && // For axis/legend, we can't correctly know the end of the bin from `datum`\n isFieldDef(fieldOrDatumDef) &&\n isBinning(fieldOrDatumDef.bin)\n ) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return {signal: customFormatExpr(formatType, field, format)};\n}\n\nexport function guideFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n type: Type,\n format: string | Dict,\n formatType: string | SignalRef,\n config: Config,\n omitTimeFormatConfig: boolean // axis doesn't use config.timeFormat\n) {\n if (isString(formatType) && isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (\n config.normalizedNumberFormatType &&\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize'\n ) {\n return undefined; // handled in encode block\n }\n if (config.numberFormatType) {\n return undefined; // handled in encode block\n }\n }\n }\n\n if (\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormat\n ) {\n return numberFormat({\n type: 'quantitative',\n config,\n normalizeStack: true\n });\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) {\n return undefined; // hanlded in encode block\n }\n\n return timeFormat({specifiedFormat: format as string, timeUnit, config, omitTimeFormatConfig});\n }\n\n return numberFormat({type, specifiedFormat: format, config});\n}\n\nexport function guideFormatType(\n formatType: string | SignalRef,\n fieldOrDatumDef: FieldDef | DatumDef,\n scaleType: ScaleType\n) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time';\n }\n return undefined;\n}\n\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat({\n type,\n specifiedFormat,\n config,\n normalizeStack\n}: {\n type: Type;\n specifiedFormat?: string | Dict;\n config: Config;\n normalizeStack?: boolean;\n}) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return normalizeStack ? config.normalizedNumberFormat : config.numberFormat;\n }\n return undefined;\n}\n\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat({\n specifiedFormat,\n timeUnit,\n config,\n omitTimeFormatConfig\n}: {\n specifiedFormat?: string;\n timeUnit?: TimeUnit;\n config: Config;\n omitTimeFormatConfig?: boolean;\n}) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\n\nfunction formatExpr(field: string, format: string) {\n return `format(${field}, \"${format || ''}\")`;\n}\n\nfunction binNumberFormatExpr(field: string, format: string | Dict, formatType: string, config: Config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\n\nexport function binFormatExpression(\n startField: string,\n endField: string,\n format: string | Dict,\n formatType: string,\n config: Config\n): string {\n if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) {\n return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config);\n }\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression({\n field,\n timeUnit,\n format,\n formatType,\n rawTimeFormat,\n isUTCScale\n}: {\n field: string;\n timeUnit?: TimeUnit;\n format?: string | Dict;\n formatType?: string;\n rawTimeFormat?: string; // should be provided only for actual text and headers, not axis/legend labels\n isUTCScale?: boolean;\n}): string {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n if (!timeUnit && formatType) {\n return `${formatType}(${field}, '${format}')`;\n }\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n } else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n","import {isArray} from 'vega-util';\nimport {NonArgAggregateOp} from './aggregate';\nimport {FieldName} from './channeldef';\nimport {DateTime} from './datetime';\n\nexport type SortOrder = 'ascending' | 'descending';\n\n/**\n * A sort definition for transform\n */\nexport interface SortField {\n /**\n * The name of the field to sort.\n */\n field: FieldName;\n\n /**\n * Whether to sort the field in ascending or descending order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortFields {\n field: FieldName[];\n order?: SortOrder[];\n}\n\nexport const DEFAULT_SORT_OP = 'min';\n\n/**\n * A sort definition for sorting a discrete scale in an encoding field definition.\n */\n\nexport interface EncodingSortField {\n /**\n * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n *\n * __Default value:__ If unspecified, defaults to the field specified in the outer data reference.\n */\n field?: F; // Field is optional because `\"op\": \"count\"` does not require a field.\n /**\n * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\n * An aggregation is required when there are multiple values of the sort field for each encoded data field.\n * The input data objects will be aggregated, grouped by the encoded data field.\n *\n * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n *\n * __Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`.\n */\n op?: NonArgAggregateOp;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortByEncoding {\n /**\n * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `\"x\"`, `\"y\"`)\n */\n encoding: SortByChannel;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport type SortArray = number[] | string[] | boolean[] | DateTime[];\n\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n} as const;\n\nexport type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX;\n\nexport function isSortByChannel(c: string): c is SortByChannel {\n return c in SORT_BY_CHANNEL_INDEX;\n}\n\nexport type SortByChannelDesc =\n | '-x'\n | '-y'\n | '-color'\n | '-fill'\n | '-stroke'\n | '-strokeWidth'\n | '-size'\n | '-shape'\n | '-fillOpacity'\n | '-strokeOpacity'\n | '-opacity'\n | '-text';\n\nexport type AllSortString = SortOrder | SortByChannel | SortByChannelDesc;\n\nexport type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null;\n\nexport function isSortByEncoding(sort: Sort): sort is SortByEncoding {\n return !!sort?.['encoding'];\n}\n\nexport function isSortField(sort: Sort): sort is EncodingSortField {\n return sort && (sort['op'] === 'count' || !!sort['field']);\n}\n\nexport function isSortArray(sort: Sort): sort is SortArray {\n return sort && isArray(sort);\n}\n","import {LayoutAlign, SignalRef} from 'vega';\nimport {BinParams} from '../bin';\nimport {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef';\nimport {ExprRef} from '../expr';\nimport {Header} from '../header';\nimport {EncodingSortField, SortArray, SortOrder} from '../sort';\nimport {StandardType} from '../type';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {GenericLayerSpec, NormalizedLayerSpec} from './layer';\nimport {GenericUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport interface FacetFieldDef\n extends TypedFieldDef {\n /**\n * An object defining properties of a facet's header.\n */\n header?: Header | null;\n\n // Note: `\"sort\"` for facet field def is different from encoding field def as it does not support `SortByEncoding`\n\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` is not supported for `row` and `column`.\n */\n sort?: SortArray | SortOrder | EncodingSortField | null;\n}\n\nexport type FacetEncodingFieldDef<\n F extends Field,\n ES extends ExprRef | SignalRef = ExprRef | SignalRef\n> = FacetFieldDef & GenericCompositionLayoutWithColumns;\n\nexport interface RowColumnEncodingFieldDef\n extends FacetFieldDef {\n // Manually declarae this separated from GenericCompositionLayout as we don't support RowCol object in RowColumnEncodingFieldDef\n\n /**\n * The alignment to apply to row/column facet's subplot.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign;\n\n /**\n * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between facet's sub-views.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number;\n}\n\nexport interface FacetMapping<\n F extends Field,\n FD extends FacetFieldDef = FacetFieldDef\n> {\n /**\n * A field definition for the vertical facet of trellis plots.\n */\n row?: FD;\n\n /**\n * A field definition for the horizontal facet of trellis plots.\n */\n column?: FD;\n}\n\nexport function isFacetMapping(\n f: FacetFieldDef | FacetMapping\n): f is FacetMapping {\n return 'row' in f || 'column' in f;\n}\n\n/**\n * Facet mapping for encoding macro\n */\nexport interface EncodingFacetMapping\n extends FacetMapping> {\n /**\n * A field definition for the (flexible) facet of trellis plots.\n *\n * If either `row` or `column` is specified, this channel will be ignored.\n */\n facet?: FacetEncodingFieldDef;\n}\n\nexport function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef {\n return !!channelDef && 'header' in channelDef;\n}\n\n/**\n * Base interface for a facet specification.\n */\nexport interface GenericFacetSpec, L extends GenericLayerSpec, F extends Field>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * Definition for how to facet the data. One of:\n * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)\n */\n facet: FacetFieldDef | FacetMapping;\n\n /**\n * A specification of the view that gets faceted.\n */\n spec: L | U;\n // TODO: replace this with GenericSpec once we support all cases;\n}\n\n/**\n * A facet specification without any shortcut / expansion syntax\n */\nexport type NormalizedFacetSpec = GenericFacetSpec;\n\nexport function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec {\n return 'facet' in spec;\n}\n","import {Gradient, ScaleType, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isNumber, isString} from 'vega-util';\nimport {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate';\nimport {Axis} from './axis';\nimport {autoMaxBins, Bin, BinParams, binToString, isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n COLOR,\n COLUMN,\n DESCRIPTION,\n DETAIL,\n ExtendedChannel,\n FACET,\n FILL,\n FILLOPACITY,\n getSizeChannel,\n HREF,\n isScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n PolarPositionScaleChannel,\n PositionScaleChannel,\n RADIUS,\n RADIUS2,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n XOFFSET,\n Y,\n Y2,\n YOFFSET\n} from './channel';\nimport {getMarkConfig, getMarkPropOrConfig} from './compile/common';\nimport {isCustomFormatType} from './compile/format';\nimport {CompositeAggregate} from './compositemark';\nimport {Config} from './config';\nimport {DateTime, dateTimeToExpr, isDateTime} from './datetime';\nimport {Encoding} from './encoding';\nimport {ExprRef, isExprRef} from './expr';\nimport {Guide, GuideEncodingConditionalValueDef, TitleMixins} from './guide';\nimport {ImputeParams} from './impute';\nimport {Legend} from './legend';\nimport * as log from './log';\nimport {LogicalComposition} from './logical';\nimport {isRectBasedMark, Mark, MarkDef, RelativeBandSize} from './mark';\nimport {ParameterPredicate, Predicate} from './predicate';\nimport {hasDiscreteDomain, isContinuousToDiscrete, Scale, SCALE_CATEGORY_INDEX} from './scale';\nimport {isSortByChannel, Sort, SortOrder} from './sort';\nimport {isFacetFieldDef} from './spec/facet';\nimport {StackOffset} from './stack';\nimport {\n BinnedTimeUnit,\n getTimeUnitParts,\n isBinnedTimeUnit,\n isLocalSingleTimeUnit,\n normalizeTimeUnit,\n TimeUnit,\n TimeUnitParams,\n timeUnitToString\n} from './timeunit';\nimport {AggregatedFieldDef, WindowFieldDef} from './transform';\nimport {getFullName, QUANTITATIVE, StandardType, Type} from './type';\nimport {\n Dict,\n flatAccessWithDatum,\n getFirstDefined,\n internalField,\n omit,\n removePathFromField,\n replacePathInField,\n stringify,\n titleCase\n} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type PrimitiveValue = number | string | boolean | null;\n\nexport type Value =\n | PrimitiveValue\n | number[]\n | Gradient\n | Text\n | ES;\n\n/**\n * Definition object for a constant value (primitive value or gradient definition) of an encoding channel.\n */\nexport interface ValueDef {\n /**\n * A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).\n */\n value: V;\n}\n\nexport type PositionValueDef = ValueDef;\nexport type NumericValueDef = ValueDef;\n\n/**\n * A ValueDef with Condition where either the condition or the value are optional.\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * @minProperties 1\n */\nexport type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial<\n ValueDef\n> & {\n /**\n * A field definition or one or more value definition(s) with a parameter predicate.\n */\n condition?:\n | Conditional\n | Conditional>\n | Conditional>[];\n};\n\nexport type StringValueDefWithCondition = ValueDefWithCondition<\n MarkPropFieldOrDatumDef,\n string | null\n>;\nexport type TypeForShape = 'nominal' | 'ordinal' | 'geojson';\n\nexport type ConditionalTemplate = FieldDef | DatumDef | ValueDef | ExprRef | SignalRef;\n\nexport type Conditional = ConditionalPredicate | ConditionalParameter;\n\nexport type ConditionalPredicate = {\n /**\n * Predicate for triggering the condition\n */\n test: LogicalComposition;\n} & CD;\n\nexport type ConditionalParameter = ParameterPredicate & CD;\n\nexport function isConditionalParameter(c: Conditional): c is ConditionalParameter {\n return c['param'];\n}\n\nexport interface ConditionValueDefMixins {\n /**\n * One or more value definition(s) with [a parameter or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n *\n * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\n * since Vega-Lite only allows at most one encoded field per encoding channel.\n */\n condition?: Conditional> | Conditional>[];\n}\n\n/**\n * A FieldDef with Condition\n * {\n * condition: {value: ...},\n * field: ...,\n * ...\n * }\n */\n\nexport type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F &\n ConditionValueDefMixins;\n\nexport type MarkPropDef =\n | FieldOrDatumDefWithCondition, V>\n | FieldOrDatumDefWithCondition, V>\n | ValueDefWithCondition, V>;\n\nexport type ColorDef = MarkPropDef;\nexport type NumericMarkPropDef = MarkPropDef;\n\nexport type NumericArrayMarkPropDef = MarkPropDef;\n\nexport type ShapeDef = MarkPropDef;\n\nexport type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>;\nexport type TextDef =\n | FieldOrDatumDefWithCondition, Text>\n | FieldOrDatumDefWithCondition, Text>\n | ValueDefWithCondition, Text>;\n\n/**\n * A ValueDef with optional Condition\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * Reference to a repeated value.\n */\nexport interface RepeatRef {\n repeat: 'row' | 'column' | 'repeat' | 'layer';\n}\n\nexport type FieldName = string;\nexport type Field = FieldName | RepeatRef;\n\nexport function isRepeatRef(field: Field | any): field is RepeatRef {\n return field && !isString(field) && 'repeat' in field;\n}\n\n/** @@hidden */\nexport type HiddenCompositeAggregate = CompositeAggregate;\n\nexport interface FieldDefBase extends BandMixins {\n /**\n * __Required.__ A string defining the name of the field from which to pull a data value\n * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n *\n * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n *\n * __Notes:__\n * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\n * If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\n * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n * 2) `field` is not required if `aggregate` is `count`.\n */\n field?: F;\n\n // function\n\n /**\n * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\n * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation.\n */\n timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams;\n\n /**\n * Aggregation function for the field\n * (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation.\n */\n aggregate?: Aggregate | HiddenCompositeAggregate;\n\n /**\n * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n *\n * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied.\n *\n * - If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n *\n * __Default value:__ `false`\n *\n * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.\n */\n bin?: B;\n}\n\nexport function toFieldDefBase(fieldDef: FieldDef): FieldDefBase {\n const {field, timeUnit, bin, aggregate} = fieldDef;\n return {\n ...(timeUnit ? {timeUnit} : {}),\n ...(bin ? {bin} : {}),\n ...(aggregate ? {aggregate} : {}),\n field\n };\n}\n\nexport interface TypeMixins {\n /**\n * The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\n * It can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n *\n * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\n * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n *\n * __Default value:__\n *\n * 1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n * - `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n * - `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n * - `\"ordinal\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`.\n *\n * 2) For a constant value in data domain (`datum`):\n * - `\"quantitative\"` if the datum is a number\n * - `\"nominal\"` if the datum is a string\n * - `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n *\n * __Note:__\n * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n * - Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n *\n * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.\n */\n type?: T;\n}\n\n/**\n * Definition object for a data field, its type and transformation of an encoding channel.\n */\nexport type TypedFieldDef<\n F extends Field,\n T extends Type = any,\n B extends Bin = boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> = FieldDefBase & TitleMixins & TypeMixins;\n\nexport interface SortableFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> extends TypedFieldDef {\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n *\n * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation.\n */\n sort?: Sort;\n}\n\nexport function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef {\n return 'sort' in fieldDef;\n}\n\nexport type ScaleFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> = SortableFieldDef & ScaleMixins;\n\nexport interface ScaleMixins {\n /**\n * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n *\n * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n *\n * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n *\n * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation.\n */\n scale?: Scale | null;\n}\n\nexport type OffsetDef =\n | ScaleFieldDef\n | ScaleDatumDef\n | ValueDef;\n\nexport interface DatumDef<\n F extends Field = string,\n V extends PrimitiveValue | DateTime | ExprRef | SignalRef = PrimitiveValue | DateTime | ExprRef | SignalRef\n> extends Partial>,\n BandMixins,\n TitleMixins {\n /**\n * A constant value in data domain.\n */\n datum?: F extends RepeatRef ? V | RepeatRef : V;\n // only apply Repeatref if field (F) can be RepeatRef\n // FIXME(https://github.com/microsoft/TypeScript/issues/37586):\n // `F extends RepeatRef` probably should be `RepeatRef extends F` but there is likely a bug in TS.\n}\n\nexport interface FormatMixins {\n /**\n * When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n *\n * - If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n * - If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n *\n * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n *\n * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n *\n * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format.\n */\n format?: string | Dict;\n\n /**\n * The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n *\n * __Default value:__\n * - `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n * - `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.\n */\n formatType?: 'number' | 'time' | string;\n}\n\nexport type StringDatumDef = DatumDef & FormatMixins;\n\nexport type ScaleDatumDef = ScaleMixins & DatumDef;\n\n/**\n * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`.\n */\nexport type SecondaryFieldDef = FieldDefBase & TitleMixins; // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef;\n\nexport type SecondaryChannelDef = Encoding['x2' | 'y2'];\n\n/**\n * Field Def without scale (and without bin: \"binned\" support).\n */\nexport type FieldDefWithoutScale = TypedFieldDef;\n\nexport type LatLongFieldDef = FieldDefBase &\n TitleMixins &\n Partial>; // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type LatLongDef = LatLongFieldDef | DatumDef;\n\nexport type PositionFieldDefBase = ScaleFieldDef<\n F,\n StandardType,\n boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> &\n PositionBaseMixins;\n\nexport type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins;\n\nexport interface PositionBaseMixins {\n /**\n * Type of stacking offset if the field should be stacked.\n * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\n * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n *\n * `stack` can be one of the following values:\n * - `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n * - `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized) and pie charts [with percentage tooltip](https://vega.github.io/vega-lite/docs/arc.html#tooltip)).
\n * -`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n *\n * __Default value:__ `zero` for plots with all of the following conditions are true:\n * (1) the mark is `bar`, `area`, or `arc`;\n * (2) the stacked measure channel (x or y) has a linear scale;\n * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n *\n * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation.\n */\n stack?: StackOffset | null | boolean;\n}\n\nexport interface BandMixins {\n /**\n * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.\n *\n * @minimum 0\n * @maximum 1\n */\n bandPosition?: number;\n}\n\nexport type PositionFieldDef = PositionFieldDefBase & PositionMixins;\n\nexport type PositionDatumDef = PositionDatumDefBase & PositionMixins;\n\nexport type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef;\n\nexport interface PositionMixins {\n /**\n * An object defining properties of axis's gridlines, ticks and labels.\n * If `null`, the axis for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n *\n * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation.\n */\n axis?: Axis | null;\n\n /**\n * An object defining the properties of the Impute Operation to be applied.\n * The field value of the other positional channel is taken as `key` of the `Impute` Operation.\n * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n *\n * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation.\n */\n impute?: ImputeParams | null;\n}\n\nexport type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef;\n\nexport function getBandPosition({\n fieldDef,\n fieldDef2,\n markDef: mark,\n config\n}: {\n fieldDef: FieldDef | DatumDef;\n fieldDef2?: SecondaryChannelDef;\n markDef: MarkDef;\n config: Config;\n}): number {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) {\n return fieldDef.bandPosition;\n }\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n if (timeUnit && !fieldDef2) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n } else if (isBinning(bin)) {\n return 0.5;\n }\n }\n\n return undefined;\n}\n\nexport function getBandSize({\n channel,\n fieldDef,\n fieldDef2,\n markDef: mark,\n config,\n scaleType,\n useVlSizeChannel\n}: {\n channel: PositionScaleChannel | PolarPositionScaleChannel;\n fieldDef: ChannelDef;\n fieldDef2?: SecondaryChannelDef;\n markDef: MarkDef;\n config: Config;\n scaleType: ScaleType;\n useVlSizeChannel?: boolean;\n}): number | RelativeBandSize | SignalRef {\n const sizeChannel = getSizeChannel(channel);\n const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, {\n vgChannel: sizeChannel\n });\n\n if (size !== undefined) {\n return size;\n }\n\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n\n if (timeUnit && !fieldDef2) {\n return {band: getMarkConfig('timeUnitBandSize', mark, config)};\n } else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) {\n return {band: 1};\n }\n }\n\n if (isRectBasedMark(mark.type)) {\n if (scaleType) {\n if (hasDiscreteDomain(scaleType)) {\n return config[mark.type]?.discreteBandSize || {band: 1};\n } else {\n return config[mark.type]?.continuousBandSize;\n }\n }\n return config[mark.type]?.discreteBandSize;\n }\n\n return undefined;\n}\n\nexport function hasBandEnd(\n fieldDef: FieldDef,\n fieldDef2: SecondaryChannelDef,\n markDef: MarkDef,\n config: Config\n): boolean {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit\n // doesn't have to use bandEnd if there is no bandPosition.\n return getBandPosition({fieldDef, fieldDef2, markDef, config}) !== undefined;\n }\n return false;\n}\n\n/**\n * Field definition of a mark property, which can contain a legend.\n */\nexport type MarkPropFieldDef = ScaleFieldDef &\n LegendMixins;\n\nexport type MarkPropDatumDef = LegendMixins & ScaleDatumDef;\n\nexport type MarkPropFieldOrDatumDef =\n | MarkPropFieldDef\n | MarkPropDatumDef;\n\nexport interface LegendMixins {\n /**\n * An object defining properties of the legend.\n * If `null`, the legend for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n *\n * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation.\n */\n legend?: Legend | null;\n}\n\n// Detail\n\n// Order Path have no scale\n\nexport type OrderFieldDef = FieldDefWithoutScale & OrderOnlyDef;\n\nexport interface OrderOnlyDef {\n /**\n * The sort order. One of `\"ascending\"` (default) or `\"descending\"`.\n */\n sort?: SortOrder;\n}\n\nexport function isOrderOnlyDef(\n orderDef: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef\n): orderDef is OrderOnlyDef {\n return orderDef && !!(orderDef as OrderOnlyDef).sort && !orderDef['field'];\n}\n\nexport type OrderValueDef = ConditionValueDefMixins & NumericValueDef;\n\nexport interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {}\n\nexport type FieldDef = SecondaryFieldDef | TypedFieldDef;\nexport type ChannelDef = Encoding[keyof Encoding];\n\nexport function isConditionalDef | GuideEncodingConditionalValueDef | ExprRef | SignalRef>(\n channelDef: CD\n): channelDef is CD & {condition: Conditional} {\n return channelDef && 'condition' in channelDef;\n}\n\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(\n channelDef: Partial>\n): channelDef is {condition: Conditional>} {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\n\nexport function hasConditionalFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is {condition: Conditional>} {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\n\nexport function hasConditionalValueDef(\n channelDef: ChannelDef\n): channelDef is ValueDef & {condition: Conditional> | Conditional>[]} {\n const condition = channelDef?.['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\n\nexport function isFieldDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\n\nexport function channelDefType(channelDef: ChannelDef): Type | undefined {\n return channelDef?.['type'];\n}\n\nexport function isDatumDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is DatumDef {\n return channelDef && 'datum' in channelDef;\n}\n\nexport function isContinuousFieldOrDatumDef(\n cd: ChannelDef\n): cd is TypedFieldDef | DatumDef {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && !isDiscrete(cd)) || isNumericDataDef(cd);\n}\n\nexport function isUnbinnedQuantitativeFieldOrDatumDef(cd: ChannelDef) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin) || isNumericDataDef(cd);\n}\n\nexport function isNumericDataDef(cd: ChannelDef): cd is DatumDef {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\n\nexport function isFieldOrDatumDef(\n channelDef: Partial>\n): channelDef is FieldDef | DatumDef {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\n\nexport function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef {\n return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\n\nexport function isValueDef(channelDef: Partial>): channelDef is ValueDef {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\n\nexport function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef {\n return channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\n\nexport function isPositionFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is PositionFieldDef | PositionDatumDef {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\n\nexport function isMarkPropFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is MarkPropFieldDef | MarkPropDatumDef {\n return channelDef && 'legend' in channelDef;\n}\n\nexport function isStringFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is StringFieldDef | StringDatumDef {\n return channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\n\nexport function toStringFieldDef(fieldDef: FieldDef): StringFieldDef {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale'] as any[]);\n}\n\nexport interface FieldRefOption {\n /** Exclude bin, aggregate, timeUnit */\n nofn?: boolean;\n /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */\n expr?: 'datum' | 'parent' | 'datum.datum';\n /** Prepend fn with custom function prefix */\n prefix?: string;\n /** Append suffix to the field ref for bin (default='start') */\n binSuffix?: 'end' | 'range' | 'mid';\n /** Append suffix to the field ref (general) */\n suffix?: string;\n /**\n * Use the field name for `as` in a transform.\n * We will not escape nested accesses because Vega transform outputs cannot be nested.\n */\n forAs?: boolean;\n}\n\nfunction isOpFieldDef(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef\n): fieldDef is WindowFieldDef | AggregatedFieldDef {\n return 'op' in fieldDef;\n}\n\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef,\n opt: FieldRefOption = {}\n): string {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n\n if (isCount(fieldDef)) {\n field = internalField('count');\n } else {\n let fn: string;\n\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n } else {\n const {bin, aggregate, timeUnit} = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n } else {\n fn = String(aggregate);\n }\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n\n if (opt.forAs) {\n return removePathFromField(field);\n } else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n } else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\n\nexport function isDiscrete(def: TypedFieldDef | DatumDef) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\n\nexport function isDiscretizing(def: TypedFieldDef | DatumDef) {\n return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type);\n}\n\nexport function isCount(fieldDef: FieldDefBase) {\n return fieldDef.aggregate === 'count';\n}\n\nexport type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string;\n\nexport function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config) {\n const {field, bin, timeUnit, aggregate} = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n } else if (isBinning(bin)) {\n return `${field} (binned)`;\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n } else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\n\nexport function functionalTitleFormatter(fieldDef: FieldDefBase) {\n const {aggregate, bin, timeUnit, field} = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n\n const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined;\n\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return `${fn.toUpperCase()}(${field})`;\n } else {\n return field;\n }\n}\n\nexport const defaultTitleFormatter: FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\n\nlet titleFormatter = defaultTitleFormatter;\n\nexport function setTitleFormatter(formatter: FieldTitleFormatter) {\n titleFormatter = formatter;\n}\n\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\n\nexport function title(\n fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef,\n config: Config,\n {allowDisabling, includeDefault = true}: {allowDisabling: boolean; includeDefault?: boolean}\n) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle ?? fieldOrDatumDef.title;\n }\n const fieldDef = fieldOrDatumDef;\n\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n } else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\n\nexport function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n } else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\n\nexport function defaultTitle(fieldDef: FieldDefBase, config: Config) {\n return titleFormatter(fieldDef, config);\n}\n\nexport function getFormatMixins(fieldDef: TypedFieldDef | DatumDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const {format, formatType} = fieldDef;\n return {format, formatType};\n } else {\n const guide = getGuide(fieldDef) ?? {};\n const {format, formatType} = guide;\n return {format, formatType};\n }\n}\n\nexport function defaultType>(fieldDef: T, channel: ExtendedChannel): Type {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n\n case 'order':\n return 'ordinal';\n }\n\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n\n const {aggregate, bin, timeUnit} = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n\n return 'nominal';\n}\n\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\n\nexport function getFieldDef(channelDef: ChannelDef): FieldDef {\n if (isFieldDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\nexport function getFieldOrDatumDef = ChannelDef>(\n channelDef: CD\n): FieldDef | DatumDef {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(\n channelDef: ChannelDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean} = {}\n): ChannelDef {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return {value: channelDef} as ValueDef;\n }\n\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) as Conditional>\n };\n }\n return channelDef;\n}\n\nexport function initFieldOrDatumDef(\n fd: FieldDef | DatumDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean}\n): FieldDef | DatumDef {\n if (isStringFieldOrDatumDef(fd)) {\n const {format, formatType, ...rest} = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n } else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const {format, formatType, ...newGuide} = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({...fd, [guideType]: newGuide}, channel, config, opt);\n }\n }\n }\n\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\n\nfunction initDatumDef(datumDef: DatumDef): DatumDef {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const {datum} = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n\n return {...datumDef, type};\n}\n\nexport function initFieldDef(\n fd: FieldDef,\n channel: ExtendedChannel,\n {compositeMark = false}: {compositeMark?: boolean} = {}\n) {\n const {aggregate, timeUnit, bin, field} = fd;\n const fieldDef = {...fd};\n\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n\n if (field) {\n fieldDef.field = `${field}`;\n }\n\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const {type} = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n } else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef as TypedFieldDef, channel);\n fieldDef['type'] = newType;\n }\n\n if (isTypedFieldDef(fieldDef)) {\n const {compatible, warning} = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const {sort} = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: {encoding: sort}\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: {encoding: sub, order: 'descending'}\n };\n }\n }\n\n if (isFacetFieldDef(fieldDef)) {\n const {header} = fieldDef;\n if (header) {\n const {orient, ...rest} = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n }\n\n return fieldDef;\n}\n\nexport function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel) {\n if (isBoolean(bin)) {\n return {maxbins: autoMaxBins(channel)};\n } else if (bin === 'binned') {\n return {\n binned: true\n };\n } else if (!bin.maxbins && !bin.step) {\n return {...bin, maxbins: autoMaxBins(channel)};\n } else {\n return bin;\n }\n}\n\nconst COMPATIBLE = {compatible: true};\nexport function channelCompatibility(\n fieldDef: TypedFieldDef,\n channel: ExtendedChannel\n): {compatible: boolean; warning?: string} {\n const type = fieldDef.type;\n\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (!isDiscrete(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n\n case SHAPE:\n case STROKEDASH:\n if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscreteOrDiscretizing(channel)\n };\n }\n return COMPATIBLE;\n\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean {\n const {formatType} = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def: FieldDef | DatumDef): boolean {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(\n v: number | string | boolean | DateTime | ExprRef | SignalRef | number[],\n {\n timeUnit,\n type,\n wrapTime,\n undefinedIfExprNotRequired\n }: {\n timeUnit: TimeUnit | TimeUnitParams;\n type?: Type;\n wrapTime?: boolean;\n undefinedIfExprNotRequired?: boolean;\n }\n): string {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n\n let expr;\n if (isExprRef(v)) {\n expr = v.expr;\n } else if (isSignalRef(v)) {\n expr = v.signal;\n } else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n } else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${stringify(v)})`;\n\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({[unit]: v});\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : stringify(v);\n}\n\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(\n fieldOrDatumDef: TypedFieldDef | DatumDef,\n values: (number | string | boolean | DateTime)[]\n) {\n const {type} = fieldOrDatumDef;\n return values.map(v => {\n const timeUnit =\n isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined;\n const expr = valueExpr(v, {\n timeUnit,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return {signal: expr};\n }\n // otherwise just return the original value\n return v;\n });\n}\n\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && ['ordinal', 'nominal'].includes((fieldDef as ScaleFieldDef).type);\n}\n","import {\n Align,\n Axis as VgAxis,\n AxisEncode,\n AxisOrient,\n BaseAxis,\n Color,\n FontStyle,\n FontWeight,\n LabelOverlap,\n SignalRef,\n TextBaseline,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {ConditionalPredicate, Value, ValueDef} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith, VgEncodeChannel} from './vega.schema';\n\nexport type BaseAxisNoValueRefs = AxisOverrideMixins &\n VLOnlyAxisMixins &\n Omit, 'labelOverlap'>;\n\ninterface AxisOverrideMixins {\n // Position and tickMinStep are not config in Vega, but are in Vega-Lite. So we just copy them here.\n\n /**\n * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n *\n * __Default value__: `0`\n */\n position?: number | ES;\n\n /**\n * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n */\n tickMinStep?: number | ES;\n\n // ---------- Properties that do not support signal / expression ----------\n /**\n * A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n *\n * __Default value:__ `true`\n */\n domain?: boolean;\n\n /**\n * A boolean flag indicating if grid lines should be included as part of the axis\n *\n * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.\n */\n grid?: boolean;\n\n /**\n * A boolean flag indicating if labels should be included as part of the axis.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.\n */\n tickExtra?: boolean;\n\n /**\n * Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n *\n * __Default value:__ `true`\n */\n tickRound?: boolean;\n\n /**\n * Boolean value that determines whether the axis should include ticks.\n *\n * __Default value:__ `true`\n */\n ticks?: boolean;\n\n // Override comments to be Vega-Lite specific\n\n /**\n * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n *\n * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.\n */\n labelFlush?: boolean | number;\n\n /**\n * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`.\n */\n labelOverlap?: LabelOverlap | ES;\n\n /**\n * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n *\n * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)\n */\n offset?: number | ES;\n\n /**\n * The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n *\n * __Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes.\n */\n orient?: AxisOrient | ES;\n\n /**\n * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n *\n * For scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n *\n * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.\n *\n * @minimum 0\n */\n tickCount?: number | TimeInterval | TimeIntervalStep | ES;\n\n /**\n * Explicitly set the visible axis tick values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | ES; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * A non-negative integer indicating the z-index of the axis.\n * If zindex is 0, axes should be drawn behind all chart elements.\n * To put them in front, set `zindex` to `1` or more.\n *\n * __Default value:__ `0` (behind the marks).\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\ninterface VLOnlyAxisMixins {\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ (none)\n * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n}\n\nexport type ConditionalAxisProp =\n | 'labelAlign'\n | 'labelBaseline'\n | 'labelColor'\n | 'labelFont'\n | 'labelFontSize'\n | 'labelFontStyle'\n | 'labelFontWeight'\n | 'labelOpacity'\n | 'labelOffset'\n | 'labelPadding'\n | 'gridColor'\n | 'gridDash'\n | 'gridDashOffset'\n | 'gridOpacity'\n | 'gridWidth'\n | 'tickColor'\n | 'tickDash'\n | 'tickDashOffset'\n | 'tickOpacity'\n | 'tickSize'\n | 'tickWidth';\n\nexport const CONDITIONAL_AXIS_PROP_INDEX: Record<\n ConditionalAxisProp,\n {\n part: keyof AxisEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null, // There is no fixed vgProp for tickSize, need to use signal.\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null, // There is no fixed vgProp for tickSize, need to use signal.\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n }\n};\n\nexport type ConditionalAxisProperty = (ValueDef | ES) & {\n condition: ConditionalPredicate | ES> | ConditionalPredicate | ES>[];\n};\n\nexport function isConditionalAxisValue(\n v: any\n): v is ConditionalAxisProperty {\n return v?.condition;\n}\n\nexport type ConditionalAxisNumber = ConditionalAxisProperty<\n number | null,\n ES\n>;\nexport type ConditionalAxisLabelAlign = ConditionalAxisProperty<\n Align | null,\n ES\n>;\nexport type ConditionalAxisLabelBaseline =\n ConditionalAxisProperty;\nexport type ConditionalAxisColor = ConditionalAxisProperty<\n Color | null,\n ES\n>;\nexport type ConditionalAxisString = ConditionalAxisProperty<\n string | null,\n ES\n>;\n\nexport type ConditionalAxisLabelFontStyle =\n ConditionalAxisProperty;\nexport type ConditionalAxisLabelFontWeight =\n ConditionalAxisProperty;\n\nexport type ConditionalAxisNumberArray = ConditionalAxisProperty<\n number[] | null,\n ES\n>;\n\n// Vega axis config is the same as Vega axis base. If this is not the case, add specific type.\nexport type AxisConfigBaseWithConditionalAndSignal = Omit<\n BaseAxisNoValueRefs,\n ConditionalAxisProp | 'title'\n> &\n AxisPropsWithCondition;\n\nexport interface AxisPropsWithCondition {\n labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign;\n labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline;\n labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor;\n labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString;\n labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber;\n labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle;\n labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight;\n labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber;\n labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber;\n labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber;\n labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber;\n gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor;\n gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray;\n gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber;\n gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber;\n gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber;\n tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor;\n tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray;\n tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber;\n tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber;\n tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber;\n tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber;\n title?: TitleMixins['title'];\n}\n\nexport type AxisConfig = Guide &\n VlOnlyGuideConfig &\n AxisConfigBaseWithConditionalAndSignal & {\n /**\n * Disable axis by default.\n */\n disable?: boolean;\n };\n\nexport interface Axis\n extends AxisConfigBaseWithConditionalAndSignal,\n Guide {\n /**\n * Mark definitions for custom axis encoding.\n *\n * @hidden\n */\n encoding?: AxisEncoding;\n}\n\nexport type AxisInternal = Axis;\n\nexport type AxisPart = keyof AxisEncoding;\nexport const AXIS_PARTS: AxisPart[] = ['domain', 'grid', 'labels', 'ticks', 'title'];\n\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE: Record = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n\n orient: 'main',\n\n bandPosition: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'both',\n tickOffset: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n tickOpacity: 'main',\n tickRound: 'both', // Apply rounding to grid and ticks so they are aligned.\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n\n encode: 'both', // we hide this in Vega-Lite\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\n\nexport interface AxisEncoding {\n /**\n * Custom encoding for the axis container.\n */\n axis?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis domain rule mark.\n */\n domain?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis gridline rule marks.\n */\n grid?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis tick rule marks.\n */\n ticks?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis title text mark.\n */\n title?: GuideEncodingEntry;\n}\n\nexport const COMMON_AXIS_PROPERTIES_INDEX: Flag)> = {\n orient: 1, // other things can depend on orient\n\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\n\nconst AXIS_PROPERTIES_INDEX: Flag> = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\n\nexport function isAxisProperty(prop: string): prop is keyof Axis {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\n\nexport interface AxisConfigMixins {\n /**\n * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config).\n */\n axis?: AxisConfig;\n\n /**\n * X-axis specific config.\n */\n axisX?: AxisConfig;\n\n /**\n * Y-axis specific config.\n */\n axisY?: AxisConfig;\n\n /**\n * Config for y-axis along the left edge of the chart.\n */\n axisLeft?: AxisConfig;\n\n /**\n * Config for y-axis along the right edge of the chart.\n */\n axisRight?: AxisConfig;\n\n /**\n * Config for x-axis along the top edge of the chart.\n */\n axisTop?: AxisConfig;\n\n /**\n * Config for x-axis along the bottom edge of the chart.\n */\n axisBottom?: AxisConfig;\n\n /**\n * Config for axes with \"band\" scales.\n */\n axisBand?: AxisConfig;\n\n /**\n * Config for axes with \"point\" scales.\n */\n axisPoint?: AxisConfig;\n\n /**\n * Config for axes with \"point\" or \"band\" scales.\n */\n axisDiscrete?: AxisConfig;\n\n /**\n * Config for quantitative axes.\n */\n axisQuantitative?: AxisConfig;\n\n /**\n * Config for temporal axes.\n */\n axisTemporal?: AxisConfig;\n\n /**\n * Config for x-axes with \"band\" scales.\n */\n axisXBand?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" scales.\n */\n axisXPoint?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" or \"band\" scales.\n */\n axisXDiscrete?: AxisConfig;\n\n /**\n * Config for x-quantitative axes.\n */\n axisXQuantitative?: AxisConfig;\n\n /**\n * Config for x-temporal axes.\n */\n axisXTemporal?: AxisConfig;\n\n /**\n * Config for y-axes with \"band\" scales.\n */\n axisYBand?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" scales.\n */\n axisYPoint?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" or \"band\" scales.\n */\n axisYDiscrete?: AxisConfig;\n\n /**\n * Config for y-quantitative axes.\n */\n axisYQuantitative?: AxisConfig;\n\n /**\n * Config for y-temporal axes.\n */\n axisYTemporal?: AxisConfig;\n}\n\nconst AXIS_CONFIGS_INDEX: Flag> = {\n axis: 1,\n axisBand: 1,\n axisBottom: 1,\n axisDiscrete: 1,\n axisLeft: 1,\n axisPoint: 1,\n axisQuantitative: 1,\n axisRight: 1,\n axisTemporal: 1,\n axisTop: 1,\n axisX: 1,\n axisXBand: 1,\n axisXDiscrete: 1,\n axisXPoint: 1,\n axisXQuantitative: 1,\n axisXTemporal: 1,\n axisY: 1,\n axisYBand: 1,\n axisYDiscrete: 1,\n axisYPoint: 1,\n axisYQuantitative: 1,\n axisYTemporal: 1\n};\n\nexport const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX);\n","import {FieldName} from '../channeldef';\nimport {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark';\nimport {Encoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport {AnyMark, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {SelectionParameter} from '../selection';\nimport {Field} from './../channeldef';\nimport {BaseSpec, DataMixins, FrameMixins, GenericCompositionLayout, ResolveMixins} from './base';\nimport {TopLevel, TopLevelParameter} from './toplevel';\n/**\n * Base interface for a unit (single-view) specification.\n */\nexport interface GenericUnitSpec, M, P = SelectionParameter> extends BaseSpec {\n /**\n * A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n */\n mark: M;\n\n /**\n * A key-value mapping between encoding channels and definition of fields.\n */\n encoding?: E;\n\n /**\n * An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\n * and to `latitude` and `\"longitude\"` channels for other marks.\n */\n projection?: Projection;\n\n /**\n * An array of parameters that may either be simple variables, or more complex selections that map user input to data queries.\n */\n params?: P[];\n}\n\n/**\n * A unit specification without any shortcut/expansion syntax.\n */\nexport type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>;\n\n/**\n * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types).\n */\nexport type UnitSpec = GenericUnitSpec, AnyMark>;\n\nexport type UnitSpecWithFrame = GenericUnitSpec, AnyMark> & FrameMixins;\n\n/**\n * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec).\n */\nexport type FacetedUnitSpec = GenericUnitSpec<\n FacetedCompositeEncoding,\n AnyMark,\n P\n> &\n ResolveMixins &\n GenericCompositionLayout &\n FrameMixins;\n\nexport type TopLevelUnitSpec = TopLevel> & DataMixins;\n\nexport function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec {\n return 'mark' in spec;\n}\n","import {Encoding} from '../encoding';\nimport {GenericMarkDef, getMarkType} from '../mark';\nimport {NonFacetUnitNormalizer, Normalize, NormalizerParams} from '../normalize/base';\nimport {GenericSpec} from '../spec';\nimport {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {FieldName} from '../channeldef';\n\n// TODO: replace string with Mark\nexport type CompositeMarkUnitSpec = GenericUnitSpec>;\n\nexport class CompositeMarkNormalizer implements NonFacetUnitNormalizer> {\n constructor(\n public name: string,\n public run: (\n spec: CompositeMarkUnitSpec,\n params: NormalizerParams,\n normalize: Normalize<\n // Input of the normalize method\n GenericUnitSpec, M> | GenericLayerSpec,\n // Output of the normalize method\n NormalizedLayerSpec | NormalizedUnitSpec\n >\n ) => NormalizedLayerSpec | NormalizedUnitSpec\n ) {}\n\n public hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {isArgmaxDef, isArgminDef} from './aggregate';\nimport {isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n CHANNELS,\n COLOR,\n DESCRIPTION,\n DETAIL,\n FILL,\n FILLOPACITY,\n getMainChannelFromOffsetChannel,\n getOffsetScaleChannel,\n HREF,\n isChannel,\n isNonPositionScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n isXorYOffset,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n supportMark,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n UNIT_CHANNELS,\n URL,\n X,\n X2,\n XOFFSET,\n Y,\n Y2,\n YOFFSET\n} from './channel';\nimport {\n binRequiresRange,\n ChannelDef,\n ColorDef,\n Field,\n FieldDef,\n FieldDefWithoutScale,\n getFieldDef,\n getGuide,\n hasConditionalFieldDef,\n hasConditionalFieldOrDatumDef,\n initChannelDef,\n initFieldDef,\n isConditionalDef,\n isDatumDef,\n isFieldDef,\n isOrderOnlyDef,\n isTypedFieldDef,\n isValueDef,\n LatLongDef,\n NumericArrayMarkPropDef,\n NumericMarkPropDef,\n OffsetDef,\n OrderFieldDef,\n OrderOnlyDef,\n OrderValueDef,\n PolarDef,\n Position2Def,\n PositionDef,\n SecondaryFieldDef,\n ShapeDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition,\n TextDef,\n title,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {Config} from './config';\nimport * as log from './log';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {AggregatedFieldDef, BinTransform, TimeUnitTransform} from './transform';\nimport {isContinuous, isDiscrete, QUANTITATIVE, TEMPORAL} from './type';\nimport {keys, some} from './util';\nimport {isSignalRef} from './vega.schema';\nimport {isBinnedTimeUnit} from './timeunit';\n\nexport interface Encoding {\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: PositionDef;\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: PositionDef;\n\n /**\n * Offset of x-position of the marks\n */\n xOffset?: OffsetDef;\n\n /**\n * Offset of y-position of the marks\n */\n yOffset?: OffsetDef;\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n // TODO: Ham need to add default behavior\n // `x2` cannot have type as it should have the same type as `x`\n x2?: Position2Def;\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n // TODO: Ham need to add default behavior\n // `y2` cannot have type as it should have the same type as `y`\n y2?: Position2Def;\n\n /**\n * Longitude position of geographically projected marks.\n */\n longitude?: LatLongDef;\n\n /**\n * Latitude position of geographically projected marks.\n */\n latitude?: LatLongDef;\n\n /**\n * Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `longitude2` cannot have type as it should have the same type as `longitude`\n longitude2?: Position2Def;\n\n /**\n * Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `latitude2` cannot have type as it should have the same type as `latitude`\n latitude2?: Position2Def;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n */\n theta?: PolarDef;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: Position2Def;\n\n /**\n * The outer radius in pixels of arc marks.\n */\n\n radius?: PolarDef;\n\n /**\n * The inner radius in pixels of arc marks.\n */\n radius2?: Position2Def;\n\n /**\n * Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\n * By default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n * `\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n *\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_\n * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme).\n */\n color?: ColorDef;\n\n /**\n * Fill color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n fill?: ColorDef;\n\n /**\n * Stroke color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n\n stroke?: ColorDef;\n\n /**\n * Opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property.\n */\n opacity?: NumericMarkPropDef;\n\n /**\n * Fill opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property.\n */\n fillOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property.\n */\n strokeOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke width of the marks.\n *\n * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property.\n */\n strokeWidth?: NumericMarkPropDef;\n\n /**\n * Stroke dash of the marks.\n *\n * __Default value:__ `[1,0]` (No dash).\n */\n strokeDash?: NumericArrayMarkPropDef;\n\n /**\n * Size of the mark.\n * - For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n * - For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n * - For `\"text\"` – the text's font size.\n * - Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)\n */\n size?: NumericMarkPropDef;\n\n /**\n * Rotation angle of point and text marks.\n */\n angle?: NumericMarkPropDef;\n\n /**\n * Shape of the mark.\n *\n * 1. For `point` marks the supported values include:\n * - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n * - the line symbol `\"stroke\"`\n * - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n *\n * 2. For `geoshape` marks it should be a field definition of the geojson data\n *\n * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)\n */\n shape?: ShapeDef;\n /**\n * Additional levels of detail for grouping data in aggregate views and\n * in line, trail, and area marks without mapping data to a specific visual channel.\n */\n detail?: FieldDefWithoutScale | FieldDefWithoutScale[];\n\n /**\n * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.\n */\n key?: FieldDefWithoutScale;\n\n /**\n * Text of the `text` mark.\n */\n text?: TextDef;\n\n /**\n * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n */\n tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null;\n\n /**\n * A URL to load upon mouse click.\n */\n href?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * The URL of an image mark.\n */\n url?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description.\n */\n description?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * Order of the marks.\n * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n * - Otherwise, this `order` channel encodes layer order of the marks.\n *\n * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping.\n */\n order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef;\n}\n\nexport interface EncodingWithFacet extends Encoding, EncodingFacetMapping {}\n\nexport function channelHasField(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\n\nexport function channelHasFieldOrDatum(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef);\n }\n }\n return false;\n}\n\nexport function channelHasNestedOffsetScale(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n if (isXorY(channel)) {\n const fieldDef = encoding[channel];\n if (\n (isFieldDef(fieldDef) || isDatumDef(fieldDef)) &&\n (isDiscrete(fieldDef.type) || (isFieldDef(fieldDef) && fieldDef.timeUnit))\n ) {\n const offsetChannel = getOffsetScaleChannel(channel);\n return channelHasFieldOrDatum(encoding, offsetChannel);\n }\n }\n return false;\n}\n\nexport function isAggregate(encoding: EncodingWithFacet) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n } else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\n\nexport function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config) {\n const groupby: string[] = [];\n const bins: BinTransform[] = [];\n const timeUnits: TimeUnitTransform[] = [];\n const aggregate: AggregatedFieldDef[] = [];\n const encoding: Encoding = {};\n\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const {field, aggregate: aggOp, bin, timeUnit, ...remaining} = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide?.title;\n let newField = vgField(channelDef, {forAs: true});\n const newFieldDef: FieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : {title: title(channelDef, config, {allowDisabling: true})}),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n\n if (aggOp) {\n let op: AggregateOp;\n\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({op: 'argmax', field: aggOp.argmax}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({op: 'argmin', field: aggOp.argmin}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n\n if (op) {\n const aggregateEntry: AggregatedFieldDef = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n } else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({bin, field, as: newField});\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, {binSuffix: 'end'}));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, {binSuffix: 'range'}));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel: SecondaryFieldDef = {\n field: `${newField}_end`\n };\n encoding[`${channel}2`] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n } else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n } else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n\n // now the field should refer to post-transformed field instead\n encoding[channel as any] = newFieldDef;\n } else {\n groupby.push(field);\n encoding[channel as any] = oldEncoding[channel];\n }\n } else {\n // For value def / signal ref / datum def, just copy\n encoding[channel as any] = oldEncoding[channel];\n }\n });\n\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\n\nexport function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n } else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n}\n\nexport function initEncoding(\n encoding: Encoding,\n mark: Mark,\n filled: boolean,\n config: Config\n): Encoding {\n const normalizedEncoding: Encoding = {};\n for (const key of keys(encoding)) {\n if (!isChannel(key)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(key));\n }\n }\n\n for (let channel of UNIT_CHANNELS) {\n if (!encoding[channel]) {\n continue;\n }\n\n const channelDef = encoding[channel];\n if (isXorYOffset(channel)) {\n const mainChannel = getMainChannelFromOffsetChannel(channel);\n\n const positionDef = normalizedEncoding[mainChannel];\n if (isFieldDef(positionDef)) {\n if (isContinuous(positionDef.type)) {\n if (isFieldDef(channelDef) && !positionDef.timeUnit) {\n // TODO: nesting continuous field instead continuous field should\n // behave like offsetting the data in data domain\n log.warn(log.message.offsetNestedInsideContinuousPositionScaleDropped(mainChannel));\n continue;\n }\n }\n }\n }\n\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n continue;\n }\n\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n continue;\n }\n }\n // Drop color if either fill or stroke is specified\n\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', {fill: 'fill' in encoding, stroke: 'stroke' in encoding}));\n continue;\n }\n\n if (\n channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))\n ) {\n if (channelDef) {\n if (channel === ORDER) {\n const def = encoding[channel];\n if (isOrderOnlyDef(def)) {\n normalizedEncoding[channel] = def;\n continue;\n }\n }\n // Array of fieldDefs for detail channel (or production rule)\n (normalizedEncoding[channel] as any) = array(channelDef).reduce(\n (defs: FieldDef[], fieldDef: FieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n } else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n },\n []\n );\n }\n } else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n } else if (\n !isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)\n ) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n continue;\n }\n\n normalizedEncoding[channel as any] = initChannelDef(channelDef as ChannelDef, channel, config);\n }\n }\n return normalizedEncoding;\n}\n\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding: Encoding, config: Config): Encoding {\n const normalizedEncoding: Encoding = {};\n\n for (const channel of keys(encoding)) {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, {compositeMark: true});\n normalizedEncoding[channel as any] = newChannelDef;\n }\n\n return normalizedEncoding;\n}\n\nexport function fieldDefs(encoding: EncodingWithFacet): FieldDef[] {\n const arr: FieldDef[] = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n } else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\n\nexport function forEach>(\n mapping: U,\n f: (cd: ChannelDef, c: keyof U) => void,\n thisArg?: any\n) {\n if (!mapping) {\n return;\n }\n\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el as unknown[]) {\n f.call(thisArg, channelDef, channel);\n }\n } else {\n f.call(thisArg, el, channel);\n }\n }\n}\n\nexport function reduce>(\n mapping: U,\n f: (acc: any, fd: TypedFieldDef, c: keyof U) => U,\n init: T,\n thisArg?: any\n) {\n if (!mapping) {\n return init;\n }\n\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1: T, channelDef: ChannelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n } else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark: Mark, encoding: Encoding): string[] {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case XOFFSET:\n case YOFFSET:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n","import {Orientation, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isString} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from '.';\nimport {\n Field,\n FieldDefBase,\n isContinuousFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n PositionFieldDef,\n SecondaryFieldDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition\n} from '../channeldef';\nimport {Encoding, fieldDefs} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {ColorMixins, GenericMarkDef, isMarkDef, Mark, AnyMarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {getFirstDefined, hash, unique} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {toStringFieldDef} from './../channeldef';\n\n// Parts mixins can be any mark type. We could make a more specific type for each part.\nexport type PartsMixins

= Partial>>;\n\nexport type GenericCompositeMarkDef = GenericMarkDef &\n ColorMixins & {\n /**\n * The opacity (value between [0,1]) of the mark.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number;\n\n /**\n * Whether a composite mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n };\n\nexport interface CompositeMarkTooltipSummary {\n /**\n * The prefix of the field to be shown in tooltip\n */\n fieldPrefix: string;\n\n /**\n * The title prefix to show, corresponding to the field with field prefix `fieldPrefix`\n */\n titlePrefix: Text | SignalRef;\n}\n\nexport function filterTooltipWithAggregatedField(\n oldEncoding: Encoding\n): {\n customTooltipWithoutAggregatedField?:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n filteredEncoding: Encoding;\n} {\n const {tooltip, ...filteredEncoding} = oldEncoding;\n if (!tooltip) {\n return {filteredEncoding};\n }\n\n let customTooltipWithAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n let customTooltipWithoutAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n (customTooltipWithAggregatedField as StringFieldDef[]).push(t);\n } else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n (customTooltipWithoutAggregatedField as StringFieldDef[]).push(t);\n }\n }\n\n if (customTooltipWithAggregatedField) {\n (filteredEncoding as Encoding).tooltip = customTooltipWithAggregatedField;\n }\n } else {\n if (tooltip['aggregate']) {\n (filteredEncoding as Encoding).tooltip = tooltip;\n } else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return {customTooltipWithoutAggregatedField, filteredEncoding};\n}\n\nexport function getCompositeMarkTooltip(\n tooltipSummary: CompositeMarkTooltipSummary[],\n continuousAxisChannelDef: PositionFieldDef,\n encodingWithoutContinuousAxis: Encoding,\n withFieldName = true\n): Encoding {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return {tooltip: encodingWithoutContinuousAxis.tooltip};\n }\n\n const fiveSummaryTooltip: StringFieldDef[] = tooltipSummary.map(\n ({fieldPrefix, titlePrefix}): StringFieldDef => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? {signal: `${titlePrefix}\"${escape(mainTitle)}\"`} : titlePrefix + mainTitle\n };\n }\n );\n\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\n\nexport function getTitle(continuousAxisChannelDef: PositionFieldDef) {\n const {title, field} = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\n\nexport function makeCompositeAggregatePartFactory

>(\n compositeMarkDef: GenericCompositeMarkDef & P,\n continuousAxis: 'x' | 'y',\n continuousAxisChannelDef: PositionFieldDef,\n sharedEncoding: Encoding,\n compositeMarkConfig: P\n) {\n const {scale, axis} = continuousAxisChannelDef;\n\n return ({\n partName,\n mark,\n positionPrefix,\n endPositionPrefix = undefined,\n extraEncoding = {}\n }: {\n partName: keyof P;\n mark: Mark | MarkDef;\n positionPrefix: string;\n endPositionPrefix?: string;\n extraEncoding?: Encoding;\n }) => {\n const title = getTitle(continuousAxisChannelDef);\n\n return partLayerMixins

(compositeMarkDef, partName, compositeMarkConfig, {\n mark, // TODO better remove this method and just have mark as a parameter of the method\n encoding: {\n [continuousAxis]: {\n field: `${positionPrefix}_${continuousAxisChannelDef.field}`,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n ...(axis !== undefined ? {axis} : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [`${continuousAxis}2`]: {\n field: `${endPositionPrefix}_${continuousAxisChannelDef.field}`\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\n\nexport function partLayerMixins

>(\n markDef: GenericCompositeMarkDef & P,\n part: keyof P,\n compositeMarkConfig: P,\n partBaseSpec: NormalizedUnitSpec\n): NormalizedUnitSpec[] {\n const {clip, color, opacity} = markDef;\n\n const mark = markDef.type;\n\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...(compositeMarkConfig[part] as AnyMarkConfig),\n ...(clip ? {clip} : {}),\n ...(color ? {color} : {}),\n ...(opacity ? {opacity} : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}),\n style: `${mark}-${String(part)}`,\n ...(isBoolean(markDef[part]) ? {} : (markDef[part] as AnyMarkConfig))\n }\n }\n ];\n }\n return [];\n}\n\nexport function compositeMarkContinuousAxis(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n orient: Orientation,\n compositeMark: M\n): {\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxisChannelDef2: SecondaryFieldDef;\n continuousAxisChannelDefError: SecondaryFieldDef;\n continuousAxisChannelDefError2: SecondaryFieldDef;\n continuousAxis: 'x' | 'y';\n} {\n const {encoding} = spec;\n const continuousAxis: 'x' | 'y' = orient === 'vertical' ? 'y' : 'x';\n\n const continuousAxisChannelDef = encoding[continuousAxis] as PositionFieldDef; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`] as SecondaryFieldDef;\n const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`] as SecondaryFieldDef;\n const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`] as SecondaryFieldDef;\n\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\n\nfunction filterAggregateFromChannelDef>(\n continuousAxisChannelDef: F,\n compositeMark: M\n): F {\n if (continuousAxisChannelDef?.aggregate) {\n const {aggregate, ...continuousAxisWithoutAggregate} = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate as F;\n } else {\n return continuousAxisChannelDef;\n }\n}\n\nexport function compositeMarkOrient(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n compositeMark: M\n): Orientation {\n const {mark, encoding} = spec;\n const {x, y} = encoding;\n\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n } else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n } else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n } else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n\n // default orientation for two continuous\n return 'vertical';\n }\n }\n\n return 'horizontal';\n } else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n } else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n","import {Orientation} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {getMarkPropOrConfig} from '../compile/common';\nimport {Config} from '../config';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef, MarkInvalidMixins} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec';\nimport {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform';\nimport {isEmpty, omit} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n filterTooltipWithAggregatedField,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n getTitle,\n makeCompositeAggregatePartFactory,\n partLayerMixins,\n PartsMixins\n} from './common';\n\nexport const BOXPLOT = 'boxplot' as const;\nexport type BoxPlot = typeof BOXPLOT;\n\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'] as const;\n\ntype BoxPlotPart = (typeof BOXPLOT_PARTS)[number];\n\nexport type BoxPlotPartsMixins = PartsMixins;\n\nexport interface BoxPlotConfig extends BoxPlotPartsMixins {\n /** Size of the box and median tick of a box plot */\n size?: number;\n\n /**\n * The extent of the whiskers. Available options include:\n * - `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n *\n * __Default value:__ `1.5`.\n */\n extent?: 'min-max' | number;\n}\n\nexport type BoxPlotDef = GenericCompositeMarkDef &\n BoxPlotConfig &\n MarkInvalidMixins & {\n /**\n * Type of the mark. For box plots, this should always be `\"boxplot\"`.\n * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html)\n */\n type: BoxPlot;\n\n /**\n * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous.\n *\n * __Default value:__ `\"vertical\"`.\n */\n orient?: Orientation;\n };\n\nexport interface BoxPlotConfigMixins {\n /**\n * Box Config\n */\n boxplot?: BoxPlotConfig;\n}\n\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\n\nexport function getBoxPlotType(extent: number | 'min-max') {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\n\nexport function normalizeBoxPlot(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const {mark, encoding: _encoding, params, projection: _p, ...outerSpec} = spec;\n const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark};\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig(\n 'size',\n markDef as any, // TODO: https://github.com/vega/vega-lite/issues/6245\n config\n );\n\n const invalid = markDef.invalid;\n\n const boxPlotType = getBoxPlotType(extent);\n const {\n bins,\n timeUnits,\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n groupby,\n aggregate,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n } = boxParams(spec, extent, config);\n\n const {color, size, ...encodingWithoutSizeColorAndContinuousAxis} = encodingWithoutContinuousAxis;\n\n const makeBoxPlotPart = (sharedEncoding: Encoding) => {\n return makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n sharedEncoding,\n config.boxplot\n );\n };\n\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({...encodingWithoutSizeColorAndContinuousAxis, ...(size ? {size} : {})});\n\n const fiveSummaryTooltipEncoding: Encoding = getCompositeMarkTooltip(\n [\n {fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max'},\n {fieldPrefix: 'upper_box_', titlePrefix: 'Q3'},\n {fieldPrefix: 'mid_box_', titlePrefix: 'Median'},\n {fieldPrefix: 'lower_box_', titlePrefix: 'Q1'},\n {fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n // ## Whisker Layers\n\n const endTick: MarkDef = {type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid, aria: false};\n const whiskerTooltipEncoding: Encoding =\n boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip(\n [\n {fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker'},\n {fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid, aria: false},\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid, aria: false},\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n\n // ## Box Layers\n\n // TODO: support hiding certain mark parts\n const boxLayers: NormalizedUnitSpec[] = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: boxOrient,\n invalid,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? {color: config.boxplot.median.color} : {}),\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n\n if (boxPlotType === 'min-max') {\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n }\n\n // Tukey Box Plot\n\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n\n const joinaggregateTransform: JoinAggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n\n const filteredWhiskerSpec: NormalizedLayerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: `lower_whisker_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: `upper_whisker_${continuousAxisChannelDef.field}`\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: `lower_box_${continuousAxisChannelDef.field}`,\n as: `lower_box_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: `upper_box_${continuousAxisChannelDef.field}`,\n as: `upper_box_${continuousAxisChannelDef.field}`\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n\n const {tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip} = encodingWithoutSizeColorAndContinuousAxis;\n\n const {scale, axis} = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})`}],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : {axis: axisWithoutTitle})\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(color ? {color} : {}),\n ...(customTooltipWithoutAggregatedField ? {tooltip: customTooltipWithoutAggregatedField} : {})\n }\n })[0];\n\n let filteredLayersMixins: NormalizedLayerSpec;\n const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform];\n if (outlierLayersMixins) {\n filteredLayersMixins = {\n transform: filteredLayersMixinsTransforms,\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n } else {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms);\n }\n\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n}\n\nfunction boxParamsQuartiles(continousAxisField: string): AggregatedFieldDef[] {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: `lower_box_${continousAxisField}`\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: `upper_box_${continousAxisField}`\n }\n ];\n}\n\nfunction boxParams(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n extent: 'min-max' | number,\n config: Config\n) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const {continuousAxisChannelDef, continuousAxis} = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n const boxPlotType = getBoxPlotType(extent);\n\n const boxplotSpecificAggregate: AggregatedFieldDef[] = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: `mid_box_${continuousFieldName}`\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n\n const postAggregateCalculates: CalculateTransform[] =\n boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: `iqr_${continuousFieldName}`\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: `upper_whisker_${continuousFieldName}`\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: `lower_whisker_${continuousFieldName}`\n }\n ];\n\n const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding;\n const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField(\n oldEncodingWithoutContinuousAxis\n );\n\n const {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(filteredEncoding, config);\n\n const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient: Orientation = orient;\n\n const transform: Transform[] = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n\n return {\n bins,\n timeUnits,\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n","import {AggregateOp, Orientation, SignalRef, Text} from 'vega';\nimport {PositionChannel} from '../channel';\nimport {\n Field,\n isContinuousFieldOrDatumDef,\n isFieldOrDatumDef,\n PositionFieldDef,\n SecondaryFieldDef,\n title,\n ValueDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {Data} from '../data';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {Step} from '../spec/base';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {TitleParams} from '../title';\nimport {AggregatedFieldDef, CalculateTransform, Transform} from '../transform';\nimport {replaceAll, titleCase} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n CompositeMarkTooltipSummary,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n makeCompositeAggregatePartFactory,\n PartsMixins\n} from './common';\nimport {ErrorBand, ErrorBandDef} from './errorband';\n\nexport const ERRORBAR = 'errorbar' as const;\nexport type ErrorBar = typeof ERRORBAR;\n\nexport type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev';\nexport type ErrorBarCenter = 'mean' | 'median';\n\nexport type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error';\n\nexport const ERRORBAR_PARTS = ['ticks', 'rule'] as const;\n\nexport type ErrorBarPart = (typeof ERRORBAR_PARTS)[number];\n\nexport interface ErrorExtraEncoding {\n /**\n * Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n xError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `xError2` cannot have type as it should have the same type as `xError`\n xError2?: SecondaryFieldDef | ValueDef;\n\n /**\n * Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n yError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `yError2` cannot have type as it should have the same type as `yError`\n yError2?: SecondaryFieldDef | ValueDef;\n}\n\nexport type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> &\n ErrorExtraEncoding;\n\nexport type ErrorBarPartsMixins = PartsMixins;\n\nexport interface ErrorBarConfig extends ErrorBarPartsMixins {\n /** Size of the ticks of an error bar */\n size?: number;\n\n /** Thickness of the ticks and the bar of an error bar */\n thickness?: number;\n\n /**\n * The center of the errorbar. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the rule. Available options include:\n * - `\"ci\"`: Extend the rule to the confidence interval of the mean.\n * - `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the rule to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n}\n\nexport type ErrorBarDef = GenericCompositeMarkDef &\n ErrorBarConfig & {\n /**\n * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBarConfigMixins {\n /**\n * ErrorBar Config\n */\n errorbar?: ErrorBarConfig;\n}\n\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\n\nexport function normalizeErrorBar(\n spec: GenericUnitSpec, ErrorBar | ErrorBarDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec | NormalizedUnitSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAR, config);\n delete encodingWithoutContinuousAxis['size'];\n\n const makeErrorBarPart = makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorbar\n );\n\n const thickness = markDef.thickness;\n const size = markDef.size;\n const tick: MarkDef = {\n type: 'tick',\n orient: ticksOrient,\n aria: false,\n ...(thickness !== undefined ? {thickness} : {}),\n ...(size !== undefined ? {size} : {})\n };\n\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar',\n ...(thickness !== undefined ? {size: thickness} : {})\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? {layer} : {...layer[0]})\n };\n}\n\nfunction errorBarOrientAndInputType(\n spec: GenericUnitSpec, ErrorBar | ErrorBand | ErrorBarDef | ErrorBandDef>,\n compositeMark: ErrorBar | ErrorBand\n): {\n orient: Orientation;\n inputType: ErrorInputType;\n} {\n const {encoding} = spec;\n\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n\n const isTypeAggregatedUpperLower: boolean = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError: boolean = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n } else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return {orient: 'horizontal', inputType: 'aggregated-upper-lower'};\n } else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n } else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return {orient: 'vertical', inputType: 'aggregated-upper-lower'};\n } else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n } else {\n // type is aggregated-error\n\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n } else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return {orient: 'horizontal', inputType: 'aggregated-error'};\n } else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n } else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return {orient: 'vertical', inputType: 'aggregated-error'};\n } else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\n\nfunction errorBarIsInputTypeRaw(encoding: ErrorEncoding): boolean {\n return (\n (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding: ErrorEncoding): boolean {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\n\nfunction errorBarIsInputTypeAggregatedError(encoding: ErrorEncoding): boolean {\n return (\n isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nexport function errorBarParams<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n spec: GenericUnitSpec, M | MD>,\n compositeMark: M,\n config: Config\n): {\n transform: Transform[];\n groupby: string[];\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxis: 'x' | 'y';\n encodingWithoutContinuousAxis: ErrorEncoding;\n ticksOrient: Orientation;\n markDef: MD;\n outerSpec: {\n data?: Data;\n title?: Text | TitleParams;\n name?: string;\n description?: string;\n transform?: Transform[];\n width?: number | 'container' | Step;\n height?: number | 'container' | Step;\n };\n tooltipEncoding: ErrorEncoding;\n} {\n // TODO: use selection\n const {mark, encoding, params, projection: _p, ...outerSpec} = spec;\n const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD);\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n\n const {orient, inputType} = errorBarOrientAndInputType(spec, compositeMark);\n const {\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n continuousAxis\n } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n\n const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} =\n errorBarAggregationAndCalculation(\n markDef,\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n inputType,\n compositeMark,\n config\n );\n\n const {\n [continuousAxis]: oldContinuousAxisChannelDef,\n [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2,\n [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError,\n [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2,\n ...oldEncodingWithoutContinuousAxis\n } = encoding;\n\n const {\n bins,\n timeUnits,\n aggregate: oldAggregate,\n groupby: oldGroupBy,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n\n const aggregate: AggregatedFieldDef[] = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby: string[] = inputType !== 'raw' ? [] : oldGroupBy;\n\n const tooltipEncoding: ErrorEncoding = getCompositeMarkTooltip(\n tooltipSummary,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n tooltipTitleWithFieldName\n );\n\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{aggregate, groupby}]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\n\nfunction errorBarAggregationAndCalculation<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n markDef: MD,\n continuousAxisChannelDef: PositionFieldDef,\n continuousAxisChannelDef2: SecondaryFieldDef,\n continuousAxisChannelDefError: SecondaryFieldDef,\n continuousAxisChannelDefError2: SecondaryFieldDef,\n inputType: ErrorInputType,\n compositeMark: M,\n config: Config\n): {\n postAggregateCalculates: CalculateTransform[];\n errorBarSpecificAggregate: AggregatedFieldDef[];\n tooltipSummary: CompositeMarkTooltipSummary[];\n tooltipTitleWithFieldName: boolean;\n} {\n let errorBarSpecificAggregate: AggregatedFieldDef[] = [];\n let postAggregateCalculates: CalculateTransform[] = [];\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n let tooltipSummary: CompositeMarkTooltipSummary[];\n let tooltipTitleWithFieldName = false;\n\n if (inputType === 'raw') {\n const center: ErrorBarCenter = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent: ErrorBarExtent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n {op: extent, field: continuousFieldName, as: `extent_${continuousFieldName}`},\n {op: center, field: continuousFieldName, as: `center_${continuousFieldName}`}\n ];\n\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: `upper_${continuousFieldName}`\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: `lower_${continuousFieldName}`\n }\n ];\n\n tooltipSummary = [\n {fieldPrefix: 'center_', titlePrefix: titleCase(center)},\n {fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+')},\n {fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-')}\n ];\n tooltipTitleWithFieldName = true;\n } else {\n let centerOp: AggregateOp;\n let lowerExtentOp: AggregateOp;\n let upperExtentOp: AggregateOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n } else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n\n errorBarSpecificAggregate = [\n {op: lowerExtentOp, field: continuousFieldName, as: `lower_${continuousFieldName}`},\n {op: upperExtentOp, field: continuousFieldName, as: `upper_${continuousFieldName}`},\n {op: centerOp, field: continuousFieldName, as: `center_${continuousFieldName}`}\n ];\n\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({field: continuousFieldName, aggregate: centerOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n }\n ];\n }\n } else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n {calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: `upper_${continuousFieldName}`},\n {calculate: `datum[\"${continuousFieldName}\"]`, as: `lower_${continuousFieldName}`}\n ];\n } else if (inputType === 'aggregated-error') {\n tooltipSummary = [{fieldPrefix: '', titlePrefix: continuousFieldName}];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `upper_${continuousFieldName}`\n }\n ];\n\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n } else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n }\n\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return {postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName};\n}\n\nfunction getTitlePrefix(center: ErrorBarCenter, extent: ErrorBarExtent, operation: '+' | '-'): string {\n return `${titleCase(center)} ${operation} ${extent}`;\n}\n","import {Interpolate, Orientation} from 'vega';\nimport {Field} from '../channeldef';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {CompositeMarkNormalizer} from './base';\nimport {GenericCompositeMarkDef, makeCompositeAggregatePartFactory, PartsMixins} from './common';\nimport {ErrorBarCenter, ErrorBarExtent, errorBarParams, ErrorEncoding} from './errorbar';\n\nexport type ErrorBandUnitSpec<\n EE = undefined // extra encoding parameter (for faceted composite unit spec)\n> = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>;\n\nexport const ERRORBAND = 'errorband' as const;\nexport type ErrorBand = typeof ERRORBAND;\n\nexport const ERRORBAND_PARTS = ['band', 'borders'] as const;\n\ntype ErrorBandPart = (typeof ERRORBAND_PARTS)[number];\n\nexport type ErrorBandPartsMixins = PartsMixins;\n\nexport interface ErrorBandConfig extends ErrorBandPartsMixins {\n /**\n * The center of the error band. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the band. Available options include:\n * - `\"ci\"`: Extend the band to the confidence interval of the mean.\n * - `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the band to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n\n /**\n * The line interpolation method for the error band. One of the following:\n * - `\"linear\"`: piecewise linear segments, as in a polyline.\n * - `\"linear-closed\"`: close the linear segments to form a polygon.\n * - `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n * - `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n * - `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n * - `\"basis\"`: a B-spline, with control point duplication on the ends.\n * - `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n * - `\"basis-closed\"`: a closed B-spline, as in a loop.\n * - `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n * - `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n * - `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n * - `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n * - `\"monotone\"`: cubic interpolation that preserves monotonicity in y.\n */\n interpolate?: Interpolate;\n\n /**\n * The tension parameter for the interpolation type of the error band.\n *\n * @minimum 0\n * @maximum 1\n */\n tension?: number;\n}\n\nexport type ErrorBandDef = GenericCompositeMarkDef &\n ErrorBandConfig & {\n /**\n * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBandConfigMixins {\n /**\n * ErrorBand Config\n */\n errorband?: ErrorBandConfig;\n}\n\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\n\nexport function normalizeErrorBand(\n spec: GenericUnitSpec, ErrorBand | ErrorBandDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef: ErrorBandDef = markDef;\n\n const makeErrorBandPart = makeCompositeAggregatePartFactory(\n errorBandDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorband\n );\n\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n\n let bandMark: MarkDef = {type: is2D ? 'area' : 'rect'};\n let bordersMark: MarkDef = {type: is2D ? 'line' : 'rule'};\n const interpolate = {\n ...(errorBandDef.interpolate ? {interpolate: errorBandDef.interpolate} : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? {tension: errorBandDef.tension} : {})\n };\n\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n } else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n } else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n","import {Field} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {EncodingFacetMapping} from '../spec/facet';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {keys} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {BOXPLOT, BoxPlot, BoxPlotConfigMixins, BoxPlotDef, BOXPLOT_PARTS, normalizeBoxPlot} from './boxplot';\nimport {\n ERRORBAND,\n ErrorBand,\n ErrorBandConfigMixins,\n ErrorBandDef,\n ERRORBAND_PARTS,\n normalizeErrorBand\n} from './errorband';\nimport {\n ERRORBAR,\n ErrorBar,\n ErrorBarConfigMixins,\n ErrorBarDef,\n ERRORBAR_PARTS,\n ErrorExtraEncoding,\n normalizeErrorBar\n} from './errorbar';\n\nexport type {BoxPlotConfig} from './boxplot';\nexport type {ErrorBandConfigMixins} from './errorband';\nexport type {ErrorBarConfigMixins} from './errorbar';\n\nexport type CompositeMarkNormalizerRun = (\n spec: GenericUnitSpec,\n params: NormalizerParams\n) => NormalizedLayerSpec | NormalizedUnitSpec;\n\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry: {\n [mark: string]: {\n normalizer: CompositeMarkNormalizer;\n parts: readonly string[];\n };\n} = {};\n\nexport function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = {normalizer, parts};\n}\n\nexport function remove(mark: string) {\n delete compositeMarkRegistry[mark];\n}\n\nexport type CompositeEncoding = Encoding & ErrorExtraEncoding;\n\nexport type PartialIndex> = {\n [t in keyof T]?: Partial;\n};\n\nexport type SharedCompositeEncoding = PartialIndex<\n Omit, 'detail' | 'order' | 'tooltip'> // need to omit and cherry pick detail / order / tooltip since they allow array\n> &\n Pick, 'detail' | 'order' | 'tooltip'>;\n\nexport type FacetedCompositeEncoding = Encoding & ErrorExtraEncoding & EncodingFacetMapping;\n\nexport type CompositeMark = BoxPlot | ErrorBar | ErrorBand;\n\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\n\nexport type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef;\n\nexport type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand;\n\nexport interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins {}\n\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n","import {SignalRef, Text} from 'vega';\nimport {ConditionValueDefMixins, FormatMixins, ValueDef} from './channeldef';\nimport {LegendConfig} from './legend';\nimport {VgEncodeChannel} from './vega.schema';\n\nexport interface TitleMixins {\n /**\n * A title for the field. If `null`, the title will be removed.\n *\n * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n *\n * __Notes__:\n *\n * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/usage/compile.html#field-title).\n *\n * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used.\n */\n title?: Text | null | SignalRef;\n}\n\nexport interface Guide extends TitleMixins, FormatMixins {}\n\nexport interface VlOnlyGuideConfig {\n /**\n * Set to null to disable title for the axis, legend, or header.\n */\n title?: null;\n}\n\nexport type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins;\n\nexport type GuideEncodingEntry = Partial>;\n\nexport const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[] = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n","import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega';\nimport {FormatMixins} from './channeldef';\nimport {ExprRef} from './expr';\nimport {Guide, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\n\nexport const HEADER_TITLE_PROPERTIES_MAP: Partial, keyof TitleConfig>> = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\n\nexport const HEADER_LABEL_PROPERTIES_MAP: Partial, keyof TitleConfig>> = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\n\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\n\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\n\nexport interface CoreHeader extends FormatMixins {\n // ---------- Title ----------\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n */\n titleAnchor?: TitleAnchor; // We don't allow signal for titleAnchor since there is a dependent logic\n\n /**\n * Horizontal text alignment (to the anchor) of header titles.\n */\n titleAlign?: Align | ES;\n\n /**\n * The rotation angle of the header title.\n *\n * __Default value:__ `0`.\n *\n * @minimum -360\n * @maximum 360\n */\n titleAngle?: number; // We don't allow signal for titleAngle since there is a dependent logic\n\n /**\n * The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n * __Default value:__ `\"middle\"`\n */\n titleBaseline?: TextBaseline | ES;\n\n /**\n * Color of the header title, can be in hex color code or regular color name.\n */\n titleColor?: Color | ES;\n\n /**\n * Font of the header title. (e.g., `\"Helvetica Neue\"`).\n */\n titleFont?: string | ES;\n\n /**\n * Font size of the header title.\n *\n * @minimum 0\n */\n titleFontSize?: number | ES;\n\n /**\n * The font style of the header title.\n */\n titleFontStyle?: FontStyle | ES;\n\n /**\n * Font weight of the header title.\n * This can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`).\n */\n titleFontWeight?: FontWeight | ES;\n\n /**\n * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n titleLimit?: number | ES;\n\n /**\n * Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n titleLineHeight?: number | ES;\n\n /**\n * The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n titleOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's title and the label.\n *\n * __Default value:__ `10`\n */\n titlePadding?: number | ES;\n\n // ---------- Label ----------\n\n /**\n * A boolean flag indicating if labels should be included as part of the header.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`.\n */\n labelAlign?: Align | ES;\n\n /**\n * The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n */\n labelBaseline?: TextBaseline | ES;\n\n /**\n * The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label.\n */\n labelAnchor?: TitleAnchor;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The rotation angle of the header labels.\n *\n * __Default value:__ `0` for column header, `-90` for row header.\n *\n * @minimum -360\n * @maximum 360\n */\n labelAngle?: number; // no signal ref since there is a dependent logic\n\n /**\n * The color of the header label, can be in hex color code or regular color name.\n */\n labelColor?: Color | ES;\n\n /**\n * The font of the header label.\n */\n labelFont?: string | ES;\n\n /**\n * The font size of the header label, in pixels.\n *\n * @minimum 0\n */\n labelFontSize?: number | ES;\n\n /**\n * The font style of the header label.\n */\n labelFontStyle?: FontStyle | ES;\n\n /**\n * The font weight of the header label.\n */\n labelFontWeight?: FontWeight | ES;\n\n /**\n * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n labelLimit?: number | ES;\n\n /**\n * Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n labelLineHeight?: number | ES;\n\n /**\n * The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n labelOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's label and the plot.\n *\n * __Default value:__ `10`\n */\n labelPadding?: number | ES;\n\n /**\n * Shortcut for setting both labelOrient and titleOrient.\n */\n orient?: Orient; // no signal ref since there is a dependent logic\n}\n\nexport interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig {}\n\n/**\n * Headers of row / column channels for faceted plots.\n */\nexport interface Header extends CoreHeader, Guide {}\n\nexport interface HeaderConfigMixins {\n /**\n * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n header?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerRow?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerColumn?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerFacet?: HeaderConfig;\n}\n\nconst HEADER_CONFIGS_INDEX: Flag> = {\n header: 1,\n headerRow: 1,\n headerColumn: 1,\n headerFacet: 1\n};\n\nexport const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX);\n","import {\n BaseLegend,\n LabelOverlap,\n Legend as VgLegend,\n LegendConfig as VgLegendConfig,\n LegendOrient,\n Orientation,\n SignalRef\n} from 'vega';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {Guide, GuideEncodingEntry, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema';\n\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n] as const;\n\ntype BaseLegendNoValueRefs = MapExcludeValueRefAndReplaceSignalWith;\n\nexport type LegendConfig = LegendMixins &\n VlOnlyGuideConfig &\n MapExcludeValueRefAndReplaceSignalWith & {\n /**\n * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientVerticalMaxLength?: number;\n\n /**\n * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientVerticalMinLength?: number;\n\n /**\n * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientHorizontalMaxLength?: number;\n\n /**\n * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientHorizontalMinLength?: number;\n\n /**\n * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n *\n * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules:\n * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)`\n * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)`\n * - For other horizontal gradients, `gradientHorizontalMinLength`\n *\n * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_.\n * @minimum 0\n */\n gradientLength?: number;\n\n /**\n * The opacity of unselected legend entries.\n *\n * __Default value:__ 0.35.\n */\n unselectedOpacity?: number;\n\n /**\n * Disable legend by default\n */\n disable?: boolean;\n };\n\n/**\n * Properties of a legend or boolean flag for determining whether to show it.\n */\nexport interface Legend\n extends Omit, 'orient'>,\n LegendMixins,\n Guide {\n /**\n * Mark definitions for custom legend encoding.\n *\n * @hidden\n */\n encoding?: LegendEncoding;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n *\n * __Default value__: `undefined`\n */\n tickMinStep?: number | ES;\n\n /**\n * Explicitly set the visible legend values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | ES; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * The type of the legend. Use `\"symbol\"` to create a discrete legend and `\"gradient\"` for a continuous color gradient.\n *\n * __Default value:__ `\"gradient\"` for non-binned quantitative fields and temporal fields; `\"symbol\"` otherwise.\n */\n type?: 'symbol' | 'gradient';\n\n /**\n * A non-negative integer indicating the z-index of the legend.\n * If zindex is 0, legend should be drawn behind all chart elements.\n * To put them in front, use zindex = 1.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\n// Change comments to be Vega-Lite specific\ninterface LegendMixins {\n /**\n * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `\"greedy\"` for `log scales otherwise `true`.\n */\n labelOverlap?: LabelOverlap | ES; // override comment since our default differs from Vega\n\n /**\n * The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n *\n * __Default value:__\n * - For top-/bottom-`orient`ed legends, `\"horizontal\"`\n * - For left-/right-`orient`ed legends, `\"vertical\"`\n * - For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends.\n */\n direction?: Orientation; // Omit SignalRef\n\n /**\n * The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n *\n * __Default value:__ `\"right\"`\n */\n orient?: LegendOrient; // Omit SignalRef\n}\n\nexport type LegendInternal = Legend;\n\nexport interface LegendEncoding {\n /**\n * Custom encoding for the legend container.\n * This can be useful for creating legend with custom x, y position.\n */\n legend?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the legend title text mark.\n */\n title?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend symbol marks.\n */\n symbols?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend gradient filled rect marks.\n */\n gradient?: GuideEncodingEntry;\n}\n\nexport const defaultLegendConfig: LegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64, // This is Vega's minimum.\n unselectedOpacity: 0.35\n};\n\nexport const COMMON_LEGEND_PROPERTY_INDEX: Flag)> = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\n\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n","import {Binding, Color, Cursor, Stream, Vector2} from 'vega';\nimport {isObject} from 'vega-util';\nimport {SingleDefUnitChannel} from './channel';\nimport {FieldName, PrimitiveValue} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ParameterName} from './parameter';\nimport {Dict} from './util';\n\nexport const SELECTION_ID = '_vgsid_';\nexport type SelectionType = 'point' | 'interval';\nexport type SelectionResolution = 'global' | 'union' | 'intersect';\n\nexport type SelectionInit = PrimitiveValue | DateTime;\nexport type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2;\n\nexport type SelectionInitMapping = Dict;\nexport type SelectionInitIntervalMapping = Dict;\n\nexport type LegendStreamBinding = {legend: string | Stream};\nexport type LegendBinding = 'legend' | LegendStreamBinding;\n\nexport interface BaseSelectionConfig {\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:\n *\n * - `\"point\"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n type: T;\n\n /**\n * Clears the selection, emptying it of all values. This property can be a\n * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable clear.\n *\n * __Default value:__ `dblclick`.\n *\n * __See also:__ [`clear` examples ](https://vega.github.io/vega-lite/docs/selection.html#clear) in the documentation.\n */\n clear?: Stream | string | boolean;\n\n /**\n * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\n * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters).\n *\n * __See also:__ [`on` examples](https://vega.github.io/vega-lite/docs/selection.html#on) in the documentation.\n */\n on?: Stream | string;\n\n /**\n * With layered and multi-view displays, a strategy that determines how\n * selections' data queries are resolved when applied in a filter transform,\n * conditional encoding rule, or scale domain.\n *\n * One of:\n * - `\"global\"` -- only one brush exists for the entire SPLOM. When the user begins to drag, any previous brushes are cleared, and a new one is constructed.\n * - `\"union\"` -- each cell contains its own brush, and points are highlighted if they lie within _any_ of these individual brushes.\n * - `\"intersect\"` -- each cell contains its own brush, and points are highlighted only if they fall within _all_ of these individual brushes.\n *\n * __Default value:__ `global`.\n *\n * __See also:__ [`resolve` examples](https://vega.github.io/vega-lite/docs/selection.html#resolve) in the documentation.\n */\n resolve?: SelectionResolution;\n\n // TODO(https://github.com/vega/vega-lite/issues/2596).\n // predicate?: string;\n // domain?: SelectionDomain;\n\n /**\n * An array of encoding channels. The corresponding data field values\n * must match for a data tuple to fall within the selection.\n *\n * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.\n */\n encodings?: SingleDefUnitChannel[];\n\n /**\n * An array of field names whose values must match for a data tuple to\n * fall within the selection.\n *\n * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.\n */\n fields?: FieldName[];\n}\n\nexport interface PointSelectionConfig extends BaseSelectionConfig<'point'> {\n /**\n * Controls whether data values should be toggled (inserted or removed from a point selection)\n * or only ever inserted into point selections.\n *\n * One of:\n * - `true` -- the default behavior, which corresponds to `\"event.shiftKey\"`. As a result, data values are toggled when the user interacts with the shift-key pressed.\n * - `false` -- disables toggling behaviour; the selection will only ever contain a single data value corresponding to the most recent interaction.\n * - A [Vega expression](https://vega.github.io/vega/docs/expressions/) which is re-evaluated as the user interacts. If the expression evaluates to `true`, the data value is toggled into or out of the point selection. If the expression evaluates to `false`, the point selection is first cleared, and the data value is then inserted. For example, setting the value to the Vega expression `\"true\"` will toggle data values\n * without the user pressing the shift-key.\n *\n * __Default value:__ `true`\n *\n * __See also:__ [`toggle` examples](https://vega.github.io/vega-lite/docs/selection.html#toggle) in the documentation.\n */\n toggle?: string | boolean;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __Default value:__ `false`, which means that data values must be interacted with directly (e.g., clicked on) to be added to the selection.\n *\n * __See also:__ [`nearest` examples](https://vega.github.io/vega-lite/docs/selection.html#nearest) documentation.\n */\n nearest?: boolean;\n}\n\n// Similar to BaseMarkConfig but the field documentations are specificly for an interval mark.\nexport interface BrushConfig {\n /**\n * The fill color of the interval mark.\n *\n * __Default value:__ `\"#333333\"`\n *\n */\n fill?: Color;\n\n /**\n * The fill opacity of the interval mark (a value between `0` and `1`).\n *\n * __Default value:__ `0.125`\n */\n fillOpacity?: number;\n\n /**\n * The stroke color of the interval mark.\n *\n * __Default value:__ `\"#ffffff\"`\n */\n stroke?: Color;\n\n /**\n * The stroke opacity of the interval mark (a value between `0` and `1`).\n */\n strokeOpacity?: number;\n\n /**\n * The stroke width of the interval mark.\n */\n strokeWidth?: number;\n\n /**\n * An array of alternating stroke and space lengths, for creating dashed or dotted lines.\n */\n strokeDash?: number[];\n\n /**\n * The offset (in pixels) with which to begin drawing the stroke dash array.\n */\n strokeDashOffset?: number;\n\n /**\n * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface IntervalSelectionConfig extends BaseSelectionConfig<'interval'> {\n /**\n * When truthy, allows a user to interactively move an interval selection\n * back-and-forth. Can be `true`, `false` (to disable panning), or a\n * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\n * which must include a start and end event to trigger continuous panning.\n * Discrete panning (e.g., pressing the left/right arrow keys) will be supported in future versions.\n *\n * __Default value:__ `true`, which corresponds to `[pointerdown, window:pointerup] > window:pointermove!`.\n * This default allows users to clicks and drags within an interval selection to reposition it.\n *\n * __See also:__ [`translate` examples](https://vega.github.io/vega-lite/docs/selection.html#translate) in the documentation.\n */\n translate?: string | boolean;\n\n /**\n * When truthy, allows a user to interactively resize an interval selection.\n * Can be `true`, `false` (to disable zooming), or a [Vega event stream\n * definition](https://vega.github.io/vega/docs/event-streams/). Currently,\n * only `wheel` events are supported,\n * but custom event streams can still be used to specify filters, debouncing, and throttling.\n * Future versions will expand the set of events that can trigger this transformation.\n *\n * __Default value:__ `true`, which corresponds to `wheel!`. This default allows users to use the mouse wheel to resize an interval selection.\n *\n * __See also:__ [`zoom` examples](https://vega.github.io/vega-lite/docs/selection.html#zoom) in the documentation.\n */\n zoom?: string | boolean;\n\n /**\n * An interval selection also adds a rectangle mark to depict the\n * extents of the interval. The `mark` property can be used to customize the\n * appearance of the mark.\n *\n * __See also:__ [`mark` examples](https://vega.github.io/vega-lite/docs/selection.html#mark) in the documentation.\n */\n mark?: BrushConfig;\n}\n\nexport interface SelectionParameter {\n /**\n * Required. A unique name for the selection parameter. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".\n */\n name: ParameterName;\n\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:\n *\n * - `\"point\"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n select: T | (T extends 'point' ? PointSelectionConfig : T extends 'interval' ? IntervalSelectionConfig : never);\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/selection.html#project) and initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/value.html) documentation.\n */\n value?: T extends 'point'\n ? SelectionInit | SelectionInitMapping[]\n : T extends 'interval'\n ? SelectionInitIntervalMapping\n : never;\n\n /**\n * When set, a selection is populated by input elements (also known as dynamic query widgets)\n * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n *\n * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\n * or can be a mapping between projected field/encodings and binding definitions.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: T extends 'point'\n ? Binding | Record | LegendBinding\n : T extends 'interval'\n ? 'scales'\n : never;\n}\n\nexport type TopLevelSelectionParameter = SelectionParameter & {\n /**\n * By default, top-level selections are applied to every view in the visualization.\n * If this property is specified, selections will only be applied to views with the given names.\n */\n views?: string[];\n};\n\nexport type ParameterExtent =\n | {\n /**\n * The name of a parameter.\n */\n param: ParameterName;\n\n /**\n * If a selection parameter is specified, the field name to extract selected values for\n * when the selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings.\n */\n field?: FieldName;\n }\n | {\n /**\n * The name of a parameter.\n */\n param: ParameterName;\n\n /**\n * If a selection parameter is specified, the encoding channel to extract selected values for\n * when a selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings.\n */\n encoding?: SingleDefUnitChannel;\n };\n\nexport type PointSelectionConfigWithoutType = Omit;\n\nexport type IntervalSelectionConfigWithoutType = Omit;\n\nexport interface SelectionConfig {\n /**\n * The default definition for a [`point`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations\n * for a point selection definition (except `type`) may be specified here.\n *\n * For instance, setting `point` to `{\"on\": \"dblclick\"}` populates point selections on double-click by default.\n */\n point?: PointSelectionConfigWithoutType;\n\n /**\n * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations\n * for an interval selection definition (except `type`) may be specified here.\n *\n * For instance, setting `interval` to `{\"translate\": false}` disables the ability to move\n * interval selections by default.\n */\n interval?: IntervalSelectionConfigWithoutType;\n}\n\nexport const defaultConfig: SelectionConfig = {\n point: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n clear: 'dblclick'\n },\n interval: {\n on: '[pointerdown, window:pointerup] > window:pointermove!',\n encodings: ['x', 'y'],\n translate: '[pointerdown, window:pointerup] > window:pointermove!',\n zoom: 'wheel!',\n mark: {fill: '#333', fillOpacity: 0.125, stroke: 'white'},\n resolve: 'global',\n clear: 'dblclick'\n }\n};\n\nexport function isLegendBinding(bind: any): bind is LegendBinding {\n return bind === 'legend' || !!bind?.legend;\n}\n\nexport function isLegendStreamBinding(bind: any): bind is LegendStreamBinding {\n return isLegendBinding(bind) && isObject(bind);\n}\n\nexport function isSelectionParameter(param: any): param is SelectionParameter {\n return !!param?.['select'];\n}\n","import {Binding, Expr, InitSignal, NewSignal} from 'vega';\nimport {isSelectionParameter, TopLevelSelectionParameter} from './selection';\n\nexport type ParameterName = string;\n\nexport interface VariableParameter {\n /**\n * A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".\n */\n name: ParameterName;\n\n /**\n * The [initial value](http://vega.github.io/vega-lite/docs/value.html) of the parameter.\n *\n * __Default value:__ `undefined`\n */\n value?: any;\n\n /**\n * An expression for the value of the parameter. This expression may include other parameters, in which case the parameter will automatically update in response to upstream parameter changes.\n */\n expr?: Expr;\n\n /**\n * Binds the parameter to an external input element such as a slider, selection list or radio button group.\n */\n bind?: Binding;\n}\n\nexport function assembleParameterSignals(params: (VariableParameter | TopLevelSelectionParameter)[]) {\n const signals: (NewSignal | InitSignal)[] = [];\n for (const param of params || []) {\n // Selection parameters are handled separately via assembleSelectionTopLevelSignals\n // and assembleSignals methods registered on the Model.\n if (isSelectionParameter(param)) continue;\n const {expr, bind, ...rest} = param;\n\n if (bind && expr) {\n // Vega's InitSignal -- apply expr to \"init\"\n const signal: InitSignal = {\n ...rest,\n bind,\n init: expr\n };\n signals.push(signal);\n } else {\n const signal: NewSignal = {\n ...rest,\n ...(expr ? {update: expr} : {}),\n ...(bind ? {bind} : {})\n };\n signals.push(signal);\n }\n }\n return signals;\n}\n","import {GenericSpec, NormalizedSpec} from '.';\nimport {BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\n\n/**\n * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property.\n */\nexport interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins {\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between sub-views of the concat operator.\n *\n * __Default value__: `10`\n */\n spacing?: number;\n}\n\n/**\n * Base interface for a generalized concatenation specification.\n */\nexport interface GenericConcatSpec>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * A list of views to be concatenated.\n */\n concat: S[];\n}\n\n/**\n * Base interface for a vertical concatenation specification.\n */\nexport interface GenericVConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a column.\n */\n vconcat: S[];\n}\n\n/**\n * Base interface for a horizontal concatenation specification.\n */\nexport interface GenericHConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a row.\n */\n hconcat: S[];\n}\n\n/** A concat spec without any shortcut/expansion syntax */\nexport type NormalizedConcatSpec =\n | GenericConcatSpec\n | GenericVConcatSpec\n | GenericHConcatSpec;\n\nexport function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\n\nexport function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec {\n return 'concat' in spec;\n}\n\nexport function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec {\n return 'vconcat' in spec;\n}\n\nexport function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec {\n return 'hconcat' in spec;\n}\n","import {Color, Cursor, SignalRef, Text} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {NormalizedSpec} from '.';\nimport {Data} from '../data';\nimport {ExprRef} from '../expr';\nimport {MarkConfig} from '../mark';\nimport {Resolve} from '../resolve';\nimport {TitleParams} from '../title';\nimport {Transform} from '../transform';\nimport {Flag, keys} from '../util';\nimport {LayoutAlign, RowCol} from '../vega.schema';\nimport {isConcatSpec, isVConcatSpec} from './concat';\nimport {isFacetMapping, isFacetSpec} from './facet';\n\nexport type {TopLevel} from './toplevel';\n\n/**\n * Common properties for all types of specification\n */\nexport interface BaseSpec {\n /**\n * Title for the plot.\n */\n title?: Text | TitleParams;\n\n /**\n * Name of the visualization for later reference.\n */\n name?: string;\n\n /**\n * Description of this mark for commenting purpose.\n */\n description?: string;\n\n /**\n * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent.\n */\n data?: Data | null;\n\n /**\n * An array of data transformations such as filter and new field calculation.\n */\n transform?: Transform[];\n}\n\nexport interface DataMixins {\n /**\n * An object describing the data source.\n */\n data: Data;\n}\n\nexport type StepFor = 'position' | 'offset';\n\nexport interface Step {\n /**\n * The size (width/height) per discrete step.\n */\n step: number;\n\n /**\n * Whether to apply the step to position scale or offset scale when there are both `x` and `xOffset` or both `y` and `yOffset` encodings.\n */\n for?: StepFor;\n}\n\nexport function getStepFor({step, offsetIsDiscrete}: {step: Step; offsetIsDiscrete: boolean}): StepFor {\n if (offsetIsDiscrete) {\n return step.for ?? 'offset';\n } else {\n return 'position';\n }\n}\n\nexport function isStep(size: number | Step | 'container' | 'merged'): size is Step {\n return isObject(size) && size['step'] !== undefined;\n}\n\n// TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing.\n/**\n * Common properties for specifying width and height of unit and layer specifications.\n */\nexport interface LayoutSizeMixins {\n /**\n * The width of a visualization.\n *\n * - For a plot with a continuous x-field, width should be a number.\n * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on width, it should be set to `\"container\"`.\n *\n * __Default value:__\n * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n width?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n\n /**\n * The height of a visualization.\n *\n * - For a plot with a continuous y-field, height should be a number.\n * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on height, it should be set to `\"container\"`.\n *\n * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n height?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n}\n\nexport function isFrameMixins(o: any): o is FrameMixins {\n return o['view'] || o['width'] || o['height'];\n}\n\nexport interface FrameMixins extends LayoutSizeMixins {\n /**\n * An object defining the view background's fill and stroke.\n *\n * __Default value:__ none (transparent)\n */\n view?: ViewBackground;\n}\n\nexport interface ResolveMixins {\n /**\n * Scale, axis, and legend resolutions for view composition specifications.\n */\n resolve?: Resolve;\n}\n\nexport interface BaseViewBackground\n extends Partial<\n Pick<\n MarkConfig,\n | 'cornerRadius'\n | 'fillOpacity'\n | 'opacity'\n | 'strokeCap'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeJoin'\n | 'strokeMiterLimit'\n | 'strokeOpacity'\n | 'strokeWidth'\n >\n > {\n // Override documentations for fill, stroke, and cursor\n /**\n * The fill color.\n *\n * __Default value:__ `undefined`\n */\n fill?: Color | null | ES;\n\n /**\n * The stroke color.\n *\n * __Default value:__ `\"#ddd\"`\n */\n stroke?: Color | null | ES;\n\n /**\n * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface ViewBackground extends BaseViewBackground {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ `\"cell\"`\n * __Note:__ Any specified view background properties will augment the default style.\n */\n style?: string | string[];\n}\n\nexport interface BoundsMixins {\n /**\n * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n *\n * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n *\n * __Default value:__ `\"full\"`\n */\n\n bounds?: 'full' | 'flush';\n}\n\n/**\n * Base layout for FacetSpec and RepeatSpec.\n * This is named \"GenericComposition\" layout as ConcatLayout is a GenericCompositionLayout too\n * (but _not_ vice versa).\n */\nexport interface GenericCompositionLayout extends BoundsMixins {\n /**\n * The alignment to apply to grid rows and columns.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * Alternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign | RowCol;\n\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * An object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean | RowCol;\n\n /**\n * The spacing in pixels between sub-views of the composition operator.\n * An object of the form `{\"row\": number, \"column\": number}` can be used to set\n * different spacing values for rows and columns.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number | RowCol;\n}\n\nexport const DEFAULT_SPACING = 20;\n\nexport interface ColumnMixins {\n /**\n * The number of columns to include in the view composition layout.\n *\n * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n *\n * __Note__:\n *\n * 1) This property is only for:\n * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n *\n * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).\n */\n columns?: number;\n}\n\nexport type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins;\n\nexport type CompositionConfig = ColumnMixins & {\n /**\n * The default spacing in pixels between composed sub-views.\n *\n * __Default value__: `20`\n */\n spacing?: number;\n};\n\nexport interface CompositionConfigMixins {\n /** Default configuration for the `facet` view composition operator */\n facet?: CompositionConfig;\n\n /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */\n concat?: CompositionConfig;\n}\n\nconst COMPOSITION_LAYOUT_INDEX: Flag = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\n\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\n\nexport type SpecType = 'unit' | 'facet' | 'layer' | 'concat';\n\nexport function extractCompositionLayout(\n spec: NormalizedSpec,\n specType: keyof CompositionConfigMixins,\n config: CompositionConfigMixins\n): GenericCompositionLayoutWithColumns {\n const compositionConfig = config[specType];\n const layout: GenericCompositionLayoutWithColumns = {};\n\n // Apply config first\n const {spacing: spacingConfig, columns} = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing: number | RowCol = spec[prop];\n\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n } else {\n (layout[prop] as any) = spec[prop];\n }\n }\n }\n\n return layout;\n}\n","import {Color, InitSignal, Locale, NewSignal, RangeConfig, RangeScheme, SignalRef, writeConfig} from 'vega';\nimport {isObject, mergeConfig} from 'vega-util';\nimport {Axis, AxisConfig, AxisConfigMixins, AXIS_CONFIGS, isConditionalAxisValue} from './axis';\nimport {signalOrValueRefWithCondition, signalRefOrValue} from './compile/common';\nimport {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark';\nimport {ExprRef, replaceExprRef} from './expr';\nimport {VL_ONLY_LEGEND_CONFIG} from './guide';\nimport {HeaderConfigMixins, HEADER_CONFIGS} from './header';\nimport {defaultLegendConfig, LegendConfig} from './legend';\nimport * as mark from './mark';\nimport {\n AnyMarkConfig,\n Mark,\n MarkConfig,\n MarkConfigMixins,\n MARK_CONFIGS,\n PRIMITIVE_MARKS,\n VL_ONLY_MARK_CONFIG_PROPERTIES,\n VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n} from './mark';\nimport {assembleParameterSignals} from './parameter';\nimport {ProjectionConfig} from './projection';\nimport {defaultScaleConfig, ScaleConfig} from './scale';\nimport {defaultConfig as defaultSelectionConfig, SelectionConfig} from './selection';\nimport {BaseViewBackground, CompositionConfigMixins, DEFAULT_SPACING, isStep} from './spec/base';\nimport {TopLevelProperties} from './spec/toplevel';\nimport {extractTitleConfig, TitleConfig} from './title';\nimport {duplicate, getFirstDefined, isEmpty, keys, omit} from './util';\n\nexport interface ViewConfig extends BaseViewBackground {\n /**\n * The default width when the plot has a continuous field for x or longitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousWidth?: number;\n\n /**\n * The default width when the plot has non-arc marks and either a discrete x-field or no x-field.\n * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteWidth?: number | {step: number};\n /**\n * The default height when the plot has a continuous y-field for x or latitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousHeight?: number;\n\n /**\n * The default height when the plot has non arc marks and either a discrete y-field or no y-field.\n * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteHeight?: number | {step: number};\n\n /**\n * Default step size for x-/y- discrete fields.\n */\n step?: number;\n\n /**\n * Whether the view should be clipped.\n */\n clip?: boolean;\n}\n\nexport function getViewConfigContinuousSize(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\n\nexport function getViewConfigDiscreteStep(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\n\nexport function getViewConfigDiscreteSize(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, {step: viewConfig.step});\n}\n\nexport const DEFAULT_STEP = 20;\n\nexport const defaultViewConfig: ViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\n\nexport function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme {\n return rangeScheme && !!rangeScheme['scheme'];\n}\n\nexport type ColorConfig = Record;\n\nexport type FontSizeConfig = Record;\n\nexport interface FormatConfig {\n /**\n * If numberFormatType is not specified,\n * D3 number format for guide labels, text marks, and tooltips of non-normalized fields (fields *without* `stack: \"normalize\"`). For example `\"s\"` for SI units.\n * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n *\n * If `config.numberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function.\n */\n numberFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.numberFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format).\n * __Note:__ You must also set `customFormatTypes` to `true` to use this feature.\n */\n numberFormatType?: string;\n\n /**\n * If normalizedNumberFormatType is not specified,\n * D3 number format for axis labels, text marks, and tooltips of normalized stacked fields (fields with `stack: \"normalize\"`). For example `\"s\"` for SI units.\n * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n *\n * If `config.normalizedNumberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function.\n * __Default value:__ `%`\n */\n normalizedNumberFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.normalizedNumberFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format).\n * __Note:__ You must also set `customFormatTypes` to `true` to use this feature.\n */\n normalizedNumberFormatType?: string;\n\n /**\n * Default time format for raw time values (without time units) in text marks, legend labels and header labels.\n *\n * __Default value:__ `\"%b %d, %Y\"`\n * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes.\n */\n timeFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.timeFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-time-format, which is exposed as [`timeFormat` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#timeFormat).\n * __Note:__ You must also set `customFormatTypes` to `true` and there must *not* be a `timeUnit` defined to use this feature.\n */\n timeFormatType?: string;\n}\n\nexport interface VLOnlyConfig extends FormatConfig {\n /**\n * Default font for all text marks, titles, and labels.\n */\n font?: string;\n\n /**\n * Default color signals.\n *\n * @hidden\n */\n color?: boolean | ColorConfig;\n\n /**\n * Default font size signals.\n *\n * @hidden\n */\n fontSize?: boolean | FontSizeConfig;\n\n /**\n * Default axis and legend title for count fields.\n *\n * __Default value:__ `'Count of Records`.\n *\n * @type {string}\n */\n countTitle?: string;\n\n /**\n * Defines how Vega-Lite generates title for fields. There are three possible styles:\n * - `\"verbal\"` (Default) - displays function in a verbal style (e.g., \"Sum of field\", \"Year-month of date\", \"field (binned)\").\n * - `\"function\"` - displays function using parentheses and capitalized texts (e.g., \"SUM(field)\", \"YEARMONTH(date)\", \"BIN(field)\").\n * - `\"plain\"` - displays only the field name without functions (e.g., \"field\", \"date\", \"field\").\n */\n fieldTitle?: 'verbal' | 'functional' | 'plain';\n\n /**\n * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type).\n */\n customFormatTypes?: boolean;\n\n /**\n * Define [custom format configuration](https://vega.github.io/vega-lite/docs/config.html#format) for tooltips. If unspecified, default format config will be applied.\n */\n tooltipFormat?: FormatConfig;\n\n /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */\n view?: ViewConfig;\n\n /**\n * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n scale?: ScaleConfig;\n\n /** An object hash for defining default properties for each type of selections. */\n selection?: SelectionConfig;\n}\n\nexport type StyleConfigIndex = Partial | Axis>> &\n MarkConfigMixins & {\n /**\n * Default style for axis, legend, and header titles.\n */\n 'guide-title'?: MarkConfig;\n\n /**\n * Default style for axis, legend, and header labels.\n */\n 'guide-label'?: MarkConfig;\n\n /**\n * Default style for chart titles\n */\n 'group-title'?: MarkConfig;\n\n /**\n * Default style for chart subtitles\n */\n 'group-subtitle'?: MarkConfig;\n };\n\nexport interface Config\n extends TopLevelProperties,\n VLOnlyConfig,\n MarkConfigMixins,\n CompositeMarkConfigMixins,\n AxisConfigMixins,\n HeaderConfigMixins,\n CompositionConfigMixins {\n /**\n * An object hash that defines default range arrays or schemes for using with scales.\n * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n range?: RangeConfig;\n\n /**\n * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config).\n */\n legend?: LegendConfig;\n\n /**\n * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config).\n */\n title?: TitleConfig;\n\n /**\n * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config).\n */\n projection?: ProjectionConfig;\n\n /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */\n style?: StyleConfigIndex;\n\n /**\n * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.\n */\n lineBreak?: string | ES;\n\n /**\n * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `\"aria-hidden\"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.\n *\n * __Default value:__ `true`.\n */\n aria?: boolean;\n\n /**\n * Locale definitions for string parsing and formatting of number and date values. The locale object should contain `number` and/or `time` properties with [locale definitions](https://vega.github.io/vega/docs/api/locale/). Locale definitions provided in the config block may be overridden by the View constructor locale option.\n */\n locale?: Locale;\n\n /**\n * @hidden\n */\n signals?: (InitSignal | NewSignal)[];\n}\n\nexport const defaultConfig: Config = {\n background: 'white',\n\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n\n view: defaultViewConfig,\n\n mark: mark.defaultMarkConfig,\n\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: {color: 'black'}, // Need this to override default color in mark config\n square: {},\n text: {color: 'black'}, // Need this to override default color in mark config\n tick: mark.defaultTickConfig,\n trail: {},\n\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: {color: 'white'},\n outliers: {},\n rule: {},\n ticks: null\n },\n\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n\n scale: defaultScaleConfig,\n\n projection: {},\n\n legend: defaultLegendConfig,\n header: {titlePadding: 10, labelPadding: 10},\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n\n selection: defaultSelectionConfig,\n style: {},\n\n title: {},\n\n facet: {spacing: DEFAULT_SPACING},\n concat: {spacing: DEFAULT_SPACING},\n\n normalizedNumberFormat: '.0%'\n};\n\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\n\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\n\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\n\nexport function colorSignalConfig(color: boolean | ColorConfig = {}): Config {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? {...DEFAULT_COLOR, ...color} : DEFAULT_COLOR\n }\n ],\n mark: {color: {signal: 'color.blue'}},\n rule: {color: {signal: 'color.gray0'}},\n text: {\n color: {signal: 'color.gray0'}\n },\n style: {\n 'guide-label': {\n fill: {signal: 'color.gray0'}\n },\n 'guide-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-subtitle': {\n fill: {signal: 'color.gray0'}\n },\n cell: {\n stroke: {signal: 'color.gray8'}\n }\n },\n axis: {\n domainColor: {signal: 'color.gray13'},\n gridColor: {signal: 'color.gray8'},\n tickColor: {signal: 'color.gray13'}\n },\n range: {\n category: [\n {signal: 'color.blue'},\n {signal: 'color.orange'},\n {signal: 'color.red'},\n {signal: 'color.teal'},\n {signal: 'color.green'},\n {signal: 'color.yellow'},\n {signal: 'color.purple'},\n {signal: 'color.pink'},\n {signal: 'color.brown'},\n {signal: 'color.grey8'}\n ]\n }\n };\n}\n\nexport function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? {...DEFAULT_FONT_SIZE, ...fontSize} : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: {signal: 'fontSize.text'}\n },\n style: {\n 'guide-label': {\n fontSize: {signal: 'fontSize.guideLabel'}\n },\n 'guide-title': {\n fontSize: {signal: 'fontSize.guideTitle'}\n },\n 'group-title': {\n fontSize: {signal: 'fontSize.groupTitle'}\n },\n 'group-subtitle': {\n fontSize: {signal: 'fontSize.groupSubtitle'}\n }\n }\n };\n}\n\nexport function fontConfig(font: string): Config {\n return {\n text: {font},\n style: {\n 'guide-label': {font},\n 'guide-title': {font},\n 'group-title': {font},\n 'group-subtitle': {font}\n }\n };\n}\n\nfunction getAxisConfigInternal(axisConfig: AxisConfig) {\n const props = keys(axisConfig || {});\n const axisConfigInternal: AxisConfig = {};\n for (const prop of props) {\n const val = axisConfig[prop];\n axisConfigInternal[prop as any] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisConfigInternal;\n}\n\nfunction getStyleConfigInternal(styleConfig: StyleConfigIndex) {\n const props = keys(styleConfig);\n\n const styleConfigInternal: StyleConfigIndex = {};\n for (const prop of props) {\n // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config\n styleConfigInternal[prop as any] = getAxisConfigInternal(styleConfig[prop] as any);\n }\n return styleConfigInternal;\n}\n\nconst configPropsWithExpr = [\n ...MARK_CONFIGS,\n ...AXIS_CONFIGS,\n ...HEADER_CONFIGS,\n 'background',\n 'padding',\n 'legend',\n 'lineBreak',\n 'scale',\n 'style',\n 'title',\n 'view'\n] as const;\n\n/**\n * Merge specified config with default config and config for the `color` flag,\n * then replace all expressions with signals\n */\nexport function initConfig(specifiedConfig: Config = {}): Config {\n const {color, font, fontSize, selection, ...restConfig} = specifiedConfig;\n const mergedConfig = mergeConfig(\n {},\n duplicate(defaultConfig),\n font ? fontConfig(font) : {},\n color ? colorSignalConfig(color) : {},\n fontSize ? fontSizeSignalConfig(fontSize) : {},\n restConfig || {}\n );\n\n // mergeConfig doesn't recurse and overrides object values.\n if (selection) {\n writeConfig(mergedConfig, 'selection', selection, true);\n }\n\n const outputConfig: Config = omit(mergedConfig, configPropsWithExpr);\n\n for (const prop of ['background', 'lineBreak', 'padding']) {\n if (mergedConfig[prop]) {\n outputConfig[prop] = signalRefOrValue(mergedConfig[prop]);\n }\n }\n\n for (const markConfigType of mark.MARK_CONFIGS) {\n if (mergedConfig[markConfigType]) {\n // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep\n outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]) as any;\n }\n }\n\n for (const axisConfigType of AXIS_CONFIGS) {\n if (mergedConfig[axisConfigType]) {\n outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]);\n }\n }\n\n for (const headerConfigType of HEADER_CONFIGS) {\n if (mergedConfig[headerConfigType]) {\n outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]);\n }\n }\n\n if (mergedConfig.legend) {\n outputConfig.legend = replaceExprRef(mergedConfig.legend);\n }\n\n if (mergedConfig.scale) {\n outputConfig.scale = replaceExprRef(mergedConfig.scale);\n }\n\n if (mergedConfig.style) {\n outputConfig.style = getStyleConfigInternal(mergedConfig.style);\n }\n\n if (mergedConfig.title) {\n outputConfig.title = replaceExprRef(mergedConfig.title);\n }\n\n if (mergedConfig.view) {\n outputConfig.view = replaceExprRef(mergedConfig.view);\n }\n\n return outputConfig;\n}\n\nconst MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]) as ReadonlySet<'view' | Mark>;\n\nconst VL_ONLY_CONFIG_PROPERTIES: (keyof Config)[] = [\n 'color',\n 'fontSize',\n 'background', // We apply background to the spec directly.\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'numberFormatType',\n 'normalizedNumberFormat',\n 'normalizedNumberFormatType',\n 'timeFormat',\n 'countTitle',\n 'header',\n\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n\n 'scale',\n 'selection',\n 'overlay' as keyof Config // FIXME: Redesign and unhide this\n];\n\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\n\nexport function stripAndRedirectConfig(config: Config) {\n config = duplicate(config);\n\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n\n if (config.params) {\n config.signals = (config.signals || []).concat(assembleParameterSignals(config.params));\n delete config.params;\n }\n\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n\n redirectTitleConfig(config);\n\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n\n return isEmpty(config) ? undefined : config;\n}\n\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config: Config) {\n const {titleMarkConfig, subtitleMarkConfig, subtitle} = extractTitleConfig(config.title);\n\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n } else {\n delete config.title;\n }\n}\n\nfunction redirectConfigToStyleConfig(\n config: Config,\n prop: Mark | 'view' | string, // string = composite mark\n toProp?: string,\n compositeMarkPart?: string\n) {\n const propConfig: MarkConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n\n const style: MarkConfig = {\n ...propConfig,\n ...(config.style[toProp ?? prop] as MarkConfig)\n };\n\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n","import {Field} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {ExprRef} from '../expr';\nimport {Projection} from '../projection';\nimport {BaseSpec, FrameMixins, ResolveMixins} from './base';\nimport {GenericUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit';\n\n/**\n * Base interface for a layer specification.\n */\nexport interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (GenericLayerSpec | U)[];\n}\n\n/**\n * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications.\n */\nexport interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (LayerSpec | UnitSpec)[];\n\n /**\n * A shared key-value mapping between encoding channels and definition of fields in the underlying layers.\n */\n encoding?: SharedCompositeEncoding;\n\n /**\n * An object defining properties of the geographic projection shared by underlying layers.\n */\n projection?: Projection;\n}\n\n/**\n * A layered specification without any shortcut/expansion syntax.\n */\nexport type NormalizedLayerSpec = GenericLayerSpec;\n\nexport function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec {\n return 'layer' in spec;\n}\n","import {isArray} from 'vega-util';\nimport {LayerSpec, NonNormalizedSpec} from '.';\nimport {Field} from '../channeldef';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {UnitSpecWithFrame} from './unit';\n\nexport interface RepeatMapping {\n /**\n * An array of fields to be repeated vertically.\n */\n row?: string[];\n\n /**\n * An array of fields to be repeated horizontally.\n */\n column?: string[];\n}\n\nexport interface LayerRepeatMapping extends RepeatMapping {\n /**\n * An array of fields to be repeated as layers.\n */\n layer: string[];\n}\n\nexport type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec;\n\n/**\n * Base interface for a repeat specification.\n */\nexport interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: string[] | RepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: NonNormalizedSpec;\n}\n\nexport interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: LayerRepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: LayerSpec | UnitSpecWithFrame;\n}\n\nexport function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec {\n return 'repeat' in spec;\n}\n\nexport function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n","import {GenericSpec} from '.';\nimport * as log from '../log';\nimport {Field, FieldName} from '../channeldef';\nimport {\n GenericConcatSpec,\n GenericHConcatSpec,\n GenericVConcatSpec,\n isConcatSpec,\n isHConcatSpec,\n isVConcatSpec\n} from './concat';\nimport {GenericFacetSpec, isFacetSpec} from './facet';\nimport {GenericLayerSpec, isLayerSpec} from './layer';\nimport {isRepeatSpec, RepeatSpec} from './repeat';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport abstract class SpecMapper<\n P,\n UI extends GenericUnitSpec,\n LI extends GenericLayerSpec = GenericLayerSpec,\n UO extends GenericUnitSpec = NormalizedUnitSpec,\n RO extends RepeatSpec = never,\n FO extends Field = FieldName\n> {\n public map(spec: GenericSpec, params: P): GenericSpec, RO, FO> {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n } else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n } else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n } else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n } else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n } else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n\n public mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n } else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n\n public abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec;\n\n protected mapLayer(spec: LI, params: P): GenericLayerSpec {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n\n protected mapHConcat(\n spec: GenericHConcatSpec>,\n params: P\n ): GenericHConcatSpec, RO, FO>> {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapVConcat(\n spec: GenericVConcatSpec>,\n params: P\n ): GenericVConcatSpec, RO, FO>> {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapConcat(\n spec: GenericConcatSpec>,\n params: P\n ): GenericConcatSpec, RO, FO>> {\n const {concat, ...rest} = spec;\n\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO> {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...(spec as any),\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params) as any\n };\n }\n\n protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec as any, params)\n };\n }\n}\n","import {array, isBoolean} from 'vega-util';\nimport {Aggregate, SUM_OPS} from './aggregate';\nimport {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel';\nimport {\n channelDefType,\n FieldName,\n getFieldDef,\n isFieldDef,\n isFieldOrDatumDef,\n PositionDatumDef,\n PositionDef,\n PositionFieldDef,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {CompositeAggregate} from './compositemark';\nimport {channelHasField, Encoding, isAggregate} from './encoding';\nimport * as log from './log';\nimport {\n ARC,\n AREA,\n BAR,\n CIRCLE,\n isMarkDef,\n isPathMark,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from './mark';\nimport {ScaleType} from './scale';\n\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n} as const;\n\nexport type StackOffset = keyof typeof STACK_OFFSET_INDEX;\n\nexport function isStackOffset(s: string): s is StackOffset {\n return s in STACK_OFFSET_INDEX;\n}\n\nexport interface StackProperties {\n /** Dimension axis of the stack. */\n groupbyChannels: ('x' | 'y' | 'theta' | 'radius' | 'xOffset' | 'yOffset')[];\n\n /** Field for groupbyChannel. */\n groupbyFields: Set;\n\n /** Measure axis of the stack. */\n fieldChannel: 'x' | 'y' | 'theta' | 'radius';\n\n /** Stack-by fields e.g., color, detail */\n stackBy: {\n fieldDef: TypedFieldDef;\n channel: NonPositionChannel;\n }[];\n\n /**\n * See `stack` property of Position Field Def.\n */\n offset: StackOffset;\n\n /**\n * Whether this stack will produce impute transform\n */\n impute: boolean;\n}\n\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\n\nfunction isUnbinnedQuantitative(channelDef: PositionDef) {\n return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin;\n}\n\nfunction potentialStackedChannel(\n encoding: Encoding,\n x: 'x' | 'theta',\n {orient, type: mark}: MarkDef\n): 'x' | 'y' | 'theta' | 'radius' | undefined {\n const y = x === 'x' ? 'y' : 'radius';\n\n const isCartesian = x === 'x';\n\n const xDef = encoding[x];\n const yDef = encoding[y];\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) {\n if (xDef.stack) {\n return x;\n } else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n }\n\n if (isCartesian && ['bar', 'area'].includes(mark)) {\n if (orient === 'vertical') {\n return y;\n } else if (orient === 'horizontal') {\n return x;\n }\n }\n } else if (isUnbinnedQuantitative(xDef)) {\n return x;\n } else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n } else if (isUnbinnedQuantitative(xDef)) {\n return x;\n } else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n return undefined;\n}\n\nfunction getDimensionChannel(channel: 'x' | 'y' | 'theta' | 'radius') {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\n\nexport function stack(m: Mark | MarkDef, encoding: Encoding): StackProperties {\n const markDef = isMarkDef(m) ? m : {type: m};\n const mark = markDef.type;\n\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel =\n potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef);\n\n if (!fieldChannel) {\n return null;\n }\n\n const stackedFieldDef = encoding[fieldChannel] as PositionFieldDef | PositionDatumDef;\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n\n const dimensionChannel: 'x' | 'y' | 'theta' | 'radius' = getDimensionChannel(fieldChannel);\n const groupbyChannels: StackProperties['groupbyChannels'] = [];\n const groupbyFields: Set = new Set();\n\n if (encoding[dimensionChannel]) {\n const dimensionDef = encoding[dimensionChannel];\n const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n\n if (dimensionField && dimensionField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionChannel);\n groupbyFields.add(dimensionField);\n }\n }\n\n const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset';\n const dimensionOffsetDef = encoding[dimensionOffsetChannel];\n const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined;\n\n if (dimensionOffsetField && dimensionOffsetField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionOffsetChannel);\n groupbyFields.add(dimensionOffsetField);\n }\n\n // If the dimension has offset, don't stack anymore\n\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from the groupBy fields.\n !groupbyFields.has(f)\n ) {\n sc.push({channel, fieldDef});\n }\n }\n }\n return sc;\n }, []);\n\n // Automatically determine offset\n let offset: StackOffset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n } else {\n offset = stackedFieldDef.stack;\n }\n } else if (STACK_BY_DEFAULT_MARKS.has(mark)) {\n offset = 'zero';\n }\n\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n\n // warn when stacking non-linear\n if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) {\n if (stackedFieldDef?.stack) {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n return null;\n }\n\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n\n // Warn if stacking non-summative aggregate\n if (\n isFieldDef(stackedFieldDef) &&\n stackedFieldDef.aggregate &&\n !(SUM_OPS as Set).has(stackedFieldDef.aggregate)\n ) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n\n return {\n groupbyChannels,\n groupbyFields,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n","import {Orientation, SignalRef} from 'vega';\nimport {isBinned, isBinning} from '../../bin';\nimport {isFieldDef, isNumericDataDef, isUnbinnedQuantitativeFieldOrDatumDef, isTypedFieldDef} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding, isAggregate} from '../../encoding';\nimport {replaceExprRef} from '../../expr';\nimport * as log from '../../log';\nimport {\n AREA,\n BAR,\n BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX,\n CIRCLE,\n IMAGE,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RECT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from '../../mark';\nimport {QUANTITATIVE, TEMPORAL} from '../../type';\nimport {contains, getFirstDefined} from '../../util';\nimport {getMarkConfig, getMarkPropOrConfig} from '../common';\n\nexport function initMarkdef(originalMarkDef: MarkDef, encoding: Encoding, config: Config) {\n // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level\n const markDef: MarkDef = replaceExprRef(originalMarkDef) as any;\n\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps =\n (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n\n return markDef;\n}\n\nfunction cursor(markDef: MarkDef, encoding: Encoding, config: Config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\n\nfunction opacity(mark: Mark, encoding: Encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\n\nexport function defaultFilled(markDef: MarkDef, config: Config, {graticule}: {graticule: boolean}) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\n\nfunction orient(mark: Mark, encoding: Encoding, specifiedOrient: Orientation): Orientation {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n\n const {x, y, x2, y2} = encoding;\n\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n\n // If y is range and x is non-range, non-bin Q\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n }\n return 'vertical';\n }\n\n // If x is range and y is non-range, non-bin Q\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n }\n\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n } else {\n return 'vertical';\n }\n } else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n } else {\n return 'horizontal';\n }\n } else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n } else if (y && !x) {\n return 'horizontal';\n }\n }\n\n // falls through\n case LINE:\n case TICK: {\n const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x);\n const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y);\n\n if (specifiedOrient) {\n return specifiedOrient;\n } else if (xIsMeasure && !yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n } else if (!xIsMeasure && yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xIsMeasure && yIsMeasure) {\n return 'vertical';\n } else {\n const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL;\n const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL;\n\n // x: T, y: N --> vertical tick\n if (xIsTemporal && !yIsTemporal) {\n return 'vertical';\n } else if (!xIsTemporal && yIsTemporal) {\n return 'horizontal';\n }\n }\n return undefined;\n }\n }\n return 'vertical';\n}\n","import type {SignalRef} from 'vega';\nimport {isObject} from 'vega-util';\nimport {Config} from '../config';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport {AreaConfig, isMarkDef, LineConfig, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {isUnitSpec} from '../spec/unit';\nimport {stack} from '../stack';\nimport {keys, omit, pick} from '../util';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\nimport {initMarkdef} from '../compile/mark/init';\n\ntype UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>;\n\nfunction dropLineAndPoint(markDef: MarkDef): MarkDef | Mark {\n const {point: _point, line: _line, ...mark} = markDef;\n\n return keys(mark).length > 1 ? mark : mark.type;\n}\n\nfunction dropLineAndPointFromConfig(config: Config) {\n for (const mark of ['line', 'area', 'rule', 'trail'] as const) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'] as any)\n };\n }\n }\n return config;\n}\n\nfunction getPointOverlay(\n markDef: MarkDef,\n markConfig: LineConfig = {},\n encoding: Encoding\n): MarkConfig {\n if (markDef.point === 'transparent') {\n return {opacity: 0};\n } else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n } else if (markDef.point !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nfunction getLineOverlay(\n markDef: MarkDef,\n markConfig: AreaConfig = {}\n): MarkConfig {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n } else if (markDef.line !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nexport class PathOverlayNormalizer implements NonFacetUnitNormalizer {\n public name = 'path-overlay';\n\n public hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay {\n if (isUnitSpec(spec)) {\n const {mark, encoding} = spec;\n const markDef = isMarkDef(mark) ? mark : {type: mark};\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type])\n );\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithPathOverlay, normParams: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {config} = normParams;\n const {params, projection, mark, name, encoding: e, ...outerSpec} = spec;\n\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n\n const markDef: MarkDef = isMarkDef(mark) ? mark : {type: mark};\n\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n\n const layer: NormalizedUnitSpec[] = [\n {\n name,\n ...(params ? {params} : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? {opacity: 0.7}\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n\n // FIXME: determine rules for applying selections.\n\n // Need to copy stack config to overlayed layer\n // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase.\n const stackProps = stack(initMarkdef(markDef, encoding, config), encoding);\n\n let overlayEncoding = encoding;\n if (stackProps) {\n const {fieldChannel: stackFieldChannel, offset} = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? {stack: offset} : {})\n }\n };\n }\n\n // overlay line layer should be on the edge of area but passing y2/x2 makes\n // it as \"rule\" mark so that it draws unwanted vertical/horizontal lines.\n // point overlay also should not have y2/x2 as it does not support.\n overlayEncoding = omit(overlayEncoding, ['y2', 'x2']);\n\n if (lineOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n\n return normalize(\n {\n ...outerSpec,\n layer\n },\n {\n ...normParams,\n config: dropLineAndPointFromConfig(config)\n }\n );\n }\n}\n","import {hasOwnProperty, isArray} from 'vega-util';\nimport {\n ChannelDef,\n DatumDef,\n Field,\n FieldDef,\n FieldName,\n hasConditionalFieldOrDatumDef,\n isConditionalDef,\n isFieldDef,\n isFieldOrDatumDef,\n isRepeatRef,\n isSortableFieldDef,\n ScaleFieldDef,\n ValueDef\n} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isSortField} from '../sort';\nimport {FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\n\nexport interface RepeaterValue {\n row?: string;\n column?: string;\n\n repeat?: string;\n\n layer?: string;\n}\n\nexport function replaceRepeaterInFacet(\n facet: FacetFieldDef | FacetMapping,\n repeater: RepeaterValue\n): FacetFieldDef | FacetMapping {\n if (!repeater) {\n return facet as FacetFieldDef;\n }\n\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater) as FacetMapping;\n }\n return replaceRepeaterInFieldDef(facet, repeater) as FacetFieldDef;\n}\n\nexport function replaceRepeaterInEncoding>(\n encoding: E,\n repeater: RepeaterValue\n): Encoding {\n if (!repeater) {\n return encoding as Encoding;\n }\n\n return replaceRepeaterInMapping(encoding, repeater) as Encoding;\n}\n\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop: keyof T, o: T, repeater: RepeaterValue): T {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return {...o, [prop]: repeater[val.repeat]};\n } else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\n\nfunction replaceRepeaterInFieldDef(fieldDef: FieldDef, repeater: RepeaterValue) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n } else if (fieldDef === null) {\n return null;\n }\n\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? {sort} : {})\n };\n }\n\n return fieldDef as ScaleFieldDef;\n}\n\nfunction replaceRepeaterInFieldOrDatumDef(def: FieldDef | DatumDef, repeater: RepeaterValue) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n } else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\n\nfunction replaceRepeaterInChannelDef(channelDef: ChannelDef, repeater: RepeaterValue) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n } else if (isConditionalDef>(channelDef)) {\n return {condition: channelDef.condition};\n }\n } else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n } as ChannelDef;\n } else {\n const {condition, ...channelDefWithoutCondition} = channelDef;\n return channelDefWithoutCondition as ChannelDef;\n }\n }\n return channelDef as ValueDef;\n }\n return undefined;\n}\n\ntype EncodingOrFacet = Encoding | FacetMapping;\n\nfunction replaceRepeaterInMapping(\n mapping: EncodingOrFacet,\n repeater: RepeaterValue\n): EncodingOrFacet {\n const out: EncodingOrFacet = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef: ChannelDef | ChannelDef[] = mapping[channel];\n\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = (channelDef as ChannelDef[]) // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n } else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n","import {isObject} from 'vega-util';\nimport {isBinned} from '../bin';\nimport {getMainRangeChannel, SECONDARY_RANGE_CHANNEL} from '../channel';\nimport {Field, isDatumDef, isFieldDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef} from '../mark';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec} from '../spec/unit';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ninterface EncodingX2Mixins {\n x2: Encoding['x2'];\n}\n\ninterface EncodingY2Mixins {\n y2: Encoding['y2'];\n}\n\ntype RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line' | {mark: 'line'}>;\n\nexport class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer {\n public name = 'RuleForRangedLine';\n\n public hasMatchingType(spec: GenericSpec): spec is RangedLineSpec {\n if (isUnitSpec(spec)) {\n const {encoding, mark} = spec;\n if (mark === 'line' || (isMarkDef(mark) && mark.type === 'line')) {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {encoding, mark} = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n\n return normalize(\n {\n ...spec,\n mark: isObject(mark) ? {...mark, type: 'rule'} : 'rule'\n },\n params\n );\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {COLUMN, FACET, ROW} from '../channel';\nimport {Field, FieldName, hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {boxPlotNormalizer} from '../compositemark/boxplot';\nimport {errorBandNormalizer} from '../compositemark/errorband';\nimport {errorBarNormalizer} from '../compositemark/errorbar';\nimport {channelHasField, Encoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {Projection} from '../projection';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec} from '../spec';\nimport {GenericCompositionLayoutWithColumns} from '../spec/base';\nimport {GenericConcatSpec} from '../spec/concat';\nimport {\n FacetEncodingFieldDef,\n FacetFieldDef,\n FacetMapping,\n GenericFacetSpec,\n isFacetMapping,\n NormalizedFacetSpec\n} from '../spec/facet';\nimport {NormalizedSpec} from '../spec/index';\nimport {NormalizedLayerSpec} from '../spec/layer';\nimport {SpecMapper} from '../spec/map';\nimport {isLayerRepeatSpec, LayerRepeatSpec, NonLayerRepeatSpec, RepeatSpec} from '../spec/repeat';\nimport {isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty, keys, omit, varName} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {NonFacetUnitNormalizer, NormalizerParams} from './base';\nimport {PathOverlayNormalizer} from './pathoverlay';\nimport {replaceRepeaterInEncoding, replaceRepeaterInFacet} from './repeater';\nimport {RuleForRangedLineNormalizer} from './ruleforrangedline';\n\nexport class CoreNormalizer extends SpecMapper, LayerSpec> {\n private nonFacetUnitNormalizers: NonFacetUnitNormalizer[] = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer()\n ];\n\n public map(spec: GenericSpec, LayerSpec, RepeatSpec, Field>, params: NormalizerParams) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n\n return super.map(spec, params);\n }\n\n // This is for normalizing non-facet unit\n public mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const {parentEncoding, parentProjection} = params;\n\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n\n const specWithReplacedEncoding = {\n ...spec,\n ...(spec.name ? {name: [params.repeaterPrefix, spec.name].filter(n => n).join('_')} : {}),\n ...(encoding ? {encoding} : {})\n };\n\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n\n return specWithReplacedEncoding as NormalizedUnitSpec;\n }\n\n protected mapRepeat(\n spec: RepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n } else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n\n private mapLayerRepeat(\n spec: LayerRepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n const {repeat, spec: childSpec, ...rest} = spec;\n const {row, column, layer} = repeat;\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n if (row || column) {\n return this.mapRepeat(\n {\n ...spec,\n repeat: {\n ...(row ? {row} : {}),\n ...(column ? {column} : {})\n },\n spec: {\n repeat: {layer},\n spec: childSpec\n }\n },\n params\n );\n } else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n\n const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(\n layerValue\n )}`;\n\n const child = this.mapLayerOrUnit(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n return child;\n })\n };\n }\n }\n\n private mapNonLayerRepeat(spec: NonLayerRepeatSpec, params: NormalizerParams): GenericConcatSpec {\n const {repeat, spec: childSpec, data, ...remainingProperties} = spec;\n\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n\n const concat: NormalizedSpec[] = [];\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n\n const childName =\n (childSpec.name ? `${childSpec.name}_` : '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n\n const child = this.map(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n // we move data up\n concat.push(omit(child, ['data']) as NormalizedSpec);\n }\n }\n }\n\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data, // data from child spec should have precedence\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n\n protected mapFacet(\n spec: GenericFacetSpec, LayerSpec, Field>,\n params: NormalizerParams\n ): GenericFacetSpec {\n const {facet} = spec;\n\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n\n return super.mapFacet(spec, params);\n }\n\n private mapUnitWithParentEncodingOrProjection(\n spec: FacetedUnitSpec,\n params: NormalizerParams\n ): NormalizedUnitSpec | NormalizedLayerSpec {\n const {encoding, projection} = spec;\n const {parentEncoding, parentProjection, config} = params;\n const mergedProjection = mergeProjection({parentProjection, projection});\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n\n return this.mapUnit(\n {\n ...spec,\n ...(mergedProjection ? {projection: mergedProjection} : {}),\n ...(mergedEncoding ? {encoding: mergedEncoding} : {})\n },\n {config}\n );\n }\n\n private mapFacetedUnit(spec: FacetedUnitSpec, normParams: NormalizerParams): NormalizedFacetSpec {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const {row, column, facet, ...encoding} = spec.encoding;\n\n // Mark and encoding should be moved into the inner spec\n const {mark, width, projection, height, view, params, encoding: _, ...outerSpec} = spec;\n\n const {facetMapping, layout} = this.getFacetMappingAndLayout({row, column, facet}, normParams);\n\n const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater);\n\n return this.mapFacet(\n {\n ...outerSpec,\n ...layout,\n\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? {width} : {}),\n ...(height ? {height} : {}),\n ...(view ? {view} : {}),\n ...(projection ? {projection} : {}),\n mark,\n encoding: newEncoding,\n ...(params ? {params} : {})\n }\n },\n normParams\n );\n }\n\n private getFacetMappingAndLayout(\n facets: {\n row: FacetEncodingFieldDef;\n column: FacetEncodingFieldDef;\n facet: FacetEncodingFieldDef;\n },\n params: NormalizerParams\n ): {facetMapping: FacetMapping | FacetFieldDef; layout: GenericCompositionLayoutWithColumns} {\n const {row, column, facet} = facets;\n\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n\n const facetMapping = {};\n const layout = {};\n\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const {align, center, spacing, columns, ...defWithoutLayout} = def;\n facetMapping[channel] = defWithoutLayout;\n\n for (const prop of ['align', 'center', 'spacing'] as const) {\n if (def[prop] !== undefined) {\n layout[prop] ??= {};\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n\n return {facetMapping, layout};\n } else {\n const {align, center, spacing, columns, ...facetMapping} = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? {align} : {}),\n ...(center ? {center} : {}),\n ...(spacing ? {spacing} : {}),\n ...(columns ? {columns} : {})\n }\n };\n }\n }\n\n public mapLayer(\n spec: LayerSpec,\n {parentEncoding, parentProjection, ...otherParams}: NormalizerParams\n ): NormalizedLayerSpec {\n // Special handling for extended layer spec\n\n const {encoding, projection, ...rest} = spec;\n const params: NormalizerParams = {\n ...otherParams,\n parentEncoding: mergeEncoding({parentEncoding, encoding, layer: true}),\n parentProjection: mergeProjection({parentProjection, projection})\n };\n return super.mapLayer(\n {\n ...rest,\n ...(spec.name ? {name: [params.repeaterPrefix, spec.name].filter(n => n).join('_')} : {})\n },\n params\n );\n }\n}\n\nfunction mergeEncoding({\n parentEncoding,\n encoding = {},\n layer\n}: {\n parentEncoding: SharedCompositeEncoding;\n encoding: SharedCompositeEncoding | Encoding;\n layer?: boolean;\n}): Encoding {\n let merged: any = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n } else if (channelDef || channelDef === null) {\n merged[channel] = channelDef;\n } else if (\n layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)\n ) {\n merged[channel] = parentChannelDef;\n }\n }\n } else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\n\nfunction mergeProjection(opt: {\n parentProjection: Projection;\n projection: Projection;\n}) {\n const {parentProjection, projection} = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({parentProjection, projection}));\n }\n return projection ?? parentProjection;\n}\n","import {AggregateOp} from 'vega';\nimport {BinParams} from './bin';\nimport {FieldName} from './channeldef';\nimport {Data} from './data';\nimport {ImputeParams} from './impute';\nimport {LogicalComposition, normalizeLogicalComposition} from './logical';\nimport {ParameterName} from './parameter';\nimport {normalizePredicate, Predicate} from './predicate';\nimport {SortField} from './sort';\nimport {TimeUnit, TimeUnitTransformParams} from './timeunit';\n\nexport interface FilterTransform {\n /**\n * The `filter` property must be a predication definition, which can take one of the following forms:\n *\n * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string,\n * where `datum` can be used to refer to the current data object.\n * For example, `{filter: \"datum.b2 > 60\"}` would make the output data includes only items that have values in the field `b2` over 60.\n *\n * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate):\n * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate),\n * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate),\n * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate),\n * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate),\n * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate),\n * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate),\n * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate),\n * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate),\n\n * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections).\n *\n * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3).\n */\n filter: LogicalComposition;\n}\n\nexport function isFilter(t: Transform): t is FilterTransform {\n return 'filter' in t;\n}\n\nexport interface CalculateTransform {\n /**\n * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object.\n */\n calculate: string;\n\n /**\n * The field for storing the computed formula value.\n */\n as: FieldName;\n}\n\nexport interface BinTransform {\n /**\n * An object indicating bin properties, or simply `true` for using default bin parameters.\n */\n bin: true | BinParams;\n\n /**\n * The data field to bin.\n */\n field: FieldName;\n\n /**\n * The output fields at which to write the start and end bin values.\n * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively.\n * If a single string (e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | FieldName[];\n}\n\nexport interface TimeUnitTransform {\n /**\n * The timeUnit.\n */\n timeUnit: TimeUnit | TimeUnitTransformParams;\n\n /**\n * The data field to apply time unit.\n */\n field: FieldName;\n\n /**\n * The output field to write the timeUnit value.\n */\n as: FieldName;\n}\n\nexport interface AggregateTransform {\n /**\n * Array of objects that define fields to aggregate.\n */\n aggregate: AggregatedFieldDef[];\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n}\n\nexport interface AggregatedFieldDef {\n /**\n * The aggregation operation to apply to the fields (e.g., `\"sum\"`, `\"average\"`, or `\"count\"`).\n * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops)\n * for more information.\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute aggregate function. This is required for all aggregation operations except `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output field names to use for each aggregated field.\n */\n as: FieldName;\n}\n\nexport interface StackTransform {\n /**\n * The field which is stacked.\n */\n stack: FieldName;\n /**\n * The data fields to group by.\n */\n groupby: FieldName[];\n /**\n * Mode for stacking marks. One of `\"zero\"` (default), `\"center\"`, or `\"normalize\"`.\n * The `\"zero\"` offset will stack starting at `0`. The `\"center\"` offset will center the stacks. The `\"normalize\"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`.\n *\n * __Default value:__ `\"zero\"`\n */\n offset?: 'zero' | 'center' | 'normalize';\n /**\n * Field that determines the order of leaves in the stacked charts.\n */\n sort?: SortField[];\n /**\n * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively.\n * If a single string(e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | [FieldName, FieldName];\n}\n\nexport type WindowOnlyOp =\n | 'row_number'\n | 'rank'\n | 'dense_rank'\n | 'percent_rank'\n | 'cume_dist'\n | 'ntile'\n | 'lag'\n | 'lead'\n | 'first_value'\n | 'last_value'\n | 'nth_value';\n\nexport interface WindowFieldDef {\n /**\n * The window or aggregation operation to apply within a window (e.g., `\"rank\"`, `\"lead\"`, `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops).\n */\n op: AggregateOp | WindowOnlyOp;\n\n /**\n * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.\n *\n * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html).\n */\n param?: number;\n\n /**\n * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `\"count\"`, `\"rank\"`, `\"dense_rank\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the window operation.\n */\n as: FieldName;\n}\n\nexport interface WindowTransform {\n /**\n * The definition of the fields in the window, and what calculations to use.\n */\n window: WindowFieldDef[];\n\n /**\n * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this.\n *\n * __Default value:__: `[null, 0]` (includes the current object and all preceding objects)\n */\n frame?: (null | number)[];\n\n /**\n * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.\n *\n * __Default value:__ `false`\n */\n ignorePeers?: boolean;\n\n /**\n * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.\n */\n groupby?: FieldName[];\n\n /**\n * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered \"peer\" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`).\n */\n sort?: SortField[];\n}\n\nexport interface JoinAggregateFieldDef {\n /**\n * The aggregation operation to apply (e.g., `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the join aggregate operation.\n */\n as: FieldName;\n}\n\nexport interface JoinAggregateTransform {\n /**\n * The definition of the fields in the join aggregate, and what calculations to use.\n */\n joinaggregate: JoinAggregateFieldDef[];\n\n /**\n * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.\n */\n groupby?: FieldName[];\n}\n\nexport interface ImputeSequence {\n /**\n * The starting value of the sequence.\n * __Default value:__ `0`\n */\n start?: number;\n /**\n * The ending value(exclusive) of the sequence.\n */\n stop: number;\n /**\n * The step value between sequence entries.\n * __Default value:__ `1` or `-1` if `stop < start`\n */\n step?: number;\n}\n\nexport function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence {\n return t?.['stop'] !== undefined;\n}\n\nexport interface ImputeTransform extends ImputeParams {\n /**\n * The data field for which the missing values should be imputed.\n */\n impute: FieldName;\n\n /**\n * A key field that uniquely identifies data objects within a group.\n * Missing key values (those occurring in the data but not in the current group) will be imputed.\n */\n key: FieldName;\n\n /**\n * An optional array of fields by which to group the values.\n * Imputation will then be performed on a per-group basis.\n */\n groupby?: FieldName[];\n}\n\nexport interface FlattenTransform {\n /**\n * An array of one or more data fields containing arrays to flatten.\n * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length.\n * If the lengths of parallel arrays do not match,\n * the longest array will be used with `null` values added for missing entries.\n */\n flatten: FieldName[];\n\n /**\n * The output field names for extracted array values.\n *\n * __Default value:__ The field name of the corresponding array field\n */\n as?: FieldName[];\n}\n\nexport interface SampleTransform {\n /**\n * The maximum number of data objects to include in the sample.\n *\n * __Default value:__ `1000`\n */\n sample: number;\n}\n\nexport interface LookupBase {\n /**\n * Key in data to lookup.\n */\n key: FieldName;\n /**\n * Fields in foreign data or selection to lookup.\n * If not specified, the entire object is queried.\n */\n fields?: FieldName[];\n}\n\nexport interface LookupData extends LookupBase {\n /**\n * Secondary data source to lookup in.\n */\n data: Data;\n}\n\nexport interface LookupSelection extends LookupBase {\n /**\n * Selection parameter name to look up.\n */\n param: ParameterName;\n}\n\nexport interface LookupTransform {\n /**\n * Key in primary data source.\n */\n lookup: string;\n\n /**\n * The output fields on which to store the looked up data values.\n *\n * For data lookups, this property may be left blank if `from.fields`\n * has been specified (those field names will be used); if `from.fields`\n * has not been specified, `as` must be a string.\n *\n * For selection lookups, this property is optional: if unspecified,\n * looked up values will be stored under a property named for the selection;\n * and if specified, it must correspond to `from.fields`.\n */\n as?: FieldName | FieldName[];\n\n /**\n * The default value to use if lookup fails.\n *\n * __Default value:__ `null`\n */\n default?: any;\n\n /**\n * Data source or selection for secondary data reference.\n */\n from: LookupData | LookupSelection;\n}\n\nexport function isLookup(t: Transform): t is LookupTransform {\n return 'lookup' in t;\n}\n\nexport function isLookupData(from: LookupData | LookupSelection): from is LookupData {\n return 'data' in from;\n}\n\nexport function isLookupSelection(from: LookupData | LookupSelection): from is LookupSelection {\n return 'param' in from;\n}\n\nexport interface FoldTransform {\n /**\n * An array of data fields indicating the properties to fold.\n */\n fold: FieldName[];\n\n /**\n * The output field names for the key and value properties produced by the fold transform.\n * __Default value:__ `[\"key\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport interface ExtentTransform {\n /**\n * The field of which to get the extent.\n */\n extent: FieldName;\n\n /**\n * The output parameter produced by the extent transform.\n */\n param: ParameterName;\n}\n\nexport interface PivotTransform {\n /**\n * The data field to pivot on. The unique values of this field become new field names in the output stream.\n */\n pivot: FieldName;\n\n /**\n * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.\n */\n value: FieldName;\n\n /**\n * The optional data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An optional parameter indicating the maximum number of pivoted fields to generate.\n * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit.\n * __Default value:__ `0`\n */\n limit?: number;\n\n /**\n * The aggregation operation to apply to grouped `value` field values.\n * __Default value:__ `sum`\n */\n op?: AggregateOp;\n}\n\nexport function isPivot(t: Transform): t is PivotTransform {\n return 'pivot' in t;\n}\n\nexport interface DensityTransform {\n /**\n * The data field for which to perform density estimation.\n */\n density: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).\n *\n * __Default value:__ `false`\n */\n cumulative?: boolean;\n\n /**\n * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).\n *\n * __Default value:__ `false`\n */\n counts?: boolean;\n\n /**\n * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.\n */\n bandwidth?: number;\n\n /**\n * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.\n */\n extent?: [number, number];\n\n /**\n * The minimum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `25`\n */\n minsteps?: number;\n\n /**\n * The maximum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `200`\n */\n maxsteps?: number;\n\n /**\n * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.\n */\n steps?: number;\n\n /**\n * The output fields for the sample value and corresponding density estimate.\n *\n * __Default value:__ `[\"value\", \"density\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isDensity(t: Transform): t is DensityTransform {\n return 'density' in t;\n}\n\nexport interface QuantileTransform {\n /**\n * The data field for which to perform quantile estimation.\n */\n quantile: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used.\n */\n probs?: number[];\n\n /**\n * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided.\n */\n step?: number;\n\n /**\n * The output field names for the probability and quantile values.\n *\n * __Default value:__ `[\"prob\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isQuantile(t: Transform): t is QuantileTransform {\n return 'quantile' in t;\n}\n\nexport interface RegressionTransform {\n /**\n * The data field of the dependent variable to predict.\n */\n regression: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * The functional form of the regression model. One of `\"linear\"`, `\"log\"`, `\"exp\"`, `\"pow\"`, `\"quad\"`, or `\"poly\"`.\n *\n * __Default value:__ `\"linear\"`\n */\n method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly';\n\n /**\n * The polynomial order (number of coefficients) for the 'poly' method.\n *\n * __Default value:__ `3`\n */\n order?: number;\n\n /**\n * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.\n */\n extent?: [number, number];\n\n /**\n * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points.\n * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order)\n * and an `rSquared` value (indicating the total variance explained by the model).\n *\n * __Default value:__ `false`\n */\n params?: boolean;\n\n /**\n * The output field names for the smoothed points generated by the regression transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isRegression(t: Transform): t is RegressionTransform {\n return 'regression' in t;\n}\n\nexport interface LoessTransform {\n /**\n * The data field of the dependent variable to smooth.\n */\n loess: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing.\n *\n * __Default value:__ `0.3`\n */\n bandwidth?: number;\n\n /**\n * The output field names for the smoothed points generated by the loess transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isLoess(t: Transform): t is LoessTransform {\n return 'loess' in t;\n}\n\nexport function isSample(t: Transform): t is SampleTransform {\n return 'sample' in t;\n}\n\nexport function isWindow(t: Transform): t is WindowTransform {\n return 'window' in t;\n}\n\nexport function isJoinAggregate(t: Transform): t is JoinAggregateTransform {\n return 'joinaggregate' in t;\n}\n\nexport function isFlatten(t: Transform): t is FlattenTransform {\n return 'flatten' in t;\n}\nexport function isCalculate(t: Transform): t is CalculateTransform {\n return 'calculate' in t;\n}\n\nexport function isBin(t: Transform): t is BinTransform {\n return 'bin' in t;\n}\n\nexport function isImpute(t: Transform): t is ImputeTransform {\n return 'impute' in t;\n}\n\nexport function isTimeUnit(t: Transform): t is TimeUnitTransform {\n return 'timeUnit' in t;\n}\n\nexport function isAggregate(t: Transform): t is AggregateTransform {\n return 'aggregate' in t;\n}\n\nexport function isStack(t: Transform): t is StackTransform {\n return 'stack' in t;\n}\n\nexport function isFold(t: Transform): t is FoldTransform {\n return 'fold' in t;\n}\n\nexport function isExtent(t: Transform): t is ExtentTransform {\n return 'extent' in t && !('density' in t);\n}\nexport type Transform =\n | AggregateTransform\n | BinTransform\n | CalculateTransform\n | DensityTransform\n | ExtentTransform\n | FilterTransform\n | FlattenTransform\n | FoldTransform\n | ImputeTransform\n | JoinAggregateTransform\n | LoessTransform\n | LookupTransform\n | QuantileTransform\n | RegressionTransform\n | TimeUnitTransform\n | SampleTransform\n | StackTransform\n | WindowTransform\n | PivotTransform;\n\nexport function normalizeTransform(transform: Transform[]) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n","import {isArray} from 'vega';\nimport {BinParams, isBinParams} from '../bin';\nimport {ChannelDef, Field, isConditionalDef, isFieldDef, isScaleFieldDef} from '../channeldef';\nimport {LogicalComposition, normalizeLogicalComposition} from '../logical';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, RepeatSpec, UnitSpec} from '../spec';\nimport {SpecMapper} from '../spec/map';\nimport {isBin, isFilter, isLookup} from '../transform';\nimport {duplicate, entries, vals} from '../util';\nimport {NormalizerParams} from './base';\n\nexport class SelectionCompatibilityNormalizer extends SpecMapper<\n NormalizerParams,\n FacetedUnitSpec,\n LayerSpec,\n UnitSpec\n> {\n public map(\n spec: GenericSpec, LayerSpec, RepeatSpec, Field>,\n normParams: NormalizerParams\n ) {\n normParams.emptySelections ??= {};\n normParams.selectionPredicates ??= {};\n spec = normalizeTransforms(spec, normParams);\n return super.map(spec, normParams);\n }\n\n public mapLayerOrUnit(spec: FacetedUnitSpec | LayerSpec, normParams: NormalizerParams) {\n spec = normalizeTransforms(spec, normParams);\n\n if (spec.encoding) {\n const encoding = {};\n for (const [channel, enc] of entries(spec.encoding)) {\n encoding[channel] = normalizeChannelDef(enc, normParams);\n }\n\n spec = {...spec, encoding};\n }\n\n return super.mapLayerOrUnit(spec, normParams);\n }\n\n public mapUnit(spec: UnitSpec, normParams: NormalizerParams) {\n const {selection, ...rest} = spec as any;\n if (selection) {\n return {\n ...rest,\n params: entries(selection).map(([name, selDef]) => {\n const {init: value, bind, empty, ...select} = selDef as any;\n if (select.type === 'single') {\n select.type = 'point';\n select.toggle = false;\n } else if (select.type === 'multi') {\n select.type = 'point';\n }\n\n // Propagate emptiness forwards and backwards\n normParams.emptySelections[name] = empty !== 'none';\n for (const pred of vals(normParams.selectionPredicates[name] ?? {})) {\n pred.empty = empty !== 'none';\n }\n\n return {name, value, select, bind};\n })\n };\n }\n\n return spec;\n }\n}\n\nfunction normalizeTransforms(spec: any, normParams: NormalizerParams) {\n const {transform: tx, ...rest} = spec;\n if (tx) {\n const transform = tx.map((t: any) => {\n if (isFilter(t)) {\n return {filter: normalizePredicate(t, normParams)};\n } else if (isBin(t) && isBinParams(t.bin)) {\n return {\n ...t,\n bin: normalizeBinExtent(t.bin)\n };\n } else if (isLookup(t)) {\n const {selection: param, ...from} = t.from as any;\n return param\n ? {\n ...t,\n from: {param, ...from}\n }\n : t;\n }\n return t;\n });\n\n return {...rest, transform};\n }\n\n return spec;\n}\n\nfunction normalizeChannelDef(obj: any, normParams: NormalizerParams): ChannelDef {\n const enc = duplicate(obj);\n\n if (isFieldDef(enc) && isBinParams(enc.bin)) {\n enc.bin = normalizeBinExtent(enc.bin);\n }\n\n if (isScaleFieldDef(enc) && (enc.scale?.domain as any)?.selection) {\n const {selection: param, ...domain} = enc.scale.domain as any;\n enc.scale.domain = {...domain, ...(param ? {param} : {})};\n }\n\n if (isConditionalDef(enc)) {\n if (isArray(enc.condition)) {\n enc.condition = enc.condition.map((c: any) => {\n const {selection, param, test, ...cond} = c;\n return param ? c : {...cond, test: normalizePredicate(c, normParams)};\n });\n } else {\n const {selection, param, test, ...cond} = normalizeChannelDef(enc.condition, normParams) as any;\n enc.condition = param\n ? enc.condition\n : {\n ...cond,\n test: normalizePredicate(enc.condition, normParams)\n };\n }\n }\n\n return enc;\n}\n\nfunction normalizeBinExtent(bin: BinParams): BinParams {\n const ext = bin.extent as any;\n if (ext?.selection) {\n const {selection: param, ...rest} = ext;\n return {...bin, extent: {...rest, param}};\n }\n\n return bin;\n}\n\nfunction normalizePredicate(op: any, normParams: NormalizerParams) {\n // Normalize old compositions of selection names (e.g., selection: {and: [\"one\", \"two\"]})\n const normalizeSelectionComposition = (o: LogicalComposition) => {\n return normalizeLogicalComposition(o, param => {\n const empty = normParams.emptySelections[param] ?? true;\n const pred = {param, empty};\n normParams.selectionPredicates[param] ??= [];\n normParams.selectionPredicates[param].push(pred);\n return pred as any;\n });\n };\n\n return op.selection\n ? normalizeSelectionComposition(op.selection)\n : normalizeLogicalComposition(op.test || op.filter, o =>\n o.selection ? normalizeSelectionComposition(o.selection) : o\n );\n}\n","import {isArray, isString} from 'vega';\nimport {Field} from '../channeldef';\nimport {VariableParameter} from '../parameter';\nimport {isSelectionParameter, SelectionParameter} from '../selection';\nimport {\n BaseSpec,\n isUnitSpec,\n NormalizedLayerSpec,\n NormalizedSpec,\n NormalizedUnitSpec,\n TopLevel,\n UnitSpec\n} from '../spec';\nimport {SpecMapper} from '../spec/map';\nimport {NormalizerParams} from './base';\n\nexport class TopLevelSelectionsNormalizer extends SpecMapper {\n public map(spec: TopLevel, normParams: NormalizerParams): TopLevel {\n const selections = normParams.selections ?? [];\n if (spec.params && !isUnitSpec(spec)) {\n const params: VariableParameter[] = [];\n for (const param of spec.params) {\n if (isSelectionParameter(param)) {\n selections.push(param);\n } else {\n params.push(param);\n }\n }\n\n spec.params = params;\n }\n\n normParams.selections = selections;\n return super.map(spec, normParams);\n }\n\n public mapUnit(spec: UnitSpec, normParams: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const selections = normParams.selections;\n if (!selections || !selections.length) return spec as NormalizedUnitSpec;\n\n const path = (normParams.path ?? []).concat(spec.name);\n const params: SelectionParameter[] = [];\n\n for (const selection of selections) {\n // By default, apply selections to all unit views.\n if (!selection.views || !selection.views.length) {\n params.push(selection);\n } else {\n for (const view of selection.views) {\n // view is either a specific unit name, or a partial path through the spec tree.\n if (\n (isString(view) && (view === spec.name || path.includes(view))) ||\n (isArray(view) &&\n // logic for backwards compatibility with view paths before we had unique names\n // @ts-ignore\n view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))\n ) {\n params.push(selection);\n }\n }\n }\n }\n\n if (params.length) spec.params = params;\n return spec as NormalizedUnitSpec;\n }\n}\n\nfor (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) {\n const proto = TopLevelSelectionsNormalizer.prototype[method];\n TopLevelSelectionsNormalizer.prototype[method] = function (spec: BaseSpec, params: NormalizerParams) {\n return proto.call(this, spec, addSpecNameToParams(spec, params));\n };\n}\n\nfunction addSpecNameToParams(spec: BaseSpec, params: NormalizerParams) {\n return spec.name\n ? {\n ...params,\n path: (params.path ?? []).concat(spec.name)\n }\n : params;\n}\n","import type {SignalRef} from 'vega';\nimport {isString} from 'vega-util';\nimport {Field} from '../channeldef';\nimport {Config, initConfig} from '../config';\nimport * as log from '../log';\nimport {\n FacetedUnitSpec,\n isLayerSpec,\n isUnitSpec,\n LayoutSizeMixins,\n NonNormalizedSpec,\n NormalizedSpec,\n RepeatSpec,\n TopLevelSpec\n} from '../spec';\nimport {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel';\nimport {deepEqual} from '../util';\nimport {NormalizerParams} from './base';\nimport {CoreNormalizer} from './core';\nimport {SelectionCompatibilityNormalizer} from './selectioncompat';\nimport {TopLevelSelectionsNormalizer} from './toplevelselection';\n\nexport function normalize(\n spec: TopLevelSpec & LayoutSizeMixins,\n config?: Config\n): TopLevel & LayoutSizeMixins {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n\n const normalizedSpec = normalizeGenericSpec(spec, config);\n\n const {width, height} = spec;\n const autosize = normalizeAutoSize(normalizedSpec, {width, height, autosize: spec.autosize}, config);\n\n return {\n ...normalizedSpec,\n ...(autosize ? {autosize} : {})\n };\n}\n\nconst coreNormalizer = new CoreNormalizer();\nconst selectionCompatNormalizer = new SelectionCompatibilityNormalizer();\nconst topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer();\n\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n * And push top-level selection definitions down to unit specs.\n */\nfunction normalizeGenericSpec(\n spec: NonNormalizedSpec | FacetedUnitSpec | RepeatSpec,\n config: Config = {}\n) {\n const normParams = {config};\n return topLevelSelectionNormalizer.map(\n coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams),\n normParams\n );\n}\n\nfunction _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) {\n return isString(autosize) ? {type: autosize} : autosize ?? {};\n}\n\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(\n spec: TopLevel,\n sizeInfo: {autosize: AutosizeType | AutoSizeParams} & LayoutSizeMixins,\n config?: Config\n) {\n let {width, height} = sizeInfo;\n\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault: AutoSizeParams = {};\n\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n } else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n } else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n } else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n\n const autosize: AutoSizeParams = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, {type: 'pad'})) {\n return undefined;\n }\n\n return autosize;\n}\n\nexport type {NormalizerParams};\n","import {Color, SignalRef} from 'vega';\nimport {BaseSpec} from '.';\nimport {getPositionScaleChannel} from '../channel';\nimport {signalRefOrValue} from '../compile/common';\nimport {Config} from '../config';\nimport {InlineDataset} from '../data';\nimport {ExprRef} from '../expr';\nimport {VariableParameter} from '../parameter';\nimport {TopLevelSelectionParameter} from '../selection';\nimport {Dict} from '../util';\n\n/**\n * @minimum 0\n */\nexport type Padding = number | {top?: number; bottom?: number; left?: number; right?: number};\n\nexport type Datasets = Dict;\n\nexport type TopLevelParameter = VariableParameter | TopLevelSelectionParameter;\n\nexport type TopLevel = S &\n TopLevelProperties & {\n /**\n * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v5.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.\n * @format uri\n */\n $schema?: string;\n\n /**\n * Vega-Lite configuration object. This property can only be defined at the top-level of a specification.\n */\n config?: Config;\n\n /**\n * A global data store for named datasets. This is a mapping from names to inline datasets.\n * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property.\n */\n datasets?: Datasets;\n\n /**\n * Optional metadata that will be passed to Vega.\n * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.\n */\n usermeta?: Dict;\n };\n\n/**\n * Shared properties between Top-Level specs and Config\n */\nexport interface TopLevelProperties {\n /**\n * CSS color property to use as the background of the entire view.\n *\n * __Default value:__ `\"white\"`\n */\n background?: Color | ES;\n\n /**\n * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\n * If an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n *\n * __Default value__: `5`\n */\n padding?: Padding | ES;\n\n /**\n * How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\n * Object values can additionally specify parameters for content sizing and automatic resizing.\n *\n * __Default value__: `pad`\n */\n autosize?: AutosizeType | AutoSizeParams; // Vega actually supports signal for autosize. However, we need to check autosize at compile time to infer the rest of the spec. Thus VL's autosize won't support SignalRef for now.\n\n /**\n * Dynamic variables or selections that parameterize a visualization.\n */\n params?: TopLevelParameter[];\n}\n\nexport type FitType = 'fit' | 'fit-x' | 'fit-y';\n\nexport function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\n\nexport function getFitType(sizeType?: 'width' | 'height'): FitType {\n return sizeType ? (`fit-${getPositionScaleChannel(sizeType)}` as FitType) : 'fit';\n}\n\nexport type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y';\n\nexport interface AutoSizeParams {\n /**\n * The sizing format type. One of `\"pad\"`, `\"fit\"`, `\"fit-x\"`, `\"fit-y\"`, or `\"none\"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each.\n *\n * __Default value__: `\"pad\"`\n */\n type?: AutosizeType;\n\n /**\n * A boolean flag indicating if autosize layout should be re-calculated on every view update.\n *\n * __Default value__: `false`\n */\n resize?: boolean;\n\n /**\n * Determines how size calculation should be performed, one of `\"content\"` or `\"padding\"`. The default setting (`\"content\"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `\"padding\"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view.\n *\n * __Default value__: `\"content\"`\n */\n contains?: 'content' | 'padding';\n}\n\nconst TOP_LEVEL_PROPERTIES: (keyof TopLevelProperties)[] = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\n\nexport function extractTopLevelProperties(t: TopLevelProperties, includeParams: boolean) {\n const o: TopLevelProperties = {};\n for (const p of TOP_LEVEL_PROPERTIES) {\n if (t && t[p] !== undefined) {\n o[p as any] = signalRefOrValue(t[p]);\n }\n }\n if (includeParams) {\n o.params = t.params;\n }\n return o;\n}\n","import * as log from '../log';\nimport {deepEqual, duplicate, getFirstDefined, keys} from '../util';\n\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {}\n ) {}\n\n public clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n\n public combine(): Partial {\n return {\n ...this.explicit, // Explicit properties comes first\n ...this.implicit\n };\n }\n\n public get(key: K): T[K] {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n\n public getWithExplicit(key: K): Explicit {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return {explicit: true, value: this.explicit[key]};\n } else if (this.implicit[key] !== undefined) {\n return {explicit: false, value: this.implicit[key]};\n }\n return {explicit: false, value: undefined};\n }\n\n public setWithExplicit(key: K, {value, explicit}: Explicit) {\n if (value !== undefined) {\n this.set(key, value, explicit);\n }\n }\n\n public set(key: K, value: T[K], explicit: boolean) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n\n public copyKeyFromSplit(key: keyof T, {explicit, implicit}: Split) {\n // Explicit has higher precedence\n if (explicit[key] !== undefined) {\n this.set(key, explicit[key], true);\n } else if (implicit[key] !== undefined) {\n this.set(key, implicit[key], false);\n }\n }\n public copyKeyFromObject(key: keyof T, s: Partial) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n public copyAll(other: Split) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\n\nexport interface Explicit {\n explicit: boolean;\n value: T;\n}\n\nexport function makeExplicit(value: T): Explicit {\n return {\n explicit: true,\n value\n };\n}\n\nexport function makeImplicit(value: T): Explicit {\n return {\n explicit: false,\n value\n };\n}\n\nexport type SplitParentProperty = 'scale' | 'axis' | 'legend' | '';\n\nexport function tieBreakByComparing(compare: (v1: T, v2: T) => number) {\n return (\n v1: Explicit,\n v2: Explicit,\n property: keyof S | never,\n propertyOf: SplitParentProperty\n ): Explicit => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n } else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\n\nexport function defaultTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\n\nexport function mergeValuesWithExplicit(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty,\n tieBreaker: (\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: string\n ) => Explicit = defaultTieBreaker\n) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n\n if (v1.explicit && !v2.explicit) {\n return v1;\n } else if (v2.explicit && !v1.explicit) {\n return v2;\n } else if (deepEqual(v1.value, v2.value)) {\n return v1;\n } else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n","import {Parse} from '../../data';\nimport {Dict} from '../../util';\nimport {Split} from '../split';\nimport {OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {SourceNode} from './source';\n\nexport interface DataComponent {\n /**\n * A list of unique sources.\n */\n sources: SourceNode[];\n\n /**\n * Registry of output nodes.\n */\n outputNodes: Dict;\n\n /**\n * How often is an output node used. If it is not used, we don't need to\n * instantiate it in the assemble step.\n */\n outputNodeRefCounts: Dict;\n\n /**\n * The output node before aggregation.\n */\n raw?: OutputNode;\n\n /**\n * The main output node.\n */\n main?: OutputNode;\n\n /**\n * For facets, we store the reference to the root node.\n */\n facetRoot?: FacetNode;\n\n /**\n * True if the data for this model is faceted.\n * A dataset is faceted if a parent model is a facet and no new dataset is\n * defined (which would make the data unfaceted again).\n */\n isFaceted: boolean;\n\n /**\n * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived.\n */\n ancestorParse?: AncestorParse;\n}\n\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public parseNothing = false\n ) {\n super(explicit, implicit);\n }\n\n public clone(): AncestorParse {\n const clone = super.clone() as AncestorParse;\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n","/*\n * Constants and utilities for data.\n */\nimport {Vector2} from 'vega';\nimport {FieldName} from './channeldef';\nimport {VgData} from './vega.schema';\n\nexport type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number';\n\nexport interface Parse {\n [field: string]: ParseValue;\n}\n\nexport interface DataFormatBase {\n /**\n * If set to `null`, disable type inference based on the spec and only use type inference based on the data.\n * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\n * For example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n *\n * For `\"date\"`, we parse data based using JavaScript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\n * For Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)\n */\n parse?: Parse | null;\n\n /**\n * Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n *\n * __Default value:__ The default format type is determined by the extension of the file URL.\n * If no extension is detected, `\"json\"` will be used by default.\n */\n type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson';\n}\n\nexport interface CsvDataFormat extends DataFormatBase {\n type?: 'csv' | 'tsv';\n}\n\nexport interface DsvDataFormat extends DataFormatBase {\n type?: 'dsv';\n\n /**\n * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.\n *\n * @minLength 1\n * @maxLength 1\n */\n delimiter: string;\n}\n\nexport interface JsonDataFormat extends DataFormatBase {\n type?: 'json';\n /**\n * The JSON property containing the desired data.\n * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data.\n * For example `\"property\": \"values.features\"` is equivalent to retrieving `json.values.features`\n * from the loaded JSON object.\n */\n property?: string;\n}\n\nexport interface TopoDataFormat extends DataFormatBase {\n type?: 'topojson';\n /**\n * The name of the TopoJSON object set to convert to a GeoJSON feature collection.\n * For example, in a map of the world, there may be an object set named `\"countries\"`.\n * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.\n */\n feature?: string;\n /**\n * The name of the TopoJSON object set to convert to mesh.\n * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set.\n * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features.\n * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.\n */\n mesh?: string;\n}\n\nexport type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat;\n\nexport type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson';\n\nexport type DataSource = UrlData | InlineData | NamedData;\n\nexport type Data = DataSource | Generator;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type InlineDataset = number[] | string[] | boolean[] | object[] | string | object;\n\nexport interface DataBase {\n /**\n * An object that specifies the format for parsing the data.\n */\n format?: DataFormat;\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface UrlData extends DataBase {\n /**\n * An URL from which to load the data set. Use the `format.type` property\n * to ensure the loaded data is correctly parsed.\n */\n url: string;\n}\n\nexport interface InlineData extends DataBase {\n /**\n * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string.\n * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type.\n */\n values: InlineDataset;\n}\n\nexport interface NamedData extends DataBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n *\n * New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set [autosize](https://vega.github.io/vega-lite/docs/size.html#autosize) or explicitly use [view.resize](https://vega.github.io/vega/docs/api/view/#view_resize).\n */\n name: string;\n}\n\nexport function isUrlData(data: Partial | Partial): data is UrlData {\n return 'url' in data;\n}\n\nexport function isInlineData(data: Partial | Partial): data is InlineData {\n return 'values' in data;\n}\n\nexport function isNamedData(data: Partial | Partial): data is NamedData {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\n\nexport function isGenerator(data: Partial | Partial): data is Generator {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\n\nexport function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator {\n return 'sequence' in data;\n}\n\nexport function isSphereGenerator(data: Partial | Partial): data is SphereGenerator {\n return 'sphere' in data;\n}\n\nexport function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator {\n return 'graticule' in data;\n}\n\nexport enum DataSourceType {\n Raw,\n Main,\n Row,\n Column,\n Lookup\n}\n\nexport type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator;\n\nexport interface GeneratorBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface SequenceGenerator extends GeneratorBase {\n /**\n * Generate a sequence of numbers.\n */\n sequence: SequenceParams;\n}\n\nexport interface SequenceParams {\n /**\n * The starting value of the sequence (inclusive).\n */\n start: number;\n /**\n * The ending value of the sequence (exclusive).\n */\n stop: number;\n /**\n * The step value between sequence entries.\n *\n * __Default value:__ `1`\n */\n step?: number;\n\n /**\n * The name of the generated sequence field.\n *\n * __Default value:__ `\"data\"`\n */\n as?: FieldName;\n}\n\nexport interface SphereGenerator extends GeneratorBase {\n /**\n * Generate sphere GeoJSON data for the full globe.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n sphere: true | {};\n}\n\nexport interface GraticuleGenerator extends GeneratorBase {\n /**\n * Generate graticule GeoJSON data for geographic reference lines.\n */\n graticule: true | GraticuleParams;\n}\n\nexport interface GraticuleParams {\n /**\n * The major extent of the graticule as a two-element array of coordinates.\n */\n extentMajor?: Vector2>;\n\n /**\n * The minor extent of the graticule as a two-element array of coordinates.\n */\n extentMinor?: Vector2>;\n\n /**\n * Sets both the major and minor extents to the same values.\n */\n extent?: Vector2>;\n\n /**\n * The major step angles of the graticule.\n *\n *\n * __Default value:__ `[90, 360]`\n */\n stepMajor?: Vector2;\n\n /**\n * The minor step angles of the graticule.\n *\n * __Default value:__ `[10, 10]`\n */\n stepMinor?: Vector2;\n\n /**\n * Sets both the major and minor step angles to the same values.\n */\n step?: Vector2;\n\n /**\n * The precision of the graticule in degrees.\n *\n * __Default value:__ `2.5`\n */\n precision?: number;\n}\n","import {Signal, SignalRef} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {identity, isArray, stringValue} from 'vega-util';\nimport {MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE, selectionCompilers} from '.';\nimport {dateTimeToExpr, isDateTime, dateTimeToTimestamp} from '../../datetime';\nimport {hasContinuousDomain} from '../../scale';\nimport {SelectionInit, SelectionInitInterval, ParameterExtent, SELECTION_ID} from '../../selection';\nimport {keys, replacePathInField, stringify, vals} from '../../util';\nimport {VgData, VgDomain} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {LayerModel} from '../layer';\nimport {isUnitModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {UnitModel} from '../unit';\nimport {parseSelectionExtent} from './parse';\nimport {SelectionProjection} from './project';\n\nexport function assembleProjection(proj: SelectionProjection) {\n const {signals, hasLegend, index, ...rest} = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n}\n\nexport function assembleInit(\n init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit,\n isExpr = true,\n wrap: (str: string | number) => string | number = identity\n): any {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n } else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n } else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(stringify(init)) : init;\n}\n\nexport function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`;\n\n for (const c of selectionCompilers) {\n if (!c.defined(selCmpt)) continue;\n if (c.signals) signals = c.signals(model, selCmpt, signals);\n if (c.modifyExpr) modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr);\n }\n\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: {signal: selCmpt.name + TUPLE},\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleFacetSignals(model: FacetModel, signals: Signal[]) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('pointermove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleTopLevelSignals(model: UnitModel, signals: Signal[]) {\n let hasSelections = false;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isPoint}`\n });\n }\n hasSelections = true;\n\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.topLevelSignals) {\n signals = c.topLevelSignals(model, selCmpt, signals);\n }\n }\n }\n\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{events: 'pointermove', update: 'isTuple(group()) ? group() : unit'}]\n });\n }\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[] {\n const dataCopy = [...data];\n const unit = unitName(model, {escape: false});\n\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const store: VgData = {name: selCmpt.name + STORE};\n\n if (selCmpt.project.hasSelectionId) {\n store.transform = [{type: 'collect', sort: {field: SELECTION_ID}}];\n }\n\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(assembleProjection);\n\n store.values = selCmpt.project.hasSelectionId\n ? selCmpt.init.map(i => ({unit, [SELECTION_ID]: assembleInit(i, false)[0]}))\n : selCmpt.init.map(i => ({unit, fields, values: assembleInit(i, false)}));\n }\n\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(store);\n }\n }\n\n return dataCopy;\n}\n\nexport function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[] {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.marks) {\n marks = c.marks(model, selCmpt, marks);\n }\n }\n }\n\n return marks;\n}\n\nexport function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[] {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n\n return marks;\n}\n\nexport function assembleSelectionScaleDomain(\n model: Model,\n extent: ParameterExtent,\n scaleCmpt: ScaleComponent,\n domain: VgDomain\n): SignalRef {\n const parsedExtent = parseSelectionExtent(model, extent.param, extent);\n\n return {\n signal:\n hasContinuousDomain(scaleCmpt.get('type')) && isArray(domain) && domain[0] > domain[1]\n ? `isValid(${parsedExtent}) && reverse(${parsedExtent})`\n : parsedExtent\n };\n}\n\nfunction cleanupEmptyOnArray(signals: Signal[]) {\n return signals.map(s => {\n if (s.on && !s.on.length) delete s.on;\n return s;\n });\n}\n","import {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Dict, uniqueId} from '../../util';\n\n/**\n * A node in the dataflow tree.\n */\nexport abstract class DataFlowNode {\n private _children: DataFlowNode[] = [];\n\n private _parent: DataFlowNode = null;\n\n protected _hash: string | number;\n\n constructor(\n parent: DataFlowNode,\n public readonly debugName?: string\n ) {\n if (parent) {\n this.parent = parent;\n }\n }\n\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n public clone(): DataFlowNode {\n throw new Error('Cannot clone node');\n }\n\n /**\n * Return a hash of the node.\n */\n public abstract hash(): string | number;\n\n /**\n * Set of fields that this node depends on.\n */\n public abstract dependentFields(): Set;\n\n /**\n * Set of fields that are being created by this node.\n */\n public abstract producedFields(): Set;\n\n get parent() {\n return this._parent;\n }\n\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent: DataFlowNode) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n\n get children() {\n return this._children;\n }\n\n public numChildren() {\n return this._children.length;\n }\n\n public addChild(child: DataFlowNode, loc?: number) {\n // do not add the same child twice\n if (this._children.includes(child)) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n } else {\n this._children.push(child);\n }\n }\n\n public removeChild(oldChild: DataFlowNode) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n\n /**\n * Remove node from the dataflow.\n */\n public remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n\n /**\n * Insert another node as a parent of this node.\n */\n public insertAsParentOf(other: DataFlowNode) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n\n public swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n const loc = parent.parent.removeChild(parent);\n\n // swap two nodes but maintain order in children\n this._parent = newParent;\n newParent.addChild(this, loc);\n\n parent.parent = this;\n }\n}\n\nexport class OutputNode extends DataFlowNode {\n private _source: string;\n\n private _name: string;\n\n public clone(): this {\n const cloneObj = new (this.constructor as any)();\n cloneObj.debugName = `clone_${this.debugName}`;\n cloneObj._source = this._source;\n cloneObj._name = `clone_${this._name}`;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(\n parent: DataFlowNode,\n source: string,\n public readonly type: DataSourceType,\n private readonly refCounts: Dict\n ) {\n super(parent, source);\n\n this._source = this._name = source;\n\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n public getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n\n public isRequired(): boolean {\n return !!this.refCounts[this._name];\n }\n\n public setSource(source: string) {\n this._source = source;\n }\n}\n","import {TimeUnitTransform as VgTimeUnitTransform} from 'vega';\nimport {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {FieldName, getBandPosition, vgField} from '../../channeldef';\nimport {\n TimeUnitParams,\n getDateTimePartAndStep,\n getSmallestTimeUnitPart,\n getTimeUnitParts,\n isBinnedTimeUnit,\n normalizeTimeUnit\n} from '../../timeunit';\nimport {TimeUnitTransform} from '../../transform';\nimport {Dict, duplicate, entries, hash, isEmpty, replacePathInField, vals} from '../../util';\nimport {ModelWithField, isUnitModel} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {isRectBasedMark} from '../../mark';\nimport {isXorY} from '../../channel';\n\nexport type TimeUnitComponent = (TimeUnitTransform | BinnedTimeUnitOffset) & {\n rectBandPosition?: number;\n};\n\nexport interface BinnedTimeUnitOffset {\n timeUnit: TimeUnitParams;\n field: FieldName;\n}\n\nfunction isTimeUnitTransformComponent(timeUnitComponent: TimeUnitComponent): timeUnitComponent is TimeUnitTransform {\n return (timeUnitComponent as TimeUnitTransform).as !== undefined;\n}\n\nfunction offsetAs(field: FieldName) {\n return `${field}_end`;\n}\n\nexport class TimeUnitNode extends DataFlowNode {\n public clone() {\n return new TimeUnitNode(null, duplicate(this.timeUnits));\n }\n\n constructor(\n parent: DataFlowNode,\n private timeUnits: Dict\n ) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef, channel) => {\n const {field, timeUnit} = fieldDef;\n\n if (timeUnit) {\n let component: TimeUnitComponent | undefined;\n\n if (isBinnedTimeUnit(timeUnit)) {\n // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs \"range\".\n\n if (isUnitModel(model)) {\n const {mark, markDef, config} = model;\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n if (isRectBasedMark(mark) || !!bandPosition) {\n component = {\n timeUnit: normalizeTimeUnit(timeUnit),\n field\n };\n }\n }\n } else {\n component = {\n as: vgField(fieldDef, {forAs: true}),\n field,\n timeUnit\n };\n }\n\n if (isUnitModel(model)) {\n const {mark, markDef, config} = model;\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) {\n component.rectBandPosition = bandPosition;\n }\n }\n\n if (component) {\n timeUnitComponent[hash(component)] = component;\n }\n }\n return timeUnitComponent;\n }, {} as Dict);\n\n if (isEmpty(formula)) {\n return null;\n }\n\n return new TimeUnitNode(parent, formula);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform) {\n const {timeUnit, ...other} = {...t};\n\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n public merge(other: TimeUnitNode) {\n this.timeUnits = {...this.timeUnits};\n\n // if the same hash happen twice, merge\n for (const key in other.timeUnits) {\n if (!this.timeUnits[key]) {\n // copy if it's not a duplicate\n this.timeUnits[key] = other.timeUnits[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n\n other.remove();\n }\n\n /**\n * Remove time units coming from the other node.\n */\n public removeFormulas(fields: Set) {\n const newFormula = {};\n\n for (const [key, timeUnitComponent] of entries(this.timeUnits)) {\n const fieldAs = isTimeUnitTransformComponent(timeUnitComponent)\n ? timeUnitComponent.as\n : `${timeUnitComponent.field}_end`;\n if (!fields.has(fieldAs)) {\n newFormula[key] = timeUnitComponent;\n }\n }\n\n this.timeUnits = newFormula;\n }\n\n public producedFields() {\n return new Set(\n vals(this.timeUnits).map(f => {\n return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field);\n })\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.timeUnits).map(f => f.field));\n }\n\n public hash() {\n return `TimeUnit ${hash(this.timeUnits)}`;\n }\n\n public assemble() {\n const transforms: (VgTimeUnitTransform | VgFormulaTransform)[] = [];\n\n for (const f of vals(this.timeUnits)) {\n const {rectBandPosition} = f;\n const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit);\n\n if (isTimeUnitTransformComponent(f)) {\n const {field, as} = f;\n const {unit, utc, ...params} = normalizedTimeUnit;\n\n const startEnd: [string, string] = [as, `${as}_end`];\n\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? {units: getTimeUnitParts(unit)} : {}),\n ...(utc ? {timezone: 'utc'} : {}),\n ...params,\n as: startEnd\n });\n\n transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit));\n } else if (f) {\n const {field: escapedField} = f;\n // since this is a expression, we want the unescaped field name\n const field = escapedField.replaceAll('\\\\.', '.');\n const expr = offsetExpr({timeUnit: normalizedTimeUnit, field});\n const endAs = offsetAs(field);\n transforms.push({\n type: 'formula',\n expr,\n as: endAs\n });\n\n transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit));\n }\n }\n\n return transforms;\n }\n}\n\nexport const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start';\nexport const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end';\n\nfunction offsetExpr({timeUnit, field, reverse}: {timeUnit: TimeUnitParams; field: string; reverse?: boolean}) {\n const {unit, utc} = timeUnit;\n const smallestUnit = getSmallestTimeUnitPart(unit);\n const {part, step} = getDateTimePartAndStep(smallestUnit, timeUnit.step);\n const offsetFn = utc ? 'utcOffset' : 'timeOffset';\n const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`;\n return expr;\n}\n\nfunction offsetedRectFormulas(\n [startField, endField]: [string, string],\n rectBandPosition: number | undefined,\n timeUnit: TimeUnitParams\n): VgFormulaTransform[] {\n if (rectBandPosition !== undefined && rectBandPosition !== 0.5) {\n const startExpr = `datum['${startField}']`;\n const endExpr = `datum['${endField}']`;\n return [\n {\n type: 'formula',\n expr: interpolateExpr(\n [\n offsetExpr({\n timeUnit,\n field: startField,\n reverse: true\n }),\n startExpr\n ],\n rectBandPosition + 0.5\n ),\n as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}`\n },\n {\n type: 'formula',\n expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}`\n }\n ];\n }\n return [];\n}\n\nfunction interpolateExpr([start, end]: [string, string], fraction: number) {\n return `${1 - fraction} * ${start} + ${fraction} * ${end}`;\n}\n","import {array, isObject} from 'vega-util';\nimport {\n GeoPositionChannel,\n getPositionChannelFromLatLong,\n isGeoPositionChannel,\n isScaleChannel,\n isSingleDefUnitChannel,\n SingleDefUnitChannel\n} from '../../channel';\nimport * as log from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {PointSelectionConfig, SelectionInitIntervalMapping, SelectionInitMapping, SELECTION_ID} from '../../selection';\nimport {Dict, hash, keys, varName, isEmpty} from '../../util';\nimport {TimeUnitComponent, TimeUnitNode} from '../data/timeunit';\nimport {SelectionCompiler} from '.';\nimport {assembleProjection} from './assemble';\nimport {isBinnedTimeUnit} from '../../timeunit';\nexport const TUPLE_FIELDS = '_tuple_fields';\n\n/**\n * Whether the selection tuples hold enumerated or ranged values for a field.\n */\nexport type TupleStoreType =\n // enumerated\n | 'E'\n // ranged, exclusive, left-right inclusive\n | 'R'\n // ranged, left-inclusive, right-exclusive\n | 'R-RE';\n\nexport interface SelectionProjection {\n type: TupleStoreType;\n field: string;\n index: number;\n channel?: SingleDefUnitChannel;\n geoChannel?: GeoPositionChannel;\n signals?: {data?: string; visual?: string};\n hasLegend?: boolean;\n}\n\nexport class SelectionProjectionComponent {\n public hasChannel: Partial>;\n public hasField: Record;\n public hasSelectionId: boolean;\n public timeUnit?: TimeUnitNode;\n public items: SelectionProjection[];\n\n constructor(...items: SelectionProjection[]) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n this.hasSelectionId = false;\n }\n}\n\nconst project: SelectionCompiler = {\n defined: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = (selCmpt.project ??= new SelectionProjectionComponent());\n const parsed: Dict = {};\n const timeUnits: Dict = {};\n\n const signals = new Set();\n const signalName = (p: SelectionProjection, range: 'data' | 'visual') => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return {[range]: sg};\n };\n\n const type = selCmpt.type;\n const cfg = model.config.selection[type];\n const init =\n selDef.value !== undefined\n ? (array(selDef.value as any) as SelectionInitMapping[] | SelectionInitIntervalMapping[])\n : null;\n\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n let {fields, encodings} = (isObject(selDef.select) ? selDef.select : {}) as PointSelectionConfig;\n if (!fields && !encodings && init) {\n for (const initVal of init) {\n // initVal may be a scalar value to smoothen varParam -> pointSelection gradient.\n if (!isObject(initVal)) {\n continue;\n }\n\n for (const key of keys(initVal)) {\n if (isSingleDefUnitChannel(key)) {\n (encodings || (encodings = [])).push(key as SingleDefUnitChannel);\n } else {\n if (type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_POS);\n encodings = cfg.encodings;\n } else {\n (fields ??= []).push(key);\n }\n }\n }\n }\n }\n\n // If no initial value is specified, use the default configuration.\n // We break this out as a separate if block (instead of an else condition)\n // to account for unprojected point selections that have scalar initial values\n if (!fields && !encodings) {\n encodings = cfg.encodings;\n if ('fields' in cfg) {\n fields = cfg.fields;\n }\n }\n\n for (const channel of encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n } else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n\n if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n\n timeUnits[hash(component)] = component;\n }\n\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n const tplType: TupleStoreType =\n type === 'interval' &&\n isScaleChannel(channel) &&\n hasContinuousDomain(model.getScaleComponent(channel).get('type'))\n ? 'R'\n : fieldDef.bin\n ? 'R-RE'\n : 'E';\n\n const p: SelectionProjection = {field, channel, type: tplType, index: proj.items.length};\n p.signals = {...signalName(p, 'data'), ...signalName(p, 'visual')};\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = parsed[field];\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n\n if (isGeoPositionChannel(channel)) {\n p.geoChannel = channel;\n p.channel = getPositionChannelFromLatLong(channel);\n proj.hasChannel[p.channel] = parsed[field];\n } else {\n proj.hasChannel[channel] = parsed[field];\n }\n }\n } else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n\n for (const field of fields ?? []) {\n if (proj.hasField[field]) continue;\n const p: SelectionProjection = {type: 'E', field, index: proj.items.length};\n p.signals = {...signalName(p, 'data')};\n proj.items.push(p);\n proj.hasField[field] = p;\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n }\n\n if (init) {\n selCmpt.init = (init as any).map((v: SelectionInitMapping | SelectionInitIntervalMapping) => {\n // Selections can be initialized either with a full object that maps projections to values\n // or scalar values to smoothen the abstraction gradient from variable params to point selections.\n return proj.items.map(p =>\n isObject(v) ? (v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field]) : v\n );\n });\n }\n\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0 || selCmpt.project.hasSelectionId\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(assembleProjection)\n });\n }\n};\n\nexport default project;\n","import {stringValue} from 'vega-util';\nimport {VL_SELECTION_RESOLVE} from '.';\nimport {isScaleChannel, ScaleChannel} from '../../channel';\nimport * as log from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {isLayerModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {SelectionProjection} from './project';\nimport {SelectionCompiler} from '.';\nimport {replacePathInField} from '../../util';\nimport {NewSignal} from 'vega';\n\nconst scaleBindings: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n\n parse: (model, selCmpt) => {\n const bound: SelectionProjection[] = (selCmpt.scales = []);\n\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n\n if (!isScaleChannel(channel)) {\n continue;\n }\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n\n scale.set('selectionExtent', {param: selCmpt.name, field: proj.field}, true);\n bound.push(proj);\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg: NewSignal = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound\n .map(proj => `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`)\n .join(', ')}}`;\n } else {\n for (const proj of bound) {\n const mapping = `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`;\n if (!update.includes(mapping)) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n\n return signals.concat(bound.map(proj => ({name: proj.signals.data})));\n },\n\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal: any = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n\n return signals;\n }\n};\n\nexport default scaleBindings;\n\nexport function domain(model: UnitModel, channel: ScaleChannel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\n\nfunction isTopLevelLayer(model: Model): boolean {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n","import {isObject, NewSignal, OnEvent, SignalValue, Stream} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, STORE, TUPLE, unitName} from '.';\nimport {GeoPositionChannel, LATITUDE, LONGITUDE, ScaleChannel, X, Y} from '../../channel';\nimport {FieldName} from '../../channeldef';\nimport {warn} from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {IntervalSelectionConfigWithoutType, SelectionInitInterval, SELECTION_ID} from '../../selection';\nimport {keys, vals} from '../../util';\nimport {LayoutSizeIndex} from '../layoutsize/component';\nimport {isUnitModel} from '../model';\nimport {UnitModel} from '../unit';\nimport {assembleInit} from './assemble';\nimport {SelectionProjection, TUPLE_FIELDS} from './project';\nimport scales from './scales';\n\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\nexport const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481\nconst INIT = '_init';\nconst CENTER = '_center';\n\n// Separate type because the \"fields\" property is only used internally and we don't want to leak it to the schema.\nexport type IntervalSelectionConfigWithField = IntervalSelectionConfigWithoutType & {fields?: FieldName[]};\n\nconst interval: SelectionCompiler<'interval'> = {\n defined: selCmpt => selCmpt.type === 'interval',\n\n parse: (model, selCmpt, selDef) => {\n if (model.hasProjection) {\n const def: IntervalSelectionConfigWithField = {...(isObject(selDef.select) ? selDef.select : {})};\n def.fields = [SELECTION_ID];\n if (!def.encodings) {\n // Remap default x/y projection\n def.encodings = selDef.value ? (keys(selDef.value) as GeoPositionChannel[]) : [LONGITUDE, LATITUDE];\n }\n\n selDef.select = {type: 'interval', ...def};\n }\n\n if (selCmpt.translate && !scales.defined(selCmpt)) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(selCmpt.name + BRUSH)}`;\n for (const evt of selCmpt.events) {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n continue;\n }\n\n const filters = array((evt.between[0].filter ??= []));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n }\n }\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const tupleSg = name + TUPLE;\n const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y);\n const init = selCmpt.init ? selCmpt.init[0] : null;\n\n signals.push(\n ...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), [])\n );\n\n if (!model.hasProjection) {\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!scales.defined(selCmpt)) {\n const triggerSg = name + SCALE_TRIGGER;\n const scaleTriggers = channels.map(proj => {\n const channel = proj.channel as 'x' | 'y';\n const {data: dname, visual: vname} = proj.signals;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n return (\n `(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`\n );\n });\n\n if (scaleTriggers.length) {\n signals.push({\n name: triggerSg,\n value: {},\n on: [\n {\n events: channels.map(proj => ({scale: model.scaleName(proj.channel)})),\n update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}`\n }\n ]\n });\n }\n }\n\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const dataSignals = channels.map(proj => proj.signals.data);\n const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`;\n return signals.concat({\n name: tupleSg,\n ...(init ? {init: `{${update}: ${assembleInit(init)}}`} : {}),\n ...(dataSignals.length\n ? {\n on: [\n {\n events: [{signal: dataSignals.join(' || ')}], // Prevents double invocation, see https://github.com/vega/vega/issues/1672.\n update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null`\n }\n ]\n }\n : {})\n });\n } else {\n const projection = stringValue(model.projectionName());\n const centerSg = model.projectionName() + CENTER;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const xinit = x ? init && init[x.index] : `${centerSg}[0]`;\n const yinit = y ? init && init[y.index] : `${centerSg}[1]`;\n const sizeSg = (layout: keyof LayoutSizeIndex) => model.getSizeSignalRef(layout).signal;\n const bbox =\n `[` +\n `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` +\n `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` +\n `${yvname ? yvname + '[1]' : sizeSg('height')}]` +\n `]`;\n\n if (init) {\n signals.unshift({\n name: name + INIT,\n init:\n `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` +\n `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]`\n });\n\n if (!x || !y) {\n // If initializing a uni-dimensional brush, use the center of the view to determine the other coord\n const hasCenterSg = signals.find(s => s.name === centerSg);\n if (!hasCenterSg) {\n signals.unshift({\n name: centerSg,\n update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])`\n });\n }\n }\n }\n\n const intersect = `intersect(${bbox}, {markname: ${stringValue(model.getName('marks'))}}, unit.mark)`;\n const base = `{unit: ${unitName(model)}}`;\n const update = `vlSelectionTuples(${intersect}, ${base})`;\n const visualSignals = channels.map(proj => proj.signals.visual);\n\n return signals.concat({\n name: tupleSg,\n on: [\n {\n events: [\n ...(visualSignals.length ? [{signal: visualSignals.join(' || ')}] : []),\n ...(init ? [{signal: GEO_INIT_TICK}] : [])\n ],\n update\n }\n ]\n });\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (isUnitModel(model) && model.hasProjection && selCmpt.init) {\n // Workaround for https://github.com/vega/vega/issues/3481\n // The scenegraph isn't populated on the first pulse. So we use a timer signal\n // to re-pulse the dataflow as soon as possible. We return an object to ensure\n // this only occurs once.\n const hasTick = signals.filter(s => s.name === GEO_INIT_TICK);\n if (!hasTick.length) {\n signals.unshift({\n name: GEO_INIT_TICK,\n value: null,\n on: [\n {\n events: 'timer{1}',\n update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}`\n }\n ]\n });\n }\n }\n\n return signals;\n },\n\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x?.signals.visual;\n const yvname = y?.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n\n // Do not add a brush if we're binding to scales\n // or we don't have a valid interval projection\n if (scales.defined(selCmpt) || (!x && !y)) {\n return marks;\n }\n\n const update: any = {\n x: x !== undefined ? {signal: `${xvname}[0]`} : {value: 0},\n y: y !== undefined ? {signal: `${yvname}[0]`} : {value: 0},\n x2: x !== undefined ? {signal: `${xvname}[1]`} : {field: {group: 'width'}},\n y2: y !== undefined ? {signal: `${yvname}[1]`} : {field: {group: 'height'}}\n };\n\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n {value: 0}\n ];\n }\n }\n\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const {fill, fillOpacity, cursor, ...stroke} = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n {value: null}\n ];\n return def;\n }, {});\n\n return [\n {\n name: `${name + BRUSH}_bg`,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: {value: fill},\n fillOpacity: {value: fillOpacity}\n },\n update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? {cursor: {value: cursor}} : {}),\n fill: {value: 'transparent'}\n },\n update: {...update, ...vgStroke}\n }\n }\n ];\n }\n};\nexport default interval;\n\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(\n model: UnitModel,\n selCmpt: SelectionComponent<'interval'>,\n proj: SelectionProjection,\n init: SelectionInitInterval\n): NewSignal[] {\n const scaledInterval = !model.hasProjection;\n const channel = proj.channel;\n const vname = proj.signals.visual;\n\n const scaleName = stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName());\n const scaled = (str: string) => `scale(${scaleName}, ${str})`;\n\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n const von = selCmpt.events.reduce((def: OnEvent[], evt: Stream) => {\n return [\n ...def,\n {events: evt.between[0], update: `[${coord}, ${coord}]`}, // Brush Start\n {events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]`} // Brush End\n ];\n }, []);\n\n if (scaledInterval) {\n const dname = proj.signals.data;\n const hasScales = scales.defined(selCmpt);\n const scale = model.getScaleComponent(channel as ScaleChannel);\n const scaleType = scale ? scale.get('type') : undefined;\n const vinit: SignalValue = init ? {init: assembleInit(init, true, scaled)} : {value: []};\n\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n von.push({\n events: {signal: selCmpt.name + SCALE_TRIGGER},\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n\n return hasScales\n ? [{name: dname, on: []}]\n : [\n {name: vname, ...vinit, on: von},\n {\n name: dname,\n ...(init ? {init: assembleInit(init)} : {}), // Cannot be `value` as `init` may require datetime exprs.\n on: [\n {\n events: {signal: vname},\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n } else {\n const initIdx = channel === X ? 0 : 1;\n const initSg = selCmpt.name + INIT;\n const vinit: SignalValue = init ? {init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]`} : {value: []};\n return [{name: vname, ...vinit, on: von}];\n }\n}\n","import {Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {SelectionCompiler, TUPLE, unitName} from '.';\nimport {SELECTION_ID} from '../../selection';\nimport {vals} from '../../util';\nimport {BRUSH} from './interval';\nimport {TUPLE_FIELDS} from './project';\n\nconst point: SelectionCompiler<'point'> = {\n defined: selCmpt => selCmpt.type === 'point',\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const brushes = vals(model.component.selection ?? {})\n .reduce((acc, cmpt) => {\n return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc;\n }, [])\n .map(b => `indexof(item().mark.name, '${b}') < 0`)\n .join(' && ');\n\n const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${\n brushes ? ` && ${brushes}` : ''\n }`;\n\n let update = `unit: ${unitName(model)}, `;\n\n if (selCmpt.project.hasSelectionId) {\n update += `${SELECTION_ID}: ${datum}[${stringValue(SELECTION_ID)}]`;\n } else {\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef?.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, {binSuffix: 'end'}))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n\n update += `fields: ${fieldsSg}, values: [${values}]`;\n }\n\n const events: Stream[] = selCmpt.events;\n return signals.concat([\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `${test} ? {${update}} : null`,\n force: true\n }\n ]\n : []\n }\n ]);\n }\n};\n\nexport default point;\n","import {array} from 'vega-util';\nimport {ChannelDef, ConditionalPredicate, isConditionalDef, isConditionalParameter} from '../../../channeldef';\nimport {GuideEncodingConditionalValueDef} from '../../../guide';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {expression} from '../../predicate';\nimport {parseSelectionPredicate} from '../../selection/parse';\nimport {UnitModel} from '../../unit';\n\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(\n model: UnitModel,\n channelDef: CD,\n vgChannel: string,\n refFn: (cDef: CD) => VgValueRef\n): VgEncodeEntry {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n if (isConditionalParameter(c)) {\n const {param, empty} = c;\n const test = parseSelectionPredicate(model, {param, empty});\n return {test, ...conditionValueRef};\n } else {\n const test = expression(model, (c as ConditionalPredicate).test); // FIXME: remove casting once TS is no longer dumb about it\n return {test, ...conditionValueRef};\n }\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n } else {\n return valueRef !== undefined ? {[vgChannel]: valueRef} : {};\n }\n}\n","import {getFormatMixins, isFieldOrDatumDef, isValueDef} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\n\nexport function textRef(\n channelDef: Encoding['text' | 'tooltip'],\n config: Config,\n expr: 'datum' | 'datum.datum' = 'datum'\n): VgValueRef {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const {format, formatType} = getFormatMixins(channelDef);\n return formatSignalRef({fieldOrDatumDef: channelDef, format, formatType, expr, config});\n }\n }\n return undefined;\n}\n","import {array, isArray, isObject, isString} from 'vega-util';\nimport {isBinned} from '../../../bin';\nimport {getMainRangeChannel, isXorY, Channel, THETA, RADIUS} from '../../../channel';\nimport {\n defaultTitle,\n getFieldDef,\n getFormatMixins,\n hasConditionalFieldDef,\n isFieldDef,\n isTypedFieldDef,\n SecondaryFieldDef,\n TypedFieldDef,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding, forEach} from '../../../encoding';\nimport {StackProperties} from '../../../stack';\nimport {entries} from '../../../util';\nimport {isSignalRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {binFormatExpression, formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\n\nexport function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)};\n } else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n\n if (markTooltip === true) {\n markTooltip = {content: 'encoding'};\n }\n\n if (isString(markTooltip)) {\n return {value: markTooltip};\n } else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n } else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n } else {\n return {signal: datum};\n }\n }\n\n return undefined;\n });\n }\n}\n\nexport function tooltipData(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const formatConfig = {...config, ...config.tooltipFormat};\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples: {channel: Channel; key: string; value: string}[] = [];\n\n function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) {\n const mainChannel = getMainRangeChannel(channel);\n\n const fieldDef: TypedFieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: (encoding[mainChannel] as TypedFieldDef).type // for secondary field def, copy type from main channel\n };\n\n const title = fieldDef.title || defaultTitle(fieldDef, formatConfig);\n const key = array(title).join(', ').replaceAll(/\"/g, '\\\\\"');\n\n let value: string;\n\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, {expr});\n const endField = vgField(fieldDef2, {expr});\n const {format, formatType} = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, formatConfig);\n toSkip[channel2] = true;\n }\n }\n\n if (\n (isXorY(channel) || channel === THETA || channel === RADIUS) &&\n stack &&\n stack.fieldChannel === channel &&\n stack.offset === 'normalize'\n ) {\n const {format, formatType} = getFormatMixins(fieldDef);\n value = formatSignalRef({\n fieldOrDatumDef: fieldDef,\n format,\n formatType,\n expr,\n config: formatConfig,\n normalizeStack: true\n }).signal;\n }\n\n value ??= textRef(fieldDef, formatConfig, expr).signal;\n\n tuples.push({channel, key, value});\n }\n\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n } else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n\n const out = {};\n for (const {channel, key, value} of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n\n return out;\n}\n\nexport function tooltipRefForEncoding(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const data = tooltipData(encoding, stack, config, {reactiveGeom});\n\n const keyValues = entries(data).map(([key, value]) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? {signal: `{${keyValues.join(', ')}}`} : undefined;\n}\n","import {entries, isEmpty} from '../../../util';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {VG_MARK_INDEX} from './../../../vega.schema';\nimport {UnitModel} from './../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\nimport {tooltipData} from './tooltip';\n\nexport function aria(model: UnitModel) {\n const {markDef, config} = model;\n\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n\n return {\n ...(enableAria ? {aria: enableAria} : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\n\nfunction ariaRoleDescription(model: UnitModel) {\n const {mark, markDef, config} = model;\n\n if (config.aria === false) {\n return {};\n }\n\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n\n if (ariaRoleDesc != null) {\n return {ariaRoleDescription: {value: ariaRoleDesc}};\n }\n\n return mark in VG_MARK_INDEX ? {} : {ariaRoleDescription: {value: mark}};\n}\n\nexport function description(model: UnitModel) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.description;\n\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n\n if (config.aria === false) {\n return {};\n }\n\n const data = tooltipData(encoding, stack, config);\n\n if (isEmpty(data)) {\n return undefined;\n }\n\n return {\n description: {\n signal: entries(data)\n .map(([key, value], index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n","import type {SignalRef} from 'vega';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport * as ref from './valueref';\n\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(\n channel: NonPositionScaleChannel,\n model: UnitModel,\n opt: {\n defaultValue?: Value | SignalRef;\n vgChannel?: VgEncodeChannel;\n defaultRef?: VgValueRef;\n } = {}\n): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {vgChannel} = opt;\n let {defaultRef, defaultValue} = opt;\n\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue ??= getMarkPropOrConfig(channel, markDef, config, {vgChannel, ignoreVgConfig: true});\n\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n\n const channelDef = encoding[channel];\n\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null, // No need to provide stack for non-position as it does not affect mid point\n defaultRef\n });\n });\n}\n","import * as log from '../../../log';\nimport {contains} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\n\nexport function color(model: UnitModel, opt: {filled: boolean | undefined} = {filled: undefined}): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {type: markType} = markDef;\n\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n\n const defaultFill =\n getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, {vgChannel: 'fill'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n\n const defaultStroke =\n getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, {vgChannel: 'stroke'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n\n const colorVgChannel = filled ? 'fill' : 'stroke';\n\n const fillStrokeMarkDefAndConfig: VgEncodeEntry = {\n ...(defaultFill ? {fill: signalOrValueRef(defaultFill)} : {}),\n ...(defaultStroke ? {stroke: signalOrValueRef(defaultStroke)} : {})\n };\n\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', {fill: 'fill' in markDef, stroke: 'stroke' in markDef}));\n }\n\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n","import {isValueDef} from '../../../channeldef';\nimport {isPathMark} from '../../../mark';\nimport {signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function zindex(model: UnitModel) {\n const {encoding, mark} = model;\n const order = encoding.order;\n\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value));\n }\n return {};\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport type {SignalRef} from 'vega';\nimport {PolarPositionChannel, PositionChannel} from '../../../channel';\nimport {Encoding} from '../../../encoding';\nimport {Mark, MarkDef} from '../../../mark';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {midPoint} from './valueref';\n\nexport interface Offset {\n offsetType?: 'visual' | 'encoding';\n offset?: number | VgValueRef;\n}\n\nexport function positionOffset({\n channel: baseChannel,\n markDef,\n encoding = {},\n model,\n bandPosition\n}: {\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n encoding?: Encoding;\n model?: UnitModel;\n bandPosition?: number;\n}): Offset {\n const channel = `${baseChannel}Offset` as\n | 'xOffset'\n | 'yOffset'\n | 'x2Offset'\n | 'y2Offset'\n | 'thetaOffset'\n | 'radiusOffset'\n | 'theta2Offset'\n | 'radius2Offset'; // Need to cast as the type can't be inferred automatically\n\n const defaultValue = markDef[channel];\n const channelDef = encoding[channel];\n\n if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) {\n const ref = midPoint({\n channel: channel,\n channelDef,\n markDef,\n config: model?.config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef: signalOrValueRef(defaultValue),\n bandPosition\n });\n return {offsetType: 'encoding', offset: ref};\n }\n\n const markDefOffsetValue = markDef[channel];\n if (markDefOffsetValue) {\n return {offsetType: 'visual', offset: markDefOffsetValue};\n }\n\n return {};\n}\n","import {\n getMainRangeChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef';\nimport {ScaleType} from '../../../scale';\nimport {contains} from '../../../util';\nimport {VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {positionOffset} from './offset';\nimport * as ref from './valueref';\n\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n vgChannel\n }: {\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n vgChannel?: 'x' | 'y' | 'xc' | 'yc';\n }\n) {\n const {encoding, markDef, config, stack} = model;\n\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n\n const {offset, offsetType} = positionOffset({\n channel,\n markDef,\n encoding,\n model,\n bandPosition: 0.5\n });\n\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n\n const valueRef =\n !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n {field: model.getName(channel)}\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition: offsetType === 'encoding' ? 0 : undefined\n });\n\n return valueRef ? {[vgChannel || channel]: valueRef} : undefined;\n}\n\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(\n params: ref.MidPointParams & {\n channel: 'x' | 'y' | 'radius' | 'theta';\n }\n): VgValueRef | VgValueRef[] {\n const {channel, channelDef, scaleName, stack, offset, markDef} = params;\n\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n let bandPosition = channelDef.bandPosition;\n\n if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) {\n // theta and radius of text mark should use bandPosition = 0.5 by default\n // so that labels for arc marks are centered automatically\n bandPosition = 0.5;\n }\n\n if (bandPosition !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type\n startSuffix: 'start',\n bandPosition,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'end'}, {offset});\n }\n\n return ref.midPointRefWithPositionInvalidTest(params);\n}\n\nexport function pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n}: {\n model: UnitModel;\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n channel: PositionChannel | PolarPositionChannel;\n scaleName: string;\n scale: ScaleComponent;\n}): () => VgValueRef {\n const {markDef, config} = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, {vgChannel});\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n } else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0};\n } else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return {signal: '2*PI'};\n case 'x':\n return {field: {group: 'width'}};\n case 'y':\n return {value: 0};\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return {...sizeRef, mult: 0.5};\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n","import {Align, SignalRef, TextBaseline} from 'vega';\nimport {getVgPositionChannel} from '../../../channel';\nimport {Config} from '../../../config';\nimport * as log from '../../../log';\nimport {Mark, MarkDef} from '../../../mark';\nimport {isSignalRef, VgEncodeChannel} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\n\nconst ALIGNED_X_CHANNEL: Record = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\n\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\n\nexport function vgAlignedPositionChannel(\n channel: 'x' | 'y' | 'radius' | 'theta',\n markDef: MarkDef,\n config: Config,\n defaultAlign: 'top' | 'middle' = 'middle'\n) {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n\n let alignExcludingSignal: Align | TextBaseline;\n\n if (isSignalRef(align)) {\n log.warn(log.message.rangeMarkAlignmentCannotBeExpression(alignChannel));\n alignExcludingSignal = undefined;\n } else {\n alignExcludingSignal = align;\n }\n\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')];\n } else {\n return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign];\n }\n}\n","import type {SignalRef} from 'vega';\nimport {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel';\nimport {isFieldOrDatumDef} from '../../../channeldef';\nimport * as log from '../../../log';\nimport {isRelativeBandSize, Mark, MarkConfig, MarkDef} from '../../../mark';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkStyleConfig} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {positionOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPosition, pointPositionDefaultRef} from './position-point';\nimport * as ref from './valueref';\n\n/**\n * Utility for area/rule position, which can be either point or range.\n * (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(\n channel: 'x' | 'y',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2,\n range\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n range: boolean;\n }\n) {\n if (range) {\n return rangePosition(channel, model, {defaultPos, defaultPos2});\n }\n return pointPosition(channel, model, {defaultPos});\n}\n\nexport function rangePosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n }\n): VgEncodeEntry {\n const {markDef, config} = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n\n return {\n ...pointPosition(channel, model, {defaultPos, vgChannel}),\n ...pos2Mixins\n };\n}\n\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(\n model: UnitModel,\n defaultPos: 'zeroOrMin' | 'zeroOrMax',\n channel: 'x2' | 'y2' | 'radius2' | 'theta2'\n) {\n const {encoding, mark, markDef, stack, config} = model;\n\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n\n const {offset} =\n channel in encoding || channel in markDef\n ? positionOffset({channel, markDef, encoding, model})\n : positionOffset({channel: baseChannel, markDef, encoding, model});\n\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n const vgSizeChannel = getSizeChannel(channel);\n\n const size = model.markDef[vgSizeChannel];\n if (size != null) {\n return {\n [vgSizeChannel]: {value: size}\n };\n } else {\n return {\n [vgChannel]: {field: model.getName(channel)}\n };\n }\n }\n\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n\n if (valueRef !== undefined) {\n return {[vgChannel]: valueRef};\n }\n\n // TODO: check width/height encoding here once we add them\n\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n\n return (\n position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n }\n );\n}\n\nexport function position2Ref({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n}: ref.MidPointParams & {\n channel: 'x2' | 'y2' | 'radius2' | 'theta2';\n}): VgValueRef | VgValueRef[] {\n if (\n isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)\n ) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'start'}, {offset});\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\n\nfunction position2orSize(\n channel: 'x2' | 'y2' | 'radius2' | 'theta2',\n markDef: MarkConfig | MarkDef\n) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel])};\n } else if (markDef[channel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])};\n } else if (markDef[sizeChannel]) {\n const dimensionSize = markDef[sizeChannel];\n if (isRelativeBandSize(dimensionSize)) {\n log.warn(log.message.relativeBandSizeNotSupported(sizeChannel));\n } else {\n return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize)};\n }\n }\n return undefined;\n}\n","import type {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../../bin';\nimport {\n getOffsetChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isPolarPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBandPosition, getBandSize, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef';\nimport {Config, getViewConfigDiscreteStep} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport * as log from '../../../log';\nimport {BandSize, isRelativeBandSize} from '../../../mark';\nimport {hasDiscreteDomain} from '../../../scale';\nimport {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, signalOrStringValue, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\nimport {positionOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPositionDefaultRef} from './position-point';\nimport {rangePosition} from './position-range';\nimport * as ref from './valueref';\nimport {getOffsetScaleChannel} from '../../../channel';\nimport {getFirstDefined} from '../../../util';\nimport {Mark} from '../../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from '../../data/timeunit';\n\nexport function rectPosition(model: UnitModel, channel: 'x' | 'y' | 'theta' | 'radius'): VgEncodeEntry {\n const {config, encoding, markDef} = model;\n const mark = markDef.type;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n const orient = markDef.orient;\n const hasSizeDef =\n encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, {vgChannel: sizeChannel});\n\n const offsetScaleChannel = getOffsetChannel(channel);\n\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n\n // x, x2, and width -- we must specify two of these in all conditions\n if (\n isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) &&\n !encoding[offsetScaleChannel] &&\n !hasDiscreteDomain(scaleType)\n ) {\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n model\n });\n } else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(channelDef, channel, model);\n } else {\n return rangePosition(channel, model, {defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin'});\n }\n}\n\nfunction defaultSizeRef(\n sizeChannel: 'width' | 'height',\n scaleName: string,\n scale: ScaleComponent,\n config: Config,\n bandSize: BandSize,\n hasFieldDef: boolean,\n mark: Mark\n): VgValueRef {\n if (isRelativeBandSize(bandSize)) {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'band') {\n let bandWidth = `bandwidth('${scaleName}')`;\n if (bandSize.band !== 1) {\n bandWidth = `${bandSize.band} * ${bandWidth}`;\n }\n const minBandSize = getMarkConfig('minBandSize', {type: mark}, config);\n return {signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth};\n } else if (bandSize.band !== 1) {\n log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType));\n bandSize = undefined;\n }\n } else {\n return {\n mult: bandSize.band,\n field: {group: sizeChannel}\n };\n }\n } else if (isSignalRef(bandSize)) {\n return bandSize;\n } else if (bandSize) {\n return {value: bandSize};\n }\n\n // no valid band size\n if (scale) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return {value: scaleRange.step - 2};\n }\n }\n if (!hasFieldDef) {\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner} = config.scale;\n const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts\n if (isSignalRef(padding)) {\n return {signal: `(1 - (${padding.signal})) * ${sizeChannel}`};\n } else if (isNumber(padding)) {\n return {signal: `${1 - padding} * ${sizeChannel}`};\n }\n }\n const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel);\n return {value: defaultStep - 2};\n}\n\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(\n fieldDef: Encoding['x' | 'y' | 'theta' | 'radius'],\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel\n) {\n const {markDef, encoding, config, stack} = model;\n const orient = markDef.orient;\n\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n\n const offsetScaleChannel = getOffsetChannel(channel);\n const offsetScaleName = model.scaleName(offsetScaleChannel);\n const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel));\n\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || markDef.size) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {\n vgChannel: vgSizeChannel,\n defaultRef: signalOrValueRef(markDef.size)\n });\n } else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n const hasSizeFromMarkOrEncoding = !!sizeMixins;\n\n // Otherwise, apply default value\n const bandSize = getBandSize({\n channel,\n fieldDef,\n markDef,\n config,\n scaleType: (scale || offsetScale)?.get('type'),\n useVlSizeChannel\n });\n\n sizeMixins = sizeMixins || {\n [vgSizeChannel]: defaultSizeRef(\n vgSizeChannel,\n offsetScaleName || scaleName,\n offsetScale || scale,\n config,\n bandSize,\n !!fieldDef,\n markDef.type\n )\n };\n\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n\n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n\n const defaultBandAlign =\n (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding\n ? 'top'\n : 'middle';\n\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign);\n const center = vgChannel === 'xc' || vgChannel === 'yc';\n const {offset, offsetType} = positionOffset({channel, markDef, encoding, model, bandPosition: center ? 0.5 : 0});\n\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}),\n bandPosition: center\n ? offsetType === 'encoding'\n ? 0\n : 0.5\n : isSignalRef(bandSize)\n ? {signal: `(1-${bandSize})/2`}\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0\n });\n\n if (vgSizeChannel) {\n return {[vgChannel]: posRef, ...sizeMixins};\n } else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? {...sizeRef, offset} : sizeRef;\n return {\n [vgChannel]: posRef,\n\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], {...posRef[1], offset: sizeOffset}]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\n\nfunction getBinSpacing(\n channel: PositionChannel | PolarPositionChannel,\n spacing: number,\n reverse: boolean | SignalRef,\n axisTranslate: number | SignalRef,\n offset: number | VgValueRef,\n minBandSize: number | SignalRef,\n bandSizeExpr: string\n) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n\n const isEnd = channel === 'x' || channel === 'y2';\n\n const spacingOffset = isEnd ? -spacing / 2 : spacing / 2;\n\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const axisTranslateExpr = signalOrStringValue(axisTranslate);\n const minBandSizeExpr = signalOrStringValue(minBandSize);\n\n const sign = isEnd ? '' : '-';\n\n const spacingAndSizeOffset = minBandSize\n ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})`\n : spacingOffset;\n\n const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset;\n\n return {\n signal: t + r + o\n };\n } else {\n offset = offset || 0;\n return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\n\nfunction rectBinPosition({\n fieldDef,\n fieldDef2,\n channel,\n model\n}: {\n fieldDef: TypedFieldDef;\n fieldDef2?: Encoding['x2' | 'y2'];\n channel: 'x' | 'y' | 'theta' | 'radius';\n model: UnitModel;\n}) {\n const {config, markDef, encoding} = model;\n\n const scale = model.getScaleComponent(channel);\n const scaleName = model.scaleName(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const reverse = scale.get('reverse');\n\n const bandSize = getBandSize({channel, fieldDef, markDef, config, scaleType});\n\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n\n const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n const minBandSize = getMarkConfig('minBandSize', markDef, config);\n\n const {offset} = positionOffset({channel, markDef, encoding, model, bandPosition: 0});\n const {offset: offset2} = positionOffset({channel: channel2, markDef, encoding, model, bandPosition: 0});\n\n const bandSizeExpr = ref.binSizeExpr({fieldDef, scaleName});\n const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr);\n const binSpacingOffset2 = getBinSpacing(\n channel2,\n spacing,\n reverse,\n axisTranslate,\n offset2 ?? offset,\n minBandSize,\n bandSizeExpr\n );\n\n const bandPositionForBandSize = isSignalRef(bandSize)\n ? {signal: `(1-${bandSize.signal})/2`}\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0.5;\n\n const bandPosition = getBandPosition({fieldDef, fieldDef2, markDef, config});\n\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5;\n\n return {\n [vgChannel2]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: bandPositionForBandSize,\n offset: binSpacingOffset2,\n useRectOffsetField\n }),\n [vgChannel]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: isSignalRef(bandPositionForBandSize)\n ? {signal: `1-${bandPositionForBandSize.signal}`}\n : 1 - bandPositionForBandSize,\n offset: binSpacingOffset,\n useRectOffsetField\n })\n };\n } else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, {offset: binSpacingOffset2});\n\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, {offset: binSpacingOffset})\n };\n } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, {expr: 'datum'})} + ${fieldDef.bin.step})`,\n offset: binSpacingOffset\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n\n/**\n * Value Ref for binned fields\n */\nfunction rectBinRef({\n fieldDef,\n scaleName,\n bandPosition,\n offset,\n useRectOffsetField\n}: {\n fieldDef: TypedFieldDef;\n scaleName: string;\n bandPosition: number | SignalRef;\n offset?: number | SignalRef;\n useRectOffsetField: boolean;\n}) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n bandPosition,\n offset,\n ...(useRectOffsetField\n ? {\n startSuffix: OFFSETTED_RECT_START_SUFFIX,\n endSuffix: OFFSETTED_RECT_END_SUFFIX\n }\n : {})\n });\n}\n","import {array} from 'vega-util';\nimport {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel';\nimport {isPathMark, MarkDef} from '../../../mark';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {aria} from './aria';\nimport {color} from './color';\nimport {nonPosition} from './nonposition';\nimport {text} from './text';\nimport {tooltip} from './tooltip';\nimport {fieldInvalidPredicate} from './valueref';\nimport {zindex} from './zindex';\n\nexport {color} from './color';\nexport {wrapCondition} from './conditional';\nexport {nonPosition} from './nonposition';\nexport {pointPosition} from './position-point';\nexport {pointOrRangePosition, rangePosition} from './position-range';\nexport {rectPosition} from './position-rect';\nexport {text} from './text';\nexport {tooltip} from './tooltip';\n\nexport type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>;\n\nconst ALWAYS_IGNORE = new Set(['aria', 'width', 'height']);\n\nexport function baseEncodeEntry(model: UnitModel, ignore: Ignore) {\n const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS});\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n {test, value: null},\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? {[channel]: valueRef} : {};\n}\n\nfunction markDefProperties(mark: MarkDef, ignore: Ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n","import {POSITION_SCALE_CHANNELS} from '../../../channel';\nimport {ScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {fieldInvalidPredicate} from './valueref';\n\nexport function defined(model: UnitModel): VgEncodeEntry {\n const {config, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS});\n\n if (signal) {\n return {defined: {signal}};\n }\n }\n return {};\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n\nexport function valueIfDefined(prop: string, value: Value): VgEncodeEntry {\n if (value !== undefined) {\n return {[prop]: signalOrValueRef(value)};\n }\n return undefined;\n}\n","import * as log from '../../log';\nimport {isPathMark} from '../../mark';\nimport {tooltip} from '../mark/encode';\nimport {SelectionCompiler} from '.';\n\nconst VORONOI = 'voronoi';\n\nconst nearest: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && selCmpt.nearest;\n },\n\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n\n marks: (model, selCmpt, marks) => {\n const {x, y} = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: {data: model.getName('marks')},\n encode: {\n update: {\n fill: {value: 'transparent'},\n strokeWidth: {value: 0.35},\n stroke: {value: 'transparent'},\n isVoronoi: {value: true},\n ...tooltip(model, {reactiveGeom: true})\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: {expr: x || !y ? 'datum.datum.x || 0' : '0'},\n y: {expr: y || !x ? 'datum.datum.y || 0' : '0'},\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n } else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n\n return marks;\n }\n};\n\nexport default nearest;\n","import {stringValue} from 'vega-util';\nimport {disableDirectManipulation, TUPLE} from '.';\nimport {varName} from '../../util';\nimport {assembleInit} from './assemble';\nimport nearest from './nearest';\nimport {TUPLE_FIELDS} from './project';\nimport {SelectionCompiler} from '.';\nimport {isLegendBinding} from '../../selection';\nimport {NewSignal} from 'vega';\n\nconst inputBindings: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return (\n selCmpt.type === 'point' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind)\n );\n },\n\n parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef),\n\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? {init: assembleInit(init[i])} : {value: null}),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal: NewSignal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n\n delete signal.value;\n delete signal.on;\n\n return signals;\n }\n};\n\nexport default inputBindings;\n","import {TUPLE, unitName} from '.';\nimport {SelectionCompiler} from '.';\n\nexport const TOGGLE = '_toggle';\n\nconst toggle: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && !!selCmpt.toggle;\n },\n\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{events: selCmpt.events, update: selCmpt.toggle}]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n\n return (\n `${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`\n );\n }\n};\n\nexport default toggle;\n","import {Update} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {isString} from 'vega-util';\nimport {TUPLE} from '.';\nimport {varName} from '../../util';\nimport inputBindings from './inputs';\nimport toggle, {TOGGLE} from './toggle';\nimport {SelectionCompiler} from '.';\n\nconst clear: SelectionCompiler = {\n defined: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n\n parse: (model, selCmpt) => {\n if (selCmpt.clear) {\n selCmpt.clear = isString(selCmpt.clear) ? parseSelector(selCmpt.clear, 'view') : selCmpt.clear;\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.defined(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({events: selCmpt.clear, update: 'null'});\n }\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n function addClear(idx: number, update: Update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({events: selCmpt.clear, update});\n }\n }\n\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n } else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n\n if (toggle.defined(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n\n return signals;\n }\n};\n\nexport default clear;\n","import {isObject, MergedStream, NewSignal, Stream} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {array, isString} from 'vega-util';\nimport {disableDirectManipulation, TUPLE} from '.';\nimport {NonPositionScaleChannel} from '../../channel';\nimport * as log from '../../log';\nimport {isLegendBinding, isLegendStreamBinding, SELECTION_ID} from '../../selection';\nimport {duplicate, vals, varName} from '../../util';\nimport {LegendComponent} from '../legend/component';\nimport {UnitModel} from '../unit';\nimport {TUPLE_FIELDS} from './project';\nimport {TOGGLE} from './toggle';\nimport {SelectionCompiler} from '.';\n\nconst legendBindings: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n\n return spec && projLen;\n },\n\n parse: (model, selCmpt, selDef) => {\n // Allow legend items to be toggleable by default even though direct manipulation is disabled.\n const selDef_ = duplicate(selDef);\n selDef_.select = isString(selDef_.select)\n ? {type: selDef_.select, toggle: selCmpt.toggle}\n : {...selDef_.select, toggle: selCmpt.toggle};\n disableDirectManipulation(selCmpt, selDef_);\n\n if (isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (!evt.filter.includes(legendFilter)) {\n evt.filter.push(legendFilter);\n }\n }\n }\n\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream: Stream[] = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = {legend: {merge: stream}};\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && (selCmpt.bind.legend as MergedStream);\n const markName = (name: string) => (s: Stream) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend) continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? {value: null} : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {\n events,\n update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value',\n force: true\n },\n {events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true}\n ]\n });\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple: NewSignal = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({signal})),\n update\n });\n } else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events) toggle.on[0].events = events;\n else toggle.on.push({...toggle.on[0], events});\n }\n\n return signals;\n }\n};\n\nexport default legendBindings;\n\nexport function parseInteractiveLegend(\n model: UnitModel,\n channel: NonPositionScaleChannel,\n legendCmpt: LegendComponent\n) {\n const field = model.fieldDef(channel)?.field;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.defined(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n }\n}\n","import {NewSignal} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {SelectionComponent} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {UnitModel} from '../unit';\nimport {BRUSH as INTERVAL_BRUSH} from './interval';\nimport {SelectionProjection} from './project';\nimport scalesCompiler, {domain} from './scales';\nimport {SelectionCompiler} from '.';\n\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\n\nconst translate: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const anchor = name + ANCHOR;\n const {x, y} = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n\n if (!boundScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update:\n '{x: x(unit), y: y(unit)' +\n (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') +\n (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') +\n '}'\n }\n ]\n },\n {\n name: name + DELTA,\n value: {},\n on: [\n {\n events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default translate;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel as ScaleChannel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort\n const sign = !boundScales ? '' : channel === X ? (reversed ? '' : '-') : reversed ? '-' : '';\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`;\n const panFn =\n !boundScales || !scaleCmpt\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'symlog'\n ? 'panSymlog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${panFn}(${extent}, ${offset}${arg})`;\n\n signal.on.push({\n events: {signal: delta},\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {stringValue} from 'vega-util';\nimport {SelectionComponent} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {UnitModel} from '../unit';\nimport {BRUSH as INTERVAL_BRUSH} from './interval';\nimport {SelectionProjection} from './project';\nimport {default as scalesCompiler, domain} from './scales';\nimport {SelectionCompiler} from '.';\n\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\n\nconst zoom: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const delta = name + DELTA;\n const {x, y} = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n\n if (!boundScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: name + ANCHOR,\n on: [\n {\n events,\n update: !boundScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => expr)\n .join(', ') +\n '}'\n }\n ]\n },\n {\n name: delta,\n on: [\n {\n events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default zoom;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const channel = proj.channel as ScaleChannel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const base = boundScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn =\n !boundScales || !scaleCmpt\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'symlog'\n ? 'zoomSymlog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`;\n\n signal.on.push({\n events: {signal: delta},\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {Binding, isString, Signal, Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {FACET_CHANNELS} from '../../channel';\nimport {\n BrushConfig,\n LegendBinding,\n SelectionInit,\n SelectionInitInterval,\n SelectionResolution,\n SelectionType\n} from '../../selection';\nimport {Dict, vals} from '../../util';\nimport {OutputNode} from '../data/dataflow';\nimport {FacetModel} from '../facet';\nimport {isFacetModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport interval from './interval';\nimport point from './point';\nimport {SelectionProjection, SelectionProjectionComponent} from './project';\nimport {SelectionParameter} from '../../selection';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\nimport {ParameterName} from '../../parameter';\n\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n\nexport interface SelectionComponent {\n name: ParameterName;\n type: T;\n // Use conditional types for stricter type of init (as the type of init depends on selection type).\n init?: (T extends 'interval' ? SelectionInitInterval : T extends 'point' ? SelectionInit : never)[][];\n events: Stream[];\n materialized: OutputNode;\n bind?: 'scales' | Binding | Dict | LegendBinding;\n resolve: SelectionResolution;\n mark?: BrushConfig;\n project: SelectionProjectionComponent;\n scales?: SelectionProjection[];\n toggle?: string;\n translate?: any;\n zoom?: any;\n nearest?: any;\n clear?: any;\n}\n\nexport interface SelectionCompiler {\n defined: (selCmpt: SelectionComponent) => boolean;\n parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionParameter) => void;\n signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: Signal[]) => Signal[];\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: Signal[]) => Signal[];\n modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\n// Order matters for parsing and assembly.\nexport const selectionCompilers: SelectionCompiler[] = [\n point,\n interval,\n project,\n toggle,\n\n // Bindings may disable direct manipulation.\n inputs,\n scales,\n legends,\n\n clear,\n translate,\n zoom,\n nearest\n];\n\nfunction getFacetModel(model: Model): FacetModel {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent)) break;\n parent = parent.parent;\n }\n\n return parent as FacetModel;\n}\n\nexport function unitName(model: Model, {escape} = {escape: true}) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const {facet} = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\n\nexport function requiresSelectionId(model: Model) {\n return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => {\n return identifier || selCmpt.project.hasSelectionId;\n }, false);\n}\n\n// Binding a point selection to query widgets or legends disables default direct manipulation interaction.\n// A user can choose to re-enable it by explicitly specifying triggering input events.\nexport function disableDirectManipulation(selCmpt: SelectionComponent, selDef: SelectionParameter<'point'>) {\n if (isString(selDef.select) || !selDef.select.on) delete selCmpt.events;\n if (isString(selDef.select) || !selDef.select.clear) delete selCmpt.clear;\n if (isString(selDef.select) || !selDef.select.toggle) delete selCmpt.toggle;\n}\n","import {parseExpression} from 'vega-expression';\n\nfunction getName(node: any) {\n const name: string[] = [];\n\n if (node.type === 'Identifier') {\n return [node.name];\n }\n\n if (node.type === 'Literal') {\n return [node.value];\n }\n\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n\n return name;\n}\n\nfunction startsWithDatum(node: any): boolean {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\n\nexport function getDependentFields(expression: string) {\n const ast = parseExpression(expression);\n const dependents = new Set();\n // visit is missing in types https://github.com/vega/vega/issues/3298\n (ast as any).visit((node: any) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n\n return dependents;\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {LogicalComposition} from '../../logical';\nimport {Predicate} from '../../predicate';\nimport {duplicate} from '../../util';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class FilterNode extends DataFlowNode {\n private expr: string;\n private _dependentFields: Set;\n public clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly model: Model,\n private readonly filter: LogicalComposition\n ) {\n super(parent);\n\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n\n this._dependentFields = getDependentFields(this.expr);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public assemble(): VgFilterTransform {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n\n public hash() {\n return `Filter ${this.expr}`;\n }\n}\n","import {parseSelector} from 'vega-event-selector';\nimport {array, isObject, isString, stringValue} from 'vega-util';\nimport {selectionCompilers, SelectionComponent, STORE} from '.';\nimport {warn} from '../../log';\nimport {BaseSelectionConfig, SelectionParameter, ParameterExtent} from '../../selection';\nimport {Dict, duplicate, entries, replacePathInField, varName} from '../../util';\nimport {DataFlowNode, OutputNode} from '../data/dataflow';\nimport {FilterNode} from '../data/filter';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataSourceType} from '../../data';\nimport {ParameterPredicate} from '../../predicate';\n\nexport function parseUnitSelection(model: UnitModel, selDefs: SelectionParameter[]) {\n const selCmpts: Dict> = {};\n const selectionConfig = model.config.selection;\n\n if (!selDefs || !selDefs.length) return selCmpts;\n\n for (const def of selDefs) {\n const name = varName(def.name);\n const selDef = def.select;\n const type = isString(selDef) ? selDef : selDef.type;\n const defaults: BaseSelectionConfig = isObject(selDef) ? duplicate(selDef) : {type};\n\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n const cfg = selectionConfig[type];\n for (const key in cfg) {\n // Project transform applies its defaults.\n if (key === 'fields' || key === 'encodings') {\n continue;\n }\n\n if (key === 'mark') {\n defaults[key] = {...cfg[key], ...defaults[key]};\n }\n\n if (defaults[key] === undefined || defaults[key] === true) {\n defaults[key] = duplicate(cfg[key] ?? defaults[key]);\n }\n }\n\n const selCmpt: SelectionComponent = (selCmpts[name] = {\n ...defaults,\n name,\n type,\n init: def.value,\n bind: def.bind,\n events: isString(defaults.on) ? parseSelector(defaults.on, 'scope') : array(duplicate(defaults.on))\n } as any);\n\n const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.parse) {\n c.parse(model, selCmpt, def_);\n }\n }\n }\n\n return selCmpts;\n}\n\nexport function parseSelectionPredicate(\n model: Model,\n pred: ParameterPredicate,\n dfnode?: DataFlowNode,\n datum = 'datum'\n): string {\n const name = isString(pred) ? pred : pred.param;\n const vname = varName(name);\n const store = stringValue(vname + STORE);\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n } catch (e) {\n // If a selection isn't found, treat as a variable parameter and coerce to boolean.\n return `!!${vname}`;\n }\n\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n } else {\n child.parent = tunode;\n }\n }\n\n const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest(';\n const resolve = selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`;\n const test = `${fn}${store}, ${datum}${resolve}`;\n const length = `length(data(${store}))`;\n\n return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`;\n}\n\nexport function parseSelectionExtent(model: Model, name: string, extent: ParameterExtent) {\n const vname = varName(name);\n const encoding = extent['encoding'];\n let field = extent['field'];\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n } catch (e) {\n // If a selection isn't found, treat it as a variable parameter.\n return vname;\n }\n\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn(\n 'A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`\n );\n }\n } else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn(\n (!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.param)}. ` +\n `Using \"field\": ${stringValue(field)}.`\n );\n } else {\n field = encodings[0].field;\n }\n }\n\n return `${selCmpt.name}[${stringValue(replacePathInField(field))}]`;\n}\n\nexport function materializeSelections(model: UnitModel, main: OutputNode) {\n for (const [selection, selCmpt] of entries(model.component.selection ?? {})) {\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(\n new FilterNode(main, model, {param: selection}),\n lookupName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n }\n}\n","import {isString} from 'vega-util';\nimport {LogicalComposition} from '../logical';\nimport {fieldFilterExpression, isSelectionPredicate, Predicate} from '../predicate';\nimport {logicalExpr} from '../util';\nimport {DataFlowNode} from './data/dataflow';\nimport {Model} from './model';\nimport {parseSelectionPredicate} from './selection/parse';\n\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string {\n return logicalExpr(filterOp, (predicate: Predicate) => {\n if (isString(predicate)) {\n return predicate;\n } else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate, node);\n } else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n","import {Axis as VgAxis, AxisEncode, NewSignal, SignalRef, Text} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue} from '../../axis';\nimport {POSITION_SCALE_CHANNELS} from '../../channel';\nimport {defaultTitle, FieldDefBase} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isText} from '../../title';\nimport {contains, getFirstDefined, isEmpty, replaceAll} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {exprFromValueRefOrSignalRef} from '../common';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {AxisComponent, AxisComponentIndex} from './component';\n\nfunction assembleTitle(title: Text | FieldDefBase[] | SignalRef, config: Config): Text | SignalRef {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\n\nfunction setAxisEncode(\n axis: Omit,\n part: keyof AxisEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | readonly VgValueRef[]\n) {\n axis.encode ??= {};\n axis.encode[part] ??= {};\n axis.encode[part].update ??= {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (axis.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleAxis(\n axisCmpt: AxisComponent,\n kind: 'main' | 'grid',\n config: Config,\n opt: {\n header: boolean; // whether this is called via a header\n } = {header: false}\n): VgAxis {\n const {disable, orient, scale, labelExpr, title, zindex, ...axis} = axisCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n } else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n\n const {condition, ...valueOrSignalRef} = propValue;\n const conditions = array(condition);\n\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n\n const vgRef = [\n ...conditions.map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n } else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef: SignalRef = {\n signal:\n conditions\n .map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueRefOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n } else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n\n // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema\n // Note that we need to use null so the default labelAlign is preserved.\n if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) {\n delete axis[prop];\n }\n }\n\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const {grid} = axis.encode;\n axis.encode = {\n ...(grid ? {grid} : {})\n };\n\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false, // always hide grid axis\n\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n } else {\n // kind === 'main'\n\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', {signal: expr});\n }\n\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n const titleString = assembleTitle(title, config);\n\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? {title: titleString} : {}),\n ...axis,\n ...(config.aria === false ? {aria: false} : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model: Model): NewSignal[] {\n const {axes} = model.component;\n const signals: NewSignal[] = [];\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update\n });\n }\n }\n }\n }\n }\n return signals;\n}\n\nexport function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[] {\n const {x = [], y = []} = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n","import {ScaleType, SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {AxisConfig} from '../../axis';\nimport {PositionScaleChannel} from '../../channel';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {isQuantitative} from '../../scale';\nimport {keys, titleCase} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {getStyleConfig, signalOrStringValue} from '../common';\n\nfunction getAxisConfigFromConfigTypes(\n configTypes: string[],\n config: Config,\n channel: 'x' | 'y',\n orient: string | SignalRef\n) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(\n orientConfig1[prop]\n )} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n\n return conditionalOrientAxisConfig;\n }\n\n return config[configType];\n })\n ]);\n}\n\nexport type AxisConfigs = ReturnType;\n\nexport function getAxisConfigs(\n channel: PositionScaleChannel,\n scaleType: ScaleType,\n orient: string | SignalRef,\n config: Config\n) {\n const typeBasedConfigTypes =\n scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ...\n\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\n\nexport function getAxisConfigStyle(axisConfigTypes: string[], config: Config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(\n property: keyof AxisConfig,\n styleConfigIndex: StyleConfigIndex,\n style: string | string[],\n axisConfigs: Partial = {}\n): {configFrom?: string; configValue?: any} {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return {configFrom, configValue: axisConfigs[configFrom][property]};\n }\n }\n return {};\n}\n","import {Align, AxisOrient, Orient, SignalRef} from 'vega';\nimport {isArray, isObject} from 'vega-util';\nimport {AxisInternal} from '../../axis';\nimport {isBinned, isBinning} from '../../bin';\nimport {PositionScaleChannel, X} from '../../channel';\nimport {\n DatumDef,\n isDiscrete,\n isFieldDef,\n PositionDatumDef,\n PositionFieldDef,\n toFieldDefBase,\n TypedFieldDef,\n valueArray\n} from '../../channeldef';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {Mark} from '../../mark';\nimport {hasDiscreteDomain} from '../../scale';\nimport {Sort} from '../../sort';\nimport {durationExpr, normalizeTimeUnit} from '../../timeunit';\nimport {NOMINAL, ORDINAL, Type} from '../../type';\nimport {contains, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitle, mergeTitleFieldDefs} from '../common';\nimport {guideFormatType} from '../format';\nimport {UnitModel} from '../unit';\nimport {ScaleType} from './../../scale';\nimport {AxisComponentProps} from './component';\nimport {AxisConfigs, getAxisConfig} from './config';\n\nexport interface AxisRuleParams {\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef;\n axis: AxisInternal;\n channel: PositionScaleChannel;\n model: UnitModel;\n\n mark: Mark;\n scaleType: ScaleType;\n orient: Orient | SignalRef;\n labelAngle: number | SignalRef;\n format: string | SignalRef;\n formatType: ReturnType;\n config: Config;\n}\n\nexport const axisRules: {\n [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k];\n} = {\n scale: ({model, channel}) => model.scaleName(channel),\n\n format: ({format}) => format, // we already calculate this in parse\n\n formatType: ({formatType}) => formatType, // we already calculate this in parse\n\n grid: ({fieldOrDatumDef, axis, scaleType}) => axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef),\n\n gridScale: ({model, channel}) => gridScale(model, channel),\n\n labelAlign: ({axis, labelAngle, orient, channel}) =>\n axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n\n labelAngle: ({labelAngle}) => labelAngle, // we already calculate this in parse\n\n labelBaseline: ({axis, labelAngle, orient, channel}) =>\n axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n\n labelFlush: ({axis, fieldOrDatumDef, channel}) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n\n labelOverlap: ({axis, fieldOrDatumDef, scaleType}) =>\n axis.labelOverlap ??\n defaultLabelOverlap(\n fieldOrDatumDef.type,\n scaleType,\n isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit,\n isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined\n ),\n\n // we already calculate orient in parse\n orient: ({orient}) => orient as AxisOrient, // Need to cast until Vega supports signal\n\n tickCount: ({channel, model, axis, fieldOrDatumDef, scaleType}) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values});\n },\n\n tickMinStep: ({axis, format, fieldOrDatumDef}) => axis.tickMinStep ?? defaultTickMinStep({format, fieldOrDatumDef}),\n\n title: ({axis, model, channel}) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(\n fieldDef ? [toFieldDefBase(fieldDef)] : [],\n isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []\n );\n },\n\n values: ({axis, fieldOrDatumDef}) => values(axis, fieldOrDatumDef),\n\n zindex: ({axis, fieldOrDatumDef, mark}) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\n\nexport function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin);\n}\n\nexport function gridScale(model: UnitModel, channel: PositionScaleChannel) {\n const gridChannel: PositionScaleChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\n\nexport function getLabelAngle(\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef,\n axis: AxisInternal,\n channel: PositionScaleChannel,\n styleConfig: StyleConfigIndex,\n axisConfigs?: AxisConfigs\n) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n } else {\n // try axis config value\n const {configValue: angle} = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n } else {\n // get default value\n if (\n channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)\n ) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\n\nexport function normalizeAngleExpr(angle: SignalRef) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\n\nexport function defaultLabelBaseline(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y',\n alwaysIncludeMiddle?: boolean\n) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal:\n `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"`};\n }\n\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n } else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"`};\n }\n\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\n\nexport function defaultLabelAlign(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y'\n): Align | SignalRef {\n if (angle === undefined) {\n return undefined;\n }\n\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal:\n `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n\n return 'right';\n}\n\nexport function defaultLabelFlush(type: Type, channel: PositionScaleChannel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\n\nexport function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log' || scaleType === 'symlog') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\n\nexport function defaultOrient(channel: PositionScaleChannel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\n\nexport function defaultTickCount({\n fieldOrDatumDef,\n scaleType,\n size,\n values: vals\n}: {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n scaleType: ScaleType;\n size?: SignalRef;\n values?: AxisInternal['values'];\n}) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return {signal: `ceil(${size.signal}/10)`};\n }\n\n if (\n fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)\n ) {\n return undefined;\n }\n }\n\n return {signal: `ceil(${size.signal}/40)`};\n }\n\n return undefined;\n}\n\nexport function defaultTickMinStep({format, fieldOrDatumDef}: Pick) {\n if (format === 'd') {\n return 1;\n }\n\n if (isFieldDef(fieldOrDatumDef)) {\n const {timeUnit} = fieldOrDatumDef;\n if (timeUnit) {\n const signal = durationExpr(timeUnit);\n if (signal) {\n return {signal};\n }\n }\n }\n return undefined;\n}\n\nexport function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y') {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n } else if (title1) {\n return title1;\n } else if (title2) {\n return title2;\n } else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n } else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n\n return undefined;\n}\n\nexport function values(axis: AxisInternal, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = axis.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n\n return undefined;\n}\n\nexport function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n","import {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {SingleDefChannel} from '../../channel';\nimport {FieldRefOption, isScaleFieldDef, TypedFieldDef, vgField} from '../../channeldef';\nimport {DateTime} from '../../datetime';\nimport {fieldFilterExpression} from '../../predicate';\nimport {isSortArray} from '../../sort';\nimport {CalculateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class CalculateNode extends DataFlowNode {\n private _dependentFields: Set;\n\n public clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: CalculateTransform\n ) {\n super(parent);\n\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n\n public static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef: TypedFieldDef, channel: SingleDefChannel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const {field, timeUnit} = fieldDef;\n const sort: (number | string | boolean | DateTime)[] = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate =\n sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({field, timeUnit, equal: sortValue})} ? ${i} : `;\n })\n .join('') + sort.length;\n\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, {forAs: true})\n });\n }\n });\n return parent;\n }\n\n public producedFields() {\n return new Set([this.transform.as]);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public assemble(): VgFormulaTransform {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n\n public hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\n\nexport function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption) {\n return vgField(fieldDef, {prefix: channel, suffix: 'sort_index', ...(opt ?? {})});\n}\n","import {Orient, SignalRef} from 'vega';\nimport {FacetChannel} from '../../channel';\nimport {Config} from '../../config';\nimport {Header} from '../../header';\nimport {contains, getFirstDefined} from '../../util';\nimport {HeaderChannel} from './component';\n\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n } else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\n\nexport function getHeaderProperty

>(\n prop: P,\n header: Header,\n config: Config,\n channel: FacetChannel\n): Header[P] {\n const headerSpecificConfig =\n channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n\n return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\n\nexport function getHeaderProperties(\n properties: (keyof Header)[],\n header: Header,\n config: Config,\n channel: FacetChannel\n): Header {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, header || {}, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n","/**\n * Utility for generating row / column headers\n */\nimport {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {FacetFieldDef} from '../../spec/facet';\n\nexport type HeaderChannel = 'row' | 'column';\nexport const HEADER_CHANNELS: HeaderChannel[] = ['row', 'column'];\n\nexport type HeaderType = 'header' | 'footer';\nexport const HEADER_TYPES: HeaderType[] = ['header', 'footer'];\n\nexport interface LayoutHeaderComponentIndex {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n}\n\n/**\n * A component that represents all header, footers and title of a Vega group with layout directive.\n */\nexport interface LayoutHeaderComponent {\n title?: Text | SignalRef;\n\n // TODO: concat can have multiple header / footer.\n // Need to redesign this part a bit.\n\n facetFieldDef?: FacetFieldDef;\n\n /**\n * An array of header components for headers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n header?: HeaderComponent[];\n\n /**\n * An array of header components for footers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n footer?: HeaderComponent[];\n}\n\n/**\n * A component that represents one group of row/column-header/footer.\n */\nexport interface HeaderComponent {\n labels: boolean;\n\n sizeSignal: {signal: string};\n\n axes: VgAxis[];\n}\n","/**\n * Utility for generating row / column headers\n */\n\nimport {SignalRef, TitleAnchor, TitleConfig} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {\n CoreHeader,\n HEADER_LABEL_PROPERTIES,\n HEADER_LABEL_PROPERTIES_MAP,\n HEADER_TITLE_PROPERTIES,\n HEADER_TITLE_PROPERTIES_MAP\n} from '../../header';\nimport {isSortField} from '../../sort';\nimport {FacetFieldDef, isFacetMapping} from '../../spec/facet';\nimport {contains, isEmpty, normalizeAngle, replaceAll} from '../../util';\nimport {RowCol, VgComparator, VgMarkGroup, VgTitle} from '../../vega.schema';\nimport {defaultLabelAlign, defaultLabelBaseline} from '../axis/properties';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {formatSignalRef} from '../format';\nimport {isFacetModel, Model} from '../model';\nimport {getHeaderChannel, getHeaderProperties, getHeaderProperty} from './common';\nimport {\n HeaderChannel,\n HeaderComponent,\n HeaderType,\n HEADER_TYPES,\n LayoutHeaderComponent,\n LayoutHeaderComponentIndex\n} from './component';\n\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model: Model, channel: FacetChannel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n\n const {\n titleAnchor,\n titleAngle: ta,\n titleOrient\n } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n\n const titleAngle = normalizeAngle(ta);\n\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\n\nexport function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor: TitleAnchor = 'middle') {\n switch (anchor) {\n case 'start':\n return {align: 'left'};\n case 'end':\n return {align: 'right'};\n }\n\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? {align} : {};\n}\n\nexport function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? {baseline} : {};\n}\n\nexport function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[] {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\n\nfunction getSort(facetFieldDef: FacetFieldDef, channel: HeaderChannel): VgComparator {\n const {sort} = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, {expr: 'datum'}),\n order: sort.order ?? 'ascending'\n };\n } else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, {expr: 'datum'}),\n order: 'ascending'\n };\n } else {\n return {\n field: vgField(facetFieldDef, {expr: 'datum'}),\n order: sort ?? 'ascending'\n };\n }\n}\n\nexport function assembleLabelTitle(\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n config: Config\n) {\n const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties(\n ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'],\n facetFieldDef.header,\n config,\n channel\n );\n\n const titleTextExpr = formatSignalRef({\n fieldOrDatumDef: facetFieldDef,\n format,\n formatType,\n expr: 'parent',\n config\n }).signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n\n return {\n text: {\n signal: labelExpr\n ? replaceAll(\n replaceAll(labelExpr, 'datum.label', titleTextExpr),\n 'datum.value',\n vgField(facetFieldDef, {expr: 'parent'})\n )\n : titleTextExpr\n },\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\n\nexport function assembleHeaderGroup(\n model: Model,\n channel: HeaderChannel,\n headerType: HeaderType,\n layoutHeader: LayoutHeaderComponent,\n headerComponent: HeaderComponent\n) {\n if (headerComponent) {\n let title = null;\n const {facetFieldDef} = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const {labelOrient} = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel);\n\n // Include label title in the header if orient aligns with the channel\n if (\n (channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))\n ) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n\n const axes = headerComponent.axes;\n\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n\n ...(layoutHeader.facetFieldDef\n ? {\n from: {data: model.getName(`${channel}_domain`)},\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: {data: model.getName(`facet_domain_${channel}`)}\n }\n : {}),\n\n ...(title ? {title} : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? {axes} : {})\n };\n }\n }\n return null;\n}\n\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\n\nexport function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\n\nexport function assembleLayoutTitleBand(\n headerComponentIndex: LayoutHeaderComponentIndex,\n config: Config\n): RowCol {\n const titleBand = {};\n\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const {titleAnchor, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleOrient'],\n headerComponent.facetFieldDef.header,\n config,\n channel\n );\n\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n\n return isEmpty(titleBand) ? undefined : titleBand;\n}\n\nexport function assembleHeaderProperties(\n config: Config,\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n properties: (keyof CoreHeader)[],\n propertiesMap: Partial, keyof TitleConfig>>\n): Partial {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n\n const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n","import {InitSignal, NewSignal} from 'vega';\nimport {getViewConfigContinuousSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {getFirstDefined} from '../../util';\nimport {isSignalRef, isVgRangeStep, VgRangeStep} from '../../vega.schema';\nimport {signalOrStringValue} from '../common';\nimport {isFacetModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {LayoutSizeType} from './component';\n\nexport function assembleLayoutSignals(model: Model): NewSignal[] {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\n\nexport function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[] {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n } else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{name, init: safeExpr, on: [{update: safeExpr, events: 'window:resize'}]}];\n } else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\n\nfunction stepSignal(scaleName: string, range: VgRangeStep): NewSignal {\n const name = `${scaleName}_step`;\n if (isSignalRef(range.step)) {\n return {name, update: range.step.signal};\n } else {\n return {name, value: range.step};\n }\n}\n\nexport function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(\n paddingOuter\n )}) * ${scaleName}_step`;\n}\n","import {Split} from '../split';\n\nexport type LayoutSize = number | 'container' | 'step' | 'merged';\n\nexport interface LayoutSizeIndex {\n width?: LayoutSize;\n\n childWidth?: LayoutSize;\n\n height?: LayoutSize;\n\n childHeight?: LayoutSize;\n}\n\nexport type LayoutSizeType = keyof LayoutSizeIndex;\n\nexport type LayoutSizeComponent = Split;\n\nexport function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height' {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n","import {GuideEncodingEntry} from '../guide';\nimport {keys} from '../util';\nimport {VgEncodeChannel} from '../vega.schema';\nimport {signalOrValueRef} from './common';\nimport {wrapCondition} from './mark/encode';\nimport {UnitModel} from './unit';\n\nexport function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) {\n return keys(encoding).reduce((encode, channel: VgEncodeChannel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value))\n };\n }, {});\n}\n","import {isXorY, ScaleChannel} from '../channel';\nimport * as log from '../log';\nimport {Resolve, ResolveMode} from '../resolve';\nimport {isConcatModel, isFacetModel, isLayerModel, Model} from './model';\n\nexport function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode {\n if (isFacetModel(model)) {\n return channel === 'theta' ? 'independent' : 'shared';\n } else if (isLayerModel(model)) {\n return 'shared';\n } else if (isConcatModel(model)) {\n return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\n\nexport function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n\n return resolve[guide][channel] || 'shared';\n}\n","import {Legend as VgLegend} from 'vega';\nimport {NonPositionScaleChannel} from '../../channel';\nimport {COMMON_LEGEND_PROPERTY_INDEX, LegendInternal} from '../../legend';\nimport {Flag, keys} from '../../util';\nimport {Split} from '../split';\n\nexport type LegendComponentProps = VgLegend & {\n labelExpr?: string;\n selections?: string[];\n disable?: boolean;\n};\n\nconst LEGEND_COMPONENT_PROPERTY_INDEX: Flag = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\n\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\n\nexport class LegendComponent extends Split {}\n\nexport type LegendComponentIndex = Partial>;\n\nexport type LegendInternalIndex = Partial>;\n","import {ColorValueRef, EncodeEntry, Gradient, LegendEncode, LegendType, SignalRef, SymbolEncodeEntry} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {COLOR, NonPositionScaleChannel, OPACITY} from '../../channel';\nimport {\n Conditional,\n DatumDef,\n hasConditionalValueDef,\n isFieldDef,\n isValueDef,\n TypedFieldDef,\n Value,\n ValueDef\n} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport {FILL_STROKE_CONFIG} from '../../mark';\nimport {getFirstDefined, isEmpty, varName} from '../../util';\nimport {applyMarkConfig, signalOrValueRef} from '../common';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport * as mixins from '../mark/encode';\nimport {STORE} from '../selection';\nimport {UnitModel} from '../unit';\nimport {LegendComponent} from './component';\n\nexport interface LegendEncodeParams {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n model: UnitModel;\n channel: NonPositionScaleChannel;\n legendCmpt: LegendComponent;\n legendType: LegendType;\n}\n\nexport const legendEncodeRules: {\n [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry;\n} = {\n symbols,\n gradient,\n labels,\n entries\n};\n\nexport function symbols(\n symbolsSpec: any,\n {fieldOrDatumDef, model, channel, legendCmpt, legendType}: LegendEncodeParams\n): SymbolEncodeEntry {\n if (legendType !== 'symbol') {\n return undefined;\n }\n\n const {markDef, encoding, config, mark} = model;\n const filled = markDef.filled && mark !== 'trail';\n\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, {filled})\n } as SymbolEncodeEntry; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n } else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n } else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n } else if (isArray(out.fill)) {\n const fill =\n getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill) as ColorValueRef;\n }\n }\n }\n }\n\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n } else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n } else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(\n getFirstConditionValue(encoding.stroke || encoding.color),\n markDef.stroke,\n filled ? markDef.color : undefined\n );\n if (stroke) {\n out.stroke = {value: stroke} as ColorValueRef;\n }\n }\n }\n }\n\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n\n if (condition) {\n out.opacity = [\n {test: condition, ...signalOrValueRef(opacity ?? 1)},\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n } else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n\n out = {...out, ...symbolsSpec};\n\n return isEmpty(out) ? undefined : out;\n}\n\nexport function gradient(gradientSpec: any, {model, legendType, legendCmpt}: LegendEncodeParams) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n\n const {config, markDef, encoding} = model;\n\n let out: SymbolEncodeEntry = {};\n\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n\n out = {...out, ...gradientSpec};\n return isEmpty(out) ? undefined : out;\n}\n\nexport function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channel, legendCmpt}: LegendEncodeParams) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{test: condition, value: 1}, {value: config.legend.unselectedOpacity}] : undefined;\n\n const {format, formatType} = legend;\n\n let text = undefined;\n\n if (isCustomFormatType(formatType)) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n });\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n });\n } else if (\n fieldOrDatumDef.type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined\n ) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n });\n }\n }\n\n const labelsSpec = {\n ...(opacity ? {opacity} : {}),\n ...(text ? {text} : {}),\n ...specifiedlabelsSpec\n };\n\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\n\nexport function entries(entriesSpec: any, {legendCmpt}: LegendEncodeParams) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? {...entriesSpec, fill: {value: 'transparent'}} : entriesSpec;\n}\n\nfunction getMaxValue(channelDef: Encoding['opacity']) {\n return getConditionValue(channelDef, (v: number, conditionalDef) => Math.max(v, conditionalDef.value as any));\n}\n\nexport function getFirstConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape']\n): V {\n return getConditionValue(channelDef, (v: V, conditionalDef: Conditional>) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\n\nfunction getConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape' | 'opacity'],\n reducer: (val: V, conditionalDef: Conditional>) => V\n): V {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value as any);\n } else if (isValueDef(channelDef)) {\n return channelDef.value as any;\n }\n return undefined;\n}\n\nfunction selectedCondition(model: UnitModel, legendCmpt: LegendComponent, fieldDef: TypedFieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length) return undefined;\n\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n","import {LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isColorChannel} from '../../channel';\nimport {DatumDef, MarkPropFieldOrDatumDef, title as fieldDefTitle, TypedFieldDef, valueArray} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {Legend, LegendConfig, LegendInternal} from '../../legend';\nimport {Mark, MarkDef} from '../../mark';\nimport {isContinuousToContinuous, ScaleType} from '../../scale';\nimport {TimeUnit} from '../../timeunit';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {guideFormat, guideFormatType} from '../format';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {NonPositionScaleChannel} from './../../channel';\nimport {LegendComponentProps} from './component';\nimport {getFirstConditionValue} from './encode';\n\nexport interface LegendRuleParams {\n legend: LegendInternal;\n channel: NonPositionScaleChannel;\n model: UnitModel;\n markDef: MarkDef;\n encoding: Encoding;\n fieldOrDatumDef: MarkPropFieldOrDatumDef;\n legendConfig: LegendConfig;\n config: Config;\n scaleType: ScaleType;\n orient: LegendOrient;\n legendType: LegendType;\n direction: Orientation;\n}\n\nexport const legendRules: {\n [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k];\n} = {\n direction: ({direction}) => direction,\n\n format: ({fieldOrDatumDef, legend, config}) => {\n const {format, formatType} = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n\n formatType: ({legend, fieldOrDatumDef, scaleType}) => {\n const {formatType} = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n gradientLength: params => {\n const {legend, legendConfig} = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n\n labelOverlap: ({legend, legendConfig, scaleType}) =>\n legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n\n symbolType: ({legend, markDef, channel, encoding}) =>\n legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n\n title: ({fieldOrDatumDef, config}) => fieldDefTitle(fieldOrDatumDef, config, {allowDisabling: true}),\n\n type: ({legendType, scaleType, channel}) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n } else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n }, // depended by other property, let's define upfront\n\n values: ({fieldOrDatumDef, legend}) => values(legend, fieldOrDatumDef)\n};\n\nexport function values(legend: LegendInternal, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = legend.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\n\nexport function defaultSymbolType(\n mark: Mark,\n channel: NonPositionScaleChannel,\n shapeChannelDef: Encoding['shape'],\n markShape: SymbolShape | SignalRef\n): SymbolShape | SignalRef {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\n\nexport function clipHeight(legendType: LegendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\n\nexport function getLegendType(params: {\n legend: LegendInternal;\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n const {legend} = params;\n\n return getFirstDefined(legend.type, defaultType(params));\n}\n\nexport function defaultType({\n channel,\n timeUnit,\n scaleType\n}: {\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\n\nexport function getDirection({\n legendConfig,\n legendType,\n orient,\n legend\n}: {\n orient: LegendOrient;\n legendConfig: LegendConfig;\n legendType: LegendType;\n legend: Legend;\n}): Orientation {\n return (\n legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType)\n );\n}\n\nexport function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\n\nexport function defaultGradientLength({\n legendConfig,\n model,\n direction,\n orient,\n scaleType\n}: {\n scaleType: ScaleType;\n direction: Orientation;\n orient: LegendOrient;\n model: Model;\n legendConfig: LegendConfig;\n}) {\n const {\n gradientHorizontalMaxLength,\n gradientHorizontalMinLength,\n gradientVerticalMaxLength,\n gradientVerticalMinLength\n } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n } else {\n return gradientHorizontalMinLength;\n }\n } else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\n\nfunction gradientLengthSignal(model: Model, sizeType: 'width' | 'height', min: number, max: number) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return {signal: `clamp(${sizeSignal}, ${min}, ${max})`};\n}\n\nexport function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap {\n if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {COLOR, NonPositionScaleChannel, SHAPE} from '../../channel';\nimport {DatumDef, FieldDef, getFieldOrDatumDef, isFieldDef, MarkPropDatumDef, MarkPropFieldDef} from '../../channeldef';\nimport {LegendInternal, LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {GEOJSON} from '../../type';\nimport {deleteNestedProperty, isEmpty, keys, varName} from '../../util';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {isUnitModel, Model} from '../model';\nimport {parseGuideResolve} from '../resolve';\nimport {parseInteractiveLegend} from '../selection/legends';\nimport {defaultTieBreaker, Explicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {LegendComponent, LegendComponentIndex, LegendComponentProps, LEGEND_COMPONENT_PROPERTIES} from './component';\nimport {LegendEncodeParams, legendEncodeRules} from './encode';\nimport {getDirection, getLegendType, LegendRuleParams, legendRules} from './properties';\n\nexport function parseLegend(model: Model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\n\nfunction parseUnitLegend(model: UnitModel): LegendComponentIndex {\n const {encoding} = model;\n\n const legendComponent: LegendComponentIndex = {};\n\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | MarkPropDatumDef;\n\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n\n return legendComponent;\n}\n\nfunction getLegendDefWithScale(model: UnitModel, channel: NonPositionScaleChannel): VgLegend {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return {stroke: scale};\n } else if (channel === 'size') {\n return {strokeWidth: scale};\n }\n }\n\n if (channel === 'color') {\n return model.markDef.filled ? {fill: scale} : {stroke: scale};\n }\n return {[channel]: scale};\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof LegendComponentProps,\n legend: LegendInternal,\n fieldDef: FieldDef\n) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\n\nexport function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent {\n let legend = model.legend(channel);\n\n const {markDef, encoding, config} = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n\n legend = legend || {};\n\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | DatumDef;\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({legend, channel, timeUnit, scaleType});\n\n const direction = getDirection({legend, legendType, orient, legendConfig});\n\n const ruleParams: LegendRuleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if (\n (legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))\n ) {\n continue;\n }\n\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode: LegendEncode = {};\n\n const legendEncodeParams: LegendEncodeParams = {fieldOrDatumDef, model, channel, legendCmpt, legendType};\n\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n\n const value =\n part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? {name: `${varName(fieldOrDatumDef.field)}_legend_${part}`}\n : {}),\n ...(selections?.length ? {interactive: !!selections} : {}),\n update: value\n };\n }\n }\n\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n\n return legendCmpt;\n}\n\nfunction parseNonUnitLegend(model: Model) {\n const {legends, resolve} = model.component;\n\n for (const child of model.children) {\n parseLegend(child);\n\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n\n return legends;\n}\n\nexport function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n mergedLegend.getWithExplicit(prop),\n childLegend.getWithExplicit(prop),\n prop,\n 'legend',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit): any => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n }\n );\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n\n return mergedLegend;\n}\n\nfunction mergeSymbolType(st1: Explicit, st2: Explicit) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {Config} from '../../config';\nimport {LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {keys, replaceAll, stringify, vals} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {Model} from '../model';\nimport {LegendComponent} from './component';\nimport {mergeLegendComponent} from './parse';\n\nfunction setLegendEncode(\n legend: VgLegend,\n part: keyof LegendEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | VgValueRef[]\n) {\n legend.encode ??= {};\n legend.encode[part] ??= {};\n legend.encode[part].update ??= {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (legend.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleLegends(model: Model): VgLegend[] {\n const legendComponentIndex = model.component.legends;\n const legendByDomain: Record = {};\n\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n } else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n\n return legends;\n}\n\nexport function assembleLegend(legendCmpt: LegendComponent, config: Config) {\n const {disable, labelExpr, selections, ...legend} = legendCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = {value: 'transparent'};\n }\n\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', {signal: expr});\n }\n\n return legend;\n}\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {contains} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\n\nexport function assembleProjections(model: Model): VgProjection[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n } else {\n return assembleProjectionForModel(model);\n }\n}\n\nexport function assembleProjectionsForModelAndChildren(model: Model): VgProjection[] {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\n\nexport function assembleProjectionForModel(model: Model): VgProjection[] {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n\n const projection = component.combine();\n const {name} = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{translate: {signal: '[width / 2, height / 2]'}},\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n } else {\n // generate projection that uses extent fitting\n const size: SignalRef = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n\n const fits: string[] = component.data.reduce((sources, data) => {\n const source: string = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n","import {BaseProjection, SignalRef, Vector2} from 'vega';\nimport {ExprRef} from './expr';\nimport {MapExcludeValueRefAndReplaceSignalWith, ProjectionType} from './vega.schema';\n\nexport interface Projection\n extends MapExcludeValueRefAndReplaceSignalWith {\n /**\n * The cartographic projection to use. This value is case-insensitive, for example `\"albers\"` and `\"Albers\"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).\n *\n * __Default value:__ `equalEarth`\n */\n type?: ProjectionType | ES; // Re-declare to override docs\n\n /**\n * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.\n */\n scale?: number | ES; // Re-declare to override docs\n\n /**\n * The projection’s translation offset as a two-element array `[tx, ty]`.\n */\n translate?: Vector2 | ES; // TODO: figure what's VL default value\n}\n\n/**\n * Any property of Projection can be in config\n */\nexport type ProjectionConfig = Projection;\n\nexport const PROJECTION_PROPERTIES: (keyof Projection)[] = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {Projection} from '../../projection';\nimport {Split} from '../split';\n\nexport class ProjectionComponent extends Split {\n public merged = false;\n\n constructor(\n name: string,\n public specifiedProjection: Projection,\n public size: SignalRef[],\n public data: (string | SignalRef)[]\n ) {\n super(\n {...specifiedProjection}, // all explicit properties of projection\n {name} // name as initial implicit property\n );\n }\n\n /**\n * Whether the projection parameters should fit provided data.\n */\n public get isFit() {\n return !!this.data;\n }\n}\n","import type {SignalRef} from 'vega';\nimport {hasOwnProperty} from 'vega-util';\nimport {LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {replaceExprRef} from '../../expr';\nimport {PROJECTION_PROPERTIES} from '../../projection';\nimport {GEOJSON} from '../../type';\nimport {deepEqual, duplicate, every} from '../../util';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {ProjectionComponent} from './component';\n\nexport function parseProjection(model: Model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\n\nfunction parseUnitProjection(model: UnitModel): ProjectionComponent {\n if (model.hasProjection) {\n const proj = replaceExprRef(model.specifiedProjection);\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n\n const projComp = new ProjectionComponent(\n model.projectionName(true),\n {\n ...(replaceExprRef(model.config.projection) ?? {}),\n ...(proj ?? {})\n },\n size,\n data\n );\n\n if (!projComp.get('type')) {\n projComp.set('type', 'equalEarth', false);\n }\n\n return projComp;\n }\n\n return undefined;\n}\n\nfunction gatherFitData(model: UnitModel) {\n const data: (SignalRef | string)[] = [];\n\n const {encoding} = model;\n\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n\n return data;\n}\n\nfunction mergeIfNoConflict(first: ProjectionComponent, second: ProjectionComponent): ProjectionComponent {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (\n hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n deepEqual(first.get(prop), second.get(prop))\n ) {\n return true;\n }\n return false;\n });\n\n const size = deepEqual(first.size, second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n } else if (deepEqual(first.explicit, {})) {\n return second;\n } else if (deepEqual(second.explicit, {})) {\n return first;\n }\n }\n\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\n\nfunction parseNonUnitProjections(model: Model): ProjectionComponent {\n if (model.children.length === 0) {\n return undefined;\n }\n\n let nonUnitProjection: ProjectionComponent;\n\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n } else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n } else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(\n name,\n nonUnitProjection.specifiedProjection,\n nonUnitProjection.size,\n duplicate(nonUnitProjection.data)\n );\n\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n\n return modelProjection;\n }\n\n return undefined;\n}\n","import {BinTransform as VgBinTransform, Transforms as VgTransform} from 'vega';\nimport {isString} from 'vega-util';\nimport {BinParams, binToString, isBinning, isParameterExtent} from '../../bin';\nimport {Channel} from '../../channel';\nimport {binRequiresRange, FieldName, isTypedFieldDef, normalizeBin, TypedFieldDef, vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {BinTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, keys, replacePathInField, unique, vals} from '../../util';\nimport {binFormatExpression} from '../format';\nimport {isUnitModel, Model, ModelWithField} from '../model';\nimport {parseSelectionExtent} from '../selection/parse';\nimport {NonPositionScaleChannel, PositionChannel} from './../../channel';\nimport {DataFlowNode} from './dataflow';\n\nfunction rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef, channel: Channel, config: Config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n\n const guide = isUnitModel(model)\n ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {}\n : {};\n\n const startField = vgField(fieldDef, {expr: 'datum'});\n const endField = vgField(fieldDef, {expr: 'datum', binSuffix: 'end'});\n\n return {\n formulaAs: vgField(fieldDef, {binSuffix: 'range', forAs: true}),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\n\nfunction binKey(bin: BinParams, field: string) {\n return `${binToString(bin)}_${field}`;\n}\n\nfunction getSignalsFromModel(model: Model, key: string) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\n\nexport function getBinSignalName(model: Model, field: string, bin: boolean | BinParams) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\n\nfunction isBinTransform(t: TypedFieldDef | BinTransform): t is BinTransform {\n return 'as' in t;\n}\n\nfunction createBinComponent(t: TypedFieldDef | BinTransform, bin: boolean | BinParams, model: Model) {\n let as: [string, string];\n let span: string;\n\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n } else {\n as = [vgField(t, {forAs: true}), vgField(t, {binSuffix: 'end', forAs: true})];\n }\n\n const normalizedBin = {...normalizeBin(bin, undefined)};\n const key = binKey(normalizedBin, t.field);\n const {signal, extentSignal} = getSignalsFromModel(model, key);\n\n if (isParameterExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n span = parseSelectionExtent(model, ext.param, ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n\n const binComponent: BinComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? {signal} : {}),\n ...(extentSignal ? {extentSignal} : {}),\n ...(span ? {span} : {})\n };\n\n return {key, binComponent};\n}\n\nexport interface BinComponent {\n bin: BinParams;\n field: FieldName;\n extentSignal?: string;\n signal?: string;\n span?: string;\n\n /** Pairs of strings of the names of start and end signals */\n as: [string, string][];\n\n // Range Formula\n\n formula?: string;\n formulaAs?: string;\n}\n\nexport class BinNode extends DataFlowNode {\n public clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n\n constructor(\n parent: DataFlowNode,\n private bins: Dict\n ) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const bins = model.reduceFieldDef((binComponentIndex: Dict, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const {key, binComponent} = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {} as Dict);\n\n if (isEmpty(bins)) {\n return null;\n }\n\n return new BinNode(parent, bins);\n }\n\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n public static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model) {\n const {key, binComponent} = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n public merge(other: BinNode, renameSignal: (s1: string, s2: string) => void) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n } else {\n this.bins[key] = other.bins[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n\n public producedFields() {\n return new Set(\n vals(this.bins)\n .map(c => c.as)\n .flat(2)\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n\n public hash() {\n return `Bin ${hash(this.bins)}`;\n }\n\n public assemble(): VgTransform[] {\n return vals(this.bins).flatMap(bin => {\n const transform: VgTransform[] = [];\n\n const [binAs, ...remainingAs] = bin.as;\n const {extent, ...params} = bin.bin;\n const binTrans: VgBinTransform = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isParameterExtent(extent) ? {extent} : {extent: null}),\n ...(bin.span ? {span: {signal: `span(${bin.span})`}} : {}),\n ...params\n };\n\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = {signal: bin.extentSignal};\n }\n\n transform.push(binTrans);\n\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({field: binAs[i]}, {expr: 'datum'}),\n as: as[i]\n });\n }\n }\n\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n","import {AggregateOp, AggregateTransform as VgAggregateTransform} from 'vega';\nimport {isArgmaxDef, isArgminDef} from '../../aggregate';\nimport {\n Channel,\n getPositionChannelFromLatLong,\n getSecondaryRangeChannel,\n isGeoPositionChannel,\n isScaleChannel,\n isXorY\n} from '../../channel';\nimport {\n binRequiresRange,\n FieldDef,\n getBandPosition,\n hasBandEnd,\n isScaleFieldDef,\n isTypedFieldDef,\n vgField\n} from '../../channeldef';\nimport * as log from '../../log';\nimport {isFieldRange} from '../../scale';\nimport {AggregateTransform} from '../../transform';\nimport {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\nimport {isRectBasedMark} from '../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from './timeunit';\n\ntype Measures = Dict>>>;\n\nfunction addDimension(dims: Set, channel: Channel, fieldDef: FieldDef, model: ModelWithField) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n if (\n isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)\n ) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, {suffix: 'end'}));\n\n const {mark, markDef, config} = model;\n\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n\n if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) {\n dims.add(vgField(fieldDef, {suffix: OFFSETTED_RECT_START_SUFFIX}));\n dims.add(vgField(fieldDef, {suffix: OFFSETTED_RECT_END_SUFFIX}));\n }\n\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, {binSuffix: 'range'}));\n }\n } else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n } else {\n dims.add(vgField(fieldDef));\n }\n if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) {\n dims.add(fieldDef.scale.range.field);\n }\n return dims;\n}\n\nfunction mergeMeasures(parentMeasures: Measures, childMeasures: Measures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n } else {\n parentMeasures[field] = {[op]: ops[op]};\n }\n }\n }\n}\n\nexport class AggregateNode extends DataFlowNode {\n public clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(\n parent: DataFlowNode,\n private dimensions: Set,\n private measures: Measures\n ) {\n super(parent);\n }\n\n get groupBy() {\n return this.dimensions;\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n\n const meas: Measures = {};\n const dims = new Set();\n\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n\n model.forEachFieldDef((fieldDef, channel: Channel) => {\n const {aggregate, field} = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] ??= {};\n meas['*']['count'] = new Set([vgField(fieldDef, {forAs: true})]);\n } else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] ??= {};\n meas[argField][op] = new Set([vgField({op, field: argField}, {forAs: true})]);\n } else {\n meas[field] ??= {};\n meas[field][aggregate] = new Set([vgField(fieldDef, {forAs: true})]);\n }\n\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] ??= {};\n meas[field]['min'] = new Set([vgField({field, aggregate: 'min'}, {forAs: true})]);\n meas[field]['max'] = new Set([vgField({field, aggregate: 'max'}, {forAs: true})]);\n }\n }\n } else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode {\n const dims = new Set();\n const meas: Measures = {};\n\n for (const s of t.aggregate) {\n const {op, field, as} = s;\n if (op) {\n if (op === 'count') {\n meas['*'] ??= {};\n meas['*']['count'] = new Set([as ? as : vgField(s, {forAs: true})]);\n } else {\n meas[field] ??= {};\n meas[field][op] = new Set([as ? as : vgField(s, {forAs: true})]);\n }\n }\n }\n\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public merge(other: AggregateNode): boolean {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n }\n log.debug('different dimensions, cannot merge');\n return false;\n }\n\n public addDimensions(fields: readonly string[]) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n\n public dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n\n public producedFields() {\n const out = new Set();\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n } else {\n m.forEach(out.add, out);\n }\n }\n }\n\n return out;\n }\n\n public hash() {\n return `Aggregate ${hash({dimensions: this.dimensions, measures: this.measures})}`;\n }\n\n public assemble(): VgAggregateTransform {\n const ops: AggregateOp[] = [];\n const fields: string[] = [];\n const as: string[] = [];\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n\n const result: VgAggregateTransform = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n\n return result;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {hasDiscreteDomain} from '../../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField} from '../../sort';\nimport {hash} from '../../util';\nimport {isVgRangeStep, VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {HEADER_CHANNELS, HEADER_TYPES} from '../header/component';\nimport {Model} from '../model';\nimport {assembleDomain, getFieldFromDomain} from '../scale/domain';\nimport {sortArrayIndexField} from './calculate';\nimport {DataFlowNode} from './dataflow';\n\ninterface ChildIndependentFieldsWithStep {\n x?: string;\n y?: string;\n}\n\ninterface FacetChannelInfo {\n name: string;\n fields: string[];\n sortField?: EncodingSortField;\n\n sortIndexField?: string;\n}\n\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n private readonly column: FacetChannelInfo;\n\n private readonly row: FacetChannelInfo;\n\n private readonly facet: FacetChannelInfo;\n\n private readonly childModel: Model;\n\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n public constructor(\n parent: DataFlowNode,\n public readonly model: FacetModel,\n public readonly name: string,\n public data: string\n ) {\n super(parent);\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const {bin, sort} = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, {binSuffix: 'end'})] : [])],\n ...(isSortField(sort)\n ? {sortField: sort}\n : isArray(sort)\n ? {sortIndexField: sortArrayIndexField(fieldDef, channel)}\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n\n public hash() {\n let out = `Facet`;\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n\n return out;\n }\n\n get fields() {\n const f: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n\n public dependentFields() {\n const depFields = new Set(this.fields);\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n\n return depFields;\n }\n\n public producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n\n /**\n * The name to reference this source is its name.\n */\n public getSource() {\n return this.name;\n }\n\n private getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep: ChildIndependentFieldsWithStep = {};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n\n return childIndependentFieldsWithStep;\n }\n\n private assembleRowColumnHeaderData(\n channel: 'row' | 'column' | 'facet',\n crossedDataName: string,\n childIndependentFieldsWithStep: ChildIndependentFieldsWithStep\n ): VgData {\n const childChannel = {row: 'y', column: 'x', facet: undefined}[channel];\n\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n\n ops.push('max');\n } else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n\n const {sortField, sortIndexField} = this[channel];\n if (sortField) {\n const {op = DEFAULT_SORT_OP, field} = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, {forAs: true}));\n } else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n\n private assembleFacetHeaderData(childIndependentFieldsWithStep: ChildIndependentFieldsWithStep) {\n const {columns} = this.model.layout;\n const {layoutHeaders} = this.model.component;\n const data: VgData[] = [];\n\n const hasSharedAxis: {row?: true; column?: true} = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n\n const stop =\n headerChannel === 'row'\n ? columns\n ? {signal: `ceil(${cardinality} / ${columns})`}\n : 1\n : columns\n ? {signal: `min(${cardinality}, ${columns})`}\n : {signal: cardinality};\n\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n\n const {row, column} = hasSharedAxis;\n\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n\n return data;\n }\n\n public assemble() {\n const data: VgData[] = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n\n const {column, row, facet} = this;\n\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n\n const fields: string[] = [].concat(\n childIndependentFieldsWithStep.x ?? [],\n childIndependentFieldsWithStep.y ?? []\n );\n const ops = fields.map((): AggregateOp => 'distinct');\n\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n\n return data;\n }\n}\n","import {FormulaTransform as VgFormulaTransform, SignalRef} from 'vega';\nimport {isNumber, isString} from 'vega-util';\nimport {AncestorParse} from '.';\nimport {isMinMaxOp} from '../../aggregate';\nimport {getMainRangeChannel, SingleDefChannel} from '../../channel';\nimport {\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n isTypedFieldDef,\n TypedFieldDef\n} from '../../channeldef';\nimport {isGenerator, Parse} from '../../data';\nimport {DateTime, isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {forEachLeaf} from '../../logical';\nimport {isPathMark} from '../../mark';\nimport {\n isFieldEqualPredicate,\n isFieldGTEPredicate,\n isFieldGTPredicate,\n isFieldLTEPredicate,\n isFieldLTPredicate,\n isFieldOneOfPredicate,\n isFieldPredicate,\n isFieldRangePredicate\n} from '../../predicate';\nimport {isSortField} from '../../sort';\nimport {FilterTransform} from '../../transform';\nimport {accessPathDepth, accessPathWithDatum, Dict, duplicate, hash, keys, removePathFromField} from '../../util';\nimport {signalRefOrValue} from '../common';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {Split} from '../split';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern: string) {\n if ((pattern.startsWith(\"'\") && pattern.endsWith(\"'\")) || (pattern.startsWith('\"') && pattern.endsWith('\"'))) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field: string, parse: string): string {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n } else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n } else if (parse === 'string') {\n return `toString(${f})`;\n } else if (parse === 'date') {\n return `toDate(${f})`;\n } else if (parse === 'flatten') {\n return f;\n } else if (parse.startsWith('date:')) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n } else if (parse.startsWith('utc:')) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n } else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\n\nexport function getImplicitFromFilterTransform(transform: FilterTransform) {\n const implicit: Dict = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val: string | number | boolean | DateTime | SignalRef = null;\n\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = signalRefOrValue(filter.equal);\n } else if (isFieldLTEPredicate(filter)) {\n val = signalRefOrValue(filter.lte);\n } else if (isFieldLTPredicate(filter)) {\n val = signalRefOrValue(filter.lt);\n } else if (isFieldGTPredicate(filter)) {\n val = signalRefOrValue(filter.gt);\n } else if (isFieldGTEPredicate(filter)) {\n val = signalRefOrValue(filter.gte);\n } else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n } else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n } else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n } else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model: Model) {\n const implicit: Dict = {};\n\n function add(fieldDef: TypedFieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n } else if (\n fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n } else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n } else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel as SingleDefChannel) as TypedFieldDef;\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const {mark, markDef, encoding} = model;\n if (\n isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order\n ) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (\n isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)\n ) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model: Model) {\n const implicit: Dict = {};\n\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n\n return implicit;\n}\n\nexport class ParseNode extends DataFlowNode {\n private _parse: Parse;\n\n public clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n\n constructor(parent: DataFlowNode, parse: Parse) {\n super(parent);\n\n this._parse = parse;\n }\n\n public hash() {\n return `Parse ${hash(this._parse)}`;\n }\n\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n public static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data?.format?.parse) {\n explicit = data.format.parse;\n }\n\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n public static makeWithAncestors(\n parent: DataFlowNode,\n explicit: Parse,\n implicit: Parse,\n ancestorParse: AncestorParse\n ) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (\n parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten'\n ) {\n delete implicit[field];\n } else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n } else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n\n const parse = new Split(explicit, implicit);\n\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n\n // copy only non-null parses\n const p: Dict = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n\n return new ParseNode(parent, p);\n }\n\n public get parse() {\n return this._parse;\n }\n\n public merge(other: ParseNode) {\n this._parse = {...this._parse, ...other.parse};\n other.remove();\n }\n\n /**\n * Assemble an object for Vega's format.parse property.\n */\n public assembleFormatParse() {\n const formatParse: Dict = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n\n // format parse depends and produces all fields in its parse\n public producedFields() {\n return new Set(keys(this._parse));\n }\n\n public dependentFields() {\n return new Set(keys(this._parse));\n }\n\n public assembleTransforms(onlyNested = false): VgFormulaTransform[] {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n\n const formula: VgFormulaTransform = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n","import {SELECTION_ID} from '../../selection';\nimport {IdentifierTransform as VgIdentifierTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class IdentifierNode extends DataFlowNode {\n public clone() {\n return new IdentifierNode(null);\n }\n\n constructor(parent: DataFlowNode) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([SELECTION_ID]);\n }\n\n public hash() {\n return 'Identifier';\n }\n\n public assemble(): VgIdentifierTransform {\n return {type: 'identifier', as: SELECTION_ID};\n }\n}\n","import {GraticuleTransform as VgGraticuleTransform} from 'vega';\nimport {GraticuleParams} from '../../data';\nimport {hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\nexport class GraticuleNode extends DataFlowNode {\n public clone() {\n return new GraticuleNode(null, this.params);\n }\n\n constructor(\n parent: DataFlowNode,\n private params: true | GraticuleParams\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // there should never be a node before graticule\n }\n\n public hash() {\n return `Graticule ${hash(this.params)}`;\n }\n\n public assemble(): VgGraticuleTransform {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n","import {SequenceParams} from '../../data';\nimport {hash} from '../../util';\nimport {SequenceTransform as VgSequenceTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class SequenceNode extends DataFlowNode {\n public clone() {\n return new SequenceNode(null, this.params);\n }\n\n constructor(\n parent: DataFlowNode,\n private params: SequenceParams\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n\n public hash() {\n return `Hash ${hash(this.params)}`;\n }\n\n public assemble(): VgSequenceTransform {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n","import {\n Data,\n DataFormat,\n DataFormatType,\n isGenerator,\n isInlineData,\n isNamedData,\n isSphereGenerator,\n isUrlData\n} from '../../data';\nimport {contains, isEmpty, omit} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataFlowNode} from './dataflow';\n\nexport class SourceNode extends DataFlowNode {\n private _data: Partial;\n\n private _name: string;\n\n private _generator: boolean;\n\n constructor(data: Data) {\n super(null); // source cannot have parent\n\n data ??= {name: 'source'};\n let format;\n\n if (!isGenerator(data)) {\n format = data.format ? {...omit(data.format, ['parse'])} : ({} as DataFormat);\n }\n\n if (isInlineData(data)) {\n this._data = {values: data.values};\n } else if (isUrlData(data)) {\n this._data = {url: data.url};\n\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension as DataFormatType;\n }\n } else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = {values: [{type: 'Sphere'}]};\n } else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n\n // set flag to check if generator\n this._generator = isGenerator(data);\n\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // we don't know what this source produces\n }\n\n get data() {\n return this._data;\n }\n\n public hasName(): boolean {\n return !!this._name;\n }\n\n get isGenerator() {\n return this._generator;\n }\n\n get dataName() {\n return this._name;\n }\n\n set dataName(name: string) {\n this._name = name;\n }\n\n set parent(parent: DataFlowNode) {\n throw new Error('Source nodes have to be roots.');\n }\n\n public remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n\n public hash(): string | number {\n throw new Error('Cannot hash sources');\n }\n\n public assemble(): VgData {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n","import {DataFlowNode} from './dataflow';\nimport {GraticuleNode} from './graticule';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\n\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node: DataFlowNode) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n\n/**\n * Abstract base class for Dataflow optimizers.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nexport abstract class Optimizer {\n #modified: boolean;\n\n constructor() {\n this.#modified = false;\n }\n\n // Once true, #modified is never set to false\n public setModified() {\n this.#modified = true;\n }\n\n get modifiedFlag() {\n return this.#modified;\n }\n\n /**\n * Run the optimization for the tree with the provided root.\n */\n public abstract optimize(root: DataFlowNode): boolean;\n}\n\n/**\n * Starts from a node and runs the optimization function (the \"run\" method) upwards to the root,\n * depending on the continue and modified flag values returned by the optimization function.\n */\nexport abstract class BottomUpOptimizer extends Optimizer {\n /**\n * Run the optimizer at the node. This method should not change the parent of the passed in node (it should only affect children).\n */\n public abstract run(node: DataFlowNode): void;\n\n /**\n * Compute a map of node depths that we can use to determine a topological sort order.\n */\n private getNodeDepths(\n node: DataFlowNode,\n depth: number,\n depths: Map\n ): Map {\n depths.set(node, depth);\n\n for (const child of node.children) {\n this.getNodeDepths(child, depth + 1, depths);\n }\n\n return depths;\n }\n\n /**\n * Run the optimizer on all nodes starting from the leaves.\n */\n public optimize(node: DataFlowNode): boolean {\n const depths = this.getNodeDepths(node, 0, new Map());\n const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]);\n\n for (const tuple of topologicalSort) {\n this.run(tuple[0]);\n }\n\n return this.modifiedFlag;\n }\n}\n\n/**\n * The optimizer function (the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport abstract class TopDownOptimizer extends Optimizer {\n /**\n * Run the optimizer at the node.\n */\n public abstract run(node: DataFlowNode): void;\n\n /**\n * Run the optimizer depth first on all nodes starting from the roots.\n */\n public optimize(node: DataFlowNode): boolean {\n this.run(node);\n\n for (const child of node.children) {\n this.optimize(child);\n }\n\n return this.modifiedFlag;\n }\n}\n","import {Parse} from '../../data';\nimport {Dict, fieldIntersection, hash, hasIntersection, isEmpty, keys, some} from '../../util';\nimport {Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {ParseNode} from './formatparse';\nimport {IdentifierNode} from './identifier';\nimport {BottomUpOptimizer, isDataSourceNode, Optimizer, TopDownOptimizer} from './optimizer';\nimport {SourceNode} from './source';\nimport {TimeUnitNode} from './timeunit';\n\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n public mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n\n public run(node: DataFlowNode) {\n const hashes = node.children.map(x => x.hash());\n const buckets: {hash?: DataFlowNode[]} = {};\n\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n } else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setModified();\n this.mergeNodes(node, buckets[k]);\n }\n }\n }\n}\n\n/**\n * Optimizer that removes identifier nodes that are not needed for selections.\n */\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n private requiresSelectionId: boolean;\n\n constructor(model: Model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n\n public run(node: DataFlowNode) {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (\n !(\n this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode)\n )\n ) {\n this.setModified();\n node.remove();\n }\n }\n }\n}\n\n/**\n * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to\n * selections projected over time units. Only keeps the first time unit in any branch.\n *\n * This optimizer is a custom top down optimizer that keep track of produced fields in a branch.\n */\nexport class RemoveDuplicateTimeUnits extends Optimizer {\n public optimize(node: DataFlowNode): boolean {\n this.run(node, new Set());\n\n return this.modifiedFlag;\n }\n\n public run(node: DataFlowNode, timeUnitFields: Set) {\n let producedFields = new Set();\n\n if (node instanceof TimeUnitNode) {\n producedFields = node.producedFields();\n if (hasIntersection(producedFields, timeUnitFields)) {\n this.setModified();\n node.removeFormulas(timeUnitFields);\n if (node.producedFields.length === 0) {\n node.remove();\n }\n }\n }\n\n for (const child of node.children) {\n this.run(child, new Set([...timeUnitFields, ...producedFields]));\n }\n }\n}\n\n/**\n * Remove output nodes that are not required.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n\n public run(node: DataFlowNode) {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setModified();\n node.remove();\n }\n }\n}\n\n/**\n * Move parse nodes up to forks and merges them if possible.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n if (isDataSourceNode(node)) {\n return;\n }\n\n if (node.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n return;\n }\n\n for (const child of node.children) {\n if (child instanceof ParseNode) {\n if (node instanceof ParseNode) {\n this.setModified();\n node.merge(child);\n } else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(node.producedFields(), child.dependentFields())) {\n continue;\n }\n this.setModified();\n child.swapWithParent();\n }\n }\n }\n\n return;\n }\n}\n\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const originalChildren = [...node.children];\n const parseChildren = node.children.filter((child): child is ParseNode => child instanceof ParseNode);\n\n if (node.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse: Parse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n } else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n\n if (!isEmpty(commonParse)) {\n this.setModified();\n const mergedParseNode = new ParseNode(node, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n\n node.removeChild(childNode);\n childNode.parent = mergedParseNode;\n\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n }\n}\n\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n } else if (node instanceof SourceNode) {\n // ignore empty unused sources as they will be removed in optimizationDataflowHelper\n } else {\n this.setModified();\n node.remove();\n }\n }\n}\n\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const timeUnitChildren = node.children.filter((x): x is TimeUnitNode => x instanceof TimeUnitNode);\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setModified();\n combination.merge(timeUnit);\n }\n }\n}\n\nexport class MergeAggregates extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const aggChildren = node.children.filter((child): child is AggregateNode => child instanceof AggregateNode);\n\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates: Dict = {};\n\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n node.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n\n this.setModified();\n }\n }\n }\n }\n }\n}\n\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(private model: Model) {\n super();\n }\n\n public run(node: DataFlowNode) {\n const moveBinsUp = !(\n isDataSourceNode(node) ||\n node instanceof FilterNode ||\n node instanceof ParseNode ||\n node instanceof IdentifierNode\n );\n\n const promotableBins: BinNode[] = [];\n const remainingBins: BinNode[] = [];\n\n for (const child of node.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n } else {\n remainingBins.push(child);\n }\n }\n }\n\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n if (node instanceof BinNode) {\n node.merge(promotedBin, this.model.renameSignal.bind(this.model));\n } else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n }\n }\n}\n\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const children = [...node.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n\n if (!hasOutputChild || node.numChildren() <= 1) {\n return;\n }\n\n const otherChildren: DataFlowNode[] = [];\n\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput: OutputNode;\n\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n } else {\n break;\n }\n }\n\n otherChildren.push(...lastOutput.children);\n\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n\n // note: the child is the first output\n node.removeChild(child);\n child.parent = mainOutput.parent;\n\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n\n this.setModified();\n } else {\n mainOutput = lastOutput;\n }\n } else {\n otherChildren.push(child);\n }\n }\n\n if (otherChildren.length) {\n this.setModified();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n }\n}\n","import {AggregateOp} from 'vega';\nimport {vgField} from '../../channeldef';\nimport {JoinAggregateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgJoinAggregateTransform} from '../../vega.schema';\nimport {JoinAggregateFieldDef} from '../../transform';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n public clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: JoinAggregateTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n\n private getDefaultName(joinAggregateFieldDef: JoinAggregateFieldDef): string {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n\n public hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n\n const groupby = this.transform.groupby;\n\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {Transforms as VgTransform} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {FieldDef, FieldName, getFieldDef, isFieldDef, isOrderOnlyDef, vgField} from '../../channeldef';\nimport {SortFields, SortOrder} from '../../sort';\nimport {StackOffset} from '../../stack';\nimport {StackTransform} from '../../transform';\nimport {duplicate, getFirstDefined, hash} from '../../util';\nimport {sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nfunction getStackByFields(model: UnitModel): string[] {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, [] as string[]);\n}\n\nexport interface StackComponent {\n /**\n * Faceted field.\n */\n facetby: string[];\n\n dimensionFieldDefs: FieldDef[];\n\n /**\n * Stack measure's field. Used in makeFromEncoding.\n */\n stackField: string;\n\n /**\n * Level of detail fields for each level in the stacked charts such as color or detail.\n * Used in makeFromEncoding.\n */\n stackby?: string[];\n\n /**\n * Field that determines order of levels in the stacked charts.\n * Used in both but optional in transform.\n */\n sort: SortFields;\n\n /** Mode for stacking marks.\n */\n offset: StackOffset;\n\n /**\n * Whether to impute the data before stacking. Used only in makeFromEncoding.\n */\n impute?: boolean;\n\n /**\n * The data fields to group by.\n */\n groupby?: FieldName[];\n /**\n * Output field names of each stack field.\n */\n as: [FieldName, FieldName];\n}\n\nfunction isValidAsArray(as: string[] | string): as is string[] {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\n\nexport class StackNode extends DataFlowNode {\n private _stack: StackComponent;\n\n public clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n\n constructor(parent: DataFlowNode, stack: StackComponent) {\n super(parent);\n\n this._stack = stack;\n }\n\n public static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform) {\n const {stack, groupby, as, offset = 'zero'} = stackTransform;\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort: SortFields = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs: [string, string];\n if (isValidAsArray(as)) {\n normalizedAs = as;\n } else if (isString(as)) {\n normalizedAs = [as, `${as}_end`];\n } else {\n normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`];\n }\n\n return new StackNode(parent, {\n dimensionFieldDefs: [],\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const stackProperties = model.stack;\n const {encoding} = model;\n\n if (!stackProperties) {\n return null;\n }\n\n const {groupbyChannels, fieldChannel, offset, impute} = stackProperties;\n\n const dimensionFieldDefs = groupbyChannels\n .map(groupbyChannel => {\n const cDef = encoding[groupbyChannel];\n return getFieldDef(cDef);\n })\n .filter(def => !!def);\n\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n\n let sort: SortFields;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n } else {\n const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending';\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce(\n (s, field) => {\n s.field.push(field);\n s.order.push(sortOrder);\n return s;\n },\n {field: [], order: []}\n );\n }\n\n return new StackNode(parent, {\n dimensionFieldDefs,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, {suffix: 'start', forAs: true}),\n model.vgField(fieldChannel, {suffix: 'end', forAs: true})\n ]\n });\n }\n\n get stack(): StackComponent {\n return this._stack;\n }\n\n public addDimensions(fields: string[]) {\n this._stack.facetby.push(...fields);\n }\n\n public dependentFields() {\n const out = new Set();\n\n out.add(this._stack.stackField);\n\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this._stack.as);\n }\n\n public hash() {\n return `Stack ${hash(this._stack)}`;\n }\n\n private getGroupbyFields() {\n const {dimensionFieldDefs, impute, groupby} = this._stack;\n\n if (dimensionFieldDefs.length > 0) {\n return dimensionFieldDefs\n .map(dimensionFieldDef => {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, {binSuffix: 'mid'})];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, {binSuffix: 'end'})\n ];\n }\n return [vgField(dimensionFieldDef)];\n })\n .flat();\n }\n return groupby ?? [];\n }\n\n public assemble(): VgTransform[] {\n const transform: VgTransform[] = [];\n const {facetby, dimensionFieldDefs, stackField: field, stackby, sort, offset, impute, as} = this._stack;\n\n // Impute\n if (impute) {\n for (const dimensionFieldDef of dimensionFieldDefs) {\n const {bandPosition = 0.5, bin} = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n\n const binStart = vgField(dimensionFieldDef, {expr: 'datum'});\n const binEnd = vgField(dimensionFieldDef, {expr: 'datum', binSuffix: 'end'});\n transform.push({\n type: 'formula',\n expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`,\n as: vgField(dimensionFieldDef, {binSuffix: 'mid', forAs: true})\n });\n }\n\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, {binSuffix: 'mid'}),\n method: 'value',\n value: 0\n });\n }\n }\n\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n\n return transform;\n }\n}\n","import {AggregateOp, WindowTransform as VgWindowTransform} from 'vega';\nimport {isAggregateOp} from '../../aggregate';\nimport {vgField} from '../../channeldef';\nimport {SortOrder} from '../../sort';\nimport {WindowFieldDef, WindowOnlyOp, WindowTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgComparator, VgJoinAggregateTransform} from '../../vega.schema';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n public clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: WindowTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n\n private getDefaultName(windowFieldDef: WindowFieldDef): string {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n\n public hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgWindowTransform | VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: (AggregateOp | WindowOnlyOp)[] = [];\n const as: string[] = [];\n const params = [];\n\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops as AggregateOp[],\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n } as VgJoinAggregateTransform;\n }\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort: VgComparator = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? {ignorePeers} : {}),\n ...(groupby !== undefined ? {groupby} : {}),\n ...(frame !== undefined ? {frame} : {})\n } as VgWindowTransform;\n }\n}\n","import {DataSourceType} from '../../data';\nimport {AggregateNode} from './aggregate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {FACET_SCALE_PREFIX} from './optimize';\nimport {StackNode} from './stack';\nimport {WindowTransformNode} from './window';\n\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet: FacetNode) {\n function clone(node: DataFlowNode): DataFlowNode[] {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n\n facet.model.component.data.outputNodes[newName] = copy;\n } else if (\n copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode\n ) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n\n return [copy];\n }\n\n return node.children.flatMap(clone);\n }\n return clone;\n}\n\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node: DataFlowNode) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n\n if (\n child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode\n ) {\n child.addDimensions(node.fields);\n }\n\n child.swapWithParent();\n moveFacetDown(node);\n } else {\n // move main to facet\n\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy: DataFlowNode[] = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n } else {\n node.children.map(moveFacetDown);\n }\n}\n\nfunction moveMainDownToFacet(node: DataFlowNode) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n","import {DataComponent} from '.';\nimport * as log from '../../log';\nimport {Model} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {Optimizer} from './optimizer';\nimport * as optimizers from './optimizers';\nimport {moveFacetDown} from './subtree';\n\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes: readonly DataFlowNode[]): boolean {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n */\nfunction runOptimizer(optimizer: Optimizer, nodes: DataFlowNode[]): boolean {\n let modified = false;\n\n for (const node of nodes) {\n modified = optimizer.optimize(node) || modified;\n }\n\n return modified;\n}\n\nfunction optimizationDataflowHelper(dataComponent: DataComponent, model: Model, firstPass: boolean) {\n let roots = dataComponent.sources;\n let modified = false;\n\n modified = runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots) || modified;\n\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n\n modified = runOptimizer(new optimizers.RemoveUnusedSubtrees(), roots) || modified;\n\n roots = roots.filter(r => r.numChildren() > 0);\n\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n modified = runOptimizer(new optimizers.MoveParseUp(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeBins(model), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeParse(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeAggregates(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeIdenticalNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeOutputs(), roots) || modified;\n }\n\n dataComponent.sources = roots;\n\n return modified;\n}\n\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data: DataComponent, model: Model) {\n // check before optimizations\n checkLinks(data.sources);\n\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(moveFacetDown);\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n\n // check after optimizations\n checkLinks(data.sources);\n\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n","import type {SignalRef} from 'vega';\n\nexport type Rename = (oldSignalName: string) => string;\n\n/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper implements SignalRef {\n constructor(exprGenerator: () => string) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n\n public signal: string; // for ts\n\n public static fromName(rename: Rename, signalName: string) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isObject, isString} from 'vega-util';\nimport {\n Aggregate,\n isAggregateOp,\n isArgmaxDef,\n isArgminDef,\n MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX,\n NonArgAggregateOp,\n SHARED_DOMAIN_OPS\n} from '../../aggregate';\nimport {isBinning, isBinParams, isParameterExtent} from '../../bin';\nimport {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../channel';\nimport {\n binRequiresRange,\n getBandPosition,\n getFieldOrDatumDef,\n hasBandEnd,\n isDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr,\n vgField\n} from '../../channeldef';\nimport {CompositeAggregate} from '../../compositemark';\nimport {DataSourceType} from '../../data';\nimport {DateTime} from '../../datetime';\nimport {ExprRef} from '../../expr';\nimport * as log from '../../log';\nimport {Domain, hasDiscreteDomain, isDomainUnionWith, isParameterDomain, ScaleConfig, ScaleType} from '../../scale';\nimport {ParameterExtent} from '../../selection';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortArray, isSortByEncoding, isSortField} from '../../sort';\nimport {normalizeTimeUnit, TimeUnit, TimeUnitTransformParams} from '../../timeunit';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {\n isDataRefDomain,\n isDataRefUnionedDomain,\n isFieldRefUnionDomain,\n isSignalRef,\n VgDomain,\n VgMultiFieldsRefWithSort,\n VgNonUnionDomain,\n VgScaleDataRefWithSort,\n VgSortField,\n VgUnionSortField\n} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {FACET_SCALE_PREFIX} from '../data/optimize';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {isRectBasedMark} from '../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from '../data/timeunit';\n\nexport function parseScaleDomain(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n } else {\n parseNonUnitScaleDomain(model);\n }\n}\n\nfunction parseUnitScaleDomain(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent: Model = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n\n const resolve = facetParent.component.resolve.scale[channel];\n\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\n\nfunction parseNonUnitScaleDomain(model: Model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n let domains: Explicit;\n let selectionExtent: ParameterExtent = null;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n } else {\n domains = mergeValuesWithExplicit(\n domains,\n childComponent.getWithExplicit('domains'),\n 'domains',\n 'scale',\n domainsTieBreaker\n );\n }\n\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.param !== se.param) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n\n localScaleComponents[channel].setWithExplicit('domains', domains);\n\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(\n domain: Domain,\n fieldDef: TypedFieldDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig\n) {\n if (domain === 'unaggregated') {\n const {valid, reason} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const {valid} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n\n return domain;\n}\n\nexport function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit {\n const scaleType = model.getScaleComponent(channel).get('type');\n const {encoding} = model;\n\n const domain = normalizeUnaggregatedDomain(\n model.scaleDomain(channel),\n model.typedFieldDef(channel),\n scaleType,\n model.config.scale\n );\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'x'),\n parseSingleChannelDomain(scaleType, domain, model, 'x2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'y'),\n parseSingleChannelDomain(scaleType, domain, model, 'y2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\n\nfunction mapDomainToDataSignal(\n domain: (number | string | boolean | DateTime | ExprRef | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit\n) {\n return domain.map(v => {\n const data = valueExpr(v, {timeUnit, type});\n return {signal: `{data: ${data}}`};\n });\n}\n\nfunction convertDomainIfItIsDateTime(\n domain: (number | string | boolean | DateTime | ExprRef | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit | TimeUnitTransformParams\n): [number[]] | [string[]] | [boolean[]] | SignalRef[] {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n\n return [domain] as [number[]] | [string[]] | [boolean[]]; // Date time won't make sense\n}\n\nfunction parseSingleChannelDomain(\n scaleType: ScaleType,\n domain: Domain,\n model: UnitModel,\n channel: ScaleChannel | 'x2' | 'y2'\n): Explicit {\n const {encoding, markDef, mark, config, stack} = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleDatumDef | ScaleFieldDef;\n\n const {type} = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n\n return makeExplicit([...unionWith, ...defaultDomain.value]);\n } else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n } else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, {suffix: 'start'})\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n }\n\n const sort: undefined | true | VgSortField =\n isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const {field} = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({field, aggregate: 'min'})\n },\n {\n data,\n field: vgField({field, aggregate: 'max'})\n }\n ]);\n } else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort:\n sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n } else {\n // continuous scales\n const {bin} = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n } else if (fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType)) {\n const fieldDef2 = encoding[getSecondaryRangeChannel(channel)];\n\n if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) {\n const data = model.requestDataName(DataSourceType.Main);\n\n const bandPosition = getBandPosition({fieldDef, fieldDef2, markDef, config});\n const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5;\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, isRectWithOffset ? {suffix: OFFSETTED_RECT_START_SUFFIX} : {})\n },\n {\n data,\n field: model.vgField(channel, {suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end'})\n }\n ]);\n }\n }\n if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort\n }\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\n\nfunction normalizeSortField(sort: EncodingSortField, isStackedMeasure: boolean): VgSortField {\n const {op, field, order} = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? {field: util.replacePathInField(field)} : {}),\n\n ...(order ? {order} : {})\n };\n}\n\nfunction parseSelectionDomain(model: UnitModel, channel: ScaleChannel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isParameterDomain(spec) && spec;\n const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent;\n\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\n\nexport function domainSort(\n model: UnitModel,\n channel: ScaleChannel,\n scaleType: ScaleType\n): undefined | true | VgSortField {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel) as ScaleFieldDef;\n const sort = fieldDef.sort;\n\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n\n const {stack} = model;\n const stackDimensions = stack\n ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)])\n : undefined;\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !stackDimensions.has(sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n } else if (isSortByEncoding(sort)) {\n const {encoding, order} = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const {aggregate, field} = fieldDefToSortBy;\n\n const isStackedMeasure = stack && !stackDimensions.has(field);\n\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField(\n {\n field: vgField(fieldDefToSortBy),\n order\n },\n isStackedMeasure\n );\n } else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField(\n {\n op: aggregate as NonArgAggregateOp, // can't be argmin/argmax since we don't support them in encoding field def\n field,\n order\n },\n isStackedMeasure\n );\n }\n } else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n } else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n\n // sort == null\n return undefined;\n}\n\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(\n fieldDef: TypedFieldDef,\n scaleType: ScaleType\n): {valid: boolean; reason?: string} {\n const {aggregate, type} = fieldDef;\n\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n\n if (isString(aggregate) && !(SHARED_DOMAIN_OPS as Set).has(aggregate)) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n\n return {valid: true};\n}\n\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: 'domains',\n propertyOf: 'scale'\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return {explicit: v1.explicit, value: [...v1.value, ...v2.value]};\n}\n\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains: VgNonUnionDomain[]): VgDomain {\n const uniqueDomains = util.unique(\n domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const {sort: _s, ...domainWithoutSort} = domain;\n return domainWithoutSort;\n }\n return domain;\n }),\n util.hash\n );\n\n const sorts: VgSortField[] = util.unique(\n domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined),\n util.hash\n );\n\n if (uniqueDomains.length === 0) {\n return undefined;\n } else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n // Get sorts with non-default ops\n const filteredSorts = sorts.filter(s => isObject(s) && 'op' in s && s.op !== 'min');\n if (sorts.every(s => isObject(s) && 'op' in s) && filteredSorts.length === 1) {\n sort = filteredSorts[0];\n } else {\n sort = true;\n }\n } else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? {order: sort.order} : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(\n sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || (isString(s.op) && s.op in UNIONDOMAIN_SORT_OP_INDEX)) {\n return s as VgUnionSortField;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }),\n util.hash\n ) as VgUnionSortField[];\n\n let sort: VgUnionSortField;\n\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n } else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n\n const allData = util.unique(\n domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }),\n x => x\n );\n\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain: VgMultiFieldsRefWithSort = {\n data: allData[0],\n fields: uniqueDomains.map(d => (d as VgScaleDataRefWithSort).field),\n ...(sort ? {sort} : {})\n };\n\n return domain;\n }\n\n return {fields: uniqueDomains, ...(sort ? {sort} : {})};\n}\n\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain: VgDomain): string {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n } else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n } else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n } else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n\n return undefined;\n}\n\nexport function assembleDomain(model: Model, channel: ScaleChannel) {\n const scaleComponent: ScaleComponent = model.component.scales[channel];\n\n const domains = scaleComponent.get('domains').map((domain: VgNonUnionDomain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n\n return domain;\n });\n\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n","import {isObject} from 'vega-util';\nimport {isXorY, ScaleChannel} from '../../channel';\nimport {keys} from '../../util';\nimport {isDataRefDomain, isVgRangeStep, VgRange, VgScale} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\nimport {assembleSelectionScaleDomain} from '../selection/assemble';\nimport {assembleDomain} from './domain';\n\nexport function assembleScales(model: Model): VgScale[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n } else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\n\nexport function assembleScalesForModel(model: Model): VgScale[] {\n return keys(model.component.scales).reduce((scales: VgScale[], channel: ScaleChannel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n\n const scale = scaleComponent.combine();\n const {name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps} = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n\n const domain = assembleDomain(model, channel);\n const domainRaw = selectionExtent\n ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain)\n : null;\n\n scales.push({\n name,\n type,\n ...(domain ? {domain} : {}),\n ...(domainRaw ? {domainRaw} : {}),\n range,\n ...(reverse !== undefined ? {reverse: reverse as any} : {}),\n ...otherScaleProps\n });\n\n return scales;\n }, [] as VgScale[]);\n}\n\nexport function assembleScaleRange(\n scaleRange: VgRange,\n scaleName: string,\n channel: ScaleChannel,\n model?: Model\n): VgRange {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: {signal: `${scaleName}_step`}\n };\n }\n } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n","import type {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {ScaleChannel} from '../../channel';\nimport {Scale, ScaleType} from '../../scale';\nimport {ParameterExtent} from '../../selection';\nimport {some} from '../../util';\nimport {VgNonUnionDomain, VgScale} from '../../vega.schema';\nimport {Explicit, Split} from '../split';\n\n/**\n * All VgDomain property except domain.\n * (We exclude domain as we have a special \"domains\" array that allow us merge them all at once in assemble.)\n */\nexport type ScaleComponentProps = Omit & {\n domains: VgNonUnionDomain[];\n selectionExtent?: ParameterExtent;\n reverse?: boolean | SignalRef; // Need override since Vega doesn't official support scale reverse yet (though it does in practice)\n};\n\nexport type Range = ScaleComponentProps['range'];\n\nexport class ScaleComponent extends Split {\n public merged = false;\n\n constructor(name: string, typeWithExplicit: Explicit) {\n super(\n {}, // no initial explicit property\n {name} // name as initial implicit property\n );\n this.setWithExplicit('type', typeWithExplicit);\n }\n\n /**\n * Whether the scale definitely includes zero in the domain\n */\n public domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(\n this.get('domains'),\n d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0\n );\n }\n}\n\nexport type ScaleComponentIndex = Partial>;\n\nexport type ScaleIndex = Partial>>;\n","import {RangeScheme, SignalRef} from 'vega';\nimport {isArray, isNumber, isObject} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {\n ANGLE,\n COLOR,\n FILL,\n FILLOPACITY,\n getOffsetScaleChannel,\n getSizeChannel,\n isXorY,\n isXorYOffset,\n OPACITY,\n PositionScaleChannel,\n RADIUS,\n ScaleChannel,\n SCALE_CHANNELS,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n THETA,\n X,\n XOFFSET,\n Y,\n YOFFSET\n} from '../../channel';\nimport {\n getBandPosition,\n getFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n ScaleDatumDef,\n ScaleFieldDef\n} from '../../channeldef';\nimport {Config, getViewConfigDiscreteSize, getViewConfigDiscreteStep, ViewConfig} from '../../config';\nimport {DataSourceType} from '../../data';\nimport {channelHasFieldOrDatum} from '../../encoding';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n hasDiscreteDomain,\n isContinuousToDiscrete,\n isExtendedScheme,\n Scale,\n ScaleType,\n scaleTypeSupportProperty,\n Scheme\n} from '../../scale';\nimport {getStepFor, isStep, LayoutSizeMixins, Step} from '../../spec/base';\nimport {isDiscrete} from '../../type';\nimport * as util from '../../util';\nimport {isSignalRef, VgRange} from '../../vega.schema';\nimport {exprFromSignalRefOrValue, signalOrStringValue} from '../common';\nimport {getBinSignalName} from '../data/bin';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex} from './component';\nimport {durationExpr} from '../../timeunit';\n\nexport const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme'];\n\nexport function parseUnitScaleRange(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\n\nfunction getBinStepSignal(model: UnitModel, channel: 'x' | 'y'): SignalRefWrapper {\n const fieldDef = model.fieldDef(channel);\n\n if (fieldDef?.bin) {\n const {bin, field} = fieldDef;\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n\n if (isObject(bin) && bin.binned && bin.step !== undefined) {\n return new SignalRefWrapper(() => {\n const scaleName = model.scaleName(channel);\n const binCount = `(domain(\"${scaleName}\")[1] - domain(\"${scaleName}\")[0]) / ${bin.step}`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n } else if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, field, bin);\n\n // TODO: extract this to be range step signal\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n }\n return undefined;\n}\n\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit {\n const specifiedScale = model.specifiedScales[channel];\n const {size} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n } else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(\n range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n })\n );\n }\n } else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: {op: 'min', field: model.vgField(channel)}\n });\n }\n\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n\n const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (isXorY(channel)) {\n if (hasDiscreteDomain(scaleType)) {\n const step = getPositionStep(sizeValue, model, channel);\n // Need to be explicit so layer with step wins over layer without step\n if (step) {\n return makeExplicit({step});\n }\n } else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n } else if (isXorYOffset(channel)) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n const positionScaleType = positionScaleCmpt.get('type');\n if (positionScaleType === 'band') {\n const step = getOffsetStep(sizeValue, scaleType);\n if (step) {\n return makeExplicit(step);\n }\n }\n }\n }\n\n const {rangeMin, rangeMax} = specifiedScale;\n const d = defaultRange(channel, model);\n\n if (\n (rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2\n ) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n\n return makeImplicit(d);\n}\n\nfunction parseScheme(scheme: Scheme | SignalRef): RangeScheme {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return {scheme};\n}\n\nfunction fullWidthOrHeightRange(\n channel: 'x' | 'y',\n model: UnitModel,\n scaleType: ScaleType,\n {center}: {center?: boolean} = {}\n) {\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n const getSignalName = model.getSignalName.bind(model);\n\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return center\n ? [\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal)\n ]\n : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n } else {\n return center\n ? [\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal)\n ]\n : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n}\n\nfunction defaultRange(channel: ScaleChannel, model: UnitModel): VgRange {\n const {size, config, mark, encoding} = model;\n\n const {type} = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n const {domain, domainMid} = model.specifiedScales[channel];\n\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n const positionSize = getDiscretePositionSize(channel, size, config.view);\n if (isStep(positionSize)) {\n const step = getPositionStep(positionSize, model, channel);\n return {step};\n }\n }\n\n return fullWidthOrHeightRange(channel, model, scaleType);\n }\n\n case XOFFSET:\n case YOFFSET:\n return getOffsetRange(channel, model, scaleType);\n\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(\n rangeMin,\n rangeMax,\n defaultContinuousToDiscreteCount(scaleType, config, domain, channel)\n );\n } else {\n return [rangeMin, rangeMax];\n }\n }\n\n case THETA:\n return [0, Math.PI * 2];\n\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n } else {\n if (domainMid !== undefined) {\n return 'diverging';\n } else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n}\n\nfunction getPositionStep(step: Step, model: UnitModel, channel: PositionScaleChannel): number | SignalRef {\n const {encoding} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const offsetChannel = getOffsetScaleChannel(channel);\n const offsetDef = encoding[offsetChannel];\n const stepFor = getStepFor({step, offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete(offsetDef.type)});\n\n if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) {\n const offsetScaleCmpt = model.getScaleComponent(offsetChannel);\n const offsetScaleName = model.scaleName(offsetChannel);\n\n let stepCount = `domain('${offsetScaleName}').length`;\n\n if (offsetScaleCmpt.get('type') === 'band') {\n const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0;\n const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0;\n stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`;\n }\n\n const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding');\n return {\n signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})`\n };\n } else {\n return step.step;\n }\n}\n\nfunction getOffsetStep(step: Step, offsetScaleType: ScaleType) {\n const stepFor = getStepFor({step, offsetIsDiscrete: hasDiscreteDomain(offsetScaleType)});\n if (stepFor === 'offset') {\n return {step: step.step};\n }\n return undefined;\n}\n\nfunction getOffsetRange(channel: string, model: UnitModel, offsetScaleType: ScaleType): VgRange {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n\n if (!positionScaleCmpt) {\n return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, {center: true});\n }\n\n const positionScaleType = positionScaleCmpt.get('type');\n const positionScaleName = model.scaleName(positionChannel);\n\n const {markDef, config} = model;\n\n if (positionScaleType === 'band') {\n const size = getDiscretePositionSize(positionChannel, model.size, model.config.view);\n\n if (isStep(size)) {\n // step is for offset\n const step = getOffsetStep(size, offsetScaleType);\n if (step) {\n return step;\n }\n }\n // otherwise use the position\n return [0, {signal: `bandwidth('${positionScaleName}')`}];\n } else {\n // continuous scale\n const positionDef = model.encoding[positionChannel];\n if (isFieldDef(positionDef) && positionDef.timeUnit) {\n const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`);\n const padding = model.config.scale.bandWithNestedOffsetPaddingInner;\n const bandPositionOffset =\n getBandPosition({\n fieldDef: positionDef,\n markDef,\n config\n }) - 0.5;\n const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : '';\n if (padding) {\n const startRatio = isSignalRef(padding)\n ? `${padding.signal}/2` + bandPositionOffsetExpr\n : `${padding / 2 + bandPositionOffset}`;\n const endRatio = isSignalRef(padding)\n ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr\n : `${1 - padding / 2 + bandPositionOffset}`;\n return [{signal: `${startRatio} * (${duration})`}, {signal: `${endRatio} * (${duration})`}];\n }\n return [0, {signal: duration}];\n }\n return util.never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`);\n }\n}\n\nfunction getDiscretePositionSize(\n channel: 'x' | 'y',\n size: LayoutSizeMixins,\n viewConfig: ViewConfig\n): Step | number | 'container' {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (sizeValue) {\n return sizeValue;\n }\n return getViewConfigDiscreteSize(viewConfig, sizeChannel);\n}\n\nexport function defaultContinuousToDiscreteCount(\n scaleType: 'quantile' | 'quantize' | 'threshold',\n config: Config,\n domain: Domain,\n channel: ScaleChannel\n) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n } else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(\n rangeMin: number | SignalRef,\n rangeMax: number | SignalRef,\n cardinality: number\n): SignalRef {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n } else {\n return {signal: f()};\n }\n}\n\nfunction sizeRangeMin(mark: Mark, zero: boolean | SignalRef, config: Config): number | SignalRef {\n if (zero) {\n if (isSignalRef(zero)) {\n return {signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}`};\n } else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\n\nfunction sizeRangeMax(\n mark: Mark,\n size: LayoutSizeMixins,\n model: UnitModel,\n config: Config\n): number | SignalRef {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n\n if (isNumber(min)) {\n return min - 1;\n } else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n } else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(\n size: LayoutSizeMixins,\n xyStepSignals: {x?: SignalRefWrapper; y?: SignalRefWrapper},\n viewConfig: ViewConfig\n): number | SignalRef {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n\n return Math.min(widthStep, heightStep);\n}\n","import {SignalRef, TimeInterval} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../bin';\nimport {\n COLOR,\n FILL,\n getSecondaryRangeChannel,\n isXorY,\n isXorYOffset,\n POLAR_POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n STROKE\n} from '../../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr\n} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isDateTime} from '../../datetime';\nimport {channelHasNestedOffsetScale} from '../../encoding';\nimport * as log from '../../log';\nimport {Mark, MarkDef, RectConfig} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n isContinuousToContinuous,\n isContinuousToDiscrete,\n Scale,\n ScaleConfig,\n ScaleType,\n scaleTypeSupportProperty\n} from '../../scale';\nimport {Sort} from '../../sort';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {contains, getFirstDefined, keys} from '../../util';\nimport {isSignalRef, VgScale} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex, ScaleComponentProps} from './component';\nimport {parseUnitScaleRange} from './range';\n\nexport function parseScaleProperty(model: Model, property: Exclude) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n } else {\n parseNonUnitScaleProperty(model, property);\n }\n}\n\nfunction parseUnitScaleProperty(model: UnitModel, property: Exclude) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n const {config, encoding, markDef, specifiedScales} = model;\n\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, {signal: valueExpr(specifiedScale[property], {type, timeUnit})}, true);\n } else {\n localScaleCmpt.set(property, specifiedScale[property] as any, true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject>(\n property,\n specifiedScale\n );\n }\n } else {\n const value =\n property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n domainMin: specifiedScale.domainMin,\n domainMax: specifiedScale.domainMax,\n markDef,\n config,\n hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel),\n hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)]\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\n\nexport interface ScaleRuleParams {\n model: Model;\n channel: ScaleChannel;\n fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef;\n hasNestedOffsetScale: boolean;\n scaleType: ScaleType;\n scalePadding: number | SignalRef;\n scalePaddingInner: number | SignalRef;\n domain: Domain;\n domainMin: Scale['domainMin'];\n domainMax: Scale['domainMax'];\n markDef: MarkDef;\n config: Config;\n hasSecondaryRangeChannel: boolean;\n}\n\nexport const scaleRules: {\n [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k];\n} = {\n bins: ({model, fieldOrDatumDef}) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n\n interpolate: ({channel, fieldOrDatumDef}) => interpolate(channel, fieldOrDatumDef.type),\n\n nice: ({scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef}) =>\n nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef),\n\n padding: ({channel, scaleType, fieldOrDatumDef, markDef, config}) =>\n padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n\n paddingInner: ({scalePadding, channel, markDef, scaleType, config, hasNestedOffsetScale}) =>\n paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale),\n\n paddingOuter: ({scalePadding, channel, scaleType, scalePaddingInner, config, hasNestedOffsetScale}) =>\n paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale),\n\n reverse: ({fieldOrDatumDef, scaleType, channel, config}) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({channel, fieldOrDatumDef, domain, markDef, scaleType, config, hasSecondaryRangeChannel}) =>\n zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel)\n};\n\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n } else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\n\nexport function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n } else {\n parseScaleProperty(child, property);\n }\n }\n\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit: Explicit;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(\n valueWithExplicit,\n childValueWithExplicit,\n property,\n 'scale',\n tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n })\n );\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\n\nexport function bins(model: Model, fieldDef: TypedFieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\n\nexport function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate'] {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\n\nexport function nice(\n scaleType: ScaleType,\n channel: ScaleChannel,\n specifiedDomain: Domain,\n domainMin: Scale['domainMin'],\n domainMax: Scale['domainMax'],\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef\n): boolean | TimeInterval {\n if (\n getFieldDef(fieldOrDatumDef)?.bin ||\n isArray(specifiedDomain) ||\n domainMax != null ||\n domainMin != null ||\n util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)\n ) {\n return undefined;\n }\n return isXorY(channel) ? true : undefined;\n}\n\nexport function padding(\n channel: ScaleChannel,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef,\n markDef: MarkDef,\n barConfig: RectConfig\n) {\n if (isXorY(channel)) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n\n const {type, orient} = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\n\nexport function paddingInner(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n mark: Mark,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n hasNestedOffsetScale = false\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n\n if (isXorY(channel)) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner, bandWithNestedOffsetPaddingInner} = scaleConfig;\n\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingInner;\n }\n\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n } else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingInner;\n }\n }\n return undefined;\n}\n\nexport function paddingOuter(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n scaleType: ScaleType,\n paddingInnerValue: number | SignalRef,\n scaleConfig: ScaleConfig,\n hasNestedOffsetScale = false\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n\n if (isXorY(channel)) {\n const {bandPaddingOuter, bandWithNestedOffsetPaddingOuter} = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingOuter;\n }\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n return getFirstDefined(\n bandPaddingOuter,\n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? {signal: `${paddingInnerValue.signal}/2`} : paddingInnerValue / 2\n );\n }\n } else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.POINT) {\n return 0.5; // so the point positions align with centers of band scales.\n } else if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingOuter;\n }\n }\n return undefined;\n}\n\nexport function reverse(\n scaleType: ScaleType,\n sort: Sort,\n channel: ScaleChannel,\n scaleConfig: ScaleConfig\n) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return {signal: `!${scaleConfig.xReverse.signal}`};\n } else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\n\nexport function zero(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n specifiedDomain: Domain,\n markDef: MarkDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n hasSecondaryRangeChannel: boolean\n) {\n // If users explicitly provide a domain, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n\n if (isNumber(first) && first <= 0 && isNumber(last) && last >= 0) {\n // if the domain includes zero, make zero remain true\n return true;\n }\n }\n return false;\n }\n }\n\n // If there is no custom domain, return configZero value (=`true` as default) only for the following cases:\n\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n // (For area/bar charts with ratio scale chart, we should always include zero.)\n if (\n !(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)\n ) {\n const {orient, type} = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n\n if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) {\n return true;\n }\n\n return scaleConfig?.zero;\n }\n\n return false;\n}\n","import {isBinning} from '../../bin';\nimport {\n getSizeChannel,\n isColorChannel,\n isScaleChannel,\n isXorY,\n isXorYOffset,\n rangeType,\n ScaleChannel\n} from '../../channel';\nimport {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport * as log from '../../log';\nimport {isRelativeBandSize, MarkDef} from '../../mark';\nimport {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport * as util from '../../util';\nimport {POLAR_POSITION_SCALE_CHANNEL_INDEX} from './../../channel';\n\nexport type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined;\n\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(\n specifiedScale: Scale,\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | DatumDef,\n mark: MarkDef,\n hasNestedOffsetScale = false\n): ScaleType {\n const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale);\n const {type} = specifiedScale;\n\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n\n return type;\n }\n\n return defaultScaleType;\n}\n\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n mark: MarkDef,\n hasNestedOffsetScale: boolean\n): ScaleType {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal': {\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n\n if (isXorY(channel) || isXorYOffset(channel)) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n if (hasNestedOffsetScale) {\n // If there is a nested offset scale, then there is a \"band\" for the span of the nested scale.\n return 'band';\n }\n } else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n\n const dimensionSize = mark[getSizeChannel(channel)];\n if (isRelativeBandSize(dimensionSize)) {\n return 'band';\n }\n\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n }\n\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n\n return 'linear';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n\n return 'linear';\n\n case 'geojson':\n return undefined;\n }\n\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n","import {ScaleChannel, SCALE_CHANNELS, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport {channelHasNestedOffsetScale} from '../../encoding';\nimport {GEOSHAPE} from '../../mark';\nimport {\n NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES,\n scaleCompatible,\n ScaleType,\n scaleTypePrecedence\n} from '../../scale';\nimport {GEOJSON} from '../../type';\nimport {keys} from '../../util';\nimport {VgScale} from '../../vega.schema';\nimport {isUnitModel, Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {parseScaleDomain} from './domain';\nimport {parseScaleProperty, parseScaleRange} from './properties';\nimport {scaleType} from './type';\n\nexport function parseScales(model: Model, {ignoreRange}: {ignoreRange?: boolean} = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\n\nexport function parseScaleCore(model: Model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n } else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model: UnitModel): ScaleComponentIndex {\n const {encoding, mark, markDef} = model;\n const scaleComponents: ScaleComponentIndex = {};\n for (const channel of SCALE_CHANNELS) {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale\n\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n continue;\n }\n\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale ??= {};\n const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel);\n\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n }\n return scaleComponents;\n}\n\nconst scaleTypeTieBreaker = tieBreakByComparing(\n (st1: ScaleType, st2: ScaleType) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)\n);\n\nfunction parseNonUnitScaleCore(model: Model) {\n const scaleComponents: ScaleComponentIndex = (model.component.scales = {});\n\n const scaleTypeWithExplicitIndex: Partial>> = {};\n const resolve = model.component.resolve;\n\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n resolve.scale[channel] ??= defaultScaleResolve(channel, model);\n\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(\n explicitScaleType,\n childScaleType,\n 'type',\n 'scale',\n scaleTypeTieBreaker\n );\n } else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n } else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n\n return scaleComponents;\n}\n","import {\n AnchorValue,\n Axis as VgAxis,\n Legend as VgLegend,\n NewSignal,\n Projection as VgProjection,\n Signal,\n SignalRef,\n Title as VgTitle\n} from 'vega';\nimport {\n Channel,\n ExtendedChannel,\n FACET_CHANNELS,\n getPositionScaleChannel,\n isChannel,\n isScaleChannel,\n ScaleChannel,\n SingleDefChannel\n} from '../channel';\nimport {ChannelDef, FieldDef, FieldRefOption, getFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {Data, DataSourceType} from '../data';\nimport {forEach, reduce} from '../encoding';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport * as log from '../log';\nimport {Resolve} from '../resolve';\nimport {hasDiscreteDomain} from '../scale';\nimport {isFacetSpec} from '../spec';\nimport {\n extractCompositionLayout,\n GenericCompositionLayoutWithColumns,\n LayoutSizeMixins,\n SpecType,\n ViewBackground\n} from '../spec/base';\nimport {NormalizedSpec} from '../spec/index';\nimport {extractTitleConfig, isText, TitleParams} from '../title';\nimport {normalizeTransform, Transform} from '../transform';\nimport {contains, Dict, duplicate, isEmpty, keys, varName} from '../util';\nimport {isVgRangeStep, VgData, VgEncodeEntry, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {assembleAxes} from './axis/assemble';\nimport {AxisComponentIndex} from './axis/component';\nimport {signalOrValueRef} from './common';\nimport {ConcatModel} from './concat';\nimport {DataComponent} from './data';\nimport {FacetModel} from './facet';\nimport {assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup} from './header/assemble';\nimport {HEADER_CHANNELS, LayoutHeaderComponent} from './header/component';\nimport {LayerModel} from './layer';\nimport {sizeExpr} from './layoutsize/assemble';\nimport {\n getSizeTypeFromLayoutSizeType,\n LayoutSizeComponent,\n LayoutSizeIndex,\n LayoutSizeType\n} from './layoutsize/component';\nimport {assembleLegends} from './legend/assemble';\nimport {LegendComponentIndex} from './legend/component';\nimport {parseLegend} from './legend/parse';\nimport {assembleProjections} from './projection/assemble';\nimport {ProjectionComponent} from './projection/component';\nimport {parseProjection} from './projection/parse';\nimport {assembleScales} from './scale/assemble';\nimport {ScaleComponent, ScaleComponentIndex} from './scale/component';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {parseScales} from './scale/parse';\nimport {SelectionComponent} from './selection';\nimport {Split} from './split';\nimport {UnitModel} from './unit';\n\n/**\n * Composable Components that are intermediate results of the parsing phase of the\n * compilations. The components represents parts of the specification in a form that\n * can be easily merged (during parsing for composite specs).\n * In addition, these components are easily transformed into Vega specifications\n * during the \"assemble\" phase, which is the last phase of the compilation step.\n */\nexport interface Component {\n data: DataComponent;\n\n layoutSize: LayoutSizeComponent;\n\n layoutHeaders: {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n };\n\n mark: VgMarkGroup[];\n scales: ScaleComponentIndex;\n projection: ProjectionComponent;\n selection: Dict;\n\n /** Dictionary mapping channel to VgAxis definition */\n axes: AxisComponentIndex;\n\n /** Dictionary mapping channel to VgLegend definition */\n legends: LegendComponentIndex;\n\n resolve: Resolve;\n}\n\nexport interface NameMapInterface {\n rename(oldname: string, newName: string): void;\n has(name: string): boolean;\n get(name: string): string;\n}\n\nexport class NameMap implements NameMapInterface {\n private nameMap: Dict;\n\n constructor() {\n this.nameMap = {};\n }\n\n public rename(oldName: string, newName: string) {\n this.nameMap[oldName] = newName;\n }\n\n public has(name: string): boolean {\n return this.nameMap[name] !== undefined;\n }\n\n public get(name: string): string {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n\n return name;\n }\n}\n\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\n\nexport function isUnitModel(model: Model): model is UnitModel {\n return model?.type === 'unit';\n}\n\nexport function isFacetModel(model: Model): model is FacetModel {\n return model?.type === 'facet';\n}\n\nexport function isConcatModel(model: Model): model is ConcatModel {\n return model?.type === 'concat';\n}\n\nexport function isLayerModel(model: Model): model is LayerModel {\n return model?.type === 'layer';\n}\n\nexport abstract class Model {\n public readonly name: string;\n\n public size: LayoutSizeMixins;\n\n public readonly title: TitleParams;\n public readonly description: string;\n\n public readonly data: Data | null;\n public readonly transforms: Transform[];\n public readonly layout: GenericCompositionLayoutWithColumns;\n\n /** Name map for scales, which can be renamed by a model's parent. */\n protected scaleNameMap: NameMapInterface;\n\n /** Name map for projections, which can be renamed by a model's parent. */\n protected projectionNameMap: NameMapInterface;\n\n /** Name map for signals, which can be renamed by a model's parent. */\n protected signalNameMap: NameMapInterface;\n\n public readonly component: Component;\n\n public readonly view?: ViewBackground;\n\n public abstract readonly children: Model[];\n\n constructor(\n spec: NormalizedSpec,\n public readonly type: SpecType,\n public readonly parent: Model,\n parentGivenName: string,\n public readonly config: Config,\n resolve: Resolve,\n view?: ViewBackground\n ) {\n this.parent = parent;\n this.config = config;\n this.view = replaceExprRef(view);\n\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? {text: spec.title} : spec.title ? replaceExprRef(spec.title) : undefined;\n\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n\n this.data = spec.data;\n\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent?.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: {row: {}, column: {}, facet: {}},\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n\n public get width(): SignalRef {\n return this.getSizeSignalRef('width');\n }\n\n public get height(): SignalRef {\n return this.getSizeSignalRef('height');\n }\n\n public parse() {\n this.parseScale();\n\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n\n public abstract parseData(): void;\n\n public abstract parseSelections(): void;\n\n public parseScale() {\n parseScales(this);\n }\n\n public parseProjection() {\n parseProjection(this);\n }\n\n public abstract parseLayoutSize(): void;\n\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n private renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n\n public abstract parseMarkGroup(): void;\n\n public abstract parseAxesAndHeaders(): void;\n\n public parseLegends() {\n parseLegend(this);\n }\n\n public abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[];\n public abstract assembleSignals(): NewSignal[];\n\n public abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[];\n\n public abstract assembleGroupStyle(): string | string[];\n\n private assembleEncodeFromView(view: ViewBackground): VgEncodeEntry {\n // Exclude \"style\"\n const {style: _, ...baseView} = view;\n\n const e: VgEncodeEntry = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n\n return e;\n }\n\n public assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry {\n let encodeEntry: VgEncodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n\n public assembleLayout(): VgLayout {\n if (!this.layout) {\n return undefined;\n }\n\n const {spacing, ...layout} = this.layout;\n\n const {component, config} = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? {titleBand} : {})\n };\n }\n\n protected assembleDefaultLayout(): VgLayout {\n return {};\n }\n\n public abstract assembleLayoutSignals(): NewSignal[];\n\n public assembleHeaderMarks(): VgMarkGroup[] {\n const {layoutHeaders} = this.component;\n let headerMarks = [];\n\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n\n public abstract assembleMarks(): VgMarkGroup[];\n\n public assembleAxes(): VgAxis[] {\n return assembleAxes(this.component.axes, this.config);\n }\n\n public assembleLegends(): VgLegend[] {\n return assembleLegends(this);\n }\n\n public assembleProjections(): VgProjection[] {\n return assembleProjections(this);\n }\n\n public assembleTitle(): VgTitle {\n const {encoding, ...titleNoEncoding} = this.title ?? ({} as TitleParams);\n\n const title: VgTitle = {\n ...extractTitleConfig(this.config.title).nonMarkTitleProperties,\n ...titleNoEncoding,\n ...(encoding ? {encode: {update: encoding}} : {})\n };\n\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame ??= 'group';\n }\n } else {\n // composition with Vega layout\n\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor ??= 'start';\n }\n\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n public assembleGroup(signals: Signal[] = []) {\n const group: VgMarkGroup = {};\n\n signals = signals.concat(this.assembleSignals());\n\n if (signals.length > 0) {\n group.signals = signals;\n }\n\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n\n return group;\n }\n\n public getName(text: string) {\n return varName((this.name ? `${this.name}_` : '') + text);\n }\n\n public getDataName(type: DataSourceType) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n public requestDataName(name: DataSourceType) {\n const fullName = this.getDataName(name);\n\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n\n return fullName;\n }\n\n public getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'});\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n } else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n public lookupDataSource(name: string) {\n const node = this.component.data.outputNodes[name];\n\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n\n return node.getSource();\n }\n\n public getSignalName(oldSignalName: string): string {\n return this.signalNameMap.get(oldSignalName);\n }\n\n public renameSignal(oldName: string, newName: string) {\n this.signalNameMap.rename(oldName, newName);\n }\n\n public renameScale(oldName: string, newName: string) {\n this.scaleNameMap.rename(oldName, newName);\n }\n\n public renameProjection(oldName: string, newName: string) {\n this.projectionNameMap.rename(oldName, newName);\n }\n\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n public scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))\n ) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n\n /**\n * @return projection name after the projection has been parsed and named.\n */\n public projectionName(parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n\n if (\n (this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))\n ) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n\n /**\n * Corrects the data references in marks after assemble.\n */\n public correctDataNames = (mark: VgMarkGroup) => {\n // TODO: make this correct\n\n // for normal data references\n if (mark.from?.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n\n // for access to facet data\n if (mark.from?.facet?.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n\n return mark;\n };\n\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n public getScaleComponent(channel: ScaleChannel): ScaleComponent {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error(\n 'getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'\n );\n }\n\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n public getSelectionComponent(variableName: string, origName: string): SelectionComponent {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n public hasAxisOrientSignalRef() {\n return (\n this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef())\n );\n }\n}\n\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport abstract class ModelWithField extends Model {\n public abstract fieldDef(channel: SingleDefChannel): FieldDef;\n\n /** Get \"field\" reference for Vega */\n public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {\n const fieldDef = this.fieldDef(channel);\n\n if (!fieldDef) {\n return undefined;\n }\n\n return vgField(fieldDef, opt);\n }\n\n protected abstract getMapping(): Partial>;\n\n public reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T {\n return reduce(\n this.getMapping(),\n (acc: U, cd: ChannelDef, c: Channel) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n },\n init\n );\n }\n\n public forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any) {\n forEach(\n this.getMapping(),\n (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n },\n t\n );\n }\n\n public abstract channelHasField(channel: Channel): boolean;\n}\n","import {KDETransform as VgKDETransform} from 'vega';\nimport {DensityTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n public clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: DensityTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n\n public dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgKDETransform {\n const {density, ...rest} = this.transform;\n const result: VgKDETransform = {\n type: 'kde',\n field: density,\n ...rest\n };\n if (this.transform.groupby) {\n result.resolve = 'shared';\n }\n return result;\n }\n}\n","import {ExtentTransform as VgExtentTransform} from 'vega';\nimport {ExtentTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class ExtentTransformNode extends DataFlowNode {\n public clone() {\n return new ExtentTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: ExtentTransform\n ) {\n super(parent);\n this.transform = duplicate(transform);\n }\n\n public dependentFields() {\n return new Set([this.transform.extent]);\n }\n\n public producedFields() {\n return new Set([]);\n }\n\n public hash() {\n return `ExtentTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgExtentTransform {\n const {extent, param} = this.transform;\n const result: VgExtentTransform = {\n type: 'extent',\n field: extent,\n signal: param\n };\n return result;\n }\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {isScaleChannel} from '../../channel';\nimport {TypedFieldDef, vgField as fieldRef} from '../../channeldef';\nimport {isPathMark} from '../../mark';\nimport {hasContinuousDomain} from '../../scale';\nimport {Dict, hash, keys} from '../../util';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class FilterInvalidNode extends DataFlowNode {\n public clone() {\n return new FilterInvalidNode(null, {...this.filter});\n }\n\n constructor(\n parent: DataFlowNode,\n public readonly filter: Dict>\n ) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n\n const filter = model.reduceFieldDef(\n (aggregator: Dict>, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n },\n {} as Dict>\n );\n\n if (!keys(filter).length) {\n return null;\n }\n\n return new FilterInvalidNode(parent, filter);\n }\n\n public dependentFields() {\n return new Set(keys(this.filter));\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n public assemble(): VgFilterTransform {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, {expr: 'datum'});\n\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n } else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n } else {\n // should never get here\n }\n }\n return vegaFilters;\n }, [] as string[]);\n\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n","import {FlattenTransform as VgFlattenTransform} from 'vega';\nimport {FlattenTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n public clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: FlattenTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const {flatten, as = []} = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n\n public dependentFields() {\n return new Set(this.transform.flatten);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFlattenTransform {\n const {flatten: fields, as} = this.transform;\n\n const result: VgFlattenTransform = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n","import {FoldTransform as VgFoldTransform} from 'vega';\nimport {FoldTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n public clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: FoldTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set(this.transform.fold);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFoldTransform {\n const {fold, as} = this.transform;\n const result: VgFoldTransform = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n","import {Transforms as VgTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoJSONNode extends DataFlowNode {\n public clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n\n let geoJsonCounter = 0;\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n return parent;\n }\n\n constructor(\n parent: DataFlowNode,\n private fields?: Vector2,\n private geojson?: string,\n private signal?: string\n ) {\n super(parent);\n }\n\n public dependentFields() {\n const fields = (this.fields ?? []).filter(isString) as string[];\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n\n public assemble(): VgTransform[] {\n return [\n ...(this.geojson\n ? [\n {\n type: 'filter',\n expr: `isValid(datum[\"${this.geojson}\"])`\n } as const\n ]\n : []),\n {\n type: 'geojson',\n ...(this.fields ? {fields: this.fields} : {}),\n ...(this.geojson ? {geojson: this.geojson} : {}),\n signal: this.signal\n }\n ];\n }\n}\n","import {GeoPointTransform as VgGeoPointTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoPointNode extends DataFlowNode {\n public clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n\n constructor(\n parent: DataFlowNode,\n private projection: string,\n private fields: [string | VgExprRef, string | VgExprRef],\n private as: [string, string]\n ) {\n super(parent);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (!model.projectionName()) {\n return parent;\n }\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName(`x${suffix}`),\n model.getName(`y${suffix}`)\n ]);\n }\n }\n\n return parent;\n }\n\n public dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n\n public producedFields() {\n return new Set(this.as);\n }\n\n public hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n\n public assemble(): VgGeoPointTransform {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n","import {\n FormulaTransform as VgFormulaTransform,\n ImputeTransform as VgImputeTransform,\n SignalRef,\n WindowTransform as VgWindowTransform\n} from 'vega';\nimport {isFieldDef} from '../../channeldef';\nimport {pathGroupingFields} from '../../encoding';\nimport {ImputeSequence, ImputeTransform, isImputeSequence} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class ImputeNode extends DataFlowNode {\n public clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: ImputeTransform\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set([this.transform.impute]);\n }\n\n private processSequence(keyvals: ImputeSequence): SignalRef {\n const {start = 0, stop, step} = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n\n return {signal: `sequence(${result})`};\n }\n\n public static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode {\n return new ImputeNode(parent, imputeTransform);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const {method, value, frame, keyvals} = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? {method} : {}),\n ...(value !== undefined ? {value} : {}),\n ...(frame ? {frame} : {}),\n ...(keyvals !== undefined ? {keyvals} : {}),\n ...(groupbyFields.length ? {groupby: groupbyFields} : {})\n });\n }\n return null;\n }\n\n public hash() {\n return `Impute ${hash(this.transform)}`;\n }\n\n public assemble() {\n const {impute, key, keyvals, method, groupby, value, frame = [null, null] as [null, null]} = this.transform;\n\n const imputeTransform: VgImputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? {keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals} : {}),\n method: 'value',\n ...(groupby ? {groupby} : {}),\n value: !method || method === 'value' ? value : null\n };\n\n if (method && method !== 'value') {\n const deriveNewField: VgWindowTransform = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? {groupby} : {})\n };\n const replaceOriginal: VgFormulaTransform = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n } else {\n return [imputeTransform];\n }\n }\n}\n","import {LoessTransform as VgLoessTransform} from 'vega';\nimport {LoessTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n public clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: LoessTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n\n public dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgLoessTransform {\n const {loess, on, ...rest} = this.transform;\n const result: VgLoessTransform = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n","import {LookupTransform as VgLookupTransform} from 'vega';\nimport {array, isString} from 'vega-util';\nimport * as log from '../../log';\nimport {isLookupData, isLookupSelection, LookupTransform} from '../../transform';\nimport {duplicate, hash, varName} from '../../util';\nimport {Model} from '../model';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {findSource} from './parse';\nimport {SourceNode} from './source';\nimport {DataSourceType} from '../../data';\n\nexport class LookupNode extends DataFlowNode {\n public clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n\n constructor(\n parent: DataFlowNode,\n public readonly transform: LookupTransform,\n public readonly secondary: string\n ) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number) {\n const sources = model.component.data.sources;\n const {from} = transform;\n let fromOutputNode = null;\n\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(\n fromSource,\n fromOutputName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n } else if (isLookupSelection(from)) {\n const selName = from.param;\n transform = {as: selName, ...transform};\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(varName(selName), selName);\n } catch (e) {\n throw new Error(log.message.cannotLookupVariableParameter(selName));\n }\n\n fromOutputNode = selCmpt.materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n\n public dependentFields() {\n return new Set([this.transform.lookup]);\n }\n\n public producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n\n public hash() {\n return `Lookup ${hash({transform: this.transform, secondary: this.secondary})}`;\n }\n\n public assemble(): VgLookupTransform {\n let foreign: Partial;\n\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? {as: array(this.transform.as)} : {})\n };\n } else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n\n foreign = {\n as: [asName]\n };\n }\n\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? {default: this.transform.default} : {})\n };\n }\n}\n","import {QuantileTransform as VgQuantileTransform} from 'vega';\nimport {QuantileTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n public clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: QuantileTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgQuantileTransform {\n const {quantile, ...rest} = this.transform;\n const result: VgQuantileTransform = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n","import {RegressionTransform as VgRegressionTransform} from 'vega';\nimport {RegressionTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n public clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: RegressionTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n\n public dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgRegressionTransform {\n const {regression, on, ...rest} = this.transform;\n const result: VgRegressionTransform = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n","import {PivotTransform} from '../../transform';\nimport {duplicate, hash, unique} from '../../util';\nimport {PivotTransform as VgPivotTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n public clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: PivotTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: readonly string[]) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n\n public producedFields(): undefined {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n\n public dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n\n public hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgPivotTransform {\n const {pivot, value, groupby, limit, op} = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? {limit} : {}),\n ...(op !== undefined ? {op} : {}),\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {SampleTransform as VgSampleTransform} from 'vega';\nimport {SampleTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n public clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: SampleTransform\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgSampleTransform {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n","import {InlineDataset, isUrlData} from '../../data';\nimport {Dict} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataComponent} from './';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {ExtentTransformNode} from './extent';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {ParseNode} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {PivotTransformNode} from './pivot';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nfunction makeWalkTree(data: VgData[]) {\n // to name datasources\n let datasetIndex = 0;\n\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node: DataFlowNode, dataSource: VgData) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n } else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n } else {\n node.data = dataSource.source;\n }\n\n data.push(...node.assemble());\n\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n\n if (\n node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode ||\n node instanceof ExtentTransformNode\n ) {\n dataSource.transform.push(node.assemble());\n }\n\n if (\n node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode ||\n node instanceof GeoJSONNode\n ) {\n dataSource.transform.push(...node.assemble());\n }\n\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n } else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n } else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n } else {\n source = dataSource.source;\n }\n\n for (const child of node.children) {\n const newData: VgData = {\n name: null,\n source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n\n return walkTree;\n}\n\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root: FacetNode): VgData[] {\n const data: VgData[] = [];\n const walkTree = makeWalkTree(data);\n\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n\n return data;\n}\n\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[] {\n const data: VgData[] = [];\n\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n\n const walkTree = makeWalkTree(data);\n\n let sourceIndex = 0;\n\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n\n const newData: VgData = root.assemble();\n\n walkTree(root, newData);\n }\n\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n\n return data;\n}\n","import {AxisOrient, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {title as fieldDefTitle} from '../../channeldef';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {assembleAxis} from '../axis/assemble';\nimport {FacetModel} from '../facet';\nimport {parseGuideResolve} from '../resolve';\nimport {getHeaderProperty} from './common';\nimport {HeaderChannel, HeaderComponent} from './component';\n\nexport function getHeaderType(orient: AxisOrient | SignalRef) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\n\nexport function parseFacetHeaders(model: FacetModel) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\n\nfunction parseFacetHeader(model: FacetModel, channel: FacetChannel) {\n const {facet, config, child, component} = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ` / ${child.component.layoutHeaders[channel].title}`;\n child.component.layoutHeaders[channel].title = null;\n }\n\n const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel);\n\n const labels =\n fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false;\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n\n component.layoutHeaders[channel] = {\n title: fieldDef.header !== null ? title : null,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\n\nfunction makeHeaderComponent(model: FacetModel, channel: HeaderChannel, labels: boolean): HeaderComponent {\n const sizeType = channel === 'row' ? 'height' : 'width';\n\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\n\nfunction mergeChildAxis(model: FacetModel, channel: 'x' | 'y') {\n const {child} = model;\n if (child.component.axes[channel]) {\n const {layoutHeaders, resolve} = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] ??= [makeHeaderComponent(model, headerChannel, false)];\n\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, {header: true});\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n } else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n","import {getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getViewConfigContinuousSize, getViewConfigDiscreteSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {isStep} from '../../spec/base';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {ConcatModel} from '../concat';\nimport {Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {getSizeTypeFromLayoutSizeType, LayoutSize, LayoutSizeIndex, LayoutSizeType} from './component';\n\nexport function parseLayerLayoutSize(model: Model) {\n parseChildrenLayoutSize(model);\n\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\n\nexport function parseConcatLayoutSize(model: ConcatModel) {\n parseChildrenLayoutSize(model);\n\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\n\nexport function parseChildrenLayoutSize(model: Model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model: Model, layoutSizeType: LayoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n\n let mergedSize: Explicit;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n } else {\n mergedSize = childSize;\n }\n }\n\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n } else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\n\nexport function parseUnitLayoutSize(model: UnitModel) {\n const {size, component} = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n } else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\n\nfunction defaultUnitSize(model: UnitModel, sizeType: 'width' | 'height'): LayoutSize {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n } else {\n return size;\n }\n } else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n } else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n } else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n","import {AggregateOp, LayoutAlign, NewSignal, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {COLUMN, ExtendedChannel, FacetChannel, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../channel';\nimport {FieldName, FieldRefOption, initFieldDef, TypedFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport * as log from '../log';\nimport {hasDiscreteDomain} from '../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField, SortOrder} from '../sort';\nimport {NormalizedFacetSpec} from '../spec';\nimport {EncodingFacetMapping, FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\nimport {keys} from '../util';\nimport {isVgRangeStep, VgData, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {assembleFacetData} from './data/assemble';\nimport {sortArrayIndexField} from './data/calculate';\nimport {parseData} from './data/parse';\nimport {assembleLabelTitle} from './header/assemble';\nimport {getHeaderChannel, getHeaderProperty} from './header/common';\nimport {HEADER_CHANNELS, HEADER_TYPES} from './header/component';\nimport {parseFacetHeaders} from './header/parse';\nimport {parseChildrenLayoutSize} from './layoutsize/parse';\nimport {Model, ModelWithField} from './model';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {assembleFacetSignals} from './selection/assemble';\n\nexport function facetSortFieldName(\n fieldDef: FacetFieldDef,\n sort: EncodingSortField,\n opt?: FieldRefOption\n) {\n return vgField(sort, {suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {})});\n}\n\nexport class FacetModel extends ModelWithField {\n public readonly facet: EncodingFacetMapping;\n\n public readonly child: Model;\n\n public readonly children: Model[];\n\n constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n\n this.facet = this.initFacet(spec.facet);\n }\n\n private initFacet(\n facet: FacetFieldDef | FacetMapping\n ): EncodingFacetMapping {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return {facet: this.initFacetFieldDef(facet, 'facet')};\n }\n\n const channels = keys(facet);\n const normalizedFacet = {};\n for (const channel of channels) {\n if (![ROW, COLUMN].includes(channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n break;\n }\n\n const fieldDef = facet[channel];\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n break;\n }\n\n normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel);\n }\n\n return normalizedFacet;\n }\n\n private initFacetFieldDef(fieldDef: FacetFieldDef, channel: FacetChannel) {\n // Cast because we call initFieldDef, which assumes general FieldDef.\n // However, FacetFieldDef is a bit more constrained than the general FieldDef\n const facetFieldDef = initFieldDef(fieldDef, channel) as FacetFieldDef;\n if (facetFieldDef.header) {\n facetFieldDef.header = replaceExprRef(facetFieldDef.header);\n } else if (facetFieldDef.header === null) {\n facetFieldDef.header = null;\n }\n return facetFieldDef;\n }\n\n public channelHasField(channel: ExtendedChannel): boolean {\n return !!this.facet[channel];\n }\n\n public fieldDef(channel: ExtendedChannel): TypedFieldDef {\n return this.facet[channel];\n }\n\n public parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n\n public parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n\n public parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n\n public parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n\n public parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n\n parseFacetHeaders(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.child.assembleSignals();\n return [];\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.child.assembleSelectionData(data);\n }\n\n private getHeaderLayoutMixins(): VgLayout {\n const layoutMixins: VgLayout = {};\n\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n\n const {facetFieldDef} = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel);\n\n if (['right', 'bottom'].includes(titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor ??= {};\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] ??= {};\n layoutMixins[bandType][channel] = 0.5;\n }\n\n if (layoutHeaderComponent.title) {\n layoutMixins.offset ??= {};\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const {column, row} = this.facet;\n\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n\n let align: LayoutAlign = 'all';\n\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n } else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n\n return {\n ...this.getHeaderLayoutMixins(),\n\n ...(columns ? {columns} : {}),\n bounds: 'full',\n align\n };\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n\n private columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n } else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return {signal: `length(data('${facetLayoutDataName}'))`};\n }\n }\n\n public assembleGroupStyle(): string | string[] {\n return undefined;\n }\n\n public assembleGroup(signals: NewSignal[]) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: {field: vgField(this.facet.column, {prefix: 'distinct'})}\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n\n /**\n * Aggregate cardinality for calculating size\n */\n private getCardinalityAggregateForChild() {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n } else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return {fields, ops, as};\n }\n\n private assembleFacet() {\n const {name, data} = this.component.data.facetRoot;\n const {row, column} = this.facet;\n const {fields, ops, as} = this.getCardinalityAggregateForChild();\n const groupby: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n\n const {bin, sort} = fieldDef;\n\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, {binSuffix: 'end'}));\n }\n\n if (isSortField(sort)) {\n const {field, op = DEFAULT_SORT_OP} = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n } else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n } else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n\n const cross = !!row && !!column;\n\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? {cross} : {}),\n ...(fields.length ? {fields, ops, as} : {})\n }\n }\n : {})\n };\n }\n\n private facetSortFields(channel: FacetChannel): string[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, {expr: 'datum'})];\n } else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, {expr: 'datum'})];\n }\n return [vgField(fieldDef, {expr: 'datum'})];\n }\n return [];\n }\n\n private facetSortOrder(channel: FacetChannel): SortOrder[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const {sort} = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n\n private assembleLabelTitle() {\n const {facet, config} = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel);\n if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n\n public assembleMarks(): VgMarkGroup[] {\n const {child} = this;\n\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? {data} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n\n return [markGroup];\n }\n\n protected getMapping() {\n return this.facet;\n }\n}\n","import {vgField} from '../../channeldef';\nimport {DEFAULT_SORT_OP, isSortField} from '../../sort';\nimport {FacetMapping} from '../../spec/facet';\nimport {facetSortFieldName} from '../facet';\nimport {DataFlowNode} from './dataflow';\nimport {JoinAggregateTransformNode} from './joinaggregate';\n\nexport function makeJoinAggregateFromFacet(\n parent: DataFlowNode,\n facet: FacetMapping\n): JoinAggregateTransformNode {\n const {row, column} = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const {field, op = DEFAULT_SORT_OP} = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, {forAs: true})\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n","import {AncestorParse, DataComponent} from '.';\nimport {\n Data,\n isGenerator,\n isGraticuleGenerator,\n isInlineData,\n isNamedData,\n isSequenceGenerator,\n isUrlData,\n DataSourceType,\n ParseValue\n} from '../../data';\nimport * as log from '../../log';\nimport {\n isAggregate,\n isBin,\n isCalculate,\n isDensity,\n isExtent,\n isFilter,\n isFlatten,\n isFold,\n isImpute,\n isJoinAggregate,\n isLoess,\n isLookup,\n isPivot,\n isQuantile,\n isRegression,\n isSample,\n isStack,\n isTimeUnit,\n isWindow\n} from '../../transform';\nimport {deepEqual, mergeDeep} from '../../util';\nimport {isFacetModel, isLayerModel, isUnitModel, Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {materializeSelections} from '../selection/parse';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {ExtentTransformNode} from './extent';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {\n getImplicitFromEncoding,\n getImplicitFromFilterTransform,\n getImplicitFromSelection,\n ParseNode\n} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {makeJoinAggregateFromFacet} from './joinaggregatefacet';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {PivotTransformNode} from './pivot';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport function findSource(data: Data, sources: SourceNode[]) {\n for (const other of sources) {\n const otherData = other.data;\n\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n\n const formatMesh = data['format']?.mesh;\n const otherFeature = otherData.format?.feature;\n\n // feature and mesh are mutually exclusive\n if (formatMesh && otherFeature) {\n continue;\n }\n\n // we have to extract the same feature or mesh\n const formatFeature = data['format']?.feature;\n if ((formatFeature || otherFeature) && formatFeature !== otherFeature) {\n continue;\n }\n\n const otherMesh = otherData.format?.mesh;\n if ((formatMesh || otherMesh) && formatMesh !== otherMesh) {\n continue;\n }\n\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n } else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n } else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\n\nfunction parseRoot(model: Model, sources: SourceNode[]): DataFlowNode {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({values: []});\n sources.push(source);\n return source;\n }\n\n const existingSource = findSource(model.data, sources);\n\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n\n return existingSource;\n } else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n } else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode {\n let lookupCounter = 0;\n\n for (const t of model.transforms) {\n let derivedType: ParseValue = undefined;\n let transformNode: DataFlowNode;\n\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n } else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n\n head = new FilterNode(head, model, t.filter);\n } else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n } else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, {[t.field]: derivedType});\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n } else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n } else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n } else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n } else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n } else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n } else if (isExtent(t)) {\n transformNode = head = new ExtentTransformNode(head, t);\n derivedType = 'derived';\n } else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n } else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n } else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n } else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n } else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n } else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n } else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n } else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n\n return head;\n}\n\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\n\nexport function parseData(model: Model): DataComponent {\n let head = parseRoot(model, model.component.data.sources);\n\n const {outputNodes, outputNodeRefCounts} = model.component.data;\n const data = model.data;\n\n const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data));\n const ancestorParse =\n !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n } else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n } else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, {...implicitSelection, ...implicitEncoding}, ancestorParse) ?? head;\n\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n","import {NewSignal, SignalRef} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isHConcatSpec, isVConcatSpec, NormalizedConcatSpec, NormalizedSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseConcatLayoutSize} from './layoutsize/parse';\nimport {Model} from './model';\n\nexport class ConcatModel extends Model {\n public readonly children: Model[];\n\n constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName(`concat_${i}`), undefined, config);\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n\n // TODO(#2415): support shared axes\n }\n\n private getChildren(spec: NormalizedConcatSpec): NormalizedSpec[] {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n } else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n\n public parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n\n public parseAxisGroup(): void {\n return null;\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n const layoutSignals = assembleLayoutSignals(this);\n\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n\n return layoutSignals;\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleMarks(): any[] {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup()\n };\n });\n }\n\n public assembleGroupStyle(): string | string[] {\n return undefined;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? {columns} : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n","import {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {\n AxisInternal,\n AxisPart,\n AxisPropsWithCondition,\n COMMON_AXIS_PROPERTIES_INDEX,\n ConditionalAxisProp\n} from '../../axis';\nimport {FieldDefBase} from '../../channeldef';\nimport {duplicate, Flag, keys} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {Split} from '../split';\n\nfunction isFalseOrNull(v: any) {\n return v === false || v === null;\n}\n\nexport type AxisComponentProps = Omit &\n Omit, 'title'> & {\n title: Text | FieldDefBase[] | SignalRef;\n labelExpr: string;\n disable: boolean;\n };\n\nconst AXIS_COMPONENT_PROPERTIES_INDEX: Flag = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\n\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\n\nexport class AxisComponent extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public mainExtracted = false\n ) {\n super();\n }\n\n public clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n\n public hasAxisPart(part: AxisPart) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n\n public hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n\nexport interface AxisComponentIndex {\n x?: AxisComponent[];\n y?: AxisComponent[];\n}\n\nexport interface AxisInternalIndex {\n x?: AxisInternal;\n y?: AxisInternal;\n}\n","import {getSecondaryRangeChannel, PositionScaleChannel} from '../../channel';\nimport {channelDefType, getFieldOrDatumDef, isFieldDef, isPositionFieldOrDatumDef} from '../../channeldef';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport {UnitModel} from '../unit';\n\nexport function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any) {\n const {encoding, config} = model;\n\n const fieldOrDatumDef =\n getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const {format, formatType} = axis;\n\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormatType\n ) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n } else if (config.numberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n if (\n channelDefType(fieldOrDatumDef) === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n !fieldOrDatumDef.timeUnit\n ) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n return specifiedLabelsSpec;\n}\n","import {AxisEncode as VgAxisEncode, AxisOrient, SignalRef} from 'vega';\nimport {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis';\nimport {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef';\nimport {getFirstDefined, isEmpty, keys, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {LayerModel} from '../layer';\nimport {parseGuideResolve} from '../resolve';\nimport {defaultTieBreaker, Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {AxisComponent, AxisComponentIndex, AxisComponentProps, AXIS_COMPONENT_PROPERTIES} from './component';\nimport {getAxisConfig, getAxisConfigs} from './config';\nimport * as encode from './encode';\nimport {AxisRuleParams, axisRules, defaultOrient, getFieldDefTitle, getLabelAngle} from './properties';\nimport {guideFormat, guideFormatType} from '../format';\n\nexport function parseUnitAxes(model: UnitModel): AxisComponentIndex {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {} as AxisComponentIndex);\n}\n\nconst OPPOSITE_ORIENT: Record = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\n\nexport function parseLayerAxes(model: LayerModel) {\n const {axes, resolve} = model.component;\n const axisCount: Record = {top: 0, bottom: 0, right: 0, left: 0};\n\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const {value: orient, explicit} = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n\n // Show gridlines for first axis only for dual-axis chart\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const [index, axisCmpt] of (axes[channel] || []).entries()) {\n if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\n\nfunction mergeAxisComponents(\n mergedAxisCmpts: AxisComponent[],\n childAxisCmpts: readonly AxisComponent[]\n): AxisComponent[] {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n\n if (!!merged !== !!child) {\n return undefined;\n } else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n\n // Cannot merge due to inconsistent orient\n return undefined;\n } else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n } else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\n\nfunction mergeAxisComponent(merged: AxisComponent, child: AxisComponent): AxisComponent {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n merged.getWithExplicit(prop),\n child.getWithExplicit(prop),\n prop,\n 'axis',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit, // keep the old explicit\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n }\n );\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\n\nfunction isExplicit(\n value: T,\n property: keyof AxisComponentProps,\n axis: Axis,\n model: UnitModel,\n channel: PositionScaleChannel\n) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n }\n\n axis = axis || {};\n\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid', // Grid is an exception because we need to set grid = true to generate another grid axis\n 'translate', // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know.\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\n\nfunction parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisComponent {\n let axis = model.axis(channel);\n\n const axisComponent = new AxisComponent();\n\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]) as\n | PositionFieldDef\n | PositionDatumDef;\n\n const {mark, config} = model;\n\n const orient =\n axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n\n const scaleType = model.getScaleComponent(channel).get('type');\n\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n\n const disable =\n axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n\n axis = axis || {};\n\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType);\n const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true);\n\n const ruleParams: AxisRuleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n format,\n formatType,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value =\n property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n\n const hasValue = value !== undefined;\n\n const explicit = isExplicit(value, property, axis, model, channel);\n\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n } else {\n const {configValue = undefined, configFrom = undefined} =\n isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n } else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)\n ) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e: VgAxisEncode, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n\n if (value !== undefined && !isEmpty(value)) {\n e[part] = {update: value};\n }\n return e;\n }, {} as VgAxisEncode);\n\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n\n return axisComponent;\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {isContinuousFieldOrDatumDef} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport * as log from '../../log';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\n\nexport function initLayoutSize({encoding, size}: {encoding: Encoding; size: LayoutSizeMixins}) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n\n return size;\n}\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const arc: MarkCompiler = {\n vgMark: 'arc',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius'),\n ...encode.rectPosition(model, 'theta')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const area: MarkCompiler = {\n vgMark: 'area',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const bar: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n","import {GeoShapeTransform as VgGeoShapeTransform} from 'vega';\nimport {isFieldDef, vgField} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {VgPostEncodingTransform} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const geoshape: MarkCompiler = {\n vgMark: 'shape',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model: UnitModel): VgPostEncodingTransform[] => {\n const {encoding} = model;\n const shapeDef = encoding.shape;\n\n const transform: VgGeoShapeTransform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? {field: vgField(shapeDef, {expr: 'datum'})}\n : {})\n };\n return [transform];\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const image: MarkCompiler = {\n vgMark: 'image',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y'),\n ...encode.text(model, 'url')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const line: MarkCompiler = {\n vgMark: 'line',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\n\nexport const trail: MarkCompiler = {\n vgMark: 'trail',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n","import {Config} from '../../config';\nimport {VgEncodeEntry} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nfunction encodeEntry(model: UnitModel, fixedShape?: 'circle' | 'square') {\n const {config} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\n\nexport function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry {\n if (fixedShape) {\n return {shape: {value: fixedShape}};\n }\n return encode.nonPosition('shape', model);\n}\n\nexport const point: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model);\n }\n};\n\nexport const circle: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'circle');\n }\n};\n\nexport const square: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'square');\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rect: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rule: MarkCompiler = {\n vgMark: 'rule',\n encodeEntry: (model: UnitModel) => {\n const {markDef} = model;\n const orient = markDef.orient;\n\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n","import type {SignalRef} from 'vega';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {MarkDef} from '../../mark';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const text: MarkCompiler = {\n vgMark: 'text',\n\n encodeEntry: (model: UnitModel) => {\n const {config, encoding} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, {defaultPos: null}),\n ...encode.pointPosition('theta', model, {defaultPos: null})\n };\n }\n};\n\nfunction align(markDef: MarkDef, encoding: Encoding, config: Config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n\nfunction baseline(markDef: MarkDef, encoding: Encoding, config: Config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n","import type {SignalRef} from 'vega';\nimport {isNumber} from 'vega-util';\nimport {getViewConfigDiscreteStep} from '../../config';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const tick: MarkCompiler = {\n vgMark: 'rect',\n\n encodeEntry: (model: UnitModel) => {\n const {config, markDef} = model;\n const orient = markDef.orient;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n\n ...encode.pointPosition('x', model, {defaultPos: 'mid', vgChannel: 'xc'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid', vgChannel: 'yc'}),\n\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\n\nfunction defaultSize(model: UnitModel): number | SignalRef {\n const {config, markDef} = model;\n const {orient} = markDef;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n\n const markPropOrConfig =\n getMarkPropOrConfig('size', markDef, config, {vgChannel: vgSizeChannel}) ?? config.tick.bandSize;\n\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n } else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n\n return (defaultViewStep * 3) / 4;\n }\n}\n","import {isArray} from 'vega-util';\nimport {FieldRefOption, isFieldDef, isValueDef, vgField} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {isAggregate, pathGroupingFields} from '../../encoding';\nimport {AREA, BAR, isPathMark, LINE, Mark, TRAIL} from '../../mark';\nimport {isSortByEncoding, isSortField} from '../../sort';\nimport {contains, getFirstDefined, isNullOrFalse, keys, omit, pick} from '../../util';\nimport {VgCompare, VgEncodeEntry, VG_CORNERRADIUS_CHANNELS} from '../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {arc} from './arc';\nimport {area} from './area';\nimport {bar} from './bar';\nimport {MarkCompiler} from './base';\nimport {geoshape} from './geoshape';\nimport {image} from './image';\nimport {line, trail} from './line';\nimport {circle, point, square} from './point';\nimport {rect} from './rect';\nimport {rule} from './rule';\nimport {text} from './text';\nimport {tick} from './tick';\n\nconst markCompiler: Record = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\n\nexport function parseMarkGroups(model: UnitModel): any[] {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n } else if (model.mark === BAR) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop =>\n getMarkPropOrConfig(prop, model.markDef, model.config)\n );\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n\n return getMarkGroup(model);\n}\n\nconst FACETED_PATH_PREFIX = 'faceted_path_';\n\nfunction getPathGroups(model: UnitModel, details: string[]) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, {fromPrefix: FACETED_PATH_PREFIX})\n }\n ];\n}\n\nconst STACK_GROUP_PREFIX = 'stack_group_';\n\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model: UnitModel) {\n // Generate the mark\n const [mark] = getMarkGroup(model, {fromPrefix: STACK_GROUP_PREFIX});\n\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt: FieldRefOption = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func: 'min' | 'max', expr: 'datum' | 'parent') => {\n const vgFieldMinMax = [\n stackField({prefix: 'min', suffix: 'start', expr}),\n stackField({prefix: 'max', suffix: 'start', expr}),\n stackField({prefix: 'min', suffix: 'end', expr}),\n stackField({prefix: 'max', suffix: 'end', expr})\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n\n let groupUpdate: VgEncodeEntry;\n let innerGroupUpdate: VgEncodeEntry;\n\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: {signal: stackFieldGroup('min', 'datum')},\n x2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: {field: {group: 'x'}, mult: -1},\n height: {field: {group: 'height'}}\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: {field: {group: 'height'}}\n };\n } else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: {signal: stackFieldGroup('min', 'datum')},\n y2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n innerGroupUpdate = {\n y: {field: {group: 'y'}, mult: -1},\n width: {field: {group: 'width'}}\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: {field: {group: 'width'}}\n };\n }\n\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n } else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = {value: 0};\n }\n }\n\n const groupby: string[] = [];\n\n if (model.stack.groupbyChannels?.length > 0) {\n for (const groupbyChannel of model.stack.groupbyChannels) {\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(groupbyChannel);\n const field = vgField(groupByField);\n if (field) {\n groupby.push(field);\n }\n\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, {binSuffix: 'end'}));\n }\n }\n }\n\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ] as const;\n\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return {...encode, [prop]: mark.encode.update[prop]};\n } else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return {...encode, [prop]: signalOrValueRef(configValue)};\n } else {\n return encode;\n }\n }\n }, groupUpdate);\n\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = {value: true};\n groupUpdate.strokeOffset = {value: 0};\n }\n\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({suffix: 'start'}),\n stackField({suffix: 'start'}),\n stackField({suffix: 'end'}),\n stackField({suffix: 'end'})\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: {update: innerGroupUpdate},\n marks: [mark]\n }\n ]\n }\n ];\n}\n\nexport function getSort(model: UnitModel): VgCompare {\n const {encoding, stack, mark, markDef, config} = model;\n const order = encoding.order;\n if (\n (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))\n ) {\n return undefined;\n } else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, {expr: 'datum'});\n } else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, {prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum'})\n };\n } else if (isSortField(s)) {\n return {\n field: vgField(\n {\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n },\n {expr: 'datum'}\n )\n };\n } else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, {expr: 'datum'}),\n order: s.order\n };\n } else if (s === null) {\n return undefined;\n } else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack?.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\n\nfunction getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix: ''}) {\n const {mark, markDef, encoding, config} = model;\n\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? {clip: true} : {}),\n ...(style ? {style} : {}),\n ...(key ? {key: key.field} : {}),\n ...(sort ? {sort} : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? {aria} : {}),\n from: {data: opt.fromPrefix + model.requestDataName(DataSourceType.Main)},\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model: UnitModel) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined;\n}\n\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model: UnitModel) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model: UnitModel) {\n if (!model.component.selection) return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount\n ? {\n interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip\n }\n : null;\n}\n","import {NewSignal, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Axis, AxisInternal, isConditionalAxisValue} from '../axis';\nimport {\n Channel,\n GEOPOSITION_CHANNELS,\n NonPositionScaleChannel,\n NONPOSITION_SCALE_CHANNELS,\n PositionChannel,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n SCALE_CHANNELS,\n SingleDefChannel,\n supportLegend,\n X,\n Y\n} from '../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n MarkPropFieldOrDatumDef,\n PositionFieldDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {isGraticuleGenerator} from '../data';\nimport * as vlEncoding from '../encoding';\nimport {Encoding, initEncoding} from '../encoding';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport {LegendInternal} from '../legend';\nimport {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {Domain, Scale} from '../scale';\nimport {isSelectionParameter, SelectionParameter} from '../selection';\nimport {LayoutSizeMixins, NormalizedUnitSpec} from '../spec';\nimport {isFrameMixins} from '../spec/base';\nimport {stack, StackProperties} from '../stack';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {AxisInternalIndex} from './axis/component';\nimport {parseUnitAxes} from './axis/parse';\nimport {signalOrValueRefWithCondition, signalRefOrValue} from './common';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {initLayoutSize} from './layoutsize/init';\nimport {parseUnitLayoutSize} from './layoutsize/parse';\nimport {LegendInternalIndex} from './legend/component';\nimport {defaultFilled, initMarkdef} from './mark/init';\nimport {parseMarkGroups} from './mark/mark';\nimport {isLayerModel, Model, ModelWithField} from './model';\nimport {ScaleIndex} from './scale/component';\nimport {\n assembleTopLevelSignals,\n assembleUnitSelectionData,\n assembleUnitSelectionMarks,\n assembleUnitSelectionSignals\n} from './selection/assemble';\nimport {parseUnitSelection} from './selection/parse';\n\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n public readonly markDef: MarkDef;\n public readonly encoding: Encoding;\n\n public readonly specifiedScales: ScaleIndex = {};\n\n public readonly stack: StackProperties;\n\n protected specifiedAxes: AxisInternalIndex = {};\n\n protected specifiedLegends: LegendInternalIndex = {};\n\n public specifiedProjection: Projection = {};\n\n public readonly selection: SelectionParameter[] = [];\n public children: Model[] = [];\n\n constructor(\n spec: NormalizedUnitSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins = {},\n config: Config\n ) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n\n const markDef = isMarkDef(spec.mark) ? {...spec.mark} : {type: spec.mark};\n const mark = markDef.type;\n\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n\n this.size = initLayoutSize({\n encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n }\n : parentGivenSize\n });\n\n // calculate stack properties\n this.stack = stack(this.markDef, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegends(encoding);\n this.specifiedProjection = spec.projection;\n\n // Selections will be initialized upon parse.\n this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p)) as SelectionParameter[];\n }\n\n public get hasProjection(): boolean {\n const {encoding} = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n public scaleDomain(channel: ScaleChannel): Domain {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n\n public axis(channel: PositionChannel): AxisInternal {\n return this.specifiedAxes[channel];\n }\n\n public legend(channel: NonPositionScaleChannel): LegendInternal {\n return this.specifiedLegends[channel];\n }\n\n private initScales(mark: Mark, encoding: Encoding): ScaleIndex {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as\n | PositionFieldDef\n | MarkPropFieldOrDatumDef;\n if (fieldOrDatumDef) {\n scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {});\n }\n return scales;\n }, {} as ScaleIndex);\n }\n\n private initScale(scale: Scale): Scale {\n const {domain, range} = scale;\n // TODO: we could simplify this function if we had a recursive replace function\n const scaleInternal = replaceExprRef(scale);\n if (isArray(domain)) {\n scaleInternal.domain = domain.map(signalRefOrValue);\n }\n if (isArray(range)) {\n scaleInternal.range = range.map(signalRefOrValue);\n }\n return scaleInternal as Scale;\n }\n\n private initAxes(encoding: Encoding): AxisInternalIndex {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (\n isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))\n ) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n\n _axis[channel] = axisSpec\n ? this.initAxis({...axisSpec}) // convert truthy value to object\n : axisSpec;\n }\n return _axis;\n }, {});\n }\n\n private initAxis(axis: Axis): Axis {\n const props = keys(axis);\n const axisInternal = {};\n for (const prop of props) {\n const val = axis[prop];\n axisInternal[prop as any] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisInternal;\n }\n\n private initLegends(encoding: Encoding): LegendInternalIndex {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldOrDatumDef;\n\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend\n ? replaceExprRef(legend) // convert truthy value to object\n : legend;\n }\n\n return _legend;\n }, {});\n }\n\n public parseData() {\n this.component.data = parseData(this);\n }\n\n public parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n\n public parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n\n public parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n\n public parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: any[]): NewSignal[] {\n return assembleTopLevelSignals(this, signals);\n }\n\n public assembleSignals(): NewSignal[] {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n\n public assembleSelectionData(data: readonly VgData[]): VgData[] {\n return assembleUnitSelectionData(this, data);\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return assembleLayoutSignals(this);\n }\n\n public assembleMarks() {\n let marks = this.component.mark ?? [];\n\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n\n return marks.map(this.correctDataNames);\n }\n public assembleGroupStyle(): string | string[] {\n const {style} = this.view || {};\n if (style !== undefined) {\n return style;\n }\n if (this.encoding.x || this.encoding.y) {\n return 'cell';\n } else {\n return 'view';\n }\n }\n\n protected getMapping() {\n return this.encoding;\n }\n\n public get mark(): Mark {\n return this.markDef.type;\n }\n\n public channelHasField(channel: Channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n\n public fieldDef(channel: SingleDefChannel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n\n public typedFieldDef(channel: SingleDefChannel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n","import {Legend as VgLegend, NewSignal, SignalRef, Title as VgTitle} from 'vega';\nimport {array} from 'vega-util';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedLayerSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {parseLayerAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseLayerLayoutSize} from './layoutsize/parse';\nimport {assembleLegends} from './legend/assemble';\nimport {Model} from './model';\nimport {assembleLayerSelectionMarks} from './selection/assemble';\nimport {UnitModel} from './unit';\n\nexport class LayerModel extends Model {\n // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error.\n // So I'm just putting generic Model for now\n public readonly children: Model[];\n\n constructor(\n spec: NormalizedLayerSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins,\n config: Config\n ) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n };\n\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n } else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n // TODO: Support same named selections across children.\n public assembleSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleGroupStyle(): string | string[] {\n const uniqueStyles = new Set();\n for (const child of this.children) {\n for (const style of array(child.assembleGroupStyle())) {\n uniqueStyles.add(style);\n }\n }\n const styles = Array.from(uniqueStyles);\n return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined;\n }\n\n public assembleTitle(): VgTitle {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleMarks(): any[] {\n return assembleLayerSelectionMarks(\n this,\n this.children.flatMap(child => {\n return child.assembleMarks();\n })\n );\n }\n\n public assembleLegends(): VgLegend[] {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n","import type {SignalRef} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedSpec} from '../spec';\nimport {ConcatModel} from './concat';\nimport {FacetModel} from './facet';\nimport {LayerModel} from './layer';\nimport {Model} from './model';\nimport {UnitModel} from './unit';\n\nexport function buildModel(\n spec: NormalizedSpec,\n parent: Model,\n parentGivenName: string,\n unitSize: LayoutSizeMixins,\n config: Config\n): Model {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n } else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n","import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';\nimport {isString, mergeConfig} from 'vega-util';\nimport {getPositionScaleChannel} from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport {Config, initConfig, stripAndRedirectConfig} from '../config';\nimport * as log from '../log';\nimport {normalize} from '../normalize';\nimport {assembleParameterSignals} from '../parameter';\nimport {LayoutSizeMixins, TopLevel, TopLevelSpec} from '../spec';\nimport {\n AutoSizeParams,\n Datasets,\n extractTopLevelProperties,\n getFitType,\n isFitType,\n TopLevelProperties\n} from '../spec/toplevel';\nimport {Dict, keys} from '../util';\nimport {buildModel} from './buildmodel';\nimport {assembleRootData} from './data/assemble';\nimport {optimizeDataflow} from './data/optimize';\nimport {Model} from './model';\n\nexport interface CompileOptions {\n /**\n * Sets a Vega-Lite configuration.\n */\n config?: Config;\n\n /**\n * Sets a custom logger.\n */\n logger?: LoggerInterface;\n\n /**\n * Sets a field title formatter.\n */\n fieldTitle?: vlFieldDef.FieldTitleFormatter;\n}\n\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n\n // 2. Normalize: Convert input spec -> normalized spec\n\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n\n // 3. Build Model: normalized spec -> Model (a tree structure)\n\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model: Model = buildModel(spec, null, '', undefined, config);\n\n // 4 Parse: Model --> Model with components\n\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n\n // drawDataflow(model.component.data.sources);\n\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n\n // drawDataflow(model.component.data.sources);\n\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(\n model,\n getTopLevelProperties(inputSpec, spec.autosize, config, model),\n inputSpec.datasets,\n inputSpec.usermeta\n );\n\n return {\n spec: vgSpec,\n normalized: spec\n };\n } finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\n\nfunction getTopLevelProperties(\n inputSpec: TopLevel,\n autosize: AutoSizeType | AutoSizeParams,\n config: Config,\n model: Model\n) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = {type: 'pad'};\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n } else if (isString(autosize)) {\n autosize = {type: autosize};\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n } else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : {autosize: autosize.type}\n : {autosize}),\n ...extractTopLevelProperties(config, false),\n ...extractTopLevelProperties(inputSpec, true)\n };\n}\n\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(\n model: Model,\n topLevelProperties: TopLevelProperties & LayoutSizeMixins,\n datasets: Datasets = {},\n usermeta: Dict\n): VgSpec {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n\n const data = [].concat(\n model.assembleSelectionData([]),\n // only assemble data in the root\n assembleRootData(model.component.data, datasets)\n );\n\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n\n let layoutSignals = model.assembleLayoutSignals();\n\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n\n const {params, ...otherTopLevelProps} = topLevelProperties;\n\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? {description: model.description} : {}),\n ...otherTopLevelProps,\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n data,\n ...(projections.length > 0 ? {projections} : {}),\n ...model.assembleGroup([\n ...layoutSignals,\n ...model.assembleSelectionTopLevelSignals([]),\n ...assembleParameterSignals(params)\n ]),\n ...(vgConfig ? {config: vgConfig} : {}),\n ...(usermeta ? {usermeta} : {})\n };\n}\n","import pkg from '../package.json';\nexport const version = pkg.version;\n\nexport {compile} from './compile/compile';\nexport type {Config} from './config';\nexport {normalize} from './normalize';\nexport type {TopLevelSpec} from './spec';\nexport * from './util';\n"],"names":["isLogicalOr","op","or","isLogicalAnd","and","isLogicalNot","not","forEachLeaf","fn","subop","normalizeLogicalComposition","normalizer","map","o","duplicate","structuredClone","never","message","Error","pick","obj","props","copy","prop","hasOwnProperty","omit","Set","prototype","x","stringify","join","hash","a","isNumber","str","isString","length","h","i","char","charCodeAt","isNullOrFalse","contains","array","item","includes","some","arr","f","k","entries","every","mergeDeep","dest","_len","arguments","src","Array","_key","s","deepMerge_","property","keys","writeConfig","unique","values","results","u","v","val","push","isEqual","dict","other","dictKeys","otherKeys","key","setEqual","b","size","e","has","hasIntersection","prefixGenerator","prefixes","splitField","splitAccessPath","wrappedWithAccessors","y","computedPrefixes","_","slice","add","fieldIntersection","undefined","isEmpty","Object","vals","isBoolean","varName","alphanumericS","replace","match","logicalExpr","cb","deleteNestedProperty","orderedProps","shift","titleCase","charAt","toUpperCase","substr","accessPathWithDatum","path","datum","pieces","prefix","stringValue","flatAccessWithDatum","escapePathAccess","string","replacePathInField","replaceAll","find","replacement","RegExp","removePathFromField","accessPathDepth","getFirstDefined","_len2","args","_key2","arg","idCounter","uniqueId","id","String","resetIdCounter","internalField","name","isInternalField","startsWith","normalizeAngle","angle","isNumeric","value","isNaN","parseFloat","clonedProto","getPrototypeOf","deepEqual","constructor","isArray","Map","get","ArrayBuffer","isView","source","flags","valueOf","toString","ks","call","data","seen","_stringify","node","toJSON","isFinite","JSON","out","TypeError","seenIndex","sort","splice","ROW","COLUMN","FACET","X","Y","X2","Y2","XOFFSET","YOFFSET","RADIUS","RADIUS2","THETA","THETA2","LATITUDE","LONGITUDE","LATITUDE2","LONGITUDE2","COLOR","FILL","STROKE","SHAPE","SIZE","ANGLE","OPACITY","FILLOPACITY","STROKEOPACITY","STROKEWIDTH","STROKEDASH","TEXT","ORDER","DETAIL","KEY","TOOLTIP","HREF","URL","DESCRIPTION","POSITION_CHANNEL_INDEX","x2","y2","POLAR_POSITION_CHANNEL_INDEX","theta","theta2","radius","radius2","isPolarPositionChannel","c","GEO_POSIITON_CHANNEL_INDEX","longitude","longitude2","latitude","latitude2","getPositionChannelFromLatLong","channel","isGeoPositionChannel","GEOPOSITION_CHANNELS","UNIT_CHANNEL_INDEX","xOffset","yOffset","color","fill","stroke","opacity","fillOpacity","strokeOpacity","strokeWidth","strokeDash","shape","order","text","detail","tooltip","href","url","description","isColorChannel","FACET_CHANNEL_INDEX","row","column","facet","FACET_CHANNELS","CHANNEL_INDEX","CHANNELS","_o","_d","_tt1","SINGLE_DEF_CHANNEL_INDEX","_r","_c","_f","SINGLE_DEF_UNIT_CHANNEL_INDEX","isSingleDefUnitChannel","isChannel","SECONDARY_RANGE_CHANNEL","isSecondaryRangeChannel","main","getMainRangeChannel","getVgPositionChannel","getSecondaryRangeChannel","getSizeChannel","getOffsetChannel","getOffsetScaleChannel","getMainChannelFromOffsetChannel","UNIT_CHANNELS","_x","_y","_x2","_y2","_xo","_yo","_latitude","_longitude","_latitude2","_longitude2","_theta","_theta2","_radius","_radius2","NONPOSITION_CHANNEL_INDEX","NONPOSITION_CHANNELS","POSITION_SCALE_CHANNEL_INDEX","POSITION_SCALE_CHANNELS","isXorY","POLAR_POSITION_SCALE_CHANNEL_INDEX","POLAR_POSITION_SCALE_CHANNELS","getPositionScaleChannel","sizeType","OFFSET_SCALE_CHANNEL_INDEX","isXorYOffset","_t","_tt","_hr","_u","_al","_dd","_k","_oo","NONPOSITION_SCALE_CHANNEL_INDEX","NONPOSITION_SCALE_CHANNELS","isNonPositionScaleChannel","supportLegend","SCALE_CHANNEL_INDEX","SCALE_CHANNELS","isScaleChannel","supportMark","mark","getSupportedMark","ALL_MARKS","arc","area","bar","circle","geoshape","image","line","rule","point","rect","square","trail","tick","_g","ALL_MARKS_EXCEPT_GEOSHAPE","rangeType","AGGREGATE_OP_INDEX","argmax","argmin","average","count","distinct","product","max","mean","median","min","missing","q1","q3","ci0","ci1","stderr","stdev","stdevp","sum","valid","variance","variancep","MULTIDOMAIN_SORT_OP_INDEX","isArgminDef","isArgmaxDef","isAggregateOp","COUNTING_OPS","isCountingAggregateOp","aggregate","isMinMaxOp","SUM_OPS","SHARED_DOMAIN_OPS","binToString","bin","normalizeBin","p","isParameterExtent","isBinning","isBinParams","binned","isBinned","isObject","extent","autoMaxBins","isExprRef","expr","replaceExprRef","index","newIndex","signalRefOrValue","extractTitleConfig","titleConfig","anchor","frame","offset","orient","limit","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding","rest","titleMarkConfig","nonMarkTitleProperties","subtitle","subtitleMarkConfig","isText","isSignalRef","signal","isVgRangeStep","range","isDataRefUnionedDomain","domain","isFieldRefUnionDomain","isDataRefDomain","VG_MARK_CONFIG_INDEX","aria","ariaRole","ariaRoleDescription","blend","strokeCap","strokeDashOffset","strokeJoin","strokeOffset","strokeMiterLimit","startAngle","endAngle","padAngle","innerRadius","outerRadius","interpolate","tension","align","baseline","dir","dx","dy","ellipsis","font","fontSize","fontWeight","fontStyle","lineBreak","lineHeight","cursor","cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","aspect","width","height","smooth","VG_MARK_CONFIGS","VG_MARK_INDEX","group","symbol","VG_CORNERRADIUS_CHANNELS","signalOrValueRefWithCondition","condition","conditionalSignalRefOrValue","signalOrValueRef","exprFromSignalRefOrValue","ref","exprFromValueRefOrSignalRef","signalOrStringValue","applyMarkConfig","model","propsList","getMarkConfig","markDef","config","getStyles","concat","type","style","getMarkPropOrConfig","opt","vgChannel","ignoreVgConfig","getMarkStyleConfig","styleConfigIndex","getStyleConfig","styles","styleConfig","sortParams","orderDef","fieldRefOption","reduce","orderChannelDef","field","vgField","mergeTitleFieldDefs","f1","f2","merged","forEach","fdToMerge","fieldDef1","mergeTitle","title1","title2","mergeTitleComponent","v1","v2","v1Val","v2Val","explicit","invalidSpec","spec","FIT_NON_SINGLE","containerSizeNonSingle","uName","containerSizeNotCompatibleWithAutosize","fitDirection","droppingFit","unknownField","cannotProjectOnChannelWithoutField","cannotProjectAggregate","nearestNotSupportForContinuous","selectionNotSupported","selectionNotFound","SCALE_BINDINGS_CONTINUOUS","LEGEND_BINDINGS_MUST_HAVE_PROJECTION","cannotLookupVariableParameter","noSameUnitLookup","NEEDS_SAME_SELECTION","INTERVAL_INITIALIZED_WITH_POS","noSuchRepeatedValue","columnsNotSupportByRowCol","CONCAT_CANNOT_SHARE_AXIS","unrecognizedParse","differentParse","local","ancestor","ADD_SAME_CHILD_TWICE","invalidTransformIgnored","transform","NO_FIELDS_NEEDS_AS","customFormatTypeNotAllowed","projectionOverridden","parentProjection","projection","REPLACE_ANGLE_WITH_THETA","offsetNestedInsideContinuousPositionScaleDropped","mainChannel","primitiveChannelDef","invalidFieldType","invalidFieldTypeForCountAggregate","invalidAggregate","droppingColor","relativeBandSizeNotSupported","sizeChannel","emptyFieldDef","fieldDef","LINE_WITH_VARYING_SIZE","incompatibleChannel","markOrFacet","when","invalidEncodingChannel","channelShouldBeDiscrete","channelShouldBeDiscreteOrDiscretizing","facetChannelDropped","channels","discreteChannelCannotEncode","rangeMarkAlignmentCannotBeExpression","lineWithRange","hasX2","hasY2","orientOverridden","original","actual","cannotUseScalePropertyWithNonColor","cannotUseRelativeBandSizeWithNonBandScale","scaleType","unaggregateDomainHasNoEffectForRawField","unaggregateDomainWithNonSharedDomainOp","unaggregatedDomainWithLogScale","cannotApplySizeToNonOrientedMark","scaleTypeNotWorkWithChannel","defaultScaleType","scaleTypeNotWorkWithFieldDef","scalePropertyNotWorkWithScaleType","propName","stepDropped","mergeConflictingProperty","propertyOf","mergeConflictingDomainProperty","independentScaleMeansIndependentGuide","domainSortDropped","MORE_THAN_ONE_SORT","FACETED_INDEPENDENT_DIFFERENT_SOURCES","FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES","FACETED_INDEPENDENT_SAME_SOURCE","cannotStackRangedMark","cannotStackNonLinearScale","stackNonSummativeAggregate","invalidTimeUnit","unitName","droppedDay","d","errorBarCenterAndExtentAreNotNeeded","center","errorBarCenterIsUsedWithWrongExtent","errorBarContinuousAxisHasCustomizedAggregate","compositeMark","errorBand1DNotSupport","channelRequiredForBinned","channelShouldNotBeUsedForBinned","domainRequiredForThresholdScale","logger","Warn","current","set","newLogger","reset","warn","debug","isDateTime","part","TIMEUNIT_PARTS","MONTHS","SHORT_MONTHS","m","DAYS","SHORT_DAYS","normalizeQuarter","q","log","normalizeMonth","lowerM","toLowerCase","monthIndex","indexOf","shortM","shortMonthIndex","normalizeDay","lowerD","dayIndex","shortD","shortDayIndex","dateTimeParts","normalize","parts","day","year","month","quarter","date","timeUnit","unit","dateTimeToExpr","utc","dateTimeExprToExpr","dateTimeToTimestamp","Date","UTC","LOCAL_SINGLE_TIMEUNIT_INDEX","week","dayofyear","hours","minutes","seconds","milliseconds","isLocalSingleTimeUnit","isBinnedTimeUnit","isBinnedTimeUnitString","isUTCTimeUnit","t","getLocalTimeUnitFromUTCTimeUnit","substring","VEGALITE_TIMEFORMAT","getTimeUnitParts","filter","containsTimeUnit","getSmallestTimeUnitPart","fullTimeUnit","fieldExpr","end","fieldRef","func","lastTimeUnit","dateExpr","timeUnitSpecifierExpression","timeUnitParts","formatExpression","isUTCScale","normalizeTimeUnit","params","timeUnitToString","tu","durationExpr","wrap","normalizedTimeUnit","smallestUnitPart","startDate","step","getDateTimePartAndStep","endDate","DATE_PARTS","isDatePart","isSelectionPredicate","predicate","isFieldEqualPredicate","equal","isFieldLTPredicate","lt","isFieldLTEPredicate","lte","isFieldGTPredicate","gt","isFieldGTEPredicate","gte","isFieldRangePredicate","isFieldOneOfPredicate","oneOf","in","isFieldValidPredicate","isFieldPredicate","predicateValueExpr","valueExpr","wrapTime","predicateValuesExpr","fieldFilterExpression","useInRange","rawFieldExpr","timeUnitFieldExpr","upper","lower","fieldValidPredicate","exprs","normalizePredicate","Type","quantitative","ordinal","temporal","nominal","geojson","isContinuous","isDiscrete","QUANTITATIVE","ORDINAL","TEMPORAL","NOMINAL","GEOJSON","getFullName","ScaleType","LINEAR","LOG","POW","SQRT","SYMLOG","IDENTITY","SEQUENTIAL","TIME","QUANTILE","QUANTIZE","THRESHOLD","BIN_ORDINAL","POINT","BAND","SCALE_CATEGORY_INDEX","linear","pow","sqrt","symlog","identity","sequential","time","band","quantile","quantize","threshold","scaleCompatible","scaleType1","scaleType2","scaleCategory1","scaleCategory2","SCALE_PRECEDENCE_INDEX","scaleTypePrecedence","QUANTITATIVE_SCALES","CONTINUOUS_TO_CONTINUOUS_SCALES","isQuantitative","CONTINUOUS_TO_DISCRETE_SCALES","CONTINUOUS_DOMAIN_SCALES","DISCRETE_DOMAIN_SCALES","hasDiscreteDomain","hasContinuousDomain","isContinuousToContinuous","isContinuousToDiscrete","defaultScaleConfig","pointPadding","barBandPaddingInner","rectBandPaddingInner","bandWithNestedOffsetPaddingInner","bandWithNestedOffsetPaddingOuter","minBandSize","minFontSize","maxFontSize","minOpacity","maxOpacity","minSize","minStrokeWidth","maxStrokeWidth","quantileCount","quantizeCount","zero","isExtendedScheme","scheme","isParameterDomain","isDomainUnionWith","isFieldRange","SCALE_PROPERTY_INDEX","domainMax","domainMin","domainMid","domainRaw","rangeMax","rangeMin","bins","reverse","round","clamp","nice","base","exponent","constant","padding","paddingInner","paddingOuter","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES","scaleTypeSupportProperty","channelScalePropertyIncompatability","scaleTypeSupportDataType","specifiedType","fieldDefType","channelSupportScaleType","hasNestedOffsetScale","CHANNEL","Mark","ARC","AREA","BAR","IMAGE","LINE","RECT","RULE","TICK","TRAIL","CIRCLE","SQUARE","GEOSHAPE","isPathMark","isRectBasedMark","PRIMITIVE_MARKS","isMarkDef","STROKE_CONFIG","FILL_CONFIG","FILL_STROKE_CONFIG","VL_ONLY_MARK_CONFIG_INDEX","filled","invalid","timeUnitBandSize","timeUnitBandPosition","VL_ONLY_MARK_CONFIG_PROPERTIES","VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","defaultMarkConfig","MARK_CONFIG_INDEX","MARK_CONFIGS","isRelativeBandSize","BAR_CORNER_RADIUS_INDEX","horizontal","vertical","DEFAULT_RECT_BAND_SIZE","defaultBarConfig","binSpacing","continuousBandSize","defaultRectConfig","defaultTickConfig","thickness","getMarkType","midPointRefWithPositionInvalidTest","channelDef","scale","midPoint","isFieldDef","wrapPositionInvalidTest","_ref","fieldInvalidTestValueRef","test","fieldInvalidPredicate","zeroValueRef","datumDefToExpr","datumDef","valueRefForFieldOrDatumDef","scaleName","encode","isDatumDef","interpolatedSignalRef","_ref2","fieldOrDatumDef","fieldOrDatumDef2","startSuffix","endSuffix","bandPosition","start","suffix","binSizeExpr","_ref3","_ref4","channel2Def","stack","defaultRef","isFieldOrDatumDef","isTypedFieldDef","getBandPosition","fieldDef2","impute","binSuffix","binRequiresRange","channel2","isValueDef","offsetMixins","widthHeightValueOrSignalRef","isFunction","isCustomFormatType","formatType","customFormatExpr","format","BIN_RANGE_DELIMITER","formatSignalRef","normalizeStack","formatCustomType","fieldToFormat","channelDefType","customFormatTypes","normalizedNumberFormatType","normalizedNumberFormat","numberFormatType","numberFormat","timeFormatType","timeFormat","isFieldOrDatumDefForTimeFormat","timeFormatExpression","rawTimeFormat","isScaleFieldDef","specifiedFormat","endField","binFormatExpression","formatExpr","guideFormat","omitTimeFormatConfig","isPositionFieldOrDatumDef","guideFormatType","binNumberFormatExpr","startField","_ref5","DEFAULT_SORT_OP","SORT_BY_CHANNEL_INDEX","isSortByChannel","isSortByEncoding","isSortField","isSortArray","isFacetMapping","isFacetFieldDef","isFacetSpec","isConditionalParameter","isRepeatRef","toFieldDefBase","isSortableFieldDef","getBandSize","useVlSizeChannel","discreteBandSize","hasBandEnd","isOrderOnlyDef","isConditionalDef","hasConditionalFieldDef","hasConditionalFieldOrDatumDef","hasConditionalValueDef","isContinuousFieldOrDatumDef","cd","isNumericDataDef","isUnbinnedQuantitativeFieldOrDatumDef","isMarkPropFieldOrDatumDef","isStringFieldOrDatumDef","toStringFieldDef","isOpFieldDef","argAccessor","isCount","nofn","forAs","def","isDiscretizing","verbalTitleFormatter","countTitle","functionalTitleFormatter","timeUnitParams","maxbins","defaultTitleFormatter","fieldTitle","titleFormatter","setTitleFormatter","formatter","resetTitleFormatter","title","allowDisabling","includeDefault","guideTitle","getGuide","defaultTitle","axis","legend","header","getFormatMixins","guide","defaultType","getFieldDef","getFieldOrDatumDef","initChannelDef","primitiveType","initFieldOrDatumDef","fd","guideType","newGuide","initFieldDef","initDatumDef","fullType","newType","compatible","warning","channelCompatibility","encoding","sub","labelOrient","titleOrient","COMPATIBLE","isTimeFieldDef","undefinedIfExprNotRequired","isTime","parse","valueArray","console","CONDITIONAL_AXIS_PROP_INDEX","labelAlign","vgProp","labelBaseline","labelColor","labelFont","labelFontSize","labelFontStyle","labelFontWeight","labelOpacity","labelOffset","labelPadding","gridColor","gridDash","gridDashOffset","gridOpacity","gridWidth","tickColor","tickDash","tickDashOffset","tickOpacity","tickSize","tickWidth","isConditionalAxisValue","AXIS_PARTS","AXIS_PROPERTY_TYPE","grid","gridCap","gridScale","domainCap","domainColor","domainDash","domainDashOffset","domainOpacity","domainWidth","labelAngle","labelBound","labelFlush","labelFlushOffset","labelLimit","labelLineHeight","labelOverlap","labels","labelSeparation","maxExtent","minExtent","position","tickCap","tickMinStep","tickOffset","tickRound","ticks","titleAlign","titleAnchor","titleAngle","titleBaseline","titleColor","titleFont","titleFontSize","titleFontStyle","titleFontWeight","titleLimit","titleLineHeight","titleOpacity","titlePadding","titleX","titleY","tickBand","tickCount","tickExtra","translate","zindex","COMMON_AXIS_PROPERTIES_INDEX","AXIS_PROPERTIES_INDEX","labelExpr","isAxisProperty","AXIS_CONFIGS_INDEX","axisBand","axisBottom","axisDiscrete","axisLeft","axisPoint","axisQuantitative","axisRight","axisTemporal","axisTop","axisX","axisXBand","axisXDiscrete","axisXPoint","axisXQuantitative","axisXTemporal","axisY","axisYBand","axisYDiscrete","axisYPoint","axisYQuantitative","axisYTemporal","AXIS_CONFIGS","isUnitSpec","CompositeMarkNormalizer","run","hasMatchingType","channelHasField","channelHasFieldOrDatum","channelHasNestedOffsetScale","offsetChannel","isAggregate","extractTransformsFromEncoding","oldEncoding","groupby","timeUnits","aggOp","remaining","isTitleDefined","newField","newFieldDef","aggregateEntry","as","secondaryChannel","markChannelCompatible","markSupported","primaryFieldDef","initEncoding","normalizedEncoding","positionDef","defs","normalizeEncoding","newChannelDef","fieldDefs","channelDefArray","mapping","thisArg","el","init","r","r1","pathGroupingFields","details","filterTooltipWithAggregatedField","filteredEncoding","customTooltipWithAggregatedField","customTooltipWithoutAggregatedField","getCompositeMarkTooltip","tooltipSummary","continuousAxisChannelDef","encodingWithoutContinuousAxis","withFieldName","fiveSummaryTooltip","fieldPrefix","titlePrefix","mainTitle","getTitle","escape","tooltipFieldDefs","makeCompositeAggregatePartFactory","compositeMarkDef","continuousAxis","sharedEncoding","compositeMarkConfig","partName","positionPrefix","endPositionPrefix","extraEncoding","partLayerMixins","partBaseSpec","clip","compositeMarkContinuousAxis","continuousAxisChannelDef2","continuousAxisChannelDefError","continuousAxisChannelDefError2","filterAggregateFromChannelDef","continuousAxisWithoutAggregate","compositeMarkOrient","xAggregate","yAggregate","BOXPLOT","BOXPLOT_PARTS","boxPlotNormalizer","normalizeBoxPlot","getBoxPlotType","_encoding","_p","outerSpec","boxplot","sizeValue","boxPlotType","ticksOrient","boxOrient","boxParams","encodingWithoutSizeColorAndContinuousAxis","makeBoxPlotPart","makeBoxPlotExtent","makeBoxPlotBox","makeBoxPlotMidTick","fiveSummaryTooltipEncoding","endTick","whiskerTooltipEncoding","whiskerLayers","boxLayers","layer","lowerBoxExpr","upperBoxExpr","iqrExpr","lowerWhiskerExpr","upperWhiskerExpr","joinaggregateTransform","joinaggregate","boxParamsQuartiles","filteredWhiskerSpec","encodingWithoutSizeColorContinuousAxisAndTooltip","axisWithoutTitle","outlierLayersMixins","filteredLayersMixins","filteredLayersMixinsTransforms","unshift","continousAxisField","continuousFieldName","boxplotSpecificAggregate","postAggregateCalculates","calculate","oldContinuousAxisChannelDef","oldEncodingWithoutContinuousAxis","ERRORBAR","ERRORBAR_PARTS","errorBarNormalizer","normalizeErrorBar","tooltipEncoding","errorBarParams","makeErrorBarPart","errorbar","errorBarOrientAndInputType","errorBarIsInputTypeRaw","inputType","isTypeAggregatedUpperLower","errorBarIsInputTypeAggregatedUpperLower","isTypeAggregatedError","errorBarIsInputTypeAggregatedError","xError","xError2","yError","yError2","errorBarSpecificAggregate","tooltipTitleWithFieldName","errorBarAggregationAndCalculation","oldContinuousAxisChannelDef2","oldContinuousAxisChannelDefError","oldContinuousAxisChannelDefError2","oldAggregate","oldGroupBy","getTitlePrefix","centerOp","lowerExtentOp","upperExtentOp","postAggregateCalculate","operation","ERRORBAND","ERRORBAND_PARTS","errorBandNormalizer","normalizeErrorBand","errorBandDef","makeErrorBandPart","errorband","is2D","bandMark","bordersMark","compositeMarkRegistry","getAllCompositeMarks","VL_ONLY_LEGEND_CONFIG","HEADER_TITLE_PROPERTIES_MAP","HEADER_LABEL_PROPERTIES_MAP","labelAnchor","HEADER_TITLE_PROPERTIES","HEADER_LABEL_PROPERTIES","HEADER_CONFIGS_INDEX","headerRow","headerColumn","headerFacet","HEADER_CONFIGS","LEGEND_SCALE_CHANNELS","defaultLegendConfig","gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity","COMMON_LEGEND_PROPERTY_INDEX","clipHeight","columnPadding","columns","direction","fillColor","gradientLength","gradientOpacity","gradientStrokeColor","gradientStrokeWidth","gradientThickness","gridAlign","legendX","legendY","rowPadding","strokeColor","symbolDash","symbolDashOffset","symbolFillColor","symbolLimit","symbolOffset","symbolOpacity","symbolSize","symbolStrokeColor","symbolStrokeWidth","symbolType","SELECTION_ID","defaultConfig","on","fields","toggle","resolve","clear","interval","encodings","zoom","isLegendBinding","bind","isLegendStreamBinding","isSelectionParameter","param","assembleParameterSignals","signals","update","isAnyConcatSpec","isVConcatSpec","isHConcatSpec","isConcatSpec","getStepFor","offsetIsDiscrete","for","isStep","isFrameMixins","DEFAULT_SPACING","COMPOSITION_LAYOUT_INDEX","bounds","spacing","COMPOSITION_LAYOUT_PROPERTIES","extractCompositionLayout","specType","compositionConfig","layout","spacingConfig","getViewConfigContinuousSize","viewConfig","getViewConfigDiscreteStep","getViewConfigDiscreteSize","DEFAULT_STEP","defaultViewConfig","continuousWidth","continuousHeight","background","view","box","outliers","borders","selection","defaultSelectionConfig","tab10","DEFAULT_FONT_SIZE","guideLabel","groupTitle","groupSubtitle","DEFAULT_COLOR","blue","orange","red","teal","green","yellow","purple","pink","brown","gray0","gray1","gray2","gray3","gray4","gray5","gray6","gray7","gray8","gray9","gray10","gray11","gray12","gray13","gray14","gray15","colorSignalConfig","cell","category","fontSizeSignalConfig","fontConfig","getAxisConfigInternal","axisConfig","axisConfigInternal","getStyleConfigInternal","styleConfigInternal","configPropsWithExpr","initConfig","specifiedConfig","restConfig","mergedConfig","mergeConfig","outputConfig","markConfigType","axisConfigType","headerConfigType","MARK_STYLES","VL_ONLY_CONFIG_PROPERTIES","VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","stripAndRedirectConfig","markType","vlOnlyMarkSpecificConfigs","redirectConfigToStyleConfig","redirectTitleConfig","toProp","compositeMarkPart","propConfig","isLayerSpec","isRepeatSpec","isLayerRepeatSpec","repeat","SpecMapper","mapFacet","mapRepeat","mapHConcat","mapVConcat","mapConcat","mapLayerOrUnit","mapLayer","mapUnit","subspec","hconcat","vconcat","STACK_OFFSET_INDEX","isStackOffset","STACKABLE_MARKS","STACK_BY_DEFAULT_MARKS","isUnbinnedQuantitative","potentialStackedChannel","isCartesian","xDef","yDef","getDimensionChannel","fieldChannel","stackedFieldDef","stackedField","dimensionChannel","groupbyChannels","groupbyFields","dimensionDef","dimensionField","dimensionOffsetChannel","dimensionOffsetDef","dimensionOffsetField","stackBy","sc","cDef","initMarkdef","originalMarkDef","specifiedOrient","cornerRadiusEnd","newProps","BAR_CORNER_RADIUS_END_INDEX","newProp","specifiedOpacity","specifiedCursor","defaultFilled","graticule","filledConfig","xIsMeasure","yIsMeasure","xIsTemporal","yIsTemporal","dropLineAndPoint","_point","_line","dropLineAndPointFromConfig","getPointOverlay","markConfig","getLineOverlay","PathOverlayNormalizer","_defineProperty","normParams","pointOverlay","lineOverlay","stackProps","overlayEncoding","stackFieldChannel","replaceRepeaterInFacet","repeater","replaceRepeaterInMapping","replaceRepeaterInFieldDef","replaceRepeaterInEncoding","replaceRepeatInProp","replaceRepeaterInFieldOrDatumDef","replaceRepeaterInChannelDef","channelDefWithoutCondition","RuleForRangedLineNormalizer","mainChannelDef","CoreNormalizer","hasRow","hasColumn","hasFacet","mapFacetedUnit","parentEncoding","specWithReplacedEncoding","repeaterPrefix","n","mapUnitWithParentEncodingOrProjection","normalizeLayerOrUnit","unitNormalizer","nonFacetUnitNormalizers","mapLayerRepeat","mapNonLayerRepeat","childSpec","layerValue","childRepeater","childName","child","remainingProperties","repeatValues","repeatValue","rowValue","columnValue","mergedProjection","mergeProjection","mergedEncoding","mergeEncoding","facetMapping","getFacetMappingAndLayout","newEncoding","facets","defWithoutLayout","otherParams","parentChannelDef","mergedChannelDef","isFilter","isImputeSequence","isLookup","isLookupData","from","isLookupSelection","isPivot","isDensity","isQuantile","isRegression","isLoess","isSample","isWindow","isJoinAggregate","isFlatten","isCalculate","isBin","isImpute","isTimeUnit","isStack","isFold","isExtent","normalizeTransform","SelectionCompatibilityNormalizer","emptySelections","selectionPredicates","normalizeTransforms","enc","normalizeChannelDef","selDef","empty","select","pred","tx","normalizeBinExtent","cond","ext","normalizeSelectionComposition","TopLevelSelectionsNormalizer","selections","views","method","proto","addSpecNameToParams","normalizedSpec","normalizeGenericSpec","autosize","normalizeAutoSize","coreNormalizer","selectionCompatNormalizer","topLevelSelectionNormalizer","_normalizeAutoSize","sizeInfo","isFitCompatible","autosizeDefault","isFitType","autoSizeType","getFitType","TOP_LEVEL_PROPERTIES","extractTopLevelProperties","includeParams","Split","implicit","clone","combine","getWithExplicit","setWithExplicit","copyKeyFromSplit","copyKeyFromObject","copyAll","makeExplicit","makeImplicit","tieBreakByComparing","compare","diff","defaultTieBreaker","mergeValuesWithExplicit","tieBreaker","AncestorParse","parseNothing","isUrlData","isInlineData","isNamedData","isGenerator","isSequenceGenerator","isSphereGenerator","isGraticuleGenerator","DataSourceType","assembleProjection","proj","hasLegend","assembleInit","isExpr","assembled","assembleUnitSelectionSignals","selCmpt","component","modifyExpr","TUPLE","selectionCompilers","defined","MODIFY","events","STORE","cleanupEmptyOnArray","assembleFacetSignals","getName","parseSelector","assembleTopLevelSignals","hasSelections","store","hasSg","isPoint","VL_SELECTION_RESOLVE","topLevelSignals","hasUnit","assembleUnitSelectionData","dataCopy","project","hasSelectionId","items","assembleUnitSelectionMarks","marks","assembleLayerSelectionMarks","children","isUnitModel","assembleSelectionScaleDomain","scaleCmpt","parsedExtent","parseSelectionExtent","DataFlowNode","parent","debugName","_parent","addChild","_children","numChildren","loc","removeChild","oldChild","remove","insertAsParentOf","swapWithParent","newParent","OutputNode","cloneObj","_source","_name","refCounts","dependentFields","producedFields","_hash","getSource","isRequired","setSource","isTimeUnitTransformComponent","timeUnitComponent","offsetAs","TimeUnitNode","makeFromEncoding","formula","reduceFieldDef","rectBandPosition","makeFromTransform","merge","removeFormulas","newFormula","fieldAs","assemble","transforms","startEnd","units","timezone","offsetedRectFormulas","escapedField","offsetExpr","endAs","OFFSETTED_RECT_START_SUFFIX","OFFSETTED_RECT_END_SUFFIX","smallestUnit","offsetFn","startExpr","endExpr","interpolateExpr","fraction","TUPLE_FIELDS","SelectionProjectionComponent","hasChannel","hasField","parsed","signalName","sg","counter","cfg","initVal","tplType","getScaleComponent","geoChannel","allSignals","hasSignal","scaleBindings","bound","scales","isTopLevelLayer","namedSg","isLayerModel","BRUSH","SCALE_TRIGGER","GEO_INIT_TICK","INIT","CENTER","hasProjection","filterExpr","evt","between","filters","tupleSg","channelSignals","triggerSg","scaleTriggers","dname","visual","vname","toNum","dataSignals","projectionName","centerSg","xvname","yvname","xinit","yinit","sizeSg","getSizeSignalRef","bbox","hasCenterSg","intersect","visualSignals","hasTick","vgStroke","enter","scaledInterval","scaled","coord","von","hasScales","vinit","initIdx","initSg","fieldsSg","brushes","acc","cmpt","force","wrapCondition","refFn","valueRef","conditions","vgConditions","conditionValueRef","parseSelectionPredicate","expression","textRef","tooltipRefForEncoding","reactiveGeom","tooltipRefFromChannelDef","markTooltip","content","tooltipData","formatConfig","tooltipFormat","toSkip","tuples","fDef","keyValues","enableAria","ariaRoleDesc","descriptionValue","nonPosition","defaultValue","transparentIfNeeded","defaultFill","defaultStroke","colorVgChannel","fillStrokeMarkDefAndConfig","positionOffset","baseChannel","offsetType","markDefOffsetValue","pointPosition","defaultPos","pointPositionDefaultRef","positionRef","definedValueOrConfig","domainDefinitelyIncludesZero","sizeRef","mult","ALIGNED_X_CHANNEL","left","right","BASELINED_Y_CHANNEL","top","middle","bottom","vgAlignedPositionChannel","defaultAlign","alignChannel","alignExcludingSignal","pointOrRangePosition","defaultPos2","rangePosition","pos2Mixins","pointPosition2OrSize","vgSizeChannel","position2Ref","position2orSize","dimensionSize","rectPosition","channelDef2","hasSizeDef","offsetScaleChannel","isBarBand","rectBinPosition","positionAndSize","defaultSizeRef","bandSize","hasFieldDef","bandWidth","scaleRange","bandPaddingInner","defaultStep","offsetScaleName","offsetScale","sizeMixins","hasSizeFromMarkOrEncoding","defaultBandAlign","posRef","vgChannel2","sizeOffset","getBinSpacing","axisTranslate","bandSizeExpr","isEnd","spacingOffset","reverseExpr","axisTranslateExpr","minBandSizeExpr","sign","spacingAndSizeOffset","axes","offset2","binSpacingOffset","binSpacingOffset2","bandPositionForBandSize","useRectOffsetField","rectBinRef","startRef","ALWAYS_IGNORE","baseEncodeEntry","ignore","markDefProperties","wrapAllFieldsInvalid","allFieldsInvalidPredicate","filterIndex","aggregator","scaleComponent","valueIfDefined","VORONOI","nearest","markname","cellDef","interactive","isVoronoi","exists","inputBindings","disableDirectManipulation","sgname","TOGGLE","tpl","idx","findIndex","addClear","vIdx","dIdx","tIdx","legendBindings","projLen","selDef_","legendFilter","stream","selName","markName","ds","sgName","tuple","parseInteractiveLegend","legendCmpt","legendSelections","ANCHOR","DELTA","boundScales","scalesCompiler","INTERVAL_BRUSH","onDelta","delta","reversed","panFn","sx","sy","zoomFn","inputs","legends","getFacetModel","isFacetModel","facetModel","requiresSelectionId","identifier","object","startsWithDatum","getDependentFields","ast","parseExpression","dependents","visit","FilterNode","_dependentFields","parseUnitSelection","selDefs","selCmpts","selectionConfig","defaults","def_","dfnode","getSelectionComponent","raw","tunode","materializeSelections","lookupName","outputNodes","materialized","Lookup","outputNodeRefCounts","filterOp","assembleTitle","setAxisEncode","vgRef","assembleAxis","axisCmpt","kind","disable","propType","propValue","valueOrSignalRef","propIndex","valueOrSignalCRef","signalRef","mainExtracted","hasAxisPart","titleString","assembleAxisSignals","assembleAxes","axisComponents","getAxisConfigFromConfigTypes","configTypes","assign","apply","configType","orient1","orientConfig1","orientConfig2","conditionalOrientAxisConfig","getAxisConfigs","typeBasedConfigTypes","axisChannel","axisOrient","vlOnlyConfigTypes","vgConfigTypes","vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle","getAxisConfigStyle","axisConfigTypes","toMerge","getAxisConfig","axisConfigs","configFrom","configValue","axisRules","defaultGrid","_ref6","defaultLabelAlign","_ref7","_ref8","defaultLabelBaseline","_ref9","defaultLabelFlush","_ref10","defaultLabelOverlap","_ref11","_ref12","defaultTickCount","_ref13","defaultTickMinStep","_ref14","fieldDefTitle","getFieldDefTitle","typedFieldDef","_ref15","_ref16","defaultZindex","gridChannel","getLabelAngle","normalizeAngleExpr","alwaysIncludeMiddle","orientIsTop","orientIsLeft","isX","mainOrient","orientIsMain","hasTimeUnit","defaultOrient","_ref17","_ref18","CalculateNode","parseAllForSortIndex","forEachFieldDef","sortValue","sortArrayIndexField","getHeaderChannel","getHeaderProperty","headerSpecificConfig","getHeaderProperties","properties","HEADER_CHANNELS","HEADER_TYPES","assembleTitleGroup","layoutHeaders","facetFieldDef","ta","headerChannel","role","defaultHeaderGuideBaseline","defaultHeaderGuideAlign","assembleHeaderProperties","assembleHeaderGroups","layoutHeader","groups","headerType","headerComponent","assembleHeaderGroup","getSort","assembleLabelTitle","titleTextExpr","isFacetWithoutRowCol","hasAxes","sizeSignal","LAYOUT_TITLE_BAND","getLayoutTitleBand","assembleLayoutTitleBand","headerComponentIndex","titleBand","propertiesMap","assembleLayoutSignals","sizeSignals","layoutSize","parentResolve","stepSignal","sizeExpr","isWidth","endsWith","safeExpr","cardinality","getSizeTypeFromLayoutSizeType","layoutSizeType","guideEncodeEntry","valueDef","defaultScaleResolve","isConcatModel","parseGuideResolve","channelScaleResolve","LEGEND_COMPONENT_PROPERTY_INDEX","LEGEND_COMPONENT_PROPERTIES","LegendComponent","legendEncodeRules","symbols","gradient","symbolsSpec","legendType","mixins","getMaxValue","symbolBaseFillColor","getFirstConditionValue","selectedCondition","gradientSpec","specifiedlabelsSpec","labelsSpec","entriesSpec","getConditionValue","conditionalDef","Math","reducer","legendRules","legendConfig","defaultGradientLength","defaultSymbolType","shapeChannelDef","markShape","getLegendType","getDirection","defaultDirection","gradientLengthSignal","parseLegend","legendComponent","parseUnitLegend","parseNonUnitLegend","parseLegendForChannel","getLegendDefWithScale","isExplicit","ruleParams","legendEncoding","legendEncode","legendEncodeParams","legendEncodingPart","mergeLegendComponent","mergedLegend","childLegend","mergedOrient","childOrient","typeMerged","mergedValueWithExplicit","mergeSymbolType","st1","st2","setLegendEncode","assembleLegends","legendComponentIndex","legendByDomain","domainHash","mergedLegendComponent","flat","l","assembleLegend","assembleProjections","assembleProjectionsForModelAndChildren","assembleProjectionForModel","projections","fits","sources","lookupDataSource","fit","PROJECTION_PROPERTIES","ProjectionComponent","specifiedProjection","isFit","parseProjection","parseUnitProjection","parseNonUnitProjections","gatherFitData","projComp","posssiblePair","requestDataName","Main","mergeIfNoConflict","first","second","allPropertiesShared","nonUnitProjection","mergable","modelProjection","renameProjection","rangeFormula","formulaAs","binKey","getSignalsFromModel","extentSignal","getBinSignalName","normalizedBin","isBinTransform","createBinComponent","span","binComponent","BinNode","binComponentIndex","renameSignal","flatMap","binAs","remainingAs","binTrans","addDimension","dims","posChannel","mergeMeasures","parentMeasures","childMeasures","ops","AggregateNode","dimensions","measures","groupBy","meas","argField","scaleDomain","addDimensions","alias","result","FacetNode","sortField","sortIndexField","childModel","depFields","getChildIndependentFieldsWithStep","childIndependentFieldsWithStep","childScaleComponent","assembleDomain","getFieldFromDomain","assembleRowColumnHeaderData","crossedDataName","childChannel","assembleFacetHeaderData","hasSharedAxis","headers","stop","facetData","unquote","pattern","specifier","getImplicitFromFilterTransform","getImplicitFromEncoding","mainFieldDef","dimensionChannelDef","getImplicitFromSelection","ParseNode","_parse","ancestorParse","makeWithAncestors","parsedAs","assembleFormatParse","formatParse","assembleTransforms","onlyNested","IdentifierNode","GraticuleNode","SequenceNode","SourceNode","_data","defaultExtension","exec","_generator","hasName","dataName","isDataSourceNode","_modified","WeakMap","Optimizer","_classPrivateFieldInitSpec","writable","_classPrivateFieldSet","setModified","modifiedFlag","_classPrivateFieldGet","BottomUpOptimizer","getNodeDepths","depth","depths","optimize","topologicalSort","TopDownOptimizer","MergeIdenticalNodes","mergeNodes","nodes","mergedNode","hashes","buckets","RemoveUnnecessaryIdentifierNodes","RemoveDuplicateTimeUnits","timeUnitFields","RemoveUnnecessaryOutputNodes","MoveParseUp","MergeParse","originalChildren","parseChildren","commonParse","conflictingParse","parseNode","mergedParseNode","childNode","RemoveUnusedSubtrees","MergeTimeUnits","timeUnitChildren","combination","pop","MergeAggregates","aggChildren","groupedAggregates","agg","groupBys","mergeableAggs","mergedAggs","MergeBins","moveBinsUp","promotableBins","remainingBins","promotedBin","remainingBin","MergeOutputs","hasOutputChild","otherChildren","mainOutput","lastOutput","theChild","JoinAggregateTransformNode","w","getDefaultName","joinAggregateFieldDef","getStackByFields","by","_field","isValidAsArray","StackNode","_stack","stackTransform","sortFields","sortOrder","normalizedAs","dimensionFieldDefs","stackField","facetby","stackProperties","groupbyChannel","stackby","getGroupbyFields","dimensionFieldDef","binStart","binEnd","WindowTransformNode","window","windowFieldDef","ignorePeers","cloneSubtree","newName","FACET_SCALE_PREFIX","moveFacetDown","facetMain","moveMainDownToFacet","cloner","MAX_OPTIMIZATION_RUNS","checkLinks","runOptimizer","optimizer","modified","optimizationDataflowHelper","dataComponent","firstPass","roots","optimizers","optimizeDataflow","firstPassCounter","secondPassCounter","SignalRefWrapper","exprGenerator","defineProperty","enumerable","fromName","rename","parseScaleDomain","parseUnitScaleDomain","parseNonUnitScaleDomain","localScaleComponents","util","domains","parseDomainForChannel","localScaleCmpt","parseSelectionDomain","isFaceted","facetParent","selectionExtent","childComponent","domainsTieBreaker","se","normalizeUnaggregatedDomain","scaleConfig","reason","canUseUnaggregatedDomain","useUnaggregatedDomain","specifiedScales","parseSingleChannelDomain","mapDomainToDataSignal","convertDomainIfItIsDateTime","defaultDomain","unionWith","domainSort","Raw","binSignal","getSignalName","isRectWithOffset","normalizeSortField","isStackedMeasure","stackDimensions","fieldDefToSortBy","mergeDomains","uniqueDomains","_s","domainWithoutSort","sorts","filteredSorts","unionDomainSorts","UNIONDOMAIN_SORT_OP_INDEX","allData","nonUnionDomain","assembleScales","assembleScalesForModel","otherScaleProps","assembleScaleRange","ScaleComponent","typeWithExplicit","RANGE_PROPERTIES","parseUnitScaleRange","rangeWithExplicit","parseRangeForChannel","getBinStepSignal","binCount","updatedName","specifiedScale","mergedScaleCmpt","supportedByScaleType","channelIncompatability","parseScheme","getPositionStep","positionChannel","positionScaleCmpt","positionScaleType","getOffsetStep","defaultRange","fullWidthOrHeightRange","positionSize","getDiscretePositionSize","getOffsetRange","sizeRangeMin","sizeRangeMax","interpolateRange","defaultContinuousToDiscreteCount","PI","offsetDef","stepFor","offsetScaleCmpt","stepCount","offsetPaddingInner","offsetPaddingOuter","offsetScaleType","positionScaleName","duration","bandPositionOffset","bandPositionOffsetExpr","startRatio","endRatio","rMax","rMin","MAX_SIZE_RANGE_STEP_RATIO","xyStepSignals","maxBandSize","minXYStep","maxSize","pointStep","widthStep","heightStep","parseScaleProperty","parseUnitScaleProperty","parseNonUnitScaleProperty","specifiedValue","scalePadding","scalePaddingInner","scaleRules","hasSecondaryRangeChannel","parseScaleRange","valueWithExplicit","childValueWithExplicit","specifiedDomain","barConfig","continuousPadding","paddingValue","offsetBandPaddingInner","paddingInnerValue","bandPaddingOuter","offsetBandPaddingOuter","xReverse","hasCustomDomain","last","parseScales","ignoreRange","parseScaleCore","parseUnitScaleCore","parseNonUnitScaleCore","scaleComponents","sType","scaleTypeTieBreaker","scaleTypeWithExplicitIndex","explicitScaleType","childScaleType","childScale","renameScale","NameMap","nameMap","oldName","Model","parentGivenName","scaleNameMap","projectionNameMap","signalNameMap","parseScale","parseLayoutSize","renameTopLevelLayoutSizeSignal","parseSelections","parseData","parseAxesAndHeaders","parseLegends","parseMarkGroup","assembleEncodeFromView","baseView","assembleGroupEncodeEntry","isTopLevel","encodeEntry","assembleLayout","assembleDefaultLayout","assembleHeaderMarks","headerMarks","titleNoEncoding","assembleGroup","assembleSignals","assembleMarks","getDataName","fullName","oldSignalName","originalScaleName","localScaleComponent","variableName","origName","sel","hasAxisOrientSignalRef","hasOrientSignalRef","ModelWithField","getMapping","DensityTransformNode","specifiedAs","density","ExtentTransformNode","FilterInvalidNode","make","vegaFilters","FlattenTransformNode","flatten","FoldTransformNode","fold","GeoJSONNode","parseAll","geoJsonCounter","coordinates","pair","GeoPointNode","ImputeNode","processSequence","keyvals","imputeTransform","imputedChannel","keyChannel","deriveNewField","replaceOriginal","LoessTransformNode","loess","LookupNode","secondary","fromOutputNode","fromSource","findSource","fromOutputName","lookup","foreign","asName","default","QuantileTransformNode","RegressionTransformNode","regression","PivotTransformNode","pivot","SampleTransformNode","sample","makeWalkTree","datasetIndex","walkTree","dataSource","newData","assembleFacetData","root","assembleRootData","datasets","sourceIndex","whereTo","getHeaderType","parseFacetHeaders","parseFacetHeader","mergeChildAxis","makeHeaderComponent","axisComponent","mainAxis","parseLayerLayoutSize","parseChildrenLayoutSize","parseNonUnitLayoutSizeForChannel","parseConcatLayoutSize","widthType","heightType","layoutSizeCmpt","mergedSize","childSize","scaleResolve","parseUnitLayoutSize","specifiedSize","defaultSize","defaultUnitSize","facetSortFieldName","FacetModel","buildModel","initFacet","initFacetFieldDef","normalizedFacet","assembleSelectionTopLevelSignals","assembleSelectionData","getHeaderLayoutMixins","layoutMixins","layoutHeaderComponent","bandType","columnDistinctSignal","facetLayoutDataName","assembleGroupStyle","getCardinalityAggregateForChild","assembleFacet","facetRoot","outputName","cross","facetSortFields","facetSortOrder","ORTHOGONAL_ORIENT","markGroup","makeJoinAggregateFromFacet","otherData","formatMesh","mesh","otherFeature","feature","formatFeature","otherMesh","parseRoot","existingSource","parseTransformArray","head","lookupCounter","derivedType","transformNode","sequence","parentIsLayer","implicitSelection","implicitEncoding","rawName","mainName","facetName","ConcatModel","getChildren","parseAxisGroup","layoutSignals","db","isFalseOrNull","AXIS_COMPONENT_PROPERTIES_INDEX","AXIS_COMPONENT_PROPERTIES","AxisComponent","specifiedLabelsSpec","parseUnitAxes","parseAxis","OPPOSITE_ORIENT","parseLayerAxes","axisCount","mergeAxisComponents","oppositeOrient","mergedAxisCmpts","childAxisCmpts","mergeAxisComponent","propsToAlwaysIncludeConfig","hasValue","hasConfigValue","axisEncoding","axisEncode","axisEncodingPart","initLayoutSize","vgMark","postEncodingTransform","shapeDef","fixedShape","shapeMixins","vgThicknessChannel","markPropOrConfig","defaultViewStep","markCompiler","parseMarkGroups","getPathGroups","hasCornerRadius","getGroupsForStackedBarWithCornerRadius","getMarkGroup","FACETED_PATH_PREFIX","fromPrefix","STACK_GROUP_PREFIX","fieldScale","stackFieldGroup","vgFieldMinMax","groupUpdate","innerGroupUpdate","groupByField","strokeProperties","strokeForeground","fieldDefToSort","scaleClip","projectionClip","interactiveFlag","xScale","yScale","unitCount","parentCount","UnitModel","parentGivenSize","initScales","specifiedAxes","initAxes","specifiedLegends","initLegends","isGeoShapeMark","hasGeoPosition","initScale","scaleInternal","_axis","axisSpec","initAxis","axisInternal","_legend","correctDataNames","vlEncoding","LayerModel","uniqueStyles","unitSize","compile","inputSpec","vlFieldDef","vgSpec","assembleTopLevelModel","getTopLevelProperties","usermeta","normalized","resize","inverseSizeType","topLevelProperties","vgConfig","otherTopLevelProps","$schema","version","pkg"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAcO,SAASA,WAAWA,CAACC,EAA2B,EAAwB;EAC7E,EAAA,OAAO,CAAC,CAACA,EAAE,CAACC,EAAE,CAAA;EAChB,CAAA;EAEO,SAASC,YAAYA,CAACF,EAA2B,EAAyB;EAC/E,EAAA,OAAO,CAAC,CAACA,EAAE,CAACG,GAAG,CAAA;EACjB,CAAA;EAEO,SAASC,YAAYA,CAACJ,EAA2B,EAAyB;EAC/E,EAAA,OAAO,CAAC,CAACA,EAAE,CAACK,GAAG,CAAA;EACjB,CAAA;EAEO,SAASC,WAAWA,CAAIN,EAAyB,EAAEO,EAAmB,EAAE;EAC7E,EAAA,IAAIH,YAAY,CAACJ,EAAE,CAAC,EAAE;EACpBM,IAAAA,WAAW,CAACN,EAAE,CAACK,GAAG,EAAEE,EAAE,CAAC,CAAA;EACzB,GAAC,MAAM,IAAIL,YAAY,CAACF,EAAE,CAAC,EAAE;EAC3B,IAAA,KAAK,MAAMQ,KAAK,IAAIR,EAAE,CAACG,GAAG,EAAE;EAC1BG,MAAAA,WAAW,CAACE,KAAK,EAAED,EAAE,CAAC,CAAA;EACxB,KAAA;EACF,GAAC,MAAM,IAAIR,WAAW,CAACC,EAAE,CAAC,EAAE;EAC1B,IAAA,KAAK,MAAMQ,KAAK,IAAIR,EAAE,CAACC,EAAE,EAAE;EACzBK,MAAAA,WAAW,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LG,IAAAA,OAAO,EAAE,4CAA4C;MACrD,IAAIz0E,KAAK,CAAC9N,WAAW,GAAG;QAACA,WAAW,EAAE8N,KAAK,CAAC9N,WAAAA;OAAY,GAAG,EAAE,CAAC;EAC9D,IAAA,GAAGsiF,kBAAkB;EACrB,IAAA,IAAI9yD,KAAK,GAAG;EAACA,MAAAA,KAAAA;OAAM,GAAG,EAAE,CAAC;EACzB,IAAA,IAAIlhB,KAAK,GAAG;EAACA,MAAAA,KAAAA;OAAM,GAAG,EAAE,CAAC;EACzB,IAAA,IAAIolE,WAAW,GAAG;EAAC9qD,MAAAA,MAAM,EAAE;EAAC2d,QAAAA,MAAM,EAAEmtC,WAAAA;EAAW,OAAA;OAAE,GAAG,EAAE,CAAC;MACvD/4E,IAAI;EACJ,IAAA,IAAIwhE,WAAW,CAACvpE,MAAM,GAAG,CAAC,GAAG;EAACupE,MAAAA,WAAAA;OAAY,GAAG,EAAE,CAAC;MAChD,GAAGruD,KAAK,CAACkmE,aAAa,CAAC,CACrB,GAAG4I,aAAa,EAChB,GAAG9uE,KAAK,CAACmsE,gCAAgC,CAAC,EAAE,CAAC,EAC7C,GAAG5zC,wBAAwB,CAAC1qB,MAAM,CAAC,CACpC,CAAC;EACF,IAAA,IAAI0mE,QAAQ,GAAG;EAACn0E,MAAAA,MAAM,EAAEm0E,QAAAA;OAAS,GAAG,EAAE,CAAC;EACvC,IAAA,IAAIL,QAAQ,GAAG;EAACA,MAAAA,QAAAA;OAAS,GAAG,EAAE,CAAA;KAC/B,CAAA;EACH;;ACpPaQ,QAAAA,OAAO,GAAGC,GAAG,CAACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/build/vega-lite.min.js b/build/vega-lite.min.js new file mode 100644 index 0000000000..b3579dcd8a --- /dev/null +++ b/build/vega-lite.min.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("vega")):"function"==typeof define&&define.amd?define(["exports","vega"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).vegaLite={},e.vega)}(this,(function(e,t){"use strict";var n="5.16.1";function i(e){return!!e.or}function r(e){return!!e.and}function o(e){return!!e.not}function a(e,t){if(o(e))a(e.not,t);else if(r(e))for(const n of e.and)a(n,t);else if(i(e))for(const n of e.or)a(n,t);else t(e)}function s(e,t){return o(e)?{not:s(e.not,t)}:r(e)?{and:e.and.map((e=>s(e,t)))}:i(e)?{or:e.or.map((e=>s(e,t)))}:t(e)}const l=structuredClone;function c(e){throw new Error(e)}function u(e,n){const i={};for(const r of n)t.hasOwnProperty(e,r)&&(i[r]=e[r]);return i}function f(e,t){const n={...e};for(const e of t)delete n[e];return n}function d(e){if(t.isNumber(e))return e;const n=t.isString(e)?e:X(e);if(n.length<250)return n;let i=0;for(let e=0;e1?t-1:0),i=1;i0===t?e:`[${e}]`)),r=e.map(((t,n)=>e.slice(0,n+1).join("")));for(const e of r)n.add(e)}return n}function k(e,t){return void 0===e||void 0===t||$(w(e),w(t))}function S(e){return 0===D(e).length}Set.prototype.toJSON=function(){return`Set(${[...this].map((e=>X(e))).join(",")})`};const D=Object.keys,F=Object.values,z=Object.entries;function O(e){return!0===e||!1===e}function _(e){const t=e.replace(/\W/g,"_");return(e.match(/^\d+/)?"_":"")+t}function N(e,t){return o(e)?`!(${N(e.not,t)})`:r(e)?`(${e.and.map((e=>N(e,t))).join(") && (")})`:i(e)?`(${e.or.map((e=>N(e,t))).join(") || (")})`:t(e)}function C(e,t){if(0===t.length)return!0;const n=t.shift();return n in e&&C(e[n],t)&&delete e[n],S(e)}function P(e){return e.charAt(0).toUpperCase()+e.substr(1)}function A(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum";const i=t.splitAccessPath(e),r=[];for(let e=1;e<=i.length;e++){const o=`[${i.slice(0,e).map(t.stringValue).join("][")}]`;r.push(`${n}${o}`)}return r.join(" && ")}function j(e){return`${arguments.length>1&&void 0!==arguments[1]?arguments[1]:"datum"}[${t.stringValue(t.splitAccessPath(e).join("."))}]`}function T(e){return e.replace(/(\[|\]|\.|'|")/g,"\\$1")}function E(e){return`${t.splitAccessPath(e).map(T).join("\\.")}`}function M(e,t,n){return e.replace(new RegExp(t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&"),"g"),n)}function L(e){return`${t.splitAccessPath(e).join(".")}`}function q(e){return e?t.splitAccessPath(e).length:0}function U(){for(var e=arguments.length,t=new Array(e),n=0;nfn(e[t])?_(`_${t}_${z(e[t])}`):_(`_${t}_${e[t]}`))).join("")}function ln(e){return!0===e||un(e)&&!e.binned}function cn(e){return"binned"===e||un(e)&&!0===e.binned}function un(e){return t.isObject(e)}function fn(e){return e?.param}function dn(e){switch(e){case Q:case J:case ye:case me:case pe:case ge:case we:case be:case xe:case $e:case he:return 6;case ke:return 4;default:return 10}}function mn(e){return!!e?.expr}function pn(e){const t=D(e||{}),n={};for(const i of t)n[i]=Sn(e[i]);return n}function gn(e){const{anchor:t,frame:n,offset:i,orient:r,angle:o,limit:a,color:s,subtitleColor:l,subtitleFont:c,subtitleFontSize:f,subtitleFontStyle:d,subtitleFontWeight:m,subtitleLineHeight:p,subtitlePadding:g,...h}=e,y={...t?{anchor:t}:{},...n?{frame:n}:{},...i?{offset:i}:{},...r?{orient:r}:{},...void 0!==o?{angle:o}:{},...void 0!==a?{limit:a}:{}},v={...l?{subtitleColor:l}:{},...c?{subtitleFont:c}:{},...f?{subtitleFontSize:f}:{},...d?{subtitleFontStyle:d}:{},...m?{subtitleFontWeight:m}:{},...p?{subtitleLineHeight:p}:{},...g?{subtitlePadding:g}:{}};return{titleMarkConfig:{...h,...s?{fill:s}:{}},subtitleMarkConfig:u(e,["align","baseline","dx","dy","limit"]),nonMarkTitleProperties:y,subtitle:v}}function hn(e){return t.isString(e)||t.isArray(e)&&t.isString(e[0])}function yn(e){return!!e?.signal}function vn(e){return!!e.step}function bn(e){return!t.isArray(e)&&("field"in e&&"data"in e)}const xn=D({aria:1,description:1,ariaRole:1,ariaRoleDescription:1,blend:1,opacity:1,fill:1,fillOpacity:1,stroke:1,strokeCap:1,strokeWidth:1,strokeOpacity:1,strokeDash:1,strokeDashOffset:1,strokeJoin:1,strokeOffset:1,strokeMiterLimit:1,startAngle:1,endAngle:1,padAngle:1,innerRadius:1,outerRadius:1,size:1,shape:1,interpolate:1,tension:1,orient:1,align:1,baseline:1,text:1,dir:1,dx:1,dy:1,ellipsis:1,limit:1,radius:1,theta:1,angle:1,font:1,fontSize:1,fontWeight:1,fontStyle:1,lineBreak:1,lineHeight:1,cursor:1,href:1,tooltip:1,cornerRadius:1,cornerRadiusTopLeft:1,cornerRadiusTopRight:1,cornerRadiusBottomLeft:1,cornerRadiusBottomRight:1,aspect:1,width:1,height:1,url:1,smooth:1}),$n={arc:1,area:1,group:1,image:1,line:1,path:1,rect:1,rule:1,shape:1,symbol:1,text:1,trail:1},wn=["cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight"];function kn(e){const n=t.isArray(e.condition)?e.condition.map(Dn):Dn(e.condition);return{...Sn(e),condition:n}}function Sn(e){if(mn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Dn(e){if(mn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return e}function Fn(e){if(mn(e)){const{expr:t,...n}=e;return{signal:t,...n}}return yn(e)?e:void 0!==e?{value:e}:void 0}function zn(e){return yn(e)?e.signal:t.stringValue(e.value)}function On(e){return yn(e)?e.signal:null==e?null:t.stringValue(e)}function _n(e,t,n){for(const i of n){const n=Pn(i,t.markDef,t.config);void 0!==n&&(e[i]=Fn(n))}return e}function Nn(e){return[].concat(e.type,e.style??[])}function Cn(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{vgChannel:r,ignoreVgConfig:o}=i;return r&&void 0!==t[r]?t[r]:void 0!==t[e]?t[e]:!o||r&&r!==e?Pn(e,t,n,i):void 0}function Pn(e,t,n){let{vgChannel:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};return U(i?An(e,t,n.style):void 0,An(e,t,n.style),i?n[t.type][i]:void 0,n[t.type][e],i?n.mark[i]:n.mark[e])}function An(e,t,n){return jn(e,Nn(t),n)}function jn(e,n,i){let r;n=t.array(n);for(const t of n){const n=i[t];n&&void 0!==n[e]&&(r=n[e])}return r}function Tn(e,n){return t.array(e).reduce(((e,t)=>(e.field.push(oa(t,n)),e.order.push(t.sort??"ascending"),e)),{field:[],order:[]})}function En(e,t){const n=[...e];return t.forEach((e=>{for(const t of n)if(Y(t,e))return;n.push(e)})),n}function Mn(e,n){return Y(e,n)||!n?e:e?[...t.array(e),...t.array(n)].join(", "):n}function Ln(e,t){const n=e.value,i=t.value;if(null==n||null===i)return{explicit:e.explicit,value:null};if((hn(n)||yn(n))&&(hn(i)||yn(i)))return{explicit:e.explicit,value:Mn(n,i)};if(hn(n)||yn(n))return{explicit:e.explicit,value:n};if(hn(i)||yn(i))return{explicit:e.explicit,value:i};if(!(hn(n)||yn(n)||hn(i)||yn(i)))return{explicit:e.explicit,value:En(n,i)};throw new Error("It should never reach here")}function qn(e,t,n){return(t=function(e){var t=function(e,t){if("object"!=typeof e||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0!==n){var i=n.call(e,t||"default");if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Un(e,t,n){return function(e,t,n){if(t.set)t.set.call(e,n);else{if(!t.writable)throw new TypeError("attempted to set read only private field");t.value=n}}(e,Rn(e,t,"set"),n),n}function Rn(e,t,n){if(!t.has(e))throw new TypeError("attempted to "+n+" private field on non-instance");return t.get(e)}function Wn(e,t,n){!function(e,t){if(t.has(e))throw new TypeError("Cannot initialize the same private elements twice on an object")}(e,t),t.set(e,n)}function Bn(e){return`Invalid specification ${X(e)}. Make sure the specification includes at least one of the following properties: "mark", "layer", "facet", "hconcat", "vconcat", "concat", or "repeat".`}const In='Autosize "fit" only works for single views and layered views.';function Hn(e){return`${"width"==e?"Width":"Height"} "container" only works for single views and layered views.`}function Vn(e){return`${"width"==e?"Width":"Height"} "container" only works well with autosize "fit" or "fit-${"width"==e?"x":"y"}".`}function Gn(e){return e?`Dropping "fit-${e}" because spec has discrete ${rt(e)}.`:'Dropping "fit" because spec has discrete size.'}function Yn(e){return`Unknown field for ${e}. Cannot calculate view size.`}function Xn(e){return`Cannot project a selection on encoding channel "${e}", which has no field.`}function Qn(e,t){return`Cannot project a selection on encoding channel "${e}" as it uses an aggregate function ("${t}").`}function Jn(e){return`Selection not supported for ${e} yet.`}const Kn="The same selection must be used to override scale domains in a layered view.";function Zn(e){return`The "columns" property cannot be used when "${e}" has nested row/column.`}function ei(e,t,n){return`An ancestor parsed field "${e}" as ${n} but a child wants to parse the field as ${t}.`}function ti(e){return`Config.customFormatTypes is not true, thus custom format type and format for channel ${e} are dropped.`}function ni(e){return`${e}Offset dropped because ${e} is continuous`}function ii(e){return`Invalid field type "${e}".`}function ri(e,t){const{fill:n,stroke:i}=t;return`Dropping color ${e} as the plot also has ${n&&i?"fill and stroke":n?"fill":"stroke"}.`}function oi(e,t){return`Dropping ${X(e)} from channel "${t}" since it does not contain any data field, datum, value, or signal.`}function ai(e,t,n){return`${e} dropped as it is incompatible with "${t}"${n?` when ${n}`:""}.`}function si(e){return`${e} encoding should be discrete (ordinal / nominal / binned).`}function li(e){return`${e} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`}function ci(e,t){return`Using discrete channel "${e}" to encode "${t}" field can be misleading as it does not encode ${"ordinal"===t?"order":"magnitude"}.`}function ui(e){return`Using unaggregated domain with raw field has no effect (${X(e)}).`}function fi(e){return`Unaggregated domain not applicable for "${e}" since it produces values outside the origin domain of the source data.`}function di(e){return`Unaggregated domain is currently unsupported for log scale (${X(e)}).`}function mi(e,t,n){return`${n}-scale's "${t}" is dropped as it does not work with ${e} scale.`}function pi(e){return`The step for "${e}" is dropped because the ${"width"===e?"x":"y"} is continuous.`}const gi="Domains that should be unioned has conflicting sort properties. Sort will be set to true.";function hi(e,t){return`Invalid ${e}: ${X(t)}.`}function yi(e){return`1D error band does not support ${e}.`}function vi(e){return`Channel ${e} is required for "binned" bin.`}const bi=t.logger(t.Warn);let xi=bi;function $i(){xi.warn(...arguments)}function wi(e){if(e&&t.isObject(e))for(const t of Ni)if(t in e)return!0;return!1}const ki=["january","february","march","april","may","june","july","august","september","october","november","december"],Si=ki.map((e=>e.substr(0,3))),Di=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"],Fi=Di.map((e=>e.substr(0,3)));function zi(e,n){const i=[];if(n&&void 0!==e.day&&D(e).length>1&&($i(function(e){return`Dropping day from datetime ${X(e)} as day cannot be combined with other units.`}(e)),delete(e=l(e)).day),void 0!==e.year?i.push(e.year):i.push(2012),void 0!==e.month){const r=n?function(e){if(V(e)&&(e=+e),t.isNumber(e))return e-1;{const t=e.toLowerCase(),n=ki.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Si.indexOf(i);if(-1!==r)return r;throw new Error(hi("month",e))}}(e.month):e.month;i.push(r)}else if(void 0!==e.quarter){const r=n?function(e){if(V(e)&&(e=+e),t.isNumber(e))return e>4&&$i(hi("quarter",e)),e-1;throw new Error(hi("quarter",e))}(e.quarter):e.quarter;i.push(t.isNumber(r)?3*r:`${r}*3`)}else i.push(0);if(void 0!==e.date)i.push(e.date);else if(void 0!==e.day){const r=n?function(e){if(V(e)&&(e=+e),t.isNumber(e))return e%7;{const t=e.toLowerCase(),n=Di.indexOf(t);if(-1!==n)return n;const i=t.substr(0,3),r=Fi.indexOf(i);if(-1!==r)return r;throw new Error(hi("day",e))}}(e.day):e.day;i.push(t.isNumber(r)?r+1:`${r}+1`)}else i.push(1);for(const t of["hours","minutes","seconds","milliseconds"]){const n=e[t];i.push(void 0===n?0:n)}return i}function Oi(e){const t=zi(e,!0).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}const _i={year:1,quarter:1,month:1,week:1,day:1,dayofyear:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1},Ni=D(_i);function Ci(e){return t.isObject(e)?e.binned:Pi(e)}function Pi(e){return e&&e.startsWith("binned")}function Ai(e){return e.startsWith("utc")}const ji={"year-month":"%b %Y ","year-month-date":"%b %d, %Y "};function Ti(e){return Ni.filter((t=>Mi(e,t)))}function Ei(e){const t=Ti(e);return t[t.length-1]}function Mi(e,t){const n=e.indexOf(t);return!(n<0)&&(!(n>0&&"seconds"===t&&"i"===e.charAt(n-1))&&(!(e.length>n+3&&"day"===t&&"o"===e.charAt(n+3))&&!(n>0&&"year"===t&&"f"===e.charAt(n-1))))}function Li(e,t){let{end:n}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{end:!1};const i=A(t),r=Ai(e)?"utc":"";let o;const a={};for(const t of Ni)Mi(e,t)&&(a[t]="quarter"===(s=t)?`(${r}quarter(${i})-1)`:`${r}${s}(${i})`,o=t);var s;return n&&(a[o]+="+1"),function(e){const t=zi(e,!1).join(", ");return e.utc?`utc(${t})`:`datetime(${t})`}(a)}function qi(e){if(!e)return;return`timeUnitSpecifier(${X(Ti(e))}, ${X(ji)})`}function Ui(e){if(!e)return;let n;return t.isString(e)?n=Pi(e)?{unit:e.substring(6),binned:!0}:{unit:e}:t.isObject(e)&&(n={...e,...e.unit?{unit:e.unit}:{}}),Ai(n.unit)&&(n.utc=!0,n.unit=n.unit.substring(3)),n}function Ri(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e=>e;const n=Ui(e),i=Ei(n.unit);if(i&&"day"!==i){const e={year:2001,month:1,date:1,hours:0,minutes:0,seconds:0,milliseconds:0},{step:r,part:o}=Bi(i,n.step);return`${t(Oi({...e,[o]:+e[o]+r}))} - ${t(Oi(e))}`}}const Wi={year:1,month:1,date:1,hours:1,minutes:1,seconds:1,milliseconds:1};function Bi(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(function(e){return!!Wi[e]}(e))return{part:e,step:t};switch(e){case"day":case"dayofyear":return{part:"date",step:t};case"quarter":return{part:"month",step:3*t};case"week":return{part:"date",step:7*t}}}function Ii(e){return!!e?.field&&void 0!==e.equal}function Hi(e){return!!e?.field&&void 0!==e.lt}function Vi(e){return!!e?.field&&void 0!==e.lte}function Gi(e){return!!e?.field&&void 0!==e.gt}function Yi(e){return!!e?.field&&void 0!==e.gte}function Xi(e){if(e?.field){if(t.isArray(e.range)&&2===e.range.length)return!0;if(yn(e.range))return!0}return!1}function Qi(e){return!!e?.field&&(t.isArray(e.oneOf)||t.isArray(e.in))}function Ji(e){return Qi(e)||Ii(e)||Xi(e)||Hi(e)||Gi(e)||Vi(e)||Yi(e)}function Ki(e,t){return wa(e,{timeUnit:t,wrapTime:!0})}function Zi(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{field:n}=e,i=Ui(e.timeUnit),{unit:r,binned:o}=i||{},a=oa(e,{expr:"datum"}),s=r?`time(${o?a:Li(r,n)})`:a;if(Ii(e))return`${s}===${Ki(e.equal,r)}`;if(Hi(e)){return`${s}<${Ki(e.lt,r)}`}if(Gi(e)){return`${s}>${Ki(e.gt,r)}`}if(Vi(e)){return`${s}<=${Ki(e.lte,r)}`}if(Yi(e)){return`${s}>=${Ki(e.gte,r)}`}if(Qi(e))return`indexof([${function(e,t){return e.map((e=>Ki(e,t)))}(e.oneOf,r).join(",")}], ${s}) !== -1`;if(function(e){return!!e?.field&&void 0!==e.valid}(e))return er(s,e.valid);if(Xi(e)){const{range:n}=e,i=yn(n)?{signal:`${n.signal}[0]`}:n[0],o=yn(n)?{signal:`${n.signal}[1]`}:n[1];if(null!==i&&null!==o&&t)return"inrange("+s+", ["+Ki(i,r)+", "+Ki(o,r)+"])";const a=[];return null!==i&&a.push(`${s} >= ${Ki(i,r)}`),null!==o&&a.push(`${s} <= ${Ki(o,r)}`),a.length>0?a.join(" && "):"true"}throw new Error(`Invalid field predicate: ${X(e)}`)}function er(e){return!(arguments.length>1&&void 0!==arguments[1])||arguments[1]?`isValid(${e}) && isFinite(+${e})`:`!isValid(${e}) || !isFinite(+${e})`}function tr(e){return Ji(e)&&e.timeUnit?{...e,timeUnit:Ui(e.timeUnit)}:e}function nr(e){return"quantitative"===e||"temporal"===e}function ir(e){return"ordinal"===e||"nominal"===e}const rr="quantitative",or="ordinal",ar="temporal",sr="nominal",lr="geojson";const cr={LINEAR:"linear",LOG:"log",POW:"pow",SQRT:"sqrt",SYMLOG:"symlog",IDENTITY:"identity",SEQUENTIAL:"sequential",TIME:"time",UTC:"utc",QUANTILE:"quantile",QUANTIZE:"quantize",THRESHOLD:"threshold",BIN_ORDINAL:"bin-ordinal",ORDINAL:"ordinal",POINT:"point",BAND:"band"},ur={linear:"numeric",log:"numeric",pow:"numeric",sqrt:"numeric",symlog:"numeric",identity:"numeric",sequential:"numeric",time:"time",utc:"time",ordinal:"ordinal","bin-ordinal":"bin-ordinal",point:"ordinal-position",band:"ordinal-position",quantile:"discretizing",quantize:"discretizing",threshold:"discretizing"};function fr(e,t){const n=ur[e],i=ur[t];return n===i||"ordinal-position"===n&&"time"===i||"ordinal-position"===i&&"time"===n}const dr={linear:0,log:1,pow:1,sqrt:1,symlog:1,identity:1,sequential:1,time:0,utc:0,point:10,band:11,ordinal:0,"bin-ordinal":0,quantile:0,quantize:0,threshold:0};function mr(e){return dr[e]}const pr=new Set(["linear","log","pow","sqrt","symlog"]),gr=new Set([...pr,"time","utc"]);function hr(e){return pr.has(e)}const yr=new Set(["quantile","quantize","threshold"]),vr=new Set([...gr,...yr,"sequential","identity"]),br=new Set(["ordinal","bin-ordinal","point","band"]);function xr(e){return br.has(e)}function $r(e){return vr.has(e)}function wr(e){return gr.has(e)}function kr(e){return yr.has(e)}function Sr(e){return e?.param}const{type:Dr,domain:Fr,range:zr,rangeMax:Or,rangeMin:_r,scheme:Nr,...Cr}={type:1,domain:1,domainMax:1,domainMin:1,domainMid:1,domainRaw:1,align:1,range:1,rangeMax:1,rangeMin:1,scheme:1,bins:1,reverse:1,round:1,clamp:1,nice:1,base:1,exponent:1,constant:1,interpolate:1,zero:1,padding:1,paddingInner:1,paddingOuter:1},Pr=D(Cr);function Ar(e,t){switch(t){case"type":case"domain":case"reverse":case"range":return!0;case"scheme":case"interpolate":return!["point","band","identity"].includes(e);case"bins":return!["point","band","identity","ordinal"].includes(e);case"round":return wr(e)||"band"===e||"point"===e;case"padding":case"rangeMin":case"rangeMax":return wr(e)||["point","band"].includes(e);case"paddingOuter":case"align":return["point","band"].includes(e);case"paddingInner":return"band"===e;case"domainMax":case"domainMid":case"domainMin":case"domainRaw":case"clamp":return wr(e);case"nice":return wr(e)||"quantize"===e||"threshold"===e;case"exponent":return"pow"===e;case"base":return"log"===e;case"constant":return"symlog"===e;case"zero":return $r(e)&&!p(["log","time","utc","threshold","quantile"],e)}}function jr(e,t){switch(t){case"interpolate":case"scheme":case"domainMid":return qe(e)?void 0:`Cannot use the scale property "${t}" with non-color channel.`;case"align":case"type":case"bins":case"domain":case"domainMax":case"domainMin":case"domainRaw":case"range":case"base":case"exponent":case"constant":case"nice":case"padding":case"paddingInner":case"paddingOuter":case"rangeMax":case"rangeMin":case"reverse":case"round":case"clamp":case"zero":return}}const Tr={arc:"arc",area:"area",bar:"bar",image:"image",line:"line",point:"point",rect:"rect",rule:"rule",text:"text",tick:"tick",trail:"trail",circle:"circle",square:"square",geoshape:"geoshape"},Er=Tr.arc,Mr=Tr.area,Lr=Tr.bar,qr=Tr.image,Ur=Tr.line,Rr=Tr.point,Wr=Tr.rect,Br=Tr.rule,Ir=Tr.text,Hr=Tr.tick,Vr=Tr.trail,Gr=Tr.circle,Yr=Tr.square,Xr=Tr.geoshape;function Qr(e){return["line","area","trail"].includes(e)}function Jr(e){return["rect","bar","image","arc"].includes(e)}const Kr=new Set(D(Tr));function Zr(e){return e.type}const eo=["stroke","strokeWidth","strokeDash","strokeDashOffset","strokeOpacity","strokeJoin","strokeMiterLimit","fill","fillOpacity"],to=D({color:1,filled:1,invalid:1,order:1,radius2:1,theta2:1,timeUnitBandSize:1,timeUnitBandPosition:1}),no=D({mark:1,arc:1,area:1,bar:1,circle:1,image:1,line:1,point:1,rect:1,rule:1,square:1,text:1,tick:1,trail:1,geoshape:1});function io(e){return e&&null!=e.band}const ro={horizontal:["cornerRadiusTopRight","cornerRadiusBottomRight"],vertical:["cornerRadiusTopLeft","cornerRadiusTopRight"]},oo={binSpacing:1,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5},ao={binSpacing:0,continuousBandSize:5,minBandSize:.25,timeUnitBandPosition:.5};function so(e){const{channel:t,channelDef:n,markDef:i,scale:r,config:o}=e,a=mo(e);return Ho(n)&&!rn(n.aggregate)&&r&&wr(r.get("type"))?function(e){let{fieldDef:t,channel:n,markDef:i,ref:r,config:o}=e;if(Qr(i.type))return r;const a=Cn("invalid",i,o);if(null===a)return[lo(t,n),r];return r}({fieldDef:n,channel:t,markDef:i,ref:a,config:o}):a}function lo(e,t){return{test:co(e,!0),..."y"===tt(t)?{field:{group:"height"}}:{value:0}}}function co(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return er(t.isString(e)?e:oa(e,{expr:"datum"}),!n)}function uo(e,t,n,i){const r={};if(t&&(r.scale=t),Go(e)){const{datum:t}=e;wi(t)?r.signal=Oi(t):yn(t)?r.signal=t.signal:mn(t)?r.signal=t.expr:r.value=t}else r.field=oa(e,n);if(i){const{offset:e,band:t}=i;e&&(r.offset=e),t&&(r.band=t)}return r}function fo(e){let{scaleName:t,fieldOrDatumDef:n,fieldOrDatumDef2:i,offset:r,startSuffix:o,endSuffix:a="end",bandPosition:s=.5}=e;const l=!yn(s)&&01&&void 0!==arguments[1]?arguments[1]:{},n=e.field;const i=t.prefix;let r=t.suffix,o="";if(function(e){return"count"===e.aggregate}(e))n=B("count");else{let i;if(!t.nofn)if(function(e){return"op"in e}(e))i=e.op;else{const{bin:a,aggregate:s,timeUnit:l}=e;ln(a)?(i=sn(a),r=(t.binSuffix??"")+(t.suffix??"")):s?en(s)?(o=`["${n}"]`,n=`argmax_${s.argmax}`):Zt(s)?(o=`["${n}"]`,n=`argmin_${s.argmin}`):i=String(s):l&&!Ci(l)&&(i=function(e){const{utc:t,...n}=Ui(e);return n.unit?(t?"utc":"")+D(n).map((e=>_(`${"unit"===e?"":`_${e}_`}${n[e]}`))).join(""):(t?"utc":"")+"timeunit"+D(n).map((e=>_(`_${e}_${n[e]}`))).join("")}(l),r=(!["range","mid"].includes(t.binSuffix)&&t.binSuffix||"")+(t.suffix??""))}i&&(n=n?`${i}_${n}`:i)}return r&&(n=`${n}_${r}`),i&&(n=`${i}_${n}`),t.forAs?L(n):t.expr?j(n,t.expr)+o:E(n)+o}function aa(e){switch(e.type){case"nominal":case"ordinal":case"geojson":return!0;case"quantitative":return Ho(e)&&!!e.bin;case"temporal":return!1}throw new Error(ii(e.type))}const sa=(e,t)=>{switch(t.fieldTitle){case"plain":return e.field;case"functional":return function(e){const{aggregate:t,bin:n,timeUnit:i,field:r}=e;if(en(t))return`${r} for argmax(${t.argmax})`;if(Zt(t))return`${r} for argmin(${t.argmin})`;const o=i&&!Ci(i)?Ui(i):void 0,a=t||o?.unit||o?.maxbins&&"timeunit"||ln(n)&&"bin";return a?`${a.toUpperCase()}(${r})`:r}(e);default:return function(e,t){const{field:n,bin:i,timeUnit:r,aggregate:o}=e;if("count"===o)return t.countTitle;if(ln(i))return`${n} (binned)`;if(r&&!Ci(r)){const e=Ui(r)?.unit;if(e)return`${n} (${Ti(e).join("-")})`}else if(o)return en(o)?`${n} for max ${o.argmax}`:Zt(o)?`${n} for min ${o.argmin}`:`${P(o)} of ${n}`;return n}(e,t)}};let la=sa;function ca(e){la=e}function ua(e,t,n){let{allowDisabling:i,includeDefault:r=!0}=n;const o=fa(e)?.title;if(!Ho(e))return o??e.title;const a=e,s=r?da(a,t):void 0;return i?U(o,a.title,s):o??a.title??s}function fa(e){return ta(e)&&e.axis?e.axis:na(e)&&e.legend?e.legend:jo(e)&&e.header?e.header:void 0}function da(e,t){return la(e,t)}function ma(e){if(ia(e)){const{format:t,formatType:n}=e;return{format:t,formatType:n}}{const t=fa(e)??{},{format:n,formatType:i}=t;return{format:n,formatType:i}}}function pa(e){return Ho(e)?e:Bo(e)?e.condition:void 0}function ga(e){return Jo(e)?e:Io(e)?e.condition:void 0}function ha(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(t.isString(e)||t.isNumber(e)||t.isBoolean(e)){return $i(function(e,t,n){return`Channel ${e} is a ${t}. Converted to {value: ${X(n)}}.`}(n,t.isString(e)?"string":t.isNumber(e)?"number":"boolean",e)),{value:e}}return Jo(e)?ya(e,n,i,r):Io(e)?{...e,condition:ya(e.condition,n,i,r)}:e}function ya(e,n,i,r){if(ia(e)){const{format:t,formatType:o,...a}=e;if(go(o)&&!i.customFormatTypes)return $i(ti(n)),ya(a,n,i,r)}else{const t=ta(e)?"axis":na(e)?"legend":jo(e)?"header":null;if(t&&e[t]){const{format:o,formatType:a,...s}=e[t];if(go(a)&&!i.customFormatTypes)return $i(ti(n)),ya({...e,[t]:s},n,i,r)}}return Ho(e)?va(e,n,r):function(e){let n=e.type;if(n)return e;const{datum:i}=e;return n=t.isNumber(i)?"quantitative":t.isString(i)?"nominal":wi(i)?"temporal":void 0,{...e,type:n}}(e)}function va(e,n){let{compositeMark:i=!1}=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{aggregate:r,timeUnit:o,bin:a,field:s}=e,l={...e};if(i||!r||tn(r)||en(r)||Zt(r)||($i(function(e){return`Invalid aggregation operator "${e}".`}(r)),delete l.aggregate),o&&(l.timeUnit=Ui(o)),s&&(l.field=`${s}`),ln(a)&&(l.bin=ba(a,n)),cn(a)&&!zt(n)&&$i(function(e){return`Channel ${e} should not be used with "binned" bin.`}(n)),Ko(l)){const{type:e}=l,t=function(e){if(e)switch(e=e.toLowerCase()){case"q":case rr:return"quantitative";case"t":case ar:return"temporal";case"o":case or:return"ordinal";case"n":case sr:return"nominal";case lr:return"geojson"}}(e);e!==t&&(l.type=t),"quantitative"!==e&&rn(r)&&($i(function(e,t){return`Invalid field type "${e}" for aggregate: "${t}", using "quantitative" instead.`}(e,r)),l.type="quantitative")}else if(!et(n)){const e=function(e,n){switch(n){case"latitude":case"longitude":return"quantitative";case"row":case"column":case"facet":case"shape":case"strokeDash":return"nominal";case"order":return"ordinal"}if(Mo(e)&&t.isArray(e.sort))return"ordinal";const{aggregate:i,bin:r,timeUnit:o}=e;if(o)return"temporal";if(r||i&&!en(i)&&!Zt(i))return"quantitative";if(ea(e)&&e.scale?.type)switch(ur[e.scale.type]){case"numeric":case"discretizing":return"quantitative";case"time":return"temporal"}return"nominal"}(l,n);l.type=e}if(Ko(l)){const{compatible:e,warning:t}=function(e,t){const n=e.type;if("geojson"===n&&"shape"!==t)return{compatible:!1,warning:`Channel ${t} should not be used with a geojson data.`};switch(t){case Q:case J:case K:return aa(e)?xa:{compatible:!1,warning:si(t)};case Z:case ee:case ie:case re:case me:case pe:case ge:case Se:case Fe:case ze:case Oe:case _e:case Ne:case ve:case se:case oe:case Ce:return xa;case ue:case de:case ce:case fe:return n!==rr?{compatible:!1,warning:`Channel ${t} should be used with a quantitative field only, not ${e.type} field.`}:xa;case be:case xe:case $e:case we:case ye:case le:case ae:case te:case ne:return"nominal"!==n||e.sort?xa:{compatible:!1,warning:`Channel ${t} should not be used with an unsorted discrete field.`};case he:case ke:return aa(e)||ea(i=e)&&kr(i.scale?.type)?xa:{compatible:!1,warning:li(t)};case De:return"nominal"!==e.type||"sort"in e?xa:{compatible:!1,warning:"Channel order is inappropriate for nominal field, which has no inherent order."}}var i}(l,n)||{};!1===e&&$i(t)}if(Mo(l)&&t.isString(l.sort)){const{sort:e}=l;if(_o(e))return{...l,sort:{encoding:e}};const t=e.substr(1);if("-"===e.charAt(0)&&_o(t))return{...l,sort:{encoding:t,order:"descending"}}}if(jo(l)){const{header:e}=l;if(e){const{orient:t,...n}=e;if(t)return{...l,header:{...n,labelOrient:e.labelOrient||t,titleOrient:e.titleOrient||t}}}}return l}function ba(e,n){return t.isBoolean(e)?{maxbins:dn(n)}:"binned"===e?{binned:!0}:e.maxbins||e.step?e:{...e,maxbins:dn(n)}}const xa={compatible:!0};function $a(e){const{formatType:t}=ma(e);return"time"===t||!t&&((n=e)&&("temporal"===n.type||Ho(n)&&!!n.timeUnit));var n}function wa(e,n){let{timeUnit:i,type:r,wrapTime:o,undefinedIfExprNotRequired:a}=n;const s=i&&Ui(i)?.unit;let l,c=s||"temporal"===r;return mn(e)?l=e.expr:yn(e)?l=e.signal:wi(e)?(c=!0,l=Oi(e)):(t.isString(e)||t.isNumber(e))&&c&&(l=`datetime(${X(e)})`,function(e){return!!_i[e]}(s)&&(t.isNumber(e)&&e<1e4||t.isString(e)&&isNaN(Date.parse(e)))&&(l=Oi({[s]:e}))),l?o&&c?`time(${l})`:l:a?void 0:X(e)}function ka(e,t){const{type:n}=e;return t.map((t=>{const i=wa(t,{timeUnit:Ho(e)&&!Ci(e.timeUnit)?e.timeUnit:void 0,type:n,undefinedIfExprNotRequired:!0});return void 0!==i?{signal:i}:t}))}function Sa(e,t){return ln(e.bin)?Ht(t)&&["ordinal","nominal"].includes(e.type):(console.warn("Only call this method for binned field defs."),!1)}const Da={labelAlign:{part:"labels",vgProp:"align"},labelBaseline:{part:"labels",vgProp:"baseline"},labelColor:{part:"labels",vgProp:"fill"},labelFont:{part:"labels",vgProp:"font"},labelFontSize:{part:"labels",vgProp:"fontSize"},labelFontStyle:{part:"labels",vgProp:"fontStyle"},labelFontWeight:{part:"labels",vgProp:"fontWeight"},labelOpacity:{part:"labels",vgProp:"opacity"},labelOffset:null,labelPadding:null,gridColor:{part:"grid",vgProp:"stroke"},gridDash:{part:"grid",vgProp:"strokeDash"},gridDashOffset:{part:"grid",vgProp:"strokeDashOffset"},gridOpacity:{part:"grid",vgProp:"opacity"},gridWidth:{part:"grid",vgProp:"strokeWidth"},tickColor:{part:"ticks",vgProp:"stroke"},tickDash:{part:"ticks",vgProp:"strokeDash"},tickDashOffset:{part:"ticks",vgProp:"strokeDashOffset"},tickOpacity:{part:"ticks",vgProp:"opacity"},tickSize:null,tickWidth:{part:"ticks",vgProp:"strokeWidth"}};function Fa(e){return e?.condition}const za=["domain","grid","labels","ticks","title"],Oa={grid:"grid",gridCap:"grid",gridColor:"grid",gridDash:"grid",gridDashOffset:"grid",gridOpacity:"grid",gridScale:"grid",gridWidth:"grid",orient:"main",bandPosition:"both",aria:"main",description:"main",domain:"main",domainCap:"main",domainColor:"main",domainDash:"main",domainDashOffset:"main",domainOpacity:"main",domainWidth:"main",format:"main",formatType:"main",labelAlign:"main",labelAngle:"main",labelBaseline:"main",labelBound:"main",labelColor:"main",labelFlush:"main",labelFlushOffset:"main",labelFont:"main",labelFontSize:"main",labelFontStyle:"main",labelFontWeight:"main",labelLimit:"main",labelLineHeight:"main",labelOffset:"main",labelOpacity:"main",labelOverlap:"main",labelPadding:"main",labels:"main",labelSeparation:"main",maxExtent:"main",minExtent:"main",offset:"both",position:"main",tickCap:"main",tickColor:"main",tickDash:"main",tickDashOffset:"main",tickMinStep:"both",tickOffset:"both",tickOpacity:"main",tickRound:"both",ticks:"main",tickSize:"main",tickWidth:"both",title:"main",titleAlign:"main",titleAnchor:"main",titleAngle:"main",titleBaseline:"main",titleColor:"main",titleFont:"main",titleFontSize:"main",titleFontStyle:"main",titleFontWeight:"main",titleLimit:"main",titleLineHeight:"main",titleOpacity:"main",titlePadding:"main",titleX:"main",titleY:"main",encode:"both",scale:"both",tickBand:"both",tickCount:"both",tickExtra:"both",translate:"both",values:"both",zindex:"both"},_a={orient:1,aria:1,bandPosition:1,description:1,domain:1,domainCap:1,domainColor:1,domainDash:1,domainDashOffset:1,domainOpacity:1,domainWidth:1,format:1,formatType:1,grid:1,gridCap:1,gridColor:1,gridDash:1,gridDashOffset:1,gridOpacity:1,gridWidth:1,labelAlign:1,labelAngle:1,labelBaseline:1,labelBound:1,labelColor:1,labelFlush:1,labelFlushOffset:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelLineHeight:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labels:1,labelSeparation:1,maxExtent:1,minExtent:1,offset:1,position:1,tickBand:1,tickCap:1,tickColor:1,tickCount:1,tickDash:1,tickDashOffset:1,tickExtra:1,tickMinStep:1,tickOffset:1,tickOpacity:1,tickRound:1,ticks:1,tickSize:1,tickWidth:1,title:1,titleAlign:1,titleAnchor:1,titleAngle:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titlePadding:1,titleX:1,titleY:1,translate:1,values:1,zindex:1},Na={..._a,style:1,labelExpr:1,encoding:1};function Ca(e){return!!Na[e]}const Pa=D({axis:1,axisBand:1,axisBottom:1,axisDiscrete:1,axisLeft:1,axisPoint:1,axisQuantitative:1,axisRight:1,axisTemporal:1,axisTop:1,axisX:1,axisXBand:1,axisXDiscrete:1,axisXPoint:1,axisXQuantitative:1,axisXTemporal:1,axisY:1,axisYBand:1,axisYDiscrete:1,axisYPoint:1,axisYQuantitative:1,axisYTemporal:1});function Aa(e){return"mark"in e}class ja{constructor(e,t){this.name=e,this.run=t}hasMatchingType(e){return!!Aa(e)&&(Zr(t=e.mark)?t.type:t)===this.name;var t}}function Ta(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?g(i,(e=>!!e.field)):Ho(i)||Bo(i))}function Ea(e,n){const i=e&&e[n];return!!i&&(t.isArray(i)?g(i,(e=>!!e.field)):Ho(i)||Go(i)||Io(i))}function Ma(e,t){if(zt(t)){const n=e[t];if((Ho(n)||Go(n))&&(ir(n.type)||Ho(n)&&n.timeUnit)){return Ea(e,at(t))}}return!1}function La(e){return g(Be,(n=>{if(Ta(e,n)){const i=e[n];if(t.isArray(i))return g(i,(e=>!!e.aggregate));{const e=pa(i);return e&&!!e.aggregate}}return!1}))}function qa(e,t){const n=[],i=[],r=[],o=[],a={};return Wa(e,((s,l)=>{if(Ho(s)){const{field:c,aggregate:u,bin:f,timeUnit:d,...m}=s;if(u||d||f){const e=fa(s),p=e?.title;let g=oa(s,{forAs:!0});const h={...p?[]:{title:ua(s,t,{allowDisabling:!0})},...m,field:g};if(u){let e;if(en(u)?(e="argmax",g=oa({op:"argmax",field:u.argmax},{forAs:!0}),h.field=`${g}.${c}`):Zt(u)?(e="argmin",g=oa({op:"argmin",field:u.argmin},{forAs:!0}),h.field=`${g}.${c}`):"boxplot"!==u&&"errorbar"!==u&&"errorband"!==u&&(e=u),e){const t={op:e,as:g};c&&(t.field=c),o.push(t)}}else if(n.push(g),Ko(s)&&ln(f)){if(i.push({bin:f,field:c,as:g}),n.push(oa(s,{binSuffix:"end"})),Sa(s,l)&&n.push(oa(s,{binSuffix:"range"})),zt(l)){const e={field:`${g}_end`};a[`${l}2`]=e}h.bin="binned",et(l)||(h.type=rr)}else if(d&&!Ci(d)){r.push({timeUnit:d,field:c,as:g});const e=Ko(s)&&s.type!==ar&&"time";e&&(l===Se||l===Oe?h.formatType=e:!function(e){return!!kt[e]}(l)?zt(l)&&(h.axis={formatType:e,...h.axis}):h.legend={formatType:e,...h.legend})}a[l]=h}else n.push(c),a[l]=e[l]}else a[l]=e[l]})),{bins:i,timeUnits:r,aggregate:o,groupby:n,encoding:a}}function Ua(e,t,n){const i=Vt(t,n);if(!i)return!1;if("binned"===i){const n=e[t===te?Z:ee];return!!(Ho(n)&&Ho(e[t])&&cn(n.bin))}return!0}function Ra(e,t){const n={};for(const i of D(e)){const r=ha(e[i],i,t,{compositeMark:!0});n[i]=r}return n}function Wa(e,n,i){if(e)for(const r of D(e)){const o=e[r];if(t.isArray(o))for(const e of o)n.call(i,e,r);else n.call(i,o,r)}}function Ba(e,n){return D(n).reduce(((i,r)=>{switch(r){case Z:case ee:case _e:case Ce:case Ne:case te:case ne:case ie:case re:case se:case le:case oe:case ae:case ce:case ue:case fe:case de:case Se:case he:case ve:case Oe:return i;case De:if("line"===e||"trail"===e)return i;case Fe:case ze:{const e=n[r];if(t.isArray(e)||Ho(e))for(const n of t.array(e))n.aggregate||i.push(oa(n,{}));return i}case ye:if("trail"===e)return i;case me:case pe:case ge:case be:case xe:case $e:case ke:case we:{const e=pa(n[r]);return e&&!e.aggregate&&i.push(oa(e,{})),i}}}),[])}function Ia(e,n,i){let r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if("tooltip"in i)return{tooltip:i.tooltip};return{tooltip:[...e.map((e=>{let{fieldPrefix:t,titlePrefix:i}=e;const o=r?` of ${Ha(n)}`:"";return{field:t+n.field,type:n.type,title:yn(i)?{signal:`${i}"${escape(o)}"`}:i+o}})),...b(function(e){const n=[];for(const i of D(e))if(Ta(e,i)){const r=e[i],o=t.array(r);for(const e of o)Ho(e)?n.push(e):Bo(e)&&n.push(e.condition)}return n}(i).map(ra),d)]}}function Ha(e){const{title:t,field:n}=e;return U(t,n)}function Va(e,n,i,r,o){const{scale:a,axis:s}=i;return l=>{let{partName:c,mark:u,positionPrefix:f,endPositionPrefix:d,extraEncoding:m={}}=l;const p=Ha(i);return Ga(e,c,o,{mark:u,encoding:{[n]:{field:`${f}_${i.field}`,type:i.type,...void 0!==p?{title:p}:{},...void 0!==a?{scale:a}:{},...void 0!==s?{axis:s}:{}},...t.isString(d)?{[`${n}2`]:{field:`${d}_${i.field}`}}:{},...r,...m}})}}function Ga(e,n,i,r){const{clip:o,color:a,opacity:s}=e,l=e.type;return e[n]||void 0===e[n]&&i[n]?[{...r,mark:{...i[n],...o?{clip:o}:{},...a?{color:a}:{},...s?{opacity:s}:{},...Zr(r.mark)?r.mark:{type:r.mark},style:`${l}-${String(n)}`,...t.isBoolean(e[n])?{}:e[n]}}]:[]}function Ya(e,t,n){const{encoding:i}=e,r="vertical"===t?"y":"x",o=i[r],a=i[`${r}2`],s=i[`${r}Error`],l=i[`${r}Error2`];return{continuousAxisChannelDef:Xa(o,n),continuousAxisChannelDef2:Xa(a,n),continuousAxisChannelDefError:Xa(s,n),continuousAxisChannelDefError2:Xa(l,n),continuousAxis:r}}function Xa(e,t){if(e?.aggregate){const{aggregate:n,...i}=e;return n!==t&&$i(function(e,t){return`Continuous axis should not have customized aggregation function ${e}; ${t} already agregates the axis.`}(n,t)),i}return e}function Qa(e,t){const{mark:n,encoding:i}=e,{x:r,y:o}=i;if(Zr(n)&&n.orient)return n.orient;if(Yo(r)){if(Yo(o)){const e=Ho(r)&&r.aggregate,n=Ho(o)&&o.aggregate;if(e||n!==t){if(n||e!==t){if(e===t&&n===t)throw new Error("Both x and y cannot have aggregate");return $a(o)&&!$a(r)?"horizontal":"vertical"}return"horizontal"}return"vertical"}return"horizontal"}if(Yo(o))return"vertical";throw new Error(`Need a valid continuous axis for ${t}s`)}const Ja="boxplot",Ka=new ja(Ja,es);function Za(e){return t.isNumber(e)?"tukey":e}function es(e,n){let{config:i}=n;e={...e,encoding:Ra(e.encoding,i)};const{mark:r,encoding:o,params:a,projection:s,...l}=e,c=Zr(r)?r:{type:r};a&&$i(Jn("boxplot"));const u=c.extent??i.boxplot.extent,d=Cn("size",c,i),m=c.invalid,p=Za(u),{bins:g,timeUnits:h,transform:y,continuousAxisChannelDef:v,continuousAxis:b,groupby:x,aggregate:$,encodingWithoutContinuousAxis:w,ticksOrient:k,boxOrient:D,customTooltipWithoutAggregatedField:F}=function(e,n,i){const r=Qa(e,Ja),{continuousAxisChannelDef:o,continuousAxis:a}=Ya(e,r,Ja),s=o.field,l=Za(n),c=[...ts(s),{op:"median",field:s,as:`mid_box_${s}`},{op:"min",field:s,as:("min-max"===l?"lower_whisker_":"min_")+s},{op:"max",field:s,as:("min-max"===l?"upper_whisker_":"max_")+s}],u="min-max"===l||"tukey"===l?[]:[{calculate:`datum["upper_box_${s}"] - datum["lower_box_${s}"]`,as:`iqr_${s}`},{calculate:`min(datum["upper_box_${s}"] + datum["iqr_${s}"] * ${n}, datum["max_${s}"])`,as:`upper_whisker_${s}`},{calculate:`max(datum["lower_box_${s}"] - datum["iqr_${s}"] * ${n}, datum["min_${s}"])`,as:`lower_whisker_${s}`}],{[a]:f,...d}=e.encoding,{customTooltipWithoutAggregatedField:m,filteredEncoding:p}=function(e){const{tooltip:n,...i}=e;if(!n)return{filteredEncoding:i};let r,o;if(t.isArray(n)){for(const e of n)e.aggregate?(r||(r=[]),r.push(e)):(o||(o=[]),o.push(e));r&&(i.tooltip=r)}else n.aggregate?i.tooltip=n:o=n;return t.isArray(o)&&1===o.length&&(o=o[0]),{customTooltipWithoutAggregatedField:o,filteredEncoding:i}}(d),{bins:g,timeUnits:h,aggregate:y,groupby:v,encoding:b}=qa(p,i),x="vertical"===r?"horizontal":"vertical",$=r,w=[...g,...h,{aggregate:[...y,...c],groupby:v},...u];return{bins:g,timeUnits:h,transform:w,groupby:v,aggregate:y,continuousAxisChannelDef:o,continuousAxis:a,encodingWithoutContinuousAxis:b,ticksOrient:x,boxOrient:$,customTooltipWithoutAggregatedField:m}}(e,u,i),{color:z,size:O,..._}=w,N=e=>Va(c,b,v,e,i.boxplot),C=N(_),P=N(w),A=N({..._,...O?{size:O}:{}}),j=Ia([{fieldPrefix:"min-max"===p?"upper_whisker_":"max_",titlePrefix:"Max"},{fieldPrefix:"upper_box_",titlePrefix:"Q3"},{fieldPrefix:"mid_box_",titlePrefix:"Median"},{fieldPrefix:"lower_box_",titlePrefix:"Q1"},{fieldPrefix:"min-max"===p?"lower_whisker_":"min_",titlePrefix:"Min"}],v,w),T={type:"tick",color:"black",opacity:1,orient:k,invalid:m,aria:!1},E="min-max"===p?j:Ia([{fieldPrefix:"upper_whisker_",titlePrefix:"Upper Whisker"},{fieldPrefix:"lower_whisker_",titlePrefix:"Lower Whisker"}],v,w),M=[...C({partName:"rule",mark:{type:"rule",invalid:m,aria:!1},positionPrefix:"lower_whisker",endPositionPrefix:"lower_box",extraEncoding:E}),...C({partName:"rule",mark:{type:"rule",invalid:m,aria:!1},positionPrefix:"upper_box",endPositionPrefix:"upper_whisker",extraEncoding:E}),...C({partName:"ticks",mark:T,positionPrefix:"lower_whisker",extraEncoding:E}),...C({partName:"ticks",mark:T,positionPrefix:"upper_whisker",extraEncoding:E})],L=[..."tukey"!==p?M:[],...P({partName:"box",mark:{type:"bar",...d?{size:d}:{},orient:D,invalid:m,ariaRoleDescription:"box"},positionPrefix:"lower_box",endPositionPrefix:"upper_box",extraEncoding:j}),...A({partName:"median",mark:{type:"tick",invalid:m,...t.isObject(i.boxplot.median)&&i.boxplot.median.color?{color:i.boxplot.median.color}:{},...d?{size:d}:{},orient:k,aria:!1},positionPrefix:"mid_box",extraEncoding:j})];if("min-max"===p)return{...l,transform:(l.transform??[]).concat(y),layer:L};const q=`datum["lower_box_${v.field}"]`,U=`datum["upper_box_${v.field}"]`,R=`(${U} - ${q})`,W=`${q} - ${u} * ${R}`,B=`${U} + ${u} * ${R}`,I=`datum["${v.field}"]`,H={joinaggregate:ts(v.field),groupby:x},V={transform:[{filter:`(${W} <= ${I}) && (${I} <= ${B})`},{aggregate:[{op:"min",field:v.field,as:`lower_whisker_${v.field}`},{op:"max",field:v.field,as:`upper_whisker_${v.field}`},{op:"min",field:`lower_box_${v.field}`,as:`lower_box_${v.field}`},{op:"max",field:`upper_box_${v.field}`,as:`upper_box_${v.field}`},...$],groupby:x}],layer:M},{tooltip:G,...Y}=_,{scale:X,axis:Q}=v,J=Ha(v),K=f(Q,["title"]),Z=Ga(c,"outliers",i.boxplot,{transform:[{filter:`(${I} < ${W}) || (${I} > ${B})`}],mark:"point",encoding:{[b]:{field:v.field,type:v.type,...void 0!==J?{title:J}:{},...void 0!==X?{scale:X}:{},...S(K)?{}:{axis:K}},...Y,...z?{color:z}:{},...F?{tooltip:F}:{}}})[0];let ee;const te=[...g,...h,H];return Z?ee={transform:te,layer:[Z,V]}:(ee=V,ee.transform.unshift(...te)),{...l,layer:[ee,{transform:y,layer:L}]}}function ts(e){return[{op:"q1",field:e,as:`lower_box_${e}`},{op:"q3",field:e,as:`upper_box_${e}`}]}const ns="errorbar",is=new ja(ns,rs);function rs(e,t){let{config:n}=t;e={...e,encoding:Ra(e.encoding,n)};const{transform:i,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:a,ticksOrient:s,markDef:l,outerSpec:c,tooltipEncoding:u}=as(e,ns,n);delete a.size;const f=Va(l,o,r,a,n.errorbar),d=l.thickness,m=l.size,p={type:"tick",orient:s,aria:!1,...void 0!==d?{thickness:d}:{},...void 0!==m?{size:m}:{}},g=[...f({partName:"ticks",mark:p,positionPrefix:"lower",extraEncoding:u}),...f({partName:"ticks",mark:p,positionPrefix:"upper",extraEncoding:u}),...f({partName:"rule",mark:{type:"rule",ariaRoleDescription:"errorbar",...void 0!==d?{size:d}:{}},positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:u})];return{...c,transform:i,...g.length>1?{layer:g}:{...g[0]}}}function os(e,t){const{encoding:n}=e;if(function(e){return(Jo(e.x)||Jo(e.y))&&!Jo(e.x2)&&!Jo(e.y2)&&!Jo(e.xError)&&!Jo(e.xError2)&&!Jo(e.yError)&&!Jo(e.yError2)}(n))return{orient:Qa(e,t),inputType:"raw"};const i=function(e){return Jo(e.x2)||Jo(e.y2)}(n),r=function(e){return Jo(e.xError)||Jo(e.xError2)||Jo(e.yError)||Jo(e.yError2)}(n),o=n.x,a=n.y;if(i){if(r)throw new Error(`${t} cannot be both type aggregated-upper-lower and aggregated-error`);const e=n.x2,i=n.y2;if(Jo(e)&&Jo(i))throw new Error(`${t} cannot have both x2 and y2`);if(Jo(e)){if(Yo(o))return{orient:"horizontal",inputType:"aggregated-upper-lower"};throw new Error(`Both x and x2 have to be quantitative in ${t}`)}if(Jo(i)){if(Yo(a))return{orient:"vertical",inputType:"aggregated-upper-lower"};throw new Error(`Both y and y2 have to be quantitative in ${t}`)}throw new Error("No ranged axis")}{const e=n.xError,i=n.xError2,r=n.yError,s=n.yError2;if(Jo(i)&&!Jo(e))throw new Error(`${t} cannot have xError2 without xError`);if(Jo(s)&&!Jo(r))throw new Error(`${t} cannot have yError2 without yError`);if(Jo(e)&&Jo(r))throw new Error(`${t} cannot have both xError and yError with both are quantiative`);if(Jo(e)){if(Yo(o))return{orient:"horizontal",inputType:"aggregated-error"};throw new Error("All x, xError, and xError2 (if exist) have to be quantitative")}if(Jo(r)){if(Yo(a))return{orient:"vertical",inputType:"aggregated-error"};throw new Error("All y, yError, and yError2 (if exist) have to be quantitative")}throw new Error("No ranged axis")}}function as(e,t,n){const{mark:i,encoding:r,params:o,projection:a,...s}=e,l=Zr(i)?i:{type:i};o&&$i(Jn(t));const{orient:c,inputType:u}=os(e,t),{continuousAxisChannelDef:f,continuousAxisChannelDef2:d,continuousAxisChannelDefError:m,continuousAxisChannelDefError2:p,continuousAxis:g}=Ya(e,c,t),{errorBarSpecificAggregate:h,postAggregateCalculates:y,tooltipSummary:v,tooltipTitleWithFieldName:b}=function(e,t,n,i,r,o,a,s){let l=[],c=[];const u=t.field;let f,d=!1;if("raw"===o){const t=e.center?e.center:e.extent?"iqr"===e.extent?"median":"mean":s.errorbar.center,n=e.extent?e.extent:"mean"===t?"stderr":"iqr";if("median"===t!=("iqr"===n)&&$i(function(e,t,n){return`${e} is not usually used with ${t} for ${n}.`}(t,n,a)),"stderr"===n||"stdev"===n)l=[{op:n,field:u,as:`extent_${u}`},{op:t,field:u,as:`center_${u}`}],c=[{calculate:`datum["center_${u}"] + datum["extent_${u}"]`,as:`upper_${u}`},{calculate:`datum["center_${u}"] - datum["extent_${u}"]`,as:`lower_${u}`}],f=[{fieldPrefix:"center_",titlePrefix:P(t)},{fieldPrefix:"upper_",titlePrefix:ss(t,n,"+")},{fieldPrefix:"lower_",titlePrefix:ss(t,n,"-")}],d=!0;else{let e,t,i;"ci"===n?(e="mean",t="ci0",i="ci1"):(e="median",t="q1",i="q3"),l=[{op:t,field:u,as:`lower_${u}`},{op:i,field:u,as:`upper_${u}`},{op:e,field:u,as:`center_${u}`}],f=[{fieldPrefix:"upper_",titlePrefix:ua({field:u,aggregate:i,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"lower_",titlePrefix:ua({field:u,aggregate:t,type:"quantitative"},s,{allowDisabling:!1})},{fieldPrefix:"center_",titlePrefix:ua({field:u,aggregate:e,type:"quantitative"},s,{allowDisabling:!1})}]}}else{(e.center||e.extent)&&$i((m=e.center,`${(p=e.extent)?"extent ":""}${p&&m?"and ":""}${m?"center ":""}${p&&m?"are ":"is "}not needed when data are aggregated.`)),"aggregated-upper-lower"===o?(f=[],c=[{calculate:`datum["${n.field}"]`,as:`upper_${u}`},{calculate:`datum["${u}"]`,as:`lower_${u}`}]):"aggregated-error"===o&&(f=[{fieldPrefix:"",titlePrefix:u}],c=[{calculate:`datum["${u}"] + datum["${i.field}"]`,as:`upper_${u}`}],r?c.push({calculate:`datum["${u}"] + datum["${r.field}"]`,as:`lower_${u}`}):c.push({calculate:`datum["${u}"] - datum["${i.field}"]`,as:`lower_${u}`}));for(const e of c)f.push({fieldPrefix:e.as.substring(0,6),titlePrefix:M(M(e.calculate,'datum["',""),'"]',"")})}var m,p;return{postAggregateCalculates:c,errorBarSpecificAggregate:l,tooltipSummary:f,tooltipTitleWithFieldName:d}}(l,f,d,m,p,u,t,n),{[g]:x,["x"===g?"x2":"y2"]:$,["x"===g?"xError":"yError"]:w,["x"===g?"xError2":"yError2"]:k,...S}=r,{bins:D,timeUnits:F,aggregate:z,groupby:O,encoding:_}=qa(S,n),N=[...z,...h],C="raw"!==u?[]:O,A=Ia(v,f,_,b);return{transform:[...s.transform??[],...D,...F,...0===N.length?[]:[{aggregate:N,groupby:C}],...y],groupby:C,continuousAxisChannelDef:f,continuousAxis:g,encodingWithoutContinuousAxis:_,ticksOrient:"vertical"===c?"horizontal":"vertical",markDef:l,outerSpec:s,tooltipEncoding:A}}function ss(e,t,n){return`${P(e)} ${n} ${t}`}const ls="errorband",cs=new ja(ls,us);function us(e,t){let{config:n}=t;e={...e,encoding:Ra(e.encoding,n)};const{transform:i,continuousAxisChannelDef:r,continuousAxis:o,encodingWithoutContinuousAxis:a,markDef:s,outerSpec:l,tooltipEncoding:c}=as(e,ls,n),u=s,f=Va(u,o,r,a,n.errorband),d=void 0!==e.encoding.x&&void 0!==e.encoding.y;let m={type:d?"area":"rect"},p={type:d?"line":"rule"};const g={...u.interpolate?{interpolate:u.interpolate}:{},...u.tension&&u.interpolate?{tension:u.tension}:{}};return d?(m={...m,...g,ariaRoleDescription:"errorband"},p={...p,...g,aria:!1}):u.interpolate?$i(yi("interpolate")):u.tension&&$i(yi("tension")),{...l,transform:i,layer:[...f({partName:"band",mark:m,positionPrefix:"lower",endPositionPrefix:"upper",extraEncoding:c}),...f({partName:"borders",mark:p,positionPrefix:"lower",extraEncoding:c}),...f({partName:"borders",mark:p,positionPrefix:"upper",extraEncoding:c})]}}const fs={};function ds(e,t,n){const i=new ja(e,t);fs[e]={normalizer:i,parts:n}}ds(Ja,es,["box","median","outliers","rule","ticks"]),ds(ns,rs,["ticks","rule"]),ds(ls,us,["band","borders"]);const ms=["gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity"],ps={titleAlign:"align",titleAnchor:"anchor",titleAngle:"angle",titleBaseline:"baseline",titleColor:"color",titleFont:"font",titleFontSize:"fontSize",titleFontStyle:"fontStyle",titleFontWeight:"fontWeight",titleLimit:"limit",titleLineHeight:"lineHeight",titleOrient:"orient",titlePadding:"offset"},gs={labelAlign:"align",labelAnchor:"anchor",labelAngle:"angle",labelBaseline:"baseline",labelColor:"color",labelFont:"font",labelFontSize:"fontSize",labelFontStyle:"fontStyle",labelFontWeight:"fontWeight",labelLimit:"limit",labelLineHeight:"lineHeight",labelOrient:"orient",labelPadding:"offset"},hs=D(ps),ys=D(gs),vs=D({header:1,headerRow:1,headerColumn:1,headerFacet:1}),bs=["size","shape","fill","stroke","strokeDash","strokeWidth","opacity"],xs="_vgsid_",$s={point:{on:"click",fields:[xs],toggle:"event.shiftKey",resolve:"global",clear:"dblclick"},interval:{on:"[pointerdown, window:pointerup] > window:pointermove!",encodings:["x","y"],translate:"[pointerdown, window:pointerup] > window:pointermove!",zoom:"wheel!",mark:{fill:"#333",fillOpacity:.125,stroke:"white"},resolve:"global",clear:"dblclick"}};function ws(e){return"legend"===e||!!e?.legend}function ks(e){return ws(e)&&t.isObject(e)}function Ss(e){return!!e?.select}function Ds(e){const t=[];for(const n of e||[]){if(Ss(n))continue;const{expr:e,bind:i,...r}=n;if(i&&e){const n={...r,bind:i,init:e};t.push(n)}else{const n={...r,...e?{update:e}:{},...i?{bind:i}:{}};t.push(n)}}return t}function Fs(e){return"concat"in e}function zs(e){return"vconcat"in e}function Os(e){return"hconcat"in e}function _s(e){let{step:t,offsetIsDiscrete:n}=e;return n?t.for??"offset":"position"}function Ns(e){return t.isObject(e)&&void 0!==e.step}function Cs(e){return e.view||e.width||e.height}const Ps=D({align:1,bounds:1,center:1,columns:1,spacing:1});function As(e,t){return e[t]??e["width"===t?"continuousWidth":"continuousHeight"]}function js(e,t){const n=Ts(e,t);return Ns(n)?n.step:Es}function Ts(e,t){return U(e[t]??e["width"===t?"discreteWidth":"discreteHeight"],{step:e.step})}const Es=20,Ms={background:"white",padding:5,timeFormat:"%b %d, %Y",countTitle:"Count of Records",view:{continuousWidth:200,continuousHeight:200,step:Es},mark:{color:"#4c78a8",invalid:"filter",timeUnitBandSize:1},arc:{},area:{},bar:oo,circle:{},geoshape:{},image:{},line:{},point:{},rect:ao,rule:{color:"black"},square:{},text:{color:"black"},tick:{thickness:1},trail:{},boxplot:{size:14,extent:1.5,box:{},median:{color:"white"},outliers:{},rule:{},ticks:null},errorbar:{center:"mean",rule:!0,ticks:!1},errorband:{band:{opacity:.3},borders:!1},scale:{pointPadding:.5,barBandPaddingInner:.1,rectBandPaddingInner:0,bandWithNestedOffsetPaddingInner:.2,bandWithNestedOffsetPaddingOuter:.2,minBandSize:2,minFontSize:8,maxFontSize:40,minOpacity:.3,maxOpacity:.8,minSize:9,minStrokeWidth:1,maxStrokeWidth:4,quantileCount:4,quantizeCount:4,zero:!0},projection:{},legend:{gradientHorizontalMaxLength:200,gradientHorizontalMinLength:100,gradientVerticalMaxLength:200,gradientVerticalMinLength:64,unselectedOpacity:.35},header:{titlePadding:10,labelPadding:10},headerColumn:{},headerRow:{},headerFacet:{},selection:$s,style:{},title:{},facet:{spacing:20},concat:{spacing:20},normalizedNumberFormat:".0%"},Ls=["#4c78a8","#f58518","#e45756","#72b7b2","#54a24b","#eeca3b","#b279a2","#ff9da6","#9d755d","#bab0ac"],qs={text:11,guideLabel:10,guideTitle:11,groupTitle:13,groupSubtitle:12},Us={blue:Ls[0],orange:Ls[1],red:Ls[2],teal:Ls[3],green:Ls[4],yellow:Ls[5],purple:Ls[6],pink:Ls[7],brown:Ls[8],gray0:"#000",gray1:"#111",gray2:"#222",gray3:"#333",gray4:"#444",gray5:"#555",gray6:"#666",gray7:"#777",gray8:"#888",gray9:"#999",gray10:"#aaa",gray11:"#bbb",gray12:"#ccc",gray13:"#ddd",gray14:"#eee",gray15:"#fff"};function Rs(e){const t=D(e||{}),n={};for(const i of t){const t=e[i];n[i]=Fa(t)?kn(t):Sn(t)}return n}const Ws=[...no,...Pa,...vs,"background","padding","legend","lineBreak","scale","style","title","view"];function Bs(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{color:n,font:i,fontSize:r,selection:o,...a}=e,s=t.mergeConfig({},l(Ms),i?function(e){return{text:{font:e},style:{"guide-label":{font:e},"guide-title":{font:e},"group-title":{font:e},"group-subtitle":{font:e}}}}(i):{},n?function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return{signals:[{name:"color",value:t.isObject(e)?{...Us,...e}:Us}],mark:{color:{signal:"color.blue"}},rule:{color:{signal:"color.gray0"}},text:{color:{signal:"color.gray0"}},style:{"guide-label":{fill:{signal:"color.gray0"}},"guide-title":{fill:{signal:"color.gray0"}},"group-title":{fill:{signal:"color.gray0"}},"group-subtitle":{fill:{signal:"color.gray0"}},cell:{stroke:{signal:"color.gray8"}}},axis:{domainColor:{signal:"color.gray13"},gridColor:{signal:"color.gray8"},tickColor:{signal:"color.gray13"}},range:{category:[{signal:"color.blue"},{signal:"color.orange"},{signal:"color.red"},{signal:"color.teal"},{signal:"color.green"},{signal:"color.yellow"},{signal:"color.purple"},{signal:"color.pink"},{signal:"color.brown"},{signal:"color.grey8"}]}}}(n):{},r?function(e){return{signals:[{name:"fontSize",value:t.isObject(e)?{...qs,...e}:qs}],text:{fontSize:{signal:"fontSize.text"}},style:{"guide-label":{fontSize:{signal:"fontSize.guideLabel"}},"guide-title":{fontSize:{signal:"fontSize.guideTitle"}},"group-title":{fontSize:{signal:"fontSize.groupTitle"}},"group-subtitle":{fontSize:{signal:"fontSize.groupSubtitle"}}}}}(r):{},a||{});o&&t.writeConfig(s,"selection",o,!0);const c=f(s,Ws);for(const e of["background","lineBreak","padding"])s[e]&&(c[e]=Sn(s[e]));for(const e of no)s[e]&&(c[e]=pn(s[e]));for(const e of Pa)s[e]&&(c[e]=Rs(s[e]));for(const e of vs)s[e]&&(c[e]=pn(s[e]));return s.legend&&(c.legend=pn(s.legend)),s.scale&&(c.scale=pn(s.scale)),s.style&&(c.style=function(e){const t=D(e),n={};for(const i of t)n[i]=Rs(e[i]);return n}(s.style)),s.title&&(c.title=pn(s.title)),s.view&&(c.view=pn(s.view)),c}const Is=new Set(["view",...Kr]),Hs=["color","fontSize","background","padding","facet","concat","numberFormat","numberFormatType","normalizedNumberFormat","normalizedNumberFormatType","timeFormat","countTitle","header","axisQuantitative","axisTemporal","axisDiscrete","axisPoint","axisXBand","axisXPoint","axisXDiscrete","axisXQuantitative","axisXTemporal","axisYBand","axisYPoint","axisYDiscrete","axisYQuantitative","axisYTemporal","scale","selection","overlay"],Vs={view:["continuousWidth","continuousHeight","discreteWidth","discreteHeight","step"],area:["line","point"],bar:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],rect:["binSpacing","continuousBandSize","discreteBandSize","minBandSize"],line:["point"],tick:["bandSize","thickness"]};function Gs(e){e=l(e);for(const t of Hs)delete e[t];if(e.axis)for(const t in e.axis)Fa(e.axis[t])&&delete e.axis[t];if(e.legend)for(const t of ms)delete e.legend[t];if(e.mark){for(const t of to)delete e.mark[t];e.mark.tooltip&&t.isObject(e.mark.tooltip)&&delete e.mark.tooltip}e.params&&(e.signals=(e.signals||[]).concat(Ds(e.params)),delete e.params);for(const t of Is){for(const n of to)delete e[t][n];const n=Vs[t];if(n)for(const i of n)delete e[t][i];Ys(e,t)}for(const t of D(fs))delete e[t];!function(e){const{titleMarkConfig:t,subtitleMarkConfig:n,subtitle:i}=gn(e.title);S(t)||(e.style["group-title"]={...e.style["group-title"],...t});S(n)||(e.style["group-subtitle"]={...e.style["group-subtitle"],...n});S(i)?delete e.title:e.title=i}(e);for(const n in e)t.isObject(e[n])&&S(e[n])&&delete e[n];return S(e)?void 0:e}function Ys(e,t,n,i){"view"===t&&(n="cell");const r={...i?e[t][i]:e[t],...e.style[n??t]};S(r)||(e.style[n??t]=r),i||delete e[t]}function Xs(e){return"layer"in e}class Qs{map(e,t){return To(e)?this.mapFacet(e,t):function(e){return"repeat"in e}(e)?this.mapRepeat(e,t):Os(e)?this.mapHConcat(e,t):zs(e)?this.mapVConcat(e,t):Fs(e)?this.mapConcat(e,t):this.mapLayerOrUnit(e,t)}mapLayerOrUnit(e,t){if(Xs(e))return this.mapLayer(e,t);if(Aa(e))return this.mapUnit(e,t);throw new Error(Bn(e))}mapLayer(e,t){return{...e,layer:e.layer.map((e=>this.mapLayerOrUnit(e,t)))}}mapHConcat(e,t){return{...e,hconcat:e.hconcat.map((e=>this.map(e,t)))}}mapVConcat(e,t){return{...e,vconcat:e.vconcat.map((e=>this.map(e,t)))}}mapConcat(e,t){const{concat:n,...i}=e;return{...i,concat:n.map((e=>this.map(e,t)))}}mapFacet(e,t){return{...e,spec:this.map(e.spec,t)}}mapRepeat(e,t){return{...e,spec:this.map(e.spec,t)}}}const Js={zero:1,center:1,normalize:1};const Ks=new Set([Er,Lr,Mr,Br,Rr,Gr,Yr,Ur,Ir,Hr]),Zs=new Set([Lr,Mr,Er]);function el(e){return Ho(e)&&"quantitative"===Vo(e)&&!e.bin}function tl(e,t,n){let{orient:i,type:r}=n;const o="x"===t?"y":"radius",a="x"===t,s=e[t],l=e[o];if(Ho(s)&&Ho(l))if(el(s)&&el(l)){if(s.stack)return t;if(l.stack)return o;const e=Ho(s)&&!!s.aggregate;if(e!==(Ho(l)&&!!l.aggregate))return e?t:o;if(a&&["bar","area"].includes(r)){if("vertical"===i)return o;if("horizontal"===i)return t}}else{if(el(s))return t;if(el(l))return o}else{if(el(s))return t;if(el(l))return o}}function nl(e,n){const i=Zr(e)?e:{type:e},r=i.type;if(!Ks.has(r))return null;const o=tl(n,"x",i)||tl(n,"theta",i);if(!o)return null;const a=n[o],s=Ho(a)?oa(a,{}):void 0,l=function(e){switch(e){case"x":return"y";case"y":return"x";case"theta":return"radius";case"radius":return"theta"}}(o),c=[],u=new Set;if(n[l]){const e=n[l],t=Ho(e)?oa(e,{}):void 0;t&&t!==s&&(c.push(l),u.add(t))}const f="x"===l?"xOffset":"yOffset",d=n[f],m=Ho(d)?oa(d,{}):void 0;m&&m!==s&&(c.push(f),u.add(m));const p=St.reduce(((e,i)=>{if("tooltip"!==i&&Ta(n,i)){const r=n[i];for(const n of t.array(r)){const t=pa(n);if(t.aggregate)continue;const r=oa(t,{});r&&u.has(r)||e.push({channel:i,fieldDef:t})}}return e}),[]);let g;return void 0!==a.stack?g=t.isBoolean(a.stack)?a.stack?"zero":null:a.stack:Zs.has(r)&&(g="zero"),g&&g in Js?La(n)&&0===p.length?null:a?.scale?.type&&a?.scale?.type!==cr.LINEAR?(a?.stack&&$i(function(e){return`Cannot stack non-linear scale (${e}).`}(a.scale.type)),null):Jo(n[it(o)])?(void 0!==a.stack&&$i(`Cannot stack "${h=o}" if there is already "${h}2".`),null):(Ho(a)&&a.aggregate&&!on.has(a.aggregate)&&$i(`Stacking is applied even though the aggregate function is non-summative ("${a.aggregate}").`),{groupbyChannels:c,groupbyFields:u,fieldChannel:o,impute:null!==a.impute&&Qr(r),stackBy:p,offset:g}):null;var h}function il(e,t,n){const i=pn(e),r=Cn("orient",i,n);if(i.orient=function(e,t,n){switch(e){case Rr:case Gr:case Yr:case Ir:case Wr:case qr:return}const{x:i,y:r,x2:o,y2:a}=t;switch(e){case Lr:if(Ho(i)&&(cn(i.bin)||Ho(r)&&r.aggregate&&!i.aggregate))return"vertical";if(Ho(r)&&(cn(r.bin)||Ho(i)&&i.aggregate&&!r.aggregate))return"horizontal";if(a||o){if(n)return n;if(!o)return(Ho(i)&&i.type===rr&&!ln(i.bin)||Qo(i))&&Ho(r)&&cn(r.bin)?"horizontal":"vertical";if(!a)return(Ho(r)&&r.type===rr&&!ln(r.bin)||Qo(r))&&Ho(i)&&cn(i.bin)?"vertical":"horizontal"}case Br:if(o&&(!Ho(i)||!cn(i.bin))&&a&&(!Ho(r)||!cn(r.bin)))return;case Mr:if(a)return Ho(r)&&cn(r.bin)?"horizontal":"vertical";if(o)return Ho(i)&&cn(i.bin)?"vertical":"horizontal";if(e===Br){if(i&&!r)return"vertical";if(r&&!i)return"horizontal"}case Ur:case Hr:{const t=Xo(i),o=Xo(r);if(n)return n;if(t&&!o)return"tick"!==e?"horizontal":"vertical";if(!t&&o)return"tick"!==e?"vertical":"horizontal";if(t&&o)return"vertical";{const e=Ko(i)&&i.type===ar,t=Ko(r)&&r.type===ar;if(e&&!t)return"vertical";if(!e&&t)return"horizontal"}return}}return"vertical"}(i.type,t,r),void 0!==r&&r!==i.orient&&$i(`Specified orient "${i.orient}" overridden with "${r}".`),"bar"===i.type&&i.orient){const e=Cn("cornerRadiusEnd",i,n);if(void 0!==e){const n="horizontal"===i.orient&&t.x2||"vertical"===i.orient&&t.y2?["cornerRadius"]:ro[i.orient];for(const t of n)i[t]=e;void 0!==i.cornerRadiusEnd&&delete i.cornerRadiusEnd}}void 0===Cn("opacity",i,n)&&(i.opacity=function(e,t){if(p([Rr,Hr,Gr,Yr],e)&&!La(t))return.7;return}(i.type,t));return void 0===Cn("cursor",i,n)&&(i.cursor=function(e,t,n){if(t.href||e.href||Cn("href",e,n))return"pointer";return e.cursor}(i,t,n)),i}function rl(e){const{point:t,line:n,...i}=e;return D(i).length>1?i:i.type}function ol(e){for(const t of["line","area","rule","trail"])e[t]&&(e={...e,[t]:f(e[t],["point","line"])});return e}function al(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;return"transparent"===e.point?{opacity:0}:e.point?t.isObject(e.point)?e.point:{}:void 0!==e.point?null:n.point||i.shape?t.isObject(n.point)?n.point:{}:void 0}function sl(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return e.line?!0===e.line?{}:e.line:void 0!==e.line?null:t.line?!0===t.line?{}:t.line:void 0}class ll{constructor(){qn(this,"name","path-overlay")}hasMatchingType(e,t){if(Aa(e)){const{mark:n,encoding:i}=e,r=Zr(n)?n:{type:n};switch(r.type){case"line":case"rule":case"trail":return!!al(r,t[r.type],i);case"area":return!!al(r,t[r.type],i)||!!sl(r,t[r.type])}}return!1}run(e,t,n){const{config:i}=t,{params:r,projection:o,mark:a,name:s,encoding:l,...c}=e,d=Ra(l,i),m=Zr(a)?a:{type:a},p=al(m,i[m.type],d),g="area"===m.type&&sl(m,i[m.type]),h=[{name:s,...r?{params:r}:{},mark:rl({..."area"===m.type&&void 0===m.opacity&&void 0===m.fillOpacity?{opacity:.7}:{},...m}),encoding:f(d,["shape"])}],y=nl(il(m,d,i),d);let v=d;if(y){const{fieldChannel:e,offset:t}=y;v={...d,[e]:{...d[e],...t?{stack:t}:{}}}}return v=f(v,["y2","x2"]),g&&h.push({...o?{projection:o}:{},mark:{type:"line",...u(m,["clip","interpolate","tension","tooltip"]),...g},encoding:v}),p&&h.push({...o?{projection:o}:{},mark:{type:"point",opacity:1,filled:!0,...u(m,["clip","tooltip"]),...p},encoding:v}),n({...c,layer:h},{...t,config:ol(i)})}}function cl(e,t){return t?Ao(e)?gl(e,t):dl(e,t):e}function ul(e,t){return t?gl(e,t):e}function fl(e,n,i){const r=n[e];return(o=r)&&!t.isString(o)&&"repeat"in o?r.repeat in i?{...n,[e]:i[r.repeat]}:void $i(function(e){return`Unknown repeated value "${e}".`}(r.repeat)):n;var o}function dl(e,t){if(void 0!==(e=fl("field",e,t))){if(null===e)return null;if(Mo(e)&&Co(e.sort)){const n=fl("field",e.sort,t);e={...e,...n?{sort:n}:{}}}return e}}function ml(e,t){if(Ho(e))return dl(e,t);{const n=fl("datum",e,t);return n===e||n.type||(n.type="nominal"),n}}function pl(e,t){if(!Jo(e)){if(Io(e)){const n=ml(e.condition,t);if(n)return{...e,condition:n};{const{condition:t,...n}=e;return n}}return e}{const n=ml(e,t);if(n)return n;if(Wo(e))return{condition:e.condition}}}function gl(e,n){const i={};for(const r in e)if(t.hasOwnProperty(e,r)){const o=e[r];if(t.isArray(o))i[r]=o.map((e=>pl(e,n))).filter((e=>e));else{const e=pl(o,n);void 0!==e&&(i[r]=e)}}return i}class hl{constructor(){qn(this,"name","RuleForRangedLine")}hasMatchingType(e){if(Aa(e)){const{encoding:t,mark:n}=e;if("line"===n||Zr(n)&&"line"===n.type)for(const e of Ze){const n=t[tt(e)];if(t[e]&&(Ho(n)&&!cn(n.bin)||Go(n)))return!0}}return!1}run(e,n,i){const{encoding:r,mark:o}=e;var a,s;return $i((a=!!r.x2,s=!!r.y2,`Line mark is for continuous lines and thus cannot be used with ${a&&s?"x2 and y2":a?"x2":"y2"}. We will use the rule mark (line segments) instead.`)),i({...e,mark:t.isObject(o)?{...o,type:"rule"}:"rule"},n)}}function yl(e){let{parentEncoding:n,encoding:i={},layer:r}=e,o={};if(n){const e=new Set([...D(n),...D(i)]);for(const a of e){const e=i[a],s=n[a];if(Jo(e)){const t={...s,...e};o[a]=t}else Io(e)?o[a]={...e,condition:{...s,...e.condition}}:e||null===e?o[a]=e:(r||Zo(s)||yn(s)||Jo(s)||t.isArray(s))&&(o[a]=s)}}else o=i;return!o||S(o)?void 0:o}function vl(e){const{parentProjection:t,projection:n}=e;return t&&n&&$i(function(e){const{parentProjection:t,projection:n}=e;return`Layer's shared projection ${X(t)} is overridden by a child projection ${X(n)}.`}({parentProjection:t,projection:n})),n??t}function bl(e){return"filter"in e}function xl(e){return"lookup"in e}function $l(e){return"pivot"in e}function wl(e){return"density"in e}function kl(e){return"quantile"in e}function Sl(e){return"regression"in e}function Dl(e){return"loess"in e}function Fl(e){return"sample"in e}function zl(e){return"window"in e}function Ol(e){return"joinaggregate"in e}function _l(e){return"flatten"in e}function Nl(e){return"calculate"in e}function Cl(e){return"bin"in e}function Pl(e){return"impute"in e}function Al(e){return"timeUnit"in e}function jl(e){return"aggregate"in e}function Tl(e){return"stack"in e}function El(e){return"fold"in e}function Ml(e){return"extent"in e&&!("density"in e)}function Ll(e,t){const{transform:n,...i}=e;if(n){return{...i,transform:n.map((e=>{if(bl(e))return{filter:Rl(e,t)};if(Cl(e)&&un(e.bin))return{...e,bin:Ul(e.bin)};if(xl(e)){const{selection:t,...n}=e.from;return t?{...e,from:{param:t,...n}}:e}return e}))}}return e}function ql(e,n){const i=l(e);if(Ho(i)&&un(i.bin)&&(i.bin=Ul(i.bin)),ea(i)&&i.scale?.domain?.selection){const{selection:e,...t}=i.scale.domain;i.scale.domain={...t,...e?{param:e}:{}}}if(Wo(i))if(t.isArray(i.condition))i.condition=i.condition.map((e=>{const{selection:t,param:i,test:r,...o}=e;return i?e:{...o,test:Rl(e,n)}}));else{const{selection:e,param:t,test:r,...o}=ql(i.condition,n);i.condition=t?i.condition:{...o,test:Rl(i.condition,n)}}return i}function Ul(e){const t=e.extent;if(t?.selection){const{selection:n,...i}=t;return{...e,extent:{...i,param:n}}}return e}function Rl(e,t){const n=e=>s(e,(e=>{const n={param:e,empty:t.emptySelections[e]??!0};return t.selectionPredicates[e]??=[],t.selectionPredicates[e].push(n),n}));return e.selection?n(e.selection):s(e.test||e.filter,(e=>e.selection?n(e.selection):e))}class Wl extends Qs{map(e,t){const n=t.selections??[];if(e.params&&!Aa(e)){const t=[];for(const i of e.params)Ss(i)?n.push(i):t.push(i);e.params=t}return t.selections=n,super.map(e,t)}mapUnit(e,n){const i=n.selections;if(!i||!i.length)return e;const r=(n.path??[]).concat(e.name),o=[];for(const n of i)if(n.views&&n.views.length)for(const i of n.views)(t.isString(i)&&(i===e.name||r.includes(i))||t.isArray(i)&&i.map((e=>r.indexOf(e))).every(((e,t,n)=>-1!==e&&(0===t||e>n[t-1]))))&&o.push(n);else o.push(n);return o.length&&(e.params=o),e}}for(const e of["mapFacet","mapRepeat","mapHConcat","mapVConcat","mapLayer"]){const t=Wl.prototype[e];Wl.prototype[e]=function(e,n){return t.call(this,e,Bl(e,n))}}function Bl(e,t){return e.name?{...t,path:(t.path??[]).concat(e.name)}:t}function Il(e,t){void 0===t&&(t=Bs(e.config));const n=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n={config:t};return Gl.map(Hl.map(Vl.map(e,n),n),n)}(e,t),{width:i,height:r}=e,o=function(e,t,n){let{width:i,height:r}=t;const o=Aa(e)||Xs(e),a={};o?"container"==i&&"container"==r?(a.type="fit",a.contains="padding"):"container"==i?(a.type="fit-x",a.contains="padding"):"container"==r&&(a.type="fit-y",a.contains="padding"):("container"==i&&($i(Hn("width")),i=void 0),"container"==r&&($i(Hn("height")),r=void 0));const s={type:"pad",...a,...n?Yl(n.autosize):{},...Yl(e.autosize)};"fit"!==s.type||o||($i(In),s.type="pad");"container"==i&&"fit"!=s.type&&"fit-x"!=s.type&&$i(Vn("width"));"container"==r&&"fit"!=s.type&&"fit-y"!=s.type&&$i(Vn("height"));if(Y(s,{type:"pad"}))return;return s}(n,{width:i,height:r,autosize:e.autosize},t);return{...n,...o?{autosize:o}:{}}}const Hl=new class extends Qs{constructor(){super(...arguments),qn(this,"nonFacetUnitNormalizers",[Ka,is,cs,new ll,new hl])}map(e,t){if(Aa(e)){const n=Ta(e.encoding,Q),i=Ta(e.encoding,J),r=Ta(e.encoding,K);if(n||i||r)return this.mapFacetedUnit(e,t)}return super.map(e,t)}mapUnit(e,t){const{parentEncoding:n,parentProjection:i}=t,r=ul(e.encoding,t.repeater),o={...e,...e.name?{name:[t.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{},...r?{encoding:r}:{}};if(n||i)return this.mapUnitWithParentEncodingOrProjection(o,t);const a=this.mapLayerOrUnit.bind(this);for(const e of this.nonFacetUnitNormalizers)if(e.hasMatchingType(o,t.config))return e.run(o,t,a);return o}mapRepeat(e,n){return function(e){return!t.isArray(e.repeat)&&e.repeat.layer}(e)?this.mapLayerRepeat(e,n):this.mapNonLayerRepeat(e,n)}mapLayerRepeat(e,t){const{repeat:n,spec:i,...r}=e,{row:o,column:a,layer:s}=n,{repeater:l={},repeaterPrefix:c=""}=t;return o||a?this.mapRepeat({...e,repeat:{...o?{row:o}:{},...a?{column:a}:{}},spec:{repeat:{layer:s},spec:i}},t):{...r,layer:s.map((e=>{const n={...l,layer:e},r=`${(i.name?`${i.name}_`:"")+c}child__layer_${_(e)}`,o=this.mapLayerOrUnit(i,{...t,repeater:n,repeaterPrefix:r});return o.name=r,o}))}}mapNonLayerRepeat(e,n){const{repeat:i,spec:r,data:o,...a}=e;!t.isArray(i)&&e.columns&&(e=f(e,["columns"]),$i(Zn("repeat")));const s=[],{repeater:l={},repeaterPrefix:c=""}=n,u=!t.isArray(i)&&i.row||[l?l.row:null],d=!t.isArray(i)&&i.column||[l?l.column:null],m=t.isArray(i)&&i||[l?l.repeat:null];for(const e of m)for(const o of u)for(const a of d){const u={repeat:e,row:o,column:a,layer:l.layer},d=(r.name?`${r.name}_`:"")+c+"child__"+(t.isArray(i)?`${_(e)}`:(i.row?`row_${_(o)}`:"")+(i.column?`column_${_(a)}`:"")),m=this.map(r,{...n,repeater:u,repeaterPrefix:d});m.name=d,s.push(f(m,["data"]))}const p=t.isArray(i)?e.columns:i.column?i.column.length:1;return{data:r.data??o,align:"all",...a,columns:p,concat:s}}mapFacet(e,t){const{facet:n}=e;return Ao(n)&&e.columns&&(e=f(e,["columns"]),$i(Zn("facet"))),super.mapFacet(e,t)}mapUnitWithParentEncodingOrProjection(e,t){const{encoding:n,projection:i}=e,{parentEncoding:r,parentProjection:o,config:a}=t,s=vl({parentProjection:o,projection:i}),l=yl({parentEncoding:r,encoding:ul(n,t.repeater)});return this.mapUnit({...e,...s?{projection:s}:{},...l?{encoding:l}:{}},{config:a})}mapFacetedUnit(e,t){const{row:n,column:i,facet:r,...o}=e.encoding,{mark:a,width:s,projection:l,height:c,view:u,params:f,encoding:d,...m}=e,{facetMapping:p,layout:g}=this.getFacetMappingAndLayout({row:n,column:i,facet:r},t),h=ul(o,t.repeater);return this.mapFacet({...m,...g,facet:p,spec:{...s?{width:s}:{},...c?{height:c}:{},...u?{view:u}:{},...l?{projection:l}:{},mark:a,encoding:h,...f?{params:f}:{}}},t)}getFacetMappingAndLayout(e,t){const{row:n,column:i,facet:r}=e;if(n||i){r&&$i(`Facet encoding dropped as ${(o=[...n?[Q]:[],...i?[J]:[]]).join(" and ")} ${o.length>1?"are":"is"} also specified.`);const t={},a={};for(const n of[Q,J]){const i=e[n];if(i){const{align:e,center:r,spacing:o,columns:s,...l}=i;t[n]=l;for(const e of["align","center","spacing"])void 0!==i[e]&&(a[e]??={},a[e][n]=i[e])}}return{facetMapping:t,layout:a}}{const{align:e,center:n,spacing:i,columns:o,...a}=r;return{facetMapping:cl(a,t.repeater),layout:{...e?{align:e}:{},...n?{center:n}:{},...i?{spacing:i}:{},...o?{columns:o}:{}}}}var o}mapLayer(e,t){let{parentEncoding:n,parentProjection:i,...r}=t;const{encoding:o,projection:a,...s}=e,l={...r,parentEncoding:yl({parentEncoding:n,encoding:o,layer:!0}),parentProjection:vl({parentProjection:i,projection:a})};return super.mapLayer({...s,...e.name?{name:[l.repeaterPrefix,e.name].filter((e=>e)).join("_")}:{}},l)}},Vl=new class extends Qs{map(e,t){return t.emptySelections??={},t.selectionPredicates??={},e=Ll(e,t),super.map(e,t)}mapLayerOrUnit(e,t){if((e=Ll(e,t)).encoding){const n={};for(const[i,r]of z(e.encoding))n[i]=ql(r,t);e={...e,encoding:n}}return super.mapLayerOrUnit(e,t)}mapUnit(e,t){const{selection:n,...i}=e;return n?{...i,params:z(n).map((e=>{let[n,i]=e;const{init:r,bind:o,empty:a,...s}=i;"single"===s.type?(s.type="point",s.toggle=!1):"multi"===s.type&&(s.type="point"),t.emptySelections[n]="none"!==a;for(const e of F(t.selectionPredicates[n]??{}))e.empty="none"!==a;return{name:n,value:r,select:s,bind:o}}))}:e}},Gl=new Wl;function Yl(e){return t.isString(e)?{type:e}:e??{}}const Xl=["background","padding"];function Ql(e,t){const n={};for(const t of Xl)e&&void 0!==e[t]&&(n[t]=Sn(e[t]));return t&&(n.params=e.params),n}class Jl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.explicit=e,this.implicit=t}clone(){return new Jl(l(this.explicit),l(this.implicit))}combine(){return{...this.explicit,...this.implicit}}get(e){return U(this.explicit[e],this.implicit[e])}getWithExplicit(e){return void 0!==this.explicit[e]?{explicit:!0,value:this.explicit[e]}:void 0!==this.implicit[e]?{explicit:!1,value:this.implicit[e]}:{explicit:!1,value:void 0}}setWithExplicit(e,t){let{value:n,explicit:i}=t;void 0!==n&&this.set(e,n,i)}set(e,t,n){return delete this[n?"implicit":"explicit"][e],this[n?"explicit":"implicit"][e]=t,this}copyKeyFromSplit(e,t){let{explicit:n,implicit:i}=t;void 0!==n[e]?this.set(e,n[e],!0):void 0!==i[e]&&this.set(e,i[e],!1)}copyKeyFromObject(e,t){void 0!==t[e]&&this.set(e,t[e],!0)}copyAll(e){for(const t of D(e.combine())){const n=e.getWithExplicit(t);this.setWithExplicit(t,n)}}}function Kl(e){return{explicit:!0,value:e}}function Zl(e){return{explicit:!1,value:e}}function ec(e){return(t,n,i,r)=>{const o=e(t.value,n.value);return o>0?t:o<0?n:tc(t,n,i,r)}}function tc(e,t,n,i){return e.explicit&&t.explicit&&$i(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${X(n)} and ${X(i)}). Using ${X(n)}.`}(n,i,e.value,t.value)),e}function nc(e,t,n,i){let r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:tc;return void 0===e||void 0===e.value?t:e.explicit&&!t.explicit?e:t.explicit&&!e.explicit?t:Y(e.value,t.value)?e:r(e,t,n,i)}class ic extends Jl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(e,t),this.explicit=e,this.implicit=t,this.parseNothing=n}clone(){const e=super.clone();return e.parseNothing=this.parseNothing,e}}function rc(e){return"url"in e}function oc(e){return"values"in e}function ac(e){return"name"in e&&!rc(e)&&!oc(e)&&!sc(e)}function sc(e){return e&&(lc(e)||cc(e)||uc(e))}function lc(e){return"sequence"in e}function cc(e){return"sphere"in e}function uc(e){return"graticule"in e}let fc=function(e){return e[e.Raw=0]="Raw",e[e.Main=1]="Main",e[e.Row=2]="Row",e[e.Column=3]="Column",e[e.Lookup=4]="Lookup",e}({});function dc(e){const{signals:t,hasLegend:n,index:i,...r}=e;return r.field=E(r.field),r}function mc(e){let n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t.identity;if(t.isArray(e)){const t=e.map((e=>mc(e,n,i)));return n?`[${t.join(", ")}]`:t}return wi(e)?i(n?Oi(e):function(e){const t=zi(e,!0);return e.utc?+new Date(Date.UTC(...t)):+new Date(...t)}(e)):n?i(X(e)):e}function pc(e,n){for(const i of F(e.component.selection??{})){const r=i.name;let o=`${r}${Au}, ${"global"===i.resolve?"true":`{unit: ${Mu(e)}}`}`;for(const t of Eu)t.defined(i)&&(t.signals&&(n=t.signals(e,i,n)),t.modifyExpr&&(o=t.modifyExpr(e,i,o)));n.push({name:r+ju,on:[{events:{signal:i.name+Au},update:`modify(${t.stringValue(i.name+Pu)}, ${o})`}]})}return yc(n)}function gc(e,n){if(e.component.selection&&D(e.component.selection).length){const i=t.stringValue(e.getName("cell"));n.unshift({name:"facet",value:{},on:[{events:t.parseSelector("pointermove","scope"),update:`isTuple(facet) ? facet : group(${i}).datum`}]})}return yc(n)}function hc(e,t){for(const n of F(e.component.selection??{}))for(const i of Eu)i.defined(n)&&i.marks&&(t=i.marks(e,n,t));return t}function yc(e){return e.map((e=>(e.on&&!e.on.length&&delete e.on,e)))}class vc{constructor(e,t){this.debugName=t,qn(this,"_children",[]),qn(this,"_parent",null),qn(this,"_hash",void 0),e&&(this.parent=e)}clone(){throw new Error("Cannot clone node")}get parent(){return this._parent}set parent(e){this._parent=e,e&&e.addChild(this)}get children(){return this._children}numChildren(){return this._children.length}addChild(e,t){this._children.includes(e)?$i("Attempt to add the same child twice."):void 0!==t?this._children.splice(t,0,e):this._children.push(e)}removeChild(e){const t=this._children.indexOf(e);return this._children.splice(t,1),t}remove(){let e=this._parent.removeChild(this);for(const t of this._children)t._parent=this._parent,this._parent.addChild(t,e++)}insertAsParentOf(e){const t=e.parent;t.removeChild(this),this.parent=t,e.parent=this}swapWithParent(){const e=this._parent,t=e.parent;for(const t of this._children)t.parent=e;this._children=[],e.removeChild(this);const n=e.parent.removeChild(e);this._parent=t,t.addChild(this,n),e.parent=this}}class bc extends vc{clone(){const e=new this.constructor;return e.debugName=`clone_${this.debugName}`,e._source=this._source,e._name=`clone_${this._name}`,e.type=this.type,e.refCounts=this.refCounts,e.refCounts[e._name]=0,e}constructor(e,t,n,i){super(e,t),this.type=n,this.refCounts=i,qn(this,"_source",void 0),qn(this,"_name",void 0),this._source=this._name=t,this.refCounts&&!(this._name in this.refCounts)&&(this.refCounts[this._name]=0)}dependentFields(){return new Set}producedFields(){return new Set}hash(){return void 0===this._hash&&(this._hash=`Output ${W()}`),this._hash}getSource(){return this.refCounts[this._name]++,this._source}isRequired(){return!!this.refCounts[this._name]}setSource(e){this._source=e}}function xc(e){return void 0!==e.as}function $c(e){return`${e}_end`}class wc extends vc{clone(){return new wc(null,l(this.timeUnits))}constructor(e,t){super(e),this.timeUnits=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{const{field:r,timeUnit:o}=n;if(o){let a;if(Ci(o)){if(xm(t)){const{mark:e,markDef:i,config:s}=t,l=Lo({fieldDef:n,markDef:i,config:s});(Jr(e)||l)&&(a={timeUnit:Ui(o),field:r})}}else a={as:oa(n,{forAs:!0}),field:r,timeUnit:o};if(xm(t)){const{mark:e,markDef:r,config:o}=t,s=Lo({fieldDef:n,markDef:r,config:o});Jr(e)&&zt(i)&&.5!==s&&(a.rectBandPosition=s)}a&&(e[d(a)]=a)}return e}),{});return S(n)?null:new wc(e,n)}static makeFromTransform(e,t){const{timeUnit:n,...i}={...t},r={...i,timeUnit:Ui(n)};return new wc(e,{[d(r)]:r})}merge(e){this.timeUnits={...this.timeUnits};for(const t in e.timeUnits)this.timeUnits[t]||(this.timeUnits[t]=e.timeUnits[t]);for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}removeFormulas(e){const t={};for(const[n,i]of z(this.timeUnits)){const r=xc(i)?i.as:`${i.field}_end`;e.has(r)||(t[n]=i)}this.timeUnits=t}producedFields(){return new Set(F(this.timeUnits).map((e=>xc(e)?e.as:$c(e.field))))}dependentFields(){return new Set(F(this.timeUnits).map((e=>e.field)))}hash(){return`TimeUnit ${d(this.timeUnits)}`}assemble(){const e=[];for(const t of F(this.timeUnits)){const{rectBandPosition:n}=t,i=Ui(t.timeUnit);if(xc(t)){const{field:r,as:o}=t,{unit:a,utc:s,...l}=i,c=[o,`${o}_end`];e.push({field:E(r),type:"timeunit",...a?{units:Ti(a)}:{},...s?{timezone:"utc"}:{},...l,as:c}),e.push(...Fc(c,n,i))}else if(t){const{field:r}=t,o=r.replaceAll("\\.","."),a=Dc({timeUnit:i,field:o}),s=$c(o);e.push({type:"formula",expr:a,as:s}),e.push(...Fc([o,s],n,i))}}return e}}const kc="offsetted_rect_start",Sc="offsetted_rect_end";function Dc(e){let{timeUnit:t,field:n,reverse:i}=e;const{unit:r,utc:o}=t,a=Ei(r),{part:s,step:l}=Bi(a,t.step);return`${o?"utcOffset":"timeOffset"}('${s}', datum['${n}'], ${i?-l:l})`}function Fc(e,t,n){let[i,r]=e;if(void 0!==t&&.5!==t){const e=`datum['${i}']`,o=`datum['${r}']`;return[{type:"formula",expr:zc([Dc({timeUnit:n,field:i,reverse:!0}),e],t+.5),as:`${i}_${kc}`},{type:"formula",expr:zc([e,o],t+.5),as:`${i}_${Sc}`}]}return[]}function zc(e,t){let[n,i]=e;return`${1-t} * ${n} + ${t} * ${i}`}const Oc="_tuple_fields";class _c{constructor(){qn(this,"hasChannel",void 0),qn(this,"hasField",void 0),qn(this,"hasSelectionId",void 0),qn(this,"timeUnit",void 0),qn(this,"items",void 0);for(var e=arguments.length,t=new Array(e),n=0;n!0,parse:(e,n,i)=>{const r=n.name,o=n.project??=new _c,a={},s={},l=new Set,c=(e,t)=>{const n="visual"===t?e.channel:e.field;let i=_(`${r}_${n}`);for(let e=1;l.has(i);e++)i=_(`${r}_${n}_${e}`);return l.add(i),{[t]:i}},u=n.type,f=e.config.selection[u],m=void 0!==i.value?t.array(i.value):null;let{fields:p,encodings:g}=t.isObject(i.select)?i.select:{};if(!p&&!g&&m)for(const e of m)if(t.isObject(e))for(const t of D(e))Je[t]?(g||(g=[])).push(t):"interval"===u?($i('Interval selections should be initialized using "x", "y", "longitude", or "latitude" keys.'),g=f.encodings):(p??=[]).push(t);p||g||(g=f.encodings,"fields"in f&&(p=f.fields));for(const t of g??[]){const n=e.fieldDef(t);if(n){let i=n.field;if(n.aggregate){$i(Qn(t,n.aggregate));continue}if(!i){$i(Xn(t));continue}if(n.timeUnit&&!Ci(n.timeUnit)){i=e.vgField(t);const r={timeUnit:n.timeUnit,as:i,field:n.field};s[d(r)]=r}if(!a[i]){const r={field:i,channel:t,type:"interval"===u&&Ht(t)&&$r(e.getScaleComponent(t).get("type"))?"R":n.bin?"R-RE":"E",index:o.items.length};r.signals={...c(r,"data"),...c(r,"visual")},o.items.push(a[i]=r),o.hasField[i]=a[i],o.hasSelectionId=o.hasSelectionId||i===xs,Ee(t)?(r.geoChannel=t,r.channel=Te(t),o.hasChannel[r.channel]=a[i]):o.hasChannel[t]=a[i]}}else $i(Xn(t))}for(const e of p??[]){if(o.hasField[e])continue;const t={type:"E",field:e,index:o.items.length};t.signals={...c(t,"data")},o.items.push(t),o.hasField[e]=t,o.hasSelectionId=o.hasSelectionId||e===xs}m&&(n.init=m.map((e=>o.items.map((n=>t.isObject(e)?void 0!==e[n.geoChannel||n.channel]?e[n.geoChannel||n.channel]:e[n.field]:e))))),S(s)||(o.timeUnit=new wc(null,s))},signals:(e,t,n)=>{const i=t.name+Oc;return n.filter((e=>e.name===i)).length>0||t.project.hasSelectionId?n:n.concat({name:i,value:t.project.items.map(dc)})}},Cc={defined:e=>"interval"===e.type&&"global"===e.resolve&&e.bind&&"scales"===e.bind,parse:(e,t)=>{const n=t.scales=[];for(const i of t.project.items){const r=i.channel;if(!Ht(r))continue;const o=e.getScaleComponent(r),a=o?o.get("type"):void 0;o&&$r(a)?(o.set("selectionExtent",{param:t.name,field:i.field},!0),n.push(i)):$i("Scale bindings are currently only supported for scales with unbinned, continuous domains.")}},topLevelSignals:(e,n,i)=>{const r=n.scales.filter((e=>0===i.filter((t=>t.name===e.signals.data)).length));if(!e.parent||Ac(e)||0===r.length)return i;const o=i.filter((e=>e.name===n.name))[0];let a=o.update;if(a.indexOf(Tu)>=0)o.update=`{${r.map((e=>`${t.stringValue(E(e.field))}: ${e.signals.data}`)).join(", ")}}`;else{for(const e of r){const n=`${t.stringValue(E(e.field))}: ${e.signals.data}`;a.includes(n)||(a=`${a.substring(0,a.length-1)}, ${n}}`)}o.update=a}return i.concat(r.map((e=>({name:e.signals.data}))))},signals:(e,t,n)=>{if(e.parent&&!Ac(e))for(const e of t.scales){const t=n.filter((t=>t.name===e.signals.data))[0];t.push="outer",delete t.value,delete t.update}return n}};function Pc(e,n){return`domain(${t.stringValue(e.scaleName(n))})`}function Ac(e){return e.parent&&km(e.parent)&&(!e.parent.parent??Ac(e.parent.parent))}const jc="_brush",Tc="_scale_trigger",Ec="geo_interval_init_tick",Mc="_init",Lc={defined:e=>"interval"===e.type,parse:(e,n,i)=>{if(e.hasProjection){const e={...t.isObject(i.select)?i.select:{}};e.fields=[xs],e.encodings||(e.encodings=i.value?D(i.value):[ue,ce]),i.select={type:"interval",...e}}if(n.translate&&!Cc.defined(n)){const e=`!event.item || event.item.mark.name !== ${t.stringValue(n.name+jc)}`;for(const i of n.events){if(!i.between){$i(`${i} is not an ordered event stream for interval selections.`);continue}const n=t.array(i.between[0].filter??=[]);n.indexOf(e)<0&&n.push(e)}}},signals:(e,n,i)=>{const r=n.name,o=r+Au,a=F(n.project.hasChannel).filter((e=>e.channel===Z||e.channel===ee)),s=n.init?n.init[0]:null;if(i.push(...a.reduce(((i,r)=>i.concat(function(e,n,i,r){const o=!e.hasProjection,a=i.channel,s=i.signals.visual,l=t.stringValue(o?e.scaleName(a):e.projectionName()),c=e=>`scale(${l}, ${e})`,u=e.getSizeSignalRef(a===Z?"width":"height").signal,f=`${a}(unit)`,d=n.events.reduce(((e,t)=>[...e,{events:t.between[0],update:`[${f}, ${f}]`},{events:t,update:`[${s}[0], clamp(${f}, 0, ${u})]`}]),[]);if(o){const t=i.signals.data,o=Cc.defined(n),u=e.getScaleComponent(a),f=u?u.get("type"):void 0,m=r?{init:mc(r,!0,c)}:{value:[]};return d.push({events:{signal:n.name+Tc},update:$r(f)?`[${c(`${t}[0]`)}, ${c(`${t}[1]`)}]`:"[0, 0]"}),o?[{name:t,on:[]}]:[{name:s,...m,on:d},{name:t,...r?{init:mc(r)}:{},on:[{events:{signal:s},update:`${s}[0] === ${s}[1] ? null : invert(${l}, ${s})`}]}]}{const e=a===Z?0:1,t=n.name+Mc;return[{name:s,...r?{init:`[${t}[0][${e}], ${t}[1][${e}]]`}:{value:[]},on:d}]}}(e,n,r,s&&s[r.index]))),[])),e.hasProjection){const l=t.stringValue(e.projectionName()),c=e.projectionName()+"_center",{x:u,y:f}=n.project.hasChannel,d=u&&u.signals.visual,m=f&&f.signals.visual,p=u?s&&s[u.index]:`${c}[0]`,g=f?s&&s[f.index]:`${c}[1]`,h=t=>e.getSizeSignalRef(t).signal,y=`[[${d?d+"[0]":"0"}, ${m?m+"[0]":"0"}],[${d?d+"[1]":h("width")}, ${m?m+"[1]":h("height")}]]`;if(s&&(i.unshift({name:r+Mc,init:`[scale(${l}, [${u?p[0]:p}, ${f?g[0]:g}]), scale(${l}, [${u?p[1]:p}, ${f?g[1]:g}])]`}),!u||!f)){i.find((e=>e.name===c))||i.unshift({name:c,update:`invert(${l}, [${h("width")}/2, ${h("height")}/2])`})}const v=`vlSelectionTuples(${`intersect(${y}, {markname: ${t.stringValue(e.getName("marks"))}}, unit.mark)`}, ${`{unit: ${Mu(e)}}`})`,b=a.map((e=>e.signals.visual));return i.concat({name:o,on:[{events:[...b.length?[{signal:b.join(" || ")}]:[],...s?[{signal:Ec}]:[]],update:v}]})}{if(!Cc.defined(n)){const n=r+Tc,o=a.map((n=>{const i=n.channel,{data:r,visual:o}=n.signals,a=t.stringValue(e.scaleName(i)),s=$r(e.getScaleComponent(i).get("type"))?"+":"";return`(!isArray(${r}) || (${s}invert(${a}, ${o})[0] === ${s}${r}[0] && ${s}invert(${a}, ${o})[1] === ${s}${r}[1]))`}));o.length&&i.push({name:n,value:{},on:[{events:a.map((t=>({scale:e.scaleName(t.channel)}))),update:o.join(" && ")+` ? ${n} : {}`}]})}const l=a.map((e=>e.signals.data)),c=`unit: ${Mu(e)}, fields: ${r+Oc}, values`;return i.concat({name:o,...s?{init:`{${c}: ${mc(s)}}`}:{},...l.length?{on:[{events:[{signal:l.join(" || ")}],update:`${l.join(" && ")} ? {${c}: [${l}]} : null`}]}:{}})}},topLevelSignals:(e,t,n)=>{if(xm(e)&&e.hasProjection&&t.init){n.filter((e=>e.name===Ec)).length||n.unshift({name:Ec,value:null,on:[{events:"timer{1}",update:`${Ec} === null ? {} : ${Ec}`}]})}return n},marks:(e,n,i)=>{const r=n.name,{x:o,y:a}=n.project.hasChannel,s=o?.signals.visual,l=a?.signals.visual,c=`data(${t.stringValue(n.name+Pu)})`;if(Cc.defined(n)||!o&&!a)return i;const u={x:void 0!==o?{signal:`${s}[0]`}:{value:0},y:void 0!==a?{signal:`${l}[0]`}:{value:0},x2:void 0!==o?{signal:`${s}[1]`}:{field:{group:"width"}},y2:void 0!==a?{signal:`${l}[1]`}:{field:{group:"height"}}};if("global"===n.resolve)for(const t of D(u))u[t]=[{test:`${c}.length && ${c}[0].unit === ${Mu(e)}`,...u[t]},{value:0}];const{fill:f,fillOpacity:d,cursor:m,...p}=n.mark,g=D(p).reduce(((e,t)=>(e[t]=[{test:[void 0!==o&&`${s}[0] !== ${s}[1]`,void 0!==a&&`${l}[0] !== ${l}[1]`].filter((e=>e)).join(" && "),value:p[t]},{value:null}],e)),{});return[{name:`${r+jc}_bg`,type:"rect",clip:!0,encode:{enter:{fill:{value:f},fillOpacity:{value:d}},update:u}},...i,{name:r+jc,type:"rect",clip:!0,encode:{enter:{...m?{cursor:{value:m}}:{},fill:{value:"transparent"}},update:{...u,...g}}}]}};const qc={defined:e=>"point"===e.type,signals:(e,n,i)=>{const r=n.name,o=r+Oc,a=n.project,s="(item().isVoronoi ? datum.datum : datum)",l=F(e.component.selection??{}).reduce(((e,t)=>"interval"===t.type?e.concat(t.name+jc):e),[]).map((e=>`indexof(item().mark.name, '${e}') < 0`)).join(" && "),c="datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0"+(l?` && ${l}`:"");let u=`unit: ${Mu(e)}, `;if(n.project.hasSelectionId)u+=`${xs}: ${s}[${t.stringValue(xs)}]`;else{u+=`fields: ${o}, values: [${a.items.map((n=>{const i=e.fieldDef(n.channel);return i?.bin?`[${s}[${t.stringValue(e.vgField(n.channel,{}))}], ${s}[${t.stringValue(e.vgField(n.channel,{binSuffix:"end"}))}]]`:`${s}[${t.stringValue(n.field)}]`})).join(", ")}]`}const f=n.events;return i.concat([{name:r+Au,on:f?[{events:f,update:`${c} ? {${u}} : null`,force:!0}]:[]}])}};function Uc(e,n,i,r){const o=Wo(n)&&n.condition,a=r(n);if(o){return{[i]:[...t.array(o).map((t=>{const n=r(t);if(function(e){return e.param}(t)){const{param:i,empty:r}=t;return{test:Iu(e,{param:i,empty:r}),...n}}return{test:Vu(e,t.test),...n}})),...void 0!==a?[a]:[]]}}return void 0!==a?{[i]:a}:{}}function Rc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";const n=e.encoding[t];return Uc(e,n,t,(t=>Wc(t,e.config)))}function Wc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"datum";if(e){if(Zo(e))return Fn(e.value);if(Jo(e)){const{format:i,formatType:r}=ma(e);return vo({fieldOrDatumDef:e,format:i,formatType:r,expr:n,config:t})}}}function Bc(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{encoding:i,markDef:r,config:o,stack:a}=e,s=i.tooltip;if(t.isArray(s))return{tooltip:Hc({tooltip:s},a,o,n)};{const l=n.reactiveGeom?"datum.datum":"datum";return Uc(e,s,"tooltip",(e=>{const s=Wc(e,o,l);if(s)return s;if(null===e)return;let c=Cn("tooltip",r,o);return!0===c&&(c={content:"encoding"}),t.isString(c)?{value:c}:t.isObject(c)?yn(c)?c:"encoding"===c.content?Hc(i,a,o,n):{signal:l}:void 0}))}}function Ic(e,n,i){let{reactiveGeom:r}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const o={...i,...i.tooltipFormat},a={},s=r?"datum.datum":"datum",l=[];function c(i,r){const c=tt(r),u=Ko(i)?i:{...i,type:e[c].type},f=u.title||da(u,o),d=t.array(f).join(", ").replaceAll(/"/g,'\\"');let m;if(zt(r)){const t="x"===r?"x2":"y2",n=pa(e[t]);if(cn(u.bin)&&n){const e=oa(u,{expr:s}),i=oa(n,{expr:s}),{format:r,formatType:l}=ma(u);m=Fo(e,i,r,l,o),a[t]=!0}}if((zt(r)||r===se||r===oe)&&n&&n.fieldChannel===r&&"normalize"===n.offset){const{format:e,formatType:t}=ma(u);m=vo({fieldOrDatumDef:u,format:e,formatType:t,expr:s,config:o,normalizeStack:!0}).signal}m??=Wc(u,o,s).signal,l.push({channel:r,key:d,value:m})}Wa(e,((e,t)=>{Ho(e)?c(e,t):Bo(e)&&c(e.condition,t)}));const u={};for(const{channel:e,key:t,value:n}of l)a[e]||u[t]||(u[t]=n);return u}function Hc(e,t,n){let{reactiveGeom:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=Ic(e,t,n,{reactiveGeom:i}),o=z(r).map((e=>{let[t,n]=e;return`"${t}": ${n}`}));return o.length>0?{signal:`{${o.join(", ")}}`}:void 0}function Vc(e){const{markDef:t,config:n}=e,i=Cn("aria",t,n);return!1===i?{}:{...i?{aria:i}:{},...Gc(e),...Yc(e)}}function Gc(e){const{mark:t,markDef:n,config:i}=e;if(!1===i.aria)return{};const r=Cn("ariaRoleDescription",n,i);return null!=r?{ariaRoleDescription:{value:r}}:t in $n?{}:{ariaRoleDescription:{value:t}}}function Yc(e){const{encoding:t,markDef:n,config:i,stack:r}=e,o=t.description;if(o)return Uc(e,o,"description",(t=>Wc(t,e.config)));const a=Cn("description",n,i);if(null!=a)return{description:Fn(a)};if(!1===i.aria)return{};const s=Ic(t,r,i);return S(s)?void 0:{description:{signal:z(s).map(((e,t)=>{let[n,i]=e;return`"${t>0?"; ":""}${n}: " + (${i})`})).join(" + ")}}}function Xc(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{markDef:i,encoding:r,config:o}=t,{vgChannel:a}=n;let{defaultRef:s,defaultValue:l}=n;void 0===s&&(l??=Cn(e,i,o,{vgChannel:a,ignoreVgConfig:!0}),void 0!==l&&(s=Fn(l)));const c=r[e];return Uc(t,c,a??e,(n=>mo({channel:e,channelDef:n,markDef:i,config:o,scaleName:t.scaleName(e),scale:t.getScaleComponent(e),stack:null,defaultRef:s})))}function Qc(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{filled:void 0};const{markDef:n,encoding:i,config:r}=e,{type:o}=n,a=t.filled??Cn("filled",n,r),s=p(["bar","point","circle","square","geoshape"],o)?"transparent":void 0,l=Cn(!0===a?"color":void 0,n,r,{vgChannel:"fill"})??r.mark[!0===a&&"color"]??s,c=Cn(!1===a?"color":void 0,n,r,{vgChannel:"stroke"})??r.mark[!1===a&&"color"],u=a?"fill":"stroke",f={...l?{fill:Fn(l)}:{},...c?{stroke:Fn(c)}:{}};return n.color&&(a?n.fill:n.stroke)&&$i(ri("property",{fill:"fill"in n,stroke:"stroke"in n})),{...f,...Xc("color",e,{vgChannel:u,defaultValue:a?l:c}),...Xc("fill",e,{defaultValue:i.fill?l:void 0}),...Xc("stroke",e,{defaultValue:i.stroke?c:void 0})}}function Jc(e){const{encoding:t,mark:n}=e,i=t.order;return!Qr(n)&&Zo(i)?Uc(e,i,"zindex",(e=>Fn(e.value))):{}}function Kc(e){let{channel:t,markDef:n,encoding:i={},model:r,bandPosition:o}=e;const a=`${t}Offset`,s=n[a],l=i[a];if(("xOffset"===a||"yOffset"===a)&&l){return{offsetType:"encoding",offset:mo({channel:a,channelDef:l,markDef:n,config:r?.config,scaleName:r.scaleName(a),scale:r.getScaleComponent(a),stack:null,defaultRef:Fn(s),bandPosition:o})}}const c=n[a];return c?{offsetType:"visual",offset:c}:{}}function Zc(e,t,n){let{defaultPos:i,vgChannel:r}=n;const{encoding:o,markDef:a,config:s,stack:l}=t,c=o[e],u=o[it(e)],f=t.scaleName(e),d=t.getScaleComponent(e),{offset:m,offsetType:p}=Kc({channel:e,markDef:a,encoding:o,model:t,bandPosition:.5}),g=eu({model:t,defaultPos:i,channel:e,scaleName:f,scale:d}),h=!c&&zt(e)&&(o.latitude||o.longitude)?{field:t.getName(e)}:function(e){const{channel:t,channelDef:n,scaleName:i,stack:r,offset:o,markDef:a}=e;if(Jo(n)&&r&&t===r.fieldChannel){if(Ho(n)){let e=n.bandPosition;if(void 0!==e||"text"!==a.type||"radius"!==t&&"theta"!==t||(e=.5),void 0!==e)return fo({scaleName:i,fieldOrDatumDef:n,startSuffix:"start",bandPosition:e,offset:o})}return uo(n,i,{suffix:"end"},{offset:o})}return so(e)}({channel:e,channelDef:c,channel2Def:u,markDef:a,config:s,scaleName:f,scale:d,stack:l,offset:m,defaultRef:g,bandPosition:"encoding"===p?0:void 0});return h?{[r||e]:h}:void 0}function eu(e){let{model:t,defaultPos:n,channel:i,scaleName:r,scale:o}=e;const{markDef:a,config:s}=t;return()=>{const e=tt(i),l=nt(i),c=Cn(i,a,s,{vgChannel:l});if(void 0!==c)return po(i,c);switch(n){case"zeroOrMin":case"zeroOrMax":if(r){const e=o.get("type");if(p([cr.LOG,cr.TIME,cr.UTC],e));else if(o.domainDefinitelyIncludesZero())return{scale:r,value:0}}if("zeroOrMin"===n)return"y"===e?{field:{group:"height"}}:{value:0};switch(e){case"radius":return{signal:`min(${t.width.signal},${t.height.signal})/2`};case"theta":return{signal:"2*PI"};case"x":return{field:{group:"width"}};case"y":return{value:0}}break;case"mid":return{...t[rt(i)],mult:.5}}}}const tu={left:"x",center:"xc",right:"x2"},nu={top:"y",middle:"yc",bottom:"y2"};function iu(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"middle";if("radius"===e||"theta"===e)return nt(e);const r="x"===e?"align":"baseline",o=Cn(r,t,n);let a;return yn(o)?($i(function(e){return`The ${e} for range marks cannot be an expression`}(r)),a=void 0):a=o,"x"===e?tu[a||("top"===i?"left":"center")]:nu[a||i]}function ru(e,t,n){let{defaultPos:i,defaultPos2:r,range:o}=n;return o?ou(e,t,{defaultPos:i,defaultPos2:r}):Zc(e,t,{defaultPos:i})}function ou(e,t,n){let{defaultPos:i,defaultPos2:r}=n;const{markDef:o,config:a}=t,s=it(e),l=rt(e),c=function(e,t,n){const{encoding:i,mark:r,markDef:o,stack:a,config:s}=e,l=tt(n),c=rt(n),u=nt(n),f=i[l],d=e.scaleName(l),m=e.getScaleComponent(l),{offset:p}=Kc(n in i||n in o?{channel:n,markDef:o,encoding:i,model:e}:{channel:l,markDef:o,encoding:i,model:e});if(!f&&("x2"===n||"y2"===n)&&(i.latitude||i.longitude)){const t=rt(n),i=e.markDef[t];return null!=i?{[t]:{value:i}}:{[u]:{field:e.getName(n)}}}const g=function(e){let{channel:t,channelDef:n,channel2Def:i,markDef:r,config:o,scaleName:a,scale:s,stack:l,offset:c,defaultRef:u}=e;if(Jo(n)&&l&&t.charAt(0)===l.fieldChannel.charAt(0))return uo(n,a,{suffix:"start"},{offset:c});return so({channel:t,channelDef:i,scaleName:a,scale:s,stack:l,markDef:r,config:o,offset:c,defaultRef:u})}({channel:n,channelDef:f,channel2Def:i[n],markDef:o,config:s,scaleName:d,scale:m,stack:a,offset:p,defaultRef:void 0});if(void 0!==g)return{[u]:g};return au(n,o)||au(n,{[n]:An(n,o,s.style),[c]:An(c,o,s.style)})||au(n,s[r])||au(n,s.mark)||{[u]:eu({model:e,defaultPos:t,channel:n,scaleName:d,scale:m})()}}(t,r,s);return{...Zc(e,t,{defaultPos:i,vgChannel:c[l]?iu(e,o,a):nt(e)}),...c}}function au(e,t){const n=rt(e),i=nt(e);if(void 0!==t[i])return{[i]:po(e,t[i])};if(void 0!==t[e])return{[i]:po(e,t[e])};if(t[n]){const i=t[n];if(!io(i))return{[n]:po(e,i)};$i(function(e){return`Position range does not support relative band size for ${e}.`}(n))}}function su(e,n){const{config:i,encoding:r,markDef:o}=e,a=o.type,s=it(n),l=rt(n),c=r[n],u=r[s],f=e.getScaleComponent(n),d=f?f.get("type"):void 0,m=o.orient,p=r[l]??r.size??Cn("size",o,i,{vgChannel:l}),g=ot(n),h="bar"===a&&("x"===n?"vertical"===m:"horizontal"===m);return!Ho(c)||!(ln(c.bin)||cn(c.bin)||c.timeUnit&&!u)||p&&!io(p)||r[g]||xr(d)?(Jo(c)&&xr(d)||h)&&!u?function(e,n,i){const{markDef:r,encoding:o,config:a,stack:s}=i,l=r.orient,c=i.scaleName(n),u=i.getScaleComponent(n),f=rt(n),d=it(n),m=ot(n),p=i.scaleName(m),g=i.getScaleComponent(at(n)),h="horizontal"===l&&"y"===n||"vertical"===l&&"x"===n;let y;(o.size||r.size)&&(h?y=Xc("size",i,{vgChannel:f,defaultRef:Fn(r.size)}):$i(function(e){return`Cannot apply size to non-oriented mark "${e}".`}(r.type)));const v=!!y,b=qo({channel:n,fieldDef:e,markDef:r,config:a,scaleType:(u||g)?.get("type"),useVlSizeChannel:h});y=y||{[f]:lu(f,p||c,g||u,a,b,!!e,r.type)};const x="band"===(u||g)?.get("type")&&io(b)&&!v?"top":"middle",$=iu(n,r,a,x),w="xc"===$||"yc"===$,{offset:k,offsetType:S}=Kc({channel:n,markDef:r,encoding:o,model:i,bandPosition:w?.5:0}),D=so({channel:n,channelDef:e,markDef:r,config:a,scaleName:c,scale:u,stack:s,offset:k,defaultRef:eu({model:i,defaultPos:"mid",channel:n,scaleName:c,scale:u}),bandPosition:w?"encoding"===S?0:.5:yn(b)?{signal:`(1-${b})/2`}:io(b)?(1-b.band)/2:0});if(f)return{[$]:D,...y};{const e=nt(d),n=y[f],i=k?{...n,offset:k}:n;return{[$]:D,[e]:t.isArray(D)?[D[0],{...D[1],offset:i}]:{...D,offset:i}}}}(c,n,e):ou(n,e,{defaultPos:"zeroOrMax",defaultPos2:"zeroOrMin"}):function(e){let{fieldDef:t,fieldDef2:n,channel:i,model:r}=e;const{config:o,markDef:a,encoding:s}=r,l=r.getScaleComponent(i),c=r.scaleName(i),u=l?l.get("type"):void 0,f=l.get("reverse"),d=qo({channel:i,fieldDef:t,markDef:a,config:o,scaleType:u}),m=r.component.axes[i]?.[0],p=m?.get("translate")??.5,g=zt(i)?Cn("binSpacing",a,o)??0:0,h=it(i),y=nt(i),v=nt(h),b=Pn("minBandSize",a,o),{offset:x}=Kc({channel:i,markDef:a,encoding:s,model:r,bandPosition:0}),{offset:$}=Kc({channel:h,markDef:a,encoding:s,model:r,bandPosition:0}),w=function(e){let{scaleName:t,fieldDef:n}=e;const i=oa(n,{expr:"datum"});return`abs(scale("${t}", ${oa(n,{expr:"datum",suffix:"end"})}) - scale("${t}", ${i}))`}({fieldDef:t,scaleName:c}),k=cu(i,g,f,p,x,b,w),S=cu(h,g,f,p,$??x,b,w),D=yn(d)?{signal:`(1-${d.signal})/2`}:io(d)?(1-d.band)/2:.5,F=Lo({fieldDef:t,fieldDef2:n,markDef:a,config:o});if(ln(t.bin)||t.timeUnit){const e=t.timeUnit&&.5!==F;return{[v]:uu({fieldDef:t,scaleName:c,bandPosition:D,offset:S,useRectOffsetField:e}),[y]:uu({fieldDef:t,scaleName:c,bandPosition:yn(D)?{signal:`1-${D.signal}`}:1-D,offset:k,useRectOffsetField:e})}}if(cn(t.bin)){const e=uo(t,c,{},{offset:S});if(Ho(n))return{[v]:e,[y]:uo(n,c,{},{offset:k})};if(un(t.bin)&&t.bin.step)return{[v]:e,[y]:{signal:`scale("${c}", ${oa(t,{expr:"datum"})} + ${t.bin.step})`,offset:k}}}return void $i(vi(h))}({fieldDef:c,fieldDef2:u,channel:n,model:e})}function lu(e,n,i,r,o,a,s){if(io(o)){if(!i)return{mult:o.band,field:{group:e}};{const e=i.get("type");if("band"===e){let e=`bandwidth('${n}')`;1!==o.band&&(e=`${o.band} * ${e}`);const t=Pn("minBandSize",{type:s},r);return{signal:t?`max(${On(t)}, ${e})`:e}}1!==o.band&&($i(function(e){return`Cannot use the relative band size with ${e} scale.`}(e)),o=void 0)}}else{if(yn(o))return o;if(o)return{value:o}}if(i){const e=i.get("range");if(vn(e)&&t.isNumber(e.step))return{value:e.step-2}}if(!a){const{bandPaddingInner:n,barBandPaddingInner:i,rectBandPaddingInner:o}=r.scale,a=U(n,"bar"===s?i:o);if(yn(a))return{signal:`(1 - (${a.signal})) * ${e}`};if(t.isNumber(a))return{signal:`${1-a} * ${e}`}}return{value:js(r.view,e)-2}}function cu(e,t,n,i,r,o,a){if(Ae(e))return 0;const s="x"===e||"y2"===e,l=s?-t/2:t/2;if(yn(n)||yn(r)||yn(i)||o){const e=On(n),t=On(r),c=On(i),u=On(o),f=o?`(${a} < ${u} ? ${s?"":"-"}0.5 * (${u} - (${a})) : ${l})`:l;return{signal:(c?`${c} + `:"")+(e?`(${e} ? -1 : 1) * `:"")+(t?`(${t} + ${f})`:f)}}return r=r||0,i+(n?-r-l:+r+l)}function uu(e){let{fieldDef:t,scaleName:n,bandPosition:i,offset:r,useRectOffsetField:o}=e;return fo({scaleName:n,fieldOrDatumDef:t,bandPosition:i,offset:r,...o?{startSuffix:kc,endSuffix:Sc}:{}})}const fu=new Set(["aria","width","height"]);function du(e,t){const{fill:n,stroke:i}="include"===t.color?Qc(e):{};return{...pu(e.markDef,t),...mu(e,"fill",n),...mu(e,"stroke",i),...Xc("opacity",e),...Xc("fillOpacity",e),...Xc("strokeOpacity",e),...Xc("strokeWidth",e),...Xc("strokeDash",e),...Jc(e),...Bc(e),...Rc(e,"href"),...Vc(e)}}function mu(e,n,i){const{config:r,mark:o,markDef:a}=e;if("hide"===Cn("invalid",a,r)&&i&&!Qr(o)){const r=function(e,t){let{invalid:n=!1,channels:i}=t;const r=i.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum"});o&&$r(r)&&(t[o]=!0)}return t}),{}),o=D(r);if(o.length>0){const e=n?"||":"&&";return o.map((e=>co(e,n))).join(` ${e} `)}return}(e,{invalid:!0,channels:It});if(r)return{[n]:[{test:r,value:null},...t.array(i)]}}return i?{[n]:i}:{}}function pu(e,t){return xn.reduce(((n,i)=>(fu.has(i)||void 0===e[i]||"ignore"===t[i]||(n[i]=Fn(e[i])),n)),{})}function gu(e){const{config:t,markDef:n}=e;if(Cn("invalid",n,t)){const t=function(e,t){let{invalid:n=!1,channels:i}=t;const r=i.reduce(((t,n)=>{const i=e.getScaleComponent(n);if(i){const r=i.get("type"),o=e.vgField(n,{expr:"datum",binSuffix:e.stack?.impute?"mid":void 0});o&&$r(r)&&(t[o]=!0)}return t}),{}),o=D(r);if(o.length>0){const e=n?"||":"&&";return o.map((e=>co(e,n))).join(` ${e} `)}return}(e,{channels:Ft});if(t)return{defined:{signal:t}}}return{}}function hu(e,t){if(void 0!==t)return{[e]:Fn(t)}}const yu="voronoi",vu={defined:e=>"point"===e.type&&e.nearest,parse:(e,t)=>{if(t.events)for(const n of t.events)n.markname=e.getName(yu)},marks:(e,t,n)=>{const{x:i,y:r}=t.project.hasChannel,o=e.mark;if(Qr(o))return $i(`The "nearest" transform is not supported for ${o} marks.`),n;const a={name:e.getName(yu),type:"path",interactive:!0,from:{data:e.getName("marks")},encode:{update:{fill:{value:"transparent"},strokeWidth:{value:.35},stroke:{value:"transparent"},isVoronoi:{value:!0},...Bc(e,{reactiveGeom:!0})}},transform:[{type:"voronoi",x:{expr:i||!r?"datum.datum.x || 0":"0"},y:{expr:r||!i?"datum.datum.y || 0":"0"},size:[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]}]};let s=0,l=!1;return n.forEach(((t,n)=>{const i=t.name??"";i===e.component.mark[0].name?s=n:i.indexOf(yu)>=0&&(l=!0)})),l||n.splice(s+1,0,a),n}},bu={defined:e=>"point"===e.type&&"global"===e.resolve&&e.bind&&"scales"!==e.bind&&!ws(e.bind),parse:(e,t,n)=>qu(t,n),topLevelSignals:(e,n,i)=>{const r=n.name,o=n.project,a=n.bind,s=n.init&&n.init[0],l=vu.defined(n)?"(item().isVoronoi ? datum.datum : datum)":"datum";return o.items.forEach(((e,o)=>{const c=_(`${r}_${e.field}`);i.filter((e=>e.name===c)).length||i.unshift({name:c,...s?{init:mc(s[o])}:{value:null},on:n.events?[{events:n.events,update:`datum && item().mark.marktype !== 'group' ? ${l}[${t.stringValue(e.field)}] : null`}]:[],bind:a[e.field]??a[e.channel]??a})})),i},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.filter((e=>e.name===i+Au))[0],a=i+Oc,s=r.items.map((e=>_(`${i}_${e.field}`))),l=s.map((e=>`${e} !== null`)).join(" && ");return s.length&&(o.update=`${l} ? {fields: ${a}, values: [${s.join(", ")}]} : null`),delete o.value,delete o.on,n}},xu="_toggle",$u={defined:e=>"point"===e.type&&!!e.toggle,signals:(e,t,n)=>n.concat({name:t.name+xu,value:!1,on:[{events:t.events,update:t.toggle}]}),modifyExpr:(e,t)=>{const n=t.name+Au,i=t.name+xu;return`${i} ? null : ${n}, `+("global"===t.resolve?`${i} ? null : true, `:`${i} ? null : {unit: ${Mu(e)}}, `)+`${i} ? ${n} : null`}},wu={defined:e=>void 0!==e.clear&&!1!==e.clear,parse:(e,n)=>{n.clear&&(n.clear=t.isString(n.clear)?t.parseSelector(n.clear,"view"):n.clear)},topLevelSignals:(e,t,n)=>{if(bu.defined(t))for(const e of t.project.items){const i=n.findIndex((n=>n.name===_(`${t.name}_${e.field}`)));-1!==i&&n[i].on.push({events:t.clear,update:"null"})}return n},signals:(e,t,n)=>{function i(e,i){-1!==e&&n[e].on&&n[e].on.push({events:t.clear,update:i})}if("interval"===t.type)for(const e of t.project.items){const t=n.findIndex((t=>t.name===e.signals.visual));if(i(t,"[0, 0]"),-1===t){i(n.findIndex((t=>t.name===e.signals.data)),"null")}}else{let e=n.findIndex((e=>e.name===t.name+Au));i(e,"null"),$u.defined(t)&&(e=n.findIndex((e=>e.name===t.name+xu)),i(e,"false"))}return n}},ku={defined:e=>{const t="global"===e.resolve&&e.bind&&ws(e.bind),n=1===e.project.items.length&&e.project.items[0].field!==xs;return t&&!n&&$i("Legend bindings are only supported for selections over an individual field or encoding channel."),t&&n},parse:(e,n,i)=>{const r=l(i);if(r.select=t.isString(r.select)?{type:r.select,toggle:n.toggle}:{...r.select,toggle:n.toggle},qu(n,r),t.isObject(i.select)&&(i.select.on||i.select.clear)){const e='event.item && indexof(event.item.mark.role, "legend") < 0';for(const i of n.events)i.filter=t.array(i.filter??[]),i.filter.includes(e)||i.filter.push(e)}const o=ks(n.bind)?n.bind.legend:"click",a=t.isString(o)?t.parseSelector(o,"view"):t.array(o);n.bind={legend:{merge:a}}},topLevelSignals:(e,t,n)=>{const i=t.name,r=ks(t.bind)&&t.bind.legend,o=e=>t=>{const n=l(t);return n.markname=e,n};for(const e of t.project.items){if(!e.hasLegend)continue;const a=`${_(e.field)}_legend`,s=`${i}_${a}`;if(0===n.filter((e=>e.name===s)).length){const e=r.merge.map(o(`${a}_symbols`)).concat(r.merge.map(o(`${a}_labels`))).concat(r.merge.map(o(`${a}_entries`)));n.unshift({name:s,...t.init?{}:{value:null},on:[{events:e,update:"isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value",force:!0},{events:r.merge,update:`!event.item || !datum ? null : ${s}`,force:!0}]})}}return n},signals:(e,t,n)=>{const i=t.name,r=t.project,o=n.find((e=>e.name===i+Au)),a=i+Oc,s=r.items.filter((e=>e.hasLegend)).map((e=>_(`${i}_${_(e.field)}_legend`))),l=`${s.map((e=>`${e} !== null`)).join(" && ")} ? {fields: ${a}, values: [${s.join(", ")}]} : null`;t.events&&s.length>0?o.on.push({events:s.map((e=>({signal:e}))),update:l}):s.length>0&&(o.update=l,delete o.value,delete o.on);const c=n.find((e=>e.name===i+xu)),u=ks(t.bind)&&t.bind.legend;return c&&(t.events?c.on.push({...c.on[0],events:u}):c.on[0].events=u),n}};const Su="_translate_anchor",Du="_translate_delta",Fu={defined:e=>"interval"===e.type&&e.translate,signals:(e,n,i)=>{const r=n.name,o=Cc.defined(n),a=r+Su,{x:s,y:l}=n.project.hasChannel;let c=t.parseSelector(n.translate,"scope");return o||(c=c.map((e=>(e.between[0].markname=r+jc,e)))),i.push({name:a,value:{},on:[{events:c.map((e=>e.between[0])),update:"{x: x(unit), y: y(unit)"+(void 0!==s?`, extent_x: ${o?Pc(e,Z):`slice(${s.signals.visual})`}`:"")+(void 0!==l?`, extent_y: ${o?Pc(e,ee):`slice(${l.signals.visual})`}`:"")+"}"}]},{name:r+Du,value:{},on:[{events:c,update:`{x: ${a}.x - x(unit), y: ${a}.y - y(unit)}`}]}),void 0!==s&&zu(e,n,s,"width",i),void 0!==l&&zu(e,n,l,"height",i),i}};function zu(e,t,n,i,r){const o=t.name,a=o+Su,s=o+Du,l=n.channel,c=Cc.defined(t),u=r.filter((e=>e.name===n.signals[c?"data":"visual"]))[0],f=e.getSizeSignalRef(i).signal,d=e.getScaleComponent(l),m=d&&d.get("type"),p=d&&d.get("reverse"),g=`${a}.extent_${l}`,h=`${c&&d?"log"===m?"panLog":"symlog"===m?"panSymlog":"pow"===m?"panPow":"panLinear":"panLinear"}(${g}, ${`${c?l===Z?p?"":"-":p?"-":"":""}${s}.${l} / ${c?`${f}`:`span(${g})`}`}${c?"pow"===m?`, ${d.get("exponent")??1}`:"symlog"===m?`, ${d.get("constant")??1}`:"":""})`;u.on.push({events:{signal:s},update:c?h:`clampRange(${h}, 0, ${f})`})}const Ou="_zoom_anchor",_u="_zoom_delta",Nu={defined:e=>"interval"===e.type&&e.zoom,signals:(e,n,i)=>{const r=n.name,o=Cc.defined(n),a=r+_u,{x:s,y:l}=n.project.hasChannel,c=t.stringValue(e.scaleName(Z)),u=t.stringValue(e.scaleName(ee));let f=t.parseSelector(n.zoom,"scope");return o||(f=f.map((e=>(e.markname=r+jc,e)))),i.push({name:r+Ou,on:[{events:f,update:o?"{"+[c?`x: invert(${c}, x(unit))`:"",u?`y: invert(${u}, y(unit))`:""].filter((e=>e)).join(", ")+"}":"{x: x(unit), y: y(unit)}"}]},{name:a,on:[{events:f,force:!0,update:"pow(1.001, event.deltaY * pow(16, event.deltaMode))"}]}),void 0!==s&&Cu(e,n,s,"width",i),void 0!==l&&Cu(e,n,l,"height",i),i}};function Cu(e,t,n,i,r){const o=t.name,a=n.channel,s=Cc.defined(t),l=r.filter((e=>e.name===n.signals[s?"data":"visual"]))[0],c=e.getSizeSignalRef(i).signal,u=e.getScaleComponent(a),f=u&&u.get("type"),d=s?Pc(e,a):l.name,m=o+_u,p=`${s&&u?"log"===f?"zoomLog":"symlog"===f?"zoomSymlog":"pow"===f?"zoomPow":"zoomLinear":"zoomLinear"}(${d}, ${`${o}${Ou}.${a}`}, ${m}${s?"pow"===f?`, ${u.get("exponent")??1}`:"symlog"===f?`, ${u.get("constant")??1}`:"":""})`;l.on.push({events:{signal:m},update:s?p:`clampRange(${p}, 0, ${c})`})}const Pu="_store",Au="_tuple",ju="_modify",Tu="vlSelectionResolve",Eu=[qc,Lc,Nc,$u,bu,Cc,ku,wu,Fu,Nu,vu];function Mu(e){let{escape:n}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{escape:!0},i=n?t.stringValue(e.name):e.name;const r=function(e){let t=e.parent;for(;t&&!$m(t);)t=t.parent;return t}(e);if(r){const{facet:e}=r;for(const n of Re)e[n]&&(i+=` + '__facet_${n}_' + (facet[${t.stringValue(r.vgField(n))}])`)}return i}function Lu(e){return F(e.component.selection??{}).reduce(((e,t)=>e||t.project.hasSelectionId),!1)}function qu(e,n){!t.isString(n.select)&&n.select.on||delete e.events,!t.isString(n.select)&&n.select.clear||delete e.clear,!t.isString(n.select)&&n.select.toggle||delete e.toggle}function Uu(e){const t=[];return"Identifier"===e.type?[e.name]:"Literal"===e.type?[e.value]:("MemberExpression"===e.type&&(t.push(...Uu(e.object)),t.push(...Uu(e.property))),t)}function Ru(e){return"MemberExpression"===e.object.type?Ru(e.object):"datum"===e.object.name}function Wu(e){const n=t.parseExpression(e),i=new Set;return n.visit((e=>{"MemberExpression"===e.type&&Ru(e)&&i.add(Uu(e).slice(1).join("."))})),i}class Bu extends vc{clone(){return new Bu(null,this.model,l(this.filter))}constructor(e,t,n){super(e),this.model=t,this.filter=n,qn(this,"expr",void 0),qn(this,"_dependentFields",void 0),this.expr=Vu(this.model,this.filter,this),this._dependentFields=Wu(this.expr)}dependentFields(){return this._dependentFields}producedFields(){return new Set}assemble(){return{type:"filter",expr:this.expr}}hash(){return`Filter ${this.expr}`}}function Iu(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"datum";const o=t.isString(n)?n:n.param,a=_(o),s=t.stringValue(a+Pu);let l;try{l=e.getSelectionComponent(a,o)}catch(e){return`!!${a}`}if(l.project.timeUnit){const t=i??e.component.data.raw,n=l.project.timeUnit.clone();t.parent?n.insertAsParentOf(t):t.parent=n}const c=`${l.project.hasSelectionId?"vlSelectionIdTest(":"vlSelectionTest("}${s}, ${r}${"global"===l.resolve?")":`, ${t.stringValue(l.resolve)})`}`,u=`length(data(${s}))`;return!1===n.empty?`${u} && ${c}`:`!${u} || ${c}`}function Hu(e,n,i){const r=_(n),o=i.encoding;let a,s=i.field;try{a=e.getSelectionComponent(r,n)}catch(e){return r}if(o||s){if(o&&!s){const e=a.project.items.filter((e=>e.channel===o));!e.length||e.length>1?(s=a.project.items[0].field,$i((e.length?"Multiple ":"No ")+`matching ${t.stringValue(o)} encoding found for selection ${t.stringValue(i.param)}. `+`Using "field": ${t.stringValue(s)}.`)):s=e[0].field}}else s=a.project.items[0].field,a.project.items.length>1&&$i(`A "field" or "encoding" must be specified when using a selection as a scale domain. Using "field": ${t.stringValue(s)}.`);return`${a.name}[${t.stringValue(E(s))}]`}function Vu(e,n,i){return N(n,(n=>t.isString(n)?n:function(e){return e?.param}(n)?Iu(e,n,i):Zi(n)))}function Gu(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}function Yu(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{header:!1};const{disable:o,orient:a,scale:s,labelExpr:l,title:c,zindex:u,...f}=e.combine();if(!o){for(const e in f){const i=Oa[e],r=f[e];if(i&&i!==n&&"both"!==i)delete f[e];else if(Fa(r)){const{condition:n,...i}=r,o=t.array(n),a=Da[e];if(a){const{vgProp:t,part:n}=a;Gu(f,n,t,[...o.map((e=>{const{test:t,...n}=e;return{test:Vu(null,t),...n}})),i]),delete f[e]}else if(null===a){const t={signal:o.map((e=>{const{test:t,...n}=e;return`${Vu(null,t)} ? ${zn(n)} : `})).join("")+zn(i)};f[e]=t}}else if(yn(r)){const t=Da[e];if(t){const{vgProp:n,part:i}=t;Gu(f,i,n,r),delete f[e]}}p(["labelAlign","labelBaseline"],e)&&null===f[e]&&delete f[e]}if("grid"===n){if(!f.grid)return;if(f.encode){const{grid:e}=f.encode;f.encode={...e?{grid:e}:{}},S(f.encode)&&delete f.encode}return{scale:s,orient:a,...f,domain:!1,labels:!1,aria:!1,maxExtent:0,minExtent:0,ticks:!1,zindex:U(u,0)}}{if(!r.header&&e.mainExtracted)return;if(void 0!==l){let e=l;f.encode?.labels?.update&&yn(f.encode.labels.update.text)&&(e=M(l,"datum.label",f.encode.labels.update.text.signal)),Gu(f,"labels","text",{signal:e})}if(null===f.labelAlign&&delete f.labelAlign,f.encode){for(const t of za)e.hasAxisPart(t)||delete f.encode[t];S(f.encode)&&delete f.encode}const n=function(e,n){if(e)return t.isArray(e)&&!hn(e)?e.map((e=>da(e,n))).join(", "):e}(c,i);return{scale:s,orient:a,grid:!1,...n?{title:n}:{},...f,...!1===i.aria?{aria:!1}:{},zindex:U(u,0)}}}}function Xu(e){const{axes:t}=e.component,n=[];for(const i of Ft)if(t[i])for(const r of t[i])if(!r.get("disable")&&!r.get("gridScale")){const t="x"===i?"height":"width",r=e.getSizeSignalRef(t).signal;t!==r&&n.push({name:t,update:r})}return n}function Qu(e,t,n,i){return Object.assign.apply(null,[{},...e.map((e=>{if("axisOrient"===e){const e="x"===n?"bottom":"left",r=t["x"===n?"axisBottom":"axisLeft"]||{},o=t["x"===n?"axisTop":"axisRight"]||{},a=new Set([...D(r),...D(o)]),s={};for(const t of a.values())s[t]={signal:`${i.signal} === "${e}" ? ${On(r[t])} : ${On(o[t])}`};return s}return t[e]}))])}function Ju(e,n){const i=[{}];for(const r of e){let e=n[r]?.style;if(e){e=t.array(e);for(const t of e)i.push(n.style[t])}}return Object.assign.apply(null,i)}function Ku(e,t,n){let i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=jn(e,n,t);if(void 0!==r)return{configFrom:"style",configValue:r};for(const t of["vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle"])if(void 0!==i[t]?.[e])return{configFrom:t,configValue:i[t][e]};return{}}const Zu={scale:e=>{let{model:t,channel:n}=e;return t.scaleName(n)},format:e=>{let{format:t}=e;return t},formatType:e=>{let{formatType:t}=e;return t},grid:e=>{let{fieldOrDatumDef:t,axis:n,scaleType:i}=e;return n.grid??function(e,t){return!xr(e)&&Ho(t)&&!ln(t?.bin)&&!cn(t?.bin)}(i,t)},gridScale:e=>{let{model:t,channel:n}=e;return function(e,t){const n="x"===t?"y":"x";if(e.getScaleComponent(n))return e.scaleName(n);return}(t,n)},labelAlign:e=>{let{axis:t,labelAngle:n,orient:i,channel:r}=e;return t.labelAlign||nf(n,i,r)},labelAngle:e=>{let{labelAngle:t}=e;return t},labelBaseline:e=>{let{axis:t,labelAngle:n,orient:i,channel:r}=e;return t.labelBaseline||tf(n,i,r)},labelFlush:e=>{let{axis:t,fieldOrDatumDef:n,channel:i}=e;return t.labelFlush??function(e,t){if("x"===t&&p(["quantitative","temporal"],e))return!0;return}(n.type,i)},labelOverlap:e=>{let{axis:n,fieldOrDatumDef:i,scaleType:r}=e;return n.labelOverlap??function(e,n,i,r){if(i&&!t.isObject(r)||"nominal"!==e&&"ordinal"!==e)return"log"!==n&&"symlog"!==n||"greedy";return}(i.type,r,Ho(i)&&!!i.timeUnit,Ho(i)?i.sort:void 0)},orient:e=>{let{orient:t}=e;return t},tickCount:e=>{let{channel:t,model:n,axis:i,fieldOrDatumDef:r,scaleType:o}=e;const a="x"===t?"width":"y"===t?"height":void 0,s=a?n.getSizeSignalRef(a):void 0;return i.tickCount??function(e){let{fieldOrDatumDef:t,scaleType:n,size:i,values:r}=e;if(!r&&!xr(n)&&"log"!==n){if(Ho(t)){if(ln(t.bin))return{signal:`ceil(${i.signal}/10)`};if(t.timeUnit&&p(["month","hours","day","quarter"],Ui(t.timeUnit)?.unit))return}return{signal:`ceil(${i.signal}/40)`}}return}({fieldOrDatumDef:r,scaleType:o,size:s,values:i.values})},tickMinStep:e=>{let{axis:t,format:n,fieldOrDatumDef:i}=e;return t.tickMinStep??function(e){let{format:t,fieldOrDatumDef:n}=e;if("d"===t)return 1;if(Ho(n)){const{timeUnit:e}=n;if(e){const t=Ri(e);if(t)return{signal:t}}}return}({format:n,fieldOrDatumDef:i})},title:e=>{let{axis:t,model:n,channel:i}=e;if(void 0!==t.title)return t.title;const r=rf(n,i);if(void 0!==r)return r;const o=n.typedFieldDef(i),a="x"===i?"x2":"y2",s=n.fieldDef(a);return En(o?[Eo(o)]:[],Ho(s)?[Eo(s)]:[])},values:e=>{let{axis:n,fieldOrDatumDef:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return ka(n,i);if(yn(i))return i;return}(n,i)},zindex:e=>{let{axis:t,fieldOrDatumDef:n,mark:i}=e;return t.zindex??function(e,t){if("rect"===e&&aa(t))return 1;return 0}(i,n)}};function ef(e){return`(((${e.signal} % 360) + 360) % 360)`}function tf(e,t,n,i){if(void 0!==e){if("x"===n){if(yn(e)){const n=ef(e);return{signal:`(45 < ${n} && ${n} < 135) || (225 < ${n} && ${n} < 315) ? "middle" :(${n} <= 45 || 315 <= ${n}) === ${yn(t)?`(${t.signal} === "top")`:"top"===t} ? "bottom" : "top"`}}if(45{if(ea(t)&&Po(t.sort)){const{field:i,timeUnit:r}=t,o=t.sort,a=o.map(((e,t)=>`${Zi({field:i,timeUnit:r,equal:e})} ? ${t} : `)).join("")+o.length;e=new of(e,{calculate:a,as:af(t,n,{forAs:!0})})}})),e}producedFields(){return new Set([this.transform.as])}dependentFields(){return this._dependentFields}assemble(){return{type:"formula",expr:this.transform.calculate,as:this.transform.as}}hash(){return`Calculate ${d(this.transform)}`}}function af(e,t,n){return oa(e,{prefix:t,suffix:"sort_index",...n??{}})}function sf(e,t){return p(["top","bottom"],t)?"column":p(["left","right"],t)||"row"===e?"row":"column"}function lf(e,t,n,i){const r="row"===i?n.headerRow:"column"===i?n.headerColumn:n.headerFacet;return U((t||{})[e],r[e],n.header[e])}function cf(e,t,n,i){const r={};for(const o of e){const e=lf(o,t||{},n,i);void 0!==e&&(r[o]=e)}return r}const uf=["row","column"],ff=["header","footer"];function df(e,t){const n=e.component.layoutHeaders[t].title,i=e.config?e.config:void 0,r=e.component.layoutHeaders[t].facetFieldDef?e.component.layoutHeaders[t].facetFieldDef:void 0,{titleAnchor:o,titleAngle:a,titleOrient:s}=cf(["titleAnchor","titleAngle","titleOrient"],r.header,i,t),l=sf(t,s),c=H(a);return{name:`${t}-title`,type:"group",role:`${l}-title`,title:{text:n,..."row"===t?{orient:"left"}:{},style:"guide-title",...pf(c,l),...mf(l,c,o),...$f(i,r,t,hs,ps)}}}function mf(e,t){switch(arguments.length>2&&void 0!==arguments[2]?arguments[2]:"middle"){case"start":return{align:"left"};case"end":return{align:"right"}}const n=nf(t,"row"===e?"left":"top","row"===e?"y":"x");return n?{align:n}:{}}function pf(e,t){const n=tf(e,"row"===t?"left":"top","row"===t?"y":"x",!0);return n?{baseline:n}:{}}function gf(e,t){const n=e.component.layoutHeaders[t],i=[];for(const r of ff)if(n[r])for(const o of n[r]){const a=vf(e,t,r,n,o);null!=a&&i.push(a)}return i}function hf(e,n){const{sort:i}=e;return Co(i)?{field:oa(i,{expr:"datum"}),order:i.order??"ascending"}:t.isArray(i)?{field:af(e,n,{expr:"datum"}),order:"ascending"}:{field:oa(e,{expr:"datum"}),order:i??"ascending"}}function yf(e,t,n){const{format:i,formatType:r,labelAngle:o,labelAnchor:a,labelOrient:s,labelExpr:l}=cf(["format","formatType","labelAngle","labelAnchor","labelOrient","labelExpr"],e.header,n,t),c=vo({fieldOrDatumDef:e,format:i,formatType:r,expr:"parent",config:n}).signal,u=sf(t,s);return{text:{signal:l?M(M(l,"datum.label",c),"datum.value",oa(e,{expr:"parent"})):c},..."row"===t?{orient:"left"}:{},style:"guide-label",frame:"group",...pf(o,u),...mf(u,o,a),...$f(n,e,t,ys,gs)}}function vf(e,t,n,i,r){if(r){let o=null;const{facetFieldDef:a}=i,s=e.config?e.config:void 0;if(a&&r.labels){const{labelOrient:e}=cf(["labelOrient"],a.header,s,t);("row"===t&&!p(["top","bottom"],e)||"column"===t&&!p(["left","right"],e))&&(o=yf(a,t,s))}const l=$m(e)&&!Ao(e.facet),c=r.axes,u=c?.length>0;if(o||u){const s="row"===t?"height":"width";return{name:e.getName(`${t}_${n}`),type:"group",role:`${t}-${n}`,...i.facetFieldDef?{from:{data:e.getName(`${t}_domain`)},sort:hf(a,t)}:{},...u&&l?{from:{data:e.getName(`facet_domain_${t}`)}}:{},...o?{title:o}:{},...r.sizeSignal?{encode:{update:{[s]:r.sizeSignal}}}:{},...u?{axes:c}:{}}}}return null}const bf={column:{start:0,end:1},row:{start:1,end:0}};function xf(e,t){return bf[t][e]}function $f(e,t,n,i,r){const o={};for(const a of i){if(!r[a])continue;const i=lf(a,t?.header,e,n);void 0!==i&&(o[r[a]]=i)}return o}function wf(e){return[...kf(e,"width"),...kf(e,"height"),...kf(e,"childWidth"),...kf(e,"childHeight")]}function kf(e,t){const n="width"===t?"x":"y",i=e.component.layoutSize.get(t);if(!i||"merged"===i)return[];const r=e.getSizeSignalRef(t).signal;if("step"===i){const t=e.getScaleComponent(n);if(t){const i=t.get("type"),o=t.get("range");if(xr(i)&&vn(o)){const i=e.scaleName(n);if($m(e.parent)){if("independent"===e.parent.component.resolve.scale[n])return[Sf(i,o)]}return[Sf(i,o),{name:r,update:Df(i,t,`domain('${i}').length`)}]}}throw new Error("layout size is step although width/height is not step.")}if("container"==i){const t=r.endsWith("width"),n=t?"containerSize()[0]":"containerSize()[1]",i=`isFinite(${n}) ? ${n} : ${As(e.config.view,t?"width":"height")}`;return[{name:r,init:i,on:[{update:i,events:"window:resize"}]}]}return[{name:r,value:i}]}function Sf(e,t){const n=`${e}_step`;return yn(t.step)?{name:n,update:t.step.signal}:{name:n,value:t.step}}function Df(e,t,n){const i=t.get("type"),r=t.get("padding"),o=U(t.get("paddingOuter"),r);let a=t.get("paddingInner");return a="band"===i?void 0!==a?a:r:1,`bandspace(${n}, ${On(a)}, ${On(o)}) * ${e}_step`}function Ff(e){return"childWidth"===e?"width":"childHeight"===e?"height":e}function zf(e,t){return D(e).reduce(((n,i)=>{const r=e[i];return{...n,...Uc(t,r,i,(e=>Fn(e.value)))}}),{})}function Of(e,t){if($m(t))return"theta"===e?"independent":"shared";if(km(t))return"shared";if(wm(t))return zt(e)||"theta"===e||"radius"===e?"independent":"shared";throw new Error("invalid model type for resolve")}function _f(e,t){const n=e.scale[t],i=zt(t)?"axis":"legend";return"independent"===n?("shared"===e[i][t]&&$i(function(e){return`Setting the scale to be independent for "${e}" means we also have to set the guide (axis or legend) to be independent.`}(t)),"independent"):e[i][t]||"shared"}const Nf=D({aria:1,clipHeight:1,columnPadding:1,columns:1,cornerRadius:1,description:1,direction:1,fillColor:1,format:1,formatType:1,gradientLength:1,gradientOpacity:1,gradientStrokeColor:1,gradientStrokeWidth:1,gradientThickness:1,gridAlign:1,labelAlign:1,labelBaseline:1,labelColor:1,labelFont:1,labelFontSize:1,labelFontStyle:1,labelFontWeight:1,labelLimit:1,labelOffset:1,labelOpacity:1,labelOverlap:1,labelPadding:1,labelSeparation:1,legendX:1,legendY:1,offset:1,orient:1,padding:1,rowPadding:1,strokeColor:1,symbolDash:1,symbolDashOffset:1,symbolFillColor:1,symbolLimit:1,symbolOffset:1,symbolOpacity:1,symbolSize:1,symbolStrokeColor:1,symbolStrokeWidth:1,symbolType:1,tickCount:1,tickMinStep:1,title:1,titleAlign:1,titleAnchor:1,titleBaseline:1,titleColor:1,titleFont:1,titleFontSize:1,titleFontStyle:1,titleFontWeight:1,titleLimit:1,titleLineHeight:1,titleOpacity:1,titleOrient:1,titlePadding:1,type:1,values:1,zindex:1,disable:1,labelExpr:1,selections:1,opacity:1,shape:1,stroke:1,fill:1,size:1,strokeWidth:1,strokeDash:1,encode:1});class Cf extends Jl{}const Pf={symbols:function(e,n){let{fieldOrDatumDef:i,model:r,channel:o,legendCmpt:a,legendType:s}=n;if("symbol"!==s)return;const{markDef:l,encoding:c,config:u,mark:f}=r,d=l.filled&&"trail"!==f;let m={..._n({},r,eo),...Qc(r,{filled:d})};const p=a.get("symbolOpacity")??u.legend.symbolOpacity,g=a.get("symbolFillColor")??u.legend.symbolFillColor,h=a.get("symbolStrokeColor")??u.legend.symbolStrokeColor,y=void 0===p?Af(c.opacity)??l.opacity:void 0;if(m.fill)if("fill"===o||d&&o===me)delete m.fill;else if(m.fill.field)g?delete m.fill:(m.fill=Fn(u.legend.symbolBaseFillColor??"black"),m.fillOpacity=Fn(y??1));else if(t.isArray(m.fill)){const e=jf(c.fill??c.color)??l.fill??(d&&l.color);e&&(m.fill=Fn(e))}if(m.stroke)if("stroke"===o||!d&&o===me)delete m.stroke;else if(m.stroke.field||h)delete m.stroke;else if(t.isArray(m.stroke)){const e=U(jf(c.stroke||c.color),l.stroke,d?l.color:void 0);e&&(m.stroke={value:e})}if(o!==be){const e=Ho(i)&&Ef(r,a,i);e?m.opacity=[{test:e,...Fn(y??1)},Fn(u.legend.unselectedOpacity)]:y&&(m.opacity=Fn(y))}return m={...m,...e},S(m)?void 0:m},gradient:function(e,t){let{model:n,legendType:i,legendCmpt:r}=t;if("gradient"!==i)return;const{config:o,markDef:a,encoding:s}=n;let l={};const c=void 0===(r.get("gradientOpacity")??o.legend.gradientOpacity)?Af(s.opacity)||a.opacity:void 0;c&&(l.opacity=Fn(c));return l={...l,...e},S(l)?void 0:l},labels:function(e,t){let{fieldOrDatumDef:n,model:i,channel:r,legendCmpt:o}=t;const a=i.legend(r)||{},s=i.config,l=Ho(n)?Ef(i,o,n):void 0,c=l?[{test:l,value:1},{value:s.legend.unselectedOpacity}]:void 0,{format:u,formatType:f}=a;let d;go(f)?d=xo({fieldOrDatumDef:n,field:"datum.value",format:u,formatType:f,config:s}):void 0===u&&void 0===f&&s.customFormatTypes&&("quantitative"===n.type&&s.numberFormatType?d=xo({fieldOrDatumDef:n,field:"datum.value",format:s.numberFormat,formatType:s.numberFormatType,config:s}):"temporal"===n.type&&s.timeFormatType&&Ho(n)&&void 0===n.timeUnit&&(d=xo({fieldOrDatumDef:n,field:"datum.value",format:s.timeFormat,formatType:s.timeFormatType,config:s})));const m={...c?{opacity:c}:{},...d?{text:d}:{},...e};return S(m)?void 0:m},entries:function(e,t){let{legendCmpt:n}=t;const i=n.get("selections");return i?.length?{...e,fill:{value:"transparent"}}:e}};function Af(e){return Tf(e,((e,t)=>Math.max(e,t.value)))}function jf(e){return Tf(e,((e,t)=>U(e,t.value)))}function Tf(e,n){return function(e){const n=e?.condition;return!!n&&(t.isArray(n)||Zo(n))}(e)?t.array(e.condition).reduce(n,e.value):Zo(e)?e.value:void 0}function Ef(e,n,i){const r=n.get("selections");if(!r?.length)return;const o=t.stringValue(i.field);return r.map((e=>`(!length(data(${t.stringValue(_(e)+Pu)})) || (${e}[${o}] && indexof(${e}[${o}], datum.value) >= 0))`)).join(" || ")}const Mf={direction:e=>{let{direction:t}=e;return t},format:e=>{let{fieldOrDatumDef:t,legend:n,config:i}=e;const{format:r,formatType:o}=n;return $o(t,t.type,r,o,i,!1)},formatType:e=>{let{legend:t,fieldOrDatumDef:n,scaleType:i}=e;const{formatType:r}=t;return wo(r,n,i)},gradientLength:e=>{const{legend:t,legendConfig:n}=e;return t.gradientLength??n.gradientLength??function(e){let{legendConfig:t,model:n,direction:i,orient:r,scaleType:o}=e;const{gradientHorizontalMaxLength:a,gradientHorizontalMinLength:s,gradientVerticalMaxLength:l,gradientVerticalMinLength:c}=t;if(wr(o))return"horizontal"===i?"top"===r||"bottom"===r?Uf(n,"width",s,a):s:Uf(n,"height",c,l);return}(e)},labelOverlap:e=>{let{legend:t,legendConfig:n,scaleType:i}=e;return t.labelOverlap??n.labelOverlap??function(e){if(p(["quantile","threshold","log","symlog"],e))return"greedy";return}(i)},symbolType:e=>{let{legend:t,markDef:n,channel:i,encoding:r}=e;return t.symbolType??function(e,t,n,i){if("shape"!==t){const e=jf(n)??i;if(e)return e}switch(e){case"bar":case"rect":case"image":case"square":return"square";case"line":case"trail":case"rule":return"stroke";case"arc":case"point":case"circle":case"tick":case"geoshape":case"area":case"text":return"circle"}}(n.type,i,r.shape,n.shape)},title:e=>{let{fieldOrDatumDef:t,config:n}=e;return ua(t,n,{allowDisabling:!0})},type:e=>{let{legendType:t,scaleType:n,channel:i}=e;if(qe(i)&&wr(n)){if("gradient"===t)return}else if("symbol"===t)return;return t},values:e=>{let{fieldOrDatumDef:n,legend:i}=e;return function(e,n){const i=e.values;if(t.isArray(i))return ka(n,i);if(yn(i))return i;return}(i,n)}};function Lf(e){const{legend:t}=e;return U(t.type,function(e){let{channel:t,timeUnit:n,scaleType:i}=e;if(qe(t)){if(p(["quarter","month","day"],n))return"symbol";if(wr(i))return"gradient"}return"symbol"}(e))}function qf(e){let{legendConfig:t,legendType:n,orient:i,legend:r}=e;return r.direction??t[n?"gradientDirection":"symbolDirection"]??function(e,t){switch(e){case"top":case"bottom":return"horizontal";case"left":case"right":case"none":case void 0:return;default:return"gradient"===t?"horizontal":void 0}}(i,n)}function Uf(e,t,n,i){return{signal:`clamp(${e.getSizeSignalRef(t).signal}, ${n}, ${i})`}}function Rf(e){const t=xm(e)?function(e){const{encoding:t}=e,n={};for(const i of[me,...bs]){const r=ga(t[i]);r&&e.getScaleComponent(i)&&(i===he&&Ho(r)&&r.type===lr||(n[i]=Bf(e,i)))}return n}(e):function(e){const{legends:t,resolve:n}=e.component;for(const i of e.children){Rf(i);for(const r of D(i.component.legends))n.legend[r]=_f(e.component.resolve,r),"shared"===n.legend[r]&&(t[r]=If(t[r],i.component.legends[r]),t[r]||(n.legend[r]="independent",delete t[r]))}for(const i of D(t))for(const t of e.children)t.component.legends[i]&&"shared"===n.legend[i]&&delete t.component.legends[i];return t}(e);return e.component.legends=t,t}function Wf(e,t,n,i){switch(t){case"disable":return void 0!==n;case"values":return!!n?.values;case"title":if("title"===t&&e===i?.title)return!0}return e===(n||{})[t]}function Bf(e,t){let n=e.legend(t);const{markDef:i,encoding:r,config:o}=e,a=o.legend,s=new Cf({},function(e,t){const n=e.scaleName(t);if("trail"===e.mark){if("color"===t)return{stroke:n};if("size"===t)return{strokeWidth:n}}return"color"===t?e.markDef.filled?{fill:n}:{stroke:n}:{[t]:n}}(e,t));!function(e,t,n){const i=e.fieldDef(t)?.field;for(const r of F(e.component.selection??{})){const e=r.project.hasField[i]??r.project.hasChannel[t];if(e&&ku.defined(r)){const t=n.get("selections")??[];t.push(r.name),n.set("selections",t,!1),e.hasLegend=!0}}}(e,t,s);const l=void 0!==n?!n:a.disable;if(s.set("disable",l,void 0!==n),l)return s;n=n||{};const c=e.getScaleComponent(t).get("type"),u=ga(r[t]),f=Ho(u)?Ui(u.timeUnit)?.unit:void 0,d=n.orient||o.legend.orient||"right",m=Lf({legend:n,channel:t,timeUnit:f,scaleType:c}),p={legend:n,channel:t,model:e,markDef:i,encoding:r,fieldOrDatumDef:u,legendConfig:a,config:o,scaleType:c,orient:d,legendType:m,direction:qf({legend:n,legendType:m,orient:d,legendConfig:a})};for(const i of Nf){if("gradient"===m&&i.startsWith("symbol")||"symbol"===m&&i.startsWith("gradient"))continue;const r=i in Mf?Mf[i](p):n[i];if(void 0!==r){const a=Wf(r,i,n,e.fieldDef(t));(a||void 0===o.legend[i])&&s.set(i,r,a)}}const g=n?.encoding??{},h=s.get("selections"),y={},v={fieldOrDatumDef:u,model:e,channel:t,legendCmpt:s,legendType:m};for(const t of["labels","legend","title","symbols","gradient","entries"]){const n=zf(g[t]??{},e),i=t in Pf?Pf[t](n,v):n;void 0===i||S(i)||(y[t]={...h?.length&&Ho(u)?{name:`${_(u.field)}_legend_${t}`}:{},...h?.length?{interactive:!!h}:{},update:i})}return S(y)||s.set("encode",y,!!n?.encoding),s}function If(e,t){if(!e)return t.clone();const n=e.getWithExplicit("orient"),i=t.getWithExplicit("orient");if(n.explicit&&i.explicit&&n.value!==i.value)return;let r=!1;for(const n of Nf){const i=nc(e.getWithExplicit(n),t.getWithExplicit(n),n,"legend",((e,t)=>{switch(n){case"symbolType":return Hf(e,t);case"title":return Ln(e,t);case"type":return r=!0,Zl("symbol")}return tc(e,t,n,"legend")}));e.setWithExplicit(n,i)}return r&&(e.implicit?.encode?.gradient&&C(e.implicit,["encode","gradient"]),e.explicit?.encode?.gradient&&C(e.explicit,["encode","gradient"])),e}function Hf(e,t){return"circle"===t.value?t:e}function Vf(e){const t=e.component.legends,n={};for(const i of D(t)){const r=X(e.getScaleComponent(i).get("domains"));if(n[r])for(const e of n[r]){If(e,t[i])||n[r].push(t[i])}else n[r]=[t[i].clone()]}return F(n).flat().map((t=>function(e,t){const{disable:n,labelExpr:i,selections:r,...o}=e.combine();if(n)return;!1===t.aria&&null==o.aria&&(o.aria=!1);if(o.encode?.symbols){const e=o.encode.symbols.update;!e.fill||"transparent"===e.fill.value||e.stroke||o.stroke||(e.stroke={value:"transparent"});for(const t of bs)o[t]&&delete e[t]}o.title||delete o.title;if(void 0!==i){let e=i;o.encode?.labels?.update&&yn(o.encode.labels.update.text)&&(e=M(i,"datum.label",o.encode.labels.update.text.signal)),function(e,t,n,i){e.encode??={},e.encode[t]??={},e.encode[t].update??={},e.encode[t].update[n]=i}(o,"labels","text",{signal:e})}return o}(t,e.config))).filter((e=>void 0!==e))}function Gf(e){return km(e)||wm(e)?function(e){return e.children.reduce(((e,t)=>e.concat(t.assembleProjections())),Yf(e))}(e):Yf(e)}function Yf(e){const t=e.component.projection;if(!t||t.merged)return[];const n=t.combine(),{name:i}=n;if(t.data){const r={signal:`[${t.size.map((e=>e.signal)).join(", ")}]`},o=t.data.reduce(((t,n)=>{const i=yn(n)?n.signal:`data('${e.lookupDataSource(n)}')`;return p(t,i)||t.push(i),t}),[]);if(o.length<=0)throw new Error("Projection's fit didn't find any data sources");return[{name:i,size:r,fit:{signal:o.length>1?`[${o.join(", ")}]`:o[0]},...n}]}return[{name:i,translate:{signal:"[width / 2, height / 2]"},...n}]}const Xf=["type","clipAngle","clipExtent","center","rotate","precision","reflectX","reflectY","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];class Qf extends Jl{constructor(e,t,n,i){super({...t},{name:e}),this.specifiedProjection=t,this.size=n,this.data=i,qn(this,"merged",!1)}get isFit(){return!!this.data}}function Jf(e){e.component.projection=xm(e)?function(e){if(e.hasProjection){const t=pn(e.specifiedProjection),n=!(t&&(null!=t.scale||null!=t.translate)),i=n?[e.getSizeSignalRef("width"),e.getSizeSignalRef("height")]:void 0,r=n?function(e){const t=[],{encoding:n}=e;for(const i of[[ue,ce],[de,fe]])(ga(n[i[0]])||ga(n[i[1]]))&&t.push({signal:e.getName(`geojson_${t.length}`)});e.channelHasField(he)&&e.typedFieldDef(he).type===lr&&t.push({signal:e.getName(`geojson_${t.length}`)});0===t.length&&t.push(e.requestDataName(fc.Main));return t}(e):void 0,o=new Qf(e.projectionName(!0),{...pn(e.config.projection)??{},...t??{}},i,r);return o.get("type")||o.set("type","equalEarth",!1),o}return}(e):function(e){if(0===e.children.length)return;let n;for(const t of e.children)Jf(t);const i=h(e.children,(e=>{const i=e.component.projection;if(i){if(n){const e=function(e,n){const i=h(Xf,(i=>!t.hasOwnProperty(e.explicit,i)&&!t.hasOwnProperty(n.explicit,i)||!!(t.hasOwnProperty(e.explicit,i)&&t.hasOwnProperty(n.explicit,i)&&Y(e.get(i),n.get(i)))));if(Y(e.size,n.size)){if(i)return e;if(Y(e.explicit,{}))return n;if(Y(n.explicit,{}))return e}return null}(n,i);return e&&(n=e),!!e}return n=i,!0}return!0}));if(n&&i){const t=e.projectionName(!0),i=new Qf(t,n.specifiedProjection,n.size,l(n.data));for(const n of e.children){const e=n.component.projection;e&&(e.isFit&&i.data.push(...n.component.projection.data),n.renameProjection(e.get("name"),t),e.merged=!0)}return i}return}(e)}function Kf(e,t,n,i){if(Sa(t,n)){const r=xm(e)?e.axis(n)??e.legend(n)??{}:{},o=oa(t,{expr:"datum"}),a=oa(t,{expr:"datum",binSuffix:"end"});return{formulaAs:oa(t,{binSuffix:"range",forAs:!0}),formula:Fo(o,a,r.format,r.formatType,i)}}return{}}function Zf(e,t){return`${sn(e)}_${t}`}function ed(e,t,n){const i=Zf(ba(n,void 0)??{},t);return e.getName(`${i}_bins`)}function td(e,n,i){let r,o;r=function(e){return"as"in e}(e)?t.isString(e.as)?[e.as,`${e.as}_end`]:[e.as[0],e.as[1]]:[oa(e,{forAs:!0}),oa(e,{binSuffix:"end",forAs:!0})];const a={...ba(n,void 0)},s=Zf(a,e.field),{signal:l,extentSignal:c}=function(e,t){return{signal:e.getName(`${t}_bins`),extentSignal:e.getName(`${t}_extent`)}}(i,s);if(fn(a.extent)){const e=a.extent;o=Hu(i,e.param,e),delete a.extent}return{key:s,binComponent:{bin:a,field:e.field,as:[r],...l?{signal:l}:{},...c?{extentSignal:c}:{},...o?{span:o}:{}}}}class nd extends vc{clone(){return new nd(null,l(this.bins))}constructor(e,t){super(e),this.bins=t}static makeFromEncoding(e,t){const n=t.reduceFieldDef(((e,n,i)=>{if(Ko(n)&&ln(n.bin)){const{key:r,binComponent:o}=td(n,n.bin,t);e[r]={...o,...e[r],...Kf(t,n,i,t.config)}}return e}),{});return S(n)?null:new nd(e,n)}static makeFromTransform(e,t,n){const{key:i,binComponent:r}=td(t,t.bin,n);return new nd(e,{[i]:r})}merge(e,t){for(const n of D(e.bins))n in this.bins?(t(e.bins[n].signal,this.bins[n].signal),this.bins[n].as=b([...this.bins[n].as,...e.bins[n].as],d)):this.bins[n]=e.bins[n];for(const t of e.children)e.removeChild(t),t.parent=this;e.remove()}producedFields(){return new Set(F(this.bins).map((e=>e.as)).flat(2))}dependentFields(){return new Set(F(this.bins).map((e=>e.field)))}hash(){return`Bin ${d(this.bins)}`}assemble(){return F(this.bins).flatMap((e=>{const t=[],[n,...i]=e.as,{extent:r,...o}=e.bin,a={type:"bin",field:E(e.field),as:n,signal:e.signal,...fn(r)?{extent:null}:{extent:r},...e.span?{span:{signal:`span(${e.span})`}}:{},...o};!r&&e.extentSignal&&(t.push({type:"extent",field:E(e.field),signal:e.extentSignal}),a.extent={signal:e.extentSignal}),t.push(a);for(const e of i)for(let i=0;i<2;i++)t.push({type:"formula",expr:oa({field:n[i]},{expr:"datum"}),as:e[i]});return e.formula&&t.push({type:"formula",expr:e.formula,as:e.formulaAs}),t}))}}function id(e,n,i,r){const o=xm(r)?r.encoding[it(n)]:void 0;if(Ko(i)&&xm(r)&&Uo(i,o,r.markDef,r.config)){e.add(oa(i,{})),e.add(oa(i,{suffix:"end"}));const{mark:t,markDef:o,config:a}=r,s=Lo({fieldDef:i,markDef:o,config:a});Jr(t)&&.5!==s&&zt(n)&&(e.add(oa(i,{suffix:kc})),e.add(oa(i,{suffix:Sc}))),i.bin&&Sa(i,n)&&e.add(oa(i,{binSuffix:"range"}))}else if(Ee(n)){const t=Te(n);e.add(r.getName(t))}else e.add(oa(i));return ea(i)&&function(e){return t.isObject(e)&&"field"in e}(i.scale?.range)&&e.add(i.scale.range.field),e}class rd extends vc{clone(){return new rd(null,new Set(this.dimensions),l(this.measures))}constructor(e,t,n){super(e),this.dimensions=t,this.measures=n}get groupBy(){return this.dimensions}static makeFromEncoding(e,t){let n=!1;t.forEachFieldDef((e=>{e.aggregate&&(n=!0)}));const i={},r=new Set;return n?(t.forEachFieldDef(((e,n)=>{const{aggregate:o,field:a}=e;if(o)if("count"===o)i["*"]??={},i["*"].count=new Set([oa(e,{forAs:!0})]);else{if(Zt(o)||en(o)){const e=Zt(o)?"argmin":"argmax",t=o[e];i[t]??={},i[t][e]=new Set([oa({op:e,field:t},{forAs:!0})])}else i[a]??={},i[a][o]=new Set([oa(e,{forAs:!0})]);Ht(n)&&"unaggregated"===t.scaleDomain(n)&&(i[a]??={},i[a].min=new Set([oa({field:a,aggregate:"min"},{forAs:!0})]),i[a].max=new Set([oa({field:a,aggregate:"max"},{forAs:!0})]))}else id(r,n,e,t)})),r.size+D(i).length===0?null:new rd(e,r,i)):null}static makeFromTransform(e,t){const n=new Set,i={};for(const e of t.aggregate){const{op:t,field:n,as:r}=e;t&&("count"===t?(i["*"]??={},i["*"].count=new Set([r||oa(e,{forAs:!0})])):(i[n]??={},i[n][t]=new Set([r||oa(e,{forAs:!0})])))}for(const e of t.groupby??[])n.add(e);return n.size+D(i).length===0?null:new rd(e,n,i)}merge(e){return x(this.dimensions,e.dimensions)?(function(e,t){for(const n of D(t)){const i=t[n];for(const t of D(i))n in e?e[n][t]=new Set([...e[n][t]??[],...i[t]]):e[n]={[t]:i[t]}}}(this.measures,e.measures),!0):(function(){xi.debug(...arguments)}("different dimensions, cannot merge"),!1)}addDimensions(e){e.forEach(this.dimensions.add,this.dimensions)}dependentFields(){return new Set([...this.dimensions,...D(this.measures)])}producedFields(){const e=new Set;for(const t of D(this.measures))for(const n of D(this.measures[t])){const i=this.measures[t][n];0===i.size?e.add(`${n}_${t}`):i.forEach(e.add,e)}return e}hash(){return`Aggregate ${d({dimensions:this.dimensions,measures:this.measures})}`}assemble(){const e=[],t=[],n=[];for(const i of D(this.measures))for(const r of D(this.measures[i]))for(const o of this.measures[i][r])n.push(o),e.push(r),t.push("*"===i?null:E(i));return{type:"aggregate",groupby:[...this.dimensions].map(E),ops:e,fields:t,as:n}}}class od extends vc{constructor(e,n,i,r){super(e),this.model=n,this.name=i,this.data=r,qn(this,"column",void 0),qn(this,"row",void 0),qn(this,"facet",void 0),qn(this,"childModel",void 0);for(const e of Re){const i=n.facet[e];if(i){const{bin:r,sort:o}=i;this[e]={name:n.getName(`${e}_domain`),fields:[oa(i),...ln(r)?[oa(i,{binSuffix:"end"})]:[]],...Co(o)?{sortField:o}:t.isArray(o)?{sortIndexField:af(i,e)}:{}}}}this.childModel=n.child}hash(){let e="Facet";for(const t of Re)this[t]&&(e+=` ${t.charAt(0)}:${d(this[t])}`);return e}get fields(){const e=[];for(const t of Re)this[t]?.fields&&e.push(...this[t].fields);return e}dependentFields(){const e=new Set(this.fields);for(const t of Re)this[t]&&(this[t].sortField&&e.add(this[t].sortField.field),this[t].sortIndexField&&e.add(this[t].sortIndexField));return e}producedFields(){return new Set}getSource(){return this.name}getChildIndependentFieldsWithStep(){const e={};for(const t of Ft){const n=this.childModel.component.scales[t];if(n&&!n.merged){const i=n.get("type"),r=n.get("range");if(xr(i)&&vn(r)){const n=Qd(Jd(this.childModel,t));n?e[t]=n:$i(Yn(t))}}}return e}assembleRowColumnHeaderData(e,t,n){const i={row:"y",column:"x",facet:void 0}[e],r=[],o=[],a=[];i&&n&&n[i]&&(t?(r.push(`distinct_${n[i]}`),o.push("max")):(r.push(n[i]),o.push("distinct")),a.push(`distinct_${n[i]}`));const{sortField:s,sortIndexField:l}=this[e];if(s){const{op:e=zo,field:t}=s;r.push(t),o.push(e),a.push(oa(s,{forAs:!0}))}else l&&(r.push(l),o.push("max"),a.push(l));return{name:this[e].name,source:t??this.data,transform:[{type:"aggregate",groupby:this[e].fields,...r.length?{fields:r,ops:o,as:a}:{}}]}}assembleFacetHeaderData(e){const{columns:t}=this.model.layout,{layoutHeaders:n}=this.model.component,i=[],r={};for(const e of uf){for(const t of ff){const i=(n[e]&&n[e][t])??[];for(const t of i)if(t.axes?.length>0){r[e]=!0;break}}if(r[e]){const n=`length(data("${this.facet.name}"))`,r="row"===e?t?{signal:`ceil(${n} / ${t})`}:1:t?{signal:`min(${n}, ${t})`}:{signal:n};i.push({name:`${this.facet.name}_${e}`,transform:[{type:"sequence",start:0,stop:r}]})}}const{row:o,column:a}=r;return(o||a)&&i.unshift(this.assembleRowColumnHeaderData("facet",null,e)),i}assemble(){const e=[];let t=null;const n=this.getChildIndependentFieldsWithStep(),{column:i,row:r,facet:o}=this;if(i&&r&&(n.x||n.y)){t=`cross_${this.column.name}_${this.row.name}`;const i=[].concat(n.x??[],n.y??[]),r=i.map((()=>"distinct"));e.push({name:t,source:this.data,transform:[{type:"aggregate",groupby:this.fields,fields:i,ops:r}]})}for(const i of[J,Q])this[i]&&e.push(this.assembleRowColumnHeaderData(i,t,n));if(o){const t=this.assembleFacetHeaderData(n);t&&e.push(...t)}return e}}function ad(e){return e.startsWith("'")&&e.endsWith("'")||e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function sd(e){const n={};return a(e.filter,(e=>{if(Ji(e)){let i=null;Ii(e)?i=Sn(e.equal):Vi(e)?i=Sn(e.lte):Hi(e)?i=Sn(e.lt):Gi(e)?i=Sn(e.gt):Yi(e)?i=Sn(e.gte):Xi(e)?i=e.range[0]:Qi(e)&&(i=(e.oneOf??e.in)[0]),i&&(wi(i)?n[e.field]="date":t.isNumber(i)?n[e.field]="number":t.isString(i)&&(n[e.field]="string")),e.timeUnit&&(n[e.field]="date")}})),n}function ld(e){const n={};function i(e){var i;$a(e)?n[e.field]="date":"quantitative"===e.type&&(i=e.aggregate,t.isString(i)&&p(["min","max"],i))?n[e.field]="number":q(e.field)>1?e.field in n||(n[e.field]="flatten"):ea(e)&&Co(e.sort)&&q(e.sort.field)>1&&(e.sort.field in n||(n[e.sort.field]="flatten"))}if((xm(e)||$m(e))&&e.forEachFieldDef(((t,n)=>{if(Ko(t))i(t);else{const r=tt(n),o=e.fieldDef(r);i({...t,type:o.type})}})),xm(e)){const{mark:t,markDef:i,encoding:r}=e;if(Qr(t)&&!e.encoding.order){const e=r["horizontal"===i.orient?"y":"x"];Ho(e)&&"quantitative"===e.type&&!(e.field in n)&&(n[e.field]="number")}}return n}class cd extends vc{clone(){return new cd(null,l(this._parse))}constructor(e,t){super(e),qn(this,"_parse",void 0),this._parse=t}hash(){return`Parse ${d(this._parse)}`}static makeExplicit(e,t,n){let i={};const r=t.data;return!sc(r)&&r?.format?.parse&&(i=r.format.parse),this.makeWithAncestors(e,i,{},n)}static makeWithAncestors(e,t,n,i){for(const e of D(n)){const t=i.getWithExplicit(e);void 0!==t.value&&(t.explicit||t.value===n[e]||"derived"===t.value||"flatten"===n[e]?delete n[e]:$i(ei(e,n[e],t.value)))}for(const e of D(t)){const n=i.get(e);void 0!==n&&(n===t[e]?delete t[e]:$i(ei(e,t[e],n)))}const r=new Jl(t,n);i.copyAll(r);const o={};for(const e of D(r.combine())){const t=r.get(e);null!==t&&(o[e]=t)}return 0===D(o).length||i.parseNothing?null:new cd(e,o)}get parse(){return this._parse}merge(e){this._parse={...this._parse,...e.parse},e.remove()}assembleFormatParse(){const e={};for(const t of D(this._parse)){const n=this._parse[t];1===q(t)&&(e[t]=n)}return e}producedFields(){return new Set(D(this._parse))}dependentFields(){return new Set(D(this._parse))}assembleTransforms(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return D(this._parse).filter((t=>!e||q(t)>1)).map((e=>{const t=function(e,t){const n=A(e);if("number"===t)return`toNumber(${n})`;if("boolean"===t)return`toBoolean(${n})`;if("string"===t)return`toString(${n})`;if("date"===t)return`toDate(${n})`;if("flatten"===t)return n;if(t.startsWith("date:"))return`timeParse(${n},'${ad(t.slice(5,t.length))}')`;if(t.startsWith("utc:"))return`utcParse(${n},'${ad(t.slice(4,t.length))}')`;return $i(`Unrecognized parse "${t}".`),null}(e,this._parse[e]);if(!t)return null;return{type:"formula",expr:t,as:L(e)}})).filter((e=>null!==e))}}class ud extends vc{clone(){return new ud(null)}constructor(e){super(e)}dependentFields(){return new Set}producedFields(){return new Set([xs])}hash(){return"Identifier"}assemble(){return{type:"identifier",as:xs}}}class fd extends vc{clone(){return new fd(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){}hash(){return`Graticule ${d(this.params)}`}assemble(){return{type:"graticule",...!0===this.params?{}:this.params}}}class dd extends vc{clone(){return new dd(null,this.params)}constructor(e,t){super(e),this.params=t}dependentFields(){return new Set}producedFields(){return new Set([this.params.as??"data"])}hash(){return`Hash ${d(this.params)}`}assemble(){return{type:"sequence",...this.params}}}class md extends vc{constructor(e){let t;if(super(null),qn(this,"_data",void 0),qn(this,"_name",void 0),qn(this,"_generator",void 0),e??={name:"source"},sc(e)||(t=e.format?{...f(e.format,["parse"])}:{}),oc(e))this._data={values:e.values};else if(rc(e)){if(this._data={url:e.url},!t.type){let n=/(?:\.([^.]+))?$/.exec(e.url)[1];p(["json","csv","tsv","dsv","topojson"],n)||(n="json"),t.type=n}}else cc(e)?this._data={values:[{type:"Sphere"}]}:(ac(e)||sc(e))&&(this._data={});this._generator=sc(e),e.name&&(this._name=e.name),t&&!S(t)&&(this._data.format=t)}dependentFields(){return new Set}producedFields(){}get data(){return this._data}hasName(){return!!this._name}get isGenerator(){return this._generator}get dataName(){return this._name}set dataName(e){this._name=e}set parent(e){throw new Error("Source nodes have to be roots.")}remove(){throw new Error("Source nodes are roots and cannot be removed.")}hash(){throw new Error("Cannot hash sources")}assemble(){return{name:this._name,...this._data,transform:[]}}}function pd(e){return e instanceof md||e instanceof fd||e instanceof dd}var gd=new WeakMap;class hd{constructor(){Wn(this,gd,{writable:!0,value:void 0}),Un(this,gd,!1)}setModified(){Un(this,gd,!0)}get modifiedFlag(){return function(e,t){return t.get?t.get.call(e):t.value}(e=this,Rn(e,gd,"get"));var e}}class yd extends hd{getNodeDepths(e,t,n){n.set(e,t);for(const i of e.children)this.getNodeDepths(i,t+1,n);return n}optimize(e){const t=[...this.getNodeDepths(e,0,new Map).entries()].sort(((e,t)=>t[1]-e[1]));for(const e of t)this.run(e[0]);return this.modifiedFlag}}class vd extends hd{optimize(e){this.run(e);for(const t of e.children)this.optimize(t);return this.modifiedFlag}}class bd extends vd{mergeNodes(e,t){const n=t.shift();for(const i of t)e.removeChild(i),i.parent=n,i.remove()}run(e){const t=e.children.map((e=>e.hash())),n={};for(let i=0;i1&&(this.setModified(),this.mergeNodes(e,n[t]))}}class xd extends vd{constructor(e){super(),qn(this,"requiresSelectionId",void 0),this.requiresSelectionId=e&&Lu(e)}run(e){e instanceof ud&&(this.requiresSelectionId&&(pd(e.parent)||e.parent instanceof rd||e.parent instanceof cd)||(this.setModified(),e.remove()))}}class $d extends hd{optimize(e){return this.run(e,new Set),this.modifiedFlag}run(e,t){let n=new Set;e instanceof wc&&(n=e.producedFields(),$(n,t)&&(this.setModified(),e.removeFormulas(t),0===e.producedFields.length&&e.remove()));for(const i of e.children)this.run(i,new Set([...t,...n]))}}class wd extends vd{constructor(){super()}run(e){e instanceof bc&&!e.isRequired()&&(this.setModified(),e.remove())}}class kd extends yd{run(e){if(!(pd(e)||e.numChildren()>1))for(const t of e.children)if(t instanceof cd)if(e instanceof cd)this.setModified(),e.merge(t);else{if(k(e.producedFields(),t.dependentFields()))continue;this.setModified(),t.swapWithParent()}}}class Sd extends yd{run(e){const t=[...e.children],n=e.children.filter((e=>e instanceof cd));if(e.numChildren()>1&&n.length>=1){const i={},r=new Set;for(const e of n){const t=e.parse;for(const e of D(t))e in i?i[e]!==t[e]&&r.add(e):i[e]=t[e]}for(const e of r)delete i[e];if(!S(i)){this.setModified();const n=new cd(e,i);for(const r of t){if(r instanceof cd)for(const e of D(i))delete r.parse[e];e.removeChild(r),r.parent=n,r instanceof cd&&0===D(r.parse).length&&r.remove()}}}}}class Dd extends yd{run(e){e instanceof bc||e.numChildren()>0||e instanceof od||e instanceof md||(this.setModified(),e.remove())}}class Fd extends yd{run(e){const t=e.children.filter((e=>e instanceof wc)),n=t.pop();for(const e of t)this.setModified(),n.merge(e)}}class zd extends yd{run(e){const t=e.children.filter((e=>e instanceof rd)),n={};for(const e of t){const t=d(e.groupBy);t in n||(n[t]=[]),n[t].push(e)}for(const t of D(n)){const i=n[t];if(i.length>1){const t=i.pop();for(const n of i)t.merge(n)&&(e.removeChild(n),n.parent=t,n.remove(),this.setModified())}}}}class Od extends yd{constructor(e){super(),this.model=e}run(e){const t=!(pd(e)||e instanceof Bu||e instanceof cd||e instanceof ud),n=[],i=[];for(const r of e.children)r instanceof nd&&(t&&!k(e.producedFields(),r.dependentFields())?n.push(r):i.push(r));if(n.length>0){const t=n.pop();for(const e of n)t.merge(e,this.model.renameSignal.bind(this.model));this.setModified(),e instanceof nd?e.merge(t,this.model.renameSignal.bind(this.model)):t.swapWithParent()}if(i.length>1){const e=i.pop();for(const t of i)e.merge(t,this.model.renameSignal.bind(this.model));this.setModified()}}}class _d extends yd{run(e){const t=[...e.children];if(!g(t,(e=>e instanceof bc))||e.numChildren()<=1)return;const n=[];let i;for(const r of t)if(r instanceof bc){let t=r;for(;1===t.numChildren();){const[e]=t.children;if(!(e instanceof bc))break;t=e}n.push(...t.children),i?(e.removeChild(r),r.parent=i.parent,i.parent.removeChild(i),i.parent=t,this.setModified()):i=t}else n.push(r);if(n.length){this.setModified();for(const e of n)e.parent.removeChild(e),e.parent=i}}}class Nd extends vc{clone(){return new Nd(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return this.transform.groupby&&this.transform.groupby.forEach(e.add,e),this.transform.joinaggregate.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.joinaggregate.map(this.getDefaultName))}getDefaultName(e){return e.as??oa(e)}hash(){return`JoinAggregateTransform ${d(this.transform)}`}assemble(){const e=[],t=[],n=[];for(const i of this.transform.joinaggregate)t.push(i.op),n.push(this.getDefaultName(i)),e.push(void 0===i.field?null:i.field);const i=this.transform.groupby;return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==i?{groupby:i}:{}}}}class Cd extends vc{clone(){return new Cd(null,l(this._stack))}constructor(e,t){super(e),qn(this,"_stack",void 0),this._stack=t}static makeFromTransform(e,n){const{stack:i,groupby:r,as:o,offset:a="zero"}=n,s=[],l=[];if(void 0!==n.sort)for(const e of n.sort)s.push(e.field),l.push(U(e.order,"ascending"));const c={field:s,order:l};let u;return u=function(e){return t.isArray(e)&&e.every((e=>t.isString(e)))&&e.length>1}(o)?o:t.isString(o)?[o,`${o}_end`]:[`${n.stack}_start`,`${n.stack}_end`],new Cd(e,{dimensionFieldDefs:[],stackField:i,groupby:r,offset:a,sort:c,facetby:[],as:u})}static makeFromEncoding(e,n){const i=n.stack,{encoding:r}=n;if(!i)return null;const{groupbyChannels:o,fieldChannel:a,offset:s,impute:l}=i,c=o.map((e=>pa(r[e]))).filter((e=>!!e)),u=function(e){return e.stack.stackBy.reduce(((e,t)=>{const n=oa(t.fieldDef);return n&&e.push(n),e}),[])}(n),f=n.encoding.order;let d;if(t.isArray(f)||Ho(f))d=Tn(f);else{const e=Ro(f)?f.sort:"y"===a?"descending":"ascending";d=u.reduce(((t,n)=>(t.field.push(n),t.order.push(e),t)),{field:[],order:[]})}return new Cd(e,{dimensionFieldDefs:c,stackField:n.vgField(a),facetby:[],stackby:u,sort:d,offset:s,impute:l,as:[n.vgField(a,{suffix:"start",forAs:!0}),n.vgField(a,{suffix:"end",forAs:!0})]})}get stack(){return this._stack}addDimensions(e){this._stack.facetby.push(...e)}dependentFields(){const e=new Set;return e.add(this._stack.stackField),this.getGroupbyFields().forEach(e.add,e),this._stack.facetby.forEach(e.add,e),this._stack.sort.field.forEach(e.add,e),e}producedFields(){return new Set(this._stack.as)}hash(){return`Stack ${d(this._stack)}`}getGroupbyFields(){const{dimensionFieldDefs:e,impute:t,groupby:n}=this._stack;return e.length>0?e.map((e=>e.bin?t?[oa(e,{binSuffix:"mid"})]:[oa(e,{}),oa(e,{binSuffix:"end"})]:[oa(e)])).flat():n??[]}assemble(){const e=[],{facetby:t,dimensionFieldDefs:n,stackField:i,stackby:r,sort:o,offset:a,impute:s,as:l}=this._stack;if(s)for(const o of n){const{bandPosition:n=.5,bin:a}=o;if(a){const t=oa(o,{expr:"datum"}),i=oa(o,{expr:"datum",binSuffix:"end"});e.push({type:"formula",expr:`${n}*${t}+${1-n}*${i}`,as:oa(o,{binSuffix:"mid",forAs:!0})})}e.push({type:"impute",field:i,groupby:[...r,...t],key:oa(o,{binSuffix:"mid"}),method:"value",value:0})}return e.push({type:"stack",groupby:[...this.getGroupbyFields(),...t],field:i,sort:o,as:l,offset:a}),e}}class Pd extends vc{clone(){return new Pd(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b(this.transform.groupby.concat(e),(e=>e))}dependentFields(){const e=new Set;return(this.transform.groupby??[]).forEach(e.add,e),(this.transform.sort??[]).forEach((t=>e.add(t.field))),this.transform.window.map((e=>e.field)).filter((e=>void 0!==e)).forEach(e.add,e),e}producedFields(){return new Set(this.transform.window.map(this.getDefaultName))}getDefaultName(e){return e.as??oa(e)}hash(){return`WindowTransform ${d(this.transform)}`}assemble(){const e=[],t=[],n=[],i=[];for(const r of this.transform.window)t.push(r.op),n.push(this.getDefaultName(r)),i.push(void 0===r.param?null:r.param),e.push(void 0===r.field?null:r.field);const r=this.transform.frame,o=this.transform.groupby;if(r&&null===r[0]&&null===r[1]&&t.every((e=>tn(e))))return{type:"joinaggregate",as:n,ops:t,fields:e,...void 0!==o?{groupby:o}:{}};const a=[],s=[];if(void 0!==this.transform.sort)for(const e of this.transform.sort)a.push(e.field),s.push(e.order??"ascending");const l={field:a,order:s},c=this.transform.ignorePeers;return{type:"window",params:i,as:n,ops:t,fields:e,sort:l,...void 0!==c?{ignorePeers:c}:{},...void 0!==o?{groupby:o}:{},...void 0!==r?{frame:r}:{}}}}function Ad(e){if(e instanceof od)if(1!==e.numChildren()||e.children[0]instanceof bc){const n=e.model.component.data.main;jd(n);const i=(t=e,function e(n){if(!(n instanceof od)){const i=n.clone();if(i instanceof bc){const e=Td+i.getSource();i.setSource(e),t.model.component.data.outputNodes[e]=i}else(i instanceof rd||i instanceof Cd||i instanceof Pd||i instanceof Nd)&&i.addDimensions(t.fields);for(const t of n.children.flatMap(e))t.parent=i;return[i]}return n.children.flatMap(e)}),r=e.children.map(i).flat();for(const e of r)e.parent=n}else{const t=e.children[0];(t instanceof rd||t instanceof Cd||t instanceof Pd||t instanceof Nd)&&t.addDimensions(e.fields),t.swapWithParent(),Ad(e)}else e.children.map(Ad);var t}function jd(e){if(e instanceof bc&&e.type===fc.Main&&1===e.numChildren()){const t=e.children[0];t instanceof od||(t.swapWithParent(),jd(e))}}const Td="scale_",Ed=5;function Md(e){for(const t of e){for(const e of t.children)if(e.parent!==t)return!1;if(!Md(t.children))return!1}return!0}function Ld(e,t){let n=!1;for(const i of t)n=e.optimize(i)||n;return n}function qd(e,t,n){let i=e.sources,r=!1;return r=Ld(new wd,i)||r,r=Ld(new xd(t),i)||r,i=i.filter((e=>e.numChildren()>0)),r=Ld(new Dd,i)||r,i=i.filter((e=>e.numChildren()>0)),n||(r=Ld(new kd,i)||r,r=Ld(new Od(t),i)||r,r=Ld(new $d,i)||r,r=Ld(new Sd,i)||r,r=Ld(new zd,i)||r,r=Ld(new Fd,i)||r,r=Ld(new bd,i)||r,r=Ld(new _d,i)||r),e.sources=i,r}class Ud{constructor(e){qn(this,"signal",void 0),Object.defineProperty(this,"signal",{enumerable:!0,get:e})}static fromName(e,t){return new Ud((()=>e(t)))}}function Rd(e){xm(e)?function(e){const t=e.component.scales;for(const n of D(t)){const i=Wd(e,n);if(t[n].setWithExplicit("domains",i),Vd(e,n),e.component.data.isFaceted){let t=e;for(;!$m(t)&&t.parent;)t=t.parent;if("shared"===t.component.resolve.scale[n])for(const e of i.value)bn(e)&&(e.data=Td+e.data.replace(Td,""))}}}(e):function(e){for(const t of e.children)Rd(t);const t=e.component.scales;for(const n of D(t)){let i,r=null;for(const t of e.children){const e=t.component.scales[n];if(e){i=void 0===i?e.getWithExplicit("domains"):nc(i,e.getWithExplicit("domains"),"domains","scale",Yd);const t=e.get("selectionExtent");r&&t&&r.param!==t.param&&$i(Kn),r=t}}t[n].setWithExplicit("domains",i),r&&t[n].set("selectionExtent",r,!0)}}(e)}function Wd(e,t){const n=e.getScaleComponent(t).get("type"),{encoding:i}=e,r=function(e,t,n,i){if("unaggregated"===e){const{valid:e,reason:i}=Gd(t,n);if(!e)return void $i(i)}else if(void 0===e&&i.useUnaggregatedDomain){const{valid:e}=Gd(t,n);if(e)return"unaggregated"}return e}(e.scaleDomain(t),e.typedFieldDef(t),n,e.config.scale);return r!==e.scaleDomain(t)&&(e.specifiedScales[t]={...e.specifiedScales[t],domain:r}),"x"===t&&ga(i.x2)?ga(i.x)?nc(Id(n,r,e,"x"),Id(n,r,e,"x2"),"domain","scale",Yd):Id(n,r,e,"x2"):"y"===t&&ga(i.y2)?ga(i.y)?nc(Id(n,r,e,"y"),Id(n,r,e,"y2"),"domain","scale",Yd):Id(n,r,e,"y2"):Id(n,r,e,t)}function Bd(e,t,n){const i=Ui(n)?.unit;return"temporal"===t||i?function(e,t,n){return e.map((e=>({signal:`{data: ${wa(e,{timeUnit:n,type:t})}}`})))}(e,t,i):[e]}function Id(e,n,i,r){const{encoding:o,markDef:a,mark:s,config:l,stack:c}=i,u=ga(o[r]),{type:f}=u,d=u.timeUnit;if(function(e){return e?.unionWith}(n)){const t=Id(e,void 0,i,r);return Kl([...Bd(n.unionWith,f,d),...t.value])}if(yn(n))return Kl([n]);if(n&&"unaggregated"!==n&&!Sr(n))return Kl(Bd(n,f,d));if(c&&r===c.fieldChannel){if("normalize"===c.offset)return Zl([[0,1]]);const e=i.requestDataName(fc.Main);return Zl([{data:e,field:i.vgField(r,{suffix:"start"})},{data:e,field:i.vgField(r,{suffix:"end"})}])}const m=Ht(r)&&Ho(u)?function(e,t,n){if(!xr(n))return;const i=e.fieldDef(t),r=i.sort;if(Po(r))return{op:"min",field:af(i,t),order:"ascending"};const{stack:o}=e,a=o?new Set([...o.groupbyFields,...o.stackBy.map((e=>e.fieldDef.field))]):void 0;if(Co(r)){return Hd(r,o&&!a.has(r.field))}if(No(r)){const{encoding:t,order:n}=r,i=e.fieldDef(t),{aggregate:s,field:l}=i,c=o&&!a.has(l);if(Zt(s)||en(s))return Hd({field:oa(i),order:n},c);if(tn(s)||!s)return Hd({op:s,field:l,order:n},c)}else{if("descending"===r)return{op:"min",field:e.vgField(t),order:"descending"};if(p(["ascending",void 0],r))return!0}return}(i,r,e):void 0;if(Go(u)){return Zl(Bd([u.datum],f,d))}const g=u;if("unaggregated"===n){const e=i.requestDataName(fc.Main),{field:t}=u;return Zl([{data:e,field:oa({field:t,aggregate:"min"})},{data:e,field:oa({field:t,aggregate:"max"})}])}if(ln(g.bin)){if(xr(e))return Zl("bin-ordinal"===e?[]:[{data:O(m)?i.requestDataName(fc.Main):i.requestDataName(fc.Raw),field:i.vgField(r,Sa(g,r)?{binSuffix:"range"}:{}),sort:!0!==m&&t.isObject(m)?m:{field:i.vgField(r,{}),op:"min"}}]);{const{bin:e}=g;if(ln(e)){const t=ed(i,g.field,e);return Zl([new Ud((()=>{const e=i.getSignalName(t);return`[${e}.start, ${e}.stop]`}))])}return Zl([{data:i.requestDataName(fc.Main),field:i.vgField(r,{})}])}}if(g.timeUnit&&p(["time","utc"],e)){const e=o[it(r)];if(Uo(g,e,a,l)){const t=i.requestDataName(fc.Main),n=Lo({fieldDef:g,fieldDef2:e,markDef:a,config:l}),o=Jr(s)&&.5!==n;return Zl([{data:t,field:i.vgField(r,o?{suffix:kc}:{})},{data:t,field:i.vgField(r,{suffix:o?Sc:"end"})}])}}return Zl(m?[{data:O(m)?i.requestDataName(fc.Main):i.requestDataName(fc.Raw),field:i.vgField(r),sort:m}]:[{data:i.requestDataName(fc.Main),field:i.vgField(r)}])}function Hd(e,t){const{op:n,field:i,order:r}=e;return{op:n??(t?"sum":zo),...i?{field:E(i)}:{},...r?{order:r}:{}}}function Vd(e,t){const n=e.component.scales[t],i=e.specifiedScales[t].domain,r=e.fieldDef(t)?.bin,o=Sr(i)&&i,a=un(r)&&fn(r.extent)&&r.extent;(o||a)&&n.set("selectionExtent",o??a,!0)}function Gd(e,n){const{aggregate:i,type:r}=e;return i?t.isString(i)&&!an.has(i)?{valid:!1,reason:fi(i)}:"quantitative"===r&&"log"===n?{valid:!1,reason:di(e)}:{valid:!0}:{valid:!1,reason:ui(e)}}function Yd(e,t,n,i){return e.explicit&&t.explicit&&$i(function(e,t,n,i){return`Conflicting ${t.toString()} property "${e.toString()}" (${X(n)} and ${X(i)}). Using the union of the two domains.`}(n,i,e.value,t.value)),{explicit:e.explicit,value:[...e.value,...t.value]}}function Xd(e){const n=b(e.map((e=>{if(bn(e)){const{sort:t,...n}=e;return n}return e})),d),i=b(e.map((e=>{if(bn(e)){const t=e.sort;return void 0===t||O(t)||("op"in t&&"count"===t.op&&delete t.field,"ascending"===t.order&&delete t.order),t}})).filter((e=>void 0!==e)),d);if(0===n.length)return;if(1===n.length){const n=e[0];if(bn(n)&&i.length>0){let e=i[0];if(i.length>1){$i(gi);const n=i.filter((e=>t.isObject(e)&&"op"in e&&"min"!==e.op));e=!i.every((e=>t.isObject(e)&&"op"in e))||1!==n.length||n[0]}else if(t.isObject(e)&&"field"in e){const t=e.field;n.field===t&&(e=!e.order||{order:e.order})}return{...n,sort:e}}return n}const r=b(i.map((e=>O(e)||!("op"in e)||t.isString(e.op)&&e.op in Kt?e:($i(function(e){return`Dropping sort property ${X(e)} as unioned domains only support boolean or op "count", "min", and "max".`}(e)),!0))),d);let o;1===r.length?o=r[0]:r.length>1&&($i(gi),o=!0);const a=b(e.map((e=>bn(e)?e.data:null)),(e=>e));if(1===a.length&&null!==a[0]){return{data:a[0],fields:n.map((e=>e.field)),...o?{sort:o}:{}}}return{fields:n,...o?{sort:o}:{}}}function Qd(e){if(bn(e)&&t.isString(e.field))return e.field;if(function(e){return!t.isArray(e)&&"fields"in e&&!("data"in e)}(e)){let n;for(const i of e.fields)if(bn(i)&&t.isString(i.field))if(n){if(n!==i.field)return $i("Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect."),n}else n=i.field;return $i("Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect."),n}if(function(e){return!t.isArray(e)&&"fields"in e&&"data"in e}(e)){$i("Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.");const n=e.fields[0];return t.isString(n)?n:void 0}}function Jd(e,t){const n=e.component.scales[t].get("domains").map((t=>(bn(t)&&(t.data=e.lookupDataSource(t.data)),t)));return Xd(n)}function Kd(e){return km(e)||wm(e)?e.children.reduce(((e,t)=>e.concat(Kd(t))),Zd(e)):Zd(e)}function Zd(e){return D(e.component.scales).reduce(((n,i)=>{const r=e.component.scales[i];if(r.merged)return n;const o=r.combine(),{name:a,type:s,selectionExtent:l,domains:c,range:u,reverse:f,...d}=o,m=function(e,n,i,r){if(zt(i)){if(vn(e))return{step:{signal:`${n}_step`}}}else if(t.isObject(e)&&bn(e))return{...e,data:r.lookupDataSource(e.data)};return e}(o.range,a,i,e),p=Jd(e,i),g=l?function(e,n,i,r){const o=Hu(e,n.param,n);return{signal:$r(i.get("type"))&&t.isArray(r)&&r[0]>r[1]?`isValid(${o}) && reverse(${o})`:o}}(e,l,r,p):null;return n.push({name:a,type:s,...p?{domain:p}:{},...g?{domainRaw:g}:{},range:m,...void 0!==f?{reverse:f}:{},...d}),n}),[])}class em extends Jl{constructor(e,t){super({},{name:e}),qn(this,"merged",!1),this.setWithExplicit("type",t)}domainDefinitelyIncludesZero(){return!1!==this.get("zero")||g(this.get("domains"),(e=>t.isArray(e)&&2===e.length&&t.isNumber(e[0])&&e[0]<=0&&t.isNumber(e[1])&&e[1]>=0))}}const tm=["range","scheme"];function nm(e,n){const i=e.fieldDef(n);if(i?.bin){const{bin:r,field:o}=i,a=rt(n),s=e.getName(a);if(t.isObject(r)&&r.binned&&void 0!==r.step)return new Ud((()=>{const t=e.scaleName(n),i=`(domain("${t}")[1] - domain("${t}")[0]) / ${r.step}`;return`${e.getSignalName(s)} / (${i})`}));if(ln(r)){const t=ed(e,o,r);return new Ud((()=>{const n=e.getSignalName(t),i=`(${n}.stop - ${n}.start) / ${n}.step`;return`${e.getSignalName(s)} / (${i})`}))}}}function im(e,n){const i=n.specifiedScales[e],{size:r}=n,o=n.getScaleComponent(e).get("type");for(const r of tm)if(void 0!==i[r]){const a=Ar(o,r),s=jr(e,r);if(a)if(s)$i(s);else switch(r){case"range":{const r=i.range;if(t.isArray(r)){if(zt(e))return Kl(r.map((e=>{if("width"===e||"height"===e){const t=n.getName(e),i=n.getSignalName.bind(n);return Ud.fromName(i,t)}return e})))}else if(t.isObject(r))return Kl({data:n.requestDataName(fc.Main),field:r.field,sort:{op:"min",field:n.vgField(e)}});return Kl(r)}case"scheme":return Kl(rm(i[r]))}else $i(mi(o,r,e))}const a=e===Z||"xOffset"===e?"width":"height",s=r[a];if(Ns(s))if(zt(e))if(xr(o)){const t=am(s,n,e);if(t)return Kl({step:t})}else $i(pi(a));else if(Pt(e)){const t=e===ie?"x":"y";if("band"===n.getScaleComponent(t).get("type")){const e=sm(s,o);if(e)return Kl(e)}}const{rangeMin:l,rangeMax:u}=i,f=function(e,n){const{size:i,config:r,mark:o,encoding:a}=n,{type:s}=ga(a[e]),l=n.getScaleComponent(e),u=l.get("type"),{domain:f,domainMid:d}=n.specifiedScales[e];switch(e){case Z:case ee:if(p(["point","band"],u)){const t=lm(e,i,r.view);if(Ns(t)){return{step:am(t,n,e)}}}return om(e,n,u);case ie:case re:return function(e,t,n){const i=e===ie?"x":"y",r=t.getScaleComponent(i);if(!r)return om(i,t,n,{center:!0});const o=r.get("type"),a=t.scaleName(i),{markDef:s,config:l}=t;if("band"===o){const e=lm(i,t.size,t.config.view);if(Ns(e)){const t=sm(e,n);if(t)return t}return[0,{signal:`bandwidth('${a}')`}]}{const n=t.encoding[i];if(Ho(n)&&n.timeUnit){const e=Ri(n.timeUnit,(e=>`scale('${a}', ${e})`)),i=t.config.scale.bandWithNestedOffsetPaddingInner,r=Lo({fieldDef:n,markDef:s,config:l})-.5,o=0!==r?` + ${r}`:"";if(i){return[{signal:`${yn(i)?`${i.signal}/2`+o:`${i/2+r}`} * (${e})`},{signal:`${yn(i)?`(1 - ${i.signal}/2)`+o:`${1-i/2+r}`} * (${e})`}]}return[0,{signal:e}]}return c(`Cannot use ${e} scale if ${i} scale is not discrete.`)}}(e,n,u);case ye:{const a=cm(o,n.component.scales[e].get("zero"),r),s=function(e,n,i,r){const o={x:nm(i,"x"),y:nm(i,"y")};switch(e){case"bar":case"tick":{if(void 0!==r.scale.maxBandSize)return r.scale.maxBandSize;const e=fm(n,o,r.view);return t.isNumber(e)?e-1:new Ud((()=>`${e.signal} - 1`))}case"line":case"trail":case"rule":return r.scale.maxStrokeWidth;case"text":return r.scale.maxFontSize;case"point":case"square":case"circle":{if(r.scale.maxSize)return r.scale.maxSize;const e=fm(n,o,r.view);return t.isNumber(e)?Math.pow(um*e,2):new Ud((()=>`pow(${um} * ${e.signal}, 2)`))}}throw new Error(ai("size",e))}(o,i,n,r);return kr(u)?function(e,t,n){const i=()=>{const i=On(t),r=On(e),o=`(${i} - ${r}) / (${n} - 1)`;return`sequence(${r}, ${i} + ${o}, ${o})`};return yn(t)?new Ud(i):{signal:i()}}(a,s,function(e,n,i,r){switch(e){case"quantile":return n.scale.quantileCount;case"quantize":return n.scale.quantizeCount;case"threshold":return void 0!==i&&t.isArray(i)?i.length+1:($i(function(e){return`Domain for ${e} is required for threshold scale.`}(r)),3)}}(u,r,f,e)):[a,s]}case se:return[0,2*Math.PI];case ve:return[0,360];case oe:return[0,new Ud((()=>`min(${n.getSignalName("width")},${n.getSignalName("height")})/2`))];case we:return[r.scale.minStrokeWidth,r.scale.maxStrokeWidth];case ke:return[[1,0],[4,2],[2,1],[1,1],[1,2,4,2]];case he:return"symbol";case me:case pe:case ge:return"ordinal"===u?"nominal"===s?"category":"ordinal":void 0!==d?"diverging":"rect"===o||"geoshape"===o?"heatmap":"ramp";case be:case xe:case $e:return[r.scale.minOpacity,r.scale.maxOpacity]}}(e,n);return(void 0!==l||void 0!==u)&&Ar(o,"rangeMin")&&t.isArray(f)&&2===f.length?Kl([l??f[0],u??f[1]]):Zl(f)}function rm(e){return function(e){return!t.isString(e)&&!!e.name}(e)?{scheme:e.name,...f(e,["name"])}:{scheme:e}}function om(e,t,n){let{center:i}=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const r=rt(e),o=t.getName(r),a=t.getSignalName.bind(t);return e===ee&&$r(n)?i?[Ud.fromName((e=>`${a(e)}/2`),o),Ud.fromName((e=>`-${a(e)}/2`),o)]:[Ud.fromName(a,o),0]:i?[Ud.fromName((e=>`-${a(e)}/2`),o),Ud.fromName((e=>`${a(e)}/2`),o)]:[0,Ud.fromName(a,o)]}function am(e,n,i){const{encoding:r}=n,o=n.getScaleComponent(i),a=at(i),s=r[a];if("offset"===_s({step:e,offsetIsDiscrete:Jo(s)&&ir(s.type)})&&Ea(r,a)){const i=n.getScaleComponent(a);let r=`domain('${n.scaleName(a)}').length`;if("band"===i.get("type")){r=`bandspace(${r}, ${i.get("paddingInner")??i.get("padding")??0}, ${i.get("paddingOuter")??i.get("padding")??0})`}const s=o.get("paddingInner")??o.get("padding");return{signal:`${e.step} * ${r} / (1-${l=s,yn(l)?l.signal:t.stringValue(l)})`}}return e.step;var l}function sm(e,t){if("offset"===_s({step:e,offsetIsDiscrete:xr(t)}))return{step:e.step}}function lm(e,t,n){const i=e===Z?"width":"height",r=t[i];return r||Ts(n,i)}function cm(e,t,n){if(t)return yn(t)?{signal:`${t.signal} ? 0 : ${cm(e,!1,n)}`}:0;switch(e){case"bar":case"tick":return n.scale.minBandSize;case"line":case"trail":case"rule":return n.scale.minStrokeWidth;case"text":return n.scale.minFontSize;case"point":case"square":case"circle":return n.scale.minSize}throw new Error(ai("size",e))}const um=.95;function fm(e,t,n){const i=Ns(e.width)?e.width.step:js(n,"width"),r=Ns(e.height)?e.height.step:js(n,"height");return t.x||t.y?new Ud((()=>`min(${[t.x?t.x.signal:i,t.y?t.y.signal:r].join(", ")})`)):Math.min(i,r)}function dm(e,t){xm(e)?function(e,t){const n=e.component.scales,{config:i,encoding:r,markDef:o,specifiedScales:a}=e;for(const s of D(n)){const l=a[s],c=n[s],u=e.getScaleComponent(s),f=ga(r[s]),d=l[t],m=u.get("type"),p=u.get("padding"),g=u.get("paddingInner"),h=Ar(m,t),y=jr(s,t);if(void 0!==d&&(h?y&&$i(y):$i(mi(m,t,s))),h&&void 0===y)if(void 0!==d){const e=f.timeUnit,n=f.type;switch(t){case"domainMax":case"domainMin":wi(l[t])||"temporal"===n||e?c.set(t,{signal:wa(l[t],{type:n,timeUnit:e})},!0):c.set(t,l[t],!0);break;default:c.copyKeyFromObject(t,l)}}else{const n=t in mm?mm[t]({model:e,channel:s,fieldOrDatumDef:f,scaleType:m,scalePadding:p,scalePaddingInner:g,domain:l.domain,domainMin:l.domainMin,domainMax:l.domainMax,markDef:o,config:i,hasNestedOffsetScale:Ma(r,s),hasSecondaryRangeChannel:!!r[it(s)]}):i.scale[t];void 0!==n&&c.set(t,n,!1)}}}(e,t):gm(e,t)}const mm={bins:e=>{let{model:t,fieldOrDatumDef:n}=e;return Ho(n)?function(e,t){const n=t.bin;if(ln(n)){const i=ed(e,t.field,n);return new Ud((()=>e.getSignalName(i)))}if(cn(n)&&un(n)&&void 0!==n.step)return{step:n.step};return}(t,n):void 0},interpolate:e=>{let{channel:t,fieldOrDatumDef:n}=e;return function(e,t){if(p([me,pe,ge],e)&&"nominal"!==t)return"hcl";return}(t,n.type)},nice:e=>{let{scaleType:n,channel:i,domain:r,domainMin:o,domainMax:a,fieldOrDatumDef:s}=e;return function(e,n,i,r,o,a){if(pa(a)?.bin||t.isArray(i)||null!=o||null!=r||p([cr.TIME,cr.UTC],e))return;return!!zt(n)||void 0}(n,i,r,o,a,s)},padding:e=>{let{channel:t,scaleType:n,fieldOrDatumDef:i,markDef:r,config:o}=e;return function(e,t,n,i,r,o){if(zt(e)){if(wr(t)){if(void 0!==n.continuousPadding)return n.continuousPadding;const{type:t,orient:a}=r;if("bar"===t&&(!Ho(i)||!i.bin&&!i.timeUnit)&&("vertical"===a&&"x"===e||"horizontal"===a&&"y"===e))return o.continuousBandSize}if(t===cr.POINT)return n.pointPadding}return}(t,n,o.scale,i,r,o.bar)},paddingInner:e=>{let{scalePadding:t,channel:n,markDef:i,scaleType:r,config:o,hasNestedOffsetScale:a}=e;return function(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(zt(t)){const{bandPaddingInner:e,barBandPaddingInner:t,rectBandPaddingInner:i,bandWithNestedOffsetPaddingInner:a}=r;return o?a:U(e,"bar"===n?t:i)}if(Pt(t)&&i===cr.BAND)return r.offsetBandPaddingInner;return}(t,n,i.type,r,o.scale,a)},paddingOuter:e=>{let{scalePadding:t,channel:n,scaleType:i,scalePaddingInner:r,config:o,hasNestedOffsetScale:a}=e;return function(e,t,n,i,r){let o=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(void 0!==e)return;if(zt(t)){const{bandPaddingOuter:e,bandWithNestedOffsetPaddingOuter:t}=r;if(o)return t;if(n===cr.BAND)return U(e,yn(i)?{signal:`${i.signal}/2`}:i/2)}else if(Pt(t)){if(n===cr.POINT)return.5;if(n===cr.BAND)return r.offsetBandPaddingOuter}return}(t,n,i,r,o.scale,a)},reverse:e=>{let{fieldOrDatumDef:t,scaleType:n,channel:i,config:r}=e;return function(e,t,n,i){if("x"===n&&void 0!==i.xReverse)return $r(e)&&"descending"===t?yn(i.xReverse)?{signal:`!${i.xReverse.signal}`}:!i.xReverse:i.xReverse;if($r(e)&&"descending"===t)return!0;return}(n,Ho(t)?t.sort:void 0,i,r.scale)},zero:e=>{let{channel:n,fieldOrDatumDef:i,domain:r,markDef:o,scaleType:a,config:s,hasSecondaryRangeChannel:l}=e;return function(e,n,i,r,o,a,s){if(i&&"unaggregated"!==i&&$r(o)){if(t.isArray(i)){const e=i[0],n=i[i.length-1];if(t.isNumber(e)&&e<=0&&t.isNumber(n)&&n>=0)return!0}return!1}if("size"===e&&"quantitative"===n.type&&!kr(o))return!0;if((!Ho(n)||!n.bin)&&p([...Ft,..._t],e)){const{orient:t,type:n}=r;return(!p(["bar","area","line","trail"],n)||!("horizontal"===t&&"y"===e||"vertical"===t&&"x"===e))&&(!(!p(["bar","area"],n)||s)||a?.zero)}return!1}(n,i,r,o,a,s.scale,l)}};function pm(e){xm(e)?function(e){const t=e.component.scales;for(const n of It){const i=t[n];if(!i)continue;const r=im(n,e);i.setWithExplicit("range",r)}}(e):gm(e,"range")}function gm(e,t){const n=e.component.scales;for(const n of e.children)"range"===t?pm(n):dm(n,t);for(const i of D(n)){let r;for(const n of e.children){const e=n.component.scales[i];if(e){r=nc(r,e.getWithExplicit(t),t,"scale",ec(((e,n)=>"range"===t&&e.step&&n.step?e.step-n.step:0)))}}n[i].setWithExplicit(t,r)}}function hm(e,t,n,i){const r=function(e,t,n,i){switch(t.type){case"nominal":case"ordinal":if(qe(e)||"discrete"===Qt(e))return"shape"===e&&"ordinal"===t.type&&$i(ci(e,"ordinal")),"ordinal";if(zt(e)||Pt(e)){if(p(["rect","bar","image","rule"],n.type))return"band";if(i)return"band"}else if("arc"===n.type&&e in Ot)return"band";return io(n[rt(e)])||ta(t)&&t.axis?.tickBand?"band":"point";case"temporal":return qe(e)?"time":"discrete"===Qt(e)?($i(ci(e,"temporal")),"ordinal"):Ho(t)&&t.timeUnit&&Ui(t.timeUnit).utc?"utc":"time";case"quantitative":return qe(e)?Ho(t)&&ln(t.bin)?"bin-ordinal":"linear":"discrete"===Qt(e)?($i(ci(e,"quantitative")),"ordinal"):"linear";case"geojson":return}throw new Error(ii(t.type))}(t,n,i,arguments.length>4&&void 0!==arguments[4]&&arguments[4]),{type:o}=e;return Ht(t)?void 0!==o?function(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!Ht(e))return!1;switch(e){case Z:case ee:case ie:case re:case se:case oe:return!!wr(t)||"band"===t||"point"===t&&!n;case ye:case we:case be:case xe:case $e:case ve:return wr(t)||kr(t)||p(["band","point","ordinal"],t);case me:case pe:case ge:return"band"!==t;case ke:case he:return"ordinal"===t||kr(t)}}(t,o)?Ho(n)&&(a=o,s=n.type,!(p([or,sr],s)?void 0===a||xr(a):s===ar?p([cr.TIME,cr.UTC,void 0],a):s!==rr||hr(a)||kr(a)||void 0===a))?($i(function(e,t){return`FieldDef does not work with "${e}" scale. We are using "${t}" scale instead.`}(o,r)),r):o:($i(function(e,t,n){return`Channel "${e}" does not work with "${t}" scale. We are using "${n}" scale instead.`}(t,o,r)),r):r:null;var a,s}function ym(e){xm(e)?e.component.scales=function(e){const{encoding:t,mark:n,markDef:i}=e,r={};for(const o of It){const a=ga(t[o]);if(a&&n===Xr&&o===he&&a.type===lr)continue;let s=a&&a.scale;if(a&&null!==s&&!1!==s){s??={};const n=hm(s,o,a,i,Ma(t,o));r[o]=new em(e.scaleName(`${o}`,!0),{value:n,explicit:s.type===n})}}return r}(e):e.component.scales=function(e){const t=e.component.scales={},n={},i=e.component.resolve;for(const t of e.children){ym(t);for(const r of D(t.component.scales))if(i.scale[r]??=Of(r,e),"shared"===i.scale[r]){const e=n[r],o=t.component.scales[r].getWithExplicit("type");e?fr(e.value,o.value)?n[r]=nc(e,o,"type","scale",vm):(i.scale[r]="independent",delete n[r]):n[r]=o}}for(const i of D(n)){const r=e.scaleName(i,!0),o=n[i];t[i]=new em(r,o);for(const t of e.children){const e=t.component.scales[i];e&&(t.renameScale(e.get("name"),r),e.merged=!0)}}return t}(e)}const vm=ec(((e,t)=>mr(e)-mr(t)));class bm{constructor(){qn(this,"nameMap",void 0),this.nameMap={}}rename(e,t){this.nameMap[e]=t}has(e){return void 0!==this.nameMap[e]}get(e){for(;this.nameMap[e]&&e!==this.nameMap[e];)e=this.nameMap[e];return e}}function xm(e){return"unit"===e?.type}function $m(e){return"facet"===e?.type}function wm(e){return"concat"===e?.type}function km(e){return"layer"===e?.type}class Sm{constructor(e,n,i,r,o,a,c){this.type=n,this.parent=i,this.config=o,qn(this,"name",void 0),qn(this,"size",void 0),qn(this,"title",void 0),qn(this,"description",void 0),qn(this,"data",void 0),qn(this,"transforms",void 0),qn(this,"layout",void 0),qn(this,"scaleNameMap",void 0),qn(this,"projectionNameMap",void 0),qn(this,"signalNameMap",void 0),qn(this,"component",void 0),qn(this,"view",void 0),qn(this,"children",void 0),qn(this,"correctDataNames",(e=>(e.from?.data&&(e.from.data=this.lookupDataSource(e.from.data)),e.from?.facet?.data&&(e.from.facet.data=this.lookupDataSource(e.from.facet.data)),e))),this.parent=i,this.config=o,this.view=pn(c),this.name=e.name??r,this.title=hn(e.title)?{text:e.title}:e.title?pn(e.title):void 0,this.scaleNameMap=i?i.scaleNameMap:new bm,this.projectionNameMap=i?i.projectionNameMap:new bm,this.signalNameMap=i?i.signalNameMap:new bm,this.data=e.data,this.description=e.description,this.transforms=(e.transform??[]).map((e=>bl(e)?{filter:s(e.filter,tr)}:e)),this.layout="layer"===n||"unit"===n?{}:function(e,n,i){const r=i[n],o={},{spacing:a,columns:s}=r;void 0!==a&&(o.spacing=a),void 0!==s&&(To(e)&&!Ao(e.facet)||Fs(e))&&(o.columns=s),zs(e)&&(o.columns=1);for(const n of Ps)if(void 0!==e[n])if("spacing"===n){const i=e[n];o[n]=t.isNumber(i)?i:{row:i.row??a,column:i.column??a}}else o[n]=e[n];return o}(e,n,o),this.component={data:{sources:i?i.component.data.sources:[],outputNodes:i?i.component.data.outputNodes:{},outputNodeRefCounts:i?i.component.data.outputNodeRefCounts:{},isFaceted:To(e)||i?.component.data.isFaceted&&void 0===e.data},layoutSize:new Jl,layoutHeaders:{row:{},column:{},facet:{}},mark:null,resolve:{scale:{},axis:{},legend:{},...a?l(a):{}},selection:null,scales:null,projection:null,axes:{},legends:{}}}get width(){return this.getSizeSignalRef("width")}get height(){return this.getSizeSignalRef("height")}parse(){this.parseScale(),this.parseLayoutSize(),this.renameTopLevelLayoutSizeSignal(),this.parseSelections(),this.parseProjection(),this.parseData(),this.parseAxesAndHeaders(),this.parseLegends(),this.parseMarkGroup()}parseScale(){!function(e){let{ignoreRange:t}=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};ym(e),Rd(e);for(const t of Pr)dm(e,t);t||pm(e)}(this)}parseProjection(){Jf(this)}renameTopLevelLayoutSizeSignal(){"width"!==this.getName("width")&&this.renameSignal(this.getName("width"),"width"),"height"!==this.getName("height")&&this.renameSignal(this.getName("height"),"height")}parseLegends(){Rf(this)}assembleEncodeFromView(e){const{style:t,...n}=e,i={};for(const e of D(n)){const t=n[e];void 0!==t&&(i[e]=Fn(t))}return i}assembleGroupEncodeEntry(e){let t={};return this.view&&(t=this.assembleEncodeFromView(this.view)),e||(this.description&&(t.description=Fn(this.description)),"unit"!==this.type&&"layer"!==this.type)?S(t)?void 0:t:{width:this.getSizeSignalRef("width"),height:this.getSizeSignalRef("height"),...t??{}}}assembleLayout(){if(!this.layout)return;const{spacing:e,...t}=this.layout,{component:n,config:i}=this,r=function(e,t){const n={};for(const i of Re){const r=e[i];if(r?.facetFieldDef){const{titleAnchor:e,titleOrient:o}=cf(["titleAnchor","titleOrient"],r.facetFieldDef.header,t,i),a=sf(i,o),s=xf(e,a);void 0!==s&&(n[a]=s)}}return S(n)?void 0:n}(n.layoutHeaders,i);return{padding:e,...this.assembleDefaultLayout(),...t,...r?{titleBand:r}:{}}}assembleDefaultLayout(){return{}}assembleHeaderMarks(){const{layoutHeaders:e}=this.component;let t=[];for(const n of Re)e[n].title&&t.push(df(this,n));for(const e of uf)t=t.concat(gf(this,e));return t}assembleAxes(){return function(e,t){const{x:n=[],y:i=[]}=e;return[...n.map((e=>Yu(e,"grid",t))),...i.map((e=>Yu(e,"grid",t))),...n.map((e=>Yu(e,"main",t))),...i.map((e=>Yu(e,"main",t)))].filter((e=>e))}(this.component.axes,this.config)}assembleLegends(){return Vf(this)}assembleProjections(){return Gf(this)}assembleTitle(){const{encoding:e,...t}=this.title??{},n={...gn(this.config.title).nonMarkTitleProperties,...t,...e?{encode:{update:e}}:{}};if(n.text)return p(["unit","layer"],this.type)?p(["middle",void 0],n.anchor)&&(n.frame??="group"):n.anchor??="start",S(n)?void 0:n}assembleGroup(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const t={};e=e.concat(this.assembleSignals()),e.length>0&&(t.signals=e);const n=this.assembleLayout();n&&(t.layout=n),t.marks=[].concat(this.assembleHeaderMarks(),this.assembleMarks());const i=!this.parent||$m(this.parent)?Kd(this):[];i.length>0&&(t.scales=i);const r=this.assembleAxes();r.length>0&&(t.axes=r);const o=this.assembleLegends();return o.length>0&&(t.legends=o),t}getName(e){return _((this.name?`${this.name}_`:"")+e)}getDataName(e){return this.getName(fc[e].toLowerCase())}requestDataName(e){const t=this.getDataName(e),n=this.component.data.outputNodeRefCounts;return n[t]=(n[t]||0)+1,t}getSizeSignalRef(e){if($m(this.parent)){const t=Nt(Ff(e)),n=this.component.scales[t];if(n&&!n.merged){const e=n.get("type"),i=n.get("range");if(xr(e)&&vn(i)){const e=n.get("name"),i=Qd(Jd(this,t));if(i){return{signal:Df(e,n,oa({aggregate:"distinct",field:i},{expr:"datum"}))}}return $i(Yn(t)),null}}}return{signal:this.signalNameMap.get(this.getName(e))}}lookupDataSource(e){const t=this.component.data.outputNodes[e];return t?t.getSource():e}getSignalName(e){return this.signalNameMap.get(e)}renameSignal(e,t){this.signalNameMap.rename(e,t)}renameScale(e,t){this.scaleNameMap.rename(e,t)}renameProjection(e,t){this.projectionNameMap.rename(e,t)}scaleName(e,t){return t?this.getName(e):Ke(e)&&Ht(e)&&this.component.scales[e]||this.scaleNameMap.has(this.getName(e))?this.scaleNameMap.get(this.getName(e)):void 0}projectionName(e){return e?this.getName("projection"):this.component.projection&&!this.component.projection.merged||this.projectionNameMap.has(this.getName("projection"))?this.projectionNameMap.get(this.getName("projection")):void 0}getScaleComponent(e){if(!this.component.scales)throw new Error("getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().");const t=this.component.scales[e];return t&&!t.merged?t:this.parent?this.parent.getScaleComponent(e):void 0}getSelectionComponent(e,t){let n=this.component.selection[e];if(!n&&this.parent&&(n=this.parent.getSelectionComponent(e,t)),!n)throw new Error(function(e){return`Cannot find a selection named "${e}".`}(t));return n}hasAxisOrientSignalRef(){return this.component.axes.x?.some((e=>e.hasOrientSignalRef()))||this.component.axes.y?.some((e=>e.hasOrientSignalRef()))}}class Dm extends Sm{vgField(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const n=this.fieldDef(e);if(n)return oa(n,t)}reduceFieldDef(e,n){return function(e,n,i,r){return e?D(e).reduce(((i,o)=>{const a=e[o];return t.isArray(a)?a.reduce(((e,t)=>n.call(r,e,t,o)),i):n.call(r,i,a,o)}),i):i}(this.getMapping(),((t,n,i)=>{const r=pa(n);return r?e(t,r,i):t}),n)}forEachFieldDef(e,t){Wa(this.getMapping(),((t,n)=>{const i=pa(t);i&&e(i,n)}),t)}}class Fm extends vc{clone(){return new Fm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"value",n[1]??"density"]}dependentFields(){return new Set([this.transform.density,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`DensityTransform ${d(this.transform)}`}assemble(){const{density:e,...t}=this.transform,n={type:"kde",field:e,...t};return this.transform.groupby&&(n.resolve="shared"),n}}class zm extends vc{clone(){return new zm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t)}dependentFields(){return new Set([this.transform.extent])}producedFields(){return new Set([])}hash(){return`ExtentTransform ${d(this.transform)}`}assemble(){const{extent:e,param:t}=this.transform;return{type:"extent",field:e,signal:t}}}class Om extends vc{clone(){return new Om(null,{...this.filter})}constructor(e,t){super(e),this.filter=t}static make(e,t){const{config:n,mark:i,markDef:r}=t;if("filter"!==Cn("invalid",r,n))return null;const o=t.reduceFieldDef(((e,n,r)=>{const o=Ht(r)&&t.getScaleComponent(r);if(o){$r(o.get("type"))&&"count"!==n.aggregate&&!Qr(i)&&(e[n.field]=n)}return e}),{});return D(o).length?new Om(e,o):null}dependentFields(){return new Set(D(this.filter))}producedFields(){return new Set}hash(){return`FilterInvalid ${d(this.filter)}`}assemble(){const e=D(this.filter).reduce(((e,t)=>{const n=this.filter[t],i=oa(n,{expr:"datum"});return null!==n&&("temporal"===n.type?e.push(`(isDate(${i}) || (isValid(${i}) && isFinite(+${i})))`):"quantitative"===n.type&&(e.push(`isValid(${i})`),e.push(`isFinite(+${i})`))),e}),[]);return e.length>0?{type:"filter",expr:e.join(" && ")}:null}}class _m extends vc{clone(){return new _m(this.parent,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const{flatten:n,as:i=[]}=this.transform;this.transform.as=n.map(((e,t)=>i[t]??e))}dependentFields(){return new Set(this.transform.flatten)}producedFields(){return new Set(this.transform.as)}hash(){return`FlattenTransform ${d(this.transform)}`}assemble(){const{flatten:e,as:t}=this.transform;return{type:"flatten",fields:e,as:t}}}class Nm extends vc{clone(){return new Nm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"key",n[1]??"value"]}dependentFields(){return new Set(this.transform.fold)}producedFields(){return new Set(this.transform.as)}hash(){return`FoldTransform ${d(this.transform)}`}assemble(){const{fold:e,as:t}=this.transform;return{type:"fold",fields:e,as:t}}}class Cm extends vc{clone(){return new Cm(null,l(this.fields),this.geojson,this.signal)}static parseAll(e,t){if(t.component.projection&&!t.component.projection.isFit)return e;let n=0;for(const i of[[ue,ce],[de,fe]]){const r=i.map((e=>{const n=ga(t.encoding[e]);return Ho(n)?n.field:Go(n)?{expr:`${n.datum}`}:Zo(n)?{expr:`${n.value}`}:void 0}));(r[0]||r[1])&&(e=new Cm(e,r,null,t.getName("geojson_"+n++)))}if(t.channelHasField(he)){const i=t.typedFieldDef(he);i.type===lr&&(e=new Cm(e,null,i.field,t.getName("geojson_"+n++)))}return e}constructor(e,t,n,i){super(e),this.fields=t,this.geojson=n,this.signal=i}dependentFields(){const e=(this.fields??[]).filter(t.isString);return new Set([...this.geojson?[this.geojson]:[],...e])}producedFields(){return new Set}hash(){return`GeoJSON ${this.geojson} ${this.signal} ${d(this.fields)}`}assemble(){return[...this.geojson?[{type:"filter",expr:`isValid(datum["${this.geojson}"])`}]:[],{type:"geojson",...this.fields?{fields:this.fields}:{},...this.geojson?{geojson:this.geojson}:{},signal:this.signal}]}}class Pm extends vc{clone(){return new Pm(null,this.projection,l(this.fields),l(this.as))}constructor(e,t,n,i){super(e),this.projection=t,this.fields=n,this.as=i}static parseAll(e,t){if(!t.projectionName())return e;for(const n of[[ue,ce],[de,fe]]){const i=n.map((e=>{const n=ga(t.encoding[e]);return Ho(n)?n.field:Go(n)?{expr:`${n.datum}`}:Zo(n)?{expr:`${n.value}`}:void 0})),r=n[0]===de?"2":"";(i[0]||i[1])&&(e=new Pm(e,t.projectionName(),i,[t.getName(`x${r}`),t.getName(`y${r}`)]))}return e}dependentFields(){return new Set(this.fields.filter(t.isString))}producedFields(){return new Set(this.as)}hash(){return`Geopoint ${this.projection} ${d(this.fields)} ${d(this.as)}`}assemble(){return{type:"geopoint",projection:this.projection,fields:this.fields,as:this.as}}}class Am extends vc{clone(){return new Am(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set([this.transform.impute,this.transform.key,...this.transform.groupby??[]])}producedFields(){return new Set([this.transform.impute])}processSequence(e){const{start:t=0,stop:n,step:i}=e;return{signal:`sequence(${[t,n,...i?[i]:[]].join(",")})`}}static makeFromTransform(e,t){return new Am(e,t)}static makeFromEncoding(e,t){const n=t.encoding,i=n.x,r=n.y;if(Ho(i)&&Ho(r)){const o=i.impute?i:r.impute?r:void 0;if(void 0===o)return;const a=i.impute?r:r.impute?i:void 0,{method:s,value:l,frame:c,keyvals:u}=o.impute,f=Ba(t.mark,n);return new Am(e,{impute:o.field,key:a.field,...s?{method:s}:{},...void 0!==l?{value:l}:{},...c?{frame:c}:{},...void 0!==u?{keyvals:u}:{},...f.length?{groupby:f}:{}})}return null}hash(){return`Impute ${d(this.transform)}`}assemble(){const{impute:e,key:t,keyvals:n,method:i,groupby:r,value:o,frame:a=[null,null]}=this.transform,s={type:"impute",field:e,key:t,...n?{keyvals:(l=n,void 0!==l?.stop?this.processSequence(n):n)}:{},method:"value",...r?{groupby:r}:{},value:i&&"value"!==i?null:o};var l;if(i&&"value"!==i){return[s,{type:"window",as:[`imputed_${e}_value`],ops:[i],fields:[e],frame:a,ignorePeers:!1,...r?{groupby:r}:{}},{type:"formula",expr:`datum.${e} === null ? datum.imputed_${e}_value : datum.${e}`,as:e}]}return[s]}}class jm extends vc{clone(){return new jm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.loess]}dependentFields(){return new Set([this.transform.loess,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`LoessTransform ${d(this.transform)}`}assemble(){const{loess:e,on:t,...n}=this.transform;return{type:"loess",x:t,y:e,...n}}}class Tm extends vc{clone(){return new Tm(null,l(this.transform),this.secondary)}constructor(e,t,n){super(e),this.transform=t,this.secondary=n}static make(e,t,n,i){const r=t.component.data.sources,{from:o}=n;let a=null;if(function(e){return"data"in e}(o)){let e=Qm(o.data,r);e||(e=new md(o.data),r.push(e));const n=t.getName(`lookup_${i}`);a=new bc(e,n,fc.Lookup,t.component.data.outputNodeRefCounts),t.component.data.outputNodes[n]=a}else if(function(e){return"param"in e}(o)){const e=o.param;let i;n={as:e,...n};try{i=t.getSelectionComponent(_(e),e)}catch(t){throw new Error(function(e){return`Lookups can only be performed on selection parameters. "${e}" is a variable parameter.`}(e))}if(a=i.materialized,!a)throw new Error(function(e){return`Cannot define and lookup the "${e}" selection in the same view. Try moving the lookup into a second, layered view?`}(e))}return new Tm(e,n,a.getSource())}dependentFields(){return new Set([this.transform.lookup])}producedFields(){return new Set(this.transform.as?t.array(this.transform.as):this.transform.from.fields)}hash(){return`Lookup ${d({transform:this.transform,secondary:this.secondary})}`}assemble(){let e;if(this.transform.from.fields)e={values:this.transform.from.fields,...this.transform.as?{as:t.array(this.transform.as)}:{}};else{let n=this.transform.as;t.isString(n)||($i('If "from.fields" is not specified, "as" has to be a string that specifies the key to be used for the data from the secondary source.'),n="_lookup"),e={as:[n]}}return{type:"lookup",from:this.secondary,key:this.transform.from.key,fields:[this.transform.lookup],...e,...this.transform.default?{default:this.transform.default}:{}}}}class Em extends vc{clone(){return new Em(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??"prob",n[1]??"value"]}dependentFields(){return new Set([this.transform.quantile,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`QuantileTransform ${d(this.transform)}`}assemble(){const{quantile:e,...t}=this.transform;return{type:"quantile",field:e,...t}}}class Mm extends vc{clone(){return new Mm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t,this.transform=l(t);const n=this.transform.as??[void 0,void 0];this.transform.as=[n[0]??t.on,n[1]??t.regression]}dependentFields(){return new Set([this.transform.regression,this.transform.on,...this.transform.groupby??[]])}producedFields(){return new Set(this.transform.as)}hash(){return`RegressionTransform ${d(this.transform)}`}assemble(){const{regression:e,on:t,...n}=this.transform;return{type:"regression",x:t,y:e,...n}}}class Lm extends vc{clone(){return new Lm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}addDimensions(e){this.transform.groupby=b((this.transform.groupby??[]).concat(e),(e=>e))}producedFields(){}dependentFields(){return new Set([this.transform.pivot,this.transform.value,...this.transform.groupby??[]])}hash(){return`PivotTransform ${d(this.transform)}`}assemble(){const{pivot:e,value:t,groupby:n,limit:i,op:r}=this.transform;return{type:"pivot",field:e,value:t,...void 0!==i?{limit:i}:{},...void 0!==r?{op:r}:{},...void 0!==n?{groupby:n}:{}}}}class qm extends vc{clone(){return new qm(null,l(this.transform))}constructor(e,t){super(e),this.transform=t}dependentFields(){return new Set}producedFields(){return new Set}hash(){return`SampleTransform ${d(this.transform)}`}assemble(){return{type:"sample",size:this.transform.sample}}}function Um(e){let t=0;return function n(i,r){if(i instanceof md&&!i.isGenerator&&!rc(i.data)){e.push(r);r={name:null,source:r.name,transform:[]}}if(i instanceof cd&&(i.parent instanceof md&&!r.source?(r.format={...r.format??{},parse:i.assembleFormatParse()},r.transform.push(...i.assembleTransforms(!0))):r.transform.push(...i.assembleTransforms())),i instanceof od)return r.name||(r.name="data_"+t++),!r.source||r.transform.length>0?(e.push(r),i.data=r.name):i.data=r.source,void e.push(...i.assemble());if((i instanceof fd||i instanceof dd||i instanceof Om||i instanceof Bu||i instanceof of||i instanceof Pm||i instanceof rd||i instanceof Tm||i instanceof Pd||i instanceof Nd||i instanceof Nm||i instanceof _m||i instanceof Fm||i instanceof jm||i instanceof Em||i instanceof Mm||i instanceof ud||i instanceof qm||i instanceof Lm||i instanceof zm)&&r.transform.push(i.assemble()),(i instanceof nd||i instanceof wc||i instanceof Am||i instanceof Cd||i instanceof Cm)&&r.transform.push(...i.assemble()),i instanceof bc)if(r.source&&0===r.transform.length)i.setSource(r.source);else if(i.parent instanceof bc)i.setSource(r.name);else if(r.name||(r.name="data_"+t++),i.setSource(r.name),1===i.numChildren()){e.push(r);r={name:null,source:r.name,transform:[]}}switch(i.numChildren()){case 0:i instanceof bc&&(!r.source||r.transform.length>0)&&e.push(r);break;case 1:n(i.children[0],r);break;default:{r.name||(r.name="data_"+t++);let o=r.name;!r.source||r.transform.length>0?e.push(r):o=r.source;for(const e of i.children){n(e,{name:null,source:o,transform:[]})}break}}}}function Rm(e){return"top"===e||"left"===e||yn(e)?"header":"footer"}function Wm(e,n){const{facet:i,config:r,child:o,component:a}=e;if(e.channelHasField(n)){const s=i[n],l=lf("title",null,r,n);let c=ua(s,r,{allowDisabling:!0,includeDefault:void 0===l||!!l});o.component.layoutHeaders[n].title&&(c=t.isArray(c)?c.join(", "):c,c+=` / ${o.component.layoutHeaders[n].title}`,o.component.layoutHeaders[n].title=null);const u=lf("labelOrient",s.header,r,n),f=null!==s.header&&U(s.header?.labels,r.header.labels,!0),d=p(["bottom","right"],u)?"footer":"header";a.layoutHeaders[n]={title:null!==s.header?c:null,facetFieldDef:s,[d]:"facet"===n?[]:[Bm(e,n,f)]}}}function Bm(e,t,n){const i="row"===t?"height":"width";return{labels:n,sizeSignal:e.child.component.layoutSize.get(i)?e.child.getSizeSignalRef(i):void 0,axes:[]}}function Im(e,t){const{child:n}=e;if(n.component.axes[t]){const{layoutHeaders:i,resolve:r}=e.component;if(r.axis[t]=_f(r,t),"shared"===r.axis[t]){const r="x"===t?"column":"row",o=i[r];for(const i of n.component.axes[t]){const t=Rm(i.get("orient"));o[t]??=[Bm(e,r,!1)];const n=Yu(i,"main",e.config,{header:!0});n&&o[t][0].axes.push(n),i.mainExtracted=!0}}}}function Hm(e){for(const t of e.children)t.parseLayoutSize()}function Vm(e,t){const n=Ff(t),i=Nt(n),r=e.component.resolve,o=e.component.layoutSize;let a;for(const t of e.children){const o=t.component.layoutSize.getWithExplicit(n),s=r.scale[i]??Of(i,e);if("independent"===s&&"step"===o.value){a=void 0;break}if(a){if("independent"===s&&a.value!==o.value){a=void 0;break}a=nc(a,o,n,"")}else a=o}if(a){for(const i of e.children)e.renameSignal(i.getName(n),e.getName(t)),i.component.layoutSize.set(n,"merged",!1);o.setWithExplicit(t,a)}else o.setWithExplicit(t,{explicit:!1,value:void 0})}function Gm(e,t){const n="width"===t?"x":"y",i=e.config,r=e.getScaleComponent(n);if(r){const e=r.get("type"),n=r.get("range");if(xr(e)){const e=Ts(i.view,t);return vn(n)||Ns(e)?"step":e}return As(i.view,t)}if(e.hasProjection||"arc"===e.mark)return As(i.view,t);{const e=Ts(i.view,t);return Ns(e)?e.step:e}}function Ym(e,t,n){return oa(t,{suffix:`by_${oa(e)}`,...n??{}})}class Xm extends Dm{constructor(e,t,n,i){super(e,"facet",t,n,i,e.resolve),qn(this,"facet",void 0),qn(this,"child",void 0),qn(this,"children",void 0),this.child=wp(e.spec,this,this.getName("child"),void 0,i),this.children=[this.child],this.facet=this.initFacet(e.facet)}initFacet(e){if(!Ao(e))return{facet:this.initFacetFieldDef(e,"facet")};const t=D(e),n={};for(const i of t){if(![Q,J].includes(i)){$i(ai(i,"facet"));break}const t=e[i];if(void 0===t.field){$i(oi(t,i));break}n[i]=this.initFacetFieldDef(t,i)}return n}initFacetFieldDef(e,t){const n=va(e,t);return n.header?n.header=pn(n.header):null===n.header&&(n.header=null),n}channelHasField(e){return!!this.facet[e]}fieldDef(e){return this.facet[e]}parseData(){this.component.data=Jm(this),this.child.parseData()}parseLayoutSize(){Hm(this)}parseSelections(){this.child.parseSelections(),this.component.selection=this.child.component.selection}parseMarkGroup(){this.child.parseMarkGroup()}parseAxesAndHeaders(){this.child.parseAxesAndHeaders(),function(e){for(const t of Re)Wm(e,t);Im(e,"x"),Im(e,"y")}(this)}assembleSelectionTopLevelSignals(e){return this.child.assembleSelectionTopLevelSignals(e)}assembleSignals(){return this.child.assembleSignals(),[]}assembleSelectionData(e){return this.child.assembleSelectionData(e)}getHeaderLayoutMixins(){const e={};for(const t of Re)for(const n of ff){const i=this.component.layoutHeaders[t],r=i[n],{facetFieldDef:o}=i;if(o){const n=lf("titleOrient",o.header,this.config,t);if(["right","bottom"].includes(n)){const i=sf(t,n);e.titleAnchor??={},e.titleAnchor[i]="end"}}if(r?.[0]){const r="row"===t?"height":"width",o="header"===n?"headerBand":"footerBand";"facet"===t||this.child.component.layoutSize.get(r)||(e[o]??={},e[o][t]=.5),i.title&&(e.offset??={},e.offset["row"===t?"rowTitle":"columnTitle"]=10)}}return e}assembleDefaultLayout(){const{column:e,row:t}=this.facet,n=e?this.columnDistinctSignal():t?1:void 0;let i="all";return(t||"independent"!==this.component.resolve.scale.x)&&(e||"independent"!==this.component.resolve.scale.y)||(i="none"),{...this.getHeaderLayoutMixins(),...n?{columns:n}:{},bounds:"full",align:i}}assembleLayoutSignals(){return this.child.assembleLayoutSignals()}columnDistinctSignal(){if(!(this.parent&&this.parent instanceof Xm)){return{signal:`length(data('${this.getName("column_domain")}'))`}}}assembleGroupStyle(){}assembleGroup(e){return this.parent&&this.parent instanceof Xm?{...this.channelHasField("column")?{encode:{update:{columns:{field:oa(this.facet.column,{prefix:"distinct"})}}}}:{},...super.assembleGroup(e)}:super.assembleGroup(e)}getCardinalityAggregateForChild(){const e=[],t=[],n=[];if(this.child instanceof Xm){if(this.child.channelHasField("column")){const i=oa(this.child.facet.column);e.push(i),t.push("distinct"),n.push(`distinct_${i}`)}}else for(const i of Ft){const r=this.child.component.scales[i];if(r&&!r.merged){const o=r.get("type"),a=r.get("range");if(xr(o)&&vn(a)){const r=Qd(Jd(this.child,i));r?(e.push(r),t.push("distinct"),n.push(`distinct_${r}`)):$i(Yn(i))}}}return{fields:e,ops:t,as:n}}assembleFacet(){const{name:e,data:n}=this.component.data.facetRoot,{row:i,column:r}=this.facet,{fields:o,ops:a,as:s}=this.getCardinalityAggregateForChild(),l=[];for(const e of Re){const n=this.facet[e];if(n){l.push(oa(n));const{bin:c,sort:u}=n;if(ln(c)&&l.push(oa(n,{binSuffix:"end"})),Co(u)){const{field:e,op:t=zo}=u,l=Ym(n,u);i&&r?(o.push(l),a.push("max"),s.push(l)):(o.push(e),a.push(t),s.push(l))}else if(t.isArray(u)){const t=af(n,e);o.push(t),a.push("max"),s.push(t)}}}const c=!!i&&!!r;return{name:e,data:n,groupby:l,...c||o.length>0?{aggregate:{...c?{cross:c}:{},...o.length?{fields:o,ops:a,as:s}:{}}}:{}}}facetSortFields(e){const{facet:n}=this,i=n[e];return i?Co(i.sort)?[Ym(i,i.sort,{expr:"datum"})]:t.isArray(i.sort)?[af(i,e,{expr:"datum"})]:[oa(i,{expr:"datum"})]:[]}facetSortOrder(e){const{facet:n}=this,i=n[e];if(i){const{sort:e}=i;return[(Co(e)?e.order:!t.isArray(e)&&e)||"ascending"]}return[]}assembleLabelTitle(){const{facet:e,config:t}=this;if(e.facet)return yf(e.facet,"facet",t);const n={row:["top","bottom"],column:["left","right"]};for(const i of uf)if(e[i]){const r=lf("labelOrient",e[i]?.header,t,i);if(n[i].includes(r))return yf(e[i],i,t)}}assembleMarks(){const{child:e}=this,t=function(e){const t=[],n=Um(t);for(const t of e.children)n(t,{source:e.name,name:null,transform:[]});return t}(this.component.data.facetRoot),n=e.assembleGroupEncodeEntry(!1),i=this.assembleLabelTitle()||e.assembleTitle(),r=e.assembleGroupStyle();return[{name:this.getName("cell"),type:"group",...i?{title:i}:{},...r?{style:r}:{},from:{facet:this.assembleFacet()},sort:{field:Re.map((e=>this.facetSortFields(e))).flat(),order:Re.map((e=>this.facetSortOrder(e))).flat()},...t.length>0?{data:t}:{},...n?{encode:{update:n}}:{},...e.assembleGroup(gc(this,[]))}]}getMapping(){return this.facet}}function Qm(e,t){for(const n of t){const t=n.data;if(e.name&&n.hasName()&&e.name!==n.dataName)continue;const i=e.format?.mesh,r=t.format?.feature;if(i&&r)continue;const o=e.format?.feature;if((o||r)&&o!==r)continue;const a=t.format?.mesh;if(!i&&!a||i===a)if(oc(e)&&oc(t)){if(Y(e.values,t.values))return n}else if(rc(e)&&rc(t)){if(e.url===t.url)return n}else if(ac(e)&&e.name===n.dataName)return n}return null}function Jm(e){let t=function(e,t){if(e.data||!e.parent){if(null===e.data){const e=new md({values:[]});return t.push(e),e}const n=Qm(e.data,t);if(n)return sc(e.data)||(n.data.format=y({},e.data.format,n.data.format)),!n.hasName()&&e.data.name&&(n.dataName=e.data.name),n;{const n=new md(e.data);return t.push(n),n}}return e.parent.component.data.facetRoot?e.parent.component.data.facetRoot:e.parent.component.data.main}(e,e.component.data.sources);const{outputNodes:n,outputNodeRefCounts:i}=e.component.data,r=e.data,o=!(r&&(sc(r)||rc(r)||oc(r)))&&e.parent?e.parent.component.data.ancestorParse.clone():new ic;sc(r)?(lc(r)?t=new dd(t,r.sequence):uc(r)&&(t=new fd(t,r.graticule)),o.parseNothing=!0):null===r?.format?.parse&&(o.parseNothing=!0),t=cd.makeExplicit(t,e,o)??t,t=new ud(t);const a=e.parent&&km(e.parent);(xm(e)||$m(e))&&a&&(t=nd.makeFromEncoding(t,e)??t),e.transforms.length>0&&(t=function(e,t,n){let i=0;for(const r of t.transforms){let o,a;if(Nl(r))a=e=new of(e,r),o="derived";else if(bl(r)){const i=sd(r);a=e=cd.makeWithAncestors(e,{},i,n)??e,e=new Bu(e,t,r.filter)}else if(Cl(r))a=e=nd.makeFromTransform(e,r,t),o="number";else if(Al(r))o="date",void 0===n.getWithExplicit(r.field).value&&(e=new cd(e,{[r.field]:o}),n.set(r.field,o,!1)),a=e=wc.makeFromTransform(e,r);else if(jl(r))a=e=rd.makeFromTransform(e,r),o="number",Lu(t)&&(e=new ud(e));else if(xl(r))a=e=Tm.make(e,t,r,i++),o="derived";else if(zl(r))a=e=new Pd(e,r),o="number";else if(Ol(r))a=e=new Nd(e,r),o="number";else if(Tl(r))a=e=Cd.makeFromTransform(e,r),o="derived";else if(El(r))a=e=new Nm(e,r),o="derived";else if(Ml(r))a=e=new zm(e,r),o="derived";else if(_l(r))a=e=new _m(e,r),o="derived";else if($l(r))a=e=new Lm(e,r),o="derived";else if(Fl(r))e=new qm(e,r);else if(Pl(r))a=e=Am.makeFromTransform(e,r),o="derived";else if(wl(r))a=e=new Fm(e,r),o="derived";else if(kl(r))a=e=new Em(e,r),o="derived";else if(Sl(r))a=e=new Mm(e,r),o="derived";else{if(!Dl(r)){$i(`Ignoring an invalid transform: ${X(r)}.`);continue}a=e=new jm(e,r),o="derived"}if(a&&void 0!==o)for(const e of a.producedFields()??[])n.set(e,o,!1)}return e}(t,e,o));const s=function(e){const t={};if(xm(e)&&e.component.selection)for(const n of D(e.component.selection)){const i=e.component.selection[n];for(const e of i.project.items)!e.channel&&q(e.field)>1&&(t[e.field]="flatten")}return t}(e),l=ld(e);t=cd.makeWithAncestors(t,{},{...s,...l},o)??t,xm(e)&&(t=Cm.parseAll(t,e),t=Pm.parseAll(t,e)),(xm(e)||$m(e))&&(a||(t=nd.makeFromEncoding(t,e)??t),t=wc.makeFromEncoding(t,e)??t,t=of.parseAllForSortIndex(t,e));const c=e.getDataName(fc.Raw),u=new bc(t,c,fc.Raw,i);if(n[c]=u,t=u,xm(e)){const n=rd.makeFromEncoding(t,e);n&&(t=n,Lu(e)&&(t=new ud(t))),t=Am.makeFromEncoding(t,e)??t,t=Cd.makeFromEncoding(t,e)??t}xm(e)&&(t=Om.make(t,e)??t);const f=e.getDataName(fc.Main),d=new bc(t,f,fc.Main,i);n[f]=d,t=d,xm(e)&&function(e,t){for(const[n,i]of z(e.component.selection??{})){const r=e.getName(`lookup_${n}`);e.component.data.outputNodes[r]=i.materialized=new bc(new Bu(t,e,{param:n}),r,fc.Lookup,e.component.data.outputNodeRefCounts)}}(e,d);let m=null;if($m(e)){const i=e.getName("facet");t=function(e,t){const{row:n,column:i}=t;if(n&&i){let t=null;for(const r of[n,i])if(Co(r.sort)){const{field:n,op:i=zo}=r.sort;e=t=new Nd(e,{joinaggregate:[{op:i,field:n,as:Ym(r,r.sort,{forAs:!0})}],groupby:[oa(r)]})}return t}return null}(t,e.facet)??t,m=new od(t,e,i,d.getSource()),n[i]=m}return{...e.component.data,outputNodes:n,outputNodeRefCounts:i,raw:u,main:d,facetRoot:m,ancestorParse:o}}class Km extends Sm{constructor(e,t,n,i){super(e,"concat",t,n,i,e.resolve),qn(this,"children",void 0),"shared"!==e.resolve?.axis?.x&&"shared"!==e.resolve?.axis?.y||$i("Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415)."),this.children=this.getChildren(e).map(((e,t)=>wp(e,this,this.getName(`concat_${t}`),void 0,i)))}parseData(){this.component.data=Jm(this);for(const e of this.children)e.parseData()}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){for(const e of this.children)e.parseAxesAndHeaders()}getChildren(e){return zs(e)?e.vconcat:Os(e)?e.hconcat:e.concat}parseLayoutSize(){!function(e){Hm(e);const t=1===e.layout.columns?"width":"childWidth",n=void 0===e.layout.columns?"height":"childHeight";Vm(e,t),Vm(e,n)}(this)}parseAxisGroup(){return null}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.forEach((e=>e.assembleSignals())),[]}assembleLayoutSignals(){const e=wf(this);for(const t of this.children)e.push(...t.assembleLayoutSignals());return e}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleMarks(){return this.children.map((e=>{const t=e.assembleTitle(),n=e.assembleGroupStyle(),i=e.assembleGroupEncodeEntry(!1);return{type:"group",name:e.getName("group"),...t?{title:t}:{},...n?{style:n}:{},...i?{encode:{update:i}}:{},...e.assembleGroup()}}))}assembleGroupStyle(){}assembleDefaultLayout(){const e=this.layout.columns;return{...null!=e?{columns:e}:{},bounds:"full",align:"each"}}}const Zm={disable:1,gridScale:1,scale:1,..._a,labelExpr:1,encode:1},ep=D(Zm);class tp extends Jl{constructor(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];super(),this.explicit=e,this.implicit=t,this.mainExtracted=n}clone(){return new tp(l(this.explicit),l(this.implicit),this.mainExtracted)}hasAxisPart(e){return"axis"===e||("grid"===e||"title"===e?!!this.get(e):!(!1===(t=this.get(e))||null===t));var t}hasOrientSignalRef(){return yn(this.explicit.orient)}}const np={bottom:"top",top:"bottom",left:"right",right:"left"};function ip(e,t){if(!e)return t.map((e=>e.clone()));{if(e.length!==t.length)return;const n=e.length;for(let i=0;i{switch(n){case"title":return Ln(e,t);case"gridScale":return{explicit:e.explicit,value:U(e.value,t.value)}}return tc(e,t,n,"axis")}));e.setWithExplicit(n,i)}return e}function op(e,t,n,i,r){if("disable"===t)return void 0!==n;switch(n=n||{},t){case"titleAngle":case"labelAngle":return e===(yn(n.labelAngle)?n.labelAngle:H(n.labelAngle));case"values":return!!n.values;case"encode":return!!n.encoding||!!n.labelAngle;case"title":if(e===rf(i,r))return!0}return e===n[t]}const ap=new Set(["grid","translate","format","formatType","orient","labelExpr","tickCount","position","tickMinStep"]);function sp(e,t){let n=t.axis(e);const i=new tp,r=ga(t.encoding[e]),{mark:o,config:a}=t,s=n?.orient||a["x"===e?"axisX":"axisY"]?.orient||a.axis?.orient||function(e){return"x"===e?"bottom":"left"}(e),l=t.getScaleComponent(e).get("type"),c=function(e,t,n,i){const r="band"===t?["axisDiscrete","axisBand"]:"point"===t?["axisDiscrete","axisPoint"]:hr(t)?["axisQuantitative"]:"time"===t||"utc"===t?["axisTemporal"]:[],o="x"===e?"axisX":"axisY",a=yn(n)?"axisOrient":`axis${P(n)}`,s=[...r,...r.map((e=>o+e.substr(4)))],l=["axis",a,o];return{vlOnlyAxisConfig:Qu(s,i,e,n),vgAxisConfig:Qu(l,i,e,n),axisConfigStyle:Ju([...l,...s],i)}}(e,l,s,t.config),u=void 0!==n?!n:Ku("disable",a.style,n?.style,c).configValue;if(i.set("disable",u,void 0!==n),u)return i;n=n||{};const f=function(e,t,n,i,r){const o=t?.labelAngle;if(void 0!==o)return yn(o)?o:H(o);{const{configValue:o}=Ku("labelAngle",i,t?.style,r);return void 0!==o?H(o):n!==Z||!p([sr,or],e.type)||Ho(e)&&e.timeUnit?void 0:270}}(r,n,e,a.style,c),d=wo(n.formatType,r,l),m=$o(r,r.type,n.format,n.formatType,a,!0),g={fieldOrDatumDef:r,axis:n,channel:e,model:t,scaleType:l,orient:s,labelAngle:f,format:m,formatType:d,mark:o,config:a};for(const r of ep){const o=r in Zu?Zu[r](g):Ca(r)?n[r]:void 0,s=void 0!==o,l=op(o,r,n,t,e);if(s&&l)i.set(r,o,l);else{const{configValue:e,configFrom:t}=Ca(r)&&"values"!==r?Ku(r,a.style,n.style,c):{},u=void 0!==e;s&&!u?i.set(r,o,l):("vgAxisConfig"!==t||ap.has(r)&&u||Fa(e)||yn(e))&&i.set(r,e,!1)}}const h=n.encoding??{},y=za.reduce(((n,r)=>{if(!i.hasAxisPart(r))return n;const o=zf(h[r]??{},t),a="labels"===r?function(e,t,n){const{encoding:i,config:r}=e,o=ga(i[t])??ga(i[it(t)]),a=e.axis(t)||{},{format:s,formatType:l}=a;if(go(l))return{text:xo({fieldOrDatumDef:o,field:"datum.value",format:s,formatType:l,config:r}),...n};if(void 0===s&&void 0===l&&r.customFormatTypes){if("quantitative"===Vo(o)){if(ta(o)&&"normalize"===o.stack&&r.normalizedNumberFormatType)return{text:xo({fieldOrDatumDef:o,field:"datum.value",format:r.normalizedNumberFormat,formatType:r.normalizedNumberFormatType,config:r}),...n};if(r.numberFormatType)return{text:xo({fieldOrDatumDef:o,field:"datum.value",format:r.numberFormat,formatType:r.numberFormatType,config:r}),...n}}if("temporal"===Vo(o)&&r.timeFormatType&&Ho(o)&&!o.timeUnit)return{text:xo({fieldOrDatumDef:o,field:"datum.value",format:r.timeFormat,formatType:r.timeFormatType,config:r}),...n}}return n}(t,e,o):o;return void 0===a||S(a)||(n[r]={update:a}),n}),{});return S(y)||i.set("encode",y,!!n.encoding||void 0!==n.labelAngle),i}function lp(e,t){const{config:n}=e;return{...du(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Zc("x",e,{defaultPos:"mid"}),...Zc("y",e,{defaultPos:"mid"}),...Xc("size",e),...Xc("angle",e),...cp(e,n,t)}}function cp(e,t,n){return n?{shape:{value:n}}:Xc("shape",e)}const up={vgMark:"rule",encodeEntry:e=>{const{markDef:t}=e,n=t.orient;return e.encoding.x||e.encoding.y||e.encoding.latitude||e.encoding.longitude?{...du(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...ru("x",e,{defaultPos:"horizontal"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"vertical"!==n}),...ru("y",e,{defaultPos:"vertical"===n?"zeroOrMax":"mid",defaultPos2:"zeroOrMin",range:"horizontal"!==n}),...Xc("size",e,{vgChannel:"strokeWidth"})}:{}}};function fp(e,t,n){if(void 0===Cn("align",e,n))return"center"}function dp(e,t,n){if(void 0===Cn("baseline",e,n))return"middle"}const mp={vgMark:"rect",encodeEntry:e=>{const{config:t,markDef:n}=e,i=n.orient,r="horizontal"===i?"width":"height",o="horizontal"===i?"height":"width";return{...du(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...Zc("x",e,{defaultPos:"mid",vgChannel:"xc"}),...Zc("y",e,{defaultPos:"mid",vgChannel:"yc"}),...Xc("size",e,{defaultValue:pp(e),vgChannel:r}),[o]:Fn(Cn("thickness",n,t))}}};function pp(e){const{config:n,markDef:i}=e,{orient:r}=i,o="horizontal"===r?"width":"height",a=e.getScaleComponent("horizontal"===r?"x":"y"),s=Cn("size",i,n,{vgChannel:o})??n.tick.bandSize;if(void 0!==s)return s;{const e=a?a.get("range"):void 0;if(e&&vn(e)&&t.isNumber(e.step))return 3*e.step/4;return 3*js(n.view,o)/4}}const gp={arc:{vgMark:"arc",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Zc("x",e,{defaultPos:"mid"}),...Zc("y",e,{defaultPos:"mid"}),...su(e,"radius"),...su(e,"theta")})},area:{vgMark:"area",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",orient:"include",size:"ignore",theta:"ignore"}),...ru("x",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"horizontal"===e.markDef.orient}),...ru("y",e,{defaultPos:"zeroOrMin",defaultPos2:"zeroOrMin",range:"vertical"===e.markDef.orient}),...gu(e)})},bar:{vgMark:"rect",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...su(e,"x"),...su(e,"y")})},circle:{vgMark:"symbol",encodeEntry:e=>lp(e,"circle")},geoshape:{vgMark:"shape",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"})}),postEncodingTransform:e=>{const{encoding:t}=e,n=t.shape;return[{type:"geoshape",projection:e.projectionName(),...n&&Ho(n)&&n.type===lr?{field:oa(n,{expr:"datum"})}:{}}]}},image:{vgMark:"image",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"ignore",orient:"ignore",size:"ignore",theta:"ignore"}),...su(e,"x"),...su(e,"y"),...Rc(e,"url")})},line:{vgMark:"line",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",size:"ignore",orient:"ignore",theta:"ignore"}),...Zc("x",e,{defaultPos:"mid"}),...Zc("y",e,{defaultPos:"mid"}),...Xc("size",e,{vgChannel:"strokeWidth"}),...gu(e)})},point:{vgMark:"symbol",encodeEntry:e=>lp(e)},rect:{vgMark:"rect",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",orient:"ignore",size:"ignore",theta:"ignore"}),...su(e,"x"),...su(e,"y")})},rule:up,square:{vgMark:"symbol",encodeEntry:e=>lp(e,"square")},text:{vgMark:"text",encodeEntry:e=>{const{config:t,encoding:n}=e;return{...du(e,{align:"include",baseline:"include",color:"include",size:"ignore",orient:"ignore",theta:"include"}),...Zc("x",e,{defaultPos:"mid"}),...Zc("y",e,{defaultPos:"mid"}),...Rc(e),...Xc("size",e,{vgChannel:"fontSize"}),...Xc("angle",e),...hu("align",fp(e.markDef,n,t)),...hu("baseline",dp(e.markDef,n,t)),...Zc("radius",e,{defaultPos:null}),...Zc("theta",e,{defaultPos:null})}}},tick:mp,trail:{vgMark:"trail",encodeEntry:e=>({...du(e,{align:"ignore",baseline:"ignore",color:"include",size:"include",orient:"ignore",theta:"ignore"}),...Zc("x",e,{defaultPos:"mid"}),...Zc("y",e,{defaultPos:"mid"}),...Xc("size",e),...gu(e)})}};function hp(e){if(p([Ur,Mr,Vr],e.mark)){const t=Ba(e.mark,e.encoding);if(t.length>0)return function(e,t){return[{name:e.getName("pathgroup"),type:"group",from:{facet:{name:yp+e.requestDataName(fc.Main),data:e.requestDataName(fc.Main),groupby:t}},encode:{update:{width:{field:{group:"width"}},height:{field:{group:"height"}}}},marks:bp(e,{fromPrefix:yp})}]}(e,t)}else if(e.mark===Lr){const t=wn.some((t=>Cn(t,e.markDef,e.config)));if(e.stack&&!e.fieldDef("size")&&t)return function(e){const[t]=bp(e,{fromPrefix:vp}),n=e.scaleName(e.stack.fieldChannel),i=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.vgField(e.stack.fieldChannel,t)},r=(e,t)=>`${e}(${[i({prefix:"min",suffix:"start",expr:t}),i({prefix:"max",suffix:"start",expr:t}),i({prefix:"min",suffix:"end",expr:t}),i({prefix:"max",suffix:"end",expr:t})].map((e=>`scale('${n}',${e})`)).join(",")})`;let o,a;"x"===e.stack.fieldChannel?(o={...u(t.encode.update,["y","yc","y2","height",...wn]),x:{signal:r("min","datum")},x2:{signal:r("max","datum")},clip:{value:!0}},a={x:{field:{group:"x"},mult:-1},height:{field:{group:"height"}}},t.encode.update={...f(t.encode.update,["y","yc","y2"]),height:{field:{group:"height"}}}):(o={...u(t.encode.update,["x","xc","x2","width"]),y:{signal:r("min","datum")},y2:{signal:r("max","datum")},clip:{value:!0}},a={y:{field:{group:"y"},mult:-1},width:{field:{group:"width"}}},t.encode.update={...f(t.encode.update,["x","xc","x2"]),width:{field:{group:"width"}}});for(const n of wn){const i=Pn(n,e.markDef,e.config);t.encode.update[n]?(o[n]=t.encode.update[n],delete t.encode.update[n]):i&&(o[n]=Fn(i)),i&&(t.encode.update[n]={value:0})}const s=[];if(e.stack.groupbyChannels?.length>0)for(const t of e.stack.groupbyChannels){const n=e.fieldDef(t),i=oa(n);i&&s.push(i),(n?.bin||n?.timeUnit)&&s.push(oa(n,{binSuffix:"end"}))}o=["stroke","strokeWidth","strokeJoin","strokeCap","strokeDash","strokeDashOffset","strokeMiterLimit","strokeOpacity"].reduce(((n,i)=>{if(t.encode.update[i])return{...n,[i]:t.encode.update[i]};{const t=Pn(i,e.markDef,e.config);return void 0!==t?{...n,[i]:Fn(t)}:n}}),o),o.stroke&&(o.strokeForeground={value:!0},o.strokeOffset={value:0});return[{type:"group",from:{facet:{data:e.requestDataName(fc.Main),name:vp+e.requestDataName(fc.Main),groupby:s,aggregate:{fields:[i({suffix:"start"}),i({suffix:"start"}),i({suffix:"end"}),i({suffix:"end"})],ops:["min","max","min","max"]}}},encode:{update:o},marks:[{type:"group",encode:{update:a},marks:[t]}]}]}(e)}return bp(e)}const yp="faceted_path_";const vp="stack_group_";function bp(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{fromPrefix:""};const{mark:i,markDef:r,encoding:o,config:a}=e,s=U(r.clip,function(e){const t=e.getScaleComponent("x"),n=e.getScaleComponent("y");return!(!t?.get("selectionExtent")&&!n?.get("selectionExtent"))||void 0}(e),function(e){const t=e.component.projection;return!(!t||t.isFit)||void 0}(e)),l=Nn(r),c=o.key,u=function(e){const{encoding:n,stack:i,mark:r,markDef:o,config:a}=e,s=n.order;if(!(!t.isArray(s)&&Zo(s)&&m(s.value)||!s&&m(Cn("order",o,a)))){if((t.isArray(s)||Ho(s))&&!i)return Tn(s,{expr:"datum"});if(Qr(r)){const i="horizontal"===o.orient?"y":"x",r=n[i];if(Ho(r)){const n=r.sort;return t.isArray(n)?{field:oa(r,{prefix:i,suffix:"sort_index",expr:"datum"})}:Co(n)?{field:oa({aggregate:La(e.encoding)?n.op:void 0,field:n.field},{expr:"datum"})}:No(n)?{field:oa(e.fieldDef(n.encoding),{expr:"datum"}),order:n.order}:null===n?void 0:{field:oa(r,{binSuffix:e.stack?.impute?"mid":void 0,expr:"datum"})}}}}}(e),f=function(e){if(!e.component.selection)return null;const t=D(e.component.selection).length;let n=t,i=e.parent;for(;i&&0===n;)n=D(i.component.selection).length,i=i.parent;return n?{interactive:t>0||"geoshape"===e.mark||!!e.encoding.tooltip}:null}(e),d=Cn("aria",r,a),p=gp[i].postEncodingTransform?gp[i].postEncodingTransform(e):null;return[{name:e.getName("marks"),type:gp[i].vgMark,...s?{clip:!0}:{},...l?{style:l}:{},...c?{key:c.field}:{},...u?{sort:u}:{},...f||{},...!1===d?{aria:d}:{},from:{data:n.fromPrefix+e.requestDataName(fc.Main)},encode:{update:gp[i].encodeEntry(e)},...p?{transform:p}:{}}]}class xp extends Dm{constructor(e,n,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{},o=arguments.length>4?arguments[4]:void 0;super(e,"unit",n,i,o,void 0,Cs(e)?e.view:void 0),qn(this,"markDef",void 0),qn(this,"encoding",void 0),qn(this,"specifiedScales",{}),qn(this,"stack",void 0),qn(this,"specifiedAxes",{}),qn(this,"specifiedLegends",{}),qn(this,"specifiedProjection",{}),qn(this,"selection",[]),qn(this,"children",[]);const a=Zr(e.mark)?{...e.mark}:{type:e.mark},s=a.type;void 0===a.filled&&(a.filled=function(e,t,n){let{graticule:i}=n;if(i)return!1;const r=Pn("filled",e,t),o=e.type;return U(r,o!==Rr&&o!==Ur&&o!==Br)}(a,o,{graticule:e.data&&uc(e.data)}));const l=this.encoding=function(e,n,i,r){const o={};for(const t of D(e))Ke(t)||$i(`${a=t}-encoding is dropped as ${a} is not a valid encoding channel.`);var a;for(let a of lt){if(!e[a])continue;const s=e[a];if(Pt(a)){const e=st(a),t=o[e];if(Ho(t)&&nr(t.type)&&Ho(s)&&!t.timeUnit){$i(ni(e));continue}}if("angle"!==a||"arc"!==n||e.theta||($i("Arc marks uses theta channel rather than angle, replacing angle with theta."),a=se),Ua(e,a,n)){if(a===ye&&"line"===n){const t=pa(e[a]);if(t?.aggregate){$i("Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.");continue}}if(a===me&&(i?"fill"in e:"stroke"in e))$i(ri("encoding",{fill:"fill"in e,stroke:"stroke"in e}));else if(a===Fe||a===De&&!t.isArray(s)&&!Zo(s)||a===Oe&&t.isArray(s)){if(s){if(a===De){const t=e[a];if(Ro(t)){o[a]=t;continue}}o[a]=t.array(s).reduce(((e,t)=>(Ho(t)?e.push(va(t,a)):$i(oi(t,a)),e)),[])}}else{if(a===Oe&&null===s)o[a]=null;else if(!(Ho(s)||Go(s)||Zo(s)||Wo(s)||yn(s))){$i(oi(s,a));continue}o[a]=ha(s,a,r)}}else $i(ai(a,n))}return o}(e.encoding||{},s,a.filled,o);this.markDef=il(a,l,o),this.size=function(e){let{encoding:t,size:n}=e;for(const e of Ft){const i=rt(e);Ns(n[i])&&Yo(t[e])&&(delete n[i],$i(pi(i)))}return n}({encoding:l,size:Cs(e)?{...r,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}}:r}),this.stack=nl(this.markDef,l),this.specifiedScales=this.initScales(s,l),this.specifiedAxes=this.initAxes(l),this.specifiedLegends=this.initLegends(l),this.specifiedProjection=e.projection,this.selection=(e.params??[]).filter((e=>Ss(e)))}get hasProjection(){const{encoding:e}=this,t=this.mark===Xr,n=e&&Me.some((t=>Jo(e[t])));return t||n}scaleDomain(e){const t=this.specifiedScales[e];return t?t.domain:void 0}axis(e){return this.specifiedAxes[e]}legend(e){return this.specifiedLegends[e]}initScales(e,t){return It.reduce(((e,n)=>{const i=ga(t[n]);return i&&(e[n]=this.initScale(i.scale??{})),e}),{})}initScale(e){const{domain:n,range:i}=e,r=pn(e);return t.isArray(n)&&(r.domain=n.map(Sn)),t.isArray(i)&&(r.range=i.map(Sn)),r}initAxes(e){return Ft.reduce(((t,n)=>{const i=e[n];if(Jo(i)||n===Z&&Jo(e.x2)||n===ee&&Jo(e.y2)){const e=Jo(i)?i.axis:void 0;t[n]=e?this.initAxis({...e}):e}return t}),{})}initAxis(e){const t=D(e),n={};for(const i of t){const t=e[i];n[i]=Fa(t)?kn(t):Sn(t)}return n}initLegends(e){return Wt.reduce(((t,n)=>{const i=ga(e[n]);if(i&&function(e){switch(e){case me:case pe:case ge:case ye:case he:case be:case we:case ke:return!0;case xe:case $e:case ve:return!1}}(n)){const e=i.legend;t[n]=e?pn(e):e}return t}),{})}parseData(){this.component.data=Jm(this)}parseLayoutSize(){!function(e){const{size:t,component:n}=e;for(const i of Ft){const r=rt(i);if(t[r]){const e=t[r];n.layoutSize.set(r,Ns(e)?"step":e,!0)}else{const t=Gm(e,r);n.layoutSize.set(r,t,!1)}}}(this)}parseSelections(){this.component.selection=function(e,n){const i={},r=e.config.selection;if(!n||!n.length)return i;for(const o of n){const n=_(o.name),a=o.select,s=t.isString(a)?a:a.type,c=t.isObject(a)?l(a):{type:s},u=r[s];for(const e in u)"fields"!==e&&"encodings"!==e&&("mark"===e&&(c[e]={...u[e],...c[e]}),void 0!==c[e]&&!0!==c[e]||(c[e]=l(u[e]??c[e])));const f=i[n]={...c,name:n,type:s,init:o.value,bind:o.bind,events:t.isString(c.on)?t.parseSelector(c.on,"scope"):t.array(l(c.on))},d=l(o);for(const t of Eu)t.defined(f)&&t.parse&&t.parse(e,f,d)}return i}(this,this.selection)}parseMarkGroup(){this.component.mark=hp(this)}parseAxesAndHeaders(){var e;this.component.axes=(e=this,Ft.reduce(((t,n)=>(e.component.scales[n]&&(t[n]=[sp(n,e)]),t)),{}))}assembleSelectionTopLevelSignals(e){return function(e,n){let i=!1;for(const r of F(e.component.selection??{})){const o=r.name,a=t.stringValue(o+Pu);if(0===n.filter((e=>e.name===o)).length){const e="global"===r.resolve?"union":r.resolve,i="point"===r.type?", true, true)":")";n.push({name:r.name,update:`${Tu}(${a}, ${t.stringValue(e)}${i}`})}i=!0;for(const t of Eu)t.defined(r)&&t.topLevelSignals&&(n=t.topLevelSignals(e,r,n))}i&&0===n.filter((e=>"unit"===e.name)).length&&n.unshift({name:"unit",value:{},on:[{events:"pointermove",update:"isTuple(group()) ? group() : unit"}]});return yc(n)}(this,e)}assembleSignals(){return[...Xu(this),...pc(this,[])]}assembleSelectionData(e){return function(e,t){const n=[...t],i=Mu(e,{escape:!1});for(const t of F(e.component.selection??{})){const e={name:t.name+Pu};if(t.project.hasSelectionId&&(e.transform=[{type:"collect",sort:{field:xs}}]),t.init){const n=t.project.items.map(dc);e.values=t.project.hasSelectionId?t.init.map((e=>({unit:i,[xs]:mc(e,!1)[0]}))):t.init.map((e=>({unit:i,fields:n,values:mc(e,!1)})))}n.filter((e=>e.name===t.name+Pu)).length||n.push(e)}return n}(this,e)}assembleLayout(){return null}assembleLayoutSignals(){return wf(this)}assembleMarks(){let e=this.component.mark??[];return this.parent&&km(this.parent)||(e=hc(this,e)),e.map(this.correctDataNames)}assembleGroupStyle(){const{style:e}=this.view||{};return void 0!==e?e:this.encoding.x||this.encoding.y?"cell":"view"}getMapping(){return this.encoding}get mark(){return this.markDef.type}channelHasField(e){return Ta(this.encoding,e)}fieldDef(e){return pa(this.encoding[e])}typedFieldDef(e){const t=this.fieldDef(e);return Ko(t)?t:null}}class $p extends Sm{constructor(e,t,n,i,r){super(e,"layer",t,n,r,e.resolve,e.view),qn(this,"children",void 0);const o={...i,...e.width?{width:e.width}:{},...e.height?{height:e.height}:{}};this.children=e.layer.map(((e,t)=>{if(Xs(e))return new $p(e,this,this.getName(`layer_${t}`),o,r);if(Aa(e))return new xp(e,this,this.getName(`layer_${t}`),o,r);throw new Error(Bn(e))}))}parseData(){this.component.data=Jm(this);for(const e of this.children)e.parseData()}parseLayoutSize(){var e;Hm(e=this),Vm(e,"width"),Vm(e,"height")}parseSelections(){this.component.selection={};for(const e of this.children){e.parseSelections();for(const t of D(e.component.selection))this.component.selection[t]=e.component.selection[t]}}parseMarkGroup(){for(const e of this.children)e.parseMarkGroup()}parseAxesAndHeaders(){!function(e){const{axes:t,resolve:n}=e.component,i={top:0,bottom:0,right:0,left:0};for(const i of e.children){i.parseAxesAndHeaders();for(const r of D(i.component.axes))n.axis[r]=_f(e.component.resolve,r),"shared"===n.axis[r]&&(t[r]=ip(t[r],i.component.axes[r]),t[r]||(n.axis[r]="independent",delete t[r]))}for(const r of Ft){for(const o of e.children)if(o.component.axes[r]){if("independent"===n.axis[r]){t[r]=(t[r]??[]).concat(o.component.axes[r]);for(const e of o.component.axes[r]){const{value:t,explicit:n}=e.getWithExplicit("orient");if(!yn(t)){if(i[t]>0&&!n){const n=np[t];i[t]>i[n]&&e.set("orient",n,!1)}i[t]++}}}delete o.component.axes[r]}if("independent"===n.axis[r]&&t[r]&&t[r].length>1)for(const[e,n]of(t[r]||[]).entries())e>0&&n.get("grid")&&!n.explicit.grid&&(n.implicit.grid=!1)}}(this)}assembleSelectionTopLevelSignals(e){return this.children.reduce(((e,t)=>t.assembleSelectionTopLevelSignals(e)),e)}assembleSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleSignals())),Xu(this))}assembleLayoutSignals(){return this.children.reduce(((e,t)=>e.concat(t.assembleLayoutSignals())),wf(this))}assembleSelectionData(e){return this.children.reduce(((e,t)=>t.assembleSelectionData(e)),e)}assembleGroupStyle(){const e=new Set;for(const n of this.children)for(const i of t.array(n.assembleGroupStyle()))e.add(i);const n=Array.from(e);return n.length>1?n:1===n.length?n[0]:void 0}assembleTitle(){let e=super.assembleTitle();if(e)return e;for(const t of this.children)if(e=t.assembleTitle(),e)return e}assembleLayout(){return null}assembleMarks(){return function(e,t){for(const n of e.children)xm(n)&&(t=hc(n,t));return t}(this,this.children.flatMap((e=>e.assembleMarks())))}assembleLegends(){return this.children.reduce(((e,t)=>e.concat(t.assembleLegends())),Vf(this))}}function wp(e,t,n,i,r){if(To(e))return new Xm(e,t,n,r);if(Xs(e))return new $p(e,t,n,i,r);if(Aa(e))return new xp(e,t,n,i,r);if(function(e){return zs(e)||Os(e)||Fs(e)}(e))return new Km(e,t,n,r);throw new Error(Bn(e))}const kp=n;e.accessPathDepth=q,e.accessPathWithDatum=A,e.compile=function(e){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i;n.logger&&(i=n.logger,xi=i),n.fieldTitle&&ca(n.fieldTitle);try{const i=Bs(t.mergeConfig(n.config,e.config)),r=Il(e,i),o=wp(r,null,"",void 0,i);o.parse(),function(e,t){Md(e.sources);let n=0,i=0;for(let i=0;i2&&void 0!==arguments[2]?arguments[2]:{},i=arguments.length>3?arguments[3]:void 0;const r=e.config?Gs(e.config):void 0,o=[].concat(e.assembleSelectionData([]),function(e,t){const n=[],i=Um(n);let r=0;for(const t of e.sources){t.hasName()||(t.dataName="source_"+r++);const e=t.assemble();i(t,e)}for(const e of n)0===e.transform.length&&delete e.transform;let o=0;for(const[e,t]of n.entries())0!==(t.transform??[]).length||t.source||n.splice(o++,0,n.splice(e,1)[0]);for(const t of n)for(const n of t.transform??[])"lookup"===n.type&&(n.from=e.outputNodes[n.from].getSource());for(const e of n)e.name in t&&(e.values=t[e.name]);return n}(e.component.data,n)),a=e.assembleProjections(),s=e.assembleTitle(),l=e.assembleGroupStyle(),c=e.assembleGroupEncodeEntry(!0);let u=e.assembleLayoutSignals();u=u.filter((e=>"width"!==e.name&&"height"!==e.name||void 0===e.value||(t[e.name]=+e.value,!1)));const{params:f,...d}=t;return{$schema:"https://vega.github.io/schema/vega/v5.json",...e.description?{description:e.description}:{},...d,...s?{title:s}:{},...l?{style:l}:{},...c?{encode:{update:c}}:{},data:o,...a.length>0?{projections:a}:{},...e.assembleGroup([...u,...e.assembleSelectionTopLevelSignals([]),...Ds(f)]),...r?{config:r}:{},...i?{usermeta:i}:{}}}(o,function(e,n,i,r){const o=r.component.layoutSize.get("width"),a=r.component.layoutSize.get("height");void 0===n?(n={type:"pad"},r.hasAxisOrientSignalRef()&&(n.resize=!0)):t.isString(n)&&(n={type:n});if(o&&a&&(s=n.type,"fit"===s||"fit-x"===s||"fit-y"===s))if("step"===o&&"step"===a)$i(Gn()),n.type="pad";else if("step"===o||"step"===a){const e="step"===o?"width":"height";$i(Gn(Nt(e)));const t="width"===e?"height":"width";n.type=function(e){return e?`fit-${Nt(e)}`:"fit"}(t)}var s;return{...1===D(n).length&&n.type?"pad"===n.type?{}:{autosize:n.type}:{autosize:n},...Ql(i,!1),...Ql(e,!0)}}(e,r.autosize,i,o),e.datasets,e.usermeta);return{spec:a,normalized:r}}finally{n.logger&&(xi=bi),n.fieldTitle&&ca(sa)}},e.contains=p,e.deepEqual=Y,e.deleteNestedProperty=C,e.duplicate=l,e.entries=z,e.every=h,e.fieldIntersection=k,e.flatAccessWithDatum=j,e.getFirstDefined=U,e.hasIntersection=$,e.hash=d,e.internalField=B,e.isBoolean=O,e.isEmpty=S,e.isEqual=function(e,t){const n=D(e),i=D(t);if(n.length!==i.length)return!1;for(const i of n)if(e[i]!==t[i])return!1;return!0},e.isInternalField=I,e.isNullOrFalse=m,e.isNumeric=V,e.keys=D,e.logicalExpr=N,e.mergeDeep=y,e.never=c,e.normalize=Il,e.normalizeAngle=H,e.omit=f,e.pick=u,e.prefixGenerator=w,e.removePathFromField=L,e.replaceAll=M,e.replacePathInField=E,e.resetIdCounter=function(){R=42},e.setEqual=x,e.some=g,e.stringify=X,e.titleCase=P,e.unique=b,e.uniqueId=W,e.vals=F,e.varName=_,e.version=kp})); +//# sourceMappingURL=vega-lite.min.js.map diff --git a/build/vega-lite.min.js.map b/build/vega-lite.min.js.map new file mode 100644 index 0000000000..c5e6dce139 --- /dev/null +++ b/build/vega-lite.min.js.map @@ -0,0 +1 @@ +{"version":3,"file":"vega-lite.min.js","sources":["../src/logical.ts","../src/util.ts","../src/channel.ts","../src/aggregate.ts","../src/bin.ts","../src/expr.ts","../src/title.ts","../src/vega.schema.ts","../src/compile/common.ts","../src/log/message.ts","../src/log/index.ts","../src/datetime.ts","../src/timeunit.ts","../src/predicate.ts","../src/type.ts","../src/scale.ts","../src/mark.ts","../src/compile/mark/encode/valueref.ts","../src/compile/format.ts","../src/sort.ts","../src/spec/facet.ts","../src/channeldef.ts","../src/axis.ts","../src/spec/unit.ts","../src/compositemark/base.ts","../src/encoding.ts","../src/compositemark/common.ts","../src/compositemark/boxplot.ts","../src/compositemark/errorbar.ts","../src/compositemark/errorband.ts","../src/compositemark/index.ts","../src/guide.ts","../src/header.ts","../src/legend.ts","../src/selection.ts","../src/parameter.ts","../src/spec/concat.ts","../src/spec/base.ts","../src/config.ts","../src/spec/layer.ts","../src/spec/map.ts","../src/spec/repeat.ts","../src/stack.ts","../src/compile/mark/init.ts","../src/normalize/pathoverlay.ts","../src/normalize/repeater.ts","../src/normalize/ruleforrangedline.ts","../src/normalize/core.ts","../src/transform.ts","../src/normalize/selectioncompat.ts","../src/normalize/toplevelselection.ts","../src/normalize/index.ts","../src/spec/toplevel.ts","../src/compile/split.ts","../src/compile/data/index.ts","../src/data.ts","../src/compile/selection/assemble.ts","../src/compile/data/dataflow.ts","../src/compile/data/timeunit.ts","../src/compile/selection/project.ts","../src/compile/selection/scales.ts","../src/compile/selection/interval.ts","../src/compile/selection/point.ts","../src/compile/mark/encode/conditional.ts","../src/compile/mark/encode/text.ts","../src/compile/mark/encode/tooltip.ts","../src/compile/mark/encode/aria.ts","../src/compile/mark/encode/nonposition.ts","../src/compile/mark/encode/color.ts","../src/compile/mark/encode/zindex.ts","../src/compile/mark/encode/offset.ts","../src/compile/mark/encode/position-point.ts","../src/compile/mark/encode/position-align.ts","../src/compile/mark/encode/position-range.ts","../src/compile/mark/encode/position-rect.ts","../src/compile/mark/encode/base.ts","../src/compile/mark/encode/defined.ts","../src/compile/selection/nearest.ts","../src/compile/selection/inputs.ts","../src/compile/selection/toggle.ts","../src/compile/selection/clear.ts","../src/compile/selection/legends.ts","../src/compile/selection/translate.ts","../src/compile/selection/zoom.ts","../src/compile/selection/index.ts","../src/compile/data/expressions.ts","../src/compile/data/filter.ts","../src/compile/selection/parse.ts","../src/compile/predicate.ts","../src/compile/axis/assemble.ts","../src/compile/axis/config.ts","../src/compile/axis/properties.ts","../src/compile/data/calculate.ts","../src/compile/header/common.ts","../src/compile/header/component.ts","../src/compile/header/assemble.ts","../src/compile/layoutsize/assemble.ts","../src/compile/layoutsize/component.ts","../src/compile/guide.ts","../src/compile/resolve.ts","../src/compile/legend/component.ts","../src/compile/legend/encode.ts","../src/compile/legend/properties.ts","../src/compile/legend/parse.ts","../src/compile/legend/assemble.ts","../src/compile/projection/assemble.ts","../src/projection.ts","../src/compile/projection/component.ts","../src/compile/projection/parse.ts","../src/compile/data/bin.ts","../src/compile/data/aggregate.ts","../src/compile/data/facet.ts","../src/compile/data/formatparse.ts","../src/compile/data/identifier.ts","../src/compile/data/graticule.ts","../src/compile/data/sequence.ts","../src/compile/data/source.ts","../src/compile/data/optimizer.ts","../src/compile/data/optimizers.ts","../src/compile/data/joinaggregate.ts","../src/compile/data/stack.ts","../src/compile/data/window.ts","../src/compile/data/subtree.ts","../src/compile/data/optimize.ts","../src/compile/signal.ts","../src/compile/scale/domain.ts","../src/compile/scale/assemble.ts","../src/compile/scale/component.ts","../src/compile/scale/range.ts","../src/compile/scale/properties.ts","../src/compile/scale/type.ts","../src/compile/scale/parse.ts","../src/compile/model.ts","../src/compile/data/density.ts","../src/compile/data/extent.ts","../src/compile/data/filterinvalid.ts","../src/compile/data/flatten.ts","../src/compile/data/fold.ts","../src/compile/data/geojson.ts","../src/compile/data/geopoint.ts","../src/compile/data/impute.ts","../src/compile/data/loess.ts","../src/compile/data/lookup.ts","../src/compile/data/quantile.ts","../src/compile/data/regression.ts","../src/compile/data/pivot.ts","../src/compile/data/sample.ts","../src/compile/data/assemble.ts","../src/compile/header/parse.ts","../src/compile/layoutsize/parse.ts","../src/compile/facet.ts","../src/compile/data/parse.ts","../src/compile/data/joinaggregatefacet.ts","../src/compile/concat.ts","../src/compile/axis/component.ts","../src/compile/axis/parse.ts","../src/compile/axis/encode.ts","../src/compile/mark/point.ts","../src/compile/mark/rule.ts","../src/compile/mark/text.ts","../src/compile/mark/tick.ts","../src/compile/mark/mark.ts","../src/compile/mark/arc.ts","../src/compile/mark/area.ts","../src/compile/mark/bar.ts","../src/compile/mark/geoshape.ts","../src/compile/mark/image.ts","../src/compile/mark/line.ts","../src/compile/mark/rect.ts","../src/compile/unit.ts","../src/compile/layoutsize/init.ts","../src/compile/layer.ts","../src/compile/buildmodel.ts","../src/index.ts","../src/compile/compile.ts"],"sourcesContent":["export type LogicalComposition = LogicalNot | LogicalAnd | LogicalOr | T;\n\nexport interface LogicalOr {\n or: LogicalComposition[];\n}\n\nexport interface LogicalAnd {\n and: LogicalComposition[];\n}\n\nexport interface LogicalNot {\n not: LogicalComposition;\n}\n\nexport function isLogicalOr(op: LogicalComposition): op is LogicalOr {\n return !!op.or;\n}\n\nexport function isLogicalAnd(op: LogicalComposition): op is LogicalAnd {\n return !!op.and;\n}\n\nexport function isLogicalNot(op: LogicalComposition): op is LogicalNot {\n return !!op.not;\n}\n\nexport function forEachLeaf(op: LogicalComposition, fn: (op: T) => void) {\n if (isLogicalNot(op)) {\n forEachLeaf(op.not, fn);\n } else if (isLogicalAnd(op)) {\n for (const subop of op.and) {\n forEachLeaf(subop, fn);\n }\n } else if (isLogicalOr(op)) {\n for (const subop of op.or) {\n forEachLeaf(subop, fn);\n }\n } else {\n fn(op);\n }\n}\n\nexport function normalizeLogicalComposition(\n op: LogicalComposition,\n normalizer: (o: T) => T\n): LogicalComposition {\n if (isLogicalNot(op)) {\n return {not: normalizeLogicalComposition(op.not, normalizer)};\n } else if (isLogicalAnd(op)) {\n return {and: op.and.map(o => normalizeLogicalComposition(o, normalizer))};\n } else if (isLogicalOr(op)) {\n return {or: op.or.map(o => normalizeLogicalComposition(o, normalizer))};\n } else {\n return normalizer(op);\n }\n}\n","import {hasOwnProperty, isNumber, isString, splitAccessPath, stringValue, writeConfig} from 'vega-util';\nimport {isLogicalAnd, isLogicalNot, isLogicalOr, LogicalComposition} from './logical';\n\nexport const duplicate = structuredClone;\n\nexport function never(message: string): never {\n throw new Error(message);\n}\n\n/**\n * Creates an object composed of the picked object properties.\n *\n * var object = {'a': 1, 'b': '2', 'c': 3};\n * pick(object, ['a', 'c']);\n * // → {'a': 1, 'c': 3}\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function pick(obj: T, props: readonly K[]): Pick {\n const copy: any = {};\n for (const prop of props) {\n if (hasOwnProperty(obj, prop)) {\n copy[prop] = obj[prop];\n }\n }\n return copy;\n}\n\n/**\n * The opposite of _.pick; this method creates an object composed of the own\n * and inherited enumerable string keyed properties of object that are not omitted.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function omit(obj: T, props: readonly K[]): Omit {\n const copy = {...(obj as any)};\n for (const prop of props) {\n delete copy[prop];\n }\n return copy;\n}\n\n/**\n * Monkey patch Set so that `stringify` produces a string representation of sets.\n */\nSet.prototype['toJSON'] = function () {\n return `Set(${[...this].map(x => stringify(x)).join(',')})`;\n};\n\n/**\n * Converts any object to a string of limited size, or a number.\n */\nexport function hash(a: any): string | number {\n if (isNumber(a)) {\n return a;\n }\n\n const str = isString(a) ? a : stringify(a);\n\n // short strings can be used as hash directly, longer strings are hashed to reduce memory usage\n if (str.length < 250) {\n return str;\n }\n\n // from http://werxltd.com/wp/2010/05/13/javascript-implementation-of-javas-string-hashcode-method/\n let h = 0;\n for (let i = 0; i < str.length; i++) {\n const char = str.charCodeAt(i);\n h = (h << 5) - h + char;\n h = h & h; // Convert to 32bit integer\n }\n return h;\n}\n\nexport function isNullOrFalse(x: any): x is false | null {\n return x === false || x === null;\n}\n\nexport function contains(array: readonly T[], item: T) {\n return array.includes(item);\n}\n\n/**\n * Returns true if any item returns true.\n */\nexport function some(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (f(a, k, i++)) {\n return true;\n }\n }\n return false;\n}\n\n/**\n * Returns true if all items return true.\n */\nexport function every(arr: readonly T[], f: (d: T, k?: any, i?: any) => boolean) {\n let i = 0;\n for (const [k, a] of arr.entries()) {\n if (!f(a, k, i++)) {\n return false;\n }\n }\n return true;\n}\n\n/**\n * Like TS Partial but applies recursively to all properties.\n */\nexport type DeepPartial = {[P in keyof T]?: DeepPartial};\n\n/**\n * recursively merges src into dest\n */\nexport function mergeDeep(dest: T, ...src: readonly DeepPartial[]): T {\n for (const s of src) {\n deepMerge_(dest, s ?? {});\n }\n return dest;\n}\n\nfunction deepMerge_(dest: any, src: any) {\n for (const property of keys(src)) {\n writeConfig(dest, property, src[property], true);\n }\n}\n\nexport function unique(values: readonly T[], f: (item: T) => string | number): T[] {\n const results: T[] = [];\n const u = {};\n let v: string | number;\n for (const val of values) {\n v = f(val);\n if (v in u) {\n continue;\n }\n u[v] = 1;\n results.push(val);\n }\n return results;\n}\n\nexport type Dict = Record;\n\n/**\n * Returns true if the two dictionaries agree. Applies only to defined values.\n */\nexport function isEqual(dict: Dict, other: Dict) {\n const dictKeys = keys(dict);\n const otherKeys = keys(other);\n if (dictKeys.length !== otherKeys.length) {\n return false;\n }\n for (const key of dictKeys) {\n if (dict[key] !== other[key]) {\n return false;\n }\n }\n return true;\n}\n\nexport function setEqual(a: Set, b: Set) {\n if (a.size !== b.size) {\n return false;\n }\n for (const e of a) {\n if (!b.has(e)) {\n return false;\n }\n }\n return true;\n}\n\nexport function hasIntersection(a: ReadonlySet, b: ReadonlySet) {\n for (const key of a) {\n if (b.has(key)) {\n return true;\n }\n }\n return false;\n}\n\nexport function prefixGenerator(a: ReadonlySet): ReadonlySet {\n const prefixes = new Set();\n for (const x of a) {\n const splitField = splitAccessPath(x);\n // Wrap every element other than the first in `[]`\n const wrappedWithAccessors = splitField.map((y, i) => (i === 0 ? y : `[${y}]`));\n const computedPrefixes = wrappedWithAccessors.map((_, i) => wrappedWithAccessors.slice(0, i + 1).join(''));\n for (const y of computedPrefixes) {\n prefixes.add(y);\n }\n }\n return prefixes;\n}\n\n/**\n * Returns true if a and b have an intersection. Also return true if a or b are undefined\n * since this means we don't know what fields a node produces or depends on.\n */\nexport function fieldIntersection(a: ReadonlySet, b: ReadonlySet): boolean {\n if (a === undefined || b === undefined) {\n return true;\n }\n return hasIntersection(prefixGenerator(a), prefixGenerator(b));\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport function isEmpty(obj: object) {\n return keys(obj).length === 0;\n}\n\n// This is a stricter version of Object.keys but with better types. See https://github.com/Microsoft/TypeScript/pull/12253#issuecomment-263132208\nexport const keys = Object.keys as (o: T) => Extract[];\n\nexport const vals = Object.values;\n\nexport const entries = Object.entries;\n\n// Using mapped type to declare a collect of flags for a string literal type S\n// https://www.typescriptlang.org/docs/handbook/advanced-types.html#mapped-types\nexport type Flag = {[K in S]: 1};\n\nexport function isBoolean(b: any): b is boolean {\n return b === true || b === false;\n}\n\n/**\n * Convert a string into a valid variable name\n */\nexport function varName(s: string): string {\n // Replace non-alphanumeric characters (anything besides a-zA-Z0-9_) with _\n const alphanumericS = s.replace(/\\W/g, '_');\n\n // Add _ if the string has leading numbers.\n return (s.match(/^\\d+/) ? '_' : '') + alphanumericS;\n}\n\nexport function logicalExpr(op: LogicalComposition, cb: (...args: readonly any[]) => string): string {\n if (isLogicalNot(op)) {\n return `!(${logicalExpr(op.not, cb)})`;\n } else if (isLogicalAnd(op)) {\n return `(${op.and.map((and: LogicalComposition) => logicalExpr(and, cb)).join(') && (')})`;\n } else if (isLogicalOr(op)) {\n return `(${op.or.map((or: LogicalComposition) => logicalExpr(or, cb)).join(') || (')})`;\n } else {\n return cb(op);\n }\n}\n\n/**\n * Delete nested property of an object, and delete the ancestors of the property if they become empty.\n */\nexport function deleteNestedProperty(obj: any, orderedProps: string[]) {\n if (orderedProps.length === 0) {\n return true;\n }\n const prop = orderedProps.shift()!; // eslint-disable-line @typescript-eslint/no-non-null-assertion\n if (prop in obj && deleteNestedProperty(obj[prop], orderedProps)) {\n delete obj[prop];\n }\n return isEmpty(obj);\n}\n\nexport function titleCase(s: string) {\n return s.charAt(0).toUpperCase() + s.substr(1);\n}\n\n/**\n * Converts a path to an access path with datum.\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function accessPathWithDatum(path: string, datum = 'datum') {\n const pieces = splitAccessPath(path);\n const prefixes = [];\n for (let i = 1; i <= pieces.length; i++) {\n const prefix = `[${pieces.slice(0, i).map(stringValue).join('][')}]`;\n prefixes.push(`${datum}${prefix}`);\n }\n return prefixes.join(' && ');\n}\n\n/**\n * Return access with datum to the flattened field.\n *\n * @param path The field name.\n * @param datum The string to use for `datum`.\n */\nexport function flatAccessWithDatum(path: string, datum: 'datum' | 'parent' | 'datum.datum' = 'datum') {\n return `${datum}[${stringValue(splitAccessPath(path).join('.'))}]`;\n}\n\nfunction escapePathAccess(string: string) {\n return string.replace(/(\\[|\\]|\\.|'|\")/g, '\\\\$1');\n}\n\n/**\n * Replaces path accesses with access to non-nested field.\n * For example, `foo[\"bar\"].baz` becomes `foo\\\\.bar\\\\.baz`.\n */\nexport function replacePathInField(path: string) {\n return `${splitAccessPath(path).map(escapePathAccess).join('\\\\.')}`;\n}\n\n/**\n * Replace all occurrences of a string with another string.\n *\n * @param string the string to replace in\n * @param find the string to replace\n * @param replacement the replacement\n */\nexport function replaceAll(string: string, find: string, replacement: string) {\n return string.replace(new RegExp(find.replace(/[-/\\\\^$*+?.()|[\\]{}]/g, '\\\\$&'), 'g'), replacement);\n}\n\n/**\n * Remove path accesses with access from field.\n * For example, `foo[\"bar\"].baz` becomes `foo.bar.baz`.\n */\nexport function removePathFromField(path: string) {\n return `${splitAccessPath(path).join('.')}`;\n}\n\n/**\n * Count the depth of the path. Returns 1 for fields that are not nested.\n */\nexport function accessPathDepth(path: string) {\n if (!path) {\n return 0;\n }\n return splitAccessPath(path).length;\n}\n\n/**\n * This is a replacement for chained || for numeric properties or properties that respect null so that 0 will be included.\n */\nexport function getFirstDefined(...args: readonly T[]): T | undefined {\n for (const arg of args) {\n if (arg !== undefined) {\n return arg;\n }\n }\n return undefined;\n}\n\n// variable used to generate id\nlet idCounter = 42;\n\n/**\n * Returns a new random id every time it gets called.\n *\n * Has side effect!\n */\nexport function uniqueId(prefix?: string) {\n const id = ++idCounter;\n return prefix ? String(prefix) + id : id;\n}\n\n/**\n * Resets the id counter used in uniqueId. This can be useful for testing.\n */\nexport function resetIdCounter() {\n idCounter = 42;\n}\n\nexport function internalField(name: string) {\n return isInternalField(name) ? name : `__${name}`;\n}\n\nexport function isInternalField(name: string) {\n return name.startsWith('__');\n}\n\n/**\n * Normalize angle to be within [0,360).\n */\nexport function normalizeAngle(angle: number) {\n if (angle === undefined) {\n return undefined;\n }\n return ((angle % 360) + 360) % 360;\n}\n\n/**\n * Returns whether the passed in value is a valid number.\n */\nexport function isNumeric(value: number | string): boolean {\n if (isNumber(value)) {\n return true;\n }\n return !isNaN(value as any) && !isNaN(parseFloat(value));\n}\n\nconst clonedProto = Object.getPrototypeOf(structuredClone({}));\n\n/**\n * Compares two values for equality, including arrays and objects.\n *\n * Adapted from https://github.com/epoberezkin/fast-deep-equal.\n */\nexport function deepEqual(a: any, b: any) {\n if (a === b) return true;\n\n if (a && b && typeof a == 'object' && typeof b == 'object') {\n // compare names to avoid issues with structured clone\n if (a.constructor.name !== b.constructor.name) return false;\n\n let length;\n let i;\n\n if (Array.isArray(a)) {\n length = a.length;\n if (length != b.length) return false;\n for (i = length; i-- !== 0; ) if (!deepEqual(a[i], b[i])) return false;\n return true;\n }\n\n if (a instanceof Map && b instanceof Map) {\n if (a.size !== b.size) return false;\n for (i of a.entries()) if (!b.has(i[0])) return false;\n for (i of a.entries()) if (!deepEqual(i[1], b.get(i[0]))) return false;\n return true;\n }\n\n if (a instanceof Set && b instanceof Set) {\n if (a.size !== b.size) return false;\n for (i of a.entries()) if (!b.has(i[0])) return false;\n return true;\n }\n\n if (ArrayBuffer.isView(a) && ArrayBuffer.isView(b)) {\n length = (a as any).length;\n if (length != (b as any).length) return false;\n for (i = length; i-- !== 0; ) if (a[i] !== b[i]) return false;\n return true;\n }\n\n if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;\n // also compare to structured clone prototype\n if (a.valueOf !== Object.prototype.valueOf && a.valueOf !== clonedProto.valueOf) return a.valueOf() === b.valueOf();\n if (a.toString !== Object.prototype.toString && a.toString !== clonedProto.toString)\n return a.toString() === b.toString();\n\n const ks = Object.keys(a);\n length = ks.length;\n if (length !== Object.keys(b).length) return false;\n\n for (i = length; i-- !== 0; ) if (!Object.prototype.hasOwnProperty.call(b, ks[i])) return false;\n\n for (i = length; i-- !== 0; ) {\n const key = ks[i];\n\n if (!deepEqual(a[key], b[key])) return false;\n }\n\n return true;\n }\n\n // true if both NaN, false otherwise\n return a !== a && b !== b;\n}\n\n/**\n * Converts any object to a string representation that can be consumed by humans.\n *\n * Adapted from https://github.com/epoberezkin/fast-json-stable-stringify\n */\nexport function stringify(data: any) {\n const seen: any[] = [];\n\n return (function _stringify(node: any) {\n if (node && node.toJSON && typeof node.toJSON === 'function') {\n node = node.toJSON();\n }\n\n if (node === undefined) return undefined;\n if (typeof node == 'number') return isFinite(node) ? '' + node : 'null';\n if (typeof node !== 'object') return JSON.stringify(node);\n\n let i, out;\n if (Array.isArray(node)) {\n out = '[';\n for (i = 0; i < node.length; i++) {\n if (i) out += ',';\n out += _stringify(node[i]) || 'null';\n }\n return out + ']';\n }\n\n if (node === null) return 'null';\n\n if (seen.includes(node)) {\n throw new TypeError('Converting circular structure to JSON');\n }\n\n const seenIndex = seen.push(node) - 1;\n const ks = Object.keys(node).sort();\n out = '';\n for (i = 0; i < ks.length; i++) {\n const key = ks[i];\n const value = _stringify(node[key]);\n\n if (!value) continue;\n if (out) out += ',';\n out += JSON.stringify(key) + ':' + value;\n }\n seen.splice(seenIndex, 1);\n return `{${out}}`;\n })(data);\n}\n","/*\n * Constants and utilities for encoding channels (Visual variables)\n * such as 'x', 'y', 'color'.\n */\n\nimport {RangeType} from './compile/scale/type';\nimport {Encoding} from './encoding';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {Flag, keys} from './util';\n\nexport type Channel = keyof Encoding;\nexport type ExtendedChannel = Channel | FacetChannel;\n\n// Facet\nexport const ROW = 'row' as const;\nexport const COLUMN = 'column' as const;\n\nexport const FACET = 'facet' as const;\n\n// Position\nexport const X = 'x' as const;\nexport const Y = 'y' as const;\nexport const X2 = 'x2' as const;\nexport const Y2 = 'y2' as const;\n\n// Position Offset\nexport const XOFFSET = 'xOffset' as const;\nexport const YOFFSET = 'yOffset' as const;\n\n// Arc-Position\nexport const RADIUS = 'radius' as const;\nexport const RADIUS2 = 'radius2' as const;\nexport const THETA = 'theta' as const;\nexport const THETA2 = 'theta2' as const;\n\n// Geo Position\nexport const LATITUDE = 'latitude' as const;\nexport const LONGITUDE = 'longitude' as const;\nexport const LATITUDE2 = 'latitude2' as const;\nexport const LONGITUDE2 = 'longitude2' as const;\n\n// Mark property with scale\nexport const COLOR = 'color' as const;\n\nexport const FILL = 'fill' as const;\n\nexport const STROKE = 'stroke' as const;\n\nexport const SHAPE = 'shape' as const;\nexport const SIZE = 'size' as const;\n\nexport const ANGLE = 'angle' as const;\n\nexport const OPACITY = 'opacity' as const;\nexport const FILLOPACITY = 'fillOpacity' as const;\n\nexport const STROKEOPACITY = 'strokeOpacity' as const;\n\nexport const STROKEWIDTH = 'strokeWidth' as const;\nexport const STROKEDASH = 'strokeDash' as const;\n\n// Non-scale channel\nexport const TEXT = 'text' as const;\nexport const ORDER = 'order' as const;\nexport const DETAIL = 'detail' as const;\nexport const KEY = 'key' as const;\n\nexport const TOOLTIP = 'tooltip' as const;\nexport const HREF = 'href' as const;\n\nexport const URL = 'url' as const;\nexport const DESCRIPTION = 'description' as const;\n\nconst POSITION_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n x2: 1,\n y2: 1\n} as const;\n\nexport type PositionChannel = keyof typeof POSITION_CHANNEL_INDEX;\n\nconst POLAR_POSITION_CHANNEL_INDEX = {\n theta: 1,\n theta2: 1,\n radius: 1,\n radius2: 1\n} as const;\n\nexport type PolarPositionChannel = keyof typeof POLAR_POSITION_CHANNEL_INDEX;\n\nexport function isPolarPositionChannel(c: Channel): c is PolarPositionChannel {\n return c in POLAR_POSITION_CHANNEL_INDEX;\n}\n\nconst GEO_POSIITON_CHANNEL_INDEX = {\n longitude: 1,\n longitude2: 1,\n latitude: 1,\n latitude2: 1\n} as const;\n\nexport type GeoPositionChannel = keyof typeof GEO_POSIITON_CHANNEL_INDEX;\n\nexport function getPositionChannelFromLatLong(channel: GeoPositionChannel): PositionChannel {\n switch (channel) {\n case LATITUDE:\n return 'y';\n case LATITUDE2:\n return 'y2';\n case LONGITUDE:\n return 'x';\n case LONGITUDE2:\n return 'x2';\n }\n}\n\nexport function isGeoPositionChannel(c: Channel): c is GeoPositionChannel {\n return c in GEO_POSIITON_CHANNEL_INDEX;\n}\n\nexport const GEOPOSITION_CHANNELS = keys(GEO_POSIITON_CHANNEL_INDEX);\n\nconst UNIT_CHANNEL_INDEX: Flag = {\n ...POSITION_CHANNEL_INDEX,\n ...POLAR_POSITION_CHANNEL_INDEX,\n\n ...GEO_POSIITON_CHANNEL_INDEX,\n xOffset: 1,\n yOffset: 1,\n\n // color\n color: 1,\n fill: 1,\n stroke: 1,\n\n // other non-position with scale\n opacity: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n\n strokeWidth: 1,\n strokeDash: 1,\n size: 1,\n angle: 1,\n shape: 1,\n\n // channels without scales\n order: 1,\n text: 1,\n detail: 1,\n key: 1,\n tooltip: 1,\n href: 1,\n url: 1,\n description: 1\n};\n\nexport type ColorChannel = 'color' | 'fill' | 'stroke';\n\nexport function isColorChannel(channel: Channel): channel is ColorChannel {\n return channel === COLOR || channel === FILL || channel === STROKE;\n}\n\nexport type FacetChannel = keyof EncodingFacetMapping;\n\nconst FACET_CHANNEL_INDEX: Flag> = {\n row: 1,\n column: 1,\n facet: 1\n};\n\nexport const FACET_CHANNELS = keys(FACET_CHANNEL_INDEX);\n\nconst CHANNEL_INDEX = {\n ...UNIT_CHANNEL_INDEX,\n ...FACET_CHANNEL_INDEX\n};\n\nexport const CHANNELS = keys(CHANNEL_INDEX);\n\nconst {order: _o, detail: _d, tooltip: _tt1, ...SINGLE_DEF_CHANNEL_INDEX} = CHANNEL_INDEX;\nconst {row: _r, column: _c, facet: _f, ...SINGLE_DEF_UNIT_CHANNEL_INDEX} = SINGLE_DEF_CHANNEL_INDEX;\n/**\n * Channels that cannot have an array of channelDef.\n * model.fieldDef, getFieldDef only work for these channels.\n *\n * (The only two channels that can have an array of channelDefs are \"detail\" and \"order\".\n * Since there can be multiple fieldDefs for detail and order, getFieldDef/model.fieldDef\n * are not applicable for them. Similarly, selection projection won't work with \"detail\" and \"order\".)\n */\n\nexport const SINGLE_DEF_CHANNELS = keys(SINGLE_DEF_CHANNEL_INDEX);\n\nexport type SingleDefChannel = (typeof SINGLE_DEF_CHANNELS)[number];\n\nexport const SINGLE_DEF_UNIT_CHANNELS = keys(SINGLE_DEF_UNIT_CHANNEL_INDEX);\n\nexport type SingleDefUnitChannel = (typeof SINGLE_DEF_UNIT_CHANNELS)[number];\n\nexport function isSingleDefUnitChannel(str: string): str is SingleDefUnitChannel {\n return !!SINGLE_DEF_UNIT_CHANNEL_INDEX[str];\n}\n\nexport function isChannel(str: string): str is Channel {\n return !!CHANNEL_INDEX[str];\n}\n\nexport type SecondaryRangeChannel = 'x2' | 'y2' | 'latitude2' | 'longitude2' | 'theta2' | 'radius2';\n\nexport const SECONDARY_RANGE_CHANNEL: SecondaryRangeChannel[] = [X2, Y2, LATITUDE2, LONGITUDE2, THETA2, RADIUS2];\n\nexport function isSecondaryRangeChannel(c: ExtendedChannel): c is SecondaryRangeChannel {\n const main = getMainRangeChannel(c);\n return main !== c;\n}\n\nexport type MainChannelOf = C extends 'x2'\n ? 'x'\n : C extends 'y2'\n ? 'y'\n : C extends 'latitude2'\n ? 'latitude'\n : C extends 'longitude2'\n ? 'longitude'\n : C extends 'theta2'\n ? 'theta'\n : C extends 'radius2'\n ? 'radius'\n : C;\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getMainRangeChannel(channel: C): MainChannelOf {\n switch (channel) {\n case X2:\n return X as MainChannelOf;\n case Y2:\n return Y as MainChannelOf;\n case LATITUDE2:\n return LATITUDE as MainChannelOf;\n case LONGITUDE2:\n return LONGITUDE as MainChannelOf;\n case THETA2:\n return THETA as MainChannelOf;\n case RADIUS2:\n return RADIUS as MainChannelOf;\n }\n return channel as MainChannelOf;\n}\n\nexport type SecondaryChannelOf = C extends 'x'\n ? 'x2'\n : C extends 'y'\n ? 'y2'\n : C extends 'latitude'\n ? 'latitude2'\n : C extends 'longitude'\n ? 'longitude2'\n : C extends 'theta'\n ? 'theta2'\n : C extends 'radius'\n ? 'radius2'\n : undefined;\n\nexport function getVgPositionChannel(channel: PolarPositionChannel | PositionChannel) {\n if (isPolarPositionChannel(channel)) {\n switch (channel) {\n case THETA:\n return 'startAngle';\n case THETA2:\n return 'endAngle';\n case RADIUS:\n return 'outerRadius';\n case RADIUS2:\n return 'innerRadius';\n }\n }\n return channel;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getSecondaryRangeChannel(channel: C): SecondaryChannelOf | undefined {\n switch (channel) {\n case X:\n return X2 as SecondaryChannelOf;\n case Y:\n return Y2 as SecondaryChannelOf;\n case LATITUDE:\n return LATITUDE2 as SecondaryChannelOf;\n case LONGITUDE:\n return LONGITUDE2 as SecondaryChannelOf;\n case THETA:\n return THETA2 as SecondaryChannelOf;\n case RADIUS:\n return RADIUS2 as SecondaryChannelOf;\n }\n return undefined;\n}\n\nexport function getSizeChannel(channel: PositionChannel): 'width' | 'height';\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined;\nexport function getSizeChannel(channel: Channel): 'width' | 'height' | undefined {\n switch (channel) {\n case X:\n case X2:\n return 'width';\n case Y:\n case Y2:\n return 'height';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetChannel(channel: Channel) {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n case X2:\n return 'x2Offset';\n case Y2:\n return 'y2Offset';\n case THETA:\n return 'thetaOffset';\n case RADIUS:\n return 'radiusOffset';\n case THETA2:\n return 'theta2Offset';\n case RADIUS2:\n return 'radius2Offset';\n }\n return undefined;\n}\n\n/**\n * Get the main channel for a range channel. E.g. `x` for `x2`.\n */\nexport function getOffsetScaleChannel(channel: Channel): OffsetScaleChannel {\n switch (channel) {\n case X:\n return 'xOffset';\n case Y:\n return 'yOffset';\n }\n return undefined;\n}\n\nexport function getMainChannelFromOffsetChannel(channel: OffsetScaleChannel): PositionScaleChannel {\n switch (channel) {\n case 'xOffset':\n return 'x';\n case 'yOffset':\n return 'y';\n }\n}\n\n// CHANNELS without COLUMN, ROW\nexport const UNIT_CHANNELS = keys(UNIT_CHANNEL_INDEX);\n\n// NONPOSITION_CHANNELS = UNIT_CHANNELS without X, Y, X2, Y2;\nconst {\n x: _x,\n y: _y,\n // x2 and y2 share the same scale as x and y\n x2: _x2,\n y2: _y2,\n //\n xOffset: _xo,\n yOffset: _yo,\n latitude: _latitude,\n longitude: _longitude,\n latitude2: _latitude2,\n longitude2: _longitude2,\n theta: _theta,\n theta2: _theta2,\n radius: _radius,\n radius2: _radius2,\n // The rest of unit channels then have scale\n ...NONPOSITION_CHANNEL_INDEX\n} = UNIT_CHANNEL_INDEX;\n\nexport const NONPOSITION_CHANNELS = keys(NONPOSITION_CHANNEL_INDEX);\nexport type NonPositionChannel = (typeof NONPOSITION_CHANNELS)[number];\n\nconst POSITION_SCALE_CHANNEL_INDEX = {\n x: 1,\n y: 1\n} as const;\nexport const POSITION_SCALE_CHANNELS = keys(POSITION_SCALE_CHANNEL_INDEX);\nexport type PositionScaleChannel = keyof typeof POSITION_SCALE_CHANNEL_INDEX;\n\nexport function isXorY(channel: ExtendedChannel): channel is PositionScaleChannel {\n return channel in POSITION_SCALE_CHANNEL_INDEX;\n}\n\nexport const POLAR_POSITION_SCALE_CHANNEL_INDEX = {\n theta: 1,\n radius: 1\n} as const;\n\nexport const POLAR_POSITION_SCALE_CHANNELS = keys(POLAR_POSITION_SCALE_CHANNEL_INDEX);\nexport type PolarPositionScaleChannel = keyof typeof POLAR_POSITION_SCALE_CHANNEL_INDEX;\n\nexport function getPositionScaleChannel(sizeType: 'width' | 'height'): PositionScaleChannel {\n return sizeType === 'width' ? X : Y;\n}\n\nconst OFFSET_SCALE_CHANNEL_INDEX: {xOffset: 1; yOffset: 1} = {xOffset: 1, yOffset: 1};\n\nexport const OFFSET_SCALE_CHANNELS = keys(OFFSET_SCALE_CHANNEL_INDEX);\n\nexport type OffsetScaleChannel = (typeof OFFSET_SCALE_CHANNELS)[0];\n\nexport function isXorYOffset(channel: Channel): channel is OffsetScaleChannel {\n return channel in OFFSET_SCALE_CHANNEL_INDEX;\n}\n\n// NON_POSITION_SCALE_CHANNEL = SCALE_CHANNELS without position / offset\nconst {\n // x2 and y2 share the same scale as x and y\n // text and tooltip have format instead of scale,\n // href has neither format, nor scale\n text: _t,\n tooltip: _tt,\n href: _hr,\n url: _u,\n description: _al,\n // detail and order have no scale\n detail: _dd,\n key: _k,\n order: _oo,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n} = NONPOSITION_CHANNEL_INDEX;\nexport const NONPOSITION_SCALE_CHANNELS = keys(NONPOSITION_SCALE_CHANNEL_INDEX);\nexport type NonPositionScaleChannel = (typeof NONPOSITION_SCALE_CHANNELS)[number];\n\nexport function isNonPositionScaleChannel(channel: Channel): channel is NonPositionScaleChannel {\n return !!NONPOSITION_CHANNEL_INDEX[channel];\n}\n\n/**\n * @returns whether Vega supports legends for a particular channel\n */\nexport function supportLegend(channel: NonPositionScaleChannel) {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n case SIZE:\n case SHAPE:\n case OPACITY:\n case STROKEWIDTH:\n case STROKEDASH:\n return true;\n case FILLOPACITY:\n case STROKEOPACITY:\n case ANGLE:\n return false;\n }\n}\n\n// Declare SCALE_CHANNEL_INDEX\nconst SCALE_CHANNEL_INDEX = {\n ...POSITION_SCALE_CHANNEL_INDEX,\n ...POLAR_POSITION_SCALE_CHANNEL_INDEX,\n ...OFFSET_SCALE_CHANNEL_INDEX,\n ...NONPOSITION_SCALE_CHANNEL_INDEX\n};\n\n/** List of channels with scales */\nexport const SCALE_CHANNELS = keys(SCALE_CHANNEL_INDEX);\nexport type ScaleChannel = (typeof SCALE_CHANNELS)[number];\n\nexport function isScaleChannel(channel: Channel): channel is ScaleChannel {\n return !!SCALE_CHANNEL_INDEX[channel];\n}\n\nexport type SupportedMark = Partial>;\n\n/**\n * Return whether a channel supports a particular mark type.\n * @param channel channel name\n * @param mark the mark type\n * @return whether the mark supports the channel\n */\nexport function supportMark(channel: ExtendedChannel, mark: Mark) {\n return getSupportedMark(channel)[mark];\n}\n\nconst ALL_MARKS: Record = {\n // all marks\n arc: 'always',\n area: 'always',\n bar: 'always',\n circle: 'always',\n geoshape: 'always',\n image: 'always',\n line: 'always',\n rule: 'always',\n point: 'always',\n rect: 'always',\n square: 'always',\n trail: 'always',\n text: 'always',\n tick: 'always'\n};\n\nconst {geoshape: _g, ...ALL_MARKS_EXCEPT_GEOSHAPE} = ALL_MARKS;\n\n/**\n * Return a dictionary showing whether a channel supports mark type.\n * @param channel\n * @return A dictionary mapping mark types to 'always', 'binned', or undefined\n */\nfunction getSupportedMark(channel: ExtendedChannel): SupportedMark {\n switch (channel) {\n case COLOR:\n case FILL:\n case STROKE:\n // falls through\n\n case DESCRIPTION:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case ORDER: // TODO: revise (order might not support rect, which is not stackable?)\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n\n // falls through\n\n case FACET:\n case ROW: // falls through\n case COLUMN:\n return ALL_MARKS;\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case LATITUDE:\n case LONGITUDE:\n // all marks except geoshape. geoshape does not use X, Y -- it uses a projection\n return ALL_MARKS_EXCEPT_GEOSHAPE;\n case X2:\n case Y2:\n case LATITUDE2:\n case LONGITUDE2:\n return {\n area: 'always',\n bar: 'always',\n image: 'always',\n rect: 'always',\n rule: 'always',\n circle: 'binned',\n point: 'binned',\n square: 'binned',\n tick: 'binned',\n line: 'binned',\n trail: 'binned'\n };\n case SIZE:\n return {\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n text: 'always',\n line: 'always',\n trail: 'always'\n };\n case STROKEDASH:\n return {\n line: 'always',\n point: 'always',\n tick: 'always',\n rule: 'always',\n circle: 'always',\n square: 'always',\n bar: 'always',\n geoshape: 'always'\n };\n case SHAPE:\n return {point: 'always', geoshape: 'always'};\n case TEXT:\n return {text: 'always'};\n case ANGLE:\n return {point: 'always', square: 'always', text: 'always'};\n case URL:\n return {image: 'always'};\n case THETA:\n return {text: 'always', arc: 'always'};\n case RADIUS:\n return {text: 'always', arc: 'always'};\n case THETA2:\n case RADIUS2:\n return {arc: 'always'};\n }\n}\n\nexport function rangeType(channel: ExtendedChannel): RangeType {\n switch (channel) {\n case X:\n case Y:\n case THETA:\n case RADIUS:\n case XOFFSET:\n case YOFFSET:\n case SIZE:\n case ANGLE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n\n // X2 and Y2 use X and Y scales, so they similarly have continuous range. [falls through]\n case X2:\n case Y2:\n case THETA2:\n case RADIUS2:\n return undefined;\n\n case FACET:\n case ROW:\n case COLUMN:\n case SHAPE:\n case STROKEDASH:\n // TEXT, TOOLTIP, URL, and HREF have no scale but have discrete output [falls through]\n case TEXT:\n case TOOLTIP:\n case HREF:\n case URL:\n case DESCRIPTION:\n return 'discrete';\n\n // Color can be either continuous or discrete, depending on scale type.\n case COLOR:\n case FILL:\n case STROKE:\n return 'flexible';\n\n // No scale, no range type.\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n case DETAIL:\n case KEY:\n case ORDER:\n return undefined;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isString} from 'vega-util';\nimport {FieldName} from './channeldef';\nimport {contains, Flag} from './util';\n\nconst AGGREGATE_OP_INDEX: Flag = {\n argmax: 1,\n argmin: 1,\n average: 1,\n count: 1,\n distinct: 1,\n product: 1,\n max: 1,\n mean: 1,\n median: 1,\n min: 1,\n missing: 1,\n q1: 1,\n q3: 1,\n ci0: 1,\n ci1: 1,\n stderr: 1,\n stdev: 1,\n stdevp: 1,\n sum: 1,\n valid: 1,\n values: 1,\n variance: 1,\n variancep: 1\n};\n\nexport const MULTIDOMAIN_SORT_OP_INDEX = {\n count: 1,\n min: 1,\n max: 1\n};\n\nexport interface ArgminDef {\n argmin: FieldName;\n}\n\nexport interface ArgmaxDef {\n argmax: FieldName;\n}\n\nexport type NonArgAggregateOp = Exclude;\n\nexport type Aggregate = NonArgAggregateOp | ArgmaxDef | ArgminDef;\n\nexport function isArgminDef(a: Aggregate | string): a is ArgminDef {\n return !!a && !!a['argmin'];\n}\n\nexport function isArgmaxDef(a: Aggregate | string): a is ArgmaxDef {\n return !!a && !!a['argmax'];\n}\n\nexport function isAggregateOp(a: string | ArgminDef | ArgmaxDef): a is AggregateOp {\n return isString(a) && !!AGGREGATE_OP_INDEX[a];\n}\n\nexport const COUNTING_OPS = new Set([\n 'count',\n 'valid',\n 'missing',\n 'distinct'\n]) as ReadonlySet;\n\nexport function isCountingAggregateOp(aggregate?: string | Aggregate): boolean {\n return isString(aggregate) && COUNTING_OPS.has(aggregate as any);\n}\n\nexport function isMinMaxOp(aggregate?: Aggregate | string): boolean {\n return isString(aggregate) && contains(['min', 'max'], aggregate);\n}\n\n/** Additive-based aggregation operations. These can be applied to stack. */\nexport const SUM_OPS = new Set([\n 'count',\n 'sum',\n 'distinct',\n 'valid',\n 'missing'\n]) as ReadonlySet;\n\n/**\n * Aggregation operators that always produce values within the range [domainMin, domainMax].\n */\nexport const SHARED_DOMAIN_OPS = new Set([\n 'mean',\n 'average',\n 'median',\n 'q1',\n 'q3',\n 'min',\n 'max'\n]) as ReadonlySet;\n","import {isBoolean, isObject} from 'vega-util';\nimport {\n COLOR,\n COLUMN,\n ExtendedChannel,\n FILL,\n FILLOPACITY,\n OPACITY,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH\n} from './channel';\nimport {normalizeBin} from './channeldef';\nimport {ParameterExtent} from './selection';\nimport {entries, keys, varName} from './util';\n\nexport interface BaseBin {\n /**\n * The number base to use for automatic bin determination (default is base 10).\n *\n * __Default value:__ `10`\n *\n */\n base?: number;\n /**\n * An exact step size to use between bins.\n *\n * __Note:__ If provided, options such as maxbins will be ignored.\n */\n step?: number;\n /**\n * An array of allowable step sizes to choose from.\n * @minItems 1\n */\n steps?: number[];\n /**\n * A minimum allowable step size (particularly useful for integer values).\n */\n minstep?: number;\n /**\n * Scale factors indicating allowable subdivisions. The default value is [5, 2], which indicates that for base 10 numbers (the default base), the method may consider dividing bin sizes by 5 and/or 2. For example, for an initial step size of 10, the method can check if bin sizes of 2 (= 10/5), 5 (= 10/2), or 1 (= 10/(5*2)) might also satisfy the given constraints.\n *\n * __Default value:__ `[5, 2]`\n *\n * @minItems 1\n */\n divide?: [number, number];\n /**\n * Maximum number of bins.\n *\n * __Default value:__ `6` for `row`, `column` and `shape` channels; `10` for other channels\n *\n * @minimum 2\n */\n maxbins?: number;\n /**\n * A value in the binned domain at which to anchor the bins, shifting the bin boundaries if necessary to ensure that a boundary aligns with the anchor value.\n *\n * __Default value:__ the minimum bin extent value\n */\n anchor?: number;\n /**\n * If true, attempts to make the bin boundaries use human-friendly boundaries, such as multiples of ten.\n *\n * __Default value:__ `true`\n */\n nice?: boolean;\n}\n\n/**\n * Binning properties or boolean flag for determining whether to bin data or not.\n */\nexport interface BinParams extends BaseBin {\n /**\n * A two-element (`[min, max]`) array indicating the range of desired bin values.\n */\n extent?: BinExtent; // VgBinTransform uses a different extent so we need to pull this out.\n\n /**\n * When set to `true`, Vega-Lite treats the input data as already binned.\n */\n binned?: boolean;\n}\n\nexport type Bin = boolean | BinParams | 'binned' | null;\n\nexport type BinExtent = [number, number] | ParameterExtent;\n\n/**\n * Create a key for the bin configuration. Not for prebinned bin.\n */\nexport function binToString(bin: BinParams | true) {\n if (isBoolean(bin)) {\n bin = normalizeBin(bin, undefined);\n }\n return (\n 'bin' +\n keys(bin)\n .map(p => (isParameterExtent(bin[p]) ? varName(`_${p}_${entries(bin[p])}`) : varName(`_${p}_${bin[p]}`)))\n .join('')\n );\n}\n\n/**\n * Vega-Lite should bin the data.\n */\nexport function isBinning(bin: BinParams | boolean | 'binned'): bin is BinParams | true {\n return bin === true || (isBinParams(bin) && !bin.binned);\n}\n\n/**\n * The data is already binned and so Vega-Lite should not bin it again.\n */\nexport function isBinned(bin: BinParams | boolean | 'binned'): bin is 'binned' | BinParams {\n return bin === 'binned' || (isBinParams(bin) && bin.binned === true);\n}\n\nexport function isBinParams(bin: BinParams | boolean | 'binned'): bin is BinParams {\n return isObject(bin);\n}\n\nexport function isParameterExtent(extent: BinExtent): extent is ParameterExtent {\n return extent?.['param'];\n}\n\nexport function autoMaxBins(channel?: ExtendedChannel): number {\n switch (channel) {\n case ROW:\n case COLUMN:\n case SIZE:\n case COLOR:\n case FILL:\n case STROKE:\n case STROKEWIDTH:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // Facets and Size shouldn't have too many bins\n // We choose 6 like shape to simplify the rule [falls through]\n case SHAPE:\n return 6; // Vega's \"shape\" has 6 distinct values\n case STROKEDASH:\n return 4; // We only provide 5 different stroke dash values (but 4 is more effective)\n default:\n return 10;\n }\n}\n","import {signalRefOrValue} from './compile/common';\nimport {Dict, keys} from './util';\nimport {MappedExclude} from './vega.schema';\n\nexport interface ExprRef {\n /**\n * Vega expression (which can refer to Vega-Lite parameters).\n */\n expr: string;\n}\n\nexport function isExprRef(o: any): o is ExprRef {\n return !!o?.expr;\n}\n\nexport function replaceExprRef>(index: T) {\n const props = keys(index || {});\n const newIndex: Dict = {};\n for (const prop of props) {\n newIndex[prop] = signalRefOrValue(index[prop]);\n }\n return newIndex as MappedExclude;\n}\n","import {BaseTitle, SignalRef, Text, TextEncodeEntry, TitleAnchor} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {ExprRef} from './expr';\nimport {MarkConfig} from './mark';\nimport {pick} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith, MappedExcludeValueRef} from './vega.schema';\n\nexport type BaseTitleNoValueRefs = MapExcludeValueRefAndReplaceSignalWith<\n Omit,\n ES\n> &\n // Since some logic depends on align/baseline, Vega-Lite does NOT allow signal for them.\n MappedExcludeValueRef>;\n\nexport type TitleConfig = BaseTitleNoValueRefs;\n\nexport interface TitleBase extends BaseTitleNoValueRefs {\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n *\n * __Default value:__ `\"middle\"` for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views.\n * `\"start\"` for other composite views.\n *\n * __Note:__ [For now](https://github.com/vega/vega-lite/issues/2875), `anchor` is only customizable only for [single](https://vega.github.io/vega-lite/docs/spec.html) and [layered](https://vega.github.io/vega-lite/docs/layer.html) views. For other composite views, `anchor` is always `\"start\"`.\n */\n anchor?: TitleAnchor;\n\n /**\n * A [mark style property](https://vega.github.io/vega-lite/docs/config.html#style) to apply to the title text mark.\n *\n * __Default value:__ `\"group-title\"`.\n */\n style?: string | string[];\n\n /**\n * \tThe integer z-index indicating the layering of the title group relative to other axis, mark and legend groups.\n *\n * __Default value:__ `0`.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n\n /**\n * Mark definitions for custom encoding.\n *\n * @hidden\n */\n encoding?: TextEncodeEntry;\n}\n\nexport interface TitleParams extends TitleBase {\n /**\n * The title text.\n */\n text: Text | ES;\n\n /**\n * The subtitle Text.\n */\n subtitle?: Text;\n}\n\nexport function extractTitleConfig(titleConfig: TitleConfig): {\n titleMarkConfig: MarkConfig;\n subtitleMarkConfig: MarkConfig;\n /** These are non-mark title config that need to be hardcoded in the title directive. */\n nonMarkTitleProperties: BaseTitleNoValueRefs;\n subtitle: BaseTitleNoValueRefs;\n} {\n const {\n // These are non-mark title config that need to be hardcoded\n anchor,\n frame,\n offset,\n orient,\n angle,\n limit,\n\n // color needs to be redirect to fill\n color,\n\n // subtitle properties\n subtitleColor,\n subtitleFont,\n subtitleFontSize,\n subtitleFontStyle,\n subtitleFontWeight,\n subtitleLineHeight,\n subtitlePadding,\n\n // The rest are mark config.\n ...rest\n } = titleConfig;\n\n const titleMarkConfig: MarkConfig = {\n ...rest,\n ...(color ? {fill: color} : {})\n };\n\n // These are non-mark title config that need to be hardcoded\n const nonMarkTitleProperties: BaseTitleNoValueRefs = {\n ...(anchor ? {anchor} : {}),\n ...(frame ? {frame} : {}),\n ...(offset ? {offset} : {}),\n ...(orient ? {orient} : {}),\n ...(angle !== undefined ? {angle} : {}),\n ...(limit !== undefined ? {limit} : {})\n };\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n const subtitle: BaseTitleNoValueRefs = {\n ...(subtitleColor ? {subtitleColor} : {}),\n ...(subtitleFont ? {subtitleFont} : {}),\n ...(subtitleFontSize ? {subtitleFontSize} : {}),\n ...(subtitleFontStyle ? {subtitleFontStyle} : {}),\n ...(subtitleFontWeight ? {subtitleFontWeight} : {}),\n ...(subtitleLineHeight ? {subtitleLineHeight} : {}),\n ...(subtitlePadding ? {subtitlePadding} : {})\n };\n\n const subtitleMarkConfig = pick(titleConfig, ['align', 'baseline', 'dx', 'dy', 'limit']);\n\n return {titleMarkConfig, subtitleMarkConfig, nonMarkTitleProperties, subtitle};\n}\n\nexport function isText(v: any): v is Text {\n return isString(v) || (isArray(v) && isString(v[0]));\n}\n","import type {\n AggregateOp,\n BandScale,\n BaseScale,\n BinOrdinalScale,\n ColorValueRef,\n Compare as VgCompare,\n ExprRef as VgExprRef,\n GeoShapeTransform as VgGeoShapeTransform,\n IdentityScale,\n LayoutAlign,\n LinearScale,\n LogScale,\n Mark,\n MarkConfig,\n NumericValueRef,\n OrdinalScale,\n PointScale,\n PowScale,\n ProjectionType,\n QuantileScale,\n QuantizeScale,\n RangeBand,\n RangeRaw,\n RangeScheme,\n ScaleData,\n ScaleDataRef,\n ScaledValueRef,\n ScaleMultiDataRef,\n ScaleMultiFieldsRef,\n SequentialScale,\n SignalRef,\n SortField as VgSortField,\n SqrtScale,\n SymLogScale,\n ThresholdScale,\n TimeInterval,\n TimeIntervalStep,\n TimeScale,\n Title as VgTitle,\n Transforms as VgTransform,\n UnionSortField as VgUnionSortField\n} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Value} from './channeldef';\nimport {ExprRef} from './expr';\nimport {SortOrder} from './sort';\nimport {Dict, Flag, keys} from './util';\n\nexport type {VgSortField, VgUnionSortField, VgCompare, VgTitle, LayoutAlign, ProjectionType, VgExprRef};\n\n// TODO: make recursive (e.g. with https://stackoverflow.com/a/64900252/214950 but needs https://github.com/vega/ts-json-schema-generator/issues/568)\nexport type MappedExclude = {\n [P in keyof T]: Exclude;\n};\n\nexport type MapExcludeAndKeepSignalAs = {\n [P in keyof T]: SignalRef extends T[P] ? Exclude | S : Exclude;\n};\n\n// Remove ValueRefs from mapped types\nexport type MappedExcludeValueRef = MappedExclude | NumericValueRef | ColorValueRef>;\n\nexport type MapExcludeValueRefAndReplaceSignalWith = MapExcludeAndKeepSignalAs<\n T,\n ScaledValueRef | NumericValueRef | ColorValueRef,\n S\n>;\n\nexport interface VgData {\n name: string;\n source?: string;\n values?: any;\n format?: {\n type?: string;\n parse?: string | Dict;\n property?: string;\n feature?: string;\n mesh?: string;\n };\n url?: string;\n transform?: VgTransform[];\n}\n\nexport type VgScaleDataRefWithSort = ScaleDataRef & {\n sort?: VgSortField;\n};\n\nexport function isSignalRef(o: any): o is SignalRef {\n return !!o?.signal;\n}\n\n// TODO: add type of value (Make it VgValueRef {value?:V ...})\nexport interface VgValueRef {\n value?: Value; // value should never be a signal so we use never\n field?:\n | string\n | {\n datum?: string;\n group?: string;\n parent?: string;\n };\n signal?: string;\n scale?: string; // TODO: object\n mult?: number;\n offset?: number | VgValueRef;\n band?: boolean | number | VgValueRef;\n test?: string;\n}\n\n// TODO: add vg prefix\nexport type VgScaleMultiDataRefWithSort = ScaleMultiDataRef & {\n fields: (any[] | VgScaleDataRefWithSort | SignalRef)[];\n sort?: VgUnionSortField;\n};\n\nexport type VgMultiFieldsRefWithSort = ScaleMultiFieldsRef & {\n sort?: VgUnionSortField;\n};\n\nexport type VgRange = RangeScheme | ScaleData | RangeBand | RangeRaw;\n\nexport function isVgRangeStep(range: VgRange): range is VgRangeStep {\n return !!range['step'];\n}\n\nexport interface VgRangeStep {\n step: number | SignalRef;\n}\n// Domains that are not a union of domains\nexport type VgNonUnionDomain = (null | string | number | boolean | SignalRef)[] | VgScaleDataRefWithSort | SignalRef;\n\nexport type VgDomain = BaseScale['domain'];\n\nexport type VgMarkGroup = any;\n\n/**\n * A combined type for any Vega scales that Vega-Lite can generate\n */\nexport type VgScale = Pick & {\n range?: RangeScheme | RangeBand | ScaleData; // different Vega scales have conflicting range, need to union them here\n nice?: boolean | number | TimeInterval | TimeIntervalStep | SignalRef; // different Vega scales have conflicting range, need to union them here\n zero?: boolean | SignalRef; // LogScale only allow false, making the intersection type overly strict\n} & Omit<\n // Continuous\n Omit &\n Omit &\n Omit &\n Omit, 'type'> & // use partial so exponent is not required\n Omit &\n Omit &\n Omit &\n // Discretizing\n Omit &\n Omit &\n Omit &\n Omit &\n // Sequential\n Omit &\n // Discrete\n Omit &\n Omit &\n Omit,\n 'range' | 'nice' | 'zero'\n >;\n\nexport interface RowCol {\n row?: T;\n column?: T;\n}\n\nexport interface VgLayout {\n center?: boolean | RowCol;\n padding?: number | RowCol;\n headerBand?: number | RowCol;\n footerBand?: number | RowCol;\n\n titleAnchor?: 'start' | 'end' | RowCol<'start' | 'end'>;\n offset?:\n | number\n | {\n rowHeader?: number;\n rowFooter?: number;\n rowTitle?: number;\n columnHeader?: number;\n columnFooter?: number;\n columnTitle?: number;\n };\n bounds?: 'full' | 'flush';\n columns?: number | {signal: string};\n align?: LayoutAlign | RowCol;\n}\n\nexport function isDataRefUnionedDomain(domain: VgDomain): domain is VgScaleMultiDataRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && !('data' in domain);\n }\n return false;\n}\n\nexport function isFieldRefUnionDomain(domain: VgDomain): domain is VgMultiFieldsRefWithSort {\n if (!isArray(domain)) {\n return 'fields' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport function isDataRefDomain(domain: VgDomain | any): domain is VgScaleDataRefWithSort {\n if (!isArray(domain)) {\n return 'field' in domain && 'data' in domain;\n }\n return false;\n}\n\nexport type VgEncodeChannel =\n | 'x'\n | 'x2'\n | 'xc'\n | 'width'\n | 'y'\n | 'y2'\n | 'yc'\n | 'height'\n | 'opacity'\n | 'fill'\n | 'fillOpacity'\n | 'stroke'\n | 'strokeWidth'\n | 'strokeCap'\n | 'strokeOpacity'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeMiterLimit'\n | 'strokeJoin'\n | 'strokeOffset'\n | 'strokeForeground'\n | 'cursor'\n | 'clip'\n | 'size'\n | 'shape'\n | 'path'\n | 'innerRadius'\n | 'outerRadius'\n | 'startAngle'\n | 'endAngle'\n | 'interpolate'\n | 'tension'\n | 'orient'\n | 'url'\n | 'align'\n | 'baseline'\n | 'text'\n | 'dir'\n | 'ellipsis'\n | 'limit'\n | 'dx'\n | 'dy'\n | 'radius'\n | 'theta'\n | 'angle'\n | 'font'\n | 'fontSize'\n | 'fontWeight'\n | 'fontStyle'\n | 'tooltip'\n | 'href'\n | 'cursor'\n | 'defined'\n | 'cornerRadius'\n | 'cornerRadiusTopLeft'\n | 'cornerRadiusTopRight'\n | 'cornerRadiusBottomRight'\n | 'cornerRadiusBottomLeft'\n | 'scaleX'\n | 'scaleY';\n\nexport type VgEncodeEntry = Partial>;\n\n// TODO: make export interface VgEncodeEntry {\n// x?: VgValueRef\n// y?: VgValueRef\n// ...\n// color?: VgValueRef\n// ...\n// }\n\nexport type VgPostEncodingTransform = VgGeoShapeTransform;\n\nconst VG_MARK_CONFIG_INDEX: Flag = {\n aria: 1,\n description: 1,\n ariaRole: 1,\n ariaRoleDescription: 1,\n blend: 1,\n opacity: 1,\n fill: 1,\n fillOpacity: 1,\n stroke: 1,\n strokeCap: 1,\n strokeWidth: 1,\n strokeOpacity: 1,\n strokeDash: 1,\n strokeDashOffset: 1,\n strokeJoin: 1,\n strokeOffset: 1,\n strokeMiterLimit: 1,\n startAngle: 1,\n endAngle: 1,\n padAngle: 1,\n innerRadius: 1,\n outerRadius: 1,\n size: 1,\n shape: 1,\n interpolate: 1,\n tension: 1,\n orient: 1,\n align: 1,\n baseline: 1,\n text: 1,\n dir: 1,\n dx: 1,\n dy: 1,\n ellipsis: 1,\n limit: 1,\n radius: 1,\n theta: 1,\n angle: 1,\n font: 1,\n fontSize: 1,\n fontWeight: 1,\n fontStyle: 1,\n lineBreak: 1,\n lineHeight: 1,\n cursor: 1,\n href: 1,\n tooltip: 1,\n cornerRadius: 1,\n cornerRadiusTopLeft: 1,\n cornerRadiusTopRight: 1,\n cornerRadiusBottomLeft: 1,\n cornerRadiusBottomRight: 1,\n aspect: 1,\n width: 1,\n height: 1,\n url: 1,\n smooth: 1\n\n // commented below are vg channel that do not have mark config.\n // x: 1,\n // y: 1,\n // x2: 1,\n // y2: 1,\n\n // xc'|'yc'\n // clip: 1,\n // path: 1,\n // url: 1,\n};\n\nexport const VG_MARK_CONFIGS = keys(VG_MARK_CONFIG_INDEX);\n\nexport const VG_MARK_INDEX: Flag = {\n arc: 1,\n area: 1,\n group: 1,\n image: 1,\n line: 1,\n path: 1,\n rect: 1,\n rule: 1,\n shape: 1,\n symbol: 1,\n text: 1,\n trail: 1\n};\n\n// Vega's cornerRadius channels.\nexport const VG_CORNERRADIUS_CHANNELS = [\n 'cornerRadius',\n 'cornerRadiusTopLeft',\n 'cornerRadiusTopRight',\n 'cornerRadiusBottomLeft',\n 'cornerRadiusBottomRight'\n] as const;\n\nexport interface VgComparator {\n field?: string | string[];\n order?: SortOrder | SortOrder[];\n}\n\nexport interface VgJoinAggregateTransform {\n type: 'joinaggregate';\n as?: string[];\n ops?: AggregateOp[];\n fields?: string[];\n groupby?: string[];\n}\n","import {ExprRef, SignalRef, Text} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {AxisConfig, ConditionalAxisProperty} from '../axis';\nimport {\n ConditionalPredicate,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldRefOption,\n OrderFieldDef,\n Value,\n ValueDef,\n vgField\n} from '../channeldef';\nimport {Config, StyleConfigIndex} from '../config';\nimport {isExprRef} from '../expr';\nimport {Mark, MarkConfig, MarkDef} from '../mark';\nimport {SortFields} from '../sort';\nimport {isText} from '../title';\nimport {deepEqual, getFirstDefined} from '../util';\nimport {isSignalRef, VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../vega.schema';\nimport {AxisComponentProps} from './axis/component';\nimport {Explicit} from './split';\nimport {UnitModel} from './unit';\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function signalOrValueRefWithCondition(\n val: ConditionalAxisProperty\n): ConditionalAxisProperty {\n const condition = isArray(val.condition)\n ? (val.condition as ConditionalPredicate | ExprRef | SignalRef>[]).map(conditionalSignalRefOrValue)\n : conditionalSignalRefOrValue(val.condition);\n\n return {\n ...signalRefOrValue>(val),\n condition\n };\n}\n\nexport function signalRefOrValue(value: T | SignalRef | ExprRef): T | SignalRef {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n return value;\n}\n\nexport function conditionalSignalRefOrValue | DatumDef | ValueDef>(\n value: ConditionalPredicate\n): ConditionalPredicate {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n return value;\n}\n\nexport function signalOrValueRef(value: T | SignalRef | ExprRef): {value: T} | SignalRef {\n if (isExprRef(value)) {\n const {expr, ...rest} = value;\n return {signal: expr, ...rest};\n }\n if (isSignalRef(value)) {\n return value;\n }\n return value !== undefined ? {value} : undefined;\n}\n\nexport function exprFromSignalRefOrValue(ref: Value | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref);\n}\nexport function exprFromValueRefOrSignalRef(ref: VgValueRef | SignalRef): string {\n if (isSignalRef(ref)) {\n return ref.signal;\n }\n return stringValue(ref.value);\n}\n\nexport function signalOrStringValue(v: SignalRef | any) {\n if (isSignalRef(v)) {\n return v.signal;\n }\n return v == null ? null : stringValue(v);\n}\n\nexport function applyMarkConfig(e: VgEncodeEntry, model: UnitModel, propsList: (keyof MarkConfig)[]) {\n for (const property of propsList) {\n const value = getMarkConfig(property, model.markDef, model.config);\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n return e;\n}\n\nexport function getStyles(mark: MarkDef): string[] {\n return [].concat(mark.type, mark.style ?? []);\n}\n\nexport function getMarkPropOrConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n opt: {\n vgChannel?: VgEncodeChannel;\n ignoreVgConfig?: boolean;\n } = {}\n): MarkDef[P] {\n const {vgChannel, ignoreVgConfig} = opt;\n if (vgChannel && mark[vgChannel] !== undefined) {\n return mark[vgChannel];\n } else if (mark[channel] !== undefined) {\n return mark[channel];\n } else if (ignoreVgConfig && (!vgChannel || vgChannel === channel)) {\n return undefined;\n }\n\n return getMarkConfig(channel, mark, config, opt);\n}\n\n/**\n * Return property value from style or mark specific config property if exists.\n * Otherwise, return general mark specific config.\n */\nexport function getMarkConfig

(\n channel: P,\n mark: MarkDef,\n config: Config,\n {vgChannel}: {vgChannel?: VgEncodeChannel} = {}\n): MarkDef[P] {\n return getFirstDefined[P]>(\n // style config has highest precedence\n vgChannel ? getMarkStyleConfig(channel, mark, config.style) : undefined,\n getMarkStyleConfig(channel, mark, config.style),\n // then mark-specific config\n vgChannel ? config[mark.type][vgChannel] : undefined,\n\n config[mark.type][channel as any], // Need to cast because MarkDef doesn't perfectly match with AnyMarkConfig, but if the type isn't available, we'll get nothing here, which is fine\n\n // If there is vgChannel, skip vl channel.\n // For example, vl size for text is vg fontSize, but config.mark.size is only for point size.\n vgChannel ? config.mark[vgChannel] : config.mark[channel as any] // Need to cast for the same reason as above\n );\n}\n\nexport function getMarkStyleConfig

(\n prop: P,\n mark: MarkDef,\n styleConfigIndex: StyleConfigIndex\n) {\n return getStyleConfig(prop, getStyles(mark), styleConfigIndex);\n}\n\nexport function getStyleConfig

>(\n p: P,\n styles: string | string[],\n styleConfigIndex: StyleConfigIndex\n) {\n styles = array(styles);\n let value;\n for (const style of styles) {\n const styleConfig = styleConfigIndex[style];\n\n if (styleConfig && styleConfig[p as string] !== undefined) {\n value = styleConfig[p as string];\n }\n }\n return value;\n}\n\n/**\n * Return Vega sort parameters (tuple of field and order).\n */\nexport function sortParams(\n orderDef: OrderFieldDef | OrderFieldDef[],\n fieldRefOption?: FieldRefOption\n): SortFields {\n return array(orderDef).reduce(\n (s, orderChannelDef) => {\n s.field.push(vgField(orderChannelDef, fieldRefOption));\n s.order.push(orderChannelDef.sort ?? 'ascending');\n return s;\n },\n {field: [], order: []}\n );\n}\n\nexport type AxisTitleComponent = AxisComponentProps['title'];\n\nexport function mergeTitleFieldDefs(f1: readonly FieldDefBase[], f2: readonly FieldDefBase[]) {\n const merged = [...f1];\n\n f2.forEach(fdToMerge => {\n for (const fieldDef1 of merged) {\n // If already exists, no need to append to merged array\n if (deepEqual(fieldDef1, fdToMerge)) {\n return;\n }\n }\n merged.push(fdToMerge);\n });\n return merged;\n}\n\nexport function mergeTitle(title1: Text | SignalRef, title2: Text | SignalRef) {\n if (deepEqual(title1, title2) || !title2) {\n // if titles are the same or title2 is falsy\n return title1;\n } else if (!title1) {\n // if title1 is falsy\n return title2;\n } else {\n return [...array(title1), ...array(title2)].join(', ');\n }\n}\n\nexport function mergeTitleComponent(v1: Explicit, v2: Explicit) {\n const v1Val = v1.value;\n const v2Val = v2.value;\n\n if (v1Val == null || v2Val === null) {\n return {\n explicit: v1.explicit,\n value: null\n };\n } else if ((isText(v1Val) || isSignalRef(v1Val)) && (isText(v2Val) || isSignalRef(v2Val))) {\n return {\n explicit: v1.explicit,\n value: mergeTitle(v1Val, v2Val)\n };\n } else if (isText(v1Val) || isSignalRef(v1Val)) {\n return {\n explicit: v1.explicit,\n value: v1Val\n };\n } else if (isText(v2Val) || isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: v2Val\n };\n } else if (!isText(v1Val) && !isSignalRef(v1Val) && !isText(v2Val) && !isSignalRef(v2Val)) {\n return {\n explicit: v1.explicit,\n value: mergeTitleFieldDefs(v1Val, v2Val)\n };\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('It should never reach here');\n}\n","/**\n * Collection of all Vega-Lite Error Messages\n */\nimport {AggregateOp, SignalRef} from 'vega';\nimport {Aggregate} from '../aggregate';\nimport {\n Channel,\n ExtendedChannel,\n FacetChannel,\n getSizeChannel,\n OffsetScaleChannel,\n PositionScaleChannel,\n ScaleChannel\n} from '../channel';\nimport {HiddenCompositeAggregate, TypedFieldDef, Value} from '../channeldef';\nimport {SplitParentProperty} from '../compile/split';\nimport {CompositeMark} from '../compositemark';\nimport {ErrorBarCenter, ErrorBarExtent} from '../compositemark/errorbar';\nimport {DateTime, DateTimeExpr} from '../datetime';\nimport {ExprRef} from '../expr';\nimport {Mark} from '../mark';\nimport {Projection} from '../projection';\nimport {ScaleType} from '../scale';\nimport {GenericSpec} from '../spec';\nimport {Type} from '../type';\nimport {stringify} from '../util';\nimport {VgSortField} from '../vega.schema';\n\nexport function invalidSpec(spec: GenericSpec) {\n return `Invalid specification ${stringify(\n spec\n )}. Make sure the specification includes at least one of the following properties: \"mark\", \"layer\", \"facet\", \"hconcat\", \"vconcat\", \"concat\", or \"repeat\".`;\n}\n\n// FIT\nexport const FIT_NON_SINGLE = 'Autosize \"fit\" only works for single views and layered views.';\n\nexport function containerSizeNonSingle(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n return `${uName} \"container\" only works for single views and layered views.`;\n}\n\nexport function containerSizeNotCompatibleWithAutosize(name: 'width' | 'height') {\n const uName = name == 'width' ? 'Width' : 'Height';\n const fitDirection = name == 'width' ? 'x' : 'y';\n return `${uName} \"container\" only works well with autosize \"fit\" or \"fit-${fitDirection}\".`;\n}\n\nexport function droppingFit(channel?: PositionScaleChannel) {\n return channel\n ? `Dropping \"fit-${channel}\" because spec has discrete ${getSizeChannel(channel)}.`\n : `Dropping \"fit\" because spec has discrete size.`;\n}\n\n// VIEW SIZE\n\nexport function unknownField(channel: Channel) {\n return `Unknown field for ${channel}. Cannot calculate view size.`;\n}\n\n// SELECTION\nexport function cannotProjectOnChannelWithoutField(channel: Channel) {\n return `Cannot project a selection on encoding channel \"${channel}\", which has no field.`;\n}\n\nexport function cannotProjectAggregate(channel: Channel, aggregate: Aggregate | HiddenCompositeAggregate) {\n return `Cannot project a selection on encoding channel \"${channel}\" as it uses an aggregate function (\"${aggregate}\").`;\n}\n\nexport function nearestNotSupportForContinuous(mark: string) {\n return `The \"nearest\" transform is not supported for ${mark} marks.`;\n}\n\nexport function selectionNotSupported(mark: CompositeMark) {\n return `Selection not supported for ${mark} yet.`;\n}\n\nexport function selectionNotFound(name: string) {\n return `Cannot find a selection named \"${name}\".`;\n}\n\nexport const SCALE_BINDINGS_CONTINUOUS =\n 'Scale bindings are currently only supported for scales with unbinned, continuous domains.';\n\nexport const LEGEND_BINDINGS_MUST_HAVE_PROJECTION =\n 'Legend bindings are only supported for selections over an individual field or encoding channel.';\nexport function cannotLookupVariableParameter(name: string) {\n return `Lookups can only be performed on selection parameters. \"${name}\" is a variable parameter.`;\n}\n\nexport function noSameUnitLookup(name: string) {\n return (\n `Cannot define and lookup the \"${name}\" selection in the same view. ` +\n `Try moving the lookup into a second, layered view?`\n );\n}\n\nexport const NEEDS_SAME_SELECTION = 'The same selection must be used to override scale domains in a layered view.';\n\nexport const INTERVAL_INITIALIZED_WITH_POS =\n 'Interval selections should be initialized using \"x\", \"y\", \"longitude\", or \"latitude\" keys.';\n\n// REPEAT\nexport function noSuchRepeatedValue(field: string) {\n return `Unknown repeated value \"${field}\".`;\n}\n\nexport function columnsNotSupportByRowCol(type: 'facet' | 'repeat') {\n return `The \"columns\" property cannot be used when \"${type}\" has nested row/column.`;\n}\n\n// CONCAT / REPEAT\nexport const CONCAT_CANNOT_SHARE_AXIS =\n 'Axes cannot be shared in concatenated or repeated views yet (https://github.com/vega/vega-lite/issues/2415).';\n\n// DATA\nexport function unrecognizedParse(p: string) {\n return `Unrecognized parse \"${p}\".`;\n}\n\nexport function differentParse(field: string, local: string, ancestor: string) {\n return `An ancestor parsed field \"${field}\" as ${ancestor} but a child wants to parse the field as ${local}.`;\n}\n\nexport const ADD_SAME_CHILD_TWICE = 'Attempt to add the same child twice.';\n\n// TRANSFORMS\nexport function invalidTransformIgnored(transform: any) {\n return `Ignoring an invalid transform: ${stringify(transform)}.`;\n}\n\nexport const NO_FIELDS_NEEDS_AS =\n 'If \"from.fields\" is not specified, \"as\" has to be a string that specifies the key to be used for the data from the secondary source.';\n\n// ENCODING & FACET\n\nexport function customFormatTypeNotAllowed(channel: ExtendedChannel) {\n return `Config.customFormatTypes is not true, thus custom format type and format for channel ${channel} are dropped.`;\n}\n\nexport function projectionOverridden(opt: {\n parentProjection: Projection;\n projection: Projection;\n}) {\n const {parentProjection, projection} = opt;\n return `Layer's shared projection ${stringify(parentProjection)} is overridden by a child projection ${stringify(\n projection\n )}.`;\n}\n\nexport const REPLACE_ANGLE_WITH_THETA = 'Arc marks uses theta channel rather than angle, replacing angle with theta.';\n\nexport function offsetNestedInsideContinuousPositionScaleDropped(mainChannel: PositionScaleChannel) {\n return `${mainChannel}Offset dropped because ${mainChannel} is continuous`;\n}\n\nexport function primitiveChannelDef(\n channel: ExtendedChannel,\n type: 'string' | 'number' | 'boolean',\n value: Exclude\n) {\n return `Channel ${channel} is a ${type}. Converted to {value: ${stringify(value)}}.`;\n}\n\nexport function invalidFieldType(type: Type) {\n return `Invalid field type \"${type}\".`;\n}\n\nexport function invalidFieldTypeForCountAggregate(type: Type, aggregate: Aggregate | string) {\n return `Invalid field type \"${type}\" for aggregate: \"${aggregate}\", using \"quantitative\" instead.`;\n}\n\nexport function invalidAggregate(aggregate: AggregateOp | string) {\n return `Invalid aggregation operator \"${aggregate}\".`;\n}\n\nexport function missingFieldType(channel: Channel, newType: Type) {\n return `Missing type for channel \"${channel}\", using \"${newType}\" instead.`;\n}\nexport function droppingColor(type: 'encoding' | 'property', opt: {fill?: boolean; stroke?: boolean}) {\n const {fill, stroke} = opt;\n return `Dropping color ${type} as the plot also has ${\n fill && stroke ? 'fill and stroke' : fill ? 'fill' : 'stroke'\n }.`;\n}\n\nexport function relativeBandSizeNotSupported(sizeChannel: 'width' | 'height') {\n return `Position range does not support relative band size for ${sizeChannel}.`;\n}\n\nexport function emptyFieldDef(fieldDef: unknown, channel: ExtendedChannel) {\n return `Dropping ${stringify(\n fieldDef\n )} from channel \"${channel}\" since it does not contain any data field, datum, value, or signal.`;\n}\n\nexport const LINE_WITH_VARYING_SIZE =\n 'Line marks cannot encode size with a non-groupby field. You may want to use trail marks instead.';\n\nexport function incompatibleChannel(\n channel: ExtendedChannel,\n markOrFacet: Mark | 'facet' | CompositeMark,\n when?: string\n) {\n return `${channel} dropped as it is incompatible with \"${markOrFacet}\"${when ? ` when ${when}` : ''}.`;\n}\n\nexport function offsetEncodingScaleIgnored(channel: OffsetScaleChannel) {\n return `${channel} encoding has no scale, so specified scale is ignored.`;\n}\n\nexport function invalidEncodingChannel(channel: ExtendedChannel) {\n return `${channel}-encoding is dropped as ${channel} is not a valid encoding channel.`;\n}\n\nexport function channelShouldBeDiscrete(channel: ExtendedChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned).`;\n}\n\nexport function channelShouldBeDiscreteOrDiscretizing(channel: ExtendedChannel) {\n return `${channel} encoding should be discrete (ordinal / nominal / binned) or use a discretizing scale (e.g. threshold).`;\n}\n\nexport function facetChannelDropped(channels: FacetChannel[]) {\n return `Facet encoding dropped as ${channels.join(' and ')} ${channels.length > 1 ? 'are' : 'is'} also specified.`;\n}\n\nexport function discreteChannelCannotEncode(channel: Channel, type: Type) {\n return `Using discrete channel \"${channel}\" to encode \"${type}\" field can be misleading as it does not encode ${\n type === 'ordinal' ? 'order' : 'magnitude'\n }.`;\n}\n\n// MARK\n\nexport function rangeMarkAlignmentCannotBeExpression(align: 'align' | 'baseline') {\n return `The ${align} for range marks cannot be an expression`;\n}\n\nexport function lineWithRange(hasX2: boolean, hasY2: boolean) {\n const channels = hasX2 && hasY2 ? 'x2 and y2' : hasX2 ? 'x2' : 'y2';\n return `Line mark is for continuous lines and thus cannot be used with ${channels}. We will use the rule mark (line segments) instead.`;\n}\n\nexport function orientOverridden(original: string, actual: string) {\n return `Specified orient \"${original}\" overridden with \"${actual}\".`;\n}\n\n// SCALE\nexport const CANNOT_UNION_CUSTOM_DOMAIN_WITH_FIELD_DOMAIN =\n 'Custom domain scale cannot be unioned with default field-based domain.';\n\nexport function cannotUseScalePropertyWithNonColor(prop: string) {\n return `Cannot use the scale property \"${prop}\" with non-color channel.`;\n}\n\nexport function cannotUseRelativeBandSizeWithNonBandScale(scaleType: ScaleType) {\n return `Cannot use the relative band size with ${scaleType} scale.`;\n}\n\nexport function unaggregateDomainHasNoEffectForRawField(fieldDef: TypedFieldDef) {\n return `Using unaggregated domain with raw field has no effect (${stringify(fieldDef)}).`;\n}\n\nexport function unaggregateDomainWithNonSharedDomainOp(aggregate: Aggregate | string) {\n return `Unaggregated domain not applicable for \"${aggregate}\" since it produces values outside the origin domain of the source data.`;\n}\n\nexport function unaggregatedDomainWithLogScale(fieldDef: TypedFieldDef) {\n return `Unaggregated domain is currently unsupported for log scale (${stringify(fieldDef)}).`;\n}\n\nexport function cannotApplySizeToNonOrientedMark(mark: Mark) {\n return `Cannot apply size to non-oriented mark \"${mark}\".`;\n}\n\nexport function scaleTypeNotWorkWithChannel(channel: Channel, scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `Channel \"${channel}\" does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scaleTypeNotWorkWithFieldDef(scaleType: ScaleType, defaultScaleType: ScaleType) {\n return `FieldDef does not work with \"${scaleType}\" scale. We are using \"${defaultScaleType}\" scale instead.`;\n}\n\nexport function scalePropertyNotWorkWithScaleType(scaleType: ScaleType, propName: string, channel: Channel) {\n return `${channel}-scale's \"${propName}\" is dropped as it does not work with ${scaleType} scale.`;\n}\n\nexport function scaleTypeNotWorkWithMark(mark: Mark, scaleType: ScaleType) {\n return `Scale type \"${scaleType}\" does not work with mark \"${mark}\".`;\n}\n\nexport function stepDropped(channel: 'width' | 'height') {\n return `The step for \"${channel}\" is dropped because the ${channel === 'width' ? 'x' : 'y'} is continuous.`;\n}\n\nexport function mergeConflictingProperty(\n property: string | number | symbol,\n propertyOf: SplitParentProperty,\n v1: T,\n v2: T\n) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using ${stringify(v1)}.`;\n}\n\nexport function mergeConflictingDomainProperty(property: 'domains', propertyOf: SplitParentProperty, v1: T, v2: T) {\n return `Conflicting ${propertyOf.toString()} property \"${property.toString()}\" (${stringify(v1)} and ${stringify(\n v2\n )}). Using the union of the two domains.`;\n}\n\nexport function independentScaleMeansIndependentGuide(channel: Channel) {\n return `Setting the scale to be independent for \"${channel}\" means we also have to set the guide (axis or legend) to be independent.`;\n}\n\nexport function domainSortDropped(sort: VgSortField) {\n return `Dropping sort property ${stringify(\n sort\n )} as unioned domains only support boolean or op \"count\", \"min\", and \"max\".`;\n}\n\nexport const MORE_THAN_ONE_SORT =\n 'Domains that should be unioned has conflicting sort properties. Sort will be set to true.';\n\nexport const FACETED_INDEPENDENT_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of multiple fields from different data sources. We will use the first field. The result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES =\n 'Detected faceted independent scales that union domain of the same fields from different source. We will assume that this is the same field from a different fork of the same data source. However, if this is not the case, the result view size may be incorrect.';\n\nexport const FACETED_INDEPENDENT_SAME_SOURCE =\n 'Detected faceted independent scales that union domain of multiple fields from the same data source. We will use the first field. The result view size may be incorrect.';\n\n// AXIS\nexport const INVALID_CHANNEL_FOR_AXIS = 'Invalid channel for axis.';\n\n// STACK\nexport function cannotStackRangedMark(channel: Channel) {\n return `Cannot stack \"${channel}\" if there is already \"${channel}2\".`;\n}\n\nexport function cannotStackNonLinearScale(scaleType: ScaleType) {\n return `Cannot stack non-linear scale (${scaleType}).`;\n}\n\nexport function stackNonSummativeAggregate(aggregate: Aggregate | string) {\n return `Stacking is applied even though the aggregate function is non-summative (\"${aggregate}\").`;\n}\n\n// TIMEUNIT\nexport function invalidTimeUnit(unitName: string, value: string | number) {\n return `Invalid ${unitName}: ${stringify(value)}.`;\n}\n\nexport function droppedDay(d: DateTime | DateTimeExpr) {\n return `Dropping day from datetime ${stringify(d)} as day cannot be combined with other units.`;\n}\n\nexport function errorBarCenterAndExtentAreNotNeeded(center: ErrorBarCenter, extent: ErrorBarExtent) {\n return `${extent ? 'extent ' : ''}${extent && center ? 'and ' : ''}${center ? 'center ' : ''}${\n extent && center ? 'are ' : 'is '\n }not needed when data are aggregated.`;\n}\n\nexport function errorBarCenterIsUsedWithWrongExtent(\n center: ErrorBarCenter,\n extent: ErrorBarExtent,\n mark: 'errorbar' | 'errorband'\n) {\n return `${center} is not usually used with ${extent} for ${mark}.`;\n}\n\nexport function errorBarContinuousAxisHasCustomizedAggregate(\n aggregate: Aggregate | string,\n compositeMark: CompositeMark\n) {\n return `Continuous axis should not have customized aggregation function ${aggregate}; ${compositeMark} already agregates the axis.`;\n}\n\nexport function errorBand1DNotSupport(property: 'interpolate' | 'tension') {\n return `1D error band does not support ${property}.`;\n}\n\n// CHANNEL\nexport function channelRequiredForBinned(channel: Channel) {\n return `Channel ${channel} is required for \"binned\" bin.`;\n}\n\nexport function channelShouldNotBeUsedForBinned(channel: ExtendedChannel) {\n return `Channel ${channel} should not be used with \"binned\" bin.`;\n}\n\nexport function domainRequiredForThresholdScale(channel: ScaleChannel) {\n return `Domain for ${channel} is required for threshold scale.`;\n}\n","/**\n * Vega-Lite's singleton logger utility.\n */\n\nimport {Debug, Error as ErrorLevel, Info, logger, LoggerInterface, Warn} from 'vega-util';\nexport * as message from './message';\n\n/**\n * Main (default) Vega Logger instance for Vega-Lite.\n */\nconst main = logger(Warn);\nlet current: LoggerInterface = main;\n\n/**\n * Logger tool for checking if the code throws correct warning.\n */\nexport class LocalLogger implements LoggerInterface {\n public warns: any[] = [];\n public infos: any[] = [];\n public debugs: any[] = [];\n\n #level: number = Warn;\n\n public level(): number;\n public level(_: number): this;\n public level(_?: number) {\n if (_) {\n this.#level = _;\n return this;\n }\n return this.#level;\n }\n\n public warn(...args: readonly any[]) {\n if (this.#level >= Warn) this.warns.push(...args);\n return this;\n }\n\n public info(...args: readonly any[]) {\n if (this.#level >= Info) this.infos.push(...args);\n return this;\n }\n\n public debug(...args: readonly any[]) {\n if (this.#level >= Debug) this.debugs.push(...args);\n return this;\n }\n\n public error(...args: readonly any[]): this {\n if (this.#level >= ErrorLevel) throw Error(...args);\n return this;\n }\n}\n\nexport function wrap(f: (logger: LocalLogger) => void) {\n return () => {\n current = new LocalLogger();\n f(current as LocalLogger);\n reset();\n };\n}\n\n/**\n * Set the singleton logger to be a custom logger.\n */\nexport function set(newLogger: LoggerInterface) {\n current = newLogger;\n return current;\n}\n\n/**\n * Reset the main logger to use the default Vega Logger.\n */\nexport function reset() {\n current = main;\n return current;\n}\n\nexport function error(...args: readonly any[]) {\n current.error(...args);\n}\n\nexport function warn(...args: readonly any[]) {\n current.warn(...args);\n}\n\nexport function info(...args: readonly any[]) {\n current.info(...args);\n}\n\nexport function debug(...args: readonly any[]) {\n current.debug(...args);\n}\n","// DateTime definition object\n\nimport {isNumber, isObject} from 'vega-util';\nimport * as log from './log';\nimport {TIMEUNIT_PARTS} from './timeunit';\nimport {duplicate, isNumeric, keys} from './util';\n\n/**\n * @minimum 1\n * @maximum 12\n * @TJS-type integer\n */\nexport type Month = number;\n\n/**\n * @minimum 1\n * @maximum 7\n */\nexport type Day = number;\n\n/**\n * Object for defining datetime in Vega-Lite Filter.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n * We accept string for month and day names.\n */\nexport interface DateTime {\n /**\n * Integer value representing the year.\n * @TJS-type integer\n */\n year?: number;\n\n /**\n * Integer value representing the quarter of the year (from 1-4).\n * @minimum 1\n * @maximum 4\n * @TJS-type integer\n */\n quarter?: number;\n\n /**\n * One of:\n * (1) integer value representing the month from `1`-`12`. `1` represents January;\n * (2) case-insensitive month name (e.g., `\"January\"`);\n * (3) case-insensitive, 3-character short month name (e.g., `\"Jan\"`).\n */\n month?: Month | string;\n\n /**\n * Integer value representing the date (day of the month) from 1-31.\n * @minimum 1\n * @maximum 31\n * @TJS-type integer\n */\n date?: number;\n\n /**\n * Value representing the day of a week. This can be one of:\n * (1) integer value -- `1` represents Monday;\n * (2) case-insensitive day name (e.g., `\"Monday\"`);\n * (3) case-insensitive, 3-character short day name (e.g., `\"Mon\"`).\n *\n * **Warning:** A DateTime definition object with `day`** should not be combined with `year`, `quarter`, `month`, or `date`.\n */\n day?: Day | string;\n\n /**\n * Integer value representing the hour of a day from 0-23.\n * @minimum 0\n * @maximum 24\n * @TJS-type integer\n */\n hours?: number;\n\n /**\n * Integer value representing the minute segment of time from 0-59.\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n minutes?: number;\n\n /**\n * Integer value representing the second segment (0-59) of a time value\n * @minimum 0\n * @maximum 60\n * @TJS-type integer\n */\n seconds?: number;\n\n /**\n * Integer value representing the millisecond segment of time.\n * @minimum 0\n * @maximum 1000\n * @TJS-type integer\n */\n milliseconds?: number;\n\n /**\n * A boolean flag indicating if date time is in utc time. If false, the date time is in local time\n */\n utc?: boolean;\n}\n\n/**\n * Internal Object for defining datetime expressions.\n * This is an expression version of DateTime.\n * If both month and quarter are provided, month has higher precedence.\n * `day` cannot be combined with other date.\n */\nexport interface DateTimeExpr {\n year?: string;\n quarter?: string;\n month?: string;\n date?: string;\n day?: string;\n hours?: string;\n minutes?: string;\n seconds?: string;\n milliseconds?: string;\n utc?: boolean;\n}\n\nexport function isDateTime(o: any): o is DateTime {\n if (o && isObject(o)) {\n for (const part of TIMEUNIT_PARTS) {\n if (part in o) {\n return true;\n }\n }\n }\n return false;\n}\n\nexport const MONTHS = [\n 'january',\n 'february',\n 'march',\n 'april',\n 'may',\n 'june',\n 'july',\n 'august',\n 'september',\n 'october',\n 'november',\n 'december'\n];\nexport const SHORT_MONTHS = MONTHS.map(m => m.substr(0, 3));\n\nexport const DAYS = ['sunday', 'monday', 'tuesday', 'wednesday', 'thursday', 'friday', 'saturday'];\nexport const SHORT_DAYS = DAYS.map(d => d.substr(0, 3));\n\nfunction normalizeQuarter(q: number | string): number {\n if (isNumeric(q)) {\n q = +q;\n }\n\n if (isNumber(q)) {\n if (q > 4) {\n log.warn(log.message.invalidTimeUnit('quarter', q));\n }\n // We accept 1-based quarter, so need to readjust to 0-based quarter\n return q - 1;\n } else {\n // Invalid quarter\n throw new Error(log.message.invalidTimeUnit('quarter', q));\n }\n}\n\nfunction normalizeMonth(m: string | number): number {\n if (isNumeric(m)) {\n m = +m;\n }\n\n if (isNumber(m)) {\n // We accept 1-based month, so need to readjust to 0-based month\n return m - 1;\n } else {\n const lowerM = m.toLowerCase();\n const monthIndex = MONTHS.indexOf(lowerM);\n if (monthIndex !== -1) {\n return monthIndex; // 0 for january, ...\n }\n const shortM = lowerM.substr(0, 3);\n const shortMonthIndex = SHORT_MONTHS.indexOf(shortM);\n if (shortMonthIndex !== -1) {\n return shortMonthIndex;\n }\n\n // Invalid month\n throw new Error(log.message.invalidTimeUnit('month', m));\n }\n}\n\nfunction normalizeDay(d: string | number): number {\n if (isNumeric(d)) {\n d = +d;\n }\n\n if (isNumber(d)) {\n // mod so that this can be both 0-based where 0 = sunday\n // and 1-based where 7=sunday\n return d % 7;\n } else {\n const lowerD = d.toLowerCase();\n const dayIndex = DAYS.indexOf(lowerD);\n if (dayIndex !== -1) {\n return dayIndex; // 0 for january, ...\n }\n const shortD = lowerD.substr(0, 3);\n const shortDayIndex = SHORT_DAYS.indexOf(shortD);\n if (shortDayIndex !== -1) {\n return shortDayIndex;\n }\n // Invalid day\n throw new Error(log.message.invalidTimeUnit('day', d));\n }\n}\n\n/**\n * @param d the date.\n * @param normalize whether to normalize quarter, month, day. This should probably be true if d is a DateTime.\n * @returns array of date time parts [year, month, day, hours, minutes, seconds, milliseconds]\n */\nfunction dateTimeParts(d: DateTime | DateTimeExpr, normalize: boolean) {\n const parts: (string | number)[] = [];\n\n if (normalize && d.day !== undefined) {\n if (keys(d).length > 1) {\n log.warn(log.message.droppedDay(d));\n d = duplicate(d);\n delete d.day;\n }\n }\n\n if (d.year !== undefined) {\n parts.push(d.year);\n } else {\n // Just like Vega's timeunit transform, set default year to 2012, so domain conversion will be compatible with Vega\n // Note: 2012 is a leap year (and so the date February 29 is respected) that begins on a Sunday (and so days of the week will order properly at the beginning of the year).\n parts.push(2012);\n }\n\n if (d.month !== undefined) {\n const month = normalize ? normalizeMonth(d.month) : d.month;\n parts.push(month);\n } else if (d.quarter !== undefined) {\n const quarter = normalize ? normalizeQuarter(d.quarter) : d.quarter;\n parts.push(isNumber(quarter) ? quarter * 3 : `${quarter}*3`);\n } else {\n parts.push(0); // months start at zero in JS\n }\n\n if (d.date !== undefined) {\n parts.push(d.date);\n } else if (d.day !== undefined) {\n // HACK: Day only works as a standalone unit\n // This is only correct because we always set year to 2006 for day\n const day = normalize ? normalizeDay(d.day) : d.day;\n parts.push(isNumber(day) ? day + 1 : `${day}+1`);\n } else {\n parts.push(1); // Date starts at 1 in JS\n }\n\n // Note: can't use TimeUnit enum here as importing it will create\n // circular dependency problem!\n for (const timeUnit of ['hours', 'minutes', 'seconds', 'milliseconds'] as const) {\n const unit = d[timeUnit];\n parts.push(typeof unit === 'undefined' ? 0 : unit);\n }\n\n return parts;\n}\n\n/**\n * Return Vega expression for a date time.\n *\n * @param d the date time.\n * @returns the Vega expression.\n */\nexport function dateTimeToExpr(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * Return Vega expression for a date time expression.\n *\n * @param d the internal date time object with expression.\n * @returns the Vega expression.\n */\nexport function dateTimeExprToExpr(d: DateTimeExpr) {\n const parts: (string | number)[] = dateTimeParts(d, false);\n\n const string = parts.join(', ');\n\n if (d.utc) {\n return `utc(${string})`;\n } else {\n return `datetime(${string})`;\n }\n}\n\n/**\n * @param d the date time.\n * @returns the timestamp.\n */\nexport function dateTimeToTimestamp(d: DateTime) {\n const parts: (string | number)[] = dateTimeParts(d, true);\n\n if (d.utc) {\n return +new Date(Date.UTC(...(parts as [any, any])));\n } else {\n return +new Date(...(parts as [any]));\n }\n}\n","import {isObject, isString} from 'vega-util';\nimport {DateTime, DateTimeExpr, dateTimeExprToExpr, dateTimeToExpr} from './datetime';\nimport {accessPathWithDatum, keys, stringify, varName} from './util';\n\n/** Time Unit that only corresponds to only one part of Date objects. */\nexport const LOCAL_SINGLE_TIMEUNIT_INDEX = {\n year: 1,\n quarter: 1,\n month: 1,\n week: 1,\n day: 1,\n dayofyear: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\nexport type LocalSingleTimeUnit = keyof typeof LOCAL_SINGLE_TIMEUNIT_INDEX;\n\nexport const TIMEUNIT_PARTS = keys(LOCAL_SINGLE_TIMEUNIT_INDEX);\n\nexport function isLocalSingleTimeUnit(timeUnit: string): timeUnit is LocalSingleTimeUnit {\n return !!LOCAL_SINGLE_TIMEUNIT_INDEX[timeUnit];\n}\n\nexport const UTC_SINGLE_TIMEUNIT_INDEX = {\n utcyear: 1,\n utcquarter: 1,\n utcmonth: 1,\n utcweek: 1,\n utcday: 1,\n utcdayofyear: 1,\n utcdate: 1,\n utchours: 1,\n utcminutes: 1,\n utcseconds: 1,\n utcmilliseconds: 1\n} as const;\n\nexport type UtcSingleTimeUnit = keyof typeof UTC_SINGLE_TIMEUNIT_INDEX;\n\nexport type SingleTimeUnit = LocalSingleTimeUnit | UtcSingleTimeUnit;\n\nexport const LOCAL_MULTI_TIMEUNIT_INDEX = {\n yearquarter: 1,\n yearquartermonth: 1,\n\n yearmonth: 1,\n yearmonthdate: 1,\n yearmonthdatehours: 1,\n yearmonthdatehoursminutes: 1,\n yearmonthdatehoursminutesseconds: 1,\n\n yearweek: 1,\n yearweekday: 1,\n yearweekdayhours: 1,\n yearweekdayhoursminutes: 1,\n yearweekdayhoursminutesseconds: 1,\n\n yeardayofyear: 1,\n\n quartermonth: 1,\n\n monthdate: 1,\n monthdatehours: 1,\n monthdatehoursminutes: 1,\n monthdatehoursminutesseconds: 1,\n\n weekday: 1,\n weeksdayhours: 1,\n weekdayhoursminutes: 1,\n weekdayhoursminutesseconds: 1,\n\n dayhours: 1,\n dayhoursminutes: 1,\n dayhoursminutesseconds: 1,\n\n hoursminutes: 1,\n hoursminutesseconds: 1,\n\n minutesseconds: 1,\n\n secondsmilliseconds: 1\n} as const;\n\nexport type LocalMultiTimeUnit = keyof typeof LOCAL_MULTI_TIMEUNIT_INDEX;\n\nconst BINNED_LOCAL_TIMEUNIT_INDEX = {\n binnedyear: 1,\n binnedyearquarter: 1,\n binnedyearquartermonth: 1,\n\n binnedyearmonth: 1,\n binnedyearmonthdate: 1,\n binnedyearmonthdatehours: 1,\n binnedyearmonthdatehoursminutes: 1,\n binnedyearmonthdatehoursminutesseconds: 1,\n\n binnedyearweek: 1,\n binnedyearweekday: 1,\n binnedyearweekdayhours: 1,\n binnedyearweekdayhoursminutes: 1,\n binnedyearweekdayhoursminutesseconds: 1,\n\n binnedyeardayofyear: 1\n} as const;\n\ntype BinnedLocalTimeUnit = keyof typeof BINNED_LOCAL_TIMEUNIT_INDEX;\n\nconst BINNED_UTC_TIMEUNIT_INDEX = {\n binnedutcyear: 1,\n binnedutcyearquarter: 1,\n binnedutcyearquartermonth: 1,\n\n binnedutcyearmonth: 1,\n binnedutcyearmonthdate: 1,\n binnedutcyearmonthdatehours: 1,\n binnedutcyearmonthdatehoursminutes: 1,\n binnedutcyearmonthdatehoursminutesseconds: 1,\n\n binnedutcyearweek: 1,\n binnedutcyearweekday: 1,\n binnedutcyearweekdayhours: 1,\n binnedutcyearweekdayhoursminutes: 1,\n binnedutcyearweekdayhoursminutesseconds: 1,\n\n binnedutcyeardayofyear: 1\n};\n\nexport const BINNED_TIMEUNIT_INDEX = {\n ...BINNED_LOCAL_TIMEUNIT_INDEX,\n ...BINNED_UTC_TIMEUNIT_INDEX\n};\n\ntype BinnedUtcTimeUnit = keyof typeof BINNED_UTC_TIMEUNIT_INDEX;\n\nexport type BinnedTimeUnit = BinnedLocalTimeUnit | BinnedUtcTimeUnit;\n\nexport function isBinnedTimeUnit(\n timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams | undefined\n): timeUnit is BinnedTimeUnit | TimeUnitParams {\n if (isObject(timeUnit)) {\n return timeUnit.binned;\n }\n return isBinnedTimeUnitString(timeUnit);\n}\n\nexport function isBinnedTimeUnitString(timeUnit: TimeUnit | BinnedTimeUnit | undefined): timeUnit is BinnedTimeUnit {\n return timeUnit && timeUnit.startsWith('binned');\n}\n\nexport const UTC_MULTI_TIMEUNIT_INDEX = {\n utcyearquarter: 1,\n utcyearquartermonth: 1,\n\n utcyearmonth: 1,\n utcyearmonthdate: 1,\n utcyearmonthdatehours: 1,\n utcyearmonthdatehoursminutes: 1,\n utcyearmonthdatehoursminutesseconds: 1,\n\n utcyearweek: 1,\n utcyearweekday: 1,\n utcyearweekdayhours: 1,\n utcyearweekdayhoursminutes: 1,\n utcyearweekdayhoursminutesseconds: 1,\n\n utcyeardayofyear: 1,\n\n utcquartermonth: 1,\n\n utcmonthdate: 1,\n utcmonthdatehours: 1,\n utcmonthdatehoursminutes: 1,\n utcmonthdatehoursminutesseconds: 1,\n\n utcweekday: 1,\n utcweeksdayhours: 1,\n utcweekdayhoursminutes: 1,\n utcweekdayhoursminutesseconds: 1,\n\n utcdayhours: 1,\n utcdayhoursminutes: 1,\n utcdayhoursminutesseconds: 1,\n\n utchoursminutes: 1,\n utchoursminutesseconds: 1,\n\n utcminutesseconds: 1,\n\n utcsecondsmilliseconds: 1\n} as const;\n\nexport type UtcMultiTimeUnit = keyof typeof UTC_MULTI_TIMEUNIT_INDEX;\n\nexport type MultiTimeUnit = LocalMultiTimeUnit | UtcMultiTimeUnit;\n\nexport type LocalTimeUnit = LocalSingleTimeUnit | LocalMultiTimeUnit;\nexport type UtcTimeUnit = UtcSingleTimeUnit | UtcMultiTimeUnit;\n\nexport function isUTCTimeUnit(t: string): t is UtcTimeUnit {\n return t.startsWith('utc');\n}\n\nexport function getLocalTimeUnitFromUTCTimeUnit(t: UtcTimeUnit): LocalTimeUnit {\n return t.substring(3) as LocalTimeUnit;\n}\n\nexport type TimeUnit = SingleTimeUnit | MultiTimeUnit;\n\nexport type TimeUnitFormat =\n | 'year'\n | 'year-month'\n | 'year-month-date'\n | 'quarter'\n | 'month'\n | 'date'\n | 'week'\n | 'day'\n | 'hours'\n | 'hours-minutes'\n | 'minutes'\n | 'seconds'\n | 'milliseconds';\n\nexport interface TimeUnitTransformParams {\n /**\n * Defines how date-time values should be binned.\n */\n unit?: TimeUnit;\n\n /**\n * If no `unit` is specified, maxbins is used to infer time units.\n */\n maxbins?: number;\n\n /**\n * The number of steps between bins, in terms of the least\n * significant unit provided.\n */\n step?: number;\n\n /**\n * True to use UTC timezone. Equivalent to using a `utc` prefixed `TimeUnit`.\n */\n utc?: boolean;\n}\n\n/**\n * Time Unit Params for encoding predicate, which can specified if the data is already \"binned\".\n */\nexport interface TimeUnitParams extends TimeUnitTransformParams {\n /**\n * Whether the data has already been binned to this time unit.\n * If true, Vega-Lite will only format the data, marks, and guides,\n * without applying the timeUnit transform to re-bin the data again.\n */\n binned?: boolean;\n}\n\n// matches vega time unit format specifier\nexport type TimeFormatConfig = Partial>;\n\n// In order of increasing specificity\nexport const VEGALITE_TIMEFORMAT: TimeFormatConfig = {\n 'year-month': '%b %Y ',\n 'year-month-date': '%b %d, %Y '\n};\n\nexport function getTimeUnitParts(timeUnit: TimeUnit): LocalSingleTimeUnit[] {\n return TIMEUNIT_PARTS.filter(part => containsTimeUnit(timeUnit, part));\n}\n\nexport function getSmallestTimeUnitPart(timeUnit: TimeUnit): LocalSingleTimeUnit {\n const parts = getTimeUnitParts(timeUnit);\n return parts[parts.length - 1];\n}\n\n/** Returns true if fullTimeUnit contains the timeUnit, false otherwise. */\nexport function containsTimeUnit(fullTimeUnit: TimeUnit, timeUnit: TimeUnit) {\n const index = fullTimeUnit.indexOf(timeUnit);\n\n if (index < 0) {\n return false;\n }\n\n // exclude milliseconds\n if (index > 0 && timeUnit === 'seconds' && fullTimeUnit.charAt(index - 1) === 'i') {\n return false;\n }\n\n // exclude dayofyear\n if (fullTimeUnit.length > index + 3 && timeUnit === 'day' && fullTimeUnit.charAt(index + 3) === 'o') {\n return false;\n }\n if (index > 0 && timeUnit === 'year' && fullTimeUnit.charAt(index - 1) === 'f') {\n return false;\n }\n\n return true;\n}\n\n/**\n * Returns Vega expression for a given timeUnit and fieldRef\n */\nexport function fieldExpr(fullTimeUnit: TimeUnit, field: string, {end}: {end: boolean} = {end: false}): string {\n const fieldRef = accessPathWithDatum(field);\n\n const utc = isUTCTimeUnit(fullTimeUnit) ? 'utc' : '';\n\n function func(timeUnit: TimeUnit) {\n if (timeUnit === 'quarter') {\n // quarter starting at 0 (0,3,6,9).\n return `(${utc}quarter(${fieldRef})-1)`;\n } else {\n return `${utc}${timeUnit}(${fieldRef})`;\n }\n }\n\n let lastTimeUnit: TimeUnit;\n\n const dateExpr: DateTimeExpr = {};\n\n for (const part of TIMEUNIT_PARTS) {\n if (containsTimeUnit(fullTimeUnit, part)) {\n dateExpr[part] = func(part);\n lastTimeUnit = part;\n }\n }\n\n if (end) {\n dateExpr[lastTimeUnit] += '+1';\n }\n\n return dateTimeExprToExpr(dateExpr);\n}\n\nexport function timeUnitSpecifierExpression(timeUnit: TimeUnit) {\n if (!timeUnit) {\n return undefined;\n }\n\n const timeUnitParts = getTimeUnitParts(timeUnit);\n return `timeUnitSpecifier(${stringify(timeUnitParts)}, ${stringify(VEGALITE_TIMEFORMAT)})`;\n}\n\n/**\n * Returns the signal expression used for axis labels for a time unit.\n */\nexport function formatExpression(timeUnit: TimeUnit, field: string, isUTCScale: boolean): string {\n if (!timeUnit) {\n return undefined;\n }\n\n const expr = timeUnitSpecifierExpression(timeUnit);\n\n // We only use utcFormat for utc scale\n // For utc time units, the data is already converted as a part of timeUnit transform.\n // Thus, utc time units should use timeFormat to avoid shifting the time twice.\n const utc = isUTCScale || isUTCTimeUnit(timeUnit);\n\n return `${utc ? 'utc' : 'time'}Format(${field}, ${expr})`;\n}\n\nexport function normalizeTimeUnit(timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitParams): TimeUnitParams {\n if (!timeUnit) {\n return undefined;\n }\n\n let params: TimeUnitParams;\n if (isString(timeUnit)) {\n if (isBinnedTimeUnitString(timeUnit)) {\n params = {\n unit: timeUnit.substring(6) as TimeUnit,\n binned: true\n };\n } else {\n params = {\n unit: timeUnit\n };\n }\n } else if (isObject(timeUnit)) {\n params = {\n ...timeUnit,\n ...(timeUnit.unit ? {unit: timeUnit.unit} : {})\n };\n }\n\n if (isUTCTimeUnit(params.unit)) {\n params.utc = true;\n params.unit = getLocalTimeUnitFromUTCTimeUnit(params.unit);\n }\n\n return params;\n}\n\nexport function timeUnitToString(tu: TimeUnit | TimeUnitTransformParams) {\n const {utc, ...rest} = normalizeTimeUnit(tu);\n\n if (rest.unit) {\n return (\n (utc ? 'utc' : '') +\n keys(rest)\n .map(p => varName(`${p === 'unit' ? '' : `_${p}_`}${rest[p]}`))\n .join('')\n );\n } else {\n // when maxbins is specified instead of units\n return (\n (utc ? 'utc' : '') +\n 'timeunit' +\n keys(rest)\n .map(p => varName(`_${p}_${rest[p]}`))\n .join('')\n );\n }\n}\n\nexport function durationExpr(\n timeUnit: TimeUnit | BinnedTimeUnit | TimeUnitTransformParams,\n wrap: (x: string) => string = x => x\n) {\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n const smallestUnitPart = getSmallestTimeUnitPart(normalizedTimeUnit.unit);\n if (smallestUnitPart && smallestUnitPart !== 'day') {\n const startDate: DateTime = {\n year: 2001, // pick a non-leap year\n month: 1,\n date: 1,\n hours: 0,\n minutes: 0,\n seconds: 0,\n milliseconds: 0\n };\n const {step, part} = getDateTimePartAndStep(smallestUnitPart, normalizedTimeUnit.step);\n const endDate: DateTime = {\n ...startDate,\n [part]: +startDate[part] + step\n };\n\n // Calculate timestamp duration for the smallest unit listed\n return `${wrap(dateTimeToExpr(endDate))} - ${wrap(dateTimeToExpr(startDate))}`;\n }\n return undefined;\n}\n\nconst DATE_PARTS = {\n year: 1,\n month: 1,\n date: 1,\n hours: 1,\n minutes: 1,\n seconds: 1,\n milliseconds: 1\n} as const;\n\ntype DatePart = keyof typeof DATE_PARTS;\n\nexport function isDatePart(timeUnit: LocalSingleTimeUnit): timeUnit is DatePart {\n return !!DATE_PARTS[timeUnit];\n}\n\nexport function getDateTimePartAndStep(\n timeUnit: LocalSingleTimeUnit,\n step = 1\n): {\n part: keyof DateTime;\n step: number;\n} {\n if (isDatePart(timeUnit)) {\n return {part: timeUnit, step};\n }\n switch (timeUnit) {\n case 'day':\n case 'dayofyear':\n return {part: 'date', step};\n case 'quarter':\n return {part: 'month', step: step * 3};\n case 'week':\n return {part: 'date', step: step * 7};\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FieldName, valueExpr, vgField} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {LogicalComposition} from './logical';\nimport {ParameterName} from './parameter';\nimport {fieldExpr as timeUnitFieldExpr, normalizeTimeUnit, TimeUnit, TimeUnitParams, BinnedTimeUnit} from './timeunit';\nimport {stringify} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type Predicate =\n // a) FieldPredicate (but we don't type FieldFilter here so the schema has no nesting\n // and thus the documentation shows all of the types clearly)\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldValidPredicate\n // b) Selection Predicate\n | ParameterPredicate\n // c) Vega Expression string\n | string;\n\nexport type FieldPredicate =\n | FieldEqualPredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate\n | FieldRangePredicate\n | FieldOneOfPredicate\n | FieldValidPredicate;\n\nexport interface ParameterPredicate {\n /**\n * Filter using a parameter name.\n */\n param: ParameterName;\n /**\n * For selection parameters, the predicate of empty selections returns true by default.\n * Override this behavior, by setting this property `empty: false`.\n */\n empty?: boolean;\n}\n\nexport function isSelectionPredicate(predicate: LogicalComposition): predicate is ParameterPredicate {\n return predicate?.['param'];\n}\n\nexport interface FieldPredicateBase {\n // TODO: support aggregate\n\n /**\n * Time unit for the field to be tested.\n */\n timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams;\n\n /**\n * Field to be tested.\n */\n field: FieldName;\n}\n\nexport interface FieldEqualPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be equal to.\n */\n equal: string | number | boolean | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldEqualPredicate(predicate: any): predicate is FieldEqualPredicate {\n return !!predicate?.field && predicate.equal !== undefined;\n}\n\nexport interface FieldLTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than.\n */\n lt: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldLTPredicate(predicate: any): predicate is FieldLTPredicate {\n return !!predicate?.field && predicate.lt !== undefined;\n}\n\nexport interface FieldLTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be less than or equals to.\n */\n lte: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldLTEPredicate(predicate: any): predicate is FieldLTEPredicate {\n return !!predicate?.field && predicate.lte !== undefined;\n}\n\nexport interface FieldGTPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than.\n */\n gt: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldGTPredicate(predicate: any): predicate is FieldGTPredicate {\n return !!predicate?.field && predicate.gt !== undefined;\n}\n\nexport interface FieldGTEPredicate extends FieldPredicateBase {\n /**\n * The value that the field should be greater than or equals to.\n */\n gte: string | number | DateTime | ExprRef | SignalRef;\n}\n\nexport function isFieldGTEPredicate(predicate: any): predicate is FieldGTEPredicate {\n return !!predicate?.field && predicate.gte !== undefined;\n}\n\nexport interface FieldRangePredicate extends FieldPredicateBase {\n /**\n * An array of inclusive minimum and maximum values\n * for a field value of a data item to be included in the filtered data.\n * @maxItems 2\n * @minItems 2\n */\n range: (number | DateTime | null | ExprRef | SignalRef)[] | ExprRef | SignalRef;\n}\n\nexport function isFieldRangePredicate(predicate: any): predicate is FieldRangePredicate {\n if (predicate?.field) {\n if (isArray(predicate.range) && predicate.range.length === 2) {\n return true;\n } else if (isSignalRef(predicate.range)) {\n return true;\n }\n }\n return false;\n}\n\nexport interface FieldOneOfPredicate extends FieldPredicateBase {\n /**\n * A set of values that the `field`'s value should be a member of,\n * for a data item included in the filtered data.\n */\n oneOf: string[] | number[] | boolean[] | DateTime[];\n}\n\nexport interface FieldValidPredicate extends FieldPredicateBase {\n /**\n * If set to true the field's value has to be valid, meaning both not `null` and not [`NaN`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NaN).\n */\n valid: boolean;\n}\n\nexport function isFieldOneOfPredicate(predicate: any): predicate is FieldOneOfPredicate {\n return (\n !!predicate?.field && (isArray(predicate.oneOf) || isArray(predicate.in)) // backward compatibility\n );\n}\n\nexport function isFieldValidPredicate(predicate: any): predicate is FieldValidPredicate {\n return !!predicate?.field && predicate.valid !== undefined;\n}\n\nexport function isFieldPredicate(\n predicate: Predicate\n): predicate is\n | FieldOneOfPredicate\n | FieldEqualPredicate\n | FieldRangePredicate\n | FieldLTPredicate\n | FieldGTPredicate\n | FieldLTEPredicate\n | FieldGTEPredicate {\n return (\n isFieldOneOfPredicate(predicate) ||\n isFieldEqualPredicate(predicate) ||\n isFieldRangePredicate(predicate) ||\n isFieldLTPredicate(predicate) ||\n isFieldGTPredicate(predicate) ||\n isFieldLTEPredicate(predicate) ||\n isFieldGTEPredicate(predicate)\n );\n}\n\nfunction predicateValueExpr(v: number | string | boolean | DateTime | ExprRef | SignalRef, timeUnit: TimeUnit) {\n return valueExpr(v, {timeUnit, wrapTime: true});\n}\n\nfunction predicateValuesExpr(vals: (number | string | boolean | DateTime)[], timeUnit: TimeUnit) {\n return vals.map(v => predicateValueExpr(v, timeUnit));\n}\n\n// This method is used by Voyager. Do not change its behavior without changing Voyager.\nexport function fieldFilterExpression(predicate: FieldPredicate, useInRange = true) {\n const {field} = predicate;\n const normalizedTimeUnit = normalizeTimeUnit(predicate.timeUnit);\n const {unit, binned} = normalizedTimeUnit || {};\n const rawFieldExpr = vgField(predicate, {expr: 'datum'});\n const fieldExpr = unit\n ? // For timeUnit, cast into integer with time() so we can use ===, inrange, indexOf to compare values directly.\n // TODO: We calculate timeUnit on the fly here. Consider if we would like to consolidate this with timeUnit pipeline\n // TODO: support utc\n `time(${!binned ? timeUnitFieldExpr(unit, field) : rawFieldExpr})`\n : rawFieldExpr;\n\n if (isFieldEqualPredicate(predicate)) {\n return `${fieldExpr}===${predicateValueExpr(predicate.equal, unit)}`;\n } else if (isFieldLTPredicate(predicate)) {\n const upper = predicate.lt;\n return `${fieldExpr}<${predicateValueExpr(upper, unit)}`;\n } else if (isFieldGTPredicate(predicate)) {\n const lower = predicate.gt;\n return `${fieldExpr}>${predicateValueExpr(lower, unit)}`;\n } else if (isFieldLTEPredicate(predicate)) {\n const upper = predicate.lte;\n return `${fieldExpr}<=${predicateValueExpr(upper, unit)}`;\n } else if (isFieldGTEPredicate(predicate)) {\n const lower = predicate.gte;\n return `${fieldExpr}>=${predicateValueExpr(lower, unit)}`;\n } else if (isFieldOneOfPredicate(predicate)) {\n return `indexof([${predicateValuesExpr(predicate.oneOf, unit).join(',')}], ${fieldExpr}) !== -1`;\n } else if (isFieldValidPredicate(predicate)) {\n return fieldValidPredicate(fieldExpr, predicate.valid);\n } else if (isFieldRangePredicate(predicate)) {\n const {range} = predicate;\n const lower = isSignalRef(range) ? {signal: `${range.signal}[0]`} : range[0];\n const upper = isSignalRef(range) ? {signal: `${range.signal}[1]`} : range[1];\n\n if (lower !== null && upper !== null && useInRange) {\n return (\n 'inrange(' + fieldExpr + ', [' + predicateValueExpr(lower, unit) + ', ' + predicateValueExpr(upper, unit) + '])'\n );\n }\n\n const exprs = [];\n if (lower !== null) {\n exprs.push(`${fieldExpr} >= ${predicateValueExpr(lower, unit)}`);\n }\n if (upper !== null) {\n exprs.push(`${fieldExpr} <= ${predicateValueExpr(upper, unit)}`);\n }\n\n return exprs.length > 0 ? exprs.join(' && ') : 'true';\n }\n\n /* istanbul ignore next: it should never reach here */\n throw new Error(`Invalid field predicate: ${stringify(predicate)}`);\n}\n\nexport function fieldValidPredicate(fieldExpr: string, valid = true) {\n if (valid) {\n return `isValid(${fieldExpr}) && isFinite(+${fieldExpr})`;\n } else {\n return `!isValid(${fieldExpr}) || !isFinite(+${fieldExpr})`;\n }\n}\n\nexport function normalizePredicate(f: Predicate): Predicate {\n if (isFieldPredicate(f) && f.timeUnit) {\n return {\n ...f,\n timeUnit: normalizeTimeUnit(f.timeUnit)\n };\n }\n return f;\n}\n","import {keys} from './util';\n\n/**\n * Data type based on level of measurement\n */\nexport const Type = {\n quantitative: 'quantitative',\n ordinal: 'ordinal',\n temporal: 'temporal',\n nominal: 'nominal',\n geojson: 'geojson'\n} as const;\n\nexport type Type = keyof typeof Type;\n\nexport function isType(t: any): t is Type {\n return t in Type;\n}\n\nexport function isContinuous(type: Type): type is 'quantitative' | 'temporal' {\n return type === 'quantitative' || type === 'temporal';\n}\nexport function isDiscrete(type: Type): type is 'ordinal' | 'nominal' {\n return type === 'ordinal' || type === 'nominal';\n}\n\nexport const QUANTITATIVE = Type.quantitative;\nexport const ORDINAL = Type.ordinal;\nexport const TEMPORAL = Type.temporal;\nexport const NOMINAL = Type.nominal;\n\nexport const GEOJSON = Type.geojson;\n\nexport type StandardType = 'quantitative' | 'ordinal' | 'temporal' | 'nominal';\n\nexport const TYPES = keys(Type);\n\n/**\n * Get full, lowercase type name for a given type.\n * @param type\n * @return Full type name.\n */\nexport function getFullName(type: Type | string): Type | undefined {\n if (type) {\n type = type.toLowerCase();\n switch (type) {\n case 'q':\n case QUANTITATIVE:\n return 'quantitative';\n case 't':\n case TEMPORAL:\n return 'temporal';\n case 'o':\n case ORDINAL:\n return 'ordinal';\n case 'n':\n case NOMINAL:\n return 'nominal';\n case GEOJSON:\n return 'geojson';\n }\n }\n // If we get invalid input, return undefined type.\n return undefined;\n}\n","import {\n isObject,\n RangeEnum,\n ScaleBins,\n ScaleInterpolateEnum,\n ScaleInterpolateParams,\n SignalRef,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {isString} from 'vega-util';\nimport type {ColorScheme} from 'vega-typings';\nimport * as CHANNEL from './channel';\nimport {Channel, isColorChannel} from './channel';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport * as log from './log';\nimport {ParameterExtent} from './selection';\nimport {NOMINAL, ORDINAL, QUANTITATIVE, TEMPORAL, Type} from './type';\nimport {contains, Flag, keys} from './util';\n\nexport const ScaleType = {\n // Continuous - Quantitative\n LINEAR: 'linear',\n LOG: 'log',\n POW: 'pow',\n SQRT: 'sqrt',\n SYMLOG: 'symlog',\n\n IDENTITY: 'identity',\n SEQUENTIAL: 'sequential',\n\n // Continuous - Time\n TIME: 'time',\n UTC: 'utc',\n\n // Discretizing scales\n QUANTILE: 'quantile',\n QUANTIZE: 'quantize',\n THRESHOLD: 'threshold',\n BIN_ORDINAL: 'bin-ordinal',\n\n // Discrete scales\n ORDINAL: 'ordinal',\n POINT: 'point',\n BAND: 'band'\n} as const;\n\ntype ValueOf = T[keyof T];\nexport type ScaleType = ValueOf;\n\n/**\n * Index for scale categories -- only scale of the same categories can be merged together.\n * Current implementation is trying to be conservative and avoid merging scale type that might not work together\n */\nexport const SCALE_CATEGORY_INDEX: Record = {\n linear: 'numeric',\n log: 'numeric',\n pow: 'numeric',\n sqrt: 'numeric',\n symlog: 'numeric',\n identity: 'numeric',\n sequential: 'numeric',\n time: 'time',\n utc: 'time',\n ordinal: 'ordinal',\n 'bin-ordinal': 'bin-ordinal', // TODO: should bin-ordinal support merging with other\n point: 'ordinal-position',\n band: 'ordinal-position',\n quantile: 'discretizing',\n quantize: 'discretizing',\n threshold: 'discretizing'\n};\n\nexport const SCALE_TYPES: ScaleType[] = keys(SCALE_CATEGORY_INDEX);\n\n/**\n * Whether the two given scale types can be merged together.\n */\nexport function scaleCompatible(scaleType1: ScaleType, scaleType2: ScaleType) {\n const scaleCategory1 = SCALE_CATEGORY_INDEX[scaleType1];\n const scaleCategory2 = SCALE_CATEGORY_INDEX[scaleType2];\n return (\n scaleCategory1 === scaleCategory2 ||\n (scaleCategory1 === 'ordinal-position' && scaleCategory2 === 'time') ||\n (scaleCategory2 === 'ordinal-position' && scaleCategory1 === 'time')\n );\n}\n\n/**\n * Index for scale precedence -- high score = higher priority for merging.\n */\nconst SCALE_PRECEDENCE_INDEX: Record = {\n // numeric\n linear: 0,\n log: 1,\n pow: 1,\n sqrt: 1,\n symlog: 1,\n identity: 1,\n sequential: 1,\n // time\n time: 0,\n utc: 0,\n // ordinal-position -- these have higher precedence than continuous scales as they support more types of data\n point: 10,\n band: 11, // band has higher precedence as it is better for interaction\n // non grouped types\n ordinal: 0,\n 'bin-ordinal': 0,\n quantile: 0,\n quantize: 0,\n threshold: 0\n};\n\n/**\n * Return scale categories -- only scale of the same categories can be merged together.\n */\nexport function scaleTypePrecedence(scaleType: ScaleType): number {\n return SCALE_PRECEDENCE_INDEX[scaleType];\n}\n\nexport const QUANTITATIVE_SCALES = new Set([\n 'linear',\n 'log',\n 'pow',\n 'sqrt',\n 'symlog'\n]) as ReadonlySet;\n\nexport const CONTINUOUS_TO_CONTINUOUS_SCALES = new Set([\n ...QUANTITATIVE_SCALES,\n 'time',\n 'utc'\n]) as ReadonlySet;\n\nexport function isQuantitative(type: ScaleType): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' {\n return QUANTITATIVE_SCALES.has(type);\n}\n\nexport const CONTINUOUS_TO_DISCRETE_SCALES = new Set([\n 'quantile',\n 'quantize',\n 'threshold'\n]) as ReadonlySet;\n\nexport const CONTINUOUS_DOMAIN_SCALES = new Set([\n ...CONTINUOUS_TO_CONTINUOUS_SCALES,\n ...CONTINUOUS_TO_DISCRETE_SCALES,\n 'sequential',\n 'identity'\n]) as ReadonlySet;\n\nexport const DISCRETE_DOMAIN_SCALES = new Set([\n 'ordinal',\n 'bin-ordinal',\n 'point',\n 'band'\n]) as ReadonlySet;\n\nexport const TIME_SCALE_TYPES = new Set(['time', 'utc']) as ReadonlySet;\n\nexport function hasDiscreteDomain(type: ScaleType): type is 'ordinal' | 'bin-ordinal' | 'point' | 'band' {\n return DISCRETE_DOMAIN_SCALES.has(type);\n}\n\nexport function hasContinuousDomain(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' | 'quantile' | 'quantize' | 'threshold' {\n return CONTINUOUS_DOMAIN_SCALES.has(type);\n}\n\nexport function isContinuousToContinuous(\n type: ScaleType\n): type is 'linear' | 'log' | 'pow' | 'sqrt' | 'symlog' | 'time' | 'utc' {\n return CONTINUOUS_TO_CONTINUOUS_SCALES.has(type);\n}\n\nexport function isContinuousToDiscrete(type: ScaleType): type is 'quantile' | 'quantize' | 'threshold' {\n return CONTINUOUS_TO_DISCRETE_SCALES.has(type);\n}\n\nexport interface ScaleConfig {\n /**\n * If true, rounds numeric output values to integers.\n * This can be helpful for snapping to the pixel grid.\n * (Only available for `x`, `y`, and `size` scales.)\n */\n round?: boolean | ES;\n\n /**\n * If true, values that exceed the data domain are clamped to either the minimum or maximum range value\n */\n clamp?: boolean | ES;\n\n /**\n * Default inner padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding.\n *\n * __Default value:__ `0.2`\n *\n * @minimum 0\n * @maximum 1\n */\n bandWithNestedOffsetPaddingInner?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` band scales with nested `xOffset` and `yOffset` encoding.\n *\n * __Default value:__ `0.2`\n *\n * @minimum 0\n * @maximum 1\n */\n // Note: nested offset always uses band scale, so we don't need \"band\" in the name for brevity.\n bandWithNestedOffsetPaddingOuter?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band scales.\n *\n * __Default value:__\n * - `nestedOffsetPaddingInner` for x/y scales with nested x/y offset scales.\n * - `barBandPaddingInner` for bar marks (`0.1` by default)\n * - `rectBandPaddingInner` for rect and other marks (`0` by default)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingInner?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` band scales.\n *\n * __Default value:__ `paddingInner/2` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n bandPaddingOuter?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"bar\"` marks.\n *\n * __Default value:__ `0.1`\n *\n * @minimum 0\n * @maximum 1\n */\n barBandPaddingInner?: number | ES;\n\n /**\n * Default inner padding for `x` and `y` band-ordinal scales of `\"rect\"` marks.\n *\n * __Default value:__ `0`\n *\n * @minimum 0\n * @maximum 1\n */\n rectBandPaddingInner?: number | ES;\n\n /**\n * Default padding inner for xOffset/yOffset's band scales.\n *\n * __Default Value:__ `0`\n */\n offsetBandPaddingInner?: number | ES;\n\n /**\n * Default padding outer for xOffset/yOffset's band scales.\n *\n * __Default Value:__ `0`\n */\n offsetBandPaddingOuter?: number | ES;\n\n /**\n * Default padding for continuous x/y scales.\n *\n * __Default:__ The bar width for continuous x-scale of a vertical bar and continuous y-scale of a horizontal bar.; `0` otherwise.\n *\n * @minimum 0\n */\n continuousPadding?: number | ES;\n\n /**\n * Default outer padding for `x` and `y` point-ordinal scales.\n *\n * __Default value:__ `0.5` (which makes _width/height = number of unique values * step_)\n *\n * @minimum 0\n * @maximum 1\n */\n pointPadding?: number | ES;\n\n /**\n * Use the source data range before aggregation as scale domain instead of aggregated data for aggregate axis.\n *\n * This is equivalent to setting `domain` to `\"unaggregate\"` for aggregated _quantitative_ fields by default.\n *\n * This property only works with aggregate functions that produce values within the raw data domain (`\"mean\"`, `\"average\"`, `\"median\"`, `\"q1\"`, `\"q3\"`, `\"min\"`, `\"max\"`). For other aggregations that produce values outside of the raw data domain (e.g. `\"count\"`, `\"sum\"`), this property is ignored.\n *\n * __Default value:__ `false`\n */\n useUnaggregatedDomain?: boolean;\n\n // nice should depends on type (quantitative or temporal), so\n // let's not make a config.\n\n // Configs for Range\n\n /**\n * The default max value for mapping quantitative fields to bar's size/bandSize.\n *\n * If undefined (default), we will use the axis's size (width or height) - 1.\n * @minimum 0\n */\n maxBandSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to bar and tick's size/bandSize scale with zero=false.\n *\n * __Default value:__ `2`\n *\n * @minimum 0\n */\n minBandSize?: number;\n\n /**\n * The default max value for mapping quantitative fields to text's size/fontSize.\n *\n * __Default value:__ `40`\n *\n * @minimum 0\n */\n maxFontSize?: number;\n\n /**\n * The default min value for mapping quantitative fields to tick's size/fontSize scale with zero=false\n *\n * __Default value:__ `8`\n *\n * @minimum 0\n */\n minFontSize?: number;\n\n /**\n * Default minimum opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.3`\n *\n * @minimum 0\n * @maximum 1\n */\n minOpacity?: number;\n\n /**\n * Default max opacity for mapping a field to opacity.\n *\n * __Default value:__ `0.8`\n *\n * @minimum 0\n * @maximum 1\n */\n maxOpacity?: number;\n\n /**\n * Default minimum value for point size scale with zero=false.\n *\n * __Default value:__ `9`\n *\n * @minimum 0\n */\n minSize?: number;\n\n /**\n * Default max value for point size scale.\n * @minimum 0\n */\n maxSize?: number;\n\n /**\n * Default minimum strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks with zero=false.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n minStrokeWidth?: number;\n\n /**\n * Default max strokeWidth for the scale of strokeWidth for rule and line marks and of size for trail marks.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n maxStrokeWidth?: number;\n\n /**\n * Default range cardinality for [`quantile`](https://vega.github.io/vega-lite/docs/scale.html#quantile) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantileCount?: number;\n\n /**\n * Default range cardinality for [`quantize`](https://vega.github.io/vega-lite/docs/scale.html#quantize) scale.\n *\n * __Default value:__ `4`\n *\n * @minimum 0\n */\n quantizeCount?: number;\n\n /**\n * Reverse x-scale by default (useful for right-to-left charts).\n */\n xReverse?: boolean | ES;\n\n /**\n * Default `scale.zero` for [`continuous`](https://vega.github.io/vega-lite/docs/scale.html#continuous) scales except for (1) x/y-scales of non-ranged bar or area charts and (2) size scales.\n *\n * __Default value:__ `true`\n *\n */\n zero?: boolean;\n}\n\nexport const defaultScaleConfig: ScaleConfig = {\n pointPadding: 0.5,\n\n barBandPaddingInner: 0.1,\n rectBandPaddingInner: 0,\n bandWithNestedOffsetPaddingInner: 0.2,\n bandWithNestedOffsetPaddingOuter: 0.2,\n\n minBandSize: 2,\n\n minFontSize: 8,\n maxFontSize: 40,\n\n minOpacity: 0.3,\n maxOpacity: 0.8,\n\n // FIXME: revise if these *can* become ratios of width/height step\n minSize: 9, // Point size is area. For square point, 9 = 3 pixel ^ 2, not too small!\n\n minStrokeWidth: 1,\n maxStrokeWidth: 4,\n quantileCount: 4,\n quantizeCount: 4,\n\n zero: true\n};\n\nexport interface SchemeParams {\n /**\n * A color scheme name for ordinal scales (e.g., `\"category10\"` or `\"blues\"`).\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n name: ColorScheme | SignalRef;\n\n /**\n * The extent of the color range to use. For example `[0.2, 1]` will rescale the color scheme such that color values in the range _[0, 0.2)_ are excluded from the scheme.\n */\n extent?: (number | SignalRef)[] | SignalRef;\n\n /**\n * The number of colors to use in the scheme. This can be useful for scale types such as `\"quantize\"`, which use the length of the scale range to determine the number of discrete bins for the scale domain.\n */\n count?: number | SignalRef;\n}\n\nexport type Domain =\n | (null | string | number | boolean | DateTime | SignalRef)[]\n | 'unaggregated'\n | ParameterExtent\n | SignalRef\n | DomainUnionWith;\n\nexport type Scheme = string | SchemeParams;\n\nexport function isExtendedScheme(scheme: Scheme | SignalRef): scheme is SchemeParams {\n return !isString(scheme) && !!scheme['name'];\n}\n\nexport function isParameterDomain(domain: Domain): domain is ParameterExtent {\n return domain?.['param'];\n}\n\nexport interface DomainUnionWith {\n /**\n * Customized domain values to be union with the field's values or explicitly defined domain.\n * Should be an array of valid scale domain values.\n */\n unionWith: (number | string | boolean | DateTime)[];\n}\n\nexport function isDomainUnionWith(domain: Domain): domain is DomainUnionWith {\n return domain?.['unionWith'];\n}\n\nexport interface FieldRange {\n field: string;\n}\n\nexport function isFieldRange(range: any): range is FieldRange {\n return isObject(range) && 'field' in range;\n}\n\nexport interface Scale {\n /**\n * The type of scale. Vega-Lite supports the following categories of scale types:\n *\n * 1) [**Continuous Scales**](https://vega.github.io/vega-lite/docs/scale.html#continuous) -- mapping continuous domains to continuous output ranges ([`\"linear\"`](https://vega.github.io/vega-lite/docs/scale.html#linear), [`\"pow\"`](https://vega.github.io/vega-lite/docs/scale.html#pow), [`\"sqrt\"`](https://vega.github.io/vega-lite/docs/scale.html#sqrt), [`\"symlog\"`](https://vega.github.io/vega-lite/docs/scale.html#symlog), [`\"log\"`](https://vega.github.io/vega-lite/docs/scale.html#log), [`\"time\"`](https://vega.github.io/vega-lite/docs/scale.html#time), [`\"utc\"`](https://vega.github.io/vega-lite/docs/scale.html#utc).\n *\n * 2) [**Discrete Scales**](https://vega.github.io/vega-lite/docs/scale.html#discrete) -- mapping discrete domains to discrete ([`\"ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#ordinal)) or continuous ([`\"band\"`](https://vega.github.io/vega-lite/docs/scale.html#band) and [`\"point\"`](https://vega.github.io/vega-lite/docs/scale.html#point)) output ranges.\n *\n * 3) [**Discretizing Scales**](https://vega.github.io/vega-lite/docs/scale.html#discretizing) -- mapping continuous domains to discrete output ranges [`\"bin-ordinal\"`](https://vega.github.io/vega-lite/docs/scale.html#bin-ordinal), [`\"quantile\"`](https://vega.github.io/vega-lite/docs/scale.html#quantile), [`\"quantize\"`](https://vega.github.io/vega-lite/docs/scale.html#quantize) and [`\"threshold\"`](https://vega.github.io/vega-lite/docs/scale.html#threshold).\n *\n * __Default value:__ please see the [scale type table](https://vega.github.io/vega-lite/docs/scale.html#type).\n */\n type?: ScaleType;\n\n /**\n * Customized domain values in the form of constant values or dynamic values driven by a parameter.\n *\n * 1) Constant `domain` for _quantitative_ fields can take one of the following forms:\n *\n * - A two-element array with minimum and maximum values. To create a diverging scale, this two-element array can be combined with the `domainMid` property.\n * - An array with more than two entries, for [Piecewise quantitative scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n * - A string value `\"unaggregated\"`, if the input field is aggregated, to indicate that the domain should include the raw data values prior to the aggregation.\n *\n * 2) Constant `domain` for _temporal_ fields can be a two-element array with minimum and maximum values, in the form of either timestamps or the [DateTime definition objects](https://vega.github.io/vega-lite/docs/types.html#datetime).\n *\n * 3) Constant `domain` for _ordinal_ and _nominal_ fields can be an array that lists valid input values.\n *\n * 4) To combine (union) specified constant domain with the field's values, `domain` can be an object with a `unionWith` property that specify constant domain to be combined. For example, `domain: {unionWith: [0, 100]}` for a quantitative scale means that the scale domain always includes `[0, 100]`, but will include other values in the fields beyond `[0, 100]`.\n *\n * 5) Domain can also takes an object defining a field or encoding of a parameter that [interactively determines](https://vega.github.io/vega-lite/docs/selection.html#scale-domains) the scale domain.\n */\n domain?:\n | (null | string | number | boolean | DateTime | ES)[]\n | 'unaggregated'\n | ParameterExtent\n | DomainUnionWith\n | ES;\n\n /**\n * An expression for an array of raw values that, if non-null, directly overrides the _domain_ property.\n * This is useful for supporting interactions such as panning or zooming a scale.\n * The scale may be initially determined using a data-driven domain, then modified in response to user input by setting the rawDomain value.\n */\n domainRaw?: ES;\n\n /**\n * Inserts a single mid-point value into a two-element domain. The mid-point value must lie between the domain minimum and maximum values. This property can be useful for setting a midpoint for [diverging color scales](https://vega.github.io/vega-lite/docs/scale.html#piecewise). The domainMid property is only intended for use with scales supporting continuous, piecewise domains.\n */\n domainMid?: number | ES;\n\n /**\n * Sets the maximum value in the scale domain, overriding the `domain` property. This property is only intended for use with scales having continuous domains.\n */\n domainMax?: number | DateTime | ES;\n\n /**\n * Sets the minimum value in the scale domain, overriding the domain property. This property is only intended for use with scales having continuous domains.\n */\n domainMin?: number | DateTime | ES;\n\n /**\n * If true, reverses the order of the scale range.\n * __Default value:__ `false`.\n */\n reverse?: boolean | ES;\n\n /**\n * The range of the scale. One of:\n *\n * - A string indicating a [pre-defined named scale range](https://vega.github.io/vega-lite/docs/scale.html#range-config) (e.g., example, `\"symbol\"`, or `\"diverging\"`).\n *\n * - For [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous), two-element array indicating minimum and maximum values, or an array with more than two entries for specifying a [piecewise scale](https://vega.github.io/vega-lite/docs/scale.html#piecewise).\n *\n * - For [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) and [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales, an array of desired output values or an object with a `field` property representing the range values. For example, if a field `color` contains CSS color names, we can set `range` to `{field: \"color\"}`.\n *\n * __Notes:__\n *\n * 1) For color scales you can also specify a color [`scheme`](https://vega.github.io/vega-lite/docs/scale.html#scheme) instead of `range`.\n *\n * 2) Any directly specified `range` for `x` and `y` channels will be ignored. Range can be customized via the view's corresponding [size](https://vega.github.io/vega-lite/docs/size.html) (`width` and `height`).\n */\n range?: RangeEnum | (number | string | number[] | ES)[] | FieldRange;\n\n /**\n * Sets the maximum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMax?: number | string | ES;\n\n /**\n * Sets the minimum value in the scale range, overriding the `range` property or the default range. This property is only intended for use with scales having continuous ranges.\n */\n rangeMin?: number | string | ES;\n\n // ordinal\n\n /**\n * A string indicating a color [scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme) name (e.g., `\"category10\"` or `\"blues\"`) or a [scheme parameter object](https://vega.github.io/vega-lite/docs/scale.html#scheme-params).\n *\n * Discrete color schemes may be used with [discrete](https://vega.github.io/vega-lite/docs/scale.html#discrete) or [discretizing](https://vega.github.io/vega-lite/docs/scale.html#discretizing) scales. Continuous color schemes are intended for use with color scales.\n *\n * For the full list of supported schemes, please refer to the [Vega Scheme](https://vega.github.io/vega/docs/schemes/#reference) reference.\n */\n scheme?: ColorScheme | SchemeParams | ES;\n\n /**\n * The alignment of the steps within the scale range.\n *\n * This value must lie in the range `[0,1]`. A value of `0.5` indicates that the steps should be centered within the range. A value of `0` or `1` may be used to shift the bands to one side, say to position them adjacent to an axis.\n *\n * __Default value:__ `0.5`\n */\n align?: number | ES;\n\n /**\n * Bin boundaries can be provided to scales as either an explicit array of bin boundaries or as a bin specification object. The legal values are:\n * - An [array](../types/#Array) literal of bin boundary values. For example, `[0, 5, 10, 15, 20]`. The array must include both starting and ending boundaries. The previous example uses five values to indicate a total of four bin intervals: [0-5), [5-10), [10-15), [15-20]. Array literals may include signal references as elements.\n * - A [bin specification object](https://vega.github.io/vega-lite/docs/scale.html#bins) that indicates the bin _step_ size, and optionally the _start_ and _stop_ boundaries.\n * - An array of bin boundaries over the scale domain. If provided, axes and legends will use the bin boundaries to inform the choice of tick marks and text labels.\n */\n // TODO: add - A [signal reference](../types/#Signal) that resolves to either an array or bin specification object.\n bins?: ScaleBins;\n\n /**\n * If `true`, rounds numeric output values to integers. This can be helpful for snapping to the pixel grid.\n *\n * __Default value:__ `false`.\n */\n round?: boolean | ES;\n\n /**\n * For _[continuous](https://vega.github.io/vega-lite/docs/scale.html#continuous)_ scales, expands the scale domain to accommodate the specified number of pixels on each of the scale range. The scale range must represent pixels for this parameter to function as intended. Padding adjustment is performed prior to all other adjustments, including the effects of the `zero`, `nice`, `domainMin`, and `domainMax` properties.\n *\n * For _[band](https://vega.github.io/vega-lite/docs/scale.html#band)_ scales, shortcut for setting `paddingInner` and `paddingOuter` to the same value.\n *\n * For _[point](https://vega.github.io/vega-lite/docs/scale.html#point)_ scales, alias for `paddingOuter`.\n *\n * __Default value:__ For _continuous_ scales, derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `continuousPadding`.\n * For _band and point_ scales, see `paddingInner` and `paddingOuter`. By default, Vega-Lite sets padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n */\n padding?: number | ES;\n\n /**\n * The inner padding (spacing) within each band step of band scales, as a fraction of the step size. This value must lie in the range [0,1].\n *\n * For point scale, this property is invalid as point scales do not have internal band widths (only step sizes between bands).\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingInner`.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingInner?: number | ES;\n\n /**\n * The outer padding (spacing) at the ends of the range of band and point scales,\n * as a fraction of the step size. This value must lie in the range [0,1].\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/scale.html#config)'s `bandPaddingOuter` for band scales and `pointPadding` for point scales.\n * By default, Vega-Lite sets outer padding such that _width/height = number of unique values * step_.\n *\n * @minimum 0\n * @maximum 1\n */\n paddingOuter?: number | ES;\n\n // typical\n /**\n * If `true`, values that exceed the data domain are clamped to either the minimum or maximum range value\n *\n * __Default value:__ derived from the [scale config](https://vega.github.io/vega-lite/docs/config.html#scale-config)'s `clamp` (`true` by default).\n */\n clamp?: boolean | ES;\n\n /**\n * Extending the domain so that it starts and ends on nice round values. This method typically modifies the scale’s domain, and may only extend the bounds to the nearest round value. Nicing is useful if the domain is computed from data and may be irregular. For example, for a domain of _[0.201479…, 0.996679…]_, a nice domain might be _[0.2, 1.0]_.\n *\n * For quantitative scales such as linear, `nice` can be either a boolean flag or a number. If `nice` is a number, it will represent a desired tick count. This allows greater control over the step size used to extend the bounds, guaranteeing that the returned ticks will exactly cover the domain.\n *\n * For temporal fields with time and utc scales, the `nice` value can be a string indicating the desired time interval. Legal values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, `time` and `utc` scales can accept an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}`, which includes a desired number of interval steps. Here, the domain would snap to quarter (Jan, Apr, Jul, Oct) boundaries.\n *\n * __Default value:__ `true` for unbinned _quantitative_ fields without explicit domain bounds; `false` otherwise.\n *\n */\n nice?: boolean | number | TimeInterval | TimeIntervalStep | ES;\n\n /**\n * The logarithm base of the `log` scale (default `10`).\n */\n base?: number | ES;\n\n /**\n * The exponent of the `pow` scale.\n */\n exponent?: number | ES;\n\n /**\n * A constant determining the slope of the symlog function around zero. Only used for `symlog` scales.\n *\n * __Default value:__ `1`\n */\n constant?: number | ES;\n\n /**\n * If `true`, ensures that a zero baseline value is included in the scale domain.\n *\n * __Default value:__ `true` for x and y channels if the quantitative field is not binned and no custom `domain` is provided; `false` otherwise.\n *\n * __Note:__ Log, time, and utc scales do not support `zero`.\n */\n zero?: boolean | ES;\n\n /**\n * The interpolation method for range values. By default, a general interpolator for numbers, dates, strings and colors (in HCL space) is used. For color ranges, this property allows interpolation in alternative color spaces. Legal values include `rgb`, `hsl`, `hsl-long`, `lab`, `hcl`, `hcl-long`, `cubehelix` and `cubehelix-long` ('-long' variants use longer paths in polar coordinate spaces). If object-valued, this property accepts an object with a string-valued _type_ property and an optional numeric _gamma_ property applicable to rgb and cubehelix interpolators. For more, see the [d3-interpolate documentation](https://github.com/d3/d3-interpolate).\n *\n * * __Default value:__ `hcl`\n */\n interpolate?: ScaleInterpolateEnum | ES | ScaleInterpolateParams;\n}\n\nconst SCALE_PROPERTY_INDEX: Flag> = {\n type: 1,\n domain: 1,\n domainMax: 1,\n domainMin: 1,\n domainMid: 1,\n domainRaw: 1,\n align: 1,\n range: 1,\n rangeMax: 1,\n rangeMin: 1,\n scheme: 1,\n bins: 1,\n // Other properties\n reverse: 1,\n round: 1,\n // quantitative / time\n clamp: 1,\n nice: 1,\n // quantitative\n base: 1,\n exponent: 1,\n constant: 1,\n interpolate: 1,\n zero: 1, // zero depends on domain\n // band/point\n padding: 1,\n paddingInner: 1,\n paddingOuter: 1\n};\n\nexport const SCALE_PROPERTIES = keys(SCALE_PROPERTY_INDEX);\n\nconst {type, domain, range, rangeMax, rangeMin, scheme, ...NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX} =\n SCALE_PROPERTY_INDEX;\n\nexport const NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES = keys(NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX);\n\nexport function scaleTypeSupportProperty(scaleType: ScaleType, propName: keyof Scale): boolean {\n switch (propName) {\n case 'type':\n case 'domain':\n case 'reverse':\n case 'range':\n return true;\n case 'scheme':\n case 'interpolate':\n return !['point', 'band', 'identity'].includes(scaleType);\n case 'bins':\n return !['point', 'band', 'identity', 'ordinal'].includes(scaleType);\n case 'round':\n return isContinuousToContinuous(scaleType) || scaleType === 'band' || scaleType === 'point';\n case 'padding':\n case 'rangeMin':\n case 'rangeMax':\n return isContinuousToContinuous(scaleType) || ['point', 'band'].includes(scaleType);\n case 'paddingOuter':\n case 'align':\n return ['point', 'band'].includes(scaleType);\n case 'paddingInner':\n return scaleType === 'band';\n case 'domainMax':\n case 'domainMid':\n case 'domainMin':\n case 'domainRaw':\n case 'clamp':\n return isContinuousToContinuous(scaleType);\n case 'nice':\n return isContinuousToContinuous(scaleType) || scaleType === 'quantize' || scaleType === 'threshold';\n case 'exponent':\n return scaleType === 'pow';\n case 'base':\n return scaleType === 'log';\n case 'constant':\n return scaleType === 'symlog';\n case 'zero':\n return (\n hasContinuousDomain(scaleType) &&\n !contains(\n [\n 'log', // log scale cannot have zero value\n 'time',\n 'utc', // zero is not meaningful for time\n 'threshold', // threshold requires custom domain so zero does not matter\n 'quantile' // quantile depends on distribution so zero does not matter\n ],\n scaleType\n )\n );\n }\n}\n\n/**\n * Returns undefined if the input channel supports the input scale property name\n */\nexport function channelScalePropertyIncompatability(channel: Channel, propName: keyof Scale): string {\n switch (propName) {\n case 'interpolate':\n case 'scheme':\n case 'domainMid':\n if (!isColorChannel(channel)) {\n return log.message.cannotUseScalePropertyWithNonColor(propName);\n }\n return undefined;\n case 'align':\n case 'type':\n case 'bins':\n case 'domain':\n case 'domainMax':\n case 'domainMin':\n case 'domainRaw':\n case 'range':\n case 'base':\n case 'exponent':\n case 'constant':\n case 'nice':\n case 'padding':\n case 'paddingInner':\n case 'paddingOuter':\n case 'rangeMax':\n case 'rangeMin':\n case 'reverse':\n case 'round':\n case 'clamp':\n case 'zero':\n return undefined; // GOOD!\n }\n}\n\nexport function scaleTypeSupportDataType(specifiedType: ScaleType, fieldDefType: Type): boolean {\n if (contains([ORDINAL, NOMINAL], fieldDefType)) {\n return specifiedType === undefined || hasDiscreteDomain(specifiedType);\n } else if (fieldDefType === TEMPORAL) {\n return contains([ScaleType.TIME, ScaleType.UTC, undefined], specifiedType);\n } else if (fieldDefType === QUANTITATIVE) {\n return isQuantitative(specifiedType) || isContinuousToDiscrete(specifiedType) || specifiedType === undefined;\n }\n\n return true;\n}\n\nexport function channelSupportScaleType(channel: Channel, scaleType: ScaleType, hasNestedOffsetScale = false): boolean {\n if (!CHANNEL.isScaleChannel(channel)) {\n return false;\n }\n switch (channel) {\n case CHANNEL.X:\n case CHANNEL.Y:\n case CHANNEL.XOFFSET:\n case CHANNEL.YOFFSET:\n case CHANNEL.THETA:\n case CHANNEL.RADIUS:\n if (isContinuousToContinuous(scaleType)) {\n return true;\n } else if (scaleType === 'band') {\n return true;\n } else if (scaleType === 'point') {\n /*\n Point scale can't be use if the position has a nested offset scale\n because if there is a nested scale, then it's band.\n */\n return !hasNestedOffsetScale;\n }\n return false;\n case CHANNEL.SIZE: // TODO: size and opacity can support ordinal with more modification\n case CHANNEL.STROKEWIDTH:\n case CHANNEL.OPACITY:\n case CHANNEL.FILLOPACITY:\n case CHANNEL.STROKEOPACITY:\n case CHANNEL.ANGLE:\n // Although it generally doesn't make sense to use band with size and opacity,\n // it can also work since we use band: 0.5 to get midpoint.\n return (\n isContinuousToContinuous(scaleType) ||\n isContinuousToDiscrete(scaleType) ||\n contains(['band', 'point', 'ordinal'], scaleType)\n );\n case CHANNEL.COLOR:\n case CHANNEL.FILL:\n case CHANNEL.STROKE:\n return scaleType !== 'band'; // band does not make sense with color\n case CHANNEL.STROKEDASH:\n case CHANNEL.SHAPE:\n return scaleType === 'ordinal' || isContinuousToDiscrete(scaleType);\n }\n}\n","import {Align, Color, Gradient, MarkConfig as VgMarkConfig, Orientation, SignalRef, TextBaseline} from 'vega';\nimport {CompositeMark, CompositeMarkDef} from './compositemark';\nimport {ExprRef} from './expr';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema';\n\n/**\n * All types of primitive marks.\n */\nexport const Mark = {\n arc: 'arc',\n area: 'area',\n bar: 'bar',\n image: 'image',\n line: 'line',\n point: 'point',\n rect: 'rect',\n rule: 'rule',\n text: 'text',\n tick: 'tick',\n trail: 'trail',\n circle: 'circle',\n square: 'square',\n geoshape: 'geoshape'\n} as const;\n\nexport const ARC = Mark.arc;\nexport const AREA = Mark.area;\nexport const BAR = Mark.bar;\nexport const IMAGE = Mark.image;\nexport const LINE = Mark.line;\nexport const POINT = Mark.point;\nexport const RECT = Mark.rect;\nexport const RULE = Mark.rule;\nexport const TEXT = Mark.text;\nexport const TICK = Mark.tick;\nexport const TRAIL = Mark.trail;\nexport const CIRCLE = Mark.circle;\nexport const SQUARE = Mark.square;\nexport const GEOSHAPE = Mark.geoshape;\n\nexport type Mark = keyof typeof Mark;\n\nexport function isMark(m: string): m is Mark {\n return m in Mark;\n}\n\nexport function isPathMark(m: Mark | CompositeMark): m is 'line' | 'area' | 'trail' {\n return ['line', 'area', 'trail'].includes(m);\n}\n\nexport function isRectBasedMark(m: Mark | CompositeMark): m is 'rect' | 'bar' | 'image' | 'arc' {\n return ['rect', 'bar', 'image', 'arc' /* arc is rect/interval in polar coordinate */].includes(m);\n}\n\nexport const PRIMITIVE_MARKS = new Set(keys(Mark));\n\nexport interface ColorMixins {\n /**\n * Default color.\n *\n * __Default value:__ `\"#4682b4\"`\n *\n * __Note:__\n * - This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n * - The `fill` and `stroke` properties have higher precedence than `color` and will override `color`.\n */\n color?: Color | Gradient | ES;\n}\n\nexport interface TooltipContent {\n content: 'encoding' | 'data';\n}\n\n/** @hidden */\nexport type Hide = 'hide';\n\nexport interface MarkInvalidMixins {\n /**\n * Defines how Vega-Lite should handle marks for invalid values (`null` and `NaN`).\n * - If set to `\"filter\"` (default), all data items with null values will be skipped (for line, trail, and area marks) or filtered (for other marks).\n * - If `null`, all data items are included. In this case, invalid values will be interpreted as zeroes.\n */\n invalid?: 'filter' | Hide | null;\n}\n\nexport interface VLOnlyMarkConfig extends ColorMixins, MarkInvalidMixins {\n /**\n * Whether the mark's color should be used as fill color instead of stroke color.\n *\n * __Default value:__ `false` for all `point`, `line`, and `rule` marks as well as `geoshape` marks for [`graticule`](https://vega.github.io/vega-lite/docs/data.html#graticule) data sources; otherwise, `true`.\n *\n * __Note:__ This property cannot be used in a [style config](https://vega.github.io/vega-lite/docs/mark.html#style-config).\n *\n */\n filled?: boolean;\n\n /**\n * For line and trail marks, this `order` property can be set to `null` or `false` to make the lines use the original order in the data sources.\n */\n order?: null | boolean;\n\n /**\n * Default relative band position for a time unit. If set to `0`, the marks will be positioned at the beginning of the time unit band step.\n * If set to `0.5`, the marks will be positioned in the middle of the time unit band step.\n */\n timeUnitBandPosition?: number;\n\n /**\n * Default relative band size for a time unit. If set to `1`, the bandwidth of the marks will be equal to the time unit band step.\n * If set to `0.5`, bandwidth of the marks will be half of the time unit band step.\n */\n timeUnitBandSize?: number;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: number | ES; // In Vega, this is called endAngle\n\n /**\n * The secondary (inner) radius in pixels of arc marks.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n radius2?: number | ES; // In Vega, this is called innerRadius\n}\n\nexport interface MarkConfig\n extends VLOnlyMarkConfig,\n MapExcludeValueRefAndReplaceSignalWith, ES> {\n // ========== Overriding Vega ==========\n\n /**\n * The tooltip text string to show upon mouse hover or an object defining which fields should the tooltip be derived from.\n *\n * - If `tooltip` is `true` or `{\"content\": \"encoding\"}`, then all fields from `encoding` will be used.\n * - If `tooltip` is `{\"content\": \"data\"}`, then all fields that appear in the highlighted data point will be used.\n * - If set to `null` or `false`, then no tooltip will be used.\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n *\n * __Default value:__ `null`\n */\n tooltip?: number | string | boolean | TooltipContent | ES | null; // VL has a special object form for tooltip content\n\n /**\n * Default size for marks.\n * - For `point`/`circle`/`square`, this represents the pixel area of the marks. Note that this value sets the area of the symbol; the side lengths will increase with the square root of this value.\n * - For `bar`, this represents the band size of the bar, in pixels.\n * - For `text`, this represents the font size, in pixels.\n *\n * __Default value:__\n * - `30` for point, circle, square marks; width/height's `step`\n * - `2` for bar marks with discrete dimensions;\n * - `5` for bar marks with continuous dimensions;\n * - `11` for text marks.\n *\n * @minimum 0\n */\n size?: number | ES; // size works beyond symbol marks in VL\n\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: number | 'width' | ES; // Vega doesn't have 'width'\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: number | 'height' | ES; // Vega doesn't have 'height'\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x2?: number | 'width' | ES; // Vega doesn't have 'width'\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y2?: number | 'height' | ES; // Vega doesn't have 'height'\n\n /**\n * Default fill color. This property has higher precedence than `config.color`. Set to `null` to remove fill.\n *\n * __Default value:__ (None)\n *\n */\n fill?: Color | Gradient | null | ES; // docs: Vega doesn't have config.color\n\n /**\n * Default stroke color. This property has higher precedence than `config.color`. Set to `null` to remove stroke.\n *\n * __Default value:__ (None)\n *\n */\n stroke?: Color | Gradient | null | ES; // docs: Vega doesn't have config.color\n\n /**\n * The overall opacity (value between [0,1]).\n *\n * __Default value:__ `0.7` for non-aggregate plots with `point`, `tick`, `circle`, or `square` marks or layered `bar` charts and `1` otherwise.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number | ES; // docs (different defaults)\n\n /**\n * The orientation of a non-stacked bar, tick, area, and line charts.\n * The value is either horizontal (default) or vertical.\n * - For bar, rule and tick, this determines whether the size of the bar and tick\n * should be applied to x or y dimension.\n * - For area, this property determines the orient property of the Vega output.\n * - For line and trail marks, this property determines the sort order of the points in the line\n * if `config.sortLineBy` is not specified.\n * For stacked charts, this is always determined by the orientation of the stack;\n * therefore explicitly specified value will be ignored.\n */\n orient?: Orientation; // Vega orient doesn't apply to bar/tick/line. Since some logic depends on this property, Vega-Lite does NOT allow signal for orient.\n\n /**\n * The horizontal alignment of the text or ranged marks (area, bar, image, rect, rule). One of `\"left\"`, `\"right\"`, `\"center\"`.\n *\n * __Note:__ Expression reference is *not* supported for range marks.\n */\n align?: Align | ES;\n\n /**\n * For text marks, the vertical text baseline. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, `\"line-bottom\"`, or an expression reference that provides one of the valid values.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`,\n * but are calculated relative to the `lineHeight` rather than `fontSize` alone.\n *\n * For range marks, the vertical alignment of the marks. One of `\"top\"`, `\"middle\"`, `\"bottom\"`.\n *\n * __Note:__ Expression reference is *not* supported for range marks.\n *\n */\n baseline?: TextBaseline | ES;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n *\n * @minimum 0\n * @maximum 360\n */\n theta?: number | ES; // overriding VG\n\n /**\n *\n * For arc mark, the primary (outer) radius in pixels.\n *\n * For text marks, polar coordinate radial offset, in pixels, of the text from the origin determined by the `x` and `y` properties.\n *\n * __Default value:__ `min(plot_width, plot_height)/2`\n * @minimum 0\n */\n radius?: number | ES; // overriding VG\n\n /**\n * The inner radius in pixels of arc marks. `innerRadius` is an alias for `radius2`.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n innerRadius?: number | ES;\n\n /**\n * The outer radius in pixels of arc marks. `outerRadius` is an alias for `radius`.\n *\n * __Default value:__ `0`\n * @minimum 0\n */\n outerRadius?: number | ES;\n}\n\nexport interface RectBinSpacingMixins {\n /**\n * Offset between bars for binned field. The ideal value for this is either 0 (preferred by statisticians) or 1 (Vega-Lite default, D3 example style).\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n binSpacing?: number;\n}\n\nexport type AnyMark = CompositeMark | CompositeMarkDef | Mark | MarkDef;\n\nexport function isMarkDef(mark: string | GenericMarkDef): mark is GenericMarkDef {\n return mark['type'];\n}\n\nexport function isPrimitiveMark(mark: AnyMark): mark is Mark {\n const markType = isMarkDef(mark) ? mark.type : mark;\n return (PRIMITIVE_MARKS as Set).has(markType);\n}\n\nexport const STROKE_CONFIG = [\n 'stroke',\n 'strokeWidth',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeOpacity',\n 'strokeJoin',\n 'strokeMiterLimit'\n] as const;\n\nexport const FILL_CONFIG = ['fill', 'fillOpacity'] as const;\n\nexport const FILL_STROKE_CONFIG = [...STROKE_CONFIG, ...FILL_CONFIG];\n\nconst VL_ONLY_MARK_CONFIG_INDEX: Flag> = {\n color: 1,\n filled: 1,\n invalid: 1,\n order: 1,\n radius2: 1,\n theta2: 1,\n timeUnitBandSize: 1,\n timeUnitBandPosition: 1\n};\n\nexport const VL_ONLY_MARK_CONFIG_PROPERTIES = keys(VL_ONLY_MARK_CONFIG_INDEX);\n\nexport const VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX: {\n [k in Mark]?: (keyof Required>[k])[];\n} = {\n area: ['line', 'point'],\n bar: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n rect: ['binSpacing', 'continuousBandSize', 'discreteBandSize', 'minBandSize'],\n line: ['point'],\n tick: ['bandSize', 'thickness']\n};\n\nexport const defaultMarkConfig: MarkConfig = {\n color: '#4c78a8',\n invalid: 'filter',\n timeUnitBandSize: 1\n};\n\n// TODO: replace with MarkConfigMixins[Mark] once https://github.com/vega/ts-json-schema-generator/issues/344 is fixed\nexport type AnyMarkConfig =\n | MarkConfig\n | AreaConfig\n | BarConfig\n | RectConfig\n | LineConfig\n | TickConfig;\n\nexport interface MarkConfigMixins {\n /** Mark Config */\n mark?: MarkConfig;\n\n // MARK-SPECIFIC CONFIGS\n\n /** Arc-specific Config */\n arc?: RectConfig;\n\n /** Area-Specific Config */\n area?: AreaConfig;\n\n /** Bar-Specific Config */\n bar?: BarConfig;\n\n /** Circle-Specific Config */\n circle?: MarkConfig;\n\n /** Image-specific Config */\n image?: RectConfig;\n\n /** Line-Specific Config */\n line?: LineConfig;\n\n /** Point-Specific Config */\n point?: MarkConfig;\n\n /** Rect-Specific Config */\n rect?: RectConfig;\n\n /** Rule-Specific Config */\n rule?: MarkConfig;\n\n /** Square-Specific Config */\n square?: MarkConfig;\n\n /** Text-Specific Config */\n text?: MarkConfig;\n\n /** Tick-Specific Config */\n tick?: TickConfig;\n\n /** Trail-Specific Config */\n trail?: LineConfig;\n\n /** Geoshape-Specific Config */\n geoshape?: MarkConfig;\n}\n\nconst MARK_CONFIG_INDEX: Flag> = {\n mark: 1,\n arc: 1,\n area: 1,\n bar: 1,\n circle: 1,\n image: 1,\n line: 1,\n point: 1,\n rect: 1,\n rule: 1,\n square: 1,\n text: 1,\n tick: 1,\n trail: 1,\n geoshape: 1\n};\n\nexport const MARK_CONFIGS = keys(MARK_CONFIG_INDEX);\n\nexport interface RectConfig extends RectBinSpacingMixins, MarkConfig {\n /**\n * The default size of the bars on continuous scales.\n *\n * __Default value:__ `5`\n *\n * @minimum 0\n */\n continuousBandSize?: number;\n\n /**\n * The default size of the bars with discrete dimensions. If unspecified, the default size is `step-2`, which provides 2 pixel offset between bars.\n * @minimum 0\n */\n discreteBandSize?: number | RelativeBandSize;\n\n /**\n * The minimum band size for bar and rectangle marks.\n * __Default value:__ `0.25`\n */\n minBandSize?: number | ES;\n}\n\nexport type BandSize = number | RelativeBandSize | SignalRef;\n\nexport interface RelativeBandSize {\n /**\n * The relative band size. For example `0.5` means half of the band scale's band width.\n */\n band: number;\n}\n\nexport function isRelativeBandSize(o: number | RelativeBandSize | ExprRef | SignalRef): o is RelativeBandSize {\n return o && o['band'] != undefined;\n}\n\nexport const BAR_CORNER_RADIUS_INDEX: Partial<\n Record<\n Orientation,\n ('cornerRadiusTopLeft' | 'cornerRadiusTopRight' | 'cornerRadiusBottomLeft' | 'cornerRadiusBottomRight')[]\n >\n> = {\n horizontal: ['cornerRadiusTopRight', 'cornerRadiusBottomRight'],\n vertical: ['cornerRadiusTopLeft', 'cornerRadiusTopRight']\n};\n\nexport interface BarCornerRadiusMixins {\n /**\n * - For vertical bars, top-left and top-right corner radius.\n *\n * - For horizontal bars, top-right and bottom-right corner radius.\n */\n cornerRadiusEnd?: number | ES;\n}\n\nexport type BarConfig = RectConfig & BarCornerRadiusMixins;\n\nexport type OverlayMarkDef = MarkConfig & MarkDefMixins;\n\nexport interface PointOverlayMixins {\n /**\n * A flag for overlaying points on top of line or area marks, or an object defining the properties of the overlayed points.\n *\n * - If this property is `\"transparent\"`, transparent points will be used (for enhancing tooltips and selections).\n *\n * - If this property is an empty object (`{}`) or `true`, filled points with default properties will be used.\n *\n * - If this property is `false`, no points would be automatically added to line or area marks.\n *\n * __Default value:__ `false`.\n */\n point?: boolean | OverlayMarkDef | 'transparent';\n}\n\nexport interface LineConfig extends MarkConfig, PointOverlayMixins {}\n\nexport interface LineOverlayMixins {\n /**\n * A flag for overlaying line on top of area marks, or an object defining the properties of the overlayed lines.\n *\n * - If this value is an empty object (`{}`) or `true`, lines with default properties will be used.\n *\n * - If this value is `false`, no lines would be automatically added to area marks.\n *\n * __Default value:__ `false`.\n */\n line?: boolean | OverlayMarkDef;\n}\n\nexport interface AreaConfig\n extends MarkConfig,\n PointOverlayMixins,\n LineOverlayMixins {}\n\nexport interface TickThicknessMixins {\n /**\n * Thickness of the tick mark.\n *\n * __Default value:__ `1`\n *\n * @minimum 0\n */\n thickness?: number | SignalRef;\n}\n\nexport interface GenericMarkDef {\n /**\n * The mark type. This could a primitive mark type\n * (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"geoshape\"`, `\"rule\"`, and `\"text\"`)\n * or a composite mark type (`\"boxplot\"`, `\"errorband\"`, `\"errorbar\"`).\n */\n type: M;\n}\n\nexport interface MarkDefMixins {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the mark. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles. Any [mark properties](https://vega.github.io/vega-lite/docs/encoding.html#mark-prop) explicitly defined within the `encoding` will override a style default.\n *\n * __Default value:__ The mark's name. For example, a bar mark will have style `\"bar\"` by default.\n * __Note:__ Any specified style will augment the default style. For example, a bar mark with `\"style\": \"foo\"` will receive from `config.style.bar` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n\n /**\n * Whether a mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n\n // Offset properties should not be a part of config\n\n /**\n * Offset for x-position.\n */\n xOffset?: number | ES;\n\n /**\n * Offset for y-position.\n */\n yOffset?: number | ES;\n\n /**\n * Offset for x2-position.\n */\n x2Offset?: number | ES;\n\n /**\n * Offset for y2-position.\n */\n y2Offset?: number | ES;\n\n /**\n * Offset for theta.\n */\n thetaOffset?: number | ES;\n\n /**\n * Offset for theta2.\n */\n theta2Offset?: number | ES;\n\n /**\n * Offset for radius.\n */\n radiusOffset?: number | ES;\n\n /**\n * Offset for radius2.\n */\n radius2Offset?: number | ES;\n}\n\nexport interface RelativeBandSize {\n /**\n * The relative band size. For example `0.5` means half of the band scale's band width.\n */\n band: number;\n}\n\n// Point/Line OverlayMixins are only for area, line, and trail but we don't want to declare multiple types of MarkDef\nexport interface MarkDef\n extends GenericMarkDef,\n Omit<\n MarkConfig &\n AreaConfig &\n BarConfig & // always extends RectConfig\n LineConfig &\n TickConfig,\n 'startAngle' | 'endAngle' | 'width' | 'height'\n >,\n MarkDefMixins {\n // Omit startAngle/endAngle since we use theta/theta2 from Vega-Lite schema to avoid confusion\n // We still support start/endAngle only in config, just in case people use Vega config with Vega-Lite.\n\n /**\n * @hidden\n */\n startAngle?: number | ES;\n /**\n * @hidden\n */\n endAngle?: number | ES;\n\n // Replace width / height to include relative band size\n\n /**\n * Width of the marks. One of:\n *\n * - A number representing a fixed pixel width.\n *\n * - A relative band size definition. For example, `{band: 0.5}` represents half of the band.\n */\n width?: number | ES | RelativeBandSize;\n\n /**\n * Height of the marks. One of:\n *\n * - A number representing a fixed pixel height.\n *\n * - A relative band size definition. For example, `{band: 0.5}` represents half of the band\n */\n height?: number | ES | RelativeBandSize;\n}\n\nconst DEFAULT_RECT_BAND_SIZE = 5;\n\nexport const defaultBarConfig: RectConfig = {\n binSpacing: 1,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\n\nexport const defaultRectConfig: RectConfig = {\n binSpacing: 0,\n continuousBandSize: DEFAULT_RECT_BAND_SIZE,\n minBandSize: 0.25,\n timeUnitBandPosition: 0.5\n};\n\nexport interface TickConfig extends MarkConfig, TickThicknessMixins {\n /**\n * The width of the ticks.\n *\n * __Default value:__ 3/4 of step (width step for horizontal ticks and height step for vertical ticks).\n * @minimum 0\n */\n bandSize?: number;\n}\n\nexport const defaultTickConfig: TickConfig = {\n thickness: 1\n};\n\nexport function getMarkType(m: string | GenericMarkDef) {\n return isMarkDef(m) ? m.type : m;\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport type {SignalRef} from 'vega';\nimport {isFunction, isString} from 'vega-util';\nimport {isCountingAggregateOp} from '../../../aggregate';\nimport {isBinned, isBinning} from '../../../bin';\nimport {Channel, getMainRangeChannel, PolarPositionChannel, PositionChannel, X, X2, Y2} from '../../../channel';\nimport {\n binRequiresRange,\n ChannelDef,\n DatumDef,\n FieldDef,\n FieldDefBase,\n FieldName,\n FieldRefOption,\n getBandPosition,\n isDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n isValueDef,\n SecondaryChannelDef,\n SecondaryFieldDef,\n TypedFieldDef,\n Value,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {dateTimeToExpr, isDateTime} from '../../../datetime';\nimport {isExprRef} from '../../../expr';\nimport * as log from '../../../log';\nimport {isPathMark, Mark, MarkDef} from '../../../mark';\nimport {fieldValidPredicate} from '../../../predicate';\nimport {hasDiscreteDomain, isContinuousToContinuous} from '../../../scale';\nimport {StackProperties} from '../../../stack';\nimport {TEMPORAL} from '../../../type';\nimport {contains, stringify} from '../../../util';\nimport {isSignalRef, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\n\nexport function midPointRefWithPositionInvalidTest(\n params: MidPointParams & {\n channel: PositionChannel | PolarPositionChannel;\n }\n) {\n const {channel, channelDef, markDef, scale, config} = params;\n const ref = midPoint(params);\n\n // Wrap to check if the positional value is invalid, if so, plot the point on the min value\n if (\n // Only this for field def without counting aggregate (as count wouldn't be null)\n isFieldDef(channelDef) &&\n !isCountingAggregateOp(channelDef.aggregate) &&\n // and only for continuous scale\n scale &&\n isContinuousToContinuous(scale.get('type'))\n ) {\n return wrapPositionInvalidTest({\n fieldDef: channelDef,\n channel,\n markDef,\n ref,\n config\n });\n }\n return ref;\n}\n\nexport function wrapPositionInvalidTest({\n fieldDef,\n channel,\n markDef,\n ref,\n config\n}: {\n fieldDef: FieldDef;\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n ref: VgValueRef;\n config: Config;\n}): VgValueRef | VgValueRef[] {\n if (isPathMark(markDef.type)) {\n // path mark already use defined to skip points, no need to do it here.\n return ref;\n }\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid === null) {\n // if there is no invalid filter, don't do the invalid test\n return [fieldInvalidTestValueRef(fieldDef, channel), ref];\n }\n return ref;\n}\n\nexport function fieldInvalidTestValueRef(fieldDef: FieldDef, channel: PositionChannel | PolarPositionChannel) {\n const test = fieldInvalidPredicate(fieldDef, true);\n\n const mainChannel = getMainRangeChannel(channel) as PositionChannel | PolarPositionChannel; // we can cast here as the output can't be other things.\n const zeroValueRef =\n mainChannel === 'y'\n ? {field: {group: 'height'}}\n : // x / angle / radius can all use 0\n {value: 0};\n\n return {test, ...zeroValueRef};\n}\n\nexport function fieldInvalidPredicate(field: FieldName | FieldDef, invalid = true) {\n return fieldValidPredicate(isString(field) ? field : vgField(field, {expr: 'datum'}), !invalid);\n}\n\nexport function datumDefToExpr(datumDef: DatumDef) {\n const {datum} = datumDef;\n if (isDateTime(datum)) {\n return dateTimeToExpr(datum);\n }\n return `${stringify(datum)}`;\n}\n\nexport function valueRefForFieldOrDatumDef(\n fieldDef: FieldDefBase | DatumDef,\n scaleName: string,\n opt: FieldRefOption,\n encode: {offset?: number | VgValueRef; band?: number | boolean | SignalRef}\n): VgValueRef {\n const ref: VgValueRef = {};\n\n if (scaleName) {\n ref.scale = scaleName;\n }\n\n if (isDatumDef(fieldDef)) {\n const {datum} = fieldDef;\n if (isDateTime(datum)) {\n ref.signal = dateTimeToExpr(datum);\n } else if (isSignalRef(datum)) {\n ref.signal = datum.signal;\n } else if (isExprRef(datum)) {\n ref.signal = datum.expr;\n } else {\n ref.value = datum;\n }\n } else {\n ref.field = vgField(fieldDef, opt);\n }\n\n if (encode) {\n const {offset, band} = encode;\n if (offset) {\n ref.offset = offset;\n }\n if (band) {\n ref.band = band;\n }\n }\n return ref;\n}\n\n/**\n * Signal that returns the middle of a bin from start and end field. Should only be used with x and y.\n */\nexport function interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef,\n fieldOrDatumDef2,\n offset,\n startSuffix,\n endSuffix = 'end',\n bandPosition = 0.5\n}: {\n scaleName: string;\n fieldOrDatumDef: TypedFieldDef;\n fieldOrDatumDef2?: SecondaryFieldDef;\n startSuffix?: string;\n endSuffix?: string;\n offset: number | SignalRef | VgValueRef;\n bandPosition: number | SignalRef;\n}): VgValueRef {\n const expr = !isSignalRef(bandPosition) && 0 < bandPosition && bandPosition < 1 ? 'datum' : undefined;\n const start = vgField(fieldOrDatumDef, {expr, suffix: startSuffix});\n const end =\n fieldOrDatumDef2 !== undefined\n ? vgField(fieldOrDatumDef2, {expr})\n : vgField(fieldOrDatumDef, {suffix: endSuffix, expr});\n\n const ref: VgValueRef = {};\n\n if (bandPosition === 0 || bandPosition === 1) {\n ref.scale = scaleName;\n const field = bandPosition === 0 ? start : end;\n ref.field = field;\n } else {\n const datum = isSignalRef(bandPosition)\n ? `(1-${bandPosition.signal}) * ${start} + ${bandPosition.signal} * ${end}`\n : `${1 - bandPosition} * ${start} + ${bandPosition} * ${end}`;\n ref.signal = `scale(\"${scaleName}\", ${datum})`;\n }\n\n if (offset) {\n ref.offset = offset;\n }\n return ref;\n}\n\nexport function binSizeExpr({scaleName, fieldDef}: {scaleName: string; fieldDef: TypedFieldDef}) {\n const start = vgField(fieldDef, {expr: 'datum'});\n const end = vgField(fieldDef, {expr: 'datum', suffix: 'end'});\n return `abs(scale(\"${scaleName}\", ${end}) - scale(\"${scaleName}\", ${start}))`;\n}\n\nexport interface MidPointParams {\n channel: Channel;\n channelDef: ChannelDef;\n channel2Def?: SecondaryChannelDef;\n\n markDef: MarkDef;\n config: Config;\n\n scaleName: string;\n scale: ScaleComponent;\n stack?: StackProperties;\n offset?: number | SignalRef | VgValueRef;\n defaultRef: VgValueRef | (() => VgValueRef);\n\n bandPosition?: number | SignalRef;\n}\n\n/**\n * @returns {VgValueRef} Value Ref for xc / yc or mid point for other channels.\n */\nexport function midPoint({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition\n}: MidPointParams): VgValueRef {\n // TODO: datum support\n if (channelDef) {\n /* istanbul ignore else */\n\n if (isFieldOrDatumDef(channelDef)) {\n const scaleType = scale?.get('type');\n if (isTypedFieldDef(channelDef)) {\n bandPosition ??= getBandPosition({\n fieldDef: channelDef,\n fieldDef2: channel2Def,\n markDef,\n config\n });\n const {bin, timeUnit, type} = channelDef;\n\n if (isBinning(bin) || (bandPosition && timeUnit && type === TEMPORAL)) {\n // Use middle only for x an y to place marks in the center between start and end of the bin range.\n // We do not use the mid point for other channels (e.g. size) so that properties of legends and marks match.\n if (stack?.impute) {\n // For stack, we computed bin_mid so we can impute.\n return valueRefForFieldOrDatumDef(channelDef, scaleName, {binSuffix: 'mid'}, {offset});\n }\n\n if (bandPosition && !hasDiscreteDomain(scaleType)) {\n // if band = 0, no need to call interpolation\n // For non-stack, we can just calculate bin mid on the fly using signal.\n return interpolatedSignalRef({scaleName, fieldOrDatumDef: channelDef, bandPosition, offset});\n }\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n binRequiresRange(channelDef, channel) ? {binSuffix: 'range'} : {},\n {\n offset\n }\n );\n } else if (isBinned(bin)) {\n if (isFieldDef(channel2Def)) {\n return interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef,\n fieldOrDatumDef2: channel2Def,\n bandPosition,\n offset\n });\n } else {\n const channel2 = channel === X ? X2 : Y2;\n log.warn(log.message.channelRequiredForBinned(channel2));\n }\n }\n }\n\n return valueRefForFieldOrDatumDef(\n channelDef,\n scaleName,\n hasDiscreteDomain(scaleType) ? {binSuffix: 'range'} : {}, // no need for bin suffix if there is no scale\n {\n offset,\n // For band, to get mid point, need to offset by half of the band\n band: scaleType === 'band' ? bandPosition ?? channelDef.bandPosition ?? 0.5 : undefined\n }\n );\n } else if (isValueDef(channelDef)) {\n const value = channelDef.value;\n const offsetMixins = offset ? {offset} : {};\n\n return {...widthHeightValueOrSignalRef(channel, value), ...offsetMixins};\n }\n\n // If channelDef is neither field def or value def, it's a condition-only def.\n // In such case, we will use default ref.\n }\n\n if (isFunction(defaultRef)) {\n defaultRef = defaultRef();\n }\n\n if (defaultRef) {\n // for non-position, ref could be undefined.\n return {\n ...defaultRef,\n // only include offset when it is non-zero (zero = no offset)\n ...(offset ? {offset} : {})\n };\n }\n return defaultRef;\n}\n\n/**\n * Convert special \"width\" and \"height\" values in Vega-Lite into Vega value ref.\n */\nexport function widthHeightValueOrSignalRef(channel: Channel, value: Value | SignalRef) {\n if (contains(['x', 'x2'], channel) && value === 'width') {\n return {field: {group: 'width'}};\n } else if (contains(['y', 'y2'], channel) && value === 'height') {\n return {field: {group: 'height'}};\n }\n return signalOrValueRef(value);\n}\n","import type {SignalRef} from 'vega';\nimport {isString} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {\n channelDefType,\n DatumDef,\n FieldDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isPositionFieldOrDatumDef,\n isScaleFieldDef,\n vgField\n} from '../channeldef';\nimport {Config} from '../config';\nimport {fieldValidPredicate} from '../predicate';\nimport {ScaleType} from '../scale';\nimport {formatExpression, normalizeTimeUnit, timeUnitSpecifierExpression} from '../timeunit';\nimport {QUANTITATIVE, Type} from '../type';\nimport {Dict, stringify} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {TimeUnit} from './../timeunit';\nimport {datumDefToExpr} from './mark/encode/valueref';\n\nexport function isCustomFormatType(formatType: string) {\n return formatType && formatType !== 'number' && formatType !== 'time';\n}\n\nfunction customFormatExpr(formatType: string, field: string, format: string | Dict) {\n return `${formatType}(${field}${format ? `, ${stringify(format)}` : ''})`;\n}\n\nexport const BIN_RANGE_DELIMITER = ' \\u2013 ';\n\nexport function formatSignalRef({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n}) {\n if (isCustomFormatType(formatType)) {\n return formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n config\n });\n }\n\n const field = fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n const type = channelDefType(fieldOrDatumDef);\n\n if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (type === 'quantitative') {\n if (normalizeStack && config.normalizedNumberFormatType)\n return formatCustomType({\n fieldOrDatumDef,\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n expr,\n config\n });\n if (config.numberFormatType) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.numberFormat,\n formatType: config.numberFormatType,\n expr,\n config\n });\n }\n }\n if (\n type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined\n ) {\n return formatCustomType({\n fieldOrDatumDef,\n format: config.timeFormat,\n formatType: config.timeFormatType,\n expr,\n config\n });\n }\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const signal = timeFormatExpression({\n field,\n timeUnit: isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined,\n format,\n formatType: config.timeFormatType,\n rawTimeFormat: config.timeFormat,\n isUTCScale: isScaleFieldDef(fieldOrDatumDef) && fieldOrDatumDef.scale?.type === ScaleType.UTC\n });\n return signal ? {signal} : undefined;\n }\n\n format = numberFormat({type, specifiedFormat: format, config, normalizeStack});\n if (isFieldDef(fieldOrDatumDef) && isBinning(fieldOrDatumDef.bin)) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n } else if (format || channelDefType(fieldOrDatumDef) === 'quantitative') {\n return {\n signal: `${formatExpr(field, format)}`\n };\n } else {\n return {signal: `isValid(${field}) ? ${field} : \"\"+${field}`};\n }\n}\n\nfunction fieldToFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n expr: 'datum' | 'parent' | 'datum.datum',\n normalizeStack: boolean\n) {\n if (isFieldDef(fieldOrDatumDef)) {\n if (normalizeStack) {\n return `${vgField(fieldOrDatumDef, {expr, suffix: 'end'})}-${vgField(fieldOrDatumDef, {\n expr,\n suffix: 'start'\n })}`;\n } else {\n return vgField(fieldOrDatumDef, {expr});\n }\n } else {\n return datumDefToExpr(fieldOrDatumDef);\n }\n}\n\nexport function formatCustomType({\n fieldOrDatumDef,\n format,\n formatType,\n expr,\n normalizeStack,\n config,\n field\n}: {\n fieldOrDatumDef: FieldDef | DatumDef;\n format: string | Dict;\n formatType: string;\n expr?: 'datum' | 'parent' | 'datum.datum';\n normalizeStack?: boolean;\n config: Config;\n field?: string; // axis/legend \"use datum.value\"\n}) {\n field ??= fieldToFormat(fieldOrDatumDef, expr, normalizeStack);\n\n if (\n field !== 'datum.value' && // For axis/legend, we can't correctly know the end of the bin from `datum`\n isFieldDef(fieldOrDatumDef) &&\n isBinning(fieldOrDatumDef.bin)\n ) {\n const endField = vgField(fieldOrDatumDef, {expr, binSuffix: 'end'});\n return {\n signal: binFormatExpression(field, endField, format, formatType, config)\n };\n }\n return {signal: customFormatExpr(formatType, field, format)};\n}\n\nexport function guideFormat(\n fieldOrDatumDef: FieldDef | DatumDef,\n type: Type,\n format: string | Dict,\n formatType: string | SignalRef,\n config: Config,\n omitTimeFormatConfig: boolean // axis doesn't use config.timeFormat\n) {\n if (isString(formatType) && isCustomFormatType(formatType)) {\n return undefined; // handled in encode block\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (\n config.normalizedNumberFormatType &&\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize'\n ) {\n return undefined; // handled in encode block\n }\n if (config.numberFormatType) {\n return undefined; // handled in encode block\n }\n }\n }\n\n if (\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormat\n ) {\n return numberFormat({\n type: 'quantitative',\n config,\n normalizeStack: true\n });\n }\n\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef)) {\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n if (timeUnit === undefined && config.customFormatTypes && config.timeFormatType) {\n return undefined; // hanlded in encode block\n }\n\n return timeFormat({specifiedFormat: format as string, timeUnit, config, omitTimeFormatConfig});\n }\n\n return numberFormat({type, specifiedFormat: format, config});\n}\n\nexport function guideFormatType(\n formatType: string | SignalRef,\n fieldOrDatumDef: FieldDef | DatumDef,\n scaleType: ScaleType\n) {\n if (formatType && (isSignalRef(formatType) || formatType === 'number' || formatType === 'time')) {\n return formatType;\n }\n if (isFieldOrDatumDefForTimeFormat(fieldOrDatumDef) && scaleType !== 'time' && scaleType !== 'utc') {\n return isFieldDef(fieldOrDatumDef) && normalizeTimeUnit(fieldOrDatumDef?.timeUnit)?.utc ? 'utc' : 'time';\n }\n return undefined;\n}\n\n/**\n * Returns number format for a fieldDef.\n */\nexport function numberFormat({\n type,\n specifiedFormat,\n config,\n normalizeStack\n}: {\n type: Type;\n specifiedFormat?: string | Dict;\n config: Config;\n normalizeStack?: boolean;\n}) {\n // Specified format in axis/legend has higher precedence than fieldDef.format\n if (isString(specifiedFormat)) {\n return specifiedFormat;\n }\n\n if (type === QUANTITATIVE) {\n // we only apply the default if the field is quantitative\n return normalizeStack ? config.normalizedNumberFormat : config.numberFormat;\n }\n return undefined;\n}\n\n/**\n * Returns time format for a fieldDef for use in guides.\n */\nexport function timeFormat({\n specifiedFormat,\n timeUnit,\n config,\n omitTimeFormatConfig\n}: {\n specifiedFormat?: string;\n timeUnit?: TimeUnit;\n config: Config;\n omitTimeFormatConfig?: boolean;\n}) {\n if (specifiedFormat) {\n return specifiedFormat;\n }\n\n if (timeUnit) {\n return {\n signal: timeUnitSpecifierExpression(timeUnit)\n };\n }\n\n return omitTimeFormatConfig ? undefined : config.timeFormat;\n}\n\nfunction formatExpr(field: string, format: string) {\n return `format(${field}, \"${format || ''}\")`;\n}\n\nfunction binNumberFormatExpr(field: string, format: string | Dict, formatType: string, config: Config) {\n if (isCustomFormatType(formatType)) {\n return customFormatExpr(formatType, field, format);\n }\n\n return formatExpr(field, (isString(format) ? format : undefined) ?? config.numberFormat);\n}\n\nexport function binFormatExpression(\n startField: string,\n endField: string,\n format: string | Dict,\n formatType: string,\n config: Config\n): string {\n if (format === undefined && formatType === undefined && config.customFormatTypes && config.numberFormatType) {\n return binFormatExpression(startField, endField, config.numberFormat, config.numberFormatType, config);\n }\n const start = binNumberFormatExpr(startField, format, formatType, config);\n const end = binNumberFormatExpr(endField, format, formatType, config);\n return `${fieldValidPredicate(startField, false)} ? \"null\" : ${start} + \"${BIN_RANGE_DELIMITER}\" + ${end}`;\n}\n\n/**\n * Returns the time expression used for axis/legend labels or text mark for a temporal field\n */\nexport function timeFormatExpression({\n field,\n timeUnit,\n format,\n formatType,\n rawTimeFormat,\n isUTCScale\n}: {\n field: string;\n timeUnit?: TimeUnit;\n format?: string | Dict;\n formatType?: string;\n rawTimeFormat?: string; // should be provided only for actual text and headers, not axis/legend labels\n isUTCScale?: boolean;\n}): string {\n if (!timeUnit || format) {\n // If there is no time unit, or if user explicitly specifies format for axis/legend/text.\n if (!timeUnit && formatType) {\n return `${formatType}(${field}, '${format}')`;\n }\n format = isString(format) ? format : rawTimeFormat; // only use provided timeFormat if there is no timeUnit.\n return `${isUTCScale ? 'utc' : 'time'}Format(${field}, '${format}')`;\n } else {\n return formatExpression(timeUnit, field, isUTCScale);\n }\n}\n","import {isArray} from 'vega-util';\nimport {NonArgAggregateOp} from './aggregate';\nimport {FieldName} from './channeldef';\nimport {DateTime} from './datetime';\n\nexport type SortOrder = 'ascending' | 'descending';\n\n/**\n * A sort definition for transform\n */\nexport interface SortField {\n /**\n * The name of the field to sort.\n */\n field: FieldName;\n\n /**\n * Whether to sort the field in ascending or descending order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortFields {\n field: FieldName[];\n order?: SortOrder[];\n}\n\nexport const DEFAULT_SORT_OP = 'min';\n\n/**\n * A sort definition for sorting a discrete scale in an encoding field definition.\n */\n\nexport interface EncodingSortField {\n /**\n * The data [field](https://vega.github.io/vega-lite/docs/field.html) to sort by.\n *\n * __Default value:__ If unspecified, defaults to the field specified in the outer data reference.\n */\n field?: F; // Field is optional because `\"op\": \"count\"` does not require a field.\n /**\n * An [aggregate operation](https://vega.github.io/vega-lite/docs/aggregate.html#ops) to perform on the field prior to sorting (e.g., `\"count\"`, `\"mean\"` and `\"median\"`).\n * An aggregation is required when there are multiple values of the sort field for each encoded data field.\n * The input data objects will be aggregated, grouped by the encoded data field.\n *\n * For a full list of operations, please see the documentation for [aggregate](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n *\n * __Default value:__ `\"sum\"` for stacked plots. Otherwise, `\"min\"`.\n */\n op?: NonArgAggregateOp;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport interface SortByEncoding {\n /**\n * The [encoding channel](https://vega.github.io/vega-lite/docs/encoding.html#channels) to sort by (e.g., `\"x\"`, `\"y\"`)\n */\n encoding: SortByChannel;\n\n /**\n * The sort order. One of `\"ascending\"` (default), `\"descending\"`, or `null` (no not sort).\n */\n order?: SortOrder | null;\n}\n\nexport type SortArray = number[] | string[] | boolean[] | DateTime[];\n\nconst SORT_BY_CHANNEL_INDEX = {\n x: 1,\n y: 1,\n color: 1,\n fill: 1,\n stroke: 1,\n strokeWidth: 1,\n size: 1,\n shape: 1,\n fillOpacity: 1,\n strokeOpacity: 1,\n opacity: 1,\n text: 1\n} as const;\n\nexport type SortByChannel = keyof typeof SORT_BY_CHANNEL_INDEX;\n\nexport function isSortByChannel(c: string): c is SortByChannel {\n return c in SORT_BY_CHANNEL_INDEX;\n}\n\nexport type SortByChannelDesc =\n | '-x'\n | '-y'\n | '-color'\n | '-fill'\n | '-stroke'\n | '-strokeWidth'\n | '-size'\n | '-shape'\n | '-fillOpacity'\n | '-strokeOpacity'\n | '-opacity'\n | '-text';\n\nexport type AllSortString = SortOrder | SortByChannel | SortByChannelDesc;\n\nexport type Sort = SortArray | AllSortString | EncodingSortField | SortByEncoding | null;\n\nexport function isSortByEncoding(sort: Sort): sort is SortByEncoding {\n return !!sort?.['encoding'];\n}\n\nexport function isSortField(sort: Sort): sort is EncodingSortField {\n return sort && (sort['op'] === 'count' || !!sort['field']);\n}\n\nexport function isSortArray(sort: Sort): sort is SortArray {\n return sort && isArray(sort);\n}\n","import {LayoutAlign, SignalRef} from 'vega';\nimport {BinParams} from '../bin';\nimport {ChannelDef, Field, FieldName, TypedFieldDef} from '../channeldef';\nimport {ExprRef} from '../expr';\nimport {Header} from '../header';\nimport {EncodingSortField, SortArray, SortOrder} from '../sort';\nimport {StandardType} from '../type';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {GenericLayerSpec, NormalizedLayerSpec} from './layer';\nimport {GenericUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport interface FacetFieldDef\n extends TypedFieldDef {\n /**\n * An object defining properties of a facet's header.\n */\n header?: Header | null;\n\n // Note: `\"sort\"` for facet field def is different from encoding field def as it does not support `SortByEncoding`\n\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` is not supported for `row` and `column`.\n */\n sort?: SortArray | SortOrder | EncodingSortField | null;\n}\n\nexport type FacetEncodingFieldDef<\n F extends Field,\n ES extends ExprRef | SignalRef = ExprRef | SignalRef\n> = FacetFieldDef & GenericCompositionLayoutWithColumns;\n\nexport interface RowColumnEncodingFieldDef\n extends FacetFieldDef {\n // Manually declarae this separated from GenericCompositionLayout as we don't support RowCol object in RowColumnEncodingFieldDef\n\n /**\n * The alignment to apply to row/column facet's subplot.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign;\n\n /**\n * Boolean flag indicating if facet's subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between facet's sub-views.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number;\n}\n\nexport interface FacetMapping<\n F extends Field,\n FD extends FacetFieldDef = FacetFieldDef\n> {\n /**\n * A field definition for the vertical facet of trellis plots.\n */\n row?: FD;\n\n /**\n * A field definition for the horizontal facet of trellis plots.\n */\n column?: FD;\n}\n\nexport function isFacetMapping(\n f: FacetFieldDef | FacetMapping\n): f is FacetMapping {\n return 'row' in f || 'column' in f;\n}\n\n/**\n * Facet mapping for encoding macro\n */\nexport interface EncodingFacetMapping\n extends FacetMapping> {\n /**\n * A field definition for the (flexible) facet of trellis plots.\n *\n * If either `row` or `column` is specified, this channel will be ignored.\n */\n facet?: FacetEncodingFieldDef;\n}\n\nexport function isFacetFieldDef(channelDef: ChannelDef): channelDef is FacetFieldDef {\n return !!channelDef && 'header' in channelDef;\n}\n\n/**\n * Base interface for a facet specification.\n */\nexport interface GenericFacetSpec, L extends GenericLayerSpec, F extends Field>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * Definition for how to facet the data. One of:\n * 1) [a field definition for faceting the plot by one field](https://vega.github.io/vega-lite/docs/facet.html#field-def)\n * 2) [An object that maps `row` and `column` channels to their field definitions](https://vega.github.io/vega-lite/docs/facet.html#mapping)\n */\n facet: FacetFieldDef | FacetMapping;\n\n /**\n * A specification of the view that gets faceted.\n */\n spec: L | U;\n // TODO: replace this with GenericSpec once we support all cases;\n}\n\n/**\n * A facet specification without any shortcut / expansion syntax\n */\nexport type NormalizedFacetSpec = GenericFacetSpec;\n\nexport function isFacetSpec(spec: BaseSpec): spec is GenericFacetSpec {\n return 'facet' in spec;\n}\n","import {Gradient, ScaleType, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isNumber, isString} from 'vega-util';\nimport {Aggregate, isAggregateOp, isArgmaxDef, isArgminDef, isCountingAggregateOp} from './aggregate';\nimport {Axis} from './axis';\nimport {autoMaxBins, Bin, BinParams, binToString, isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n COLOR,\n COLUMN,\n DESCRIPTION,\n DETAIL,\n ExtendedChannel,\n FACET,\n FILL,\n FILLOPACITY,\n getSizeChannel,\n HREF,\n isScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n PolarPositionScaleChannel,\n PositionScaleChannel,\n RADIUS,\n RADIUS2,\n ROW,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n URL,\n X,\n X2,\n XOFFSET,\n Y,\n Y2,\n YOFFSET\n} from './channel';\nimport {getMarkConfig, getMarkPropOrConfig} from './compile/common';\nimport {isCustomFormatType} from './compile/format';\nimport {CompositeAggregate} from './compositemark';\nimport {Config} from './config';\nimport {DateTime, dateTimeToExpr, isDateTime} from './datetime';\nimport {Encoding} from './encoding';\nimport {ExprRef, isExprRef} from './expr';\nimport {Guide, GuideEncodingConditionalValueDef, TitleMixins} from './guide';\nimport {ImputeParams} from './impute';\nimport {Legend} from './legend';\nimport * as log from './log';\nimport {LogicalComposition} from './logical';\nimport {isRectBasedMark, Mark, MarkDef, RelativeBandSize} from './mark';\nimport {ParameterPredicate, Predicate} from './predicate';\nimport {hasDiscreteDomain, isContinuousToDiscrete, Scale, SCALE_CATEGORY_INDEX} from './scale';\nimport {isSortByChannel, Sort, SortOrder} from './sort';\nimport {isFacetFieldDef} from './spec/facet';\nimport {StackOffset} from './stack';\nimport {\n BinnedTimeUnit,\n getTimeUnitParts,\n isBinnedTimeUnit,\n isLocalSingleTimeUnit,\n normalizeTimeUnit,\n TimeUnit,\n TimeUnitParams,\n timeUnitToString\n} from './timeunit';\nimport {AggregatedFieldDef, WindowFieldDef} from './transform';\nimport {getFullName, QUANTITATIVE, StandardType, Type} from './type';\nimport {\n Dict,\n flatAccessWithDatum,\n getFirstDefined,\n internalField,\n omit,\n removePathFromField,\n replacePathInField,\n stringify,\n titleCase\n} from './util';\nimport {isSignalRef} from './vega.schema';\n\nexport type PrimitiveValue = number | string | boolean | null;\n\nexport type Value =\n | PrimitiveValue\n | number[]\n | Gradient\n | Text\n | ES;\n\n/**\n * Definition object for a constant value (primitive value or gradient definition) of an encoding channel.\n */\nexport interface ValueDef {\n /**\n * A constant value in visual domain (e.g., `\"red\"` / `\"#0099ff\"` / [gradient definition](https://vega.github.io/vega-lite/docs/types.html#gradient) for color, values between `0` to `1` for opacity).\n */\n value: V;\n}\n\nexport type PositionValueDef = ValueDef;\nexport type NumericValueDef = ValueDef;\n\n/**\n * A ValueDef with Condition where either the condition or the value are optional.\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * @minProperties 1\n */\nexport type ValueDefWithCondition | DatumDef, V extends Value = Value> = Partial<\n ValueDef\n> & {\n /**\n * A field definition or one or more value definition(s) with a parameter predicate.\n */\n condition?:\n | Conditional\n | Conditional>\n | Conditional>[];\n};\n\nexport type StringValueDefWithCondition = ValueDefWithCondition<\n MarkPropFieldOrDatumDef,\n string | null\n>;\nexport type TypeForShape = 'nominal' | 'ordinal' | 'geojson';\n\nexport type ConditionalTemplate = FieldDef | DatumDef | ValueDef | ExprRef | SignalRef;\n\nexport type Conditional = ConditionalPredicate | ConditionalParameter;\n\nexport type ConditionalPredicate = {\n /**\n * Predicate for triggering the condition\n */\n test: LogicalComposition;\n} & CD;\n\nexport type ConditionalParameter = ParameterPredicate & CD;\n\nexport function isConditionalParameter(c: Conditional): c is ConditionalParameter {\n return c['param'];\n}\n\nexport interface ConditionValueDefMixins {\n /**\n * One or more value definition(s) with [a parameter or a test predicate](https://vega.github.io/vega-lite/docs/condition.html).\n *\n * __Note:__ A field definition's `condition` property can only contain [conditional value definitions](https://vega.github.io/vega-lite/docs/condition.html#value)\n * since Vega-Lite only allows at most one encoded field per encoding channel.\n */\n condition?: Conditional> | Conditional>[];\n}\n\n/**\n * A FieldDef with Condition\n * {\n * condition: {value: ...},\n * field: ...,\n * ...\n * }\n */\n\nexport type FieldOrDatumDefWithCondition | DatumDef, V extends Value = Value> = F &\n ConditionValueDefMixins;\n\nexport type MarkPropDef =\n | FieldOrDatumDefWithCondition, V>\n | FieldOrDatumDefWithCondition, V>\n | ValueDefWithCondition, V>;\n\nexport type ColorDef = MarkPropDef;\nexport type NumericMarkPropDef = MarkPropDef;\n\nexport type NumericArrayMarkPropDef = MarkPropDef;\n\nexport type ShapeDef = MarkPropDef;\n\nexport type StringFieldDefWithCondition = FieldOrDatumDefWithCondition, string>;\nexport type TextDef =\n | FieldOrDatumDefWithCondition, Text>\n | FieldOrDatumDefWithCondition, Text>\n | ValueDefWithCondition, Text>;\n\n/**\n * A ValueDef with optional Condition\n * {\n * condition: {field: ...} | {value: ...},\n * value: ...,\n * }\n */\n\n/**\n * Reference to a repeated value.\n */\nexport interface RepeatRef {\n repeat: 'row' | 'column' | 'repeat' | 'layer';\n}\n\nexport type FieldName = string;\nexport type Field = FieldName | RepeatRef;\n\nexport function isRepeatRef(field: Field | any): field is RepeatRef {\n return field && !isString(field) && 'repeat' in field;\n}\n\n/** @@hidden */\nexport type HiddenCompositeAggregate = CompositeAggregate;\n\nexport interface FieldDefBase extends BandMixins {\n /**\n * __Required.__ A string defining the name of the field from which to pull a data value\n * or an object defining iterated values from the [`repeat`](https://vega.github.io/vega-lite/docs/repeat.html) operator.\n *\n * __See also:__ [`field`](https://vega.github.io/vega-lite/docs/field.html) documentation.\n *\n * __Notes:__\n * 1) Dots (`.`) and brackets (`[` and `]`) can be used to access nested objects (e.g., `\"field\": \"foo.bar\"` and `\"field\": \"foo['bar']\"`).\n * If field names contain dots or brackets but are not nested, you can use `\\\\` to escape dots and brackets (e.g., `\"a\\\\.b\"` and `\"a\\\\[0\\\\]\"`).\n * See more details about escaping in the [field documentation](https://vega.github.io/vega-lite/docs/field.html).\n * 2) `field` is not required if `aggregate` is `count`.\n */\n field?: F;\n\n // function\n\n /**\n * Time unit (e.g., `year`, `yearmonth`, `month`, `hours`) for a temporal field.\n * or [a temporal field that gets casted as ordinal](https://vega.github.io/vega-lite/docs/type.html#cast).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html) documentation.\n */\n timeUnit?: TimeUnit | BinnedTimeUnit | TimeUnitParams;\n\n /**\n * Aggregation function for the field\n * (e.g., `\"mean\"`, `\"sum\"`, `\"median\"`, `\"min\"`, `\"max\"`, `\"count\"`).\n *\n * __Default value:__ `undefined` (None)\n *\n * __See also:__ [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html) documentation.\n */\n aggregate?: Aggregate | HiddenCompositeAggregate;\n\n /**\n * A flag for binning a `quantitative` field, [an object defining binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters), or indicating that the data for `x` or `y` channel are binned before they are imported into Vega-Lite (`\"binned\"`).\n *\n * - If `true`, default [binning parameters](https://vega.github.io/vega-lite/docs/bin.html#bin-parameters) will be applied.\n *\n * - If `\"binned\"`, this indicates that the data for the `x` (or `y`) channel are already binned. You can map the bin-start field to `x` (or `y`) and the bin-end field to `x2` (or `y2`). The scale and axis will be formatted similar to binning in Vega-Lite. To adjust the axis ticks based on the bin step, you can also set the axis's [`tickMinStep`](https://vega.github.io/vega-lite/docs/axis.html#ticks) property.\n *\n * __Default value:__ `false`\n *\n * __See also:__ [`bin`](https://vega.github.io/vega-lite/docs/bin.html) documentation.\n */\n bin?: B;\n}\n\nexport function toFieldDefBase(fieldDef: FieldDef): FieldDefBase {\n const {field, timeUnit, bin, aggregate} = fieldDef;\n return {\n ...(timeUnit ? {timeUnit} : {}),\n ...(bin ? {bin} : {}),\n ...(aggregate ? {aggregate} : {}),\n field\n };\n}\n\nexport interface TypeMixins {\n /**\n * The type of measurement (`\"quantitative\"`, `\"temporal\"`, `\"ordinal\"`, or `\"nominal\"`) for the encoded field or constant value (`datum`).\n * It can also be a `\"geojson\"` type for encoding ['geoshape'](https://vega.github.io/vega-lite/docs/geoshape.html).\n *\n * Vega-Lite automatically infers data types in many cases as discussed below. However, type is required for a field if:\n * (1) the field is not nominal and the field encoding has no specified `aggregate` (except `argmin` and `argmax`), `bin`, scale type, custom `sort` order, nor `timeUnit`\n * or (2) if you wish to use an ordinal scale for a field with `bin` or `timeUnit`.\n *\n * __Default value:__\n *\n * 1) For a data `field`, `\"nominal\"` is the default data type unless the field encoding has `aggregate`, `channel`, `bin`, scale type, `sort`, or `timeUnit` that satisfies the following criteria:\n * - `\"quantitative\"` is the default type if (1) the encoded field contains `bin` or `aggregate` except `\"argmin\"` and `\"argmax\"`, (2) the encoding channel is `latitude` or `longitude` channel or (3) if the specified scale type is [a quantitative scale](https://vega.github.io/vega-lite/docs/scale.html#type).\n * - `\"temporal\"` is the default type if (1) the encoded field contains `timeUnit` or (2) the specified scale type is a time or utc scale\n * - `\"ordinal\"` is the default type if (1) the encoded field contains a [custom `sort` order](https://vega.github.io/vega-lite/docs/sort.html#specifying-custom-sort-order), (2) the specified scale type is an ordinal/point/band scale, or (3) the encoding channel is `order`.\n *\n * 2) For a constant value in data domain (`datum`):\n * - `\"quantitative\"` if the datum is a number\n * - `\"nominal\"` if the datum is a string\n * - `\"temporal\"` if the datum is [a date time object](https://vega.github.io/vega-lite/docs/datetime.html)\n *\n * __Note:__\n * - Data `type` describes the semantics of the data rather than the primitive data types (number, string, etc.). The same primitive data type can have different types of measurement. For example, numeric data can represent quantitative, ordinal, or nominal data.\n * - Data values for a temporal field can be either a date-time string (e.g., `\"2015-03-07 12:32:17\"`, `\"17:01\"`, `\"2015-03-16\"`. `\"2015\"`) or a timestamp number (e.g., `1552199579097`).\n * - When using with [`bin`](https://vega.github.io/vega-lite/docs/bin.html), the `type` property can be either `\"quantitative\"` (for using a linear bin scale) or [`\"ordinal\"` (for using an ordinal bin scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`timeUnit`](https://vega.github.io/vega-lite/docs/timeunit.html), the `type` property can be either `\"temporal\"` (default, for using a temporal scale) or [`\"ordinal\"` (for using an ordinal scale)](https://vega.github.io/vega-lite/docs/type.html#cast-bin).\n * - When using with [`aggregate`](https://vega.github.io/vega-lite/docs/aggregate.html), the `type` property refers to the post-aggregation data type. For example, we can calculate count `distinct` of a categorical field `\"cat\"` using `{\"aggregate\": \"distinct\", \"field\": \"cat\"}`. The `\"type\"` of the aggregate output is `\"quantitative\"`.\n * - Secondary channels (e.g., `x2`, `y2`, `xError`, `yError`) do not have `type` as they must have exactly the same type as their primary channels (e.g., `x`, `y`).\n *\n * __See also:__ [`type`](https://vega.github.io/vega-lite/docs/type.html) documentation.\n */\n type?: T;\n}\n\n/**\n * Definition object for a data field, its type and transformation of an encoding channel.\n */\nexport type TypedFieldDef<\n F extends Field,\n T extends Type = any,\n B extends Bin = boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> = FieldDefBase & TitleMixins & TypeMixins;\n\nexport interface SortableFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> extends TypedFieldDef {\n /**\n * Sort order for the encoded field.\n *\n * For continuous fields (quantitative or temporal), `sort` can be either `\"ascending\"` or `\"descending\"`.\n *\n * For discrete fields, `sort` can be one of the following:\n * - `\"ascending\"` or `\"descending\"` -- for sorting by the values' natural order in JavaScript.\n * - [A string indicating an encoding channel name to sort by](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding) (e.g., `\"x\"` or `\"y\"`) with an optional minus prefix for descending sort (e.g., `\"-x\"` to sort by x-field, descending). This channel string is short-form of [a sort-by-encoding definition](https://vega.github.io/vega-lite/docs/sort.html#sort-by-encoding). For example, `\"sort\": \"-x\"` is equivalent to `\"sort\": {\"encoding\": \"x\", \"order\": \"descending\"}`.\n * - [A sort field definition](https://vega.github.io/vega-lite/docs/sort.html#sort-field) for sorting by another field.\n * - [An array specifying the field values in preferred order](https://vega.github.io/vega-lite/docs/sort.html#sort-array). In this case, the sort order will obey the values in the array, followed by any unspecified values in their original order. For discrete time field, values in the sort array can be [date-time definition objects](types#datetime). In addition, for time units `\"month\"` and `\"day\"`, the values can be the month or day names (case insensitive) or their 3-letter initials (e.g., `\"Mon\"`, `\"Tue\"`).\n * - `null` indicating no sort.\n *\n * __Default value:__ `\"ascending\"`\n *\n * __Note:__ `null` and sorting by another channel is not supported for `row` and `column`.\n *\n * __See also:__ [`sort`](https://vega.github.io/vega-lite/docs/sort.html) documentation.\n */\n sort?: Sort;\n}\n\nexport function isSortableFieldDef(fieldDef: FieldDef): fieldDef is SortableFieldDef {\n return 'sort' in fieldDef;\n}\n\nexport type ScaleFieldDef<\n F extends Field,\n T extends Type = StandardType,\n B extends Bin = boolean | BinParams | null\n> = SortableFieldDef & ScaleMixins;\n\nexport interface ScaleMixins {\n /**\n * An object defining properties of the channel's scale, which is the function that transforms values in the data domain (numbers, dates, strings, etc) to visual values (pixels, colors, sizes) of the encoding channels.\n *\n * If `null`, the scale will be [disabled and the data value will be directly encoded](https://vega.github.io/vega-lite/docs/scale.html#disable).\n *\n * __Default value:__ If undefined, default [scale properties](https://vega.github.io/vega-lite/docs/scale.html) are applied.\n *\n * __See also:__ [`scale`](https://vega.github.io/vega-lite/docs/scale.html) documentation.\n */\n scale?: Scale | null;\n}\n\nexport type OffsetDef =\n | ScaleFieldDef\n | ScaleDatumDef\n | ValueDef;\n\nexport interface DatumDef<\n F extends Field = string,\n V extends PrimitiveValue | DateTime | ExprRef | SignalRef = PrimitiveValue | DateTime | ExprRef | SignalRef\n> extends Partial>,\n BandMixins,\n TitleMixins {\n /**\n * A constant value in data domain.\n */\n datum?: F extends RepeatRef ? V | RepeatRef : V;\n // only apply Repeatref if field (F) can be RepeatRef\n // FIXME(https://github.com/microsoft/TypeScript/issues/37586):\n // `F extends RepeatRef` probably should be `RepeatRef extends F` but there is likely a bug in TS.\n}\n\nexport interface FormatMixins {\n /**\n * When used with the default `\"number\"` and `\"time\"` format type, the text formatting pattern for labels of guides (axes, legends, headers) and text marks.\n *\n * - If the format type is `\"number\"` (e.g., for quantitative fields), this is D3's [number format pattern](https://github.com/d3/d3-format#locale_format).\n * - If the format type is `\"time\"` (e.g., for temporal fields), this is D3's [time format pattern](https://github.com/d3/d3-time-format#locale_format).\n *\n * See the [format documentation](https://vega.github.io/vega-lite/docs/format.html) for more examples.\n *\n * When used with a [custom `formatType`](https://vega.github.io/vega-lite/docs/config.html#custom-format-type), this value will be passed as `format` alongside `datum.value` to the registered function.\n *\n * __Default value:__ Derived from [numberFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for number format and from [timeFormat](https://vega.github.io/vega-lite/docs/config.html#format) config for time format.\n */\n format?: string | Dict;\n\n /**\n * The format type for labels. One of `\"number\"`, `\"time\"`, or a [registered custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type).\n *\n * __Default value:__\n * - `\"time\"` for temporal fields and ordinal and nominal fields with `timeUnit`.\n * - `\"number\"` for quantitative fields as well as ordinal and nominal fields without `timeUnit`.\n */\n formatType?: 'number' | 'time' | string;\n}\n\nexport type StringDatumDef = DatumDef & FormatMixins;\n\nexport type ScaleDatumDef = ScaleMixins & DatumDef;\n\n/**\n * A field definition of a secondary channel that shares a scale with another primary channel. For example, `x2`, `xError` and `xError2` share the same scale with `x`.\n */\nexport type SecondaryFieldDef = FieldDefBase & TitleMixins; // x2/y2 shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type Position2Def = SecondaryFieldDef | DatumDef | PositionValueDef;\n\nexport type SecondaryChannelDef = Encoding['x2' | 'y2'];\n\n/**\n * Field Def without scale (and without bin: \"binned\" support).\n */\nexport type FieldDefWithoutScale = TypedFieldDef;\n\nexport type LatLongFieldDef = FieldDefBase &\n TitleMixins &\n Partial>; // Lat long shouldn't have bin, but we keep bin property for simplicity of the codebase.\n\nexport type LatLongDef = LatLongFieldDef | DatumDef;\n\nexport type PositionFieldDefBase = ScaleFieldDef<\n F,\n StandardType,\n boolean | BinParams | 'binned' | null // This is equivalent to Bin but we use the full form so the docs has detailed types\n> &\n PositionBaseMixins;\n\nexport type PositionDatumDefBase = ScaleDatumDef & PositionBaseMixins;\n\nexport interface PositionBaseMixins {\n /**\n * Type of stacking offset if the field should be stacked.\n * `stack` is only applicable for `x`, `y`, `theta`, and `radius` channels with continuous domains.\n * For example, `stack` of `y` can be used to customize stacking for a vertical bar chart.\n *\n * `stack` can be one of the following values:\n * - `\"zero\"` or `true`: stacking with baseline offset at zero value of the scale (for creating typical stacked [bar](https://vega.github.io/vega-lite/docs/stack.html#bar) and [area](https://vega.github.io/vega-lite/docs/stack.html#area) chart).\n * - `\"normalize\"` - stacking with normalized domain (for creating [normalized stacked bar and area charts](https://vega.github.io/vega-lite/docs/stack.html#normalized) and pie charts [with percentage tooltip](https://vega.github.io/vega-lite/docs/arc.html#tooltip)).
\n * -`\"center\"` - stacking with center baseline (for [streamgraph](https://vega.github.io/vega-lite/docs/stack.html#streamgraph)).\n * - `null` or `false` - No-stacking. This will produce layered [bar](https://vega.github.io/vega-lite/docs/stack.html#layered-bar-chart) and area chart.\n *\n * __Default value:__ `zero` for plots with all of the following conditions are true:\n * (1) the mark is `bar`, `area`, or `arc`;\n * (2) the stacked measure channel (x or y) has a linear scale;\n * (3) At least one of non-position channels mapped to an unaggregated field that is different from x and y. Otherwise, `null` by default.\n *\n * __See also:__ [`stack`](https://vega.github.io/vega-lite/docs/stack.html) documentation.\n */\n stack?: StackOffset | null | boolean;\n}\n\nexport interface BandMixins {\n /**\n * Relative position on a band of a stacked, binned, time unit, or band scale. For example, the marks will be positioned at the beginning of the band if set to `0`, and at the middle of the band if set to `0.5`.\n *\n * @minimum 0\n * @maximum 1\n */\n bandPosition?: number;\n}\n\nexport type PositionFieldDef = PositionFieldDefBase & PositionMixins;\n\nexport type PositionDatumDef = PositionDatumDefBase & PositionMixins;\n\nexport type PositionDef = PositionFieldDef | PositionDatumDef | PositionValueDef;\n\nexport interface PositionMixins {\n /**\n * An object defining properties of axis's gridlines, ticks and labels.\n * If `null`, the axis for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [axis properties](https://vega.github.io/vega-lite/docs/axis.html) are applied.\n *\n * __See also:__ [`axis`](https://vega.github.io/vega-lite/docs/axis.html) documentation.\n */\n axis?: Axis | null;\n\n /**\n * An object defining the properties of the Impute Operation to be applied.\n * The field value of the other positional channel is taken as `key` of the `Impute` Operation.\n * The field of the `color` channel if specified is used as `groupby` of the `Impute` Operation.\n *\n * __See also:__ [`impute`](https://vega.github.io/vega-lite/docs/impute.html) documentation.\n */\n impute?: ImputeParams | null;\n}\n\nexport type PolarDef = PositionFieldDefBase | PositionDatumDefBase | PositionValueDef;\n\nexport function getBandPosition({\n fieldDef,\n fieldDef2,\n markDef: mark,\n config\n}: {\n fieldDef: FieldDef | DatumDef;\n fieldDef2?: SecondaryChannelDef;\n markDef: MarkDef;\n config: Config;\n}): number {\n if (isFieldOrDatumDef(fieldDef) && fieldDef.bandPosition !== undefined) {\n return fieldDef.bandPosition;\n }\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n if (timeUnit && !fieldDef2) {\n return getMarkConfig('timeUnitBandPosition', mark, config);\n } else if (isBinning(bin)) {\n return 0.5;\n }\n }\n\n return undefined;\n}\n\nexport function getBandSize({\n channel,\n fieldDef,\n fieldDef2,\n markDef: mark,\n config,\n scaleType,\n useVlSizeChannel\n}: {\n channel: PositionScaleChannel | PolarPositionScaleChannel;\n fieldDef: ChannelDef;\n fieldDef2?: SecondaryChannelDef;\n markDef: MarkDef;\n config: Config;\n scaleType: ScaleType;\n useVlSizeChannel?: boolean;\n}): number | RelativeBandSize | SignalRef {\n const sizeChannel = getSizeChannel(channel);\n const size = getMarkPropOrConfig(useVlSizeChannel ? 'size' : sizeChannel, mark, config, {\n vgChannel: sizeChannel\n });\n\n if (size !== undefined) {\n return size;\n }\n\n if (isFieldDef(fieldDef)) {\n const {timeUnit, bin} = fieldDef;\n\n if (timeUnit && !fieldDef2) {\n return {band: getMarkConfig('timeUnitBandSize', mark, config)};\n } else if (isBinning(bin) && !hasDiscreteDomain(scaleType)) {\n return {band: 1};\n }\n }\n\n if (isRectBasedMark(mark.type)) {\n if (scaleType) {\n if (hasDiscreteDomain(scaleType)) {\n return config[mark.type]?.discreteBandSize || {band: 1};\n } else {\n return config[mark.type]?.continuousBandSize;\n }\n }\n return config[mark.type]?.discreteBandSize;\n }\n\n return undefined;\n}\n\nexport function hasBandEnd(\n fieldDef: FieldDef,\n fieldDef2: SecondaryChannelDef,\n markDef: MarkDef,\n config: Config\n): boolean {\n if (isBinning(fieldDef.bin) || (fieldDef.timeUnit && isTypedFieldDef(fieldDef) && fieldDef.type === 'temporal')) {\n // Need to check bandPosition because non-rect marks (e.g., point) with timeUnit\n // doesn't have to use bandEnd if there is no bandPosition.\n return getBandPosition({fieldDef, fieldDef2, markDef, config}) !== undefined;\n }\n return false;\n}\n\n/**\n * Field definition of a mark property, which can contain a legend.\n */\nexport type MarkPropFieldDef = ScaleFieldDef &\n LegendMixins;\n\nexport type MarkPropDatumDef = LegendMixins & ScaleDatumDef;\n\nexport type MarkPropFieldOrDatumDef =\n | MarkPropFieldDef\n | MarkPropDatumDef;\n\nexport interface LegendMixins {\n /**\n * An object defining properties of the legend.\n * If `null`, the legend for the encoding channel will be removed.\n *\n * __Default value:__ If undefined, default [legend properties](https://vega.github.io/vega-lite/docs/legend.html) are applied.\n *\n * __See also:__ [`legend`](https://vega.github.io/vega-lite/docs/legend.html) documentation.\n */\n legend?: Legend | null;\n}\n\n// Detail\n\n// Order Path have no scale\n\nexport type OrderFieldDef = FieldDefWithoutScale & OrderOnlyDef;\n\nexport interface OrderOnlyDef {\n /**\n * The sort order. One of `\"ascending\"` (default) or `\"descending\"`.\n */\n sort?: SortOrder;\n}\n\nexport function isOrderOnlyDef(\n orderDef: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef\n): orderDef is OrderOnlyDef {\n return orderDef && !!(orderDef as OrderOnlyDef).sort && !orderDef['field'];\n}\n\nexport type OrderValueDef = ConditionValueDefMixins & NumericValueDef;\n\nexport interface StringFieldDef extends FieldDefWithoutScale, FormatMixins {}\n\nexport type FieldDef = SecondaryFieldDef | TypedFieldDef;\nexport type ChannelDef = Encoding[keyof Encoding];\n\nexport function isConditionalDef | GuideEncodingConditionalValueDef | ExprRef | SignalRef>(\n channelDef: CD\n): channelDef is CD & {condition: Conditional} {\n return channelDef && 'condition' in channelDef;\n}\n\n/**\n * Return if a channelDef is a ConditionalValueDef with ConditionFieldDef\n */\nexport function hasConditionalFieldDef(\n channelDef: Partial>\n): channelDef is {condition: Conditional>} {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldDef(condition);\n}\n\nexport function hasConditionalFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is {condition: Conditional>} {\n const condition = channelDef?.['condition'];\n return !!condition && !isArray(condition) && isFieldOrDatumDef(condition);\n}\n\nexport function hasConditionalValueDef(\n channelDef: ChannelDef\n): channelDef is ValueDef & {condition: Conditional> | Conditional>[]} {\n const condition = channelDef?.['condition'];\n return !!condition && (isArray(condition) || isValueDef(condition));\n}\n\nexport function isFieldDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is FieldDefBase | TypedFieldDef | SecondaryFieldDef {\n // TODO: we can't use field in channelDef here as it's somehow failing runtime test\n return channelDef && (!!channelDef['field'] || channelDef['aggregate'] === 'count');\n}\n\nexport function channelDefType(channelDef: ChannelDef): Type | undefined {\n return channelDef?.['type'];\n}\n\nexport function isDatumDef(\n channelDef: Partial> | FieldDefBase | DatumDef\n): channelDef is DatumDef {\n return channelDef && 'datum' in channelDef;\n}\n\nexport function isContinuousFieldOrDatumDef(\n cd: ChannelDef\n): cd is TypedFieldDef | DatumDef {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && !isDiscrete(cd)) || isNumericDataDef(cd);\n}\n\nexport function isUnbinnedQuantitativeFieldOrDatumDef(cd: ChannelDef) {\n // TODO: make datum support DateTime object\n return (isTypedFieldDef(cd) && cd.type === 'quantitative' && !cd.bin) || isNumericDataDef(cd);\n}\n\nexport function isNumericDataDef(cd: ChannelDef): cd is DatumDef {\n return isDatumDef(cd) && isNumber(cd.datum);\n}\n\nexport function isFieldOrDatumDef(\n channelDef: Partial>\n): channelDef is FieldDef | DatumDef {\n return isFieldDef(channelDef) || isDatumDef(channelDef);\n}\n\nexport function isTypedFieldDef(channelDef: ChannelDef): channelDef is TypedFieldDef {\n return channelDef && ('field' in channelDef || channelDef['aggregate'] === 'count') && 'type' in channelDef;\n}\n\nexport function isValueDef(channelDef: Partial>): channelDef is ValueDef {\n return channelDef && 'value' in channelDef && 'value' in channelDef;\n}\n\nexport function isScaleFieldDef(channelDef: ChannelDef): channelDef is ScaleFieldDef {\n return channelDef && ('scale' in channelDef || 'sort' in channelDef);\n}\n\nexport function isPositionFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is PositionFieldDef | PositionDatumDef {\n return channelDef && ('axis' in channelDef || 'stack' in channelDef || 'impute' in channelDef);\n}\n\nexport function isMarkPropFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is MarkPropFieldDef | MarkPropDatumDef {\n return channelDef && 'legend' in channelDef;\n}\n\nexport function isStringFieldOrDatumDef(\n channelDef: ChannelDef\n): channelDef is StringFieldDef | StringDatumDef {\n return channelDef && ('format' in channelDef || 'formatType' in channelDef);\n}\n\nexport function toStringFieldDef(fieldDef: FieldDef): StringFieldDef {\n // omit properties that don't exist in string field defs\n return omit(fieldDef, ['legend', 'axis', 'header', 'scale'] as any[]);\n}\n\nexport interface FieldRefOption {\n /** Exclude bin, aggregate, timeUnit */\n nofn?: boolean;\n /** Wrap the field with datum, parent, or datum.datum (e.g., datum['...'] for Vega Expression */\n expr?: 'datum' | 'parent' | 'datum.datum';\n /** Prepend fn with custom function prefix */\n prefix?: string;\n /** Append suffix to the field ref for bin (default='start') */\n binSuffix?: 'end' | 'range' | 'mid';\n /** Append suffix to the field ref (general) */\n suffix?: string;\n /**\n * Use the field name for `as` in a transform.\n * We will not escape nested accesses because Vega transform outputs cannot be nested.\n */\n forAs?: boolean;\n}\n\nfunction isOpFieldDef(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef\n): fieldDef is WindowFieldDef | AggregatedFieldDef {\n return 'op' in fieldDef;\n}\n\n/**\n * Get a Vega field reference from a Vega-Lite field def.\n */\nexport function vgField(\n fieldDef: FieldDefBase | WindowFieldDef | AggregatedFieldDef,\n opt: FieldRefOption = {}\n): string {\n let field = fieldDef.field;\n const prefix = opt.prefix;\n let suffix = opt.suffix;\n\n let argAccessor = ''; // for accessing argmin/argmax field at the end without getting escaped\n\n if (isCount(fieldDef)) {\n field = internalField('count');\n } else {\n let fn: string;\n\n if (!opt.nofn) {\n if (isOpFieldDef(fieldDef)) {\n fn = fieldDef.op;\n } else {\n const {bin, aggregate, timeUnit} = fieldDef;\n if (isBinning(bin)) {\n fn = binToString(bin);\n suffix = (opt.binSuffix ?? '') + (opt.suffix ?? '');\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmax_${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n argAccessor = `[\"${field}\"]`;\n field = `argmin_${aggregate.argmin}`;\n } else {\n fn = String(aggregate);\n }\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n fn = timeUnitToString(timeUnit);\n suffix = ((!['range', 'mid'].includes(opt.binSuffix) && opt.binSuffix) || '') + (opt.suffix ?? '');\n }\n }\n }\n\n if (fn) {\n field = field ? `${fn}_${field}` : fn;\n }\n }\n\n if (suffix) {\n field = `${field}_${suffix}`;\n }\n\n if (prefix) {\n field = `${prefix}_${field}`;\n }\n\n if (opt.forAs) {\n return removePathFromField(field);\n } else if (opt.expr) {\n // Expression to access flattened field. No need to escape dots.\n return flatAccessWithDatum(field, opt.expr) + argAccessor;\n } else {\n // We flattened all fields so paths should have become dot.\n return replacePathInField(field) + argAccessor;\n }\n}\n\nexport function isDiscrete(def: TypedFieldDef | DatumDef) {\n switch (def.type) {\n case 'nominal':\n case 'ordinal':\n case 'geojson':\n return true;\n case 'quantitative':\n return isFieldDef(def) && !!def.bin;\n case 'temporal':\n return false;\n }\n throw new Error(log.message.invalidFieldType(def.type));\n}\n\nexport function isDiscretizing(def: TypedFieldDef | DatumDef) {\n return isScaleFieldDef(def) && isContinuousToDiscrete(def.scale?.type);\n}\n\nexport function isCount(fieldDef: FieldDefBase) {\n return fieldDef.aggregate === 'count';\n}\n\nexport type FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => string;\n\nexport function verbalTitleFormatter(fieldDef: FieldDefBase, config: Config) {\n const {field, bin, timeUnit, aggregate} = fieldDef;\n if (aggregate === 'count') {\n return config.countTitle;\n } else if (isBinning(bin)) {\n return `${field} (binned)`;\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n const unit = normalizeTimeUnit(timeUnit)?.unit;\n if (unit) {\n return `${field} (${getTimeUnitParts(unit).join('-')})`;\n }\n } else if (aggregate) {\n if (isArgmaxDef(aggregate)) {\n return `${field} for max ${aggregate.argmax}`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for min ${aggregate.argmin}`;\n } else {\n return `${titleCase(aggregate)} of ${field}`;\n }\n }\n return field;\n}\n\nexport function functionalTitleFormatter(fieldDef: FieldDefBase) {\n const {aggregate, bin, timeUnit, field} = fieldDef;\n if (isArgmaxDef(aggregate)) {\n return `${field} for argmax(${aggregate.argmax})`;\n } else if (isArgminDef(aggregate)) {\n return `${field} for argmin(${aggregate.argmin})`;\n }\n\n const timeUnitParams = timeUnit && !isBinnedTimeUnit(timeUnit) ? normalizeTimeUnit(timeUnit) : undefined;\n\n const fn = aggregate || timeUnitParams?.unit || (timeUnitParams?.maxbins && 'timeunit') || (isBinning(bin) && 'bin');\n if (fn) {\n return `${fn.toUpperCase()}(${field})`;\n } else {\n return field;\n }\n}\n\nexport const defaultTitleFormatter: FieldTitleFormatter = (fieldDef: FieldDefBase, config: Config) => {\n switch (config.fieldTitle) {\n case 'plain':\n return fieldDef.field;\n case 'functional':\n return functionalTitleFormatter(fieldDef);\n default:\n return verbalTitleFormatter(fieldDef, config);\n }\n};\n\nlet titleFormatter = defaultTitleFormatter;\n\nexport function setTitleFormatter(formatter: FieldTitleFormatter) {\n titleFormatter = formatter;\n}\n\nexport function resetTitleFormatter() {\n setTitleFormatter(defaultTitleFormatter);\n}\n\nexport function title(\n fieldOrDatumDef: TypedFieldDef | SecondaryFieldDef | DatumDef,\n config: Config,\n {allowDisabling, includeDefault = true}: {allowDisabling: boolean; includeDefault?: boolean}\n) {\n const guideTitle = getGuide(fieldOrDatumDef)?.title;\n\n if (!isFieldDef(fieldOrDatumDef)) {\n return guideTitle ?? fieldOrDatumDef.title;\n }\n const fieldDef = fieldOrDatumDef;\n\n const def = includeDefault ? defaultTitle(fieldDef, config) : undefined;\n\n if (allowDisabling) {\n return getFirstDefined(guideTitle, fieldDef.title, def);\n } else {\n return guideTitle ?? fieldDef.title ?? def;\n }\n}\n\nexport function getGuide(fieldDef: TypedFieldDef | SecondaryFieldDef | DatumDef): Guide {\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis) {\n return fieldDef.axis;\n } else if (isMarkPropFieldOrDatumDef(fieldDef) && fieldDef.legend) {\n return fieldDef.legend;\n } else if (isFacetFieldDef(fieldDef) && fieldDef.header) {\n return fieldDef.header;\n }\n return undefined;\n}\n\nexport function defaultTitle(fieldDef: FieldDefBase, config: Config) {\n return titleFormatter(fieldDef, config);\n}\n\nexport function getFormatMixins(fieldDef: TypedFieldDef | DatumDef) {\n if (isStringFieldOrDatumDef(fieldDef)) {\n const {format, formatType} = fieldDef;\n return {format, formatType};\n } else {\n const guide = getGuide(fieldDef) ?? {};\n const {format, formatType} = guide;\n return {format, formatType};\n }\n}\n\nexport function defaultType>(fieldDef: T, channel: ExtendedChannel): Type {\n switch (channel) {\n case 'latitude':\n case 'longitude':\n return 'quantitative';\n\n case 'row':\n case 'column':\n case 'facet':\n case 'shape':\n case 'strokeDash':\n return 'nominal';\n\n case 'order':\n return 'ordinal';\n }\n\n if (isSortableFieldDef(fieldDef) && isArray(fieldDef.sort)) {\n return 'ordinal';\n }\n\n const {aggregate, bin, timeUnit} = fieldDef;\n if (timeUnit) {\n return 'temporal';\n }\n\n if (bin || (aggregate && !isArgmaxDef(aggregate) && !isArgminDef(aggregate))) {\n return 'quantitative';\n }\n\n if (isScaleFieldDef(fieldDef) && fieldDef.scale?.type) {\n switch (SCALE_CATEGORY_INDEX[fieldDef.scale.type]) {\n case 'numeric':\n case 'discretizing':\n return 'quantitative';\n case 'time':\n return 'temporal';\n }\n }\n\n return 'nominal';\n}\n\n/**\n * Returns the fieldDef -- either from the outer channelDef or from the condition of channelDef.\n * @param channelDef\n */\n\nexport function getFieldDef(channelDef: ChannelDef): FieldDef {\n if (isFieldDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\nexport function getFieldOrDatumDef = ChannelDef>(\n channelDef: CD\n): FieldDef | DatumDef {\n if (isFieldOrDatumDef(channelDef)) {\n return channelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return channelDef.condition;\n }\n return undefined;\n}\n\n/**\n * Convert type to full, lowercase type, or augment the fieldDef with a default type if missing.\n */\nexport function initChannelDef(\n channelDef: ChannelDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean} = {}\n): ChannelDef {\n if (isString(channelDef) || isNumber(channelDef) || isBoolean(channelDef)) {\n const primitiveType = isString(channelDef) ? 'string' : isNumber(channelDef) ? 'number' : 'boolean';\n log.warn(log.message.primitiveChannelDef(channel, primitiveType, channelDef));\n return {value: channelDef} as ValueDef;\n }\n\n // If a fieldDef contains a field, we need type.\n if (isFieldOrDatumDef(channelDef)) {\n return initFieldOrDatumDef(channelDef, channel, config, opt);\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n return {\n ...channelDef,\n // Need to cast as normalizeFieldDef normally return FieldDef, but here we know that it is definitely Condition\n condition: initFieldOrDatumDef(channelDef.condition, channel, config, opt) as Conditional>\n };\n }\n return channelDef;\n}\n\nexport function initFieldOrDatumDef(\n fd: FieldDef | DatumDef,\n channel: ExtendedChannel,\n config: Config,\n opt: {compositeMark?: boolean}\n): FieldDef | DatumDef {\n if (isStringFieldOrDatumDef(fd)) {\n const {format, formatType, ...rest} = fd;\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef(rest, channel, config, opt);\n }\n } else {\n const guideType = isPositionFieldOrDatumDef(fd)\n ? 'axis'\n : isMarkPropFieldOrDatumDef(fd)\n ? 'legend'\n : isFacetFieldDef(fd)\n ? 'header'\n : null;\n if (guideType && fd[guideType]) {\n const {format, formatType, ...newGuide} = fd[guideType];\n if (isCustomFormatType(formatType) && !config.customFormatTypes) {\n log.warn(log.message.customFormatTypeNotAllowed(channel));\n return initFieldOrDatumDef({...fd, [guideType]: newGuide}, channel, config, opt);\n }\n }\n }\n\n if (isFieldDef(fd)) {\n return initFieldDef(fd, channel, opt);\n }\n return initDatumDef(fd);\n}\n\nfunction initDatumDef(datumDef: DatumDef): DatumDef {\n let type = datumDef['type'];\n if (type) {\n return datumDef;\n }\n const {datum} = datumDef;\n type = isNumber(datum) ? 'quantitative' : isString(datum) ? 'nominal' : isDateTime(datum) ? 'temporal' : undefined;\n\n return {...datumDef, type};\n}\n\nexport function initFieldDef(\n fd: FieldDef,\n channel: ExtendedChannel,\n {compositeMark = false}: {compositeMark?: boolean} = {}\n) {\n const {aggregate, timeUnit, bin, field} = fd;\n const fieldDef = {...fd};\n\n // Drop invalid aggregate\n if (!compositeMark && aggregate && !isAggregateOp(aggregate) && !isArgmaxDef(aggregate) && !isArgminDef(aggregate)) {\n log.warn(log.message.invalidAggregate(aggregate));\n delete fieldDef.aggregate;\n }\n\n // Normalize Time Unit\n if (timeUnit) {\n fieldDef.timeUnit = normalizeTimeUnit(timeUnit);\n }\n\n if (field) {\n fieldDef.field = `${field}`;\n }\n\n // Normalize bin\n if (isBinning(bin)) {\n fieldDef.bin = normalizeBin(bin, channel);\n }\n\n if (isBinned(bin) && !isXorY(channel)) {\n log.warn(log.message.channelShouldNotBeUsedForBinned(channel));\n }\n\n // Normalize Type\n if (isTypedFieldDef(fieldDef)) {\n const {type} = fieldDef;\n const fullType = getFullName(type);\n if (type !== fullType) {\n // convert short type to full type\n fieldDef.type = fullType;\n }\n if (type !== 'quantitative') {\n if (isCountingAggregateOp(aggregate)) {\n log.warn(log.message.invalidFieldTypeForCountAggregate(type, aggregate));\n fieldDef.type = 'quantitative';\n }\n }\n } else if (!isSecondaryRangeChannel(channel)) {\n // If type is empty / invalid, then augment with default type\n const newType = defaultType(fieldDef as TypedFieldDef, channel);\n fieldDef['type'] = newType;\n }\n\n if (isTypedFieldDef(fieldDef)) {\n const {compatible, warning} = channelCompatibility(fieldDef, channel) || {};\n if (compatible === false) {\n log.warn(warning);\n }\n }\n\n if (isSortableFieldDef(fieldDef) && isString(fieldDef.sort)) {\n const {sort} = fieldDef;\n if (isSortByChannel(sort)) {\n return {\n ...fieldDef,\n sort: {encoding: sort}\n };\n }\n const sub = sort.substr(1);\n if (sort.charAt(0) === '-' && isSortByChannel(sub)) {\n return {\n ...fieldDef,\n sort: {encoding: sub, order: 'descending'}\n };\n }\n }\n\n if (isFacetFieldDef(fieldDef)) {\n const {header} = fieldDef;\n if (header) {\n const {orient, ...rest} = header;\n if (orient) {\n return {\n ...fieldDef,\n header: {\n ...rest,\n labelOrient: header.labelOrient || orient,\n titleOrient: header.titleOrient || orient\n }\n };\n }\n }\n }\n\n return fieldDef;\n}\n\nexport function normalizeBin(bin: BinParams | boolean | 'binned', channel?: ExtendedChannel) {\n if (isBoolean(bin)) {\n return {maxbins: autoMaxBins(channel)};\n } else if (bin === 'binned') {\n return {\n binned: true\n };\n } else if (!bin.maxbins && !bin.step) {\n return {...bin, maxbins: autoMaxBins(channel)};\n } else {\n return bin;\n }\n}\n\nconst COMPATIBLE = {compatible: true};\nexport function channelCompatibility(\n fieldDef: TypedFieldDef,\n channel: ExtendedChannel\n): {compatible: boolean; warning?: string} {\n const type = fieldDef.type;\n\n if (type === 'geojson' && channel !== 'shape') {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with a geojson data.`\n };\n }\n\n switch (channel) {\n case ROW:\n case COLUMN:\n case FACET:\n if (!isDiscrete(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscrete(channel)\n };\n }\n return COMPATIBLE;\n\n case X:\n case Y:\n case XOFFSET:\n case YOFFSET:\n case COLOR:\n case FILL:\n case STROKE:\n case TEXT:\n case DETAIL:\n case KEY:\n case TOOLTIP:\n case HREF:\n case URL:\n case ANGLE:\n case THETA:\n case RADIUS:\n case DESCRIPTION:\n return COMPATIBLE;\n\n case LONGITUDE:\n case LONGITUDE2:\n case LATITUDE:\n case LATITUDE2:\n if (type !== QUANTITATIVE) {\n return {\n compatible: false,\n warning: `Channel ${channel} should be used with a quantitative field only, not ${fieldDef.type} field.`\n };\n }\n return COMPATIBLE;\n\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEWIDTH:\n case SIZE:\n case THETA2:\n case RADIUS2:\n case X2:\n case Y2:\n if (type === 'nominal' && !fieldDef['sort']) {\n return {\n compatible: false,\n warning: `Channel ${channel} should not be used with an unsorted discrete field.`\n };\n }\n return COMPATIBLE;\n\n case SHAPE:\n case STROKEDASH:\n if (!isDiscrete(fieldDef) && !isDiscretizing(fieldDef)) {\n return {\n compatible: false,\n warning: log.message.channelShouldBeDiscreteOrDiscretizing(channel)\n };\n }\n return COMPATIBLE;\n\n case ORDER:\n if (fieldDef.type === 'nominal' && !('sort' in fieldDef)) {\n return {\n compatible: false,\n warning: `Channel order is inappropriate for nominal field, which has no inherent order.`\n };\n }\n return COMPATIBLE;\n }\n}\n\n/**\n * Check if the field def uses a time format or does not use any format but is temporal\n * (this does not cover field defs that are temporal but use a number format).\n */\nexport function isFieldOrDatumDefForTimeFormat(fieldOrDatumDef: FieldDef | DatumDef): boolean {\n const {formatType} = getFormatMixins(fieldOrDatumDef);\n return formatType === 'time' || (!formatType && isTimeFieldDef(fieldOrDatumDef));\n}\n\n/**\n * Check if field def has type `temporal`. If you want to also cover field defs that use a time format, use `isTimeFormatFieldDef`.\n */\nexport function isTimeFieldDef(def: FieldDef | DatumDef): boolean {\n return def && (def['type'] === 'temporal' || (isFieldDef(def) && !!def.timeUnit));\n}\n\n/**\n * Getting a value associated with a fielddef.\n * Convert the value to Vega expression if applicable (for datetime object, or string if the field def is temporal or has timeUnit)\n */\nexport function valueExpr(\n v: number | string | boolean | DateTime | ExprRef | SignalRef | number[],\n {\n timeUnit,\n type,\n wrapTime,\n undefinedIfExprNotRequired\n }: {\n timeUnit: TimeUnit | TimeUnitParams;\n type?: Type;\n wrapTime?: boolean;\n undefinedIfExprNotRequired?: boolean;\n }\n): string {\n const unit = timeUnit && normalizeTimeUnit(timeUnit)?.unit;\n let isTime = unit || type === 'temporal';\n\n let expr;\n if (isExprRef(v)) {\n expr = v.expr;\n } else if (isSignalRef(v)) {\n expr = v.signal;\n } else if (isDateTime(v)) {\n isTime = true;\n expr = dateTimeToExpr(v);\n } else if (isString(v) || isNumber(v)) {\n if (isTime) {\n expr = `datetime(${stringify(v)})`;\n\n if (isLocalSingleTimeUnit(unit)) {\n // for single timeUnit, we will use dateTimeToExpr to convert number/string to match the timeUnit\n if ((isNumber(v) && v < 10000) || (isString(v) && isNaN(Date.parse(v)))) {\n expr = dateTimeToExpr({[unit]: v});\n }\n }\n }\n }\n if (expr) {\n return wrapTime && isTime ? `time(${expr})` : expr;\n }\n // number or boolean or normal string\n return undefinedIfExprNotRequired ? undefined : stringify(v);\n}\n\n/**\n * Standardize value array -- convert each value to Vega expression if applicable\n */\nexport function valueArray(\n fieldOrDatumDef: TypedFieldDef | DatumDef,\n values: (number | string | boolean | DateTime)[]\n) {\n const {type} = fieldOrDatumDef;\n return values.map(v => {\n const timeUnit =\n isFieldDef(fieldOrDatumDef) && !isBinnedTimeUnit(fieldOrDatumDef.timeUnit) ? fieldOrDatumDef.timeUnit : undefined;\n const expr = valueExpr(v, {\n timeUnit,\n type,\n undefinedIfExprNotRequired: true\n });\n // return signal for the expression if we need an expression\n if (expr !== undefined) {\n return {signal: expr};\n }\n // otherwise just return the original value\n return v;\n });\n}\n\n/**\n * Checks whether a fieldDef for a particular channel requires a computed bin range.\n */\nexport function binRequiresRange(fieldDef: FieldDef, channel: Channel): boolean {\n if (!isBinning(fieldDef.bin)) {\n console.warn('Only call this method for binned field defs.');\n return false;\n }\n\n // We need the range only when the user explicitly forces a binned field to be use discrete scale. In this case, bin range is used in axis and legend labels.\n // We could check whether the axis or legend exists (not disabled) but that seems overkill.\n return isScaleChannel(channel) && ['ordinal', 'nominal'].includes((fieldDef as ScaleFieldDef).type);\n}\n","import {\n Align,\n Axis as VgAxis,\n AxisEncode,\n AxisOrient,\n BaseAxis,\n Color,\n FontStyle,\n FontWeight,\n LabelOverlap,\n SignalRef,\n TextBaseline,\n TimeInterval,\n TimeIntervalStep\n} from 'vega';\nimport {ConditionalPredicate, Value, ValueDef} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {Guide, GuideEncodingEntry, TitleMixins, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith, VgEncodeChannel} from './vega.schema';\n\nexport type BaseAxisNoValueRefs = AxisOverrideMixins &\n VLOnlyAxisMixins &\n Omit, 'labelOverlap'>;\n\ninterface AxisOverrideMixins {\n // Position and tickMinStep are not config in Vega, but are in Vega-Lite. So we just copy them here.\n\n /**\n * The anchor position of the axis in pixels. For x-axes with top or bottom orientation, this sets the axis group x coordinate. For y-axes with left or right orientation, this sets the axis group y coordinate.\n *\n * __Default value__: `0`\n */\n position?: number | ES;\n\n /**\n * The minimum desired step between axis ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n */\n tickMinStep?: number | ES;\n\n // ---------- Properties that do not support signal / expression ----------\n /**\n * A boolean flag indicating if the domain (the axis baseline) should be included as part of the axis.\n *\n * __Default value:__ `true`\n */\n domain?: boolean;\n\n /**\n * A boolean flag indicating if grid lines should be included as part of the axis\n *\n * __Default value:__ `true` for [continuous scales](https://vega.github.io/vega-lite/docs/scale.html#continuous) that are not binned; otherwise, `false`.\n */\n grid?: boolean;\n\n /**\n * A boolean flag indicating if labels should be included as part of the axis.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Boolean flag indicating if an extra axis tick should be added for the initial position of the axis. This flag is useful for styling axes for `band` scales such that ticks are placed on band boundaries rather in the middle of a band. Use in conjunction with `\"bandPosition\": 1` and an axis `\"padding\"` value of `0`.\n */\n tickExtra?: boolean;\n\n /**\n * Boolean flag indicating if pixel position values should be rounded to the nearest integer.\n *\n * __Default value:__ `true`\n */\n tickRound?: boolean;\n\n /**\n * Boolean value that determines whether the axis should include ticks.\n *\n * __Default value:__ `true`\n */\n ticks?: boolean;\n\n // Override comments to be Vega-Lite specific\n\n /**\n * Indicates if the first and last axis labels should be aligned flush with the scale range. Flush alignment for a horizontal axis will left-align the first label and right-align the last label. For vertical axes, bottom and top text baselines are applied instead. If this property is a number, it also indicates the number of pixels by which to offset the first and last labels; for example, a value of 2 will flush-align the first and last labels and also push them 2 pixels outward from the center of the axis. The additional adjustment can sometimes help the labels better visually group with corresponding axis ticks.\n *\n * __Default value:__ `true` for axis of a continuous x-scale. Otherwise, `false`.\n */\n labelFlush?: boolean | number;\n\n /**\n * The strategy to use for resolving overlap of axis labels. If `false` (the default), no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used (this works well for standard linear axes). If set to `\"greedy\"`, a linear scan of the labels is performed, removing any labels that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `true` for non-nominal fields with non-log scales; `\"greedy\"` for log scales; otherwise `false`.\n */\n labelOverlap?: LabelOverlap | ES;\n\n /**\n * The offset, in pixels, by which to displace the axis from the edge of the enclosing group or data rectangle.\n *\n * __Default value:__ derived from the [axis config](https://vega.github.io/vega-lite/docs/config.html#facet-scale-config)'s `offset` (`0` by default)\n */\n offset?: number | ES;\n\n /**\n * The orientation of the axis. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`. The orientation can be used to further specialize the axis type (e.g., a y-axis oriented towards the right edge of the chart).\n *\n * __Default value:__ `\"bottom\"` for x-axes and `\"left\"` for y-axes.\n */\n orient?: AxisOrient | ES;\n\n /**\n * A desired number of ticks, for axes visualizing quantitative scales. The resulting number may be different so that values are \"nice\" (multiples of 2, 5, 10) and lie within the underlying scale's range.\n *\n * For scales of type `\"time\"` or `\"utc\"`, the tick count can instead be a time interval specifier. Legal string values are `\"millisecond\"`, `\"second\"`, `\"minute\"`, `\"hour\"`, `\"day\"`, `\"week\"`, `\"month\"`, and `\"year\"`. Alternatively, an object-valued interval specifier of the form `{\"interval\": \"month\", \"step\": 3}` includes a desired number of interval steps. Here, ticks are generated for each quarter (Jan, Apr, Jul, Oct) boundary.\n *\n * __Default value__: Determine using a formula `ceil(width/40)` for x and `ceil(height/40)` for y.\n *\n * @minimum 0\n */\n tickCount?: number | TimeInterval | TimeIntervalStep | ES;\n\n /**\n * Explicitly set the visible axis tick values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | ES; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * A non-negative integer indicating the z-index of the axis.\n * If zindex is 0, axes should be drawn behind all chart elements.\n * To put them in front, set `zindex` to `1` or more.\n *\n * __Default value:__ `0` (behind the marks).\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\ninterface VLOnlyAxisMixins {\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the axis's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * A string or array of strings indicating the name of custom styles to apply to the axis. A style is a named collection of axis property defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ (none)\n * __Note:__ Any specified style will augment the default style. For example, an x-axis mark with `\"style\": \"foo\"` will use `config.axisX` and `config.style.foo` (the specified style `\"foo\"` has higher precedence).\n */\n style?: string | string[];\n}\n\nexport type ConditionalAxisProp =\n | 'labelAlign'\n | 'labelBaseline'\n | 'labelColor'\n | 'labelFont'\n | 'labelFontSize'\n | 'labelFontStyle'\n | 'labelFontWeight'\n | 'labelOpacity'\n | 'labelOffset'\n | 'labelPadding'\n | 'gridColor'\n | 'gridDash'\n | 'gridDashOffset'\n | 'gridOpacity'\n | 'gridWidth'\n | 'tickColor'\n | 'tickDash'\n | 'tickDashOffset'\n | 'tickOpacity'\n | 'tickSize'\n | 'tickWidth';\n\nexport const CONDITIONAL_AXIS_PROP_INDEX: Record<\n ConditionalAxisProp,\n {\n part: keyof AxisEncode;\n vgProp: VgEncodeChannel;\n } | null // null if we need to convert condition to signal\n> = {\n labelAlign: {\n part: 'labels',\n vgProp: 'align'\n },\n labelBaseline: {\n part: 'labels',\n vgProp: 'baseline'\n },\n labelColor: {\n part: 'labels',\n vgProp: 'fill'\n },\n labelFont: {\n part: 'labels',\n vgProp: 'font'\n },\n labelFontSize: {\n part: 'labels',\n vgProp: 'fontSize'\n },\n labelFontStyle: {\n part: 'labels',\n vgProp: 'fontStyle'\n },\n labelFontWeight: {\n part: 'labels',\n vgProp: 'fontWeight'\n },\n labelOpacity: {\n part: 'labels',\n vgProp: 'opacity'\n },\n labelOffset: null,\n labelPadding: null, // There is no fixed vgProp for tickSize, need to use signal.\n gridColor: {\n part: 'grid',\n vgProp: 'stroke'\n },\n gridDash: {\n part: 'grid',\n vgProp: 'strokeDash'\n },\n gridDashOffset: {\n part: 'grid',\n vgProp: 'strokeDashOffset'\n },\n gridOpacity: {\n part: 'grid',\n vgProp: 'opacity'\n },\n gridWidth: {\n part: 'grid',\n vgProp: 'strokeWidth'\n },\n tickColor: {\n part: 'ticks',\n vgProp: 'stroke'\n },\n tickDash: {\n part: 'ticks',\n vgProp: 'strokeDash'\n },\n tickDashOffset: {\n part: 'ticks',\n vgProp: 'strokeDashOffset'\n },\n tickOpacity: {\n part: 'ticks',\n vgProp: 'opacity'\n },\n tickSize: null, // There is no fixed vgProp for tickSize, need to use signal.\n tickWidth: {\n part: 'ticks',\n vgProp: 'strokeWidth'\n }\n};\n\nexport type ConditionalAxisProperty = (ValueDef | ES) & {\n condition: ConditionalPredicate | ES> | ConditionalPredicate | ES>[];\n};\n\nexport function isConditionalAxisValue(\n v: any\n): v is ConditionalAxisProperty {\n return v?.condition;\n}\n\nexport type ConditionalAxisNumber = ConditionalAxisProperty<\n number | null,\n ES\n>;\nexport type ConditionalAxisLabelAlign = ConditionalAxisProperty<\n Align | null,\n ES\n>;\nexport type ConditionalAxisLabelBaseline =\n ConditionalAxisProperty;\nexport type ConditionalAxisColor = ConditionalAxisProperty<\n Color | null,\n ES\n>;\nexport type ConditionalAxisString = ConditionalAxisProperty<\n string | null,\n ES\n>;\n\nexport type ConditionalAxisLabelFontStyle =\n ConditionalAxisProperty;\nexport type ConditionalAxisLabelFontWeight =\n ConditionalAxisProperty;\n\nexport type ConditionalAxisNumberArray = ConditionalAxisProperty<\n number[] | null,\n ES\n>;\n\n// Vega axis config is the same as Vega axis base. If this is not the case, add specific type.\nexport type AxisConfigBaseWithConditionalAndSignal = Omit<\n BaseAxisNoValueRefs,\n ConditionalAxisProp | 'title'\n> &\n AxisPropsWithCondition;\n\nexport interface AxisPropsWithCondition {\n labelAlign?: BaseAxisNoValueRefs['labelAlign'] | ConditionalAxisLabelAlign;\n labelBaseline?: BaseAxisNoValueRefs['labelBaseline'] | ConditionalAxisLabelBaseline;\n labelColor?: BaseAxisNoValueRefs['labelColor'] | ConditionalAxisColor;\n labelFont?: BaseAxisNoValueRefs['labelFont'] | ConditionalAxisString;\n labelFontSize?: BaseAxisNoValueRefs['labelFontSize'] | ConditionalAxisNumber;\n labelFontStyle?: BaseAxisNoValueRefs['labelFontStyle'] | ConditionalAxisLabelFontStyle;\n labelFontWeight?: BaseAxisNoValueRefs['labelFontWeight'] | ConditionalAxisLabelFontWeight;\n labelLineHeight?: BaseAxisNoValueRefs['labelLineHeight'] | ConditionalAxisNumber;\n labelOpacity?: BaseAxisNoValueRefs['labelOpacity'] | ConditionalAxisNumber;\n labelOffset?: BaseAxisNoValueRefs['labelOffset'] | ConditionalAxisNumber;\n labelPadding?: BaseAxisNoValueRefs['labelPadding'] | ConditionalAxisNumber;\n gridColor?: BaseAxisNoValueRefs['gridColor'] | ConditionalAxisColor;\n gridDash?: BaseAxisNoValueRefs['gridDash'] | ConditionalAxisNumberArray;\n gridDashOffset?: BaseAxisNoValueRefs['gridDashOffset'] | ConditionalAxisNumber;\n gridOpacity?: BaseAxisNoValueRefs['gridOpacity'] | ConditionalAxisNumber;\n gridWidth?: BaseAxisNoValueRefs['gridWidth'] | ConditionalAxisNumber;\n tickColor?: BaseAxisNoValueRefs['tickColor'] | ConditionalAxisColor;\n tickDash?: BaseAxisNoValueRefs['tickDash'] | ConditionalAxisNumberArray;\n tickDashOffset?: BaseAxisNoValueRefs['tickDashOffset'] | ConditionalAxisNumber;\n tickOpacity?: BaseAxisNoValueRefs['tickOpacity'] | ConditionalAxisNumber;\n tickSize?: BaseAxisNoValueRefs['tickSize'] | ConditionalAxisNumber;\n tickWidth?: BaseAxisNoValueRefs['tickWidth'] | ConditionalAxisNumber;\n title?: TitleMixins['title'];\n}\n\nexport type AxisConfig = Guide &\n VlOnlyGuideConfig &\n AxisConfigBaseWithConditionalAndSignal & {\n /**\n * Disable axis by default.\n */\n disable?: boolean;\n };\n\nexport interface Axis\n extends AxisConfigBaseWithConditionalAndSignal,\n Guide {\n /**\n * Mark definitions for custom axis encoding.\n *\n * @hidden\n */\n encoding?: AxisEncoding;\n}\n\nexport type AxisInternal = Axis;\n\nexport type AxisPart = keyof AxisEncoding;\nexport const AXIS_PARTS: AxisPart[] = ['domain', 'grid', 'labels', 'ticks', 'title'];\n\n/**\n * A dictionary listing whether a certain axis property is applicable for only main axes or only grid axes.\n */\nexport const AXIS_PROPERTY_TYPE: Record = {\n grid: 'grid',\n gridCap: 'grid',\n gridColor: 'grid',\n gridDash: 'grid',\n gridDashOffset: 'grid',\n gridOpacity: 'grid',\n gridScale: 'grid',\n gridWidth: 'grid',\n\n orient: 'main',\n\n bandPosition: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n\n aria: 'main',\n description: 'main',\n domain: 'main',\n domainCap: 'main',\n domainColor: 'main',\n domainDash: 'main',\n domainDashOffset: 'main',\n domainOpacity: 'main',\n domainWidth: 'main',\n format: 'main',\n formatType: 'main',\n labelAlign: 'main',\n labelAngle: 'main',\n labelBaseline: 'main',\n labelBound: 'main',\n labelColor: 'main',\n labelFlush: 'main',\n labelFlushOffset: 'main',\n labelFont: 'main',\n labelFontSize: 'main',\n labelFontStyle: 'main',\n labelFontWeight: 'main',\n labelLimit: 'main',\n labelLineHeight: 'main',\n labelOffset: 'main',\n labelOpacity: 'main',\n labelOverlap: 'main',\n labelPadding: 'main',\n labels: 'main',\n labelSeparation: 'main',\n maxExtent: 'main',\n minExtent: 'main',\n offset: 'both',\n position: 'main',\n tickCap: 'main',\n tickColor: 'main',\n tickDash: 'main',\n tickDashOffset: 'main',\n tickMinStep: 'both',\n tickOffset: 'both', // Need to be applied to grid axis too, so the grid will align with ticks.\n tickOpacity: 'main',\n tickRound: 'both', // Apply rounding to grid and ticks so they are aligned.\n ticks: 'main',\n tickSize: 'main',\n tickWidth: 'both',\n title: 'main',\n titleAlign: 'main',\n titleAnchor: 'main',\n titleAngle: 'main',\n titleBaseline: 'main',\n titleColor: 'main',\n titleFont: 'main',\n titleFontSize: 'main',\n titleFontStyle: 'main',\n titleFontWeight: 'main',\n titleLimit: 'main',\n titleLineHeight: 'main',\n titleOpacity: 'main',\n titlePadding: 'main',\n titleX: 'main',\n titleY: 'main',\n\n encode: 'both', // we hide this in Vega-Lite\n scale: 'both',\n tickBand: 'both',\n tickCount: 'both',\n tickExtra: 'both',\n translate: 'both',\n values: 'both',\n zindex: 'both' // this is actually set afterward, so it doesn't matter\n};\n\nexport interface AxisEncoding {\n /**\n * Custom encoding for the axis container.\n */\n axis?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis domain rule mark.\n */\n domain?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis gridline rule marks.\n */\n grid?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for axis tick rule marks.\n */\n ticks?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the axis title text mark.\n */\n title?: GuideEncodingEntry;\n}\n\nexport const COMMON_AXIS_PROPERTIES_INDEX: Flag)> = {\n orient: 1, // other things can depend on orient\n\n aria: 1,\n bandPosition: 1,\n description: 1,\n domain: 1,\n domainCap: 1,\n domainColor: 1,\n domainDash: 1,\n domainDashOffset: 1,\n domainOpacity: 1,\n domainWidth: 1,\n format: 1,\n formatType: 1,\n grid: 1,\n gridCap: 1,\n gridColor: 1,\n gridDash: 1,\n gridDashOffset: 1,\n gridOpacity: 1,\n gridWidth: 1,\n labelAlign: 1,\n labelAngle: 1,\n labelBaseline: 1,\n labelBound: 1,\n labelColor: 1,\n labelFlush: 1,\n labelFlushOffset: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelLineHeight: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labels: 1,\n labelSeparation: 1,\n maxExtent: 1,\n minExtent: 1,\n offset: 1,\n position: 1,\n tickBand: 1,\n tickCap: 1,\n tickColor: 1,\n tickCount: 1,\n tickDash: 1,\n tickDashOffset: 1,\n tickExtra: 1,\n tickMinStep: 1,\n tickOffset: 1,\n tickOpacity: 1,\n tickRound: 1,\n ticks: 1,\n tickSize: 1,\n tickWidth: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleAngle: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titlePadding: 1,\n titleX: 1,\n titleY: 1,\n translate: 1,\n values: 1,\n zindex: 1\n};\n\nconst AXIS_PROPERTIES_INDEX: Flag> = {\n ...COMMON_AXIS_PROPERTIES_INDEX,\n style: 1,\n labelExpr: 1,\n encoding: 1\n};\n\nexport function isAxisProperty(prop: string): prop is keyof Axis {\n return !!AXIS_PROPERTIES_INDEX[prop];\n}\n\n// Export for dependent projects\nexport const AXIS_PROPERTIES = keys(AXIS_PROPERTIES_INDEX);\n\nexport interface AxisConfigMixins {\n /**\n * Axis configuration, which determines default properties for all `x` and `y` [axes](https://vega.github.io/vega-lite/docs/axis.html). For a full list of axis configuration options, please see the [corresponding section of the axis documentation](https://vega.github.io/vega-lite/docs/axis.html#config).\n */\n axis?: AxisConfig;\n\n /**\n * X-axis specific config.\n */\n axisX?: AxisConfig;\n\n /**\n * Y-axis specific config.\n */\n axisY?: AxisConfig;\n\n /**\n * Config for y-axis along the left edge of the chart.\n */\n axisLeft?: AxisConfig;\n\n /**\n * Config for y-axis along the right edge of the chart.\n */\n axisRight?: AxisConfig;\n\n /**\n * Config for x-axis along the top edge of the chart.\n */\n axisTop?: AxisConfig;\n\n /**\n * Config for x-axis along the bottom edge of the chart.\n */\n axisBottom?: AxisConfig;\n\n /**\n * Config for axes with \"band\" scales.\n */\n axisBand?: AxisConfig;\n\n /**\n * Config for axes with \"point\" scales.\n */\n axisPoint?: AxisConfig;\n\n /**\n * Config for axes with \"point\" or \"band\" scales.\n */\n axisDiscrete?: AxisConfig;\n\n /**\n * Config for quantitative axes.\n */\n axisQuantitative?: AxisConfig;\n\n /**\n * Config for temporal axes.\n */\n axisTemporal?: AxisConfig;\n\n /**\n * Config for x-axes with \"band\" scales.\n */\n axisXBand?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" scales.\n */\n axisXPoint?: AxisConfig;\n\n /**\n * Config for x-axes with \"point\" or \"band\" scales.\n */\n axisXDiscrete?: AxisConfig;\n\n /**\n * Config for x-quantitative axes.\n */\n axisXQuantitative?: AxisConfig;\n\n /**\n * Config for x-temporal axes.\n */\n axisXTemporal?: AxisConfig;\n\n /**\n * Config for y-axes with \"band\" scales.\n */\n axisYBand?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" scales.\n */\n axisYPoint?: AxisConfig;\n\n /**\n * Config for y-axes with \"point\" or \"band\" scales.\n */\n axisYDiscrete?: AxisConfig;\n\n /**\n * Config for y-quantitative axes.\n */\n axisYQuantitative?: AxisConfig;\n\n /**\n * Config for y-temporal axes.\n */\n axisYTemporal?: AxisConfig;\n}\n\nconst AXIS_CONFIGS_INDEX: Flag> = {\n axis: 1,\n axisBand: 1,\n axisBottom: 1,\n axisDiscrete: 1,\n axisLeft: 1,\n axisPoint: 1,\n axisQuantitative: 1,\n axisRight: 1,\n axisTemporal: 1,\n axisTop: 1,\n axisX: 1,\n axisXBand: 1,\n axisXDiscrete: 1,\n axisXPoint: 1,\n axisXQuantitative: 1,\n axisXTemporal: 1,\n axisY: 1,\n axisYBand: 1,\n axisYDiscrete: 1,\n axisYPoint: 1,\n axisYQuantitative: 1,\n axisYTemporal: 1\n};\n\nexport const AXIS_CONFIGS = keys(AXIS_CONFIGS_INDEX);\n","import {FieldName} from '../channeldef';\nimport {CompositeEncoding, FacetedCompositeEncoding} from '../compositemark';\nimport {Encoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport {AnyMark, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {SelectionParameter} from '../selection';\nimport {Field} from './../channeldef';\nimport {BaseSpec, DataMixins, FrameMixins, GenericCompositionLayout, ResolveMixins} from './base';\nimport {TopLevel, TopLevelParameter} from './toplevel';\n/**\n * Base interface for a unit (single-view) specification.\n */\nexport interface GenericUnitSpec, M, P = SelectionParameter> extends BaseSpec {\n /**\n * A string describing the mark type (one of `\"bar\"`, `\"circle\"`, `\"square\"`, `\"tick\"`, `\"line\"`,\n * `\"area\"`, `\"point\"`, `\"rule\"`, `\"geoshape\"`, and `\"text\"`) or a [mark definition object](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n */\n mark: M;\n\n /**\n * A key-value mapping between encoding channels and definition of fields.\n */\n encoding?: E;\n\n /**\n * An object defining properties of geographic projection, which will be applied to `shape` path for `\"geoshape\"` marks\n * and to `latitude` and `\"longitude\"` channels for other marks.\n */\n projection?: Projection;\n\n /**\n * An array of parameters that may either be simple variables, or more complex selections that map user input to data queries.\n */\n params?: P[];\n}\n\n/**\n * A unit specification without any shortcut/expansion syntax.\n */\nexport type NormalizedUnitSpec = GenericUnitSpec, Mark | MarkDef>;\n\n/**\n * A unit specification, which can contain either [primitive marks or composite marks](https://vega.github.io/vega-lite/docs/mark.html#types).\n */\nexport type UnitSpec = GenericUnitSpec, AnyMark>;\n\nexport type UnitSpecWithFrame = GenericUnitSpec, AnyMark> & FrameMixins;\n\n/**\n * Unit spec that can have a composite mark and row or column channels (shorthand for a facet spec).\n */\nexport type FacetedUnitSpec = GenericUnitSpec<\n FacetedCompositeEncoding,\n AnyMark,\n P\n> &\n ResolveMixins &\n GenericCompositionLayout &\n FrameMixins;\n\nexport type TopLevelUnitSpec = TopLevel> & DataMixins;\n\nexport function isUnitSpec(spec: BaseSpec): spec is FacetedUnitSpec | NormalizedUnitSpec {\n return 'mark' in spec;\n}\n","import {Encoding} from '../encoding';\nimport {GenericMarkDef, getMarkType} from '../mark';\nimport {NonFacetUnitNormalizer, Normalize, NormalizerParams} from '../normalize/base';\nimport {GenericSpec} from '../spec';\nimport {GenericLayerSpec, NormalizedLayerSpec} from '../spec/layer';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {FieldName} from '../channeldef';\n\n// TODO: replace string with Mark\nexport type CompositeMarkUnitSpec = GenericUnitSpec>;\n\nexport class CompositeMarkNormalizer implements NonFacetUnitNormalizer> {\n constructor(\n public name: string,\n public run: (\n spec: CompositeMarkUnitSpec,\n params: NormalizerParams,\n normalize: Normalize<\n // Input of the normalize method\n GenericUnitSpec, M> | GenericLayerSpec,\n // Output of the normalize method\n NormalizedLayerSpec | NormalizedUnitSpec\n >\n ) => NormalizedLayerSpec | NormalizedUnitSpec\n ) {}\n\n public hasMatchingType(spec: GenericSpec): spec is CompositeMarkUnitSpec {\n if (isUnitSpec(spec)) {\n return getMarkType(spec.mark) === this.name;\n }\n return false;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {isArgmaxDef, isArgminDef} from './aggregate';\nimport {isBinned, isBinning} from './bin';\nimport {\n ANGLE,\n Channel,\n CHANNELS,\n COLOR,\n DESCRIPTION,\n DETAIL,\n FILL,\n FILLOPACITY,\n getMainChannelFromOffsetChannel,\n getOffsetScaleChannel,\n HREF,\n isChannel,\n isNonPositionScaleChannel,\n isSecondaryRangeChannel,\n isXorY,\n isXorYOffset,\n KEY,\n LATITUDE,\n LATITUDE2,\n LONGITUDE,\n LONGITUDE2,\n OPACITY,\n ORDER,\n RADIUS,\n RADIUS2,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n supportMark,\n TEXT,\n THETA,\n THETA2,\n TOOLTIP,\n UNIT_CHANNELS,\n URL,\n X,\n X2,\n XOFFSET,\n Y,\n Y2,\n YOFFSET\n} from './channel';\nimport {\n binRequiresRange,\n ChannelDef,\n ColorDef,\n Field,\n FieldDef,\n FieldDefWithoutScale,\n getFieldDef,\n getGuide,\n hasConditionalFieldDef,\n hasConditionalFieldOrDatumDef,\n initChannelDef,\n initFieldDef,\n isConditionalDef,\n isDatumDef,\n isFieldDef,\n isOrderOnlyDef,\n isTypedFieldDef,\n isValueDef,\n LatLongDef,\n NumericArrayMarkPropDef,\n NumericMarkPropDef,\n OffsetDef,\n OrderFieldDef,\n OrderOnlyDef,\n OrderValueDef,\n PolarDef,\n Position2Def,\n PositionDef,\n SecondaryFieldDef,\n ShapeDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition,\n TextDef,\n title,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {Config} from './config';\nimport * as log from './log';\nimport {Mark} from './mark';\nimport {EncodingFacetMapping} from './spec/facet';\nimport {AggregatedFieldDef, BinTransform, TimeUnitTransform} from './transform';\nimport {isContinuous, isDiscrete, QUANTITATIVE, TEMPORAL} from './type';\nimport {keys, some} from './util';\nimport {isSignalRef} from './vega.schema';\nimport {isBinnedTimeUnit} from './timeunit';\n\nexport interface Encoding {\n /**\n * X coordinates of the marks, or width of horizontal `\"bar\"` and `\"area\"` without specified `x2` or `width`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n x?: PositionDef;\n\n /**\n * Y coordinates of the marks, or height of vertical `\"bar\"` and `\"area\"` without specified `y2` or `height`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n y?: PositionDef;\n\n /**\n * Offset of x-position of the marks\n */\n xOffset?: OffsetDef;\n\n /**\n * Offset of y-position of the marks\n */\n yOffset?: OffsetDef;\n\n /**\n * X2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"width\"` for the width of the plot.\n */\n // TODO: Ham need to add default behavior\n // `x2` cannot have type as it should have the same type as `x`\n x2?: Position2Def;\n\n /**\n * Y2 coordinates for ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n *\n * The `value` of this channel can be a number or a string `\"height\"` for the height of the plot.\n */\n // TODO: Ham need to add default behavior\n // `y2` cannot have type as it should have the same type as `y`\n y2?: Position2Def;\n\n /**\n * Longitude position of geographically projected marks.\n */\n longitude?: LatLongDef;\n\n /**\n * Latitude position of geographically projected marks.\n */\n latitude?: LatLongDef;\n\n /**\n * Longitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `longitude2` cannot have type as it should have the same type as `longitude`\n longitude2?: Position2Def;\n\n /**\n * Latitude-2 position for geographically projected ranged `\"area\"`, `\"bar\"`, `\"rect\"`, and `\"rule\"`.\n */\n // `latitude2` cannot have type as it should have the same type as `latitude`\n latitude2?: Position2Def;\n\n /**\n * - For arc marks, the arc length in radians if theta2 is not specified, otherwise the start arc angle. (A value of 0 indicates up or “north”, increasing values proceed clockwise.)\n *\n * - For text marks, polar coordinate angle in radians.\n */\n theta?: PolarDef;\n\n /**\n * The end angle of arc marks in radians. A value of 0 indicates up or “north”, increasing values proceed clockwise.\n */\n theta2?: Position2Def;\n\n /**\n * The outer radius in pixels of arc marks.\n */\n\n radius?: PolarDef;\n\n /**\n * The inner radius in pixels of arc marks.\n */\n radius2?: Position2Def;\n\n /**\n * Color of the marks – either fill or stroke color based on the `filled` property of mark definition.\n * By default, `color` represents fill color for `\"area\"`, `\"bar\"`, `\"tick\"`,\n * `\"text\"`, `\"trail\"`, `\"circle\"`, and `\"square\"` / stroke color for `\"line\"` and `\"point\"`.\n *\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_\n * 1) For fine-grained control over both fill and stroke colors of the marks, please use the `fill` and `stroke` channels. The `fill` or `stroke` encodings have higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n * 2) See the scale documentation for more information about customizing [color scheme](https://vega.github.io/vega-lite/docs/scale.html#scheme).\n */\n color?: ColorDef;\n\n /**\n * Fill color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `fill` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n fill?: ColorDef;\n\n /**\n * Stroke color of the marks.\n * __Default value:__ If undefined, the default color depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `color` property.\n *\n * _Note:_ The `stroke` encoding has higher precedence than `color`, thus may override the `color` encoding if conflicting encodings are specified.\n */\n\n stroke?: ColorDef;\n\n /**\n * Opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `opacity` property.\n */\n opacity?: NumericMarkPropDef;\n\n /**\n * Fill opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `fillOpacity` property.\n */\n fillOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke opacity of the marks.\n *\n * __Default value:__ If undefined, the default opacity depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeOpacity` property.\n */\n strokeOpacity?: NumericMarkPropDef;\n\n /**\n * Stroke width of the marks.\n *\n * __Default value:__ If undefined, the default stroke width depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#mark-config)'s `strokeWidth` property.\n */\n strokeWidth?: NumericMarkPropDef;\n\n /**\n * Stroke dash of the marks.\n *\n * __Default value:__ `[1,0]` (No dash).\n */\n strokeDash?: NumericArrayMarkPropDef;\n\n /**\n * Size of the mark.\n * - For `\"point\"`, `\"square\"` and `\"circle\"`, – the symbol size, or pixel area of the mark.\n * - For `\"bar\"` and `\"tick\"` – the bar and tick's size.\n * - For `\"text\"` – the text's font size.\n * - Size is unsupported for `\"line\"`, `\"area\"`, and `\"rect\"`. (Use `\"trail\"` instead of line with varying size)\n */\n size?: NumericMarkPropDef;\n\n /**\n * Rotation angle of point and text marks.\n */\n angle?: NumericMarkPropDef;\n\n /**\n * Shape of the mark.\n *\n * 1. For `point` marks the supported values include:\n * - plotting shapes: `\"circle\"`, `\"square\"`, `\"cross\"`, `\"diamond\"`, `\"triangle-up\"`, `\"triangle-down\"`, `\"triangle-right\"`, or `\"triangle-left\"`.\n * - the line symbol `\"stroke\"`\n * - centered directional shapes `\"arrow\"`, `\"wedge\"`, or `\"triangle\"`\n * - a custom [SVG path string](https://developer.mozilla.org/en-US/docs/Web/SVG/Tutorial/Paths) (For correct sizing, custom shape paths should be defined within a square bounding box with coordinates ranging from -1 to 1 along both the x and y dimensions.)\n *\n * 2. For `geoshape` marks it should be a field definition of the geojson data\n *\n * __Default value:__ If undefined, the default shape depends on [mark config](https://vega.github.io/vega-lite/docs/config.html#point-config)'s `shape` property. (`\"circle\"` if unset.)\n */\n shape?: ShapeDef;\n /**\n * Additional levels of detail for grouping data in aggregate views and\n * in line, trail, and area marks without mapping data to a specific visual channel.\n */\n detail?: FieldDefWithoutScale | FieldDefWithoutScale[];\n\n /**\n * A data field to use as a unique key for data binding. When a visualization’s data is updated, the key value will be used to match data elements to existing mark instances. Use a key channel to enable object constancy for transitions over dynamic data.\n */\n key?: FieldDefWithoutScale;\n\n /**\n * Text of the `text` mark.\n */\n text?: TextDef;\n\n /**\n * The tooltip text to show upon mouse hover. Specifying `tooltip` encoding overrides [the `tooltip` property in the mark definition](https://vega.github.io/vega-lite/docs/mark.html#mark-def).\n *\n * See the [`tooltip`](https://vega.github.io/vega-lite/docs/tooltip.html) documentation for a detailed discussion about tooltip in Vega-Lite.\n */\n tooltip?: StringFieldDefWithCondition | StringValueDefWithCondition | StringFieldDef[] | null;\n\n /**\n * A URL to load upon mouse click.\n */\n href?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * The URL of an image mark.\n */\n url?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * A text description of this mark for ARIA accessibility (SVG output only). For SVG output the `\"aria-label\"` attribute will be set to this description.\n */\n description?: StringFieldDefWithCondition | StringValueDefWithCondition;\n\n /**\n * Order of the marks.\n * - For stacked marks, this `order` channel encodes [stack order](https://vega.github.io/vega-lite/docs/stack.html#order).\n * - For line and trail marks, this `order` channel encodes order of data points in the lines. This can be useful for creating [a connected scatterplot](https://vega.github.io/vega-lite/examples/connected_scatterplot.html). Setting `order` to `{\"value\": null}` makes the line marks use the original order in the data sources.\n * - Otherwise, this `order` channel encodes layer order of the marks.\n *\n * __Note__: In aggregate plots, `order` field should be `aggregate`d to avoid creating additional aggregation grouping.\n */\n order?: OrderFieldDef | OrderFieldDef[] | OrderValueDef | OrderOnlyDef;\n}\n\nexport interface EncodingWithFacet extends Encoding, EncodingFacetMapping {}\n\nexport function channelHasField(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || hasConditionalFieldDef(channelDef);\n }\n }\n return false;\n}\n\nexport function channelHasFieldOrDatum(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n const channelDef = encoding && encoding[channel];\n if (channelDef) {\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.field);\n } else {\n return isFieldDef(channelDef) || isDatumDef(channelDef) || hasConditionalFieldOrDatumDef(channelDef);\n }\n }\n return false;\n}\n\nexport function channelHasNestedOffsetScale(\n encoding: EncodingWithFacet,\n channel: keyof EncodingWithFacet\n): boolean {\n if (isXorY(channel)) {\n const fieldDef = encoding[channel];\n if (\n (isFieldDef(fieldDef) || isDatumDef(fieldDef)) &&\n (isDiscrete(fieldDef.type) || (isFieldDef(fieldDef) && fieldDef.timeUnit))\n ) {\n const offsetChannel = getOffsetScaleChannel(channel);\n return channelHasFieldOrDatum(encoding, offsetChannel);\n }\n }\n return false;\n}\n\nexport function isAggregate(encoding: EncodingWithFacet) {\n return some(CHANNELS, channel => {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n if (isArray(channelDef)) {\n return some(channelDef, fieldDef => !!fieldDef.aggregate);\n } else {\n const fieldDef = getFieldDef(channelDef);\n return fieldDef && !!fieldDef.aggregate;\n }\n }\n return false;\n });\n}\n\nexport function extractTransformsFromEncoding(oldEncoding: Encoding, config: Config) {\n const groupby: string[] = [];\n const bins: BinTransform[] = [];\n const timeUnits: TimeUnitTransform[] = [];\n const aggregate: AggregatedFieldDef[] = [];\n const encoding: Encoding = {};\n\n forEach(oldEncoding, (channelDef, channel) => {\n // Extract potential embedded transformations along with remaining properties\n if (isFieldDef(channelDef)) {\n const {field, aggregate: aggOp, bin, timeUnit, ...remaining} = channelDef;\n if (aggOp || timeUnit || bin) {\n const guide = getGuide(channelDef);\n const isTitleDefined = guide?.title;\n let newField = vgField(channelDef, {forAs: true});\n const newFieldDef: FieldDef = {\n // Only add title if it doesn't exist\n ...(isTitleDefined ? [] : {title: title(channelDef, config, {allowDisabling: true})}),\n ...remaining,\n // Always overwrite field\n field: newField\n };\n\n if (aggOp) {\n let op: AggregateOp;\n\n if (isArgmaxDef(aggOp)) {\n op = 'argmax';\n newField = vgField({op: 'argmax', field: aggOp.argmax}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (isArgminDef(aggOp)) {\n op = 'argmin';\n newField = vgField({op: 'argmin', field: aggOp.argmin}, {forAs: true});\n newFieldDef.field = `${newField}.${field}`;\n } else if (aggOp !== 'boxplot' && aggOp !== 'errorbar' && aggOp !== 'errorband') {\n op = aggOp;\n }\n\n if (op) {\n const aggregateEntry: AggregatedFieldDef = {\n op,\n as: newField\n };\n if (field) {\n aggregateEntry.field = field;\n }\n aggregate.push(aggregateEntry);\n }\n } else {\n groupby.push(newField);\n if (isTypedFieldDef(channelDef) && isBinning(bin)) {\n bins.push({bin, field, as: newField});\n // Add additional groupbys for range and end of bins\n groupby.push(vgField(channelDef, {binSuffix: 'end'}));\n if (binRequiresRange(channelDef, channel)) {\n groupby.push(vgField(channelDef, {binSuffix: 'range'}));\n }\n // Create accompanying 'x2' or 'y2' field if channel is 'x' or 'y' respectively\n if (isXorY(channel)) {\n const secondaryChannel: SecondaryFieldDef = {\n field: `${newField}_end`\n };\n encoding[`${channel}2`] = secondaryChannel;\n }\n newFieldDef.bin = 'binned';\n if (!isSecondaryRangeChannel(channel)) {\n newFieldDef['type'] = QUANTITATIVE;\n }\n } else if (timeUnit && !isBinnedTimeUnit(timeUnit)) {\n timeUnits.push({\n timeUnit,\n field,\n as: newField\n });\n\n // define the format type for later compilation\n const formatType = isTypedFieldDef(channelDef) && channelDef.type !== TEMPORAL && 'time';\n if (formatType) {\n if (channel === TEXT || channel === TOOLTIP) {\n newFieldDef['formatType'] = formatType;\n } else if (isNonPositionScaleChannel(channel)) {\n newFieldDef['legend'] = {\n formatType,\n ...newFieldDef['legend']\n };\n } else if (isXorY(channel)) {\n newFieldDef['axis'] = {\n formatType,\n ...newFieldDef['axis']\n };\n }\n }\n }\n }\n\n // now the field should refer to post-transformed field instead\n encoding[channel as any] = newFieldDef;\n } else {\n groupby.push(field);\n encoding[channel as any] = oldEncoding[channel];\n }\n } else {\n // For value def / signal ref / datum def, just copy\n encoding[channel as any] = oldEncoding[channel];\n }\n });\n\n return {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding\n };\n}\n\nexport function markChannelCompatible(encoding: Encoding, channel: Channel, mark: Mark) {\n const markSupported = supportMark(channel, mark);\n if (!markSupported) {\n return false;\n } else if (markSupported === 'binned') {\n const primaryFieldDef = encoding[channel === X2 ? X : Y];\n\n // circle, point, square and tick only support x2/y2 when their corresponding x/y fieldDef\n // has \"binned\" data and thus need x2/y2 to specify the bin-end field.\n if (isFieldDef(primaryFieldDef) && isFieldDef(encoding[channel]) && isBinned(primaryFieldDef.bin)) {\n return true;\n } else {\n return false;\n }\n }\n return true;\n}\n\nexport function initEncoding(\n encoding: Encoding,\n mark: Mark,\n filled: boolean,\n config: Config\n): Encoding {\n const normalizedEncoding: Encoding = {};\n for (const key of keys(encoding)) {\n if (!isChannel(key)) {\n // Drop invalid channel\n log.warn(log.message.invalidEncodingChannel(key));\n }\n }\n\n for (let channel of UNIT_CHANNELS) {\n if (!encoding[channel]) {\n continue;\n }\n\n const channelDef = encoding[channel];\n if (isXorYOffset(channel)) {\n const mainChannel = getMainChannelFromOffsetChannel(channel);\n\n const positionDef = normalizedEncoding[mainChannel];\n if (isFieldDef(positionDef)) {\n if (isContinuous(positionDef.type)) {\n if (isFieldDef(channelDef) && !positionDef.timeUnit) {\n // TODO: nesting continuous field instead continuous field should\n // behave like offsetting the data in data domain\n log.warn(log.message.offsetNestedInsideContinuousPositionScaleDropped(mainChannel));\n continue;\n }\n }\n }\n }\n\n if (channel === 'angle' && mark === 'arc' && !encoding.theta) {\n log.warn(log.message.REPLACE_ANGLE_WITH_THETA);\n channel = THETA;\n }\n\n if (!markChannelCompatible(encoding, channel, mark)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, mark));\n continue;\n }\n\n // Drop line's size if the field is aggregated.\n if (channel === SIZE && mark === 'line') {\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef?.aggregate) {\n log.warn(log.message.LINE_WITH_VARYING_SIZE);\n continue;\n }\n }\n // Drop color if either fill or stroke is specified\n\n if (channel === COLOR && (filled ? 'fill' in encoding : 'stroke' in encoding)) {\n log.warn(log.message.droppingColor('encoding', {fill: 'fill' in encoding, stroke: 'stroke' in encoding}));\n continue;\n }\n\n if (\n channel === DETAIL ||\n (channel === ORDER && !isArray(channelDef) && !isValueDef(channelDef)) ||\n (channel === TOOLTIP && isArray(channelDef))\n ) {\n if (channelDef) {\n if (channel === ORDER) {\n const def = encoding[channel];\n if (isOrderOnlyDef(def)) {\n normalizedEncoding[channel] = def;\n continue;\n }\n }\n // Array of fieldDefs for detail channel (or production rule)\n (normalizedEncoding[channel] as any) = array(channelDef).reduce(\n (defs: FieldDef[], fieldDef: FieldDef) => {\n if (!isFieldDef(fieldDef)) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n } else {\n defs.push(initFieldDef(fieldDef, channel));\n }\n return defs;\n },\n []\n );\n }\n } else {\n if (channel === TOOLTIP && channelDef === null) {\n // Preserve null so we can use it to disable tooltip\n normalizedEncoding[channel] = null;\n } else if (\n !isFieldDef(channelDef) &&\n !isDatumDef(channelDef) &&\n !isValueDef(channelDef) &&\n !isConditionalDef(channelDef) &&\n !isSignalRef(channelDef)\n ) {\n log.warn(log.message.emptyFieldDef(channelDef, channel));\n continue;\n }\n\n normalizedEncoding[channel as any] = initChannelDef(channelDef as ChannelDef, channel, config);\n }\n }\n return normalizedEncoding;\n}\n\n/**\n * For composite marks, we have to call initChannelDef during init so we can infer types earlier.\n */\nexport function normalizeEncoding(encoding: Encoding, config: Config): Encoding {\n const normalizedEncoding: Encoding = {};\n\n for (const channel of keys(encoding)) {\n const newChannelDef = initChannelDef(encoding[channel], channel, config, {compositeMark: true});\n normalizedEncoding[channel as any] = newChannelDef;\n }\n\n return normalizedEncoding;\n}\n\nexport function fieldDefs(encoding: EncodingWithFacet): FieldDef[] {\n const arr: FieldDef[] = [];\n for (const channel of keys(encoding)) {\n if (channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n const channelDefArray = array(channelDef);\n for (const def of channelDefArray) {\n if (isFieldDef(def)) {\n arr.push(def);\n } else if (hasConditionalFieldDef(def)) {\n arr.push(def.condition);\n }\n }\n }\n }\n return arr;\n}\n\nexport function forEach>(\n mapping: U,\n f: (cd: ChannelDef, c: keyof U) => void,\n thisArg?: any\n) {\n if (!mapping) {\n return;\n }\n\n for (const channel of keys(mapping)) {\n const el = mapping[channel];\n if (isArray(el)) {\n for (const channelDef of el as unknown[]) {\n f.call(thisArg, channelDef, channel);\n }\n } else {\n f.call(thisArg, el, channel);\n }\n }\n}\n\nexport function reduce>(\n mapping: U,\n f: (acc: any, fd: TypedFieldDef, c: keyof U) => U,\n init: T,\n thisArg?: any\n) {\n if (!mapping) {\n return init;\n }\n\n return keys(mapping).reduce((r, channel) => {\n const map = mapping[channel];\n if (isArray(map)) {\n return map.reduce((r1: T, channelDef: ChannelDef) => {\n return f.call(thisArg, r1, channelDef, channel);\n }, r);\n } else {\n return f.call(thisArg, r, map, channel);\n }\n }, init);\n}\n\n/**\n * Returns list of path grouping fields for the given encoding\n */\nexport function pathGroupingFields(mark: Mark, encoding: Encoding): string[] {\n return keys(encoding).reduce((details, channel) => {\n switch (channel) {\n // x, y, x2, y2, lat, long, lat1, long2, order, tooltip, href, aria label, cursor should not cause lines to group\n case X:\n case Y:\n case HREF:\n case DESCRIPTION:\n case URL:\n case X2:\n case Y2:\n case XOFFSET:\n case YOFFSET:\n case THETA:\n case THETA2:\n case RADIUS:\n case RADIUS2:\n // falls through\n\n case LATITUDE:\n case LONGITUDE:\n case LATITUDE2:\n case LONGITUDE2:\n // TODO: case 'cursor':\n\n // text, shape, shouldn't be a part of line/trail/area [falls through]\n case TEXT:\n case SHAPE:\n case ANGLE:\n // falls through\n\n // tooltip fields should not be added to group by [falls through]\n case TOOLTIP:\n return details;\n\n case ORDER:\n // order should not group line / trail\n if (mark === 'line' || mark === 'trail') {\n return details;\n }\n // but order should group area for stacking (falls through)\n\n case DETAIL:\n case KEY: {\n const channelDef = encoding[channel];\n if (isArray(channelDef) || isFieldDef(channelDef)) {\n for (const fieldDef of array(channelDef)) {\n if (!fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n }\n }\n return details;\n }\n\n case SIZE:\n if (mark === 'trail') {\n // For trail, size should not group trail lines.\n return details;\n }\n // For line, size should group lines.\n\n // falls through\n case COLOR:\n case FILL:\n case STROKE:\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n case STROKEDASH:\n case STROKEWIDTH: {\n // TODO strokeDashOffset:\n // falls through\n\n const fieldDef = getFieldDef(encoding[channel]);\n if (fieldDef && !fieldDef.aggregate) {\n details.push(vgField(fieldDef, {}));\n }\n return details;\n }\n }\n }, []);\n}\n","import {Orientation, SignalRef, Text} from 'vega';\nimport {isArray, isBoolean, isString} from 'vega-util';\nimport {CompositeMark, CompositeMarkDef} from '.';\nimport {\n Field,\n FieldDefBase,\n isContinuousFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n PositionFieldDef,\n SecondaryFieldDef,\n StringFieldDef,\n StringFieldDefWithCondition,\n StringValueDefWithCondition\n} from '../channeldef';\nimport {Encoding, fieldDefs} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {ColorMixins, GenericMarkDef, isMarkDef, Mark, AnyMarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {getFirstDefined, hash, unique} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {toStringFieldDef} from './../channeldef';\n\n// Parts mixins can be any mark type. We could make a more specific type for each part.\nexport type PartsMixins

= Partial>>;\n\nexport type GenericCompositeMarkDef = GenericMarkDef &\n ColorMixins & {\n /**\n * The opacity (value between [0,1]) of the mark.\n *\n * @minimum 0\n * @maximum 1\n */\n opacity?: number;\n\n /**\n * Whether a composite mark be clipped to the enclosing group’s width and height.\n */\n clip?: boolean;\n };\n\nexport interface CompositeMarkTooltipSummary {\n /**\n * The prefix of the field to be shown in tooltip\n */\n fieldPrefix: string;\n\n /**\n * The title prefix to show, corresponding to the field with field prefix `fieldPrefix`\n */\n titlePrefix: Text | SignalRef;\n}\n\nexport function filterTooltipWithAggregatedField(\n oldEncoding: Encoding\n): {\n customTooltipWithoutAggregatedField?:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n filteredEncoding: Encoding;\n} {\n const {tooltip, ...filteredEncoding} = oldEncoding;\n if (!tooltip) {\n return {filteredEncoding};\n }\n\n let customTooltipWithAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n let customTooltipWithoutAggregatedField:\n | StringFieldDefWithCondition\n | StringValueDefWithCondition\n | StringFieldDef[];\n\n if (isArray(tooltip)) {\n for (const t of tooltip) {\n if (t.aggregate) {\n if (!customTooltipWithAggregatedField) {\n customTooltipWithAggregatedField = [];\n }\n (customTooltipWithAggregatedField as StringFieldDef[]).push(t);\n } else {\n if (!customTooltipWithoutAggregatedField) {\n customTooltipWithoutAggregatedField = [];\n }\n (customTooltipWithoutAggregatedField as StringFieldDef[]).push(t);\n }\n }\n\n if (customTooltipWithAggregatedField) {\n (filteredEncoding as Encoding).tooltip = customTooltipWithAggregatedField;\n }\n } else {\n if (tooltip['aggregate']) {\n (filteredEncoding as Encoding).tooltip = tooltip;\n } else {\n customTooltipWithoutAggregatedField = tooltip;\n }\n }\n\n if (isArray(customTooltipWithoutAggregatedField) && customTooltipWithoutAggregatedField.length === 1) {\n customTooltipWithoutAggregatedField = customTooltipWithoutAggregatedField[0];\n }\n return {customTooltipWithoutAggregatedField, filteredEncoding};\n}\n\nexport function getCompositeMarkTooltip(\n tooltipSummary: CompositeMarkTooltipSummary[],\n continuousAxisChannelDef: PositionFieldDef,\n encodingWithoutContinuousAxis: Encoding,\n withFieldName = true\n): Encoding {\n if ('tooltip' in encodingWithoutContinuousAxis) {\n return {tooltip: encodingWithoutContinuousAxis.tooltip};\n }\n\n const fiveSummaryTooltip: StringFieldDef[] = tooltipSummary.map(\n ({fieldPrefix, titlePrefix}): StringFieldDef => {\n const mainTitle = withFieldName ? ` of ${getTitle(continuousAxisChannelDef)}` : '';\n return {\n field: fieldPrefix + continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n title: isSignalRef(titlePrefix) ? {signal: `${titlePrefix}\"${escape(mainTitle)}\"`} : titlePrefix + mainTitle\n };\n }\n );\n\n const tooltipFieldDefs = fieldDefs(encodingWithoutContinuousAxis).map(toStringFieldDef);\n\n return {\n tooltip: [\n ...fiveSummaryTooltip,\n // need to cast because TextFieldDef supports fewer types of bin\n ...unique(tooltipFieldDefs, hash)\n ]\n };\n}\n\nexport function getTitle(continuousAxisChannelDef: PositionFieldDef) {\n const {title, field} = continuousAxisChannelDef;\n return getFirstDefined(title, field);\n}\n\nexport function makeCompositeAggregatePartFactory

>(\n compositeMarkDef: GenericCompositeMarkDef & P,\n continuousAxis: 'x' | 'y',\n continuousAxisChannelDef: PositionFieldDef,\n sharedEncoding: Encoding,\n compositeMarkConfig: P\n) {\n const {scale, axis} = continuousAxisChannelDef;\n\n return ({\n partName,\n mark,\n positionPrefix,\n endPositionPrefix = undefined,\n extraEncoding = {}\n }: {\n partName: keyof P;\n mark: Mark | MarkDef;\n positionPrefix: string;\n endPositionPrefix?: string;\n extraEncoding?: Encoding;\n }) => {\n const title = getTitle(continuousAxisChannelDef);\n\n return partLayerMixins

(compositeMarkDef, partName, compositeMarkConfig, {\n mark, // TODO better remove this method and just have mark as a parameter of the method\n encoding: {\n [continuousAxis]: {\n field: `${positionPrefix}_${continuousAxisChannelDef.field}`,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n ...(axis !== undefined ? {axis} : {})\n },\n ...(isString(endPositionPrefix)\n ? {\n [`${continuousAxis}2`]: {\n field: `${endPositionPrefix}_${continuousAxisChannelDef.field}`\n }\n }\n : {}),\n ...sharedEncoding,\n ...extraEncoding\n }\n });\n };\n}\n\nexport function partLayerMixins

>(\n markDef: GenericCompositeMarkDef & P,\n part: keyof P,\n compositeMarkConfig: P,\n partBaseSpec: NormalizedUnitSpec\n): NormalizedUnitSpec[] {\n const {clip, color, opacity} = markDef;\n\n const mark = markDef.type;\n\n if (markDef[part] || (markDef[part] === undefined && compositeMarkConfig[part])) {\n return [\n {\n ...partBaseSpec,\n mark: {\n ...(compositeMarkConfig[part] as AnyMarkConfig),\n ...(clip ? {clip} : {}),\n ...(color ? {color} : {}),\n ...(opacity ? {opacity} : {}),\n ...(isMarkDef(partBaseSpec.mark) ? partBaseSpec.mark : {type: partBaseSpec.mark}),\n style: `${mark}-${String(part)}`,\n ...(isBoolean(markDef[part]) ? {} : (markDef[part] as AnyMarkConfig))\n }\n }\n ];\n }\n return [];\n}\n\nexport function compositeMarkContinuousAxis(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n orient: Orientation,\n compositeMark: M\n): {\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxisChannelDef2: SecondaryFieldDef;\n continuousAxisChannelDefError: SecondaryFieldDef;\n continuousAxisChannelDefError2: SecondaryFieldDef;\n continuousAxis: 'x' | 'y';\n} {\n const {encoding} = spec;\n const continuousAxis: 'x' | 'y' = orient === 'vertical' ? 'y' : 'x';\n\n const continuousAxisChannelDef = encoding[continuousAxis] as PositionFieldDef; // Safe to cast because if x is not continuous fielddef, the orient would not be horizontal.\n const continuousAxisChannelDef2 = encoding[`${continuousAxis}2`] as SecondaryFieldDef;\n const continuousAxisChannelDefError = encoding[`${continuousAxis}Error`] as SecondaryFieldDef;\n const continuousAxisChannelDefError2 = encoding[`${continuousAxis}Error2`] as SecondaryFieldDef;\n\n return {\n continuousAxisChannelDef: filterAggregateFromChannelDef(continuousAxisChannelDef, compositeMark),\n continuousAxisChannelDef2: filterAggregateFromChannelDef(continuousAxisChannelDef2, compositeMark),\n continuousAxisChannelDefError: filterAggregateFromChannelDef(continuousAxisChannelDefError, compositeMark),\n continuousAxisChannelDefError2: filterAggregateFromChannelDef(continuousAxisChannelDefError2, compositeMark),\n continuousAxis\n };\n}\n\nfunction filterAggregateFromChannelDef>(\n continuousAxisChannelDef: F,\n compositeMark: M\n): F {\n if (continuousAxisChannelDef?.aggregate) {\n const {aggregate, ...continuousAxisWithoutAggregate} = continuousAxisChannelDef;\n if (aggregate !== compositeMark) {\n log.warn(log.message.errorBarContinuousAxisHasCustomizedAggregate(aggregate, compositeMark));\n }\n return continuousAxisWithoutAggregate as F;\n } else {\n return continuousAxisChannelDef;\n }\n}\n\nexport function compositeMarkOrient(\n spec: GenericUnitSpec, CompositeMark | CompositeMarkDef>,\n compositeMark: M\n): Orientation {\n const {mark, encoding} = spec;\n const {x, y} = encoding;\n\n if (isMarkDef(mark) && mark.orient) {\n return mark.orient;\n }\n\n if (isContinuousFieldOrDatumDef(x)) {\n // x is continuous\n if (isContinuousFieldOrDatumDef(y)) {\n // both x and y are continuous\n const xAggregate = isFieldDef(x) && x.aggregate;\n const yAggregate = isFieldDef(y) && y.aggregate;\n\n if (!xAggregate && yAggregate === compositeMark) {\n return 'vertical';\n } else if (!yAggregate && xAggregate === compositeMark) {\n return 'horizontal';\n } else if (xAggregate === compositeMark && yAggregate === compositeMark) {\n throw new Error('Both x and y cannot have aggregate');\n } else {\n if (isFieldOrDatumDefForTimeFormat(y) && !isFieldOrDatumDefForTimeFormat(x)) {\n // y is temporal but x is not\n return 'horizontal';\n }\n\n // default orientation for two continuous\n return 'vertical';\n }\n }\n\n return 'horizontal';\n } else if (isContinuousFieldOrDatumDef(y)) {\n // y is continuous but x is not\n return 'vertical';\n } else {\n // Neither x nor y is continuous.\n throw new Error(`Need a valid continuous axis for ${compositeMark}s`);\n }\n}\n","import {Orientation} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {getMarkPropOrConfig} from '../compile/common';\nimport {Config} from '../config';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef, MarkInvalidMixins} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec, NormalizedUnitSpec} from '../spec';\nimport {AggregatedFieldDef, CalculateTransform, JoinAggregateTransform, Transform} from '../transform';\nimport {isEmpty, omit} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n filterTooltipWithAggregatedField,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n getTitle,\n makeCompositeAggregatePartFactory,\n partLayerMixins,\n PartsMixins\n} from './common';\n\nexport const BOXPLOT = 'boxplot' as const;\nexport type BoxPlot = typeof BOXPLOT;\n\nexport const BOXPLOT_PARTS = ['box', 'median', 'outliers', 'rule', 'ticks'] as const;\n\ntype BoxPlotPart = (typeof BOXPLOT_PARTS)[number];\n\nexport type BoxPlotPartsMixins = PartsMixins;\n\nexport interface BoxPlotConfig extends BoxPlotPartsMixins {\n /** Size of the box and median tick of a box plot */\n size?: number;\n\n /**\n * The extent of the whiskers. Available options include:\n * - `\"min-max\"`: min and max are the lower and upper whiskers respectively.\n * - A number representing multiple of the interquartile range. This number will be multiplied by the IQR to determine whisker boundary, which spans from the smallest data to the largest data within the range _[Q1 - k * IQR, Q3 + k * IQR]_ where _Q1_ and _Q3_ are the first and third quartiles while _IQR_ is the interquartile range (_Q3-Q1_).\n *\n * __Default value:__ `1.5`.\n */\n extent?: 'min-max' | number;\n}\n\nexport type BoxPlotDef = GenericCompositeMarkDef &\n BoxPlotConfig &\n MarkInvalidMixins & {\n /**\n * Type of the mark. For box plots, this should always be `\"boxplot\"`.\n * [boxplot](https://vega.github.io/vega-lite/docs/boxplot.html)\n */\n type: BoxPlot;\n\n /**\n * Orientation of the box plot. This is normally automatically determined based on types of fields on x and y channels. However, an explicit `orient` be specified when the orientation is ambiguous.\n *\n * __Default value:__ `\"vertical\"`.\n */\n orient?: Orientation;\n };\n\nexport interface BoxPlotConfigMixins {\n /**\n * Box Config\n */\n boxplot?: BoxPlotConfig;\n}\n\nexport const boxPlotNormalizer = new CompositeMarkNormalizer(BOXPLOT, normalizeBoxPlot);\n\nexport function getBoxPlotType(extent: number | 'min-max') {\n if (isNumber(extent)) {\n return 'tukey';\n }\n // Ham: If we ever want to, we could add another extent syntax `{kIQR: number}` for the original [Q1-k*IQR, Q3+k*IQR] whisker and call this boxPlotType = `kIQR`. However, I'm not exposing this for now.\n return extent;\n}\n\nexport function normalizeBoxPlot(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n const {mark, encoding: _encoding, params, projection: _p, ...outerSpec} = spec;\n const markDef: BoxPlotDef = isMarkDef(mark) ? mark : {type: mark};\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported('boxplot'));\n }\n\n const extent = markDef.extent ?? config.boxplot.extent;\n const sizeValue = getMarkPropOrConfig(\n 'size',\n markDef as any, // TODO: https://github.com/vega/vega-lite/issues/6245\n config\n );\n\n const invalid = markDef.invalid;\n\n const boxPlotType = getBoxPlotType(extent);\n const {\n bins,\n timeUnits,\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n groupby,\n aggregate,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n } = boxParams(spec, extent, config);\n\n const {color, size, ...encodingWithoutSizeColorAndContinuousAxis} = encodingWithoutContinuousAxis;\n\n const makeBoxPlotPart = (sharedEncoding: Encoding) => {\n return makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n sharedEncoding,\n config.boxplot\n );\n };\n\n const makeBoxPlotExtent = makeBoxPlotPart(encodingWithoutSizeColorAndContinuousAxis);\n const makeBoxPlotBox = makeBoxPlotPart(encodingWithoutContinuousAxis);\n const makeBoxPlotMidTick = makeBoxPlotPart({...encodingWithoutSizeColorAndContinuousAxis, ...(size ? {size} : {})});\n\n const fiveSummaryTooltipEncoding: Encoding = getCompositeMarkTooltip(\n [\n {fieldPrefix: boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_', titlePrefix: 'Max'},\n {fieldPrefix: 'upper_box_', titlePrefix: 'Q3'},\n {fieldPrefix: 'mid_box_', titlePrefix: 'Median'},\n {fieldPrefix: 'lower_box_', titlePrefix: 'Q1'},\n {fieldPrefix: boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_', titlePrefix: 'Min'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n // ## Whisker Layers\n\n const endTick: MarkDef = {type: 'tick', color: 'black', opacity: 1, orient: ticksOrient, invalid, aria: false};\n const whiskerTooltipEncoding: Encoding =\n boxPlotType === 'min-max'\n ? fiveSummaryTooltipEncoding // for min-max, show five-summary tooltip for whisker\n : // for tukey / k-IQR, just show upper/lower-whisker\n getCompositeMarkTooltip(\n [\n {fieldPrefix: 'upper_whisker_', titlePrefix: 'Upper Whisker'},\n {fieldPrefix: 'lower_whisker_', titlePrefix: 'Lower Whisker'}\n ],\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis\n );\n\n const whiskerLayers = [\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid, aria: false},\n positionPrefix: 'lower_whisker',\n endPositionPrefix: 'lower_box',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'rule',\n mark: {type: 'rule', invalid, aria: false},\n positionPrefix: 'upper_box',\n endPositionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'lower_whisker',\n extraEncoding: whiskerTooltipEncoding\n }),\n ...makeBoxPlotExtent({\n partName: 'ticks',\n mark: endTick,\n positionPrefix: 'upper_whisker',\n extraEncoding: whiskerTooltipEncoding\n })\n ];\n\n // ## Box Layers\n\n // TODO: support hiding certain mark parts\n const boxLayers: NormalizedUnitSpec[] = [\n ...(boxPlotType !== 'tukey' ? whiskerLayers : []),\n ...makeBoxPlotBox({\n partName: 'box',\n mark: {\n type: 'bar',\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: boxOrient,\n invalid,\n ariaRoleDescription: 'box'\n },\n positionPrefix: 'lower_box',\n endPositionPrefix: 'upper_box',\n extraEncoding: fiveSummaryTooltipEncoding\n }),\n ...makeBoxPlotMidTick({\n partName: 'median',\n mark: {\n type: 'tick',\n invalid,\n ...(isObject(config.boxplot.median) && config.boxplot.median.color ? {color: config.boxplot.median.color} : {}),\n ...(sizeValue ? {size: sizeValue} : {}),\n orient: ticksOrient,\n aria: false\n },\n positionPrefix: 'mid_box',\n extraEncoding: fiveSummaryTooltipEncoding\n })\n ];\n\n if (boxPlotType === 'min-max') {\n return {\n ...outerSpec,\n transform: (outerSpec.transform ?? []).concat(transform),\n layer: boxLayers\n };\n }\n\n // Tukey Box Plot\n\n const lowerBoxExpr = `datum[\"lower_box_${continuousAxisChannelDef.field}\"]`;\n const upperBoxExpr = `datum[\"upper_box_${continuousAxisChannelDef.field}\"]`;\n const iqrExpr = `(${upperBoxExpr} - ${lowerBoxExpr})`;\n const lowerWhiskerExpr = `${lowerBoxExpr} - ${extent} * ${iqrExpr}`;\n const upperWhiskerExpr = `${upperBoxExpr} + ${extent} * ${iqrExpr}`;\n const fieldExpr = `datum[\"${continuousAxisChannelDef.field}\"]`;\n\n const joinaggregateTransform: JoinAggregateTransform = {\n joinaggregate: boxParamsQuartiles(continuousAxisChannelDef.field),\n groupby\n };\n\n const filteredWhiskerSpec: NormalizedLayerSpec = {\n transform: [\n {\n filter: `(${lowerWhiskerExpr} <= ${fieldExpr}) && (${fieldExpr} <= ${upperWhiskerExpr})`\n },\n {\n aggregate: [\n {\n op: 'min',\n field: continuousAxisChannelDef.field,\n as: `lower_whisker_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: continuousAxisChannelDef.field,\n as: `upper_whisker_${continuousAxisChannelDef.field}`\n },\n // preserve lower_box / upper_box\n {\n op: 'min',\n field: `lower_box_${continuousAxisChannelDef.field}`,\n as: `lower_box_${continuousAxisChannelDef.field}`\n },\n {\n op: 'max',\n field: `upper_box_${continuousAxisChannelDef.field}`,\n as: `upper_box_${continuousAxisChannelDef.field}`\n },\n ...aggregate\n ],\n groupby\n }\n ],\n layer: whiskerLayers\n };\n\n const {tooltip, ...encodingWithoutSizeColorContinuousAxisAndTooltip} = encodingWithoutSizeColorAndContinuousAxis;\n\n const {scale, axis} = continuousAxisChannelDef;\n const title = getTitle(continuousAxisChannelDef);\n const axisWithoutTitle = omit(axis, ['title']);\n\n const outlierLayersMixins = partLayerMixins(markDef, 'outliers', config.boxplot, {\n transform: [{filter: `(${fieldExpr} < ${lowerWhiskerExpr}) || (${fieldExpr} > ${upperWhiskerExpr})`}],\n mark: 'point',\n encoding: {\n [continuousAxis]: {\n field: continuousAxisChannelDef.field,\n type: continuousAxisChannelDef.type,\n ...(title !== undefined ? {title} : {}),\n ...(scale !== undefined ? {scale} : {}),\n // add axis without title since we already added the title above\n ...(isEmpty(axisWithoutTitle) ? {} : {axis: axisWithoutTitle})\n },\n ...encodingWithoutSizeColorContinuousAxisAndTooltip,\n ...(color ? {color} : {}),\n ...(customTooltipWithoutAggregatedField ? {tooltip: customTooltipWithoutAggregatedField} : {})\n }\n })[0];\n\n let filteredLayersMixins: NormalizedLayerSpec;\n const filteredLayersMixinsTransforms = [...bins, ...timeUnits, joinaggregateTransform];\n if (outlierLayersMixins) {\n filteredLayersMixins = {\n transform: filteredLayersMixinsTransforms,\n layer: [outlierLayersMixins, filteredWhiskerSpec]\n };\n } else {\n filteredLayersMixins = filteredWhiskerSpec;\n filteredLayersMixins.transform.unshift(...filteredLayersMixinsTransforms);\n }\n\n return {\n ...outerSpec,\n layer: [\n filteredLayersMixins,\n {\n // boxplot\n transform,\n layer: boxLayers\n }\n ]\n };\n}\n\nfunction boxParamsQuartiles(continousAxisField: string): AggregatedFieldDef[] {\n return [\n {\n op: 'q1',\n field: continousAxisField,\n as: `lower_box_${continousAxisField}`\n },\n {\n op: 'q3',\n field: continousAxisField,\n as: `upper_box_${continousAxisField}`\n }\n ];\n}\n\nfunction boxParams(\n spec: GenericUnitSpec, BoxPlot | BoxPlotDef>,\n extent: 'min-max' | number,\n config: Config\n) {\n const orient = compositeMarkOrient(spec, BOXPLOT);\n const {continuousAxisChannelDef, continuousAxis} = compositeMarkContinuousAxis(spec, orient, BOXPLOT);\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n const boxPlotType = getBoxPlotType(extent);\n\n const boxplotSpecificAggregate: AggregatedFieldDef[] = [\n ...boxParamsQuartiles(continuousFieldName),\n {\n op: 'median',\n field: continuousFieldName,\n as: `mid_box_${continuousFieldName}`\n },\n {\n op: 'min',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'lower_whisker_' : 'min_') + continuousFieldName\n },\n {\n op: 'max',\n field: continuousFieldName,\n as: (boxPlotType === 'min-max' ? 'upper_whisker_' : 'max_') + continuousFieldName\n }\n ];\n\n const postAggregateCalculates: CalculateTransform[] =\n boxPlotType === 'min-max' || boxPlotType === 'tukey'\n ? []\n : [\n // This is for the original k-IQR, which we do not expose\n {\n calculate: `datum[\"upper_box_${continuousFieldName}\"] - datum[\"lower_box_${continuousFieldName}\"]`,\n as: `iqr_${continuousFieldName}`\n },\n {\n calculate: `min(datum[\"upper_box_${continuousFieldName}\"] + datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"max_${continuousFieldName}\"])`,\n as: `upper_whisker_${continuousFieldName}`\n },\n {\n calculate: `max(datum[\"lower_box_${continuousFieldName}\"] - datum[\"iqr_${continuousFieldName}\"] * ${extent}, datum[\"min_${continuousFieldName}\"])`,\n as: `lower_whisker_${continuousFieldName}`\n }\n ];\n\n const {[continuousAxis]: oldContinuousAxisChannelDef, ...oldEncodingWithoutContinuousAxis} = spec.encoding;\n const {customTooltipWithoutAggregatedField, filteredEncoding} = filterTooltipWithAggregatedField(\n oldEncodingWithoutContinuousAxis\n );\n\n const {\n bins,\n timeUnits,\n aggregate,\n groupby,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(filteredEncoding, config);\n\n const ticksOrient: Orientation = orient === 'vertical' ? 'horizontal' : 'vertical';\n const boxOrient: Orientation = orient;\n\n const transform: Transform[] = [\n ...bins,\n ...timeUnits,\n {\n aggregate: [...aggregate, ...boxplotSpecificAggregate],\n groupby\n },\n ...postAggregateCalculates\n ];\n\n return {\n bins,\n timeUnits,\n transform,\n groupby,\n aggregate,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n boxOrient,\n customTooltipWithoutAggregatedField\n };\n}\n","import {AggregateOp, Orientation, SignalRef, Text} from 'vega';\nimport {PositionChannel} from '../channel';\nimport {\n Field,\n isContinuousFieldOrDatumDef,\n isFieldOrDatumDef,\n PositionFieldDef,\n SecondaryFieldDef,\n title,\n ValueDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {Data} from '../data';\nimport {Encoding, extractTransformsFromEncoding, normalizeEncoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {isMarkDef, MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {Step} from '../spec/base';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {TitleParams} from '../title';\nimport {AggregatedFieldDef, CalculateTransform, Transform} from '../transform';\nimport {replaceAll, titleCase} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {\n compositeMarkContinuousAxis,\n compositeMarkOrient,\n CompositeMarkTooltipSummary,\n GenericCompositeMarkDef,\n getCompositeMarkTooltip,\n makeCompositeAggregatePartFactory,\n PartsMixins\n} from './common';\nimport {ErrorBand, ErrorBandDef} from './errorband';\n\nexport const ERRORBAR = 'errorbar' as const;\nexport type ErrorBar = typeof ERRORBAR;\n\nexport type ErrorBarExtent = 'ci' | 'iqr' | 'stderr' | 'stdev';\nexport type ErrorBarCenter = 'mean' | 'median';\n\nexport type ErrorInputType = 'raw' | 'aggregated-upper-lower' | 'aggregated-error';\n\nexport const ERRORBAR_PARTS = ['ticks', 'rule'] as const;\n\nexport type ErrorBarPart = (typeof ERRORBAR_PARTS)[number];\n\nexport interface ErrorExtraEncoding {\n /**\n * Error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n xError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of x coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `xError2` cannot have type as it should have the same type as `xError`\n xError2?: SecondaryFieldDef | ValueDef;\n\n /**\n * Error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n yError?: SecondaryFieldDef | ValueDef;\n\n /**\n * Secondary error value of y coordinates for error specified `\"errorbar\"` and `\"errorband\"`.\n */\n // `yError2` cannot have type as it should have the same type as `yError`\n yError2?: SecondaryFieldDef | ValueDef;\n}\n\nexport type ErrorEncoding = Pick, PositionChannel | 'color' | 'detail' | 'opacity'> &\n ErrorExtraEncoding;\n\nexport type ErrorBarPartsMixins = PartsMixins;\n\nexport interface ErrorBarConfig extends ErrorBarPartsMixins {\n /** Size of the ticks of an error bar */\n size?: number;\n\n /** Thickness of the ticks and the bar of an error bar */\n thickness?: number;\n\n /**\n * The center of the errorbar. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the rule. Available options include:\n * - `\"ci\"`: Extend the rule to the confidence interval of the mean.\n * - `\"stderr\"`: The size of rule are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of rule are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the rule to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n}\n\nexport type ErrorBarDef = GenericCompositeMarkDef &\n ErrorBarConfig & {\n /**\n * Orientation of the error bar. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBarConfigMixins {\n /**\n * ErrorBar Config\n */\n errorbar?: ErrorBarConfig;\n}\n\nexport const errorBarNormalizer = new CompositeMarkNormalizer(ERRORBAR, normalizeErrorBar);\n\nexport function normalizeErrorBar(\n spec: GenericUnitSpec, ErrorBar | ErrorBarDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec | NormalizedUnitSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAR, config);\n delete encodingWithoutContinuousAxis['size'];\n\n const makeErrorBarPart = makeCompositeAggregatePartFactory(\n markDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorbar\n );\n\n const thickness = markDef.thickness;\n const size = markDef.size;\n const tick: MarkDef = {\n type: 'tick',\n orient: ticksOrient,\n aria: false,\n ...(thickness !== undefined ? {thickness} : {}),\n ...(size !== undefined ? {size} : {})\n };\n\n const layer = [\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'lower',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'ticks',\n mark: tick,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBarPart({\n partName: 'rule',\n mark: {\n type: 'rule',\n ariaRoleDescription: 'errorbar',\n ...(thickness !== undefined ? {size: thickness} : {})\n },\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ];\n\n return {\n ...outerSpec,\n transform,\n ...(layer.length > 1 ? {layer} : {...layer[0]})\n };\n}\n\nfunction errorBarOrientAndInputType(\n spec: GenericUnitSpec, ErrorBar | ErrorBand | ErrorBarDef | ErrorBandDef>,\n compositeMark: ErrorBar | ErrorBand\n): {\n orient: Orientation;\n inputType: ErrorInputType;\n} {\n const {encoding} = spec;\n\n if (errorBarIsInputTypeRaw(encoding)) {\n return {\n orient: compositeMarkOrient(spec, compositeMark),\n inputType: 'raw'\n };\n }\n\n const isTypeAggregatedUpperLower: boolean = errorBarIsInputTypeAggregatedUpperLower(encoding);\n const isTypeAggregatedError: boolean = errorBarIsInputTypeAggregatedError(encoding);\n const x = encoding.x;\n const y = encoding.y;\n\n if (isTypeAggregatedUpperLower) {\n // type is aggregated-upper-lower\n\n if (isTypeAggregatedError) {\n throw new Error(`${compositeMark} cannot be both type aggregated-upper-lower and aggregated-error`);\n }\n\n const x2 = encoding.x2;\n const y2 = encoding.y2;\n\n if (isFieldOrDatumDef(x2) && isFieldOrDatumDef(y2)) {\n // having both x, x2 and y, y2\n throw new Error(`${compositeMark} cannot have both x2 and y2`);\n } else if (isFieldOrDatumDef(x2)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x, x2 quantitative and field y, y2 are not specified\n return {orient: 'horizontal', inputType: 'aggregated-upper-lower'};\n } else {\n // having x, x2 that are not both quantitative\n throw new Error(`Both x and x2 have to be quantitative in ${compositeMark}`);\n }\n } else if (isFieldOrDatumDef(y2)) {\n // y2 is a FieldDef\n if (isContinuousFieldOrDatumDef(y)) {\n // having y, y2 quantitative and field x, x2 are not specified\n return {orient: 'vertical', inputType: 'aggregated-upper-lower'};\n } else {\n // having y, y2 that are not both quantitative\n throw new Error(`Both y and y2 have to be quantitative in ${compositeMark}`);\n }\n }\n throw new Error('No ranged axis');\n } else {\n // type is aggregated-error\n\n const xError = encoding.xError;\n const xError2 = encoding.xError2;\n const yError = encoding.yError;\n const yError2 = encoding.yError2;\n\n if (isFieldOrDatumDef(xError2) && !isFieldOrDatumDef(xError)) {\n // having xError2 without xError\n throw new Error(`${compositeMark} cannot have xError2 without xError`);\n }\n\n if (isFieldOrDatumDef(yError2) && !isFieldOrDatumDef(yError)) {\n // having yError2 without yError\n throw new Error(`${compositeMark} cannot have yError2 without yError`);\n }\n\n if (isFieldOrDatumDef(xError) && isFieldOrDatumDef(yError)) {\n // having both xError and yError\n throw new Error(`${compositeMark} cannot have both xError and yError with both are quantiative`);\n } else if (isFieldOrDatumDef(xError)) {\n if (isContinuousFieldOrDatumDef(x)) {\n // having x and xError that are all quantitative\n return {orient: 'horizontal', inputType: 'aggregated-error'};\n } else {\n // having x, xError, and xError2 that are not all quantitative\n throw new Error('All x, xError, and xError2 (if exist) have to be quantitative');\n }\n } else if (isFieldOrDatumDef(yError)) {\n if (isContinuousFieldOrDatumDef(y)) {\n // having y and yError that are all quantitative\n return {orient: 'vertical', inputType: 'aggregated-error'};\n } else {\n // having y, yError, and yError2 that are not all quantitative\n throw new Error('All y, yError, and yError2 (if exist) have to be quantitative');\n }\n }\n throw new Error('No ranged axis');\n }\n}\n\nfunction errorBarIsInputTypeRaw(encoding: ErrorEncoding): boolean {\n return (\n (isFieldOrDatumDef(encoding.x) || isFieldOrDatumDef(encoding.y)) &&\n !isFieldOrDatumDef(encoding.x2) &&\n !isFieldOrDatumDef(encoding.y2) &&\n !isFieldOrDatumDef(encoding.xError) &&\n !isFieldOrDatumDef(encoding.xError2) &&\n !isFieldOrDatumDef(encoding.yError) &&\n !isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nfunction errorBarIsInputTypeAggregatedUpperLower(encoding: ErrorEncoding): boolean {\n return isFieldOrDatumDef(encoding.x2) || isFieldOrDatumDef(encoding.y2);\n}\n\nfunction errorBarIsInputTypeAggregatedError(encoding: ErrorEncoding): boolean {\n return (\n isFieldOrDatumDef(encoding.xError) ||\n isFieldOrDatumDef(encoding.xError2) ||\n isFieldOrDatumDef(encoding.yError) ||\n isFieldOrDatumDef(encoding.yError2)\n );\n}\n\nexport function errorBarParams<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n spec: GenericUnitSpec, M | MD>,\n compositeMark: M,\n config: Config\n): {\n transform: Transform[];\n groupby: string[];\n continuousAxisChannelDef: PositionFieldDef;\n continuousAxis: 'x' | 'y';\n encodingWithoutContinuousAxis: ErrorEncoding;\n ticksOrient: Orientation;\n markDef: MD;\n outerSpec: {\n data?: Data;\n title?: Text | TitleParams;\n name?: string;\n description?: string;\n transform?: Transform[];\n width?: number | 'container' | Step;\n height?: number | 'container' | Step;\n };\n tooltipEncoding: ErrorEncoding;\n} {\n // TODO: use selection\n const {mark, encoding, params, projection: _p, ...outerSpec} = spec;\n const markDef: MD = isMarkDef(mark) ? mark : ({type: mark} as MD);\n\n // TODO(https://github.com/vega/vega-lite/issues/3702): add selection support\n if (params) {\n log.warn(log.message.selectionNotSupported(compositeMark));\n }\n\n const {orient, inputType} = errorBarOrientAndInputType(spec, compositeMark);\n const {\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n continuousAxis\n } = compositeMarkContinuousAxis(spec, orient, compositeMark);\n\n const {errorBarSpecificAggregate, postAggregateCalculates, tooltipSummary, tooltipTitleWithFieldName} =\n errorBarAggregationAndCalculation(\n markDef,\n continuousAxisChannelDef,\n continuousAxisChannelDef2,\n continuousAxisChannelDefError,\n continuousAxisChannelDefError2,\n inputType,\n compositeMark,\n config\n );\n\n const {\n [continuousAxis]: oldContinuousAxisChannelDef,\n [continuousAxis === 'x' ? 'x2' : 'y2']: oldContinuousAxisChannelDef2,\n [continuousAxis === 'x' ? 'xError' : 'yError']: oldContinuousAxisChannelDefError,\n [continuousAxis === 'x' ? 'xError2' : 'yError2']: oldContinuousAxisChannelDefError2,\n ...oldEncodingWithoutContinuousAxis\n } = encoding;\n\n const {\n bins,\n timeUnits,\n aggregate: oldAggregate,\n groupby: oldGroupBy,\n encoding: encodingWithoutContinuousAxis\n } = extractTransformsFromEncoding(oldEncodingWithoutContinuousAxis, config);\n\n const aggregate: AggregatedFieldDef[] = [...oldAggregate, ...errorBarSpecificAggregate];\n const groupby: string[] = inputType !== 'raw' ? [] : oldGroupBy;\n\n const tooltipEncoding: ErrorEncoding = getCompositeMarkTooltip(\n tooltipSummary,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n tooltipTitleWithFieldName\n );\n\n return {\n transform: [\n ...(outerSpec.transform ?? []),\n ...bins,\n ...timeUnits,\n ...(aggregate.length === 0 ? [] : [{aggregate, groupby}]),\n ...postAggregateCalculates\n ],\n groupby,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n ticksOrient: orient === 'vertical' ? 'horizontal' : 'vertical',\n markDef,\n outerSpec,\n tooltipEncoding\n };\n}\n\nfunction errorBarAggregationAndCalculation<\n M extends ErrorBar | ErrorBand,\n MD extends GenericCompositeMarkDef & (ErrorBarDef | ErrorBandDef)\n>(\n markDef: MD,\n continuousAxisChannelDef: PositionFieldDef,\n continuousAxisChannelDef2: SecondaryFieldDef,\n continuousAxisChannelDefError: SecondaryFieldDef,\n continuousAxisChannelDefError2: SecondaryFieldDef,\n inputType: ErrorInputType,\n compositeMark: M,\n config: Config\n): {\n postAggregateCalculates: CalculateTransform[];\n errorBarSpecificAggregate: AggregatedFieldDef[];\n tooltipSummary: CompositeMarkTooltipSummary[];\n tooltipTitleWithFieldName: boolean;\n} {\n let errorBarSpecificAggregate: AggregatedFieldDef[] = [];\n let postAggregateCalculates: CalculateTransform[] = [];\n const continuousFieldName: string = continuousAxisChannelDef.field;\n\n let tooltipSummary: CompositeMarkTooltipSummary[];\n let tooltipTitleWithFieldName = false;\n\n if (inputType === 'raw') {\n const center: ErrorBarCenter = markDef.center\n ? markDef.center\n : markDef.extent\n ? markDef.extent === 'iqr'\n ? 'median'\n : 'mean'\n : config.errorbar.center;\n const extent: ErrorBarExtent = markDef.extent ? markDef.extent : center === 'mean' ? 'stderr' : 'iqr';\n\n if ((center === 'median') !== (extent === 'iqr')) {\n log.warn(log.message.errorBarCenterIsUsedWithWrongExtent(center, extent, compositeMark));\n }\n\n if (extent === 'stderr' || extent === 'stdev') {\n errorBarSpecificAggregate = [\n {op: extent, field: continuousFieldName, as: `extent_${continuousFieldName}`},\n {op: center, field: continuousFieldName, as: `center_${continuousFieldName}`}\n ];\n\n postAggregateCalculates = [\n {\n calculate: `datum[\"center_${continuousFieldName}\"] + datum[\"extent_${continuousFieldName}\"]`,\n as: `upper_${continuousFieldName}`\n },\n {\n calculate: `datum[\"center_${continuousFieldName}\"] - datum[\"extent_${continuousFieldName}\"]`,\n as: `lower_${continuousFieldName}`\n }\n ];\n\n tooltipSummary = [\n {fieldPrefix: 'center_', titlePrefix: titleCase(center)},\n {fieldPrefix: 'upper_', titlePrefix: getTitlePrefix(center, extent, '+')},\n {fieldPrefix: 'lower_', titlePrefix: getTitlePrefix(center, extent, '-')}\n ];\n tooltipTitleWithFieldName = true;\n } else {\n let centerOp: AggregateOp;\n let lowerExtentOp: AggregateOp;\n let upperExtentOp: AggregateOp;\n if (extent === 'ci') {\n centerOp = 'mean';\n lowerExtentOp = 'ci0';\n upperExtentOp = 'ci1';\n } else {\n centerOp = 'median';\n lowerExtentOp = 'q1';\n upperExtentOp = 'q3';\n }\n\n errorBarSpecificAggregate = [\n {op: lowerExtentOp, field: continuousFieldName, as: `lower_${continuousFieldName}`},\n {op: upperExtentOp, field: continuousFieldName, as: `upper_${continuousFieldName}`},\n {op: centerOp, field: continuousFieldName, as: `center_${continuousFieldName}`}\n ];\n\n tooltipSummary = [\n {\n fieldPrefix: 'upper_',\n titlePrefix: title({field: continuousFieldName, aggregate: upperExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'lower_',\n titlePrefix: title({field: continuousFieldName, aggregate: lowerExtentOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n },\n {\n fieldPrefix: 'center_',\n titlePrefix: title({field: continuousFieldName, aggregate: centerOp, type: 'quantitative'}, config, {\n allowDisabling: false\n })\n }\n ];\n }\n } else {\n if (markDef.center || markDef.extent) {\n log.warn(log.message.errorBarCenterAndExtentAreNotNeeded(markDef.center, markDef.extent));\n }\n\n if (inputType === 'aggregated-upper-lower') {\n tooltipSummary = [];\n postAggregateCalculates = [\n {calculate: `datum[\"${continuousAxisChannelDef2.field}\"]`, as: `upper_${continuousFieldName}`},\n {calculate: `datum[\"${continuousFieldName}\"]`, as: `lower_${continuousFieldName}`}\n ];\n } else if (inputType === 'aggregated-error') {\n tooltipSummary = [{fieldPrefix: '', titlePrefix: continuousFieldName}];\n postAggregateCalculates = [\n {\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `upper_${continuousFieldName}`\n }\n ];\n\n if (continuousAxisChannelDefError2) {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] + datum[\"${continuousAxisChannelDefError2.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n } else {\n postAggregateCalculates.push({\n calculate: `datum[\"${continuousFieldName}\"] - datum[\"${continuousAxisChannelDefError.field}\"]`,\n as: `lower_${continuousFieldName}`\n });\n }\n }\n\n for (const postAggregateCalculate of postAggregateCalculates) {\n tooltipSummary.push({\n fieldPrefix: postAggregateCalculate.as.substring(0, 6),\n titlePrefix: replaceAll(replaceAll(postAggregateCalculate.calculate, 'datum[\"', ''), '\"]', '')\n });\n }\n }\n return {postAggregateCalculates, errorBarSpecificAggregate, tooltipSummary, tooltipTitleWithFieldName};\n}\n\nfunction getTitlePrefix(center: ErrorBarCenter, extent: ErrorBarExtent, operation: '+' | '-'): string {\n return `${titleCase(center)} ${operation} ${extent}`;\n}\n","import {Interpolate, Orientation} from 'vega';\nimport {Field} from '../channeldef';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport * as log from '../log';\nimport {MarkDef} from '../mark';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {CompositeMarkNormalizer} from './base';\nimport {GenericCompositeMarkDef, makeCompositeAggregatePartFactory, PartsMixins} from './common';\nimport {ErrorBarCenter, ErrorBarExtent, errorBarParams, ErrorEncoding} from './errorbar';\n\nexport type ErrorBandUnitSpec<\n EE = undefined // extra encoding parameter (for faceted composite unit spec)\n> = GenericUnitSpec & EE, ErrorBand | ErrorBandDef>;\n\nexport const ERRORBAND = 'errorband' as const;\nexport type ErrorBand = typeof ERRORBAND;\n\nexport const ERRORBAND_PARTS = ['band', 'borders'] as const;\n\ntype ErrorBandPart = (typeof ERRORBAND_PARTS)[number];\n\nexport type ErrorBandPartsMixins = PartsMixins;\n\nexport interface ErrorBandConfig extends ErrorBandPartsMixins {\n /**\n * The center of the error band. Available options include:\n * - `\"mean\"`: the mean of the data points.\n * - `\"median\"`: the median of the data points.\n *\n * __Default value:__ `\"mean\"`.\n * @hidden\n */\n\n // center is not needed right now but will be added back to the schema if future features require it.\n center?: ErrorBarCenter;\n\n /**\n * The extent of the band. Available options include:\n * - `\"ci\"`: Extend the band to the confidence interval of the mean.\n * - `\"stderr\"`: The size of band are set to the value of standard error, extending from the mean.\n * - `\"stdev\"`: The size of band are set to the value of standard deviation, extending from the mean.\n * - `\"iqr\"`: Extend the band to the q1 and q3.\n *\n * __Default value:__ `\"stderr\"`.\n */\n extent?: ErrorBarExtent;\n\n /**\n * The line interpolation method for the error band. One of the following:\n * - `\"linear\"`: piecewise linear segments, as in a polyline.\n * - `\"linear-closed\"`: close the linear segments to form a polygon.\n * - `\"step\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes at the midpoint of each pair of adjacent x-values.\n * - `\"step-before\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes before the x-value.\n * - `\"step-after\"`: a piecewise constant function (a step function) consisting of alternating horizontal and vertical lines. The y-value changes after the x-value.\n * - `\"basis\"`: a B-spline, with control point duplication on the ends.\n * - `\"basis-open\"`: an open B-spline; may not intersect the start or end.\n * - `\"basis-closed\"`: a closed B-spline, as in a loop.\n * - `\"cardinal\"`: a Cardinal spline, with control point duplication on the ends.\n * - `\"cardinal-open\"`: an open Cardinal spline; may not intersect the start or end, but will intersect other control points.\n * - `\"cardinal-closed\"`: a closed Cardinal spline, as in a loop.\n * - `\"bundle\"`: equivalent to basis, except the tension parameter is used to straighten the spline.\n * - `\"monotone\"`: cubic interpolation that preserves monotonicity in y.\n */\n interpolate?: Interpolate;\n\n /**\n * The tension parameter for the interpolation type of the error band.\n *\n * @minimum 0\n * @maximum 1\n */\n tension?: number;\n}\n\nexport type ErrorBandDef = GenericCompositeMarkDef &\n ErrorBandConfig & {\n /**\n * Orientation of the error band. This is normally automatically determined, but can be specified when the orientation is ambiguous and cannot be automatically determined.\n */\n orient?: Orientation;\n };\n\nexport interface ErrorBandConfigMixins {\n /**\n * ErrorBand Config\n */\n errorband?: ErrorBandConfig;\n}\n\nexport const errorBandNormalizer = new CompositeMarkNormalizer(ERRORBAND, normalizeErrorBand);\n\nexport function normalizeErrorBand(\n spec: GenericUnitSpec, ErrorBand | ErrorBandDef>,\n {config}: NormalizerParams\n): NormalizedLayerSpec {\n // Need to initEncoding first so we can infer type\n spec = {\n ...spec,\n encoding: normalizeEncoding(spec.encoding, config)\n };\n\n const {\n transform,\n continuousAxisChannelDef,\n continuousAxis,\n encodingWithoutContinuousAxis,\n markDef,\n outerSpec,\n tooltipEncoding\n } = errorBarParams(spec, ERRORBAND, config);\n const errorBandDef: ErrorBandDef = markDef;\n\n const makeErrorBandPart = makeCompositeAggregatePartFactory(\n errorBandDef,\n continuousAxis,\n continuousAxisChannelDef,\n encodingWithoutContinuousAxis,\n config.errorband\n );\n\n const is2D = spec.encoding.x !== undefined && spec.encoding.y !== undefined;\n\n let bandMark: MarkDef = {type: is2D ? 'area' : 'rect'};\n let bordersMark: MarkDef = {type: is2D ? 'line' : 'rule'};\n const interpolate = {\n ...(errorBandDef.interpolate ? {interpolate: errorBandDef.interpolate} : {}),\n ...(errorBandDef.tension && errorBandDef.interpolate ? {tension: errorBandDef.tension} : {})\n };\n\n if (is2D) {\n bandMark = {\n ...bandMark,\n ...interpolate,\n ariaRoleDescription: 'errorband'\n };\n bordersMark = {\n ...bordersMark,\n ...interpolate,\n aria: false\n };\n } else if (errorBandDef.interpolate) {\n log.warn(log.message.errorBand1DNotSupport('interpolate'));\n } else if (errorBandDef.tension) {\n log.warn(log.message.errorBand1DNotSupport('tension'));\n }\n\n return {\n ...outerSpec,\n transform,\n layer: [\n ...makeErrorBandPart({\n partName: 'band',\n mark: bandMark,\n positionPrefix: 'lower',\n endPositionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'lower',\n\n extraEncoding: tooltipEncoding\n }),\n ...makeErrorBandPart({\n partName: 'borders',\n mark: bordersMark,\n positionPrefix: 'upper',\n extraEncoding: tooltipEncoding\n })\n ]\n };\n}\n","import {Field} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport {NormalizerParams} from '../normalize';\nimport {GenericUnitSpec, NormalizedLayerSpec} from '../spec';\nimport {EncodingFacetMapping} from '../spec/facet';\nimport {NormalizedUnitSpec} from '../spec/unit';\nimport {keys} from '../util';\nimport {CompositeMarkNormalizer} from './base';\nimport {BOXPLOT, BoxPlot, BoxPlotConfigMixins, BoxPlotDef, BOXPLOT_PARTS, normalizeBoxPlot} from './boxplot';\nimport {\n ERRORBAND,\n ErrorBand,\n ErrorBandConfigMixins,\n ErrorBandDef,\n ERRORBAND_PARTS,\n normalizeErrorBand\n} from './errorband';\nimport {\n ERRORBAR,\n ErrorBar,\n ErrorBarConfigMixins,\n ErrorBarDef,\n ERRORBAR_PARTS,\n ErrorExtraEncoding,\n normalizeErrorBar\n} from './errorbar';\n\nexport type {BoxPlotConfig} from './boxplot';\nexport type {ErrorBandConfigMixins} from './errorband';\nexport type {ErrorBarConfigMixins} from './errorbar';\n\nexport type CompositeMarkNormalizerRun = (\n spec: GenericUnitSpec,\n params: NormalizerParams\n) => NormalizedLayerSpec | NormalizedUnitSpec;\n\n/**\n * Registry index for all composite mark's normalizer\n */\nconst compositeMarkRegistry: {\n [mark: string]: {\n normalizer: CompositeMarkNormalizer;\n parts: readonly string[];\n };\n} = {};\n\nexport function add(mark: string, run: CompositeMarkNormalizerRun, parts: readonly string[]) {\n const normalizer = new CompositeMarkNormalizer(mark, run);\n compositeMarkRegistry[mark] = {normalizer, parts};\n}\n\nexport function remove(mark: string) {\n delete compositeMarkRegistry[mark];\n}\n\nexport type CompositeEncoding = Encoding & ErrorExtraEncoding;\n\nexport type PartialIndex> = {\n [t in keyof T]?: Partial;\n};\n\nexport type SharedCompositeEncoding = PartialIndex<\n Omit, 'detail' | 'order' | 'tooltip'> // need to omit and cherry pick detail / order / tooltip since they allow array\n> &\n Pick, 'detail' | 'order' | 'tooltip'>;\n\nexport type FacetedCompositeEncoding = Encoding & ErrorExtraEncoding & EncodingFacetMapping;\n\nexport type CompositeMark = BoxPlot | ErrorBar | ErrorBand;\n\nexport function getAllCompositeMarks() {\n return keys(compositeMarkRegistry);\n}\n\nexport type CompositeMarkDef = BoxPlotDef | ErrorBarDef | ErrorBandDef;\n\nexport type CompositeAggregate = BoxPlot | ErrorBar | ErrorBand;\n\nexport interface CompositeMarkConfigMixins extends BoxPlotConfigMixins, ErrorBarConfigMixins, ErrorBandConfigMixins {}\n\nadd(BOXPLOT, normalizeBoxPlot, BOXPLOT_PARTS);\nadd(ERRORBAR, normalizeErrorBar, ERRORBAR_PARTS);\nadd(ERRORBAND, normalizeErrorBand, ERRORBAND_PARTS);\n","import {SignalRef, Text} from 'vega';\nimport {ConditionValueDefMixins, FormatMixins, ValueDef} from './channeldef';\nimport {LegendConfig} from './legend';\nimport {VgEncodeChannel} from './vega.schema';\n\nexport interface TitleMixins {\n /**\n * A title for the field. If `null`, the title will be removed.\n *\n * __Default value:__ derived from the field's name and transformation function (`aggregate`, `bin` and `timeUnit`). If the field has an aggregate function, the function is displayed as part of the title (e.g., `\"Sum of Profit\"`). If the field is binned or has a time unit applied, the applied function is shown in parentheses (e.g., `\"Profit (binned)\"`, `\"Transaction Date (year-month)\"`). Otherwise, the title is simply the field name.\n *\n * __Notes__:\n *\n * 1) You can customize the default field title format by providing the [`fieldTitle`](https://vega.github.io/vega-lite/docs/config.html#top-level-config) property in the [config](https://vega.github.io/vega-lite/docs/config.html) or [`fieldTitle` function via the `compile` function's options](https://vega.github.io/vega-lite/usage/compile.html#field-title).\n *\n * 2) If both field definition's `title` and axis, header, or legend `title` are defined, axis/header/legend title will be used.\n */\n title?: Text | null | SignalRef;\n}\n\nexport interface Guide extends TitleMixins, FormatMixins {}\n\nexport interface VlOnlyGuideConfig {\n /**\n * Set to null to disable title for the axis, legend, or header.\n */\n title?: null;\n}\n\nexport type GuideEncodingConditionalValueDef = ValueDef & ConditionValueDefMixins;\n\nexport type GuideEncodingEntry = Partial>;\n\nexport const VL_ONLY_LEGEND_CONFIG: (keyof LegendConfig)[] = [\n 'gradientHorizontalMaxLength',\n 'gradientHorizontalMinLength',\n 'gradientVerticalMaxLength',\n 'gradientVerticalMinLength',\n 'unselectedOpacity'\n];\n","import {Align, Color, FontStyle, FontWeight, Orient, SignalRef, TextBaseline, TitleAnchor, TitleConfig} from 'vega';\nimport {FormatMixins} from './channeldef';\nimport {ExprRef} from './expr';\nimport {Guide, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\n\nexport const HEADER_TITLE_PROPERTIES_MAP: Partial, keyof TitleConfig>> = {\n titleAlign: 'align',\n titleAnchor: 'anchor',\n titleAngle: 'angle',\n titleBaseline: 'baseline',\n titleColor: 'color',\n titleFont: 'font',\n titleFontSize: 'fontSize',\n titleFontStyle: 'fontStyle',\n titleFontWeight: 'fontWeight',\n titleLimit: 'limit',\n titleLineHeight: 'lineHeight',\n titleOrient: 'orient',\n titlePadding: 'offset'\n};\n\nexport const HEADER_LABEL_PROPERTIES_MAP: Partial, keyof TitleConfig>> = {\n labelAlign: 'align',\n labelAnchor: 'anchor',\n labelAngle: 'angle',\n labelBaseline: 'baseline',\n labelColor: 'color',\n labelFont: 'font',\n labelFontSize: 'fontSize',\n labelFontStyle: 'fontStyle',\n labelFontWeight: 'fontWeight',\n labelLimit: 'limit',\n labelLineHeight: 'lineHeight',\n labelOrient: 'orient',\n labelPadding: 'offset'\n};\n\nexport const HEADER_TITLE_PROPERTIES = keys(HEADER_TITLE_PROPERTIES_MAP);\n\nexport const HEADER_LABEL_PROPERTIES = keys(HEADER_LABEL_PROPERTIES_MAP);\n\nexport interface CoreHeader extends FormatMixins {\n // ---------- Title ----------\n /**\n * The anchor position for placing the title. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with an orientation of top these anchor positions map to a left-, center-, or right-aligned title.\n */\n titleAnchor?: TitleAnchor; // We don't allow signal for titleAnchor since there is a dependent logic\n\n /**\n * Horizontal text alignment (to the anchor) of header titles.\n */\n titleAlign?: Align | ES;\n\n /**\n * The rotation angle of the header title.\n *\n * __Default value:__ `0`.\n *\n * @minimum -360\n * @maximum 360\n */\n titleAngle?: number; // We don't allow signal for titleAngle since there is a dependent logic\n\n /**\n * The vertical text baseline for the header title. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n * __Default value:__ `\"middle\"`\n */\n titleBaseline?: TextBaseline | ES;\n\n /**\n * Color of the header title, can be in hex color code or regular color name.\n */\n titleColor?: Color | ES;\n\n /**\n * Font of the header title. (e.g., `\"Helvetica Neue\"`).\n */\n titleFont?: string | ES;\n\n /**\n * Font size of the header title.\n *\n * @minimum 0\n */\n titleFontSize?: number | ES;\n\n /**\n * The font style of the header title.\n */\n titleFontStyle?: FontStyle | ES;\n\n /**\n * Font weight of the header title.\n * This can be either a string (e.g `\"bold\"`, `\"normal\"`) or a number (`100`, `200`, `300`, ..., `900` where `\"normal\"` = `400` and `\"bold\"` = `700`).\n */\n titleFontWeight?: FontWeight | ES;\n\n /**\n * The maximum length of the header title in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n titleLimit?: number | ES;\n\n /**\n * Line height in pixels for multi-line header title text or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n titleLineHeight?: number | ES;\n\n /**\n * The orientation of the header title. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n titleOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's title and the label.\n *\n * __Default value:__ `10`\n */\n titlePadding?: number | ES;\n\n // ---------- Label ----------\n\n /**\n * A boolean flag indicating if labels should be included as part of the header.\n *\n * __Default value:__ `true`.\n */\n labels?: boolean;\n\n /**\n * Horizontal text alignment of header labels. One of `\"left\"`, `\"center\"`, or `\"right\"`.\n */\n labelAlign?: Align | ES;\n\n /**\n * The vertical text baseline for the header labels. One of `\"alphabetic\"` (default), `\"top\"`, `\"middle\"`, `\"bottom\"`, `\"line-top\"`, or `\"line-bottom\"`.\n * The `\"line-top\"` and `\"line-bottom\"` values operate similarly to `\"top\"` and `\"bottom\"`, but are calculated relative to the `titleLineHeight` rather than `titleFontSize` alone.\n *\n */\n labelBaseline?: TextBaseline | ES;\n\n /**\n * The anchor position for placing the labels. One of `\"start\"`, `\"middle\"`, or `\"end\"`. For example, with a label orientation of top these anchor positions map to a left-, center-, or right-aligned label.\n */\n labelAnchor?: TitleAnchor;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the header's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The rotation angle of the header labels.\n *\n * __Default value:__ `0` for column header, `-90` for row header.\n *\n * @minimum -360\n * @maximum 360\n */\n labelAngle?: number; // no signal ref since there is a dependent logic\n\n /**\n * The color of the header label, can be in hex color code or regular color name.\n */\n labelColor?: Color | ES;\n\n /**\n * The font of the header label.\n */\n labelFont?: string | ES;\n\n /**\n * The font size of the header label, in pixels.\n *\n * @minimum 0\n */\n labelFontSize?: number | ES;\n\n /**\n * The font style of the header label.\n */\n labelFontStyle?: FontStyle | ES;\n\n /**\n * The font weight of the header label.\n */\n labelFontWeight?: FontWeight | ES;\n\n /**\n * The maximum length of the header label in pixels. The text value will be automatically truncated if the rendered size exceeds the limit.\n *\n * __Default value:__ `0`, indicating no limit\n */\n labelLimit?: number | ES;\n\n /**\n * Line height in pixels for multi-line header labels or title text with `\"line-top\"` or `\"line-bottom\"` baseline.\n */\n labelLineHeight?: number | ES;\n\n /**\n * The orientation of the header label. One of `\"top\"`, `\"bottom\"`, `\"left\"` or `\"right\"`.\n */\n labelOrient?: Orient; // no signal ref since there is a dependent logic\n\n /**\n * The padding, in pixel, between facet header's label and the plot.\n *\n * __Default value:__ `10`\n */\n labelPadding?: number | ES;\n\n /**\n * Shortcut for setting both labelOrient and titleOrient.\n */\n orient?: Orient; // no signal ref since there is a dependent logic\n}\n\nexport interface HeaderConfig extends CoreHeader, VlOnlyGuideConfig {}\n\n/**\n * Headers of row / column channels for faceted plots.\n */\nexport interface Header extends CoreHeader, Guide {}\n\nexport interface HeaderConfigMixins {\n /**\n * Header configuration, which determines default properties for all [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n header?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for row [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerRow?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for column [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerColumn?: HeaderConfig;\n\n /**\n * Header configuration, which determines default properties for non-row/column facet [headers](https://vega.github.io/vega-lite/docs/header.html).\n *\n * For a full list of header configuration options, please see the [corresponding section of in the header documentation](https://vega.github.io/vega-lite/docs/header.html#config).\n */\n headerFacet?: HeaderConfig;\n}\n\nconst HEADER_CONFIGS_INDEX: Flag> = {\n header: 1,\n headerRow: 1,\n headerColumn: 1,\n headerFacet: 1\n};\n\nexport const HEADER_CONFIGS = keys(HEADER_CONFIGS_INDEX);\n","import {\n BaseLegend,\n LabelOverlap,\n Legend as VgLegend,\n LegendConfig as VgLegendConfig,\n LegendOrient,\n Orientation,\n SignalRef\n} from 'vega';\nimport {DateTime} from './datetime';\nimport {ExprRef} from './expr';\nimport {Guide, GuideEncodingEntry, VlOnlyGuideConfig} from './guide';\nimport {Flag, keys} from './util';\nimport {MapExcludeValueRefAndReplaceSignalWith} from './vega.schema';\n\nexport const LEGEND_SCALE_CHANNELS = [\n 'size',\n 'shape',\n 'fill',\n 'stroke',\n 'strokeDash',\n 'strokeWidth',\n 'opacity'\n] as const;\n\ntype BaseLegendNoValueRefs = MapExcludeValueRefAndReplaceSignalWith;\n\nexport type LegendConfig = LegendMixins &\n VlOnlyGuideConfig &\n MapExcludeValueRefAndReplaceSignalWith & {\n /**\n * Max legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientVerticalMaxLength?: number;\n\n /**\n * Min legend length for a vertical gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientVerticalMinLength?: number;\n\n /**\n * Max legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `200`\n */\n gradientHorizontalMaxLength?: number;\n\n /**\n * Min legend length for a horizontal gradient when `config.legend.gradientLength` is undefined.\n *\n * __Default value:__ `100`\n */\n gradientHorizontalMinLength?: number;\n\n /**\n * The length in pixels of the primary axis of a color gradient. This value corresponds to the height of a vertical gradient or the width of a horizontal gradient.\n *\n * __Default value:__ `undefined`. If `undefined`, the default gradient will be determined based on the following rules:\n * - For vertical gradients, `clamp(plot_height, gradientVerticalMinLength, gradientVerticalMaxLength)`\n * - For top-`orient`ed or bottom-`orient`ed horizontal gradients, `clamp(plot_width, gradientHorizontalMinLength, gradientHorizontalMaxLength)`\n * - For other horizontal gradients, `gradientHorizontalMinLength`\n *\n * where `clamp(value, min, max)` restricts _value_ to be between the specified _min_ and _max_.\n * @minimum 0\n */\n gradientLength?: number;\n\n /**\n * The opacity of unselected legend entries.\n *\n * __Default value:__ 0.35.\n */\n unselectedOpacity?: number;\n\n /**\n * Disable legend by default\n */\n disable?: boolean;\n };\n\n/**\n * Properties of a legend or boolean flag for determining whether to show it.\n */\nexport interface Legend\n extends Omit, 'orient'>,\n LegendMixins,\n Guide {\n /**\n * Mark definitions for custom legend encoding.\n *\n * @hidden\n */\n encoding?: LegendEncoding;\n\n /**\n * [Vega expression](https://vega.github.io/vega/docs/expressions/) for customizing labels.\n *\n * __Note:__ The label text and value can be assessed via the `label` and `value` properties of the legend's backing `datum` object.\n */\n labelExpr?: string;\n\n /**\n * The minimum desired step between legend ticks, in terms of scale domain values. For example, a value of `1` indicates that ticks should not be less than 1 unit apart. If `tickMinStep` is specified, the `tickCount` value will be adjusted, if necessary, to enforce the minimum step value.\n *\n * __Default value__: `undefined`\n */\n tickMinStep?: number | ES;\n\n /**\n * Explicitly set the visible legend values.\n */\n values?: number[] | string[] | boolean[] | DateTime[] | ES; // Vega already supports Signal -- we have to re-declare here since VL supports special Date Time object that's not valid in Vega.\n\n /**\n * The type of the legend. Use `\"symbol\"` to create a discrete legend and `\"gradient\"` for a continuous color gradient.\n *\n * __Default value:__ `\"gradient\"` for non-binned quantitative fields and temporal fields; `\"symbol\"` otherwise.\n */\n type?: 'symbol' | 'gradient';\n\n /**\n * A non-negative integer indicating the z-index of the legend.\n * If zindex is 0, legend should be drawn behind all chart elements.\n * To put them in front, use zindex = 1.\n *\n * @TJS-type integer\n * @minimum 0\n */\n zindex?: number;\n}\n\n// Change comments to be Vega-Lite specific\ninterface LegendMixins {\n /**\n * The strategy to use for resolving overlap of labels in gradient legends. If `false`, no overlap reduction is attempted. If set to `true` or `\"parity\"`, a strategy of removing every other label is used. If set to `\"greedy\"`, a linear scan of the labels is performed, removing any label that overlaps with the last visible label (this often works better for log-scaled axes).\n *\n * __Default value:__ `\"greedy\"` for `log scales otherwise `true`.\n */\n labelOverlap?: LabelOverlap | ES; // override comment since our default differs from Vega\n\n /**\n * The direction of the legend, one of `\"vertical\"` or `\"horizontal\"`.\n *\n * __Default value:__\n * - For top-/bottom-`orient`ed legends, `\"horizontal\"`\n * - For left-/right-`orient`ed legends, `\"vertical\"`\n * - For top/bottom-left/right-`orient`ed legends, `\"horizontal\"` for gradient legends and `\"vertical\"` for symbol legends.\n */\n direction?: Orientation; // Omit SignalRef\n\n /**\n * The orientation of the legend, which determines how the legend is positioned within the scene. One of `\"left\"`, `\"right\"`, `\"top\"`, `\"bottom\"`, `\"top-left\"`, `\"top-right\"`, `\"bottom-left\"`, `\"bottom-right\"`, `\"none\"`.\n *\n * __Default value:__ `\"right\"`\n */\n orient?: LegendOrient; // Omit SignalRef\n}\n\nexport type LegendInternal = Legend;\n\nexport interface LegendEncoding {\n /**\n * Custom encoding for the legend container.\n * This can be useful for creating legend with custom x, y position.\n */\n legend?: GuideEncodingEntry;\n\n /**\n * Custom encoding for the legend title text mark.\n */\n title?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend label text marks.\n */\n labels?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend symbol marks.\n */\n symbols?: GuideEncodingEntry;\n\n /**\n * Custom encoding for legend gradient filled rect marks.\n */\n gradient?: GuideEncodingEntry;\n}\n\nexport const defaultLegendConfig: LegendConfig = {\n gradientHorizontalMaxLength: 200,\n gradientHorizontalMinLength: 100,\n gradientVerticalMaxLength: 200,\n gradientVerticalMinLength: 64, // This is Vega's minimum.\n unselectedOpacity: 0.35\n};\n\nexport const COMMON_LEGEND_PROPERTY_INDEX: Flag)> = {\n aria: 1,\n clipHeight: 1,\n columnPadding: 1,\n columns: 1,\n cornerRadius: 1,\n description: 1,\n direction: 1,\n fillColor: 1,\n format: 1,\n formatType: 1,\n gradientLength: 1,\n gradientOpacity: 1,\n gradientStrokeColor: 1,\n gradientStrokeWidth: 1,\n gradientThickness: 1,\n gridAlign: 1,\n labelAlign: 1,\n labelBaseline: 1,\n labelColor: 1,\n labelFont: 1,\n labelFontSize: 1,\n labelFontStyle: 1,\n labelFontWeight: 1,\n labelLimit: 1,\n labelOffset: 1,\n labelOpacity: 1,\n labelOverlap: 1,\n labelPadding: 1,\n labelSeparation: 1,\n legendX: 1,\n legendY: 1,\n offset: 1,\n orient: 1,\n padding: 1,\n rowPadding: 1,\n strokeColor: 1,\n symbolDash: 1,\n symbolDashOffset: 1,\n symbolFillColor: 1,\n symbolLimit: 1,\n symbolOffset: 1,\n symbolOpacity: 1,\n symbolSize: 1,\n symbolStrokeColor: 1,\n symbolStrokeWidth: 1,\n symbolType: 1,\n tickCount: 1,\n tickMinStep: 1,\n title: 1,\n titleAlign: 1,\n titleAnchor: 1,\n titleBaseline: 1,\n titleColor: 1,\n titleFont: 1,\n titleFontSize: 1,\n titleFontStyle: 1,\n titleFontWeight: 1,\n titleLimit: 1,\n titleLineHeight: 1,\n titleOpacity: 1,\n titleOrient: 1,\n titlePadding: 1,\n type: 1,\n values: 1,\n zindex: 1\n};\n\nexport const LEGEND_PROPERTIES = keys(COMMON_LEGEND_PROPERTY_INDEX);\n","import {Binding, Color, Cursor, Stream, Vector2} from 'vega';\nimport {isObject} from 'vega-util';\nimport {SingleDefUnitChannel} from './channel';\nimport {FieldName, PrimitiveValue} from './channeldef';\nimport {DateTime} from './datetime';\nimport {ParameterName} from './parameter';\nimport {Dict} from './util';\n\nexport const SELECTION_ID = '_vgsid_';\nexport type SelectionType = 'point' | 'interval';\nexport type SelectionResolution = 'global' | 'union' | 'intersect';\n\nexport type SelectionInit = PrimitiveValue | DateTime;\nexport type SelectionInitInterval = Vector2 | Vector2 | Vector2 | Vector2;\n\nexport type SelectionInitMapping = Dict;\nexport type SelectionInitIntervalMapping = Dict;\n\nexport type LegendStreamBinding = {legend: string | Stream};\nexport type LegendBinding = 'legend' | LegendStreamBinding;\n\nexport interface BaseSelectionConfig {\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:\n *\n * - `\"point\"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n type: T;\n\n /**\n * Clears the selection, emptying it of all values. This property can be a\n * [Event Stream](https://vega.github.io/vega/docs/event-streams/) or `false` to disable clear.\n *\n * __Default value:__ `dblclick`.\n *\n * __See also:__ [`clear` examples ](https://vega.github.io/vega-lite/docs/selection.html#clear) in the documentation.\n */\n clear?: Stream | string | boolean;\n\n /**\n * A [Vega event stream](https://vega.github.io/vega/docs/event-streams/) (object or selector) that triggers the selection.\n * For interval selections, the event stream must specify a [start and end](https://vega.github.io/vega/docs/event-streams/#between-filters).\n *\n * __See also:__ [`on` examples](https://vega.github.io/vega-lite/docs/selection.html#on) in the documentation.\n */\n on?: Stream | string;\n\n /**\n * With layered and multi-view displays, a strategy that determines how\n * selections' data queries are resolved when applied in a filter transform,\n * conditional encoding rule, or scale domain.\n *\n * One of:\n * - `\"global\"` -- only one brush exists for the entire SPLOM. When the user begins to drag, any previous brushes are cleared, and a new one is constructed.\n * - `\"union\"` -- each cell contains its own brush, and points are highlighted if they lie within _any_ of these individual brushes.\n * - `\"intersect\"` -- each cell contains its own brush, and points are highlighted only if they fall within _all_ of these individual brushes.\n *\n * __Default value:__ `global`.\n *\n * __See also:__ [`resolve` examples](https://vega.github.io/vega-lite/docs/selection.html#resolve) in the documentation.\n */\n resolve?: SelectionResolution;\n\n // TODO(https://github.com/vega/vega-lite/issues/2596).\n // predicate?: string;\n // domain?: SelectionDomain;\n\n /**\n * An array of encoding channels. The corresponding data field values\n * must match for a data tuple to fall within the selection.\n *\n * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.\n */\n encodings?: SingleDefUnitChannel[];\n\n /**\n * An array of field names whose values must match for a data tuple to\n * fall within the selection.\n *\n * __See also:__ The [projection with `encodings` and `fields` section](https://vega.github.io/vega-lite/docs/selection.html#project) in the documentation.\n */\n fields?: FieldName[];\n}\n\nexport interface PointSelectionConfig extends BaseSelectionConfig<'point'> {\n /**\n * Controls whether data values should be toggled (inserted or removed from a point selection)\n * or only ever inserted into point selections.\n *\n * One of:\n * - `true` -- the default behavior, which corresponds to `\"event.shiftKey\"`. As a result, data values are toggled when the user interacts with the shift-key pressed.\n * - `false` -- disables toggling behaviour; the selection will only ever contain a single data value corresponding to the most recent interaction.\n * - A [Vega expression](https://vega.github.io/vega/docs/expressions/) which is re-evaluated as the user interacts. If the expression evaluates to `true`, the data value is toggled into or out of the point selection. If the expression evaluates to `false`, the point selection is first cleared, and the data value is then inserted. For example, setting the value to the Vega expression `\"true\"` will toggle data values\n * without the user pressing the shift-key.\n *\n * __Default value:__ `true`\n *\n * __See also:__ [`toggle` examples](https://vega.github.io/vega-lite/docs/selection.html#toggle) in the documentation.\n */\n toggle?: string | boolean;\n\n /**\n * When true, an invisible voronoi diagram is computed to accelerate discrete\n * selection. The data value _nearest_ the mouse cursor is added to the selection.\n *\n * __Default value:__ `false`, which means that data values must be interacted with directly (e.g., clicked on) to be added to the selection.\n *\n * __See also:__ [`nearest` examples](https://vega.github.io/vega-lite/docs/selection.html#nearest) documentation.\n */\n nearest?: boolean;\n}\n\n// Similar to BaseMarkConfig but the field documentations are specificly for an interval mark.\nexport interface BrushConfig {\n /**\n * The fill color of the interval mark.\n *\n * __Default value:__ `\"#333333\"`\n *\n */\n fill?: Color;\n\n /**\n * The fill opacity of the interval mark (a value between `0` and `1`).\n *\n * __Default value:__ `0.125`\n */\n fillOpacity?: number;\n\n /**\n * The stroke color of the interval mark.\n *\n * __Default value:__ `\"#ffffff\"`\n */\n stroke?: Color;\n\n /**\n * The stroke opacity of the interval mark (a value between `0` and `1`).\n */\n strokeOpacity?: number;\n\n /**\n * The stroke width of the interval mark.\n */\n strokeWidth?: number;\n\n /**\n * An array of alternating stroke and space lengths, for creating dashed or dotted lines.\n */\n strokeDash?: number[];\n\n /**\n * The offset (in pixels) with which to begin drawing the stroke dash array.\n */\n strokeDashOffset?: number;\n\n /**\n * The mouse cursor used over the interval mark. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface IntervalSelectionConfig extends BaseSelectionConfig<'interval'> {\n /**\n * When truthy, allows a user to interactively move an interval selection\n * back-and-forth. Can be `true`, `false` (to disable panning), or a\n * [Vega event stream definition](https://vega.github.io/vega/docs/event-streams/)\n * which must include a start and end event to trigger continuous panning.\n * Discrete panning (e.g., pressing the left/right arrow keys) will be supported in future versions.\n *\n * __Default value:__ `true`, which corresponds to `[pointerdown, window:pointerup] > window:pointermove!`.\n * This default allows users to clicks and drags within an interval selection to reposition it.\n *\n * __See also:__ [`translate` examples](https://vega.github.io/vega-lite/docs/selection.html#translate) in the documentation.\n */\n translate?: string | boolean;\n\n /**\n * When truthy, allows a user to interactively resize an interval selection.\n * Can be `true`, `false` (to disable zooming), or a [Vega event stream\n * definition](https://vega.github.io/vega/docs/event-streams/). Currently,\n * only `wheel` events are supported,\n * but custom event streams can still be used to specify filters, debouncing, and throttling.\n * Future versions will expand the set of events that can trigger this transformation.\n *\n * __Default value:__ `true`, which corresponds to `wheel!`. This default allows users to use the mouse wheel to resize an interval selection.\n *\n * __See also:__ [`zoom` examples](https://vega.github.io/vega-lite/docs/selection.html#zoom) in the documentation.\n */\n zoom?: string | boolean;\n\n /**\n * An interval selection also adds a rectangle mark to depict the\n * extents of the interval. The `mark` property can be used to customize the\n * appearance of the mark.\n *\n * __See also:__ [`mark` examples](https://vega.github.io/vega-lite/docs/selection.html#mark) in the documentation.\n */\n mark?: BrushConfig;\n}\n\nexport interface SelectionParameter {\n /**\n * Required. A unique name for the selection parameter. Selection names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".\n */\n name: ParameterName;\n\n /**\n * Determines the default event processing and data query for the selection. Vega-Lite currently supports two selection types:\n *\n * - `\"point\"` -- to select multiple discrete data values; the first value is selected on `click` and additional values toggled on shift-click.\n * - `\"interval\"` -- to select a continuous range of data values on `drag`.\n */\n select: T | (T extends 'point' ? PointSelectionConfig : T extends 'interval' ? IntervalSelectionConfig : never);\n\n /**\n * Initialize the selection with a mapping between [projected channels or field names](https://vega.github.io/vega-lite/docs/selection.html#project) and initial values.\n *\n * __See also:__ [`init`](https://vega.github.io/vega-lite/docs/value.html) documentation.\n */\n value?: T extends 'point'\n ? SelectionInit | SelectionInitMapping[]\n : T extends 'interval'\n ? SelectionInitIntervalMapping\n : never;\n\n /**\n * When set, a selection is populated by input elements (also known as dynamic query widgets)\n * or by interacting with the corresponding legend. Direct manipulation interaction is disabled by default;\n * to re-enable it, set the selection's [`on`](https://vega.github.io/vega-lite/docs/selection.html#common-selection-properties) property.\n *\n * Legend bindings are restricted to selections that only specify a single field or encoding.\n *\n * Query widget binding takes the form of Vega's [input element binding definition](https://vega.github.io/vega/docs/signals/#bind)\n * or can be a mapping between projected field/encodings and binding definitions.\n *\n * __See also:__ [`bind`](https://vega.github.io/vega-lite/docs/bind.html) documentation.\n */\n bind?: T extends 'point'\n ? Binding | Record | LegendBinding\n : T extends 'interval'\n ? 'scales'\n : never;\n}\n\nexport type TopLevelSelectionParameter = SelectionParameter & {\n /**\n * By default, top-level selections are applied to every view in the visualization.\n * If this property is specified, selections will only be applied to views with the given names.\n */\n views?: string[];\n};\n\nexport type ParameterExtent =\n | {\n /**\n * The name of a parameter.\n */\n param: ParameterName;\n\n /**\n * If a selection parameter is specified, the field name to extract selected values for\n * when the selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings.\n */\n field?: FieldName;\n }\n | {\n /**\n * The name of a parameter.\n */\n param: ParameterName;\n\n /**\n * If a selection parameter is specified, the encoding channel to extract selected values for\n * when a selection is [projected](https://vega.github.io/vega-lite/docs/selection.html#project) over multiple fields or encodings.\n */\n encoding?: SingleDefUnitChannel;\n };\n\nexport type PointSelectionConfigWithoutType = Omit;\n\nexport type IntervalSelectionConfigWithoutType = Omit;\n\nexport interface SelectionConfig {\n /**\n * The default definition for a [`point`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations\n * for a point selection definition (except `type`) may be specified here.\n *\n * For instance, setting `point` to `{\"on\": \"dblclick\"}` populates point selections on double-click by default.\n */\n point?: PointSelectionConfigWithoutType;\n\n /**\n * The default definition for an [`interval`](https://vega.github.io/vega-lite/docs/parameter.html#select) selection. All properties and transformations\n * for an interval selection definition (except `type`) may be specified here.\n *\n * For instance, setting `interval` to `{\"translate\": false}` disables the ability to move\n * interval selections by default.\n */\n interval?: IntervalSelectionConfigWithoutType;\n}\n\nexport const defaultConfig: SelectionConfig = {\n point: {\n on: 'click',\n fields: [SELECTION_ID],\n toggle: 'event.shiftKey',\n resolve: 'global',\n clear: 'dblclick'\n },\n interval: {\n on: '[pointerdown, window:pointerup] > window:pointermove!',\n encodings: ['x', 'y'],\n translate: '[pointerdown, window:pointerup] > window:pointermove!',\n zoom: 'wheel!',\n mark: {fill: '#333', fillOpacity: 0.125, stroke: 'white'},\n resolve: 'global',\n clear: 'dblclick'\n }\n};\n\nexport function isLegendBinding(bind: any): bind is LegendBinding {\n return bind === 'legend' || !!bind?.legend;\n}\n\nexport function isLegendStreamBinding(bind: any): bind is LegendStreamBinding {\n return isLegendBinding(bind) && isObject(bind);\n}\n\nexport function isSelectionParameter(param: any): param is SelectionParameter {\n return !!param?.['select'];\n}\n","import {Binding, Expr, InitSignal, NewSignal} from 'vega';\nimport {isSelectionParameter, TopLevelSelectionParameter} from './selection';\n\nexport type ParameterName = string;\n\nexport interface VariableParameter {\n /**\n * A unique name for the variable parameter. Parameter names should be valid JavaScript identifiers: they should contain only alphanumeric characters (or \"$\", or \"_\") and may not start with a digit. Reserved keywords that may not be used as parameter names are \"datum\", \"event\", \"item\", and \"parent\".\n */\n name: ParameterName;\n\n /**\n * The [initial value](http://vega.github.io/vega-lite/docs/value.html) of the parameter.\n *\n * __Default value:__ `undefined`\n */\n value?: any;\n\n /**\n * An expression for the value of the parameter. This expression may include other parameters, in which case the parameter will automatically update in response to upstream parameter changes.\n */\n expr?: Expr;\n\n /**\n * Binds the parameter to an external input element such as a slider, selection list or radio button group.\n */\n bind?: Binding;\n}\n\nexport function assembleParameterSignals(params: (VariableParameter | TopLevelSelectionParameter)[]) {\n const signals: (NewSignal | InitSignal)[] = [];\n for (const param of params || []) {\n // Selection parameters are handled separately via assembleSelectionTopLevelSignals\n // and assembleSignals methods registered on the Model.\n if (isSelectionParameter(param)) continue;\n const {expr, bind, ...rest} = param;\n\n if (bind && expr) {\n // Vega's InitSignal -- apply expr to \"init\"\n const signal: InitSignal = {\n ...rest,\n bind,\n init: expr\n };\n signals.push(signal);\n } else {\n const signal: NewSignal = {\n ...rest,\n ...(expr ? {update: expr} : {}),\n ...(bind ? {bind} : {})\n };\n signals.push(signal);\n }\n }\n return signals;\n}\n","import {GenericSpec, NormalizedSpec} from '.';\nimport {BaseSpec, BoundsMixins, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\n\n/**\n * Base layout mixins for V/HConcatSpec, which should not have RowCol generic fo its property.\n */\nexport interface OneDirectionalConcatLayout extends BoundsMixins, ResolveMixins {\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean;\n\n /**\n * The spacing in pixels between sub-views of the concat operator.\n *\n * __Default value__: `10`\n */\n spacing?: number;\n}\n\n/**\n * Base interface for a generalized concatenation specification.\n */\nexport interface GenericConcatSpec>\n extends BaseSpec,\n GenericCompositionLayoutWithColumns,\n ResolveMixins {\n /**\n * A list of views to be concatenated.\n */\n concat: S[];\n}\n\n/**\n * Base interface for a vertical concatenation specification.\n */\nexport interface GenericVConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a column.\n */\n vconcat: S[];\n}\n\n/**\n * Base interface for a horizontal concatenation specification.\n */\nexport interface GenericHConcatSpec>\n extends BaseSpec,\n OneDirectionalConcatLayout {\n /**\n * A list of views to be concatenated and put into a row.\n */\n hconcat: S[];\n}\n\n/** A concat spec without any shortcut/expansion syntax */\nexport type NormalizedConcatSpec =\n | GenericConcatSpec\n | GenericVConcatSpec\n | GenericHConcatSpec;\n\nexport function isAnyConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec | GenericHConcatSpec {\n return isVConcatSpec(spec) || isHConcatSpec(spec) || isConcatSpec(spec);\n}\n\nexport function isConcatSpec(spec: BaseSpec): spec is GenericConcatSpec {\n return 'concat' in spec;\n}\n\nexport function isVConcatSpec(spec: BaseSpec): spec is GenericVConcatSpec {\n return 'vconcat' in spec;\n}\n\nexport function isHConcatSpec(spec: BaseSpec): spec is GenericHConcatSpec {\n return 'hconcat' in spec;\n}\n","import {Color, Cursor, SignalRef, Text} from 'vega';\nimport {isNumber, isObject} from 'vega-util';\nimport {NormalizedSpec} from '.';\nimport {Data} from '../data';\nimport {ExprRef} from '../expr';\nimport {MarkConfig} from '../mark';\nimport {Resolve} from '../resolve';\nimport {TitleParams} from '../title';\nimport {Transform} from '../transform';\nimport {Flag, keys} from '../util';\nimport {LayoutAlign, RowCol} from '../vega.schema';\nimport {isConcatSpec, isVConcatSpec} from './concat';\nimport {isFacetMapping, isFacetSpec} from './facet';\n\nexport type {TopLevel} from './toplevel';\n\n/**\n * Common properties for all types of specification\n */\nexport interface BaseSpec {\n /**\n * Title for the plot.\n */\n title?: Text | TitleParams;\n\n /**\n * Name of the visualization for later reference.\n */\n name?: string;\n\n /**\n * Description of this mark for commenting purpose.\n */\n description?: string;\n\n /**\n * An object describing the data source. Set to `null` to ignore the parent's data source. If no data is set, it is derived from the parent.\n */\n data?: Data | null;\n\n /**\n * An array of data transformations such as filter and new field calculation.\n */\n transform?: Transform[];\n}\n\nexport interface DataMixins {\n /**\n * An object describing the data source.\n */\n data: Data;\n}\n\nexport type StepFor = 'position' | 'offset';\n\nexport interface Step {\n /**\n * The size (width/height) per discrete step.\n */\n step: number;\n\n /**\n * Whether to apply the step to position scale or offset scale when there are both `x` and `xOffset` or both `y` and `yOffset` encodings.\n */\n for?: StepFor;\n}\n\nexport function getStepFor({step, offsetIsDiscrete}: {step: Step; offsetIsDiscrete: boolean}): StepFor {\n if (offsetIsDiscrete) {\n return step.for ?? 'offset';\n } else {\n return 'position';\n }\n}\n\nexport function isStep(size: number | Step | 'container' | 'merged'): size is Step {\n return isObject(size) && size['step'] !== undefined;\n}\n\n// TODO(https://github.com/vega/vega-lite/issues/2503): Make this generic so we can support some form of top-down sizing.\n/**\n * Common properties for specifying width and height of unit and layer specifications.\n */\nexport interface LayoutSizeMixins {\n /**\n * The width of a visualization.\n *\n * - For a plot with a continuous x-field, width should be a number.\n * - For a plot with either a discrete x-field or no x-field, width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step. (No x-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on width, it should be set to `\"container\"`.\n *\n * __Default value:__\n * Based on `config.view.continuousWidth` for a plot with a continuous x-field and `config.view.discreteWidth` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the width of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`width`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n width?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n\n /**\n * The height of a visualization.\n *\n * - For a plot with a continuous y-field, height should be a number.\n * - For a plot with either a discrete y-field or no y-field, height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step. (No y-field is equivalent to having one discrete step.)\n * - To enable responsive sizing on height, it should be set to `\"container\"`.\n *\n * __Default value:__ Based on `config.view.continuousHeight` for a plot with a continuous y-field and `config.view.discreteHeight` otherwise.\n *\n * __Note:__ For plots with [`row` and `column` channels](https://vega.github.io/vega-lite/docs/encoding.html#facet), this represents the height of a single view and the `\"container\"` option cannot be used.\n *\n * __See also:__ [`height`](https://vega.github.io/vega-lite/docs/size.html) documentation.\n */\n height?: number | 'container' | Step; // Vega also supports SignalRef for width and height. However, we need to know if width is a step or not in VL and it's very difficult to check this at runtime, so we intentionally do not support SignalRef here.\n}\n\nexport function isFrameMixins(o: any): o is FrameMixins {\n return o['view'] || o['width'] || o['height'];\n}\n\nexport interface FrameMixins extends LayoutSizeMixins {\n /**\n * An object defining the view background's fill and stroke.\n *\n * __Default value:__ none (transparent)\n */\n view?: ViewBackground;\n}\n\nexport interface ResolveMixins {\n /**\n * Scale, axis, and legend resolutions for view composition specifications.\n */\n resolve?: Resolve;\n}\n\nexport interface BaseViewBackground\n extends Partial<\n Pick<\n MarkConfig,\n | 'cornerRadius'\n | 'fillOpacity'\n | 'opacity'\n | 'strokeCap'\n | 'strokeDash'\n | 'strokeDashOffset'\n | 'strokeJoin'\n | 'strokeMiterLimit'\n | 'strokeOpacity'\n | 'strokeWidth'\n >\n > {\n // Override documentations for fill, stroke, and cursor\n /**\n * The fill color.\n *\n * __Default value:__ `undefined`\n */\n fill?: Color | null | ES;\n\n /**\n * The stroke color.\n *\n * __Default value:__ `\"#ddd\"`\n */\n stroke?: Color | null | ES;\n\n /**\n * The mouse cursor used over the view. Any valid [CSS cursor type](https://developer.mozilla.org/en-US/docs/Web/CSS/cursor#Values) can be used.\n */\n cursor?: Cursor;\n}\n\nexport interface ViewBackground extends BaseViewBackground {\n /**\n * A string or array of strings indicating the name of custom styles to apply to the view background. A style is a named collection of mark property defaults defined within the [style configuration](https://vega.github.io/vega-lite/docs/mark.html#style-config). If style is an array, later styles will override earlier styles.\n *\n * __Default value:__ `\"cell\"`\n * __Note:__ Any specified view background properties will augment the default style.\n */\n style?: string | string[];\n}\n\nexport interface BoundsMixins {\n /**\n * The bounds calculation method to use for determining the extent of a sub-plot. One of `full` (the default) or `flush`.\n *\n * - If set to `full`, the entire calculated bounds (including axes, title, and legend) will be used.\n * - If set to `flush`, only the specified width and height values for the sub-view will be used. The `flush` setting can be useful when attempting to place sub-plots without axes or legends into a uniform grid structure.\n *\n * __Default value:__ `\"full\"`\n */\n\n bounds?: 'full' | 'flush';\n}\n\n/**\n * Base layout for FacetSpec and RepeatSpec.\n * This is named \"GenericComposition\" layout as ConcatLayout is a GenericCompositionLayout too\n * (but _not_ vice versa).\n */\nexport interface GenericCompositionLayout extends BoundsMixins {\n /**\n * The alignment to apply to grid rows and columns.\n * The supported string values are `\"all\"`, `\"each\"`, and `\"none\"`.\n *\n * - For `\"none\"`, a flow layout will be used, in which adjacent subviews are simply placed one after the other.\n * - For `\"each\"`, subviews will be aligned into a clean grid structure, but each row or column may be of variable size.\n * - For `\"all\"`, subviews will be aligned and each row or column will be sized identically based on the maximum observed size. String values for this property will be applied to both grid rows and columns.\n *\n * Alternatively, an object value of the form `{\"row\": string, \"column\": string}` can be used to supply different alignments for rows and columns.\n *\n * __Default value:__ `\"all\"`.\n */\n align?: LayoutAlign | RowCol;\n\n /**\n * Boolean flag indicating if subviews should be centered relative to their respective rows or columns.\n *\n * An object value of the form `{\"row\": boolean, \"column\": boolean}` can be used to supply different centering values for rows and columns.\n *\n * __Default value:__ `false`\n */\n center?: boolean | RowCol;\n\n /**\n * The spacing in pixels between sub-views of the composition operator.\n * An object of the form `{\"row\": number, \"column\": number}` can be used to set\n * different spacing values for rows and columns.\n *\n * __Default value__: Depends on `\"spacing\"` property of [the view composition configuration](https://vega.github.io/vega-lite/docs/config.html#view-config) (`20` by default)\n */\n spacing?: number | RowCol;\n}\n\nexport const DEFAULT_SPACING = 20;\n\nexport interface ColumnMixins {\n /**\n * The number of columns to include in the view composition layout.\n *\n * __Default value__: `undefined` -- An infinite number of columns (a single row) will be assumed. This is equivalent to\n * `hconcat` (for `concat`) and to using the `column` channel (for `facet` and `repeat`).\n *\n * __Note__:\n *\n * 1) This property is only for:\n * - the general (wrappable) `concat` operator (not `hconcat`/`vconcat`)\n * - the `facet` and `repeat` operator with one field/repetition definition (without row/column nesting)\n *\n * 2) Setting the `columns` to `1` is equivalent to `vconcat` (for `concat`) and to using the `row` channel (for `facet` and `repeat`).\n */\n columns?: number;\n}\n\nexport type GenericCompositionLayoutWithColumns = GenericCompositionLayout & ColumnMixins;\n\nexport type CompositionConfig = ColumnMixins & {\n /**\n * The default spacing in pixels between composed sub-views.\n *\n * __Default value__: `20`\n */\n spacing?: number;\n};\n\nexport interface CompositionConfigMixins {\n /** Default configuration for the `facet` view composition operator */\n facet?: CompositionConfig;\n\n /** Default configuration for all concatenation and repeat view composition operators (`concat`, `hconcat`, `vconcat`, and `repeat`) */\n concat?: CompositionConfig;\n}\n\nconst COMPOSITION_LAYOUT_INDEX: Flag = {\n align: 1,\n bounds: 1,\n center: 1,\n columns: 1,\n spacing: 1\n};\n\nconst COMPOSITION_LAYOUT_PROPERTIES = keys(COMPOSITION_LAYOUT_INDEX);\n\nexport type SpecType = 'unit' | 'facet' | 'layer' | 'concat';\n\nexport function extractCompositionLayout(\n spec: NormalizedSpec,\n specType: keyof CompositionConfigMixins,\n config: CompositionConfigMixins\n): GenericCompositionLayoutWithColumns {\n const compositionConfig = config[specType];\n const layout: GenericCompositionLayoutWithColumns = {};\n\n // Apply config first\n const {spacing: spacingConfig, columns} = compositionConfig;\n if (spacingConfig !== undefined) {\n layout.spacing = spacingConfig;\n }\n\n if (columns !== undefined) {\n if ((isFacetSpec(spec) && !isFacetMapping(spec.facet)) || isConcatSpec(spec)) {\n layout.columns = columns;\n }\n }\n\n if (isVConcatSpec(spec)) {\n layout.columns = 1;\n }\n\n // Then copy properties from the spec\n for (const prop of COMPOSITION_LAYOUT_PROPERTIES) {\n if (spec[prop] !== undefined) {\n if (prop === 'spacing') {\n const spacing: number | RowCol = spec[prop];\n\n layout[prop] = isNumber(spacing)\n ? spacing\n : {\n row: spacing.row ?? spacingConfig,\n column: spacing.column ?? spacingConfig\n };\n } else {\n (layout[prop] as any) = spec[prop];\n }\n }\n }\n\n return layout;\n}\n","import {Color, InitSignal, Locale, NewSignal, RangeConfig, RangeScheme, SignalRef, writeConfig} from 'vega';\nimport {isObject, mergeConfig} from 'vega-util';\nimport {Axis, AxisConfig, AxisConfigMixins, AXIS_CONFIGS, isConditionalAxisValue} from './axis';\nimport {signalOrValueRefWithCondition, signalRefOrValue} from './compile/common';\nimport {CompositeMarkConfigMixins, getAllCompositeMarks} from './compositemark';\nimport {ExprRef, replaceExprRef} from './expr';\nimport {VL_ONLY_LEGEND_CONFIG} from './guide';\nimport {HeaderConfigMixins, HEADER_CONFIGS} from './header';\nimport {defaultLegendConfig, LegendConfig} from './legend';\nimport * as mark from './mark';\nimport {\n AnyMarkConfig,\n Mark,\n MarkConfig,\n MarkConfigMixins,\n MARK_CONFIGS,\n PRIMITIVE_MARKS,\n VL_ONLY_MARK_CONFIG_PROPERTIES,\n VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n} from './mark';\nimport {assembleParameterSignals} from './parameter';\nimport {ProjectionConfig} from './projection';\nimport {defaultScaleConfig, ScaleConfig} from './scale';\nimport {defaultConfig as defaultSelectionConfig, SelectionConfig} from './selection';\nimport {BaseViewBackground, CompositionConfigMixins, DEFAULT_SPACING, isStep} from './spec/base';\nimport {TopLevelProperties} from './spec/toplevel';\nimport {extractTitleConfig, TitleConfig} from './title';\nimport {duplicate, getFirstDefined, isEmpty, keys, omit} from './util';\n\nexport interface ViewConfig extends BaseViewBackground {\n /**\n * The default width when the plot has a continuous field for x or longitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousWidth?: number;\n\n /**\n * The default width when the plot has non-arc marks and either a discrete x-field or no x-field.\n * The width can be either a number indicating a fixed width or an object in the form of `{step: number}` defining the width per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteWidth?: number | {step: number};\n /**\n * The default height when the plot has a continuous y-field for x or latitude, or has arc marks.\n *\n * __Default value:__ `200`\n */\n continuousHeight?: number;\n\n /**\n * The default height when the plot has non arc marks and either a discrete y-field or no y-field.\n * The height can be either a number indicating a fixed height or an object in the form of `{step: number}` defining the height per discrete step.\n *\n * __Default value:__ a step size based on `config.view.step`.\n */\n discreteHeight?: number | {step: number};\n\n /**\n * Default step size for x-/y- discrete fields.\n */\n step?: number;\n\n /**\n * Whether the view should be clipped.\n */\n clip?: boolean;\n}\n\nexport function getViewConfigContinuousSize(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n return viewConfig[channel] ?? viewConfig[channel === 'width' ? 'continuousWidth' : 'continuousHeight']; // get width/height for backwards compatibility\n}\n\nexport function getViewConfigDiscreteStep(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n const size = getViewConfigDiscreteSize(viewConfig, channel);\n return isStep(size) ? size.step : DEFAULT_STEP;\n}\n\nexport function getViewConfigDiscreteSize(\n viewConfig: ViewConfig,\n channel: 'width' | 'height'\n) {\n const size = viewConfig[channel] ?? viewConfig[channel === 'width' ? 'discreteWidth' : 'discreteHeight']; // get width/height for backwards compatibility\n return getFirstDefined(size, {step: viewConfig.step});\n}\n\nexport const DEFAULT_STEP = 20;\n\nexport const defaultViewConfig: ViewConfig = {\n continuousWidth: 200,\n continuousHeight: 200,\n step: DEFAULT_STEP\n};\n\nexport function isVgScheme(rangeScheme: string[] | RangeScheme): rangeScheme is RangeScheme {\n return rangeScheme && !!rangeScheme['scheme'];\n}\n\nexport type ColorConfig = Record;\n\nexport type FontSizeConfig = Record;\n\nexport interface FormatConfig {\n /**\n * If numberFormatType is not specified,\n * D3 number format for guide labels, text marks, and tooltips of non-normalized fields (fields *without* `stack: \"normalize\"`). For example `\"s\"` for SI units.\n * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n *\n * If `config.numberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function.\n */\n numberFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.numberFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format).\n * __Note:__ You must also set `customFormatTypes` to `true` to use this feature.\n */\n numberFormatType?: string;\n\n /**\n * If normalizedNumberFormatType is not specified,\n * D3 number format for axis labels, text marks, and tooltips of normalized stacked fields (fields with `stack: \"normalize\"`). For example `\"s\"` for SI units.\n * Use [D3's number format pattern](https://github.com/d3/d3-format#locale_format).\n *\n * If `config.normalizedNumberFormatType` is specified and `config.customFormatTypes` is `true`, this value will be passed as `format` alongside `datum.value` to the `config.numberFormatType` function.\n * __Default value:__ `%`\n */\n normalizedNumberFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.normalizedNumberFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-format, which is exposed as [`format` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#format).\n * __Note:__ You must also set `customFormatTypes` to `true` to use this feature.\n */\n normalizedNumberFormatType?: string;\n\n /**\n * Default time format for raw time values (without time units) in text marks, legend labels and header labels.\n *\n * __Default value:__ `\"%b %d, %Y\"`\n * __Note:__ Axes automatically determine the format for each label automatically so this config does not affect axes.\n */\n timeFormat?: string;\n\n /**\n * [Custom format type](https://vega.github.io/vega-lite/docs/config.html#custom-format-type)\n * for `config.timeFormat`.\n *\n * __Default value:__ `undefined` -- This is equilvalent to call D3-time-format, which is exposed as [`timeFormat` in Vega-Expression](https://vega.github.io/vega/docs/expressions/#timeFormat).\n * __Note:__ You must also set `customFormatTypes` to `true` and there must *not* be a `timeUnit` defined to use this feature.\n */\n timeFormatType?: string;\n}\n\nexport interface VLOnlyConfig extends FormatConfig {\n /**\n * Default font for all text marks, titles, and labels.\n */\n font?: string;\n\n /**\n * Default color signals.\n *\n * @hidden\n */\n color?: boolean | ColorConfig;\n\n /**\n * Default font size signals.\n *\n * @hidden\n */\n fontSize?: boolean | FontSizeConfig;\n\n /**\n * Default axis and legend title for count fields.\n *\n * __Default value:__ `'Count of Records`.\n *\n * @type {string}\n */\n countTitle?: string;\n\n /**\n * Defines how Vega-Lite generates title for fields. There are three possible styles:\n * - `\"verbal\"` (Default) - displays function in a verbal style (e.g., \"Sum of field\", \"Year-month of date\", \"field (binned)\").\n * - `\"function\"` - displays function using parentheses and capitalized texts (e.g., \"SUM(field)\", \"YEARMONTH(date)\", \"BIN(field)\").\n * - `\"plain\"` - displays only the field name without functions (e.g., \"field\", \"date\", \"field\").\n */\n fieldTitle?: 'verbal' | 'functional' | 'plain';\n\n /**\n * Allow the `formatType` property for text marks and guides to accept a custom formatter function [registered as a Vega expression](https://vega.github.io/vega-lite/usage/compile.html#format-type).\n */\n customFormatTypes?: boolean;\n\n /**\n * Define [custom format configuration](https://vega.github.io/vega-lite/docs/config.html#format) for tooltips. If unspecified, default format config will be applied.\n */\n tooltipFormat?: FormatConfig;\n\n /** Default properties for [single view plots](https://vega.github.io/vega-lite/docs/spec.html#single). */\n view?: ViewConfig;\n\n /**\n * Scale configuration determines default properties for all [scales](https://vega.github.io/vega-lite/docs/scale.html). For a full list of scale configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n scale?: ScaleConfig;\n\n /** An object hash for defining default properties for each type of selections. */\n selection?: SelectionConfig;\n}\n\nexport type StyleConfigIndex = Partial | Axis>> &\n MarkConfigMixins & {\n /**\n * Default style for axis, legend, and header titles.\n */\n 'guide-title'?: MarkConfig;\n\n /**\n * Default style for axis, legend, and header labels.\n */\n 'guide-label'?: MarkConfig;\n\n /**\n * Default style for chart titles\n */\n 'group-title'?: MarkConfig;\n\n /**\n * Default style for chart subtitles\n */\n 'group-subtitle'?: MarkConfig;\n };\n\nexport interface Config\n extends TopLevelProperties,\n VLOnlyConfig,\n MarkConfigMixins,\n CompositeMarkConfigMixins,\n AxisConfigMixins,\n HeaderConfigMixins,\n CompositionConfigMixins {\n /**\n * An object hash that defines default range arrays or schemes for using with scales.\n * For a full list of scale range configuration options, please see the [corresponding section of the scale documentation](https://vega.github.io/vega-lite/docs/scale.html#config).\n */\n range?: RangeConfig;\n\n /**\n * Legend configuration, which determines default properties for all [legends](https://vega.github.io/vega-lite/docs/legend.html). For a full list of legend configuration options, please see the [corresponding section of in the legend documentation](https://vega.github.io/vega-lite/docs/legend.html#config).\n */\n legend?: LegendConfig;\n\n /**\n * Title configuration, which determines default properties for all [titles](https://vega.github.io/vega-lite/docs/title.html). For a full list of title configuration options, please see the [corresponding section of the title documentation](https://vega.github.io/vega-lite/docs/title.html#config).\n */\n title?: TitleConfig;\n\n /**\n * Projection configuration, which determines default properties for all [projections](https://vega.github.io/vega-lite/docs/projection.html). For a full list of projection configuration options, please see the [corresponding section of the projection documentation](https://vega.github.io/vega-lite/docs/projection.html#config).\n */\n projection?: ProjectionConfig;\n\n /** An object hash that defines key-value mappings to determine default properties for marks with a given [style](https://vega.github.io/vega-lite/docs/mark.html#mark-def). The keys represent styles names; the values have to be valid [mark configuration objects](https://vega.github.io/vega-lite/docs/mark.html#config). */\n style?: StyleConfigIndex;\n\n /**\n * A delimiter, such as a newline character, upon which to break text strings into multiple lines. This property provides a global default for text marks, which is overridden by mark or style config settings, and by the lineBreak mark encoding channel. If signal-valued, either string or regular expression (regexp) values are valid.\n */\n lineBreak?: string | ES;\n\n /**\n * A boolean flag indicating if ARIA default attributes should be included for marks and guides (SVG output only). If false, the `\"aria-hidden\"` attribute will be set for all guides, removing them from the ARIA accessibility tree and Vega-Lite will not generate default descriptions for marks.\n *\n * __Default value:__ `true`.\n */\n aria?: boolean;\n\n /**\n * Locale definitions for string parsing and formatting of number and date values. The locale object should contain `number` and/or `time` properties with [locale definitions](https://vega.github.io/vega/docs/api/locale/). Locale definitions provided in the config block may be overridden by the View constructor locale option.\n */\n locale?: Locale;\n\n /**\n * @hidden\n */\n signals?: (InitSignal | NewSignal)[];\n}\n\nexport const defaultConfig: Config = {\n background: 'white',\n\n padding: 5,\n timeFormat: '%b %d, %Y',\n countTitle: 'Count of Records',\n\n view: defaultViewConfig,\n\n mark: mark.defaultMarkConfig,\n\n arc: {},\n area: {},\n bar: mark.defaultBarConfig,\n circle: {},\n geoshape: {},\n image: {},\n line: {},\n point: {},\n rect: mark.defaultRectConfig,\n rule: {color: 'black'}, // Need this to override default color in mark config\n square: {},\n text: {color: 'black'}, // Need this to override default color in mark config\n tick: mark.defaultTickConfig,\n trail: {},\n\n boxplot: {\n size: 14,\n extent: 1.5,\n box: {},\n median: {color: 'white'},\n outliers: {},\n rule: {},\n ticks: null\n },\n\n errorbar: {\n center: 'mean',\n rule: true,\n ticks: false\n },\n\n errorband: {\n band: {\n opacity: 0.3\n },\n borders: false\n },\n\n scale: defaultScaleConfig,\n\n projection: {},\n\n legend: defaultLegendConfig,\n header: {titlePadding: 10, labelPadding: 10},\n headerColumn: {},\n headerRow: {},\n headerFacet: {},\n\n selection: defaultSelectionConfig,\n style: {},\n\n title: {},\n\n facet: {spacing: DEFAULT_SPACING},\n concat: {spacing: DEFAULT_SPACING},\n\n normalizedNumberFormat: '.0%'\n};\n\n// Tableau10 color palette, copied from `vegaScale.scheme('tableau10')`\nconst tab10 = [\n '#4c78a8',\n '#f58518',\n '#e45756',\n '#72b7b2',\n '#54a24b',\n '#eeca3b',\n '#b279a2',\n '#ff9da6',\n '#9d755d',\n '#bab0ac'\n];\n\nexport const DEFAULT_FONT_SIZE = {\n text: 11,\n guideLabel: 10,\n guideTitle: 11,\n groupTitle: 13,\n groupSubtitle: 12\n};\n\nexport const DEFAULT_COLOR = {\n blue: tab10[0],\n orange: tab10[1],\n red: tab10[2],\n teal: tab10[3],\n green: tab10[4],\n yellow: tab10[5],\n purple: tab10[6],\n pink: tab10[7],\n brown: tab10[8],\n gray0: '#000',\n gray1: '#111',\n gray2: '#222',\n gray3: '#333',\n gray4: '#444',\n gray5: '#555',\n gray6: '#666',\n gray7: '#777',\n gray8: '#888',\n gray9: '#999',\n gray10: '#aaa',\n gray11: '#bbb',\n gray12: '#ccc',\n gray13: '#ddd',\n gray14: '#eee',\n gray15: '#fff'\n};\n\nexport function colorSignalConfig(color: boolean | ColorConfig = {}): Config {\n return {\n signals: [\n {\n name: 'color',\n value: isObject(color) ? {...DEFAULT_COLOR, ...color} : DEFAULT_COLOR\n }\n ],\n mark: {color: {signal: 'color.blue'}},\n rule: {color: {signal: 'color.gray0'}},\n text: {\n color: {signal: 'color.gray0'}\n },\n style: {\n 'guide-label': {\n fill: {signal: 'color.gray0'}\n },\n 'guide-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-title': {\n fill: {signal: 'color.gray0'}\n },\n 'group-subtitle': {\n fill: {signal: 'color.gray0'}\n },\n cell: {\n stroke: {signal: 'color.gray8'}\n }\n },\n axis: {\n domainColor: {signal: 'color.gray13'},\n gridColor: {signal: 'color.gray8'},\n tickColor: {signal: 'color.gray13'}\n },\n range: {\n category: [\n {signal: 'color.blue'},\n {signal: 'color.orange'},\n {signal: 'color.red'},\n {signal: 'color.teal'},\n {signal: 'color.green'},\n {signal: 'color.yellow'},\n {signal: 'color.purple'},\n {signal: 'color.pink'},\n {signal: 'color.brown'},\n {signal: 'color.grey8'}\n ]\n }\n };\n}\n\nexport function fontSizeSignalConfig(fontSize: boolean | FontSizeConfig): Config {\n return {\n signals: [\n {\n name: 'fontSize',\n value: isObject(fontSize) ? {...DEFAULT_FONT_SIZE, ...fontSize} : DEFAULT_FONT_SIZE\n }\n ],\n text: {\n fontSize: {signal: 'fontSize.text'}\n },\n style: {\n 'guide-label': {\n fontSize: {signal: 'fontSize.guideLabel'}\n },\n 'guide-title': {\n fontSize: {signal: 'fontSize.guideTitle'}\n },\n 'group-title': {\n fontSize: {signal: 'fontSize.groupTitle'}\n },\n 'group-subtitle': {\n fontSize: {signal: 'fontSize.groupSubtitle'}\n }\n }\n };\n}\n\nexport function fontConfig(font: string): Config {\n return {\n text: {font},\n style: {\n 'guide-label': {font},\n 'guide-title': {font},\n 'group-title': {font},\n 'group-subtitle': {font}\n }\n };\n}\n\nfunction getAxisConfigInternal(axisConfig: AxisConfig) {\n const props = keys(axisConfig || {});\n const axisConfigInternal: AxisConfig = {};\n for (const prop of props) {\n const val = axisConfig[prop];\n axisConfigInternal[prop as any] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisConfigInternal;\n}\n\nfunction getStyleConfigInternal(styleConfig: StyleConfigIndex) {\n const props = keys(styleConfig);\n\n const styleConfigInternal: StyleConfigIndex = {};\n for (const prop of props) {\n // We need to cast to cheat a bit here since styleConfig can be either mark config or axis config\n styleConfigInternal[prop as any] = getAxisConfigInternal(styleConfig[prop] as any);\n }\n return styleConfigInternal;\n}\n\nconst configPropsWithExpr = [\n ...MARK_CONFIGS,\n ...AXIS_CONFIGS,\n ...HEADER_CONFIGS,\n 'background',\n 'padding',\n 'legend',\n 'lineBreak',\n 'scale',\n 'style',\n 'title',\n 'view'\n] as const;\n\n/**\n * Merge specified config with default config and config for the `color` flag,\n * then replace all expressions with signals\n */\nexport function initConfig(specifiedConfig: Config = {}): Config {\n const {color, font, fontSize, selection, ...restConfig} = specifiedConfig;\n const mergedConfig = mergeConfig(\n {},\n duplicate(defaultConfig),\n font ? fontConfig(font) : {},\n color ? colorSignalConfig(color) : {},\n fontSize ? fontSizeSignalConfig(fontSize) : {},\n restConfig || {}\n );\n\n // mergeConfig doesn't recurse and overrides object values.\n if (selection) {\n writeConfig(mergedConfig, 'selection', selection, true);\n }\n\n const outputConfig: Config = omit(mergedConfig, configPropsWithExpr);\n\n for (const prop of ['background', 'lineBreak', 'padding']) {\n if (mergedConfig[prop]) {\n outputConfig[prop] = signalRefOrValue(mergedConfig[prop]);\n }\n }\n\n for (const markConfigType of mark.MARK_CONFIGS) {\n if (mergedConfig[markConfigType]) {\n // FIXME: outputConfig[markConfigType] expects that types are replaced recursively but replaceExprRef only replaces one level deep\n outputConfig[markConfigType] = replaceExprRef(mergedConfig[markConfigType]) as any;\n }\n }\n\n for (const axisConfigType of AXIS_CONFIGS) {\n if (mergedConfig[axisConfigType]) {\n outputConfig[axisConfigType] = getAxisConfigInternal(mergedConfig[axisConfigType]);\n }\n }\n\n for (const headerConfigType of HEADER_CONFIGS) {\n if (mergedConfig[headerConfigType]) {\n outputConfig[headerConfigType] = replaceExprRef(mergedConfig[headerConfigType]);\n }\n }\n\n if (mergedConfig.legend) {\n outputConfig.legend = replaceExprRef(mergedConfig.legend);\n }\n\n if (mergedConfig.scale) {\n outputConfig.scale = replaceExprRef(mergedConfig.scale);\n }\n\n if (mergedConfig.style) {\n outputConfig.style = getStyleConfigInternal(mergedConfig.style);\n }\n\n if (mergedConfig.title) {\n outputConfig.title = replaceExprRef(mergedConfig.title);\n }\n\n if (mergedConfig.view) {\n outputConfig.view = replaceExprRef(mergedConfig.view);\n }\n\n return outputConfig;\n}\n\nconst MARK_STYLES = new Set(['view', ...PRIMITIVE_MARKS]) as ReadonlySet<'view' | Mark>;\n\nconst VL_ONLY_CONFIG_PROPERTIES: (keyof Config)[] = [\n 'color',\n 'fontSize',\n 'background', // We apply background to the spec directly.\n 'padding',\n 'facet',\n 'concat',\n 'numberFormat',\n 'numberFormatType',\n 'normalizedNumberFormat',\n 'normalizedNumberFormatType',\n 'timeFormat',\n 'countTitle',\n 'header',\n\n 'axisQuantitative',\n 'axisTemporal',\n 'axisDiscrete',\n 'axisPoint',\n\n 'axisXBand',\n 'axisXPoint',\n 'axisXDiscrete',\n 'axisXQuantitative',\n 'axisXTemporal',\n\n 'axisYBand',\n 'axisYPoint',\n 'axisYDiscrete',\n 'axisYQuantitative',\n 'axisYTemporal',\n\n 'scale',\n 'selection',\n 'overlay' as keyof Config // FIXME: Redesign and unhide this\n];\n\nconst VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX = {\n view: ['continuousWidth', 'continuousHeight', 'discreteWidth', 'discreteHeight', 'step'],\n ...VL_ONLY_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX\n};\n\nexport function stripAndRedirectConfig(config: Config) {\n config = duplicate(config);\n\n for (const prop of VL_ONLY_CONFIG_PROPERTIES) {\n delete config[prop];\n }\n\n if (config.axis) {\n // delete condition axis config\n for (const prop in config.axis) {\n if (isConditionalAxisValue(config.axis[prop])) {\n delete config.axis[prop];\n }\n }\n }\n\n if (config.legend) {\n for (const prop of VL_ONLY_LEGEND_CONFIG) {\n delete config.legend[prop];\n }\n }\n\n // Remove Vega-Lite only generic mark config\n if (config.mark) {\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config.mark[prop];\n }\n\n if (config.mark.tooltip && isObject(config.mark.tooltip)) {\n delete config.mark.tooltip;\n }\n }\n\n if (config.params) {\n config.signals = (config.signals || []).concat(assembleParameterSignals(config.params));\n delete config.params;\n }\n\n for (const markType of MARK_STYLES) {\n // Remove Vega-Lite-only mark config\n for (const prop of VL_ONLY_MARK_CONFIG_PROPERTIES) {\n delete config[markType][prop];\n }\n\n // Remove Vega-Lite only mark-specific config\n const vlOnlyMarkSpecificConfigs = VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX[markType];\n if (vlOnlyMarkSpecificConfigs) {\n for (const prop of vlOnlyMarkSpecificConfigs) {\n delete config[markType][prop];\n }\n }\n\n // Redirect mark config to config.style so that mark config only affect its own mark type\n // without affecting other marks that share the same underlying Vega marks.\n // For example, config.rect should not affect bar marks.\n redirectConfigToStyleConfig(config, markType);\n }\n\n for (const m of getAllCompositeMarks()) {\n // Clean up the composite mark config as we don't need them in the output specs anymore\n delete config[m];\n }\n\n redirectTitleConfig(config);\n\n // Remove empty config objects.\n for (const prop in config) {\n if (isObject(config[prop]) && isEmpty(config[prop])) {\n delete config[prop];\n }\n }\n\n return isEmpty(config) ? undefined : config;\n}\n\n/**\n *\n * Redirect config.title -- so that title config do not affect header labels,\n * which also uses `title` directive to implement.\n *\n * For subtitle configs in config.title, keep them in config.title as header titles never have subtitles.\n */\nfunction redirectTitleConfig(config: Config) {\n const {titleMarkConfig, subtitleMarkConfig, subtitle} = extractTitleConfig(config.title);\n\n // set config.style if title/subtitleMarkConfig is not an empty object\n if (!isEmpty(titleMarkConfig)) {\n config.style['group-title'] = {\n ...config.style['group-title'],\n ...titleMarkConfig // config.title has higher precedence than config.style.group-title in Vega\n };\n }\n if (!isEmpty(subtitleMarkConfig)) {\n config.style['group-subtitle'] = {\n ...config.style['group-subtitle'],\n ...subtitleMarkConfig\n };\n }\n\n // subtitle part can stay in config.title since header titles do not use subtitle\n if (!isEmpty(subtitle)) {\n config.title = subtitle;\n } else {\n delete config.title;\n }\n}\n\nfunction redirectConfigToStyleConfig(\n config: Config,\n prop: Mark | 'view' | string, // string = composite mark\n toProp?: string,\n compositeMarkPart?: string\n) {\n const propConfig: MarkConfig = compositeMarkPart ? config[prop][compositeMarkPart] : config[prop];\n\n if (prop === 'view') {\n toProp = 'cell'; // View's default style is \"cell\"\n }\n\n const style: MarkConfig = {\n ...propConfig,\n ...(config.style[toProp ?? prop] as MarkConfig)\n };\n\n // set config.style if it is not an empty object\n if (!isEmpty(style)) {\n config.style[toProp ?? prop] = style;\n }\n\n if (!compositeMarkPart) {\n // For composite mark, so don't delete the whole config yet as we have to do multiple redirections.\n delete config[prop];\n }\n}\n","import {Field} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {ExprRef} from '../expr';\nimport {Projection} from '../projection';\nimport {BaseSpec, FrameMixins, ResolveMixins} from './base';\nimport {GenericUnitSpec, NormalizedUnitSpec, UnitSpec} from './unit';\n\n/**\n * Base interface for a layer specification.\n */\nexport interface GenericLayerSpec> extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (GenericLayerSpec | U)[];\n}\n\n/**\n * A full layered plot specification, which may contains `encoding` and `projection` properties that will be applied to underlying unit (single-view) specifications.\n */\nexport interface LayerSpec extends BaseSpec, FrameMixins, ResolveMixins {\n /**\n * Layer or single view specifications to be layered.\n *\n * __Note__: Specifications inside `layer` cannot use `row` and `column` channels as layering facet specifications is not allowed. Instead, use the [facet operator](https://vega.github.io/vega-lite/docs/facet.html) and place a layer inside a facet.\n */\n layer: (LayerSpec | UnitSpec)[];\n\n /**\n * A shared key-value mapping between encoding channels and definition of fields in the underlying layers.\n */\n encoding?: SharedCompositeEncoding;\n\n /**\n * An object defining properties of the geographic projection shared by underlying layers.\n */\n projection?: Projection;\n}\n\n/**\n * A layered specification without any shortcut/expansion syntax.\n */\nexport type NormalizedLayerSpec = GenericLayerSpec;\n\nexport function isLayerSpec(spec: BaseSpec): spec is GenericLayerSpec {\n return 'layer' in spec;\n}\n","import {GenericSpec} from '.';\nimport * as log from '../log';\nimport {Field, FieldName} from '../channeldef';\nimport {\n GenericConcatSpec,\n GenericHConcatSpec,\n GenericVConcatSpec,\n isConcatSpec,\n isHConcatSpec,\n isVConcatSpec\n} from './concat';\nimport {GenericFacetSpec, isFacetSpec} from './facet';\nimport {GenericLayerSpec, isLayerSpec} from './layer';\nimport {isRepeatSpec, RepeatSpec} from './repeat';\nimport {GenericUnitSpec, isUnitSpec, NormalizedUnitSpec} from './unit';\n\nexport abstract class SpecMapper<\n P,\n UI extends GenericUnitSpec,\n LI extends GenericLayerSpec = GenericLayerSpec,\n UO extends GenericUnitSpec = NormalizedUnitSpec,\n RO extends RepeatSpec = never,\n FO extends Field = FieldName\n> {\n public map(spec: GenericSpec, params: P): GenericSpec, RO, FO> {\n if (isFacetSpec(spec)) {\n return this.mapFacet(spec, params);\n } else if (isRepeatSpec(spec)) {\n return this.mapRepeat(spec, params);\n } else if (isHConcatSpec(spec)) {\n return this.mapHConcat(spec, params);\n } else if (isVConcatSpec(spec)) {\n return this.mapVConcat(spec, params);\n } else if (isConcatSpec(spec)) {\n return this.mapConcat(spec, params);\n } else {\n return this.mapLayerOrUnit(spec, params);\n }\n }\n\n public mapLayerOrUnit(spec: UI | LI, params: P): UO | GenericLayerSpec {\n if (isLayerSpec(spec)) {\n return this.mapLayer(spec, params);\n } else if (isUnitSpec(spec)) {\n return this.mapUnit(spec, params);\n }\n throw new Error(log.message.invalidSpec(spec));\n }\n\n public abstract mapUnit(spec: UI, params: P): UO | GenericLayerSpec;\n\n protected mapLayer(spec: LI, params: P): GenericLayerSpec {\n return {\n ...spec,\n layer: spec.layer.map(subspec => this.mapLayerOrUnit(subspec, params))\n };\n }\n\n protected mapHConcat(\n spec: GenericHConcatSpec>,\n params: P\n ): GenericHConcatSpec, RO, FO>> {\n return {\n ...spec,\n hconcat: spec.hconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapVConcat(\n spec: GenericVConcatSpec>,\n params: P\n ): GenericVConcatSpec, RO, FO>> {\n return {\n ...spec,\n vconcat: spec.vconcat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapConcat(\n spec: GenericConcatSpec>,\n params: P\n ): GenericConcatSpec, RO, FO>> {\n const {concat, ...rest} = spec;\n\n return {\n ...rest,\n concat: concat.map(subspec => this.map(subspec, params))\n };\n }\n\n protected mapFacet(spec: GenericFacetSpec, params: P): GenericFacetSpec, FO> {\n return {\n // as any is required here since TS cannot infer that FO may only be FieldName or Field, but not RepeatRef\n ...(spec as any),\n // TODO: remove \"any\" once we support all facet listed in https://github.com/vega/vega-lite/issues/2760\n spec: this.map(spec.spec, params) as any\n };\n }\n\n protected mapRepeat(spec: RepeatSpec, params: P): GenericSpec {\n return {\n ...spec,\n // as any is required here since TS cannot infer that the output type satisfies the input type\n spec: this.map(spec.spec as any, params)\n };\n }\n}\n","import {isArray} from 'vega-util';\nimport {LayerSpec, NonNormalizedSpec} from '.';\nimport {Field} from '../channeldef';\nimport {BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins} from './base';\nimport {UnitSpecWithFrame} from './unit';\n\nexport interface RepeatMapping {\n /**\n * An array of fields to be repeated vertically.\n */\n row?: string[];\n\n /**\n * An array of fields to be repeated horizontally.\n */\n column?: string[];\n}\n\nexport interface LayerRepeatMapping extends RepeatMapping {\n /**\n * An array of fields to be repeated as layers.\n */\n layer: string[];\n}\n\nexport type RepeatSpec = NonLayerRepeatSpec | LayerRepeatSpec;\n\n/**\n * Base interface for a repeat specification.\n */\nexport interface NonLayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: string[] | RepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: NonNormalizedSpec;\n}\n\nexport interface LayerRepeatSpec extends BaseSpec, GenericCompositionLayoutWithColumns, ResolveMixins {\n /**\n * Definition for fields to be repeated. One of:\n * 1) An array of fields to be repeated. If `\"repeat\"` is an array, the field can be referred to as `{\"repeat\": \"repeat\"}`. The repeated views are laid out in a wrapped row. You can set the number of columns to control the wrapping.\n * 2) An object that maps `\"row\"` and/or `\"column\"` to the listed fields to be repeated along the particular orientations. The objects `{\"repeat\": \"row\"}` and `{\"repeat\": \"column\"}` can be used to refer to the repeated field respectively.\n */\n repeat: LayerRepeatMapping;\n\n /**\n * A specification of the view that gets repeated.\n */\n spec: LayerSpec | UnitSpecWithFrame;\n}\n\nexport function isRepeatSpec(spec: BaseSpec): spec is RepeatSpec {\n return 'repeat' in spec;\n}\n\nexport function isLayerRepeatSpec(spec: RepeatSpec): spec is LayerRepeatSpec {\n return !isArray(spec.repeat) && spec.repeat['layer'];\n}\n","import {array, isBoolean} from 'vega-util';\nimport {Aggregate, SUM_OPS} from './aggregate';\nimport {getSecondaryRangeChannel, NonPositionChannel, NONPOSITION_CHANNELS} from './channel';\nimport {\n channelDefType,\n FieldName,\n getFieldDef,\n isFieldDef,\n isFieldOrDatumDef,\n PositionDatumDef,\n PositionDef,\n PositionFieldDef,\n TypedFieldDef,\n vgField\n} from './channeldef';\nimport {CompositeAggregate} from './compositemark';\nimport {channelHasField, Encoding, isAggregate} from './encoding';\nimport * as log from './log';\nimport {\n ARC,\n AREA,\n BAR,\n CIRCLE,\n isMarkDef,\n isPathMark,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from './mark';\nimport {ScaleType} from './scale';\n\nconst STACK_OFFSET_INDEX = {\n zero: 1,\n center: 1,\n normalize: 1\n} as const;\n\nexport type StackOffset = keyof typeof STACK_OFFSET_INDEX;\n\nexport function isStackOffset(s: string): s is StackOffset {\n return s in STACK_OFFSET_INDEX;\n}\n\nexport interface StackProperties {\n /** Dimension axis of the stack. */\n groupbyChannels: ('x' | 'y' | 'theta' | 'radius' | 'xOffset' | 'yOffset')[];\n\n /** Field for groupbyChannel. */\n groupbyFields: Set;\n\n /** Measure axis of the stack. */\n fieldChannel: 'x' | 'y' | 'theta' | 'radius';\n\n /** Stack-by fields e.g., color, detail */\n stackBy: {\n fieldDef: TypedFieldDef;\n channel: NonPositionChannel;\n }[];\n\n /**\n * See `stack` property of Position Field Def.\n */\n offset: StackOffset;\n\n /**\n * Whether this stack will produce impute transform\n */\n impute: boolean;\n}\n\nexport const STACKABLE_MARKS = new Set([ARC, BAR, AREA, RULE, POINT, CIRCLE, SQUARE, LINE, TEXT, TICK]);\nexport const STACK_BY_DEFAULT_MARKS = new Set([BAR, AREA, ARC]);\n\nfunction isUnbinnedQuantitative(channelDef: PositionDef) {\n return isFieldDef(channelDef) && channelDefType(channelDef) === 'quantitative' && !channelDef.bin;\n}\n\nfunction potentialStackedChannel(\n encoding: Encoding,\n x: 'x' | 'theta',\n {orient, type: mark}: MarkDef\n): 'x' | 'y' | 'theta' | 'radius' | undefined {\n const y = x === 'x' ? 'y' : 'radius';\n\n const isCartesian = x === 'x';\n\n const xDef = encoding[x];\n const yDef = encoding[y];\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n if (isUnbinnedQuantitative(xDef) && isUnbinnedQuantitative(yDef)) {\n if (xDef.stack) {\n return x;\n } else if (yDef.stack) {\n return y;\n }\n const xAggregate = isFieldDef(xDef) && !!xDef.aggregate;\n const yAggregate = isFieldDef(yDef) && !!yDef.aggregate;\n // if there is no explicit stacking, only apply stack if there is only one aggregate for x or y\n if (xAggregate !== yAggregate) {\n return xAggregate ? x : y;\n }\n\n if (isCartesian && ['bar', 'area'].includes(mark)) {\n if (orient === 'vertical') {\n return y;\n } else if (orient === 'horizontal') {\n return x;\n }\n }\n } else if (isUnbinnedQuantitative(xDef)) {\n return x;\n } else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n } else if (isUnbinnedQuantitative(xDef)) {\n return x;\n } else if (isUnbinnedQuantitative(yDef)) {\n return y;\n }\n return undefined;\n}\n\nfunction getDimensionChannel(channel: 'x' | 'y' | 'theta' | 'radius') {\n switch (channel) {\n case 'x':\n return 'y';\n case 'y':\n return 'x';\n case 'theta':\n return 'radius';\n case 'radius':\n return 'theta';\n }\n}\n\nexport function stack(m: Mark | MarkDef, encoding: Encoding): StackProperties {\n const markDef = isMarkDef(m) ? m : {type: m};\n const mark = markDef.type;\n\n // Should have stackable mark\n if (!STACKABLE_MARKS.has(mark)) {\n return null;\n }\n\n // Run potential stacked twice, one for Cartesian and another for Polar,\n // so text marks can be stacked in any of the coordinates.\n\n // Note: The logic here is not perfectly correct. If we want to support stacked dot plots where each dot is a pie chart with label, we have to change the stack logic here to separate Cartesian stacking for polar stacking.\n // However, since we probably never want to do that, let's just note the limitation here.\n const fieldChannel =\n potentialStackedChannel(encoding, 'x', markDef) || potentialStackedChannel(encoding, 'theta', markDef);\n\n if (!fieldChannel) {\n return null;\n }\n\n const stackedFieldDef = encoding[fieldChannel] as PositionFieldDef | PositionDatumDef;\n const stackedField = isFieldDef(stackedFieldDef) ? vgField(stackedFieldDef, {}) : undefined;\n\n const dimensionChannel: 'x' | 'y' | 'theta' | 'radius' = getDimensionChannel(fieldChannel);\n const groupbyChannels: StackProperties['groupbyChannels'] = [];\n const groupbyFields: Set = new Set();\n\n if (encoding[dimensionChannel]) {\n const dimensionDef = encoding[dimensionChannel];\n const dimensionField = isFieldDef(dimensionDef) ? vgField(dimensionDef, {}) : undefined;\n\n if (dimensionField && dimensionField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionChannel);\n groupbyFields.add(dimensionField);\n }\n }\n\n const dimensionOffsetChannel = dimensionChannel === 'x' ? 'xOffset' : 'yOffset';\n const dimensionOffsetDef = encoding[dimensionOffsetChannel];\n const dimensionOffsetField = isFieldDef(dimensionOffsetDef) ? vgField(dimensionOffsetDef, {}) : undefined;\n\n if (dimensionOffsetField && dimensionOffsetField !== stackedField) {\n // avoid grouping by the stacked field\n groupbyChannels.push(dimensionOffsetChannel);\n groupbyFields.add(dimensionOffsetField);\n }\n\n // If the dimension has offset, don't stack anymore\n\n // Should have grouping level of detail that is different from the dimension field\n const stackBy = NONPOSITION_CHANNELS.reduce((sc, channel) => {\n // Ignore tooltip in stackBy (https://github.com/vega/vega-lite/issues/4001)\n if (channel !== 'tooltip' && channelHasField(encoding, channel)) {\n const channelDef = encoding[channel];\n for (const cDef of array(channelDef)) {\n const fieldDef = getFieldDef(cDef);\n if (fieldDef.aggregate) {\n continue;\n }\n\n // Check whether the channel's field is identical to x/y's field or if the channel is a repeat\n const f = vgField(fieldDef, {});\n if (\n // if fielddef is a repeat, just include it in the stack by\n !f ||\n // otherwise, the field must be different from the groupBy fields.\n !groupbyFields.has(f)\n ) {\n sc.push({channel, fieldDef});\n }\n }\n }\n return sc;\n }, []);\n\n // Automatically determine offset\n let offset: StackOffset;\n if (stackedFieldDef.stack !== undefined) {\n if (isBoolean(stackedFieldDef.stack)) {\n offset = stackedFieldDef.stack ? 'zero' : null;\n } else {\n offset = stackedFieldDef.stack;\n }\n } else if (STACK_BY_DEFAULT_MARKS.has(mark)) {\n offset = 'zero';\n }\n\n if (!offset || !isStackOffset(offset)) {\n return null;\n }\n\n if (isAggregate(encoding) && stackBy.length === 0) {\n return null;\n }\n\n // warn when stacking non-linear\n if (stackedFieldDef?.scale?.type && stackedFieldDef?.scale?.type !== ScaleType.LINEAR) {\n if (stackedFieldDef?.stack) {\n log.warn(log.message.cannotStackNonLinearScale(stackedFieldDef.scale.type));\n }\n return null;\n }\n\n // Check if it is a ranged mark\n if (isFieldOrDatumDef(encoding[getSecondaryRangeChannel(fieldChannel)])) {\n if (stackedFieldDef.stack !== undefined) {\n log.warn(log.message.cannotStackRangedMark(fieldChannel));\n }\n return null;\n }\n\n // Warn if stacking non-summative aggregate\n if (\n isFieldDef(stackedFieldDef) &&\n stackedFieldDef.aggregate &&\n !(SUM_OPS as Set).has(stackedFieldDef.aggregate)\n ) {\n log.warn(log.message.stackNonSummativeAggregate(stackedFieldDef.aggregate));\n }\n\n return {\n groupbyChannels,\n groupbyFields,\n fieldChannel,\n impute: stackedFieldDef.impute === null ? false : isPathMark(mark),\n stackBy,\n offset\n };\n}\n","import {Orientation, SignalRef} from 'vega';\nimport {isBinned, isBinning} from '../../bin';\nimport {isFieldDef, isNumericDataDef, isUnbinnedQuantitativeFieldOrDatumDef, isTypedFieldDef} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding, isAggregate} from '../../encoding';\nimport {replaceExprRef} from '../../expr';\nimport * as log from '../../log';\nimport {\n AREA,\n BAR,\n BAR_CORNER_RADIUS_INDEX as BAR_CORNER_RADIUS_END_INDEX,\n CIRCLE,\n IMAGE,\n LINE,\n Mark,\n MarkDef,\n POINT,\n RECT,\n RULE,\n SQUARE,\n TEXT,\n TICK\n} from '../../mark';\nimport {QUANTITATIVE, TEMPORAL} from '../../type';\nimport {contains, getFirstDefined} from '../../util';\nimport {getMarkConfig, getMarkPropOrConfig} from '../common';\n\nexport function initMarkdef(originalMarkDef: MarkDef, encoding: Encoding, config: Config) {\n // FIXME: markDef expects that exprRefs are replaced recursively but replaceExprRef only replaces the top level\n const markDef: MarkDef = replaceExprRef(originalMarkDef) as any;\n\n // set orient, which can be overridden by rules as sometimes the specified orient is invalid.\n const specifiedOrient = getMarkPropOrConfig('orient', markDef, config);\n markDef.orient = orient(markDef.type, encoding, specifiedOrient);\n if (specifiedOrient !== undefined && specifiedOrient !== markDef.orient) {\n log.warn(log.message.orientOverridden(markDef.orient, specifiedOrient));\n }\n\n if (markDef.type === 'bar' && markDef.orient) {\n const cornerRadiusEnd = getMarkPropOrConfig('cornerRadiusEnd', markDef, config);\n if (cornerRadiusEnd !== undefined) {\n const newProps =\n (markDef.orient === 'horizontal' && encoding.x2) || (markDef.orient === 'vertical' && encoding.y2)\n ? ['cornerRadius']\n : BAR_CORNER_RADIUS_END_INDEX[markDef.orient];\n\n for (const newProp of newProps) {\n markDef[newProp] = cornerRadiusEnd;\n }\n\n if (markDef.cornerRadiusEnd !== undefined) {\n delete markDef.cornerRadiusEnd; // no need to keep the original cap cornerRadius\n }\n }\n }\n\n // set opacity and filled if not specified in mark config\n const specifiedOpacity = getMarkPropOrConfig('opacity', markDef, config);\n if (specifiedOpacity === undefined) {\n markDef.opacity = opacity(markDef.type, encoding);\n }\n\n // set cursor, which should be pointer if href channel is present unless otherwise specified\n const specifiedCursor = getMarkPropOrConfig('cursor', markDef, config);\n if (specifiedCursor === undefined) {\n markDef.cursor = cursor(markDef, encoding, config);\n }\n\n return markDef;\n}\n\nfunction cursor(markDef: MarkDef, encoding: Encoding, config: Config) {\n if (encoding.href || markDef.href || getMarkPropOrConfig('href', markDef, config)) {\n return 'pointer';\n }\n return markDef.cursor;\n}\n\nfunction opacity(mark: Mark, encoding: Encoding) {\n if (contains([POINT, TICK, CIRCLE, SQUARE], mark)) {\n // point-based marks\n if (!isAggregate(encoding)) {\n return 0.7;\n }\n }\n return undefined;\n}\n\nexport function defaultFilled(markDef: MarkDef, config: Config, {graticule}: {graticule: boolean}) {\n if (graticule) {\n return false;\n }\n const filledConfig = getMarkConfig('filled', markDef, config);\n const mark = markDef.type;\n return getFirstDefined(filledConfig, mark !== POINT && mark !== LINE && mark !== RULE);\n}\n\nfunction orient(mark: Mark, encoding: Encoding, specifiedOrient: Orientation): Orientation {\n switch (mark) {\n case POINT:\n case CIRCLE:\n case SQUARE:\n case TEXT:\n case RECT:\n case IMAGE:\n // orient is meaningless for these marks.\n return undefined;\n }\n\n const {x, y, x2, y2} = encoding;\n\n switch (mark) {\n case BAR:\n if (isFieldDef(x) && (isBinned(x.bin) || (isFieldDef(y) && y.aggregate && !x.aggregate))) {\n return 'vertical';\n }\n if (isFieldDef(y) && (isBinned(y.bin) || (isFieldDef(x) && x.aggregate && !y.aggregate))) {\n return 'horizontal';\n }\n if (y2 || x2) {\n // Ranged bar does not always have clear orientation, so we allow overriding\n if (specifiedOrient) {\n return specifiedOrient;\n }\n\n // If y is range and x is non-range, non-bin Q\n if (!x2) {\n if ((isFieldDef(x) && x.type === QUANTITATIVE && !isBinning(x.bin)) || isNumericDataDef(x)) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n }\n }\n return 'vertical';\n }\n\n // If x is range and y is non-range, non-bin Q\n if (!y2) {\n if ((isFieldDef(y) && y.type === QUANTITATIVE && !isBinning(y.bin)) || isNumericDataDef(y)) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n }\n }\n return 'horizontal';\n }\n }\n\n // falls through\n case RULE:\n // return undefined for line segment rule and bar with both axis ranged\n // we have to ignore the case that the data are already binned\n if (x2 && !(isFieldDef(x) && isBinned(x.bin)) && y2 && !(isFieldDef(y) && isBinned(y.bin))) {\n return undefined;\n }\n\n // falls through\n case AREA:\n // If there are range for both x and y, y (vertical) has higher precedence.\n if (y2) {\n if (isFieldDef(y) && isBinned(y.bin)) {\n return 'horizontal';\n } else {\n return 'vertical';\n }\n } else if (x2) {\n if (isFieldDef(x) && isBinned(x.bin)) {\n return 'vertical';\n } else {\n return 'horizontal';\n }\n } else if (mark === RULE) {\n if (x && !y) {\n return 'vertical';\n } else if (y && !x) {\n return 'horizontal';\n }\n }\n\n // falls through\n case LINE:\n case TICK: {\n const xIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(x);\n const yIsMeasure = isUnbinnedQuantitativeFieldOrDatumDef(y);\n\n if (specifiedOrient) {\n return specifiedOrient;\n } else if (xIsMeasure && !yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'horizontal' : 'vertical';\n } else if (!xIsMeasure && yIsMeasure) {\n // Tick is opposite to bar, line, area\n return mark !== 'tick' ? 'vertical' : 'horizontal';\n } else if (xIsMeasure && yIsMeasure) {\n return 'vertical';\n } else {\n const xIsTemporal = isTypedFieldDef(x) && x.type === TEMPORAL;\n const yIsTemporal = isTypedFieldDef(y) && y.type === TEMPORAL;\n\n // x: T, y: N --> vertical tick\n if (xIsTemporal && !yIsTemporal) {\n return 'vertical';\n } else if (!xIsTemporal && yIsTemporal) {\n return 'horizontal';\n }\n }\n return undefined;\n }\n }\n return 'vertical';\n}\n","import type {SignalRef} from 'vega';\nimport {isObject} from 'vega-util';\nimport {Config} from '../config';\nimport {Encoding, normalizeEncoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport {AreaConfig, isMarkDef, LineConfig, Mark, MarkConfig, MarkDef} from '../mark';\nimport {GenericUnitSpec, NormalizedUnitSpec} from '../spec';\nimport {isUnitSpec} from '../spec/unit';\nimport {stack} from '../stack';\nimport {keys, omit, pick} from '../util';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\nimport {initMarkdef} from '../compile/mark/init';\n\ntype UnitSpecWithPathOverlay = GenericUnitSpec, Mark | MarkDef<'line' | 'area' | 'rule' | 'trail'>>;\n\nfunction dropLineAndPoint(markDef: MarkDef): MarkDef | Mark {\n const {point: _point, line: _line, ...mark} = markDef;\n\n return keys(mark).length > 1 ? mark : mark.type;\n}\n\nfunction dropLineAndPointFromConfig(config: Config) {\n for (const mark of ['line', 'area', 'rule', 'trail'] as const) {\n if (config[mark]) {\n config = {\n ...config,\n // TODO: remove as any\n [mark]: omit(config[mark], ['point', 'line'] as any)\n };\n }\n }\n return config;\n}\n\nfunction getPointOverlay(\n markDef: MarkDef,\n markConfig: LineConfig = {},\n encoding: Encoding\n): MarkConfig {\n if (markDef.point === 'transparent') {\n return {opacity: 0};\n } else if (markDef.point) {\n // truthy : true or object\n return isObject(markDef.point) ? markDef.point : {};\n } else if (markDef.point !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.point || encoding.shape) {\n // enable point overlay if config[mark].point is truthy or if encoding.shape is provided\n return isObject(markConfig.point) ? markConfig.point : {};\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nfunction getLineOverlay(\n markDef: MarkDef,\n markConfig: AreaConfig = {}\n): MarkConfig {\n if (markDef.line) {\n // true or object\n return markDef.line === true ? {} : markDef.line;\n } else if (markDef.line !== undefined) {\n // false or null\n return null;\n } else {\n // undefined (not disabled)\n if (markConfig.line) {\n // enable line overlay if config[mark].line is truthy\n return markConfig.line === true ? {} : markConfig.line;\n }\n // markDef.point is defined as falsy\n return undefined;\n }\n}\n\nexport class PathOverlayNormalizer implements NonFacetUnitNormalizer {\n public name = 'path-overlay';\n\n public hasMatchingType(spec: GenericUnitSpec, config: Config): spec is UnitSpecWithPathOverlay {\n if (isUnitSpec(spec)) {\n const {mark, encoding} = spec;\n const markDef = isMarkDef(mark) ? mark : {type: mark};\n switch (markDef.type) {\n case 'line':\n case 'rule':\n case 'trail':\n return !!getPointOverlay(markDef, config[markDef.type], encoding);\n case 'area':\n return (\n // false / null are also included as we want to remove the properties\n !!getPointOverlay(markDef, config[markDef.type], encoding) ||\n !!getLineOverlay(markDef, config[markDef.type])\n );\n }\n }\n return false;\n }\n\n public run(spec: UnitSpecWithPathOverlay, normParams: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {config} = normParams;\n const {params, projection, mark, name, encoding: e, ...outerSpec} = spec;\n\n // Need to call normalizeEncoding because we need the inferred types to correctly determine stack\n const encoding = normalizeEncoding(e, config);\n\n const markDef: MarkDef = isMarkDef(mark) ? mark : {type: mark};\n\n const pointOverlay = getPointOverlay(markDef, config[markDef.type], encoding);\n\n const lineOverlay = markDef.type === 'area' && getLineOverlay(markDef, config[markDef.type]);\n\n const layer: NormalizedUnitSpec[] = [\n {\n name,\n ...(params ? {params} : {}),\n mark: dropLineAndPoint({\n // TODO: extract this 0.7 to be shared with default opacity for point/tick/...\n ...(markDef.type === 'area' && markDef.opacity === undefined && markDef.fillOpacity === undefined\n ? {opacity: 0.7}\n : {}),\n ...markDef\n }),\n // drop shape from encoding as this might be used to trigger point overlay\n encoding: omit(encoding, ['shape'])\n }\n ];\n\n // FIXME: determine rules for applying selections.\n\n // Need to copy stack config to overlayed layer\n // FIXME: normalizer shouldn't call `initMarkdef`, a method from an init phase.\n const stackProps = stack(initMarkdef(markDef, encoding, config), encoding);\n\n let overlayEncoding = encoding;\n if (stackProps) {\n const {fieldChannel: stackFieldChannel, offset} = stackProps;\n overlayEncoding = {\n ...encoding,\n [stackFieldChannel]: {\n ...encoding[stackFieldChannel],\n ...(offset ? {stack: offset} : {})\n }\n };\n }\n\n // overlay line layer should be on the edge of area but passing y2/x2 makes\n // it as \"rule\" mark so that it draws unwanted vertical/horizontal lines.\n // point overlay also should not have y2/x2 as it does not support.\n overlayEncoding = omit(overlayEncoding, ['y2', 'x2']);\n\n if (lineOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'line',\n ...pick(markDef, ['clip', 'interpolate', 'tension', 'tooltip']),\n ...lineOverlay\n },\n encoding: overlayEncoding\n });\n }\n if (pointOverlay) {\n layer.push({\n ...(projection ? {projection} : {}),\n mark: {\n type: 'point',\n opacity: 1,\n filled: true,\n ...pick(markDef, ['clip', 'tooltip']),\n ...pointOverlay\n },\n encoding: overlayEncoding\n });\n }\n\n return normalize(\n {\n ...outerSpec,\n layer\n },\n {\n ...normParams,\n config: dropLineAndPointFromConfig(config)\n }\n );\n }\n}\n","import {hasOwnProperty, isArray} from 'vega-util';\nimport {\n ChannelDef,\n DatumDef,\n Field,\n FieldDef,\n FieldName,\n hasConditionalFieldOrDatumDef,\n isConditionalDef,\n isFieldDef,\n isFieldOrDatumDef,\n isRepeatRef,\n isSortableFieldDef,\n ScaleFieldDef,\n ValueDef\n} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isSortField} from '../sort';\nimport {FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\n\nexport interface RepeaterValue {\n row?: string;\n column?: string;\n\n repeat?: string;\n\n layer?: string;\n}\n\nexport function replaceRepeaterInFacet(\n facet: FacetFieldDef | FacetMapping,\n repeater: RepeaterValue\n): FacetFieldDef | FacetMapping {\n if (!repeater) {\n return facet as FacetFieldDef;\n }\n\n if (isFacetMapping(facet)) {\n return replaceRepeaterInMapping(facet, repeater) as FacetMapping;\n }\n return replaceRepeaterInFieldDef(facet, repeater) as FacetFieldDef;\n}\n\nexport function replaceRepeaterInEncoding>(\n encoding: E,\n repeater: RepeaterValue\n): Encoding {\n if (!repeater) {\n return encoding as Encoding;\n }\n\n return replaceRepeaterInMapping(encoding, repeater) as Encoding;\n}\n\n/**\n * Replaces repeated value and returns if the repeated value is valid.\n */\nfunction replaceRepeatInProp(prop: keyof T, o: T, repeater: RepeaterValue): T {\n const val = o[prop];\n if (isRepeatRef(val)) {\n if (val.repeat in repeater) {\n return {...o, [prop]: repeater[val.repeat]};\n } else {\n log.warn(log.message.noSuchRepeatedValue(val.repeat));\n return undefined;\n }\n }\n return o;\n}\n\n/**\n * Replace repeater values in a field def with the concrete field name.\n */\n\nfunction replaceRepeaterInFieldDef(fieldDef: FieldDef, repeater: RepeaterValue) {\n fieldDef = replaceRepeatInProp('field', fieldDef, repeater);\n\n if (fieldDef === undefined) {\n // the field def should be ignored\n return undefined;\n } else if (fieldDef === null) {\n return null;\n }\n\n if (isSortableFieldDef(fieldDef) && isSortField(fieldDef.sort)) {\n const sort = replaceRepeatInProp('field', fieldDef.sort, repeater);\n fieldDef = {\n ...fieldDef,\n ...(sort ? {sort} : {})\n };\n }\n\n return fieldDef as ScaleFieldDef;\n}\n\nfunction replaceRepeaterInFieldOrDatumDef(def: FieldDef | DatumDef, repeater: RepeaterValue) {\n if (isFieldDef(def)) {\n return replaceRepeaterInFieldDef(def, repeater);\n } else {\n const datumDef = replaceRepeatInProp('datum', def, repeater);\n if (datumDef !== def && !datumDef.type) {\n datumDef.type = 'nominal';\n }\n return datumDef;\n }\n}\n\nfunction replaceRepeaterInChannelDef(channelDef: ChannelDef, repeater: RepeaterValue) {\n if (isFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef, repeater);\n if (fd) {\n return fd;\n } else if (isConditionalDef>(channelDef)) {\n return {condition: channelDef.condition};\n }\n } else {\n if (hasConditionalFieldOrDatumDef(channelDef)) {\n const fd = replaceRepeaterInFieldOrDatumDef(channelDef.condition, repeater);\n if (fd) {\n return {\n ...channelDef,\n condition: fd\n } as ChannelDef;\n } else {\n const {condition, ...channelDefWithoutCondition} = channelDef;\n return channelDefWithoutCondition as ChannelDef;\n }\n }\n return channelDef as ValueDef;\n }\n return undefined;\n}\n\ntype EncodingOrFacet = Encoding | FacetMapping;\n\nfunction replaceRepeaterInMapping(\n mapping: EncodingOrFacet,\n repeater: RepeaterValue\n): EncodingOrFacet {\n const out: EncodingOrFacet = {};\n for (const channel in mapping) {\n if (hasOwnProperty(mapping, channel)) {\n const channelDef: ChannelDef | ChannelDef[] = mapping[channel];\n\n if (isArray(channelDef)) {\n // array cannot have condition\n out[channel] = (channelDef as ChannelDef[]) // somehow we need to cast it here\n .map(cd => replaceRepeaterInChannelDef(cd, repeater))\n .filter(cd => cd);\n } else {\n const cd = replaceRepeaterInChannelDef(channelDef, repeater);\n if (cd !== undefined) {\n out[channel] = cd;\n }\n }\n }\n }\n return out;\n}\n","import {isObject} from 'vega-util';\nimport {isBinned} from '../bin';\nimport {getMainRangeChannel, SECONDARY_RANGE_CHANNEL} from '../channel';\nimport {Field, isDatumDef, isFieldDef} from '../channeldef';\nimport {Encoding} from '../encoding';\nimport * as log from '../log';\nimport {isMarkDef} from '../mark';\nimport {GenericSpec} from '../spec';\nimport {GenericUnitSpec, isUnitSpec} from '../spec/unit';\nimport {NonFacetUnitNormalizer, NormalizeLayerOrUnit, NormalizerParams} from './base';\n\ninterface EncodingX2Mixins {\n x2: Encoding['x2'];\n}\n\ninterface EncodingY2Mixins {\n y2: Encoding['y2'];\n}\n\ntype RangedLineSpec = GenericUnitSpec & (EncodingX2Mixins | EncodingY2Mixins), 'line' | {mark: 'line'}>;\n\nexport class RuleForRangedLineNormalizer implements NonFacetUnitNormalizer {\n public name = 'RuleForRangedLine';\n\n public hasMatchingType(spec: GenericSpec): spec is RangedLineSpec {\n if (isUnitSpec(spec)) {\n const {encoding, mark} = spec;\n if (mark === 'line' || (isMarkDef(mark) && mark.type === 'line')) {\n for (const channel of SECONDARY_RANGE_CHANNEL) {\n const mainChannel = getMainRangeChannel(channel);\n const mainChannelDef = encoding[mainChannel];\n\n if (encoding[channel]) {\n if ((isFieldDef(mainChannelDef) && !isBinned(mainChannelDef.bin)) || isDatumDef(mainChannelDef)) {\n return true;\n }\n }\n }\n }\n }\n return false;\n }\n\n public run(spec: RangedLineSpec, params: NormalizerParams, normalize: NormalizeLayerOrUnit) {\n const {encoding, mark} = spec;\n log.warn(log.message.lineWithRange(!!encoding.x2, !!encoding.y2));\n\n return normalize(\n {\n ...spec,\n mark: isObject(mark) ? {...mark, type: 'rule'} : 'rule'\n },\n params\n );\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {COLUMN, FACET, ROW} from '../channel';\nimport {Field, FieldName, hasConditionalFieldOrDatumDef, isFieldOrDatumDef, isValueDef} from '../channeldef';\nimport {SharedCompositeEncoding} from '../compositemark';\nimport {boxPlotNormalizer} from '../compositemark/boxplot';\nimport {errorBandNormalizer} from '../compositemark/errorband';\nimport {errorBarNormalizer} from '../compositemark/errorbar';\nimport {channelHasField, Encoding} from '../encoding';\nimport {ExprRef} from '../expr';\nimport * as log from '../log';\nimport {Projection} from '../projection';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, UnitSpec} from '../spec';\nimport {GenericCompositionLayoutWithColumns} from '../spec/base';\nimport {GenericConcatSpec} from '../spec/concat';\nimport {\n FacetEncodingFieldDef,\n FacetFieldDef,\n FacetMapping,\n GenericFacetSpec,\n isFacetMapping,\n NormalizedFacetSpec\n} from '../spec/facet';\nimport {NormalizedSpec} from '../spec/index';\nimport {NormalizedLayerSpec} from '../spec/layer';\nimport {SpecMapper} from '../spec/map';\nimport {isLayerRepeatSpec, LayerRepeatSpec, NonLayerRepeatSpec, RepeatSpec} from '../spec/repeat';\nimport {isUnitSpec, NormalizedUnitSpec} from '../spec/unit';\nimport {isEmpty, keys, omit, varName} from '../util';\nimport {isSignalRef} from '../vega.schema';\nimport {NonFacetUnitNormalizer, NormalizerParams} from './base';\nimport {PathOverlayNormalizer} from './pathoverlay';\nimport {replaceRepeaterInEncoding, replaceRepeaterInFacet} from './repeater';\nimport {RuleForRangedLineNormalizer} from './ruleforrangedline';\n\nexport class CoreNormalizer extends SpecMapper, LayerSpec> {\n private nonFacetUnitNormalizers: NonFacetUnitNormalizer[] = [\n boxPlotNormalizer,\n errorBarNormalizer,\n errorBandNormalizer,\n new PathOverlayNormalizer(),\n new RuleForRangedLineNormalizer()\n ];\n\n public map(spec: GenericSpec, LayerSpec, RepeatSpec, Field>, params: NormalizerParams) {\n // Special handling for a faceted unit spec as it can return a facet spec, not just a layer or unit spec like a normal unit spec.\n if (isUnitSpec(spec)) {\n const hasRow = channelHasField(spec.encoding, ROW);\n const hasColumn = channelHasField(spec.encoding, COLUMN);\n const hasFacet = channelHasField(spec.encoding, FACET);\n\n if (hasRow || hasColumn || hasFacet) {\n return this.mapFacetedUnit(spec, params);\n }\n }\n\n return super.map(spec, params);\n }\n\n // This is for normalizing non-facet unit\n public mapUnit(spec: UnitSpec, params: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const {parentEncoding, parentProjection} = params;\n\n const encoding = replaceRepeaterInEncoding(spec.encoding, params.repeater);\n\n const specWithReplacedEncoding = {\n ...spec,\n ...(spec.name ? {name: [params.repeaterPrefix, spec.name].filter(n => n).join('_')} : {}),\n ...(encoding ? {encoding} : {})\n };\n\n if (parentEncoding || parentProjection) {\n return this.mapUnitWithParentEncodingOrProjection(specWithReplacedEncoding, params);\n }\n\n const normalizeLayerOrUnit = this.mapLayerOrUnit.bind(this);\n\n for (const unitNormalizer of this.nonFacetUnitNormalizers) {\n if (unitNormalizer.hasMatchingType(specWithReplacedEncoding, params.config)) {\n return unitNormalizer.run(specWithReplacedEncoding, params, normalizeLayerOrUnit);\n }\n }\n\n return specWithReplacedEncoding as NormalizedUnitSpec;\n }\n\n protected mapRepeat(\n spec: RepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n if (isLayerRepeatSpec(spec)) {\n return this.mapLayerRepeat(spec, params);\n } else {\n return this.mapNonLayerRepeat(spec, params);\n }\n }\n\n private mapLayerRepeat(\n spec: LayerRepeatSpec,\n params: NormalizerParams\n ): GenericConcatSpec | NormalizedLayerSpec {\n const {repeat, spec: childSpec, ...rest} = spec;\n const {row, column, layer} = repeat;\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n if (row || column) {\n return this.mapRepeat(\n {\n ...spec,\n repeat: {\n ...(row ? {row} : {}),\n ...(column ? {column} : {})\n },\n spec: {\n repeat: {layer},\n spec: childSpec\n }\n },\n params\n );\n } else {\n return {\n ...rest,\n layer: layer.map(layerValue => {\n const childRepeater = {\n ...repeater,\n layer: layerValue\n };\n\n const childName = `${(childSpec.name ? `${childSpec.name}_` : '') + repeaterPrefix}child__layer_${varName(\n layerValue\n )}`;\n\n const child = this.mapLayerOrUnit(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n return child;\n })\n };\n }\n }\n\n private mapNonLayerRepeat(spec: NonLayerRepeatSpec, params: NormalizerParams): GenericConcatSpec {\n const {repeat, spec: childSpec, data, ...remainingProperties} = spec;\n\n if (!isArray(repeat) && spec.columns) {\n // is repeat with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('repeat'));\n }\n\n const concat: NormalizedSpec[] = [];\n\n const {repeater = {}, repeaterPrefix = ''} = params;\n\n const row = (!isArray(repeat) && repeat.row) || [repeater ? repeater.row : null];\n const column = (!isArray(repeat) && repeat.column) || [repeater ? repeater.column : null];\n\n const repeatValues = (isArray(repeat) && repeat) || [repeater ? repeater.repeat : null];\n\n // cross product\n for (const repeatValue of repeatValues) {\n for (const rowValue of row) {\n for (const columnValue of column) {\n const childRepeater = {\n repeat: repeatValue,\n row: rowValue,\n column: columnValue,\n layer: repeater.layer\n };\n\n const childName =\n (childSpec.name ? `${childSpec.name}_` : '') +\n repeaterPrefix +\n 'child__' +\n (isArray(repeat)\n ? `${varName(repeatValue)}`\n : (repeat.row ? `row_${varName(rowValue)}` : '') +\n (repeat.column ? `column_${varName(columnValue)}` : ''));\n\n const child = this.map(childSpec, {...params, repeater: childRepeater, repeaterPrefix: childName});\n child.name = childName;\n\n // we move data up\n concat.push(omit(child, ['data']) as NormalizedSpec);\n }\n }\n }\n\n const columns = isArray(repeat) ? spec.columns : repeat.column ? repeat.column.length : 1;\n return {\n data: childSpec.data ?? data, // data from child spec should have precedence\n align: 'all',\n ...remainingProperties,\n columns,\n concat\n };\n }\n\n protected mapFacet(\n spec: GenericFacetSpec, LayerSpec, Field>,\n params: NormalizerParams\n ): GenericFacetSpec {\n const {facet} = spec;\n\n if (isFacetMapping(facet) && spec.columns) {\n // is facet with row/column\n spec = omit(spec, ['columns']);\n log.warn(log.message.columnsNotSupportByRowCol('facet'));\n }\n\n return super.mapFacet(spec, params);\n }\n\n private mapUnitWithParentEncodingOrProjection(\n spec: FacetedUnitSpec,\n params: NormalizerParams\n ): NormalizedUnitSpec | NormalizedLayerSpec {\n const {encoding, projection} = spec;\n const {parentEncoding, parentProjection, config} = params;\n const mergedProjection = mergeProjection({parentProjection, projection});\n const mergedEncoding = mergeEncoding({\n parentEncoding,\n encoding: replaceRepeaterInEncoding(encoding, params.repeater)\n });\n\n return this.mapUnit(\n {\n ...spec,\n ...(mergedProjection ? {projection: mergedProjection} : {}),\n ...(mergedEncoding ? {encoding: mergedEncoding} : {})\n },\n {config}\n );\n }\n\n private mapFacetedUnit(spec: FacetedUnitSpec, normParams: NormalizerParams): NormalizedFacetSpec {\n // New encoding in the inside spec should not contain row / column\n // as row/column should be moved to facet\n const {row, column, facet, ...encoding} = spec.encoding;\n\n // Mark and encoding should be moved into the inner spec\n const {mark, width, projection, height, view, params, encoding: _, ...outerSpec} = spec;\n\n const {facetMapping, layout} = this.getFacetMappingAndLayout({row, column, facet}, normParams);\n\n const newEncoding = replaceRepeaterInEncoding(encoding, normParams.repeater);\n\n return this.mapFacet(\n {\n ...outerSpec,\n ...layout,\n\n // row / column has higher precedence than facet\n facet: facetMapping,\n spec: {\n ...(width ? {width} : {}),\n ...(height ? {height} : {}),\n ...(view ? {view} : {}),\n ...(projection ? {projection} : {}),\n mark,\n encoding: newEncoding,\n ...(params ? {params} : {})\n }\n },\n normParams\n );\n }\n\n private getFacetMappingAndLayout(\n facets: {\n row: FacetEncodingFieldDef;\n column: FacetEncodingFieldDef;\n facet: FacetEncodingFieldDef;\n },\n params: NormalizerParams\n ): {facetMapping: FacetMapping | FacetFieldDef; layout: GenericCompositionLayoutWithColumns} {\n const {row, column, facet} = facets;\n\n if (row || column) {\n if (facet) {\n log.warn(log.message.facetChannelDropped([...(row ? [ROW] : []), ...(column ? [COLUMN] : [])]));\n }\n\n const facetMapping = {};\n const layout = {};\n\n for (const channel of [ROW, COLUMN]) {\n const def = facets[channel];\n if (def) {\n const {align, center, spacing, columns, ...defWithoutLayout} = def;\n facetMapping[channel] = defWithoutLayout;\n\n for (const prop of ['align', 'center', 'spacing'] as const) {\n if (def[prop] !== undefined) {\n layout[prop] ??= {};\n layout[prop][channel] = def[prop];\n }\n }\n }\n }\n\n return {facetMapping, layout};\n } else {\n const {align, center, spacing, columns, ...facetMapping} = facet;\n return {\n facetMapping: replaceRepeaterInFacet(facetMapping, params.repeater),\n layout: {\n ...(align ? {align} : {}),\n ...(center ? {center} : {}),\n ...(spacing ? {spacing} : {}),\n ...(columns ? {columns} : {})\n }\n };\n }\n }\n\n public mapLayer(\n spec: LayerSpec,\n {parentEncoding, parentProjection, ...otherParams}: NormalizerParams\n ): NormalizedLayerSpec {\n // Special handling for extended layer spec\n\n const {encoding, projection, ...rest} = spec;\n const params: NormalizerParams = {\n ...otherParams,\n parentEncoding: mergeEncoding({parentEncoding, encoding, layer: true}),\n parentProjection: mergeProjection({parentProjection, projection})\n };\n return super.mapLayer(\n {\n ...rest,\n ...(spec.name ? {name: [params.repeaterPrefix, spec.name].filter(n => n).join('_')} : {})\n },\n params\n );\n }\n}\n\nfunction mergeEncoding({\n parentEncoding,\n encoding = {},\n layer\n}: {\n parentEncoding: SharedCompositeEncoding;\n encoding: SharedCompositeEncoding | Encoding;\n layer?: boolean;\n}): Encoding {\n let merged: any = {};\n if (parentEncoding) {\n const channels = new Set([...keys(parentEncoding), ...keys(encoding)]);\n for (const channel of channels) {\n const channelDef = encoding[channel];\n const parentChannelDef = parentEncoding[channel];\n\n if (isFieldOrDatumDef(channelDef)) {\n // Field/Datum Def can inherit properties from its parent\n // Note that parentChannelDef doesn't have to be a field/datum def if the channelDef is already one.\n const mergedChannelDef = {\n ...parentChannelDef,\n ...channelDef\n };\n merged[channel] = mergedChannelDef;\n } else if (hasConditionalFieldOrDatumDef(channelDef)) {\n merged[channel] = {\n ...channelDef,\n condition: {\n ...parentChannelDef,\n ...channelDef.condition\n }\n };\n } else if (channelDef || channelDef === null) {\n merged[channel] = channelDef;\n } else if (\n layer ||\n isValueDef(parentChannelDef) ||\n isSignalRef(parentChannelDef) ||\n isFieldOrDatumDef(parentChannelDef) ||\n isArray(parentChannelDef)\n ) {\n merged[channel] = parentChannelDef;\n }\n }\n } else {\n merged = encoding;\n }\n return !merged || isEmpty(merged) ? undefined : merged;\n}\n\nfunction mergeProjection(opt: {\n parentProjection: Projection;\n projection: Projection;\n}) {\n const {parentProjection, projection} = opt;\n if (parentProjection && projection) {\n log.warn(log.message.projectionOverridden({parentProjection, projection}));\n }\n return projection ?? parentProjection;\n}\n","import {AggregateOp} from 'vega';\nimport {BinParams} from './bin';\nimport {FieldName} from './channeldef';\nimport {Data} from './data';\nimport {ImputeParams} from './impute';\nimport {LogicalComposition, normalizeLogicalComposition} from './logical';\nimport {ParameterName} from './parameter';\nimport {normalizePredicate, Predicate} from './predicate';\nimport {SortField} from './sort';\nimport {TimeUnit, TimeUnitTransformParams} from './timeunit';\n\nexport interface FilterTransform {\n /**\n * The `filter` property must be a predication definition, which can take one of the following forms:\n *\n * 1) an [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string,\n * where `datum` can be used to refer to the current data object.\n * For example, `{filter: \"datum.b2 > 60\"}` would make the output data includes only items that have values in the field `b2` over 60.\n *\n * 2) one of the [field predicates](https://vega.github.io/vega-lite/docs/predicate.html#field-predicate):\n * [`equal`](https://vega.github.io/vega-lite/docs/predicate.html#field-equal-predicate),\n * [`lt`](https://vega.github.io/vega-lite/docs/predicate.html#lt-predicate),\n * [`lte`](https://vega.github.io/vega-lite/docs/predicate.html#lte-predicate),\n * [`gt`](https://vega.github.io/vega-lite/docs/predicate.html#gt-predicate),\n * [`gte`](https://vega.github.io/vega-lite/docs/predicate.html#gte-predicate),\n * [`range`](https://vega.github.io/vega-lite/docs/predicate.html#range-predicate),\n * [`oneOf`](https://vega.github.io/vega-lite/docs/predicate.html#one-of-predicate),\n * or [`valid`](https://vega.github.io/vega-lite/docs/predicate.html#valid-predicate),\n\n * 3) a [selection predicate](https://vega.github.io/vega-lite/docs/predicate.html#selection-predicate), which define the names of a selection that the data point should belong to (or a logical composition of selections).\n *\n * 4) a [logical composition](https://vega.github.io/vega-lite/docs/predicate.html#composition) of (1), (2), or (3).\n */\n filter: LogicalComposition;\n}\n\nexport function isFilter(t: Transform): t is FilterTransform {\n return 'filter' in t;\n}\n\nexport interface CalculateTransform {\n /**\n * A [expression](https://vega.github.io/vega-lite/docs/types.html#expression) string. Use the variable `datum` to refer to the current data object.\n */\n calculate: string;\n\n /**\n * The field for storing the computed formula value.\n */\n as: FieldName;\n}\n\nexport interface BinTransform {\n /**\n * An object indicating bin properties, or simply `true` for using default bin parameters.\n */\n bin: true | BinParams;\n\n /**\n * The data field to bin.\n */\n field: FieldName;\n\n /**\n * The output fields at which to write the start and end bin values.\n * This can be either a string or an array of strings with two elements denoting the name for the fields for bin start and bin end respectively.\n * If a single string (e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | FieldName[];\n}\n\nexport interface TimeUnitTransform {\n /**\n * The timeUnit.\n */\n timeUnit: TimeUnit | TimeUnitTransformParams;\n\n /**\n * The data field to apply time unit.\n */\n field: FieldName;\n\n /**\n * The output field to write the timeUnit value.\n */\n as: FieldName;\n}\n\nexport interface AggregateTransform {\n /**\n * Array of objects that define fields to aggregate.\n */\n aggregate: AggregatedFieldDef[];\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n}\n\nexport interface AggregatedFieldDef {\n /**\n * The aggregation operation to apply to the fields (e.g., `\"sum\"`, `\"average\"`, or `\"count\"`).\n * See the [full list of supported aggregation operations](https://vega.github.io/vega-lite/docs/aggregate.html#ops)\n * for more information.\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute aggregate function. This is required for all aggregation operations except `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output field names to use for each aggregated field.\n */\n as: FieldName;\n}\n\nexport interface StackTransform {\n /**\n * The field which is stacked.\n */\n stack: FieldName;\n /**\n * The data fields to group by.\n */\n groupby: FieldName[];\n /**\n * Mode for stacking marks. One of `\"zero\"` (default), `\"center\"`, or `\"normalize\"`.\n * The `\"zero\"` offset will stack starting at `0`. The `\"center\"` offset will center the stacks. The `\"normalize\"` offset will compute percentage values for each stack point, with output values in the range `[0,1]`.\n *\n * __Default value:__ `\"zero\"`\n */\n offset?: 'zero' | 'center' | 'normalize';\n /**\n * Field that determines the order of leaves in the stacked charts.\n */\n sort?: SortField[];\n /**\n * Output field names. This can be either a string or an array of strings with two elements denoting the name for the fields for stack start and stack end respectively.\n * If a single string(e.g., `\"val\"`) is provided, the end field will be `\"val_end\"`.\n */\n as: FieldName | [FieldName, FieldName];\n}\n\nexport type WindowOnlyOp =\n | 'row_number'\n | 'rank'\n | 'dense_rank'\n | 'percent_rank'\n | 'cume_dist'\n | 'ntile'\n | 'lag'\n | 'lead'\n | 'first_value'\n | 'last_value'\n | 'nth_value';\n\nexport interface WindowFieldDef {\n /**\n * The window or aggregation operation to apply within a window (e.g., `\"rank\"`, `\"lead\"`, `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/window.html#ops).\n */\n op: AggregateOp | WindowOnlyOp;\n\n /**\n * Parameter values for the window functions. Parameter values can be omitted for operations that do not accept a parameter.\n *\n * See the list of all supported operations and their parameters [here](https://vega.github.io/vega-lite/docs/transforms/window.html).\n */\n param?: number;\n\n /**\n * The data field for which to compute the aggregate or window function. This can be omitted for window functions that do not operate over a field such as `\"count\"`, `\"rank\"`, `\"dense_rank\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the window operation.\n */\n as: FieldName;\n}\n\nexport interface WindowTransform {\n /**\n * The definition of the fields in the window, and what calculations to use.\n */\n window: WindowFieldDef[];\n\n /**\n * A frame specification as a two-element array indicating how the sliding window should proceed. The array entries should either be a number indicating the offset from the current data object, or null to indicate unbounded rows preceding or following the current data object. The default value is `[null, 0]`, indicating that the sliding window includes the current object and all preceding objects. The value `[-5, 5]` indicates that the window should include five objects preceding and five objects following the current object. Finally, `[null, null]` indicates that the window frame should always include all data objects. If you this frame and want to assign the same value to add objects, you can use the simpler [join aggregate transform](https://vega.github.io/vega-lite/docs/joinaggregate.html). The only operators affected are the aggregation operations and the `first_value`, `last_value`, and `nth_value` window operations. The other window operations are not affected by this.\n *\n * __Default value:__: `[null, 0]` (includes the current object and all preceding objects)\n */\n frame?: (null | number)[];\n\n /**\n * Indicates if the sliding window frame should ignore peer values (data that are considered identical by the sort criteria). The default is false, causing the window frame to expand to include all peer values. If set to true, the window frame will be defined by offset values only. This setting only affects those operations that depend on the window frame, namely aggregation operations and the first_value, last_value, and nth_value window operations.\n *\n * __Default value:__ `false`\n */\n ignorePeers?: boolean;\n\n /**\n * The data fields for partitioning the data objects into separate windows. If unspecified, all data points will be in a single window.\n */\n groupby?: FieldName[];\n\n /**\n * A sort field definition for sorting data objects within a window. If two data objects are considered equal by the comparator, they are considered \"peer\" values of equal rank. If sort is not specified, the order is undefined: data objects are processed in the order they are observed and none are considered peers (the ignorePeers parameter is ignored and treated as if set to `true`).\n */\n sort?: SortField[];\n}\n\nexport interface JoinAggregateFieldDef {\n /**\n * The aggregation operation to apply (e.g., `\"sum\"`, `\"average\"` or `\"count\"`). See the list of all supported operations [here](https://vega.github.io/vega-lite/docs/aggregate.html#ops).\n */\n op: AggregateOp;\n\n /**\n * The data field for which to compute the aggregate function. This can be omitted for functions that do not operate over a field such as `\"count\"`.\n */\n field?: FieldName;\n\n /**\n * The output name for the join aggregate operation.\n */\n as: FieldName;\n}\n\nexport interface JoinAggregateTransform {\n /**\n * The definition of the fields in the join aggregate, and what calculations to use.\n */\n joinaggregate: JoinAggregateFieldDef[];\n\n /**\n * The data fields for partitioning the data objects into separate groups. If unspecified, all data points will be in a single group.\n */\n groupby?: FieldName[];\n}\n\nexport interface ImputeSequence {\n /**\n * The starting value of the sequence.\n * __Default value:__ `0`\n */\n start?: number;\n /**\n * The ending value(exclusive) of the sequence.\n */\n stop: number;\n /**\n * The step value between sequence entries.\n * __Default value:__ `1` or `-1` if `stop < start`\n */\n step?: number;\n}\n\nexport function isImputeSequence(t: ImputeSequence | any[] | undefined): t is ImputeSequence {\n return t?.['stop'] !== undefined;\n}\n\nexport interface ImputeTransform extends ImputeParams {\n /**\n * The data field for which the missing values should be imputed.\n */\n impute: FieldName;\n\n /**\n * A key field that uniquely identifies data objects within a group.\n * Missing key values (those occurring in the data but not in the current group) will be imputed.\n */\n key: FieldName;\n\n /**\n * An optional array of fields by which to group the values.\n * Imputation will then be performed on a per-group basis.\n */\n groupby?: FieldName[];\n}\n\nexport interface FlattenTransform {\n /**\n * An array of one or more data fields containing arrays to flatten.\n * If multiple fields are specified, their array values should have a parallel structure, ideally with the same length.\n * If the lengths of parallel arrays do not match,\n * the longest array will be used with `null` values added for missing entries.\n */\n flatten: FieldName[];\n\n /**\n * The output field names for extracted array values.\n *\n * __Default value:__ The field name of the corresponding array field\n */\n as?: FieldName[];\n}\n\nexport interface SampleTransform {\n /**\n * The maximum number of data objects to include in the sample.\n *\n * __Default value:__ `1000`\n */\n sample: number;\n}\n\nexport interface LookupBase {\n /**\n * Key in data to lookup.\n */\n key: FieldName;\n /**\n * Fields in foreign data or selection to lookup.\n * If not specified, the entire object is queried.\n */\n fields?: FieldName[];\n}\n\nexport interface LookupData extends LookupBase {\n /**\n * Secondary data source to lookup in.\n */\n data: Data;\n}\n\nexport interface LookupSelection extends LookupBase {\n /**\n * Selection parameter name to look up.\n */\n param: ParameterName;\n}\n\nexport interface LookupTransform {\n /**\n * Key in primary data source.\n */\n lookup: string;\n\n /**\n * The output fields on which to store the looked up data values.\n *\n * For data lookups, this property may be left blank if `from.fields`\n * has been specified (those field names will be used); if `from.fields`\n * has not been specified, `as` must be a string.\n *\n * For selection lookups, this property is optional: if unspecified,\n * looked up values will be stored under a property named for the selection;\n * and if specified, it must correspond to `from.fields`.\n */\n as?: FieldName | FieldName[];\n\n /**\n * The default value to use if lookup fails.\n *\n * __Default value:__ `null`\n */\n default?: any;\n\n /**\n * Data source or selection for secondary data reference.\n */\n from: LookupData | LookupSelection;\n}\n\nexport function isLookup(t: Transform): t is LookupTransform {\n return 'lookup' in t;\n}\n\nexport function isLookupData(from: LookupData | LookupSelection): from is LookupData {\n return 'data' in from;\n}\n\nexport function isLookupSelection(from: LookupData | LookupSelection): from is LookupSelection {\n return 'param' in from;\n}\n\nexport interface FoldTransform {\n /**\n * An array of data fields indicating the properties to fold.\n */\n fold: FieldName[];\n\n /**\n * The output field names for the key and value properties produced by the fold transform.\n * __Default value:__ `[\"key\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport interface ExtentTransform {\n /**\n * The field of which to get the extent.\n */\n extent: FieldName;\n\n /**\n * The output parameter produced by the extent transform.\n */\n param: ParameterName;\n}\n\nexport interface PivotTransform {\n /**\n * The data field to pivot on. The unique values of this field become new field names in the output stream.\n */\n pivot: FieldName;\n\n /**\n * The data field to populate pivoted fields. The aggregate values of this field become the values of the new pivoted fields.\n */\n value: FieldName;\n\n /**\n * The optional data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An optional parameter indicating the maximum number of pivoted fields to generate.\n * The default (`0`) applies no limit. The pivoted `pivot` names are sorted in ascending order prior to enforcing the limit.\n * __Default value:__ `0`\n */\n limit?: number;\n\n /**\n * The aggregation operation to apply to grouped `value` field values.\n * __Default value:__ `sum`\n */\n op?: AggregateOp;\n}\n\nexport function isPivot(t: Transform): t is PivotTransform {\n return 'pivot' in t;\n}\n\nexport interface DensityTransform {\n /**\n * The data field for which to perform density estimation.\n */\n density: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A boolean flag indicating whether to produce density estimates (false) or cumulative density estimates (true).\n *\n * __Default value:__ `false`\n */\n cumulative?: boolean;\n\n /**\n * A boolean flag indicating if the output values should be probability estimates (false) or smoothed counts (true).\n *\n * __Default value:__ `false`\n */\n counts?: boolean;\n\n /**\n * The bandwidth (standard deviation) of the Gaussian kernel. If unspecified or set to zero, the bandwidth value is automatically estimated from the input data using Scott’s rule.\n */\n bandwidth?: number;\n\n /**\n * A [min, max] domain from which to sample the distribution. If unspecified, the extent will be determined by the observed minimum and maximum values of the density value field.\n */\n extent?: [number, number];\n\n /**\n * The minimum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `25`\n */\n minsteps?: number;\n\n /**\n * The maximum number of samples to take along the extent domain for plotting the density.\n *\n * __Default value:__ `200`\n */\n maxsteps?: number;\n\n /**\n * The exact number of samples to take along the extent domain for plotting the density. If specified, overrides both minsteps and maxsteps to set an exact number of uniform samples. Potentially useful in conjunction with a fixed extent to ensure consistent sample points for stacked densities.\n */\n steps?: number;\n\n /**\n * The output fields for the sample value and corresponding density estimate.\n *\n * __Default value:__ `[\"value\", \"density\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isDensity(t: Transform): t is DensityTransform {\n return 'density' in t;\n}\n\nexport interface QuantileTransform {\n /**\n * The data field for which to perform quantile estimation.\n */\n quantile: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * An array of probabilities in the range (0, 1) for which to compute quantile values. If not specified, the *step* parameter will be used.\n */\n probs?: number[];\n\n /**\n * A probability step size (default 0.01) for sampling quantile values. All values from one-half the step size up to 1 (exclusive) will be sampled. This parameter is only used if the *probs* parameter is not provided.\n */\n step?: number;\n\n /**\n * The output field names for the probability and quantile values.\n *\n * __Default value:__ `[\"prob\", \"value\"]`\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isQuantile(t: Transform): t is QuantileTransform {\n return 'quantile' in t;\n}\n\nexport interface RegressionTransform {\n /**\n * The data field of the dependent variable to predict.\n */\n regression: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * The functional form of the regression model. One of `\"linear\"`, `\"log\"`, `\"exp\"`, `\"pow\"`, `\"quad\"`, or `\"poly\"`.\n *\n * __Default value:__ `\"linear\"`\n */\n method?: 'linear' | 'log' | 'exp' | 'pow' | 'quad' | 'poly';\n\n /**\n * The polynomial order (number of coefficients) for the 'poly' method.\n *\n * __Default value:__ `3`\n */\n order?: number;\n\n /**\n * A [min, max] domain over the independent (x) field for the starting and ending points of the generated trend line.\n */\n extent?: [number, number];\n\n /**\n * A boolean flag indicating if the transform should return the regression model parameters (one object per group), rather than trend line points.\n * The resulting objects include a `coef` array of fitted coefficient values (starting with the intercept term and then including terms of increasing order)\n * and an `rSquared` value (indicating the total variance explained by the model).\n *\n * __Default value:__ `false`\n */\n params?: boolean;\n\n /**\n * The output field names for the smoothed points generated by the regression transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isRegression(t: Transform): t is RegressionTransform {\n return 'regression' in t;\n}\n\nexport interface LoessTransform {\n /**\n * The data field of the dependent variable to smooth.\n */\n loess: FieldName;\n\n /**\n * The data field of the independent variable to use a predictor.\n */\n on: FieldName;\n\n /**\n * The data fields to group by. If not specified, a single group containing all data objects will be used.\n */\n groupby?: FieldName[];\n\n /**\n * A bandwidth parameter in the range `[0, 1]` that determines the amount of smoothing.\n *\n * __Default value:__ `0.3`\n */\n bandwidth?: number;\n\n /**\n * The output field names for the smoothed points generated by the loess transform.\n *\n * __Default value:__ The field names of the input x and y values.\n */\n as?: [FieldName, FieldName];\n}\n\nexport function isLoess(t: Transform): t is LoessTransform {\n return 'loess' in t;\n}\n\nexport function isSample(t: Transform): t is SampleTransform {\n return 'sample' in t;\n}\n\nexport function isWindow(t: Transform): t is WindowTransform {\n return 'window' in t;\n}\n\nexport function isJoinAggregate(t: Transform): t is JoinAggregateTransform {\n return 'joinaggregate' in t;\n}\n\nexport function isFlatten(t: Transform): t is FlattenTransform {\n return 'flatten' in t;\n}\nexport function isCalculate(t: Transform): t is CalculateTransform {\n return 'calculate' in t;\n}\n\nexport function isBin(t: Transform): t is BinTransform {\n return 'bin' in t;\n}\n\nexport function isImpute(t: Transform): t is ImputeTransform {\n return 'impute' in t;\n}\n\nexport function isTimeUnit(t: Transform): t is TimeUnitTransform {\n return 'timeUnit' in t;\n}\n\nexport function isAggregate(t: Transform): t is AggregateTransform {\n return 'aggregate' in t;\n}\n\nexport function isStack(t: Transform): t is StackTransform {\n return 'stack' in t;\n}\n\nexport function isFold(t: Transform): t is FoldTransform {\n return 'fold' in t;\n}\n\nexport function isExtent(t: Transform): t is ExtentTransform {\n return 'extent' in t && !('density' in t);\n}\nexport type Transform =\n | AggregateTransform\n | BinTransform\n | CalculateTransform\n | DensityTransform\n | ExtentTransform\n | FilterTransform\n | FlattenTransform\n | FoldTransform\n | ImputeTransform\n | JoinAggregateTransform\n | LoessTransform\n | LookupTransform\n | QuantileTransform\n | RegressionTransform\n | TimeUnitTransform\n | SampleTransform\n | StackTransform\n | WindowTransform\n | PivotTransform;\n\nexport function normalizeTransform(transform: Transform[]) {\n return transform.map(t => {\n if (isFilter(t)) {\n return {\n filter: normalizeLogicalComposition(t.filter, normalizePredicate)\n };\n }\n return t;\n });\n}\n","import {isArray} from 'vega';\nimport {BinParams, isBinParams} from '../bin';\nimport {ChannelDef, Field, isConditionalDef, isFieldDef, isScaleFieldDef} from '../channeldef';\nimport {LogicalComposition, normalizeLogicalComposition} from '../logical';\nimport {FacetedUnitSpec, GenericSpec, LayerSpec, RepeatSpec, UnitSpec} from '../spec';\nimport {SpecMapper} from '../spec/map';\nimport {isBin, isFilter, isLookup} from '../transform';\nimport {duplicate, entries, vals} from '../util';\nimport {NormalizerParams} from './base';\n\nexport class SelectionCompatibilityNormalizer extends SpecMapper<\n NormalizerParams,\n FacetedUnitSpec,\n LayerSpec,\n UnitSpec\n> {\n public map(\n spec: GenericSpec, LayerSpec, RepeatSpec, Field>,\n normParams: NormalizerParams\n ) {\n normParams.emptySelections ??= {};\n normParams.selectionPredicates ??= {};\n spec = normalizeTransforms(spec, normParams);\n return super.map(spec, normParams);\n }\n\n public mapLayerOrUnit(spec: FacetedUnitSpec | LayerSpec, normParams: NormalizerParams) {\n spec = normalizeTransforms(spec, normParams);\n\n if (spec.encoding) {\n const encoding = {};\n for (const [channel, enc] of entries(spec.encoding)) {\n encoding[channel] = normalizeChannelDef(enc, normParams);\n }\n\n spec = {...spec, encoding};\n }\n\n return super.mapLayerOrUnit(spec, normParams);\n }\n\n public mapUnit(spec: UnitSpec, normParams: NormalizerParams) {\n const {selection, ...rest} = spec as any;\n if (selection) {\n return {\n ...rest,\n params: entries(selection).map(([name, selDef]) => {\n const {init: value, bind, empty, ...select} = selDef as any;\n if (select.type === 'single') {\n select.type = 'point';\n select.toggle = false;\n } else if (select.type === 'multi') {\n select.type = 'point';\n }\n\n // Propagate emptiness forwards and backwards\n normParams.emptySelections[name] = empty !== 'none';\n for (const pred of vals(normParams.selectionPredicates[name] ?? {})) {\n pred.empty = empty !== 'none';\n }\n\n return {name, value, select, bind};\n })\n };\n }\n\n return spec;\n }\n}\n\nfunction normalizeTransforms(spec: any, normParams: NormalizerParams) {\n const {transform: tx, ...rest} = spec;\n if (tx) {\n const transform = tx.map((t: any) => {\n if (isFilter(t)) {\n return {filter: normalizePredicate(t, normParams)};\n } else if (isBin(t) && isBinParams(t.bin)) {\n return {\n ...t,\n bin: normalizeBinExtent(t.bin)\n };\n } else if (isLookup(t)) {\n const {selection: param, ...from} = t.from as any;\n return param\n ? {\n ...t,\n from: {param, ...from}\n }\n : t;\n }\n return t;\n });\n\n return {...rest, transform};\n }\n\n return spec;\n}\n\nfunction normalizeChannelDef(obj: any, normParams: NormalizerParams): ChannelDef {\n const enc = duplicate(obj);\n\n if (isFieldDef(enc) && isBinParams(enc.bin)) {\n enc.bin = normalizeBinExtent(enc.bin);\n }\n\n if (isScaleFieldDef(enc) && (enc.scale?.domain as any)?.selection) {\n const {selection: param, ...domain} = enc.scale.domain as any;\n enc.scale.domain = {...domain, ...(param ? {param} : {})};\n }\n\n if (isConditionalDef(enc)) {\n if (isArray(enc.condition)) {\n enc.condition = enc.condition.map((c: any) => {\n const {selection, param, test, ...cond} = c;\n return param ? c : {...cond, test: normalizePredicate(c, normParams)};\n });\n } else {\n const {selection, param, test, ...cond} = normalizeChannelDef(enc.condition, normParams) as any;\n enc.condition = param\n ? enc.condition\n : {\n ...cond,\n test: normalizePredicate(enc.condition, normParams)\n };\n }\n }\n\n return enc;\n}\n\nfunction normalizeBinExtent(bin: BinParams): BinParams {\n const ext = bin.extent as any;\n if (ext?.selection) {\n const {selection: param, ...rest} = ext;\n return {...bin, extent: {...rest, param}};\n }\n\n return bin;\n}\n\nfunction normalizePredicate(op: any, normParams: NormalizerParams) {\n // Normalize old compositions of selection names (e.g., selection: {and: [\"one\", \"two\"]})\n const normalizeSelectionComposition = (o: LogicalComposition) => {\n return normalizeLogicalComposition(o, param => {\n const empty = normParams.emptySelections[param] ?? true;\n const pred = {param, empty};\n normParams.selectionPredicates[param] ??= [];\n normParams.selectionPredicates[param].push(pred);\n return pred as any;\n });\n };\n\n return op.selection\n ? normalizeSelectionComposition(op.selection)\n : normalizeLogicalComposition(op.test || op.filter, o =>\n o.selection ? normalizeSelectionComposition(o.selection) : o\n );\n}\n","import {isArray, isString} from 'vega';\nimport {Field} from '../channeldef';\nimport {VariableParameter} from '../parameter';\nimport {isSelectionParameter, SelectionParameter} from '../selection';\nimport {\n BaseSpec,\n isUnitSpec,\n NormalizedLayerSpec,\n NormalizedSpec,\n NormalizedUnitSpec,\n TopLevel,\n UnitSpec\n} from '../spec';\nimport {SpecMapper} from '../spec/map';\nimport {NormalizerParams} from './base';\n\nexport class TopLevelSelectionsNormalizer extends SpecMapper {\n public map(spec: TopLevel, normParams: NormalizerParams): TopLevel {\n const selections = normParams.selections ?? [];\n if (spec.params && !isUnitSpec(spec)) {\n const params: VariableParameter[] = [];\n for (const param of spec.params) {\n if (isSelectionParameter(param)) {\n selections.push(param);\n } else {\n params.push(param);\n }\n }\n\n spec.params = params;\n }\n\n normParams.selections = selections;\n return super.map(spec, normParams);\n }\n\n public mapUnit(spec: UnitSpec, normParams: NormalizerParams): NormalizedUnitSpec | NormalizedLayerSpec {\n const selections = normParams.selections;\n if (!selections || !selections.length) return spec as NormalizedUnitSpec;\n\n const path = (normParams.path ?? []).concat(spec.name);\n const params: SelectionParameter[] = [];\n\n for (const selection of selections) {\n // By default, apply selections to all unit views.\n if (!selection.views || !selection.views.length) {\n params.push(selection);\n } else {\n for (const view of selection.views) {\n // view is either a specific unit name, or a partial path through the spec tree.\n if (\n (isString(view) && (view === spec.name || path.includes(view))) ||\n (isArray(view) &&\n // logic for backwards compatibility with view paths before we had unique names\n // @ts-ignore\n view.map(v => path.indexOf(v)).every((v, i, arr) => v !== -1 && (i === 0 || v > arr[i - 1])))\n ) {\n params.push(selection);\n }\n }\n }\n }\n\n if (params.length) spec.params = params;\n return spec as NormalizedUnitSpec;\n }\n}\n\nfor (const method of ['mapFacet', 'mapRepeat', 'mapHConcat', 'mapVConcat', 'mapLayer']) {\n const proto = TopLevelSelectionsNormalizer.prototype[method];\n TopLevelSelectionsNormalizer.prototype[method] = function (spec: BaseSpec, params: NormalizerParams) {\n return proto.call(this, spec, addSpecNameToParams(spec, params));\n };\n}\n\nfunction addSpecNameToParams(spec: BaseSpec, params: NormalizerParams) {\n return spec.name\n ? {\n ...params,\n path: (params.path ?? []).concat(spec.name)\n }\n : params;\n}\n","import type {SignalRef} from 'vega';\nimport {isString} from 'vega-util';\nimport {Field} from '../channeldef';\nimport {Config, initConfig} from '../config';\nimport * as log from '../log';\nimport {\n FacetedUnitSpec,\n isLayerSpec,\n isUnitSpec,\n LayoutSizeMixins,\n NonNormalizedSpec,\n NormalizedSpec,\n RepeatSpec,\n TopLevelSpec\n} from '../spec';\nimport {AutoSizeParams, AutosizeType, TopLevel} from '../spec/toplevel';\nimport {deepEqual} from '../util';\nimport {NormalizerParams} from './base';\nimport {CoreNormalizer} from './core';\nimport {SelectionCompatibilityNormalizer} from './selectioncompat';\nimport {TopLevelSelectionsNormalizer} from './toplevelselection';\n\nexport function normalize(\n spec: TopLevelSpec & LayoutSizeMixins,\n config?: Config\n): TopLevel & LayoutSizeMixins {\n if (config === undefined) {\n config = initConfig(spec.config);\n }\n\n const normalizedSpec = normalizeGenericSpec(spec, config);\n\n const {width, height} = spec;\n const autosize = normalizeAutoSize(normalizedSpec, {width, height, autosize: spec.autosize}, config);\n\n return {\n ...normalizedSpec,\n ...(autosize ? {autosize} : {})\n };\n}\n\nconst coreNormalizer = new CoreNormalizer();\nconst selectionCompatNormalizer = new SelectionCompatibilityNormalizer();\nconst topLevelSelectionNormalizer = new TopLevelSelectionsNormalizer();\n\n/**\n * Decompose extended unit specs into composition of pure unit specs.\n * And push top-level selection definitions down to unit specs.\n */\nfunction normalizeGenericSpec(\n spec: NonNormalizedSpec | FacetedUnitSpec | RepeatSpec,\n config: Config = {}\n) {\n const normParams = {config};\n return topLevelSelectionNormalizer.map(\n coreNormalizer.map(selectionCompatNormalizer.map(spec, normParams), normParams),\n normParams\n );\n}\n\nfunction _normalizeAutoSize(autosize: AutosizeType | AutoSizeParams) {\n return isString(autosize) ? {type: autosize} : autosize ?? {};\n}\n\n/**\n * Normalize autosize and deal with width or height == \"container\".\n */\nexport function normalizeAutoSize(\n spec: TopLevel,\n sizeInfo: {autosize: AutosizeType | AutoSizeParams} & LayoutSizeMixins,\n config?: Config\n) {\n let {width, height} = sizeInfo;\n\n const isFitCompatible = isUnitSpec(spec) || isLayerSpec(spec);\n const autosizeDefault: AutoSizeParams = {};\n\n if (!isFitCompatible) {\n // If spec is not compatible with autosize == \"fit\", discard width/height == container\n if (width == 'container') {\n log.warn(log.message.containerSizeNonSingle('width'));\n width = undefined;\n }\n if (height == 'container') {\n log.warn(log.message.containerSizeNonSingle('height'));\n height = undefined;\n }\n } else {\n // Default autosize parameters to fit when width/height is \"container\"\n if (width == 'container' && height == 'container') {\n autosizeDefault.type = 'fit';\n autosizeDefault.contains = 'padding';\n } else if (width == 'container') {\n autosizeDefault.type = 'fit-x';\n autosizeDefault.contains = 'padding';\n } else if (height == 'container') {\n autosizeDefault.type = 'fit-y';\n autosizeDefault.contains = 'padding';\n }\n }\n\n const autosize: AutoSizeParams = {\n type: 'pad',\n ...autosizeDefault,\n ...(config ? _normalizeAutoSize(config.autosize) : {}),\n ..._normalizeAutoSize(spec.autosize)\n };\n\n if (autosize.type === 'fit' && !isFitCompatible) {\n log.warn(log.message.FIT_NON_SINGLE);\n autosize.type = 'pad';\n }\n\n if (width == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-x')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('width'));\n }\n if (height == 'container' && !(autosize.type == 'fit' || autosize.type == 'fit-y')) {\n log.warn(log.message.containerSizeNotCompatibleWithAutosize('height'));\n }\n\n // Delete autosize property if it's Vega's default\n if (deepEqual(autosize, {type: 'pad'})) {\n return undefined;\n }\n\n return autosize;\n}\n\nexport type {NormalizerParams};\n","import {Color, SignalRef} from 'vega';\nimport {BaseSpec} from '.';\nimport {getPositionScaleChannel} from '../channel';\nimport {signalRefOrValue} from '../compile/common';\nimport {Config} from '../config';\nimport {InlineDataset} from '../data';\nimport {ExprRef} from '../expr';\nimport {VariableParameter} from '../parameter';\nimport {TopLevelSelectionParameter} from '../selection';\nimport {Dict} from '../util';\n\n/**\n * @minimum 0\n */\nexport type Padding = number | {top?: number; bottom?: number; left?: number; right?: number};\n\nexport type Datasets = Dict;\n\nexport type TopLevelParameter = VariableParameter | TopLevelSelectionParameter;\n\nexport type TopLevel = S &\n TopLevelProperties & {\n /**\n * URL to [JSON schema](http://json-schema.org/) for a Vega-Lite specification. Unless you have a reason to change this, use `https://vega.github.io/schema/vega-lite/v5.json`. Setting the `$schema` property allows automatic validation and autocomplete in editors that support JSON schema.\n * @format uri\n */\n $schema?: string;\n\n /**\n * Vega-Lite configuration object. This property can only be defined at the top-level of a specification.\n */\n config?: Config;\n\n /**\n * A global data store for named datasets. This is a mapping from names to inline datasets.\n * This can be an array of objects or primitive values or a string. Arrays of primitive values are ingested as objects with a `data` property.\n */\n datasets?: Datasets;\n\n /**\n * Optional metadata that will be passed to Vega.\n * This object is completely ignored by Vega and Vega-Lite and can be used for custom metadata.\n */\n usermeta?: Dict;\n };\n\n/**\n * Shared properties between Top-Level specs and Config\n */\nexport interface TopLevelProperties {\n /**\n * CSS color property to use as the background of the entire view.\n *\n * __Default value:__ `\"white\"`\n */\n background?: Color | ES;\n\n /**\n * The default visualization padding, in pixels, from the edge of the visualization canvas to the data rectangle. If a number, specifies padding for all sides.\n * If an object, the value should have the format `{\"left\": 5, \"top\": 5, \"right\": 5, \"bottom\": 5}` to specify padding for each side of the visualization.\n *\n * __Default value__: `5`\n */\n padding?: Padding | ES;\n\n /**\n * How the visualization size should be determined. If a string, should be one of `\"pad\"`, `\"fit\"` or `\"none\"`.\n * Object values can additionally specify parameters for content sizing and automatic resizing.\n *\n * __Default value__: `pad`\n */\n autosize?: AutosizeType | AutoSizeParams; // Vega actually supports signal for autosize. However, we need to check autosize at compile time to infer the rest of the spec. Thus VL's autosize won't support SignalRef for now.\n\n /**\n * Dynamic variables or selections that parameterize a visualization.\n */\n params?: TopLevelParameter[];\n}\n\nexport type FitType = 'fit' | 'fit-x' | 'fit-y';\n\nexport function isFitType(autoSizeType: AutosizeType): autoSizeType is FitType {\n return autoSizeType === 'fit' || autoSizeType === 'fit-x' || autoSizeType === 'fit-y';\n}\n\nexport function getFitType(sizeType?: 'width' | 'height'): FitType {\n return sizeType ? (`fit-${getPositionScaleChannel(sizeType)}` as FitType) : 'fit';\n}\n\nexport type AutosizeType = 'pad' | 'none' | 'fit' | 'fit-x' | 'fit-y';\n\nexport interface AutoSizeParams {\n /**\n * The sizing format type. One of `\"pad\"`, `\"fit\"`, `\"fit-x\"`, `\"fit-y\"`, or `\"none\"`. See the [autosize type](https://vega.github.io/vega-lite/docs/size.html#autosize) documentation for descriptions of each.\n *\n * __Default value__: `\"pad\"`\n */\n type?: AutosizeType;\n\n /**\n * A boolean flag indicating if autosize layout should be re-calculated on every view update.\n *\n * __Default value__: `false`\n */\n resize?: boolean;\n\n /**\n * Determines how size calculation should be performed, one of `\"content\"` or `\"padding\"`. The default setting (`\"content\"`) interprets the width and height settings as the data rectangle (plotting) dimensions, to which padding is then added. In contrast, the `\"padding\"` setting includes the padding within the view size calculations, such that the width and height settings indicate the **total** intended size of the view.\n *\n * __Default value__: `\"content\"`\n */\n contains?: 'content' | 'padding';\n}\n\nconst TOP_LEVEL_PROPERTIES: (keyof TopLevelProperties)[] = [\n 'background',\n 'padding'\n // We do not include \"autosize\" here as it is supported by only unit and layer specs and thus need to be normalized\n];\n\nexport function extractTopLevelProperties(t: TopLevelProperties, includeParams: boolean) {\n const o: TopLevelProperties = {};\n for (const p of TOP_LEVEL_PROPERTIES) {\n if (t && t[p] !== undefined) {\n o[p as any] = signalRefOrValue(t[p]);\n }\n }\n if (includeParams) {\n o.params = t.params;\n }\n return o;\n}\n","import * as log from '../log';\nimport {deepEqual, duplicate, getFirstDefined, keys} from '../util';\n\n/**\n * Generic class for storing properties that are explicitly specified\n * and implicitly determined by the compiler.\n * This is important for scale/axis/legend merging as\n * we want to prioritize properties that users explicitly specified.\n */\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport class Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {}\n ) {}\n\n public clone() {\n return new Split(duplicate(this.explicit), duplicate(this.implicit));\n }\n\n public combine(): Partial {\n return {\n ...this.explicit, // Explicit properties comes first\n ...this.implicit\n };\n }\n\n public get(key: K): T[K] {\n // Explicit has higher precedence\n return getFirstDefined(this.explicit[key], this.implicit[key]);\n }\n\n public getWithExplicit(key: K): Explicit {\n // Explicit has higher precedence\n if (this.explicit[key] !== undefined) {\n return {explicit: true, value: this.explicit[key]};\n } else if (this.implicit[key] !== undefined) {\n return {explicit: false, value: this.implicit[key]};\n }\n return {explicit: false, value: undefined};\n }\n\n public setWithExplicit(key: K, {value, explicit}: Explicit) {\n if (value !== undefined) {\n this.set(key, value, explicit);\n }\n }\n\n public set(key: K, value: T[K], explicit: boolean) {\n delete this[explicit ? 'implicit' : 'explicit'][key];\n this[explicit ? 'explicit' : 'implicit'][key] = value;\n return this;\n }\n\n public copyKeyFromSplit(key: keyof T, {explicit, implicit}: Split) {\n // Explicit has higher precedence\n if (explicit[key] !== undefined) {\n this.set(key, explicit[key], true);\n } else if (implicit[key] !== undefined) {\n this.set(key, implicit[key], false);\n }\n }\n public copyKeyFromObject(key: keyof T, s: Partial) {\n // Explicit has higher precedence\n if (s[key] !== undefined) {\n this.set(key, s[key], true);\n }\n }\n\n /**\n * Merge split object into this split object. Properties from the other split\n * overwrite properties from this split.\n */\n public copyAll(other: Split) {\n for (const key of keys(other.combine())) {\n const val = other.getWithExplicit(key);\n this.setWithExplicit(key, val);\n }\n }\n}\n\nexport interface Explicit {\n explicit: boolean;\n value: T;\n}\n\nexport function makeExplicit(value: T): Explicit {\n return {\n explicit: true,\n value\n };\n}\n\nexport function makeImplicit(value: T): Explicit {\n return {\n explicit: false,\n value\n };\n}\n\nexport type SplitParentProperty = 'scale' | 'axis' | 'legend' | '';\n\nexport function tieBreakByComparing(compare: (v1: T, v2: T) => number) {\n return (\n v1: Explicit,\n v2: Explicit,\n property: keyof S | never,\n propertyOf: SplitParentProperty\n ): Explicit => {\n const diff = compare(v1.value, v2.value);\n if (diff > 0) {\n return v1;\n } else if (diff < 0) {\n return v2;\n }\n return defaultTieBreaker(v1, v2, property, propertyOf);\n };\n}\n\nexport function defaultTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, prefer v1.\n return v1;\n}\n\nexport function mergeValuesWithExplicit(\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: SplitParentProperty,\n tieBreaker: (\n v1: Explicit,\n v2: Explicit,\n property: keyof S,\n propertyOf: string\n ) => Explicit = defaultTieBreaker\n) {\n if (v1 === undefined || v1.value === undefined) {\n // For first run\n return v2;\n }\n\n if (v1.explicit && !v2.explicit) {\n return v1;\n } else if (v2.explicit && !v1.explicit) {\n return v2;\n } else if (deepEqual(v1.value, v2.value)) {\n return v1;\n } else {\n return tieBreaker(v1, v2, property, propertyOf);\n }\n}\n","import {Parse} from '../../data';\nimport {Dict} from '../../util';\nimport {Split} from '../split';\nimport {OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {SourceNode} from './source';\n\nexport interface DataComponent {\n /**\n * A list of unique sources.\n */\n sources: SourceNode[];\n\n /**\n * Registry of output nodes.\n */\n outputNodes: Dict;\n\n /**\n * How often is an output node used. If it is not used, we don't need to\n * instantiate it in the assemble step.\n */\n outputNodeRefCounts: Dict;\n\n /**\n * The output node before aggregation.\n */\n raw?: OutputNode;\n\n /**\n * The main output node.\n */\n main?: OutputNode;\n\n /**\n * For facets, we store the reference to the root node.\n */\n facetRoot?: FacetNode;\n\n /**\n * True if the data for this model is faceted.\n * A dataset is faceted if a parent model is a facet and no new dataset is\n * defined (which would make the data unfaceted again).\n */\n isFaceted: boolean;\n\n /**\n * Parse properties passed down from ancestors. Helps us to keep track of what has been parsed or is derived.\n */\n ancestorParse?: AncestorParse;\n}\n\n/**\n * Class to track interesting properties (see https://15721.courses.cs.cmu.edu/spring2016/papers/graefe-ieee1995.pdf)\n * about how fields have been parsed or whether they have been derived in a transform. We use this to not parse the\n * same field again (or differently).\n */\nexport class AncestorParse extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public parseNothing = false\n ) {\n super(explicit, implicit);\n }\n\n public clone(): AncestorParse {\n const clone = super.clone() as AncestorParse;\n clone.parseNothing = this.parseNothing;\n return clone;\n }\n}\n","/*\n * Constants and utilities for data.\n */\nimport {Vector2} from 'vega';\nimport {FieldName} from './channeldef';\nimport {VgData} from './vega.schema';\n\nexport type ParseValue = null | string | 'string' | 'boolean' | 'date' | 'number';\n\nexport interface Parse {\n [field: string]: ParseValue;\n}\n\nexport interface DataFormatBase {\n /**\n * If set to `null`, disable type inference based on the spec and only use type inference based on the data.\n * Alternatively, a parsing directive object can be provided for explicit data types. Each property of the object corresponds to a field name, and the value to the desired data type (one of `\"number\"`, `\"boolean\"`, `\"date\"`, or null (do not parse the field)).\n * For example, `\"parse\": {\"modified_on\": \"date\"}` parses the `modified_on` field in each input record a Date value.\n *\n * For `\"date\"`, we parse data based using JavaScript's [`Date.parse()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).\n * For Specific date formats can be provided (e.g., `{foo: \"date:'%m%d%Y'\"}`), using the [d3-time-format syntax](https://github.com/d3/d3-time-format#locale_format). UTC date format parsing is supported similarly (e.g., `{foo: \"utc:'%m%d%Y'\"}`). See more about [UTC time](https://vega.github.io/vega-lite/docs/timeunit.html#utc)\n */\n parse?: Parse | null;\n\n /**\n * Type of input data: `\"json\"`, `\"csv\"`, `\"tsv\"`, `\"dsv\"`.\n *\n * __Default value:__ The default format type is determined by the extension of the file URL.\n * If no extension is detected, `\"json\"` will be used by default.\n */\n type?: 'csv' | 'tsv' | 'dsv' | 'json' | 'topojson';\n}\n\nexport interface CsvDataFormat extends DataFormatBase {\n type?: 'csv' | 'tsv';\n}\n\nexport interface DsvDataFormat extends DataFormatBase {\n type?: 'dsv';\n\n /**\n * The delimiter between records. The delimiter must be a single character (i.e., a single 16-bit code unit); so, ASCII delimiters are fine, but emoji delimiters are not.\n *\n * @minLength 1\n * @maxLength 1\n */\n delimiter: string;\n}\n\nexport interface JsonDataFormat extends DataFormatBase {\n type?: 'json';\n /**\n * The JSON property containing the desired data.\n * This parameter can be used when the loaded JSON file may have surrounding structure or meta-data.\n * For example `\"property\": \"values.features\"` is equivalent to retrieving `json.values.features`\n * from the loaded JSON object.\n */\n property?: string;\n}\n\nexport interface TopoDataFormat extends DataFormatBase {\n type?: 'topojson';\n /**\n * The name of the TopoJSON object set to convert to a GeoJSON feature collection.\n * For example, in a map of the world, there may be an object set named `\"countries\"`.\n * Using the feature property, we can extract this set and generate a GeoJSON feature object for each country.\n */\n feature?: string;\n /**\n * The name of the TopoJSON object set to convert to mesh.\n * Similar to the `feature` option, `mesh` extracts a named TopoJSON object set.\n * Unlike the `feature` option, the corresponding geo data is returned as a single, unified mesh instance, not as individual GeoJSON features.\n * Extracting a mesh is useful for more efficiently drawing borders or other geographic elements that you do not need to associate with specific regions such as individual countries, states or counties.\n */\n mesh?: string;\n}\n\nexport type DataFormat = CsvDataFormat | DsvDataFormat | JsonDataFormat | TopoDataFormat;\n\nexport type DataFormatType = 'json' | 'csv' | 'tsv' | 'dsv' | 'topojson';\n\nexport type DataSource = UrlData | InlineData | NamedData;\n\nexport type Data = DataSource | Generator;\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nexport type InlineDataset = number[] | string[] | boolean[] | object[] | string | object;\n\nexport interface DataBase {\n /**\n * An object that specifies the format for parsing the data.\n */\n format?: DataFormat;\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface UrlData extends DataBase {\n /**\n * An URL from which to load the data set. Use the `format.type` property\n * to ensure the loaded data is correctly parsed.\n */\n url: string;\n}\n\nexport interface InlineData extends DataBase {\n /**\n * The full data set, included inline. This can be an array of objects or primitive values, an object, or a string.\n * Arrays of primitive values are ingested as objects with a `data` property. Strings are parsed according to the specified format type.\n */\n values: InlineDataset;\n}\n\nexport interface NamedData extends DataBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n *\n * New data may change the layout but Vega does not always resize the chart. To update the layout when the data updates, set [autosize](https://vega.github.io/vega-lite/docs/size.html#autosize) or explicitly use [view.resize](https://vega.github.io/vega/docs/api/view/#view_resize).\n */\n name: string;\n}\n\nexport function isUrlData(data: Partial | Partial): data is UrlData {\n return 'url' in data;\n}\n\nexport function isInlineData(data: Partial | Partial): data is InlineData {\n return 'values' in data;\n}\n\nexport function isNamedData(data: Partial | Partial): data is NamedData {\n return 'name' in data && !isUrlData(data) && !isInlineData(data) && !isGenerator(data);\n}\n\nexport function isGenerator(data: Partial | Partial): data is Generator {\n return data && (isSequenceGenerator(data) || isSphereGenerator(data) || isGraticuleGenerator(data));\n}\n\nexport function isSequenceGenerator(data: Partial | Partial): data is SequenceGenerator {\n return 'sequence' in data;\n}\n\nexport function isSphereGenerator(data: Partial | Partial): data is SphereGenerator {\n return 'sphere' in data;\n}\n\nexport function isGraticuleGenerator(data: Partial | Partial): data is GraticuleGenerator {\n return 'graticule' in data;\n}\n\nexport enum DataSourceType {\n Raw,\n Main,\n Row,\n Column,\n Lookup\n}\n\nexport type Generator = SequenceGenerator | SphereGenerator | GraticuleGenerator;\n\nexport interface GeneratorBase {\n /**\n * Provide a placeholder name and bind data at runtime.\n */\n name?: string;\n}\n\nexport interface SequenceGenerator extends GeneratorBase {\n /**\n * Generate a sequence of numbers.\n */\n sequence: SequenceParams;\n}\n\nexport interface SequenceParams {\n /**\n * The starting value of the sequence (inclusive).\n */\n start: number;\n /**\n * The ending value of the sequence (exclusive).\n */\n stop: number;\n /**\n * The step value between sequence entries.\n *\n * __Default value:__ `1`\n */\n step?: number;\n\n /**\n * The name of the generated sequence field.\n *\n * __Default value:__ `\"data\"`\n */\n as?: FieldName;\n}\n\nexport interface SphereGenerator extends GeneratorBase {\n /**\n * Generate sphere GeoJSON data for the full globe.\n */\n // eslint-disable-next-line @typescript-eslint/ban-types\n sphere: true | {};\n}\n\nexport interface GraticuleGenerator extends GeneratorBase {\n /**\n * Generate graticule GeoJSON data for geographic reference lines.\n */\n graticule: true | GraticuleParams;\n}\n\nexport interface GraticuleParams {\n /**\n * The major extent of the graticule as a two-element array of coordinates.\n */\n extentMajor?: Vector2>;\n\n /**\n * The minor extent of the graticule as a two-element array of coordinates.\n */\n extentMinor?: Vector2>;\n\n /**\n * Sets both the major and minor extents to the same values.\n */\n extent?: Vector2>;\n\n /**\n * The major step angles of the graticule.\n *\n *\n * __Default value:__ `[90, 360]`\n */\n stepMajor?: Vector2;\n\n /**\n * The minor step angles of the graticule.\n *\n * __Default value:__ `[10, 10]`\n */\n stepMinor?: Vector2;\n\n /**\n * Sets both the major and minor step angles to the same values.\n */\n step?: Vector2;\n\n /**\n * The precision of the graticule in degrees.\n *\n * __Default value:__ `2.5`\n */\n precision?: number;\n}\n","import {Signal, SignalRef} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {identity, isArray, stringValue} from 'vega-util';\nimport {MODIFY, STORE, unitName, VL_SELECTION_RESOLVE, TUPLE, selectionCompilers} from '.';\nimport {dateTimeToExpr, isDateTime, dateTimeToTimestamp} from '../../datetime';\nimport {hasContinuousDomain} from '../../scale';\nimport {SelectionInit, SelectionInitInterval, ParameterExtent, SELECTION_ID} from '../../selection';\nimport {keys, replacePathInField, stringify, vals} from '../../util';\nimport {VgData, VgDomain} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {LayerModel} from '../layer';\nimport {isUnitModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {UnitModel} from '../unit';\nimport {parseSelectionExtent} from './parse';\nimport {SelectionProjection} from './project';\n\nexport function assembleProjection(proj: SelectionProjection) {\n const {signals, hasLegend, index, ...rest} = proj;\n rest.field = replacePathInField(rest.field);\n return rest;\n}\n\nexport function assembleInit(\n init: readonly (SelectionInit | readonly SelectionInit[] | SelectionInitInterval)[] | SelectionInit,\n isExpr = true,\n wrap: (str: string | number) => string | number = identity\n): any {\n if (isArray(init)) {\n const assembled = init.map(v => assembleInit(v, isExpr, wrap));\n return isExpr ? `[${assembled.join(', ')}]` : assembled;\n } else if (isDateTime(init)) {\n if (isExpr) {\n return wrap(dateTimeToExpr(init));\n } else {\n return wrap(dateTimeToTimestamp(init));\n }\n }\n return isExpr ? wrap(stringify(init)) : init;\n}\n\nexport function assembleUnitSelectionSignals(model: UnitModel, signals: Signal[]) {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n let modifyExpr = `${name}${TUPLE}, ${selCmpt.resolve === 'global' ? 'true' : `{unit: ${unitName(model)}}`}`;\n\n for (const c of selectionCompilers) {\n if (!c.defined(selCmpt)) continue;\n if (c.signals) signals = c.signals(model, selCmpt, signals);\n if (c.modifyExpr) modifyExpr = c.modifyExpr(model, selCmpt, modifyExpr);\n }\n\n signals.push({\n name: name + MODIFY,\n on: [\n {\n events: {signal: selCmpt.name + TUPLE},\n update: `modify(${stringValue(selCmpt.name + STORE)}, ${modifyExpr})`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleFacetSignals(model: FacetModel, signals: Signal[]) {\n if (model.component.selection && keys(model.component.selection).length) {\n const name = stringValue(model.getName('cell'));\n signals.unshift({\n name: 'facet',\n value: {},\n on: [\n {\n events: parseSelector('pointermove', 'scope'),\n update: `isTuple(facet) ? facet : group(${name}).datum`\n }\n ]\n });\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleTopLevelSignals(model: UnitModel, signals: Signal[]) {\n let hasSelections = false;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const name = selCmpt.name;\n const store = stringValue(name + STORE);\n const hasSg = signals.filter(s => s.name === name);\n if (hasSg.length === 0) {\n const resolve = selCmpt.resolve === 'global' ? 'union' : selCmpt.resolve;\n const isPoint = selCmpt.type === 'point' ? ', true, true)' : ')';\n signals.push({\n name: selCmpt.name,\n update: `${VL_SELECTION_RESOLVE}(${store}, ${stringValue(resolve)}${isPoint}`\n });\n }\n hasSelections = true;\n\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.topLevelSignals) {\n signals = c.topLevelSignals(model, selCmpt, signals);\n }\n }\n }\n\n if (hasSelections) {\n const hasUnit = signals.filter(s => s.name === 'unit');\n if (hasUnit.length === 0) {\n signals.unshift({\n name: 'unit',\n value: {},\n on: [{events: 'pointermove', update: 'isTuple(group()) ? group() : unit'}]\n });\n }\n }\n\n return cleanupEmptyOnArray(signals);\n}\n\nexport function assembleUnitSelectionData(model: UnitModel, data: readonly VgData[]): VgData[] {\n const dataCopy = [...data];\n const unit = unitName(model, {escape: false});\n\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const store: VgData = {name: selCmpt.name + STORE};\n\n if (selCmpt.project.hasSelectionId) {\n store.transform = [{type: 'collect', sort: {field: SELECTION_ID}}];\n }\n\n if (selCmpt.init) {\n const fields = selCmpt.project.items.map(assembleProjection);\n\n store.values = selCmpt.project.hasSelectionId\n ? selCmpt.init.map(i => ({unit, [SELECTION_ID]: assembleInit(i, false)[0]}))\n : selCmpt.init.map(i => ({unit, fields, values: assembleInit(i, false)}));\n }\n\n const contains = dataCopy.filter(d => d.name === selCmpt.name + STORE);\n if (!contains.length) {\n dataCopy.push(store);\n }\n }\n\n return dataCopy;\n}\n\nexport function assembleUnitSelectionMarks(model: UnitModel, marks: any[]): any[] {\n for (const selCmpt of vals(model.component.selection ?? {})) {\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.marks) {\n marks = c.marks(model, selCmpt, marks);\n }\n }\n }\n\n return marks;\n}\n\nexport function assembleLayerSelectionMarks(model: LayerModel, marks: any[]): any[] {\n for (const child of model.children) {\n if (isUnitModel(child)) {\n marks = assembleUnitSelectionMarks(child, marks);\n }\n }\n\n return marks;\n}\n\nexport function assembleSelectionScaleDomain(\n model: Model,\n extent: ParameterExtent,\n scaleCmpt: ScaleComponent,\n domain: VgDomain\n): SignalRef {\n const parsedExtent = parseSelectionExtent(model, extent.param, extent);\n\n return {\n signal:\n hasContinuousDomain(scaleCmpt.get('type')) && isArray(domain) && domain[0] > domain[1]\n ? `isValid(${parsedExtent}) && reverse(${parsedExtent})`\n : parsedExtent\n };\n}\n\nfunction cleanupEmptyOnArray(signals: Signal[]) {\n return signals.map(s => {\n if (s.on && !s.on.length) delete s.on;\n return s;\n });\n}\n","import {DataSourceType} from '../../data';\nimport * as log from '../../log';\nimport {Dict, uniqueId} from '../../util';\n\n/**\n * A node in the dataflow tree.\n */\nexport abstract class DataFlowNode {\n private _children: DataFlowNode[] = [];\n\n private _parent: DataFlowNode = null;\n\n protected _hash: string | number;\n\n constructor(\n parent: DataFlowNode,\n public readonly debugName?: string\n ) {\n if (parent) {\n this.parent = parent;\n }\n }\n\n /**\n * Clone this node with a deep copy but don't clone links to children or parents.\n */\n public clone(): DataFlowNode {\n throw new Error('Cannot clone node');\n }\n\n /**\n * Return a hash of the node.\n */\n public abstract hash(): string | number;\n\n /**\n * Set of fields that this node depends on.\n */\n public abstract dependentFields(): Set;\n\n /**\n * Set of fields that are being created by this node.\n */\n public abstract producedFields(): Set;\n\n get parent() {\n return this._parent;\n }\n\n /**\n * Set the parent of the node and also add this node to the parent's children.\n */\n set parent(parent: DataFlowNode) {\n this._parent = parent;\n if (parent) {\n parent.addChild(this);\n }\n }\n\n get children() {\n return this._children;\n }\n\n public numChildren() {\n return this._children.length;\n }\n\n public addChild(child: DataFlowNode, loc?: number) {\n // do not add the same child twice\n if (this._children.includes(child)) {\n log.warn(log.message.ADD_SAME_CHILD_TWICE);\n return;\n }\n\n if (loc !== undefined) {\n this._children.splice(loc, 0, child);\n } else {\n this._children.push(child);\n }\n }\n\n public removeChild(oldChild: DataFlowNode) {\n const loc = this._children.indexOf(oldChild);\n this._children.splice(loc, 1);\n return loc;\n }\n\n /**\n * Remove node from the dataflow.\n */\n public remove() {\n let loc = this._parent.removeChild(this);\n for (const child of this._children) {\n // do not use the set method because we want to insert at a particular location\n child._parent = this._parent;\n this._parent.addChild(child, loc++);\n }\n }\n\n /**\n * Insert another node as a parent of this node.\n */\n public insertAsParentOf(other: DataFlowNode) {\n const parent = other.parent;\n parent.removeChild(this);\n this.parent = parent;\n other.parent = this;\n }\n\n public swapWithParent() {\n const parent = this._parent;\n const newParent = parent.parent;\n\n // reconnect the children\n for (const child of this._children) {\n child.parent = parent;\n }\n\n // remove old links\n this._children = []; // equivalent to removing every child link one by one\n parent.removeChild(this);\n const loc = parent.parent.removeChild(parent);\n\n // swap two nodes but maintain order in children\n this._parent = newParent;\n newParent.addChild(this, loc);\n\n parent.parent = this;\n }\n}\n\nexport class OutputNode extends DataFlowNode {\n private _source: string;\n\n private _name: string;\n\n public clone(): this {\n const cloneObj = new (this.constructor as any)();\n cloneObj.debugName = `clone_${this.debugName}`;\n cloneObj._source = this._source;\n cloneObj._name = `clone_${this._name}`;\n cloneObj.type = this.type;\n cloneObj.refCounts = this.refCounts;\n cloneObj.refCounts[cloneObj._name] = 0;\n return cloneObj;\n }\n\n /**\n * @param source The name of the source. Will change in assemble.\n * @param type The type of the output node.\n * @param refCounts A global ref counter map.\n */\n constructor(\n parent: DataFlowNode,\n source: string,\n public readonly type: DataSourceType,\n private readonly refCounts: Dict\n ) {\n super(parent, source);\n\n this._source = this._name = source;\n\n if (this.refCounts && !(this._name in this.refCounts)) {\n this.refCounts[this._name] = 0;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n if (this._hash === undefined) {\n this._hash = `Output ${uniqueId()}`;\n }\n return this._hash;\n }\n\n /**\n * Request the datasource name and increase the ref counter.\n *\n * During the parsing phase, this will return the simple name such as 'main' or 'raw'.\n * It is crucial to request the name from an output node to mark it as a required node.\n * If nobody ever requests the name, this datasource will not be instantiated in the assemble phase.\n *\n * In the assemble phase, this will return the correct name.\n */\n public getSource() {\n this.refCounts[this._name]++;\n return this._source;\n }\n\n public isRequired(): boolean {\n return !!this.refCounts[this._name];\n }\n\n public setSource(source: string) {\n this._source = source;\n }\n}\n","import {TimeUnitTransform as VgTimeUnitTransform} from 'vega';\nimport {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {FieldName, getBandPosition, vgField} from '../../channeldef';\nimport {\n TimeUnitParams,\n getDateTimePartAndStep,\n getSmallestTimeUnitPart,\n getTimeUnitParts,\n isBinnedTimeUnit,\n normalizeTimeUnit\n} from '../../timeunit';\nimport {TimeUnitTransform} from '../../transform';\nimport {Dict, duplicate, entries, hash, isEmpty, replacePathInField, vals} from '../../util';\nimport {ModelWithField, isUnitModel} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {isRectBasedMark} from '../../mark';\nimport {isXorY} from '../../channel';\n\nexport type TimeUnitComponent = (TimeUnitTransform | BinnedTimeUnitOffset) & {\n rectBandPosition?: number;\n};\n\nexport interface BinnedTimeUnitOffset {\n timeUnit: TimeUnitParams;\n field: FieldName;\n}\n\nfunction isTimeUnitTransformComponent(timeUnitComponent: TimeUnitComponent): timeUnitComponent is TimeUnitTransform {\n return (timeUnitComponent as TimeUnitTransform).as !== undefined;\n}\n\nfunction offsetAs(field: FieldName) {\n return `${field}_end`;\n}\n\nexport class TimeUnitNode extends DataFlowNode {\n public clone() {\n return new TimeUnitNode(null, duplicate(this.timeUnits));\n }\n\n constructor(\n parent: DataFlowNode,\n private timeUnits: Dict\n ) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const formula = model.reduceFieldDef((timeUnitComponent: TimeUnitComponent, fieldDef, channel) => {\n const {field, timeUnit} = fieldDef;\n\n if (timeUnit) {\n let component: TimeUnitComponent | undefined;\n\n if (isBinnedTimeUnit(timeUnit)) {\n // For binned time unit, only produce end if the mark is a rect-based mark (rect, bar, image, arc), which needs \"range\".\n\n if (isUnitModel(model)) {\n const {mark, markDef, config} = model;\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n if (isRectBasedMark(mark) || !!bandPosition) {\n component = {\n timeUnit: normalizeTimeUnit(timeUnit),\n field\n };\n }\n }\n } else {\n component = {\n as: vgField(fieldDef, {forAs: true}),\n field,\n timeUnit\n };\n }\n\n if (isUnitModel(model)) {\n const {mark, markDef, config} = model;\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n if (isRectBasedMark(mark) && isXorY(channel) && bandPosition !== 0.5) {\n component.rectBandPosition = bandPosition;\n }\n }\n\n if (component) {\n timeUnitComponent[hash(component)] = component;\n }\n }\n return timeUnitComponent;\n }, {} as Dict);\n\n if (isEmpty(formula)) {\n return null;\n }\n\n return new TimeUnitNode(parent, formula);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: TimeUnitTransform) {\n const {timeUnit, ...other} = {...t};\n\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit);\n\n const component = {\n ...other,\n timeUnit: normalizedTimeUnit\n };\n\n return new TimeUnitNode(parent, {\n [hash(component)]: component\n });\n }\n\n /**\n * Merge together TimeUnitNodes assigning the children of `other` to `this`\n * and removing `other`.\n */\n public merge(other: TimeUnitNode) {\n this.timeUnits = {...this.timeUnits};\n\n // if the same hash happen twice, merge\n for (const key in other.timeUnits) {\n if (!this.timeUnits[key]) {\n // copy if it's not a duplicate\n this.timeUnits[key] = other.timeUnits[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n\n other.remove();\n }\n\n /**\n * Remove time units coming from the other node.\n */\n public removeFormulas(fields: Set) {\n const newFormula = {};\n\n for (const [key, timeUnitComponent] of entries(this.timeUnits)) {\n const fieldAs = isTimeUnitTransformComponent(timeUnitComponent)\n ? timeUnitComponent.as\n : `${timeUnitComponent.field}_end`;\n if (!fields.has(fieldAs)) {\n newFormula[key] = timeUnitComponent;\n }\n }\n\n this.timeUnits = newFormula;\n }\n\n public producedFields() {\n return new Set(\n vals(this.timeUnits).map(f => {\n return isTimeUnitTransformComponent(f) ? f.as : offsetAs(f.field);\n })\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.timeUnits).map(f => f.field));\n }\n\n public hash() {\n return `TimeUnit ${hash(this.timeUnits)}`;\n }\n\n public assemble() {\n const transforms: (VgTimeUnitTransform | VgFormulaTransform)[] = [];\n\n for (const f of vals(this.timeUnits)) {\n const {rectBandPosition} = f;\n const normalizedTimeUnit = normalizeTimeUnit(f.timeUnit);\n\n if (isTimeUnitTransformComponent(f)) {\n const {field, as} = f;\n const {unit, utc, ...params} = normalizedTimeUnit;\n\n const startEnd: [string, string] = [as, `${as}_end`];\n\n transforms.push({\n field: replacePathInField(field),\n type: 'timeunit',\n ...(unit ? {units: getTimeUnitParts(unit)} : {}),\n ...(utc ? {timezone: 'utc'} : {}),\n ...params,\n as: startEnd\n });\n\n transforms.push(...offsetedRectFormulas(startEnd, rectBandPosition, normalizedTimeUnit));\n } else if (f) {\n const {field: escapedField} = f;\n // since this is a expression, we want the unescaped field name\n const field = escapedField.replaceAll('\\\\.', '.');\n const expr = offsetExpr({timeUnit: normalizedTimeUnit, field});\n const endAs = offsetAs(field);\n transforms.push({\n type: 'formula',\n expr,\n as: endAs\n });\n\n transforms.push(...offsetedRectFormulas([field, endAs], rectBandPosition, normalizedTimeUnit));\n }\n }\n\n return transforms;\n }\n}\n\nexport const OFFSETTED_RECT_START_SUFFIX = 'offsetted_rect_start';\nexport const OFFSETTED_RECT_END_SUFFIX = 'offsetted_rect_end';\n\nfunction offsetExpr({timeUnit, field, reverse}: {timeUnit: TimeUnitParams; field: string; reverse?: boolean}) {\n const {unit, utc} = timeUnit;\n const smallestUnit = getSmallestTimeUnitPart(unit);\n const {part, step} = getDateTimePartAndStep(smallestUnit, timeUnit.step);\n const offsetFn = utc ? 'utcOffset' : 'timeOffset';\n const expr = `${offsetFn}('${part}', datum['${field}'], ${reverse ? -step : step})`;\n return expr;\n}\n\nfunction offsetedRectFormulas(\n [startField, endField]: [string, string],\n rectBandPosition: number | undefined,\n timeUnit: TimeUnitParams\n): VgFormulaTransform[] {\n if (rectBandPosition !== undefined && rectBandPosition !== 0.5) {\n const startExpr = `datum['${startField}']`;\n const endExpr = `datum['${endField}']`;\n return [\n {\n type: 'formula',\n expr: interpolateExpr(\n [\n offsetExpr({\n timeUnit,\n field: startField,\n reverse: true\n }),\n startExpr\n ],\n rectBandPosition + 0.5\n ),\n as: `${startField}_${OFFSETTED_RECT_START_SUFFIX}`\n },\n {\n type: 'formula',\n expr: interpolateExpr([startExpr, endExpr], rectBandPosition + 0.5),\n as: `${startField}_${OFFSETTED_RECT_END_SUFFIX}`\n }\n ];\n }\n return [];\n}\n\nfunction interpolateExpr([start, end]: [string, string], fraction: number) {\n return `${1 - fraction} * ${start} + ${fraction} * ${end}`;\n}\n","import {array, isObject} from 'vega-util';\nimport {\n GeoPositionChannel,\n getPositionChannelFromLatLong,\n isGeoPositionChannel,\n isScaleChannel,\n isSingleDefUnitChannel,\n SingleDefUnitChannel\n} from '../../channel';\nimport * as log from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {PointSelectionConfig, SelectionInitIntervalMapping, SelectionInitMapping, SELECTION_ID} from '../../selection';\nimport {Dict, hash, keys, varName, isEmpty} from '../../util';\nimport {TimeUnitComponent, TimeUnitNode} from '../data/timeunit';\nimport {SelectionCompiler} from '.';\nimport {assembleProjection} from './assemble';\nimport {isBinnedTimeUnit} from '../../timeunit';\nexport const TUPLE_FIELDS = '_tuple_fields';\n\n/**\n * Whether the selection tuples hold enumerated or ranged values for a field.\n */\nexport type TupleStoreType =\n // enumerated\n | 'E'\n // ranged, exclusive, left-right inclusive\n | 'R'\n // ranged, left-inclusive, right-exclusive\n | 'R-RE';\n\nexport interface SelectionProjection {\n type: TupleStoreType;\n field: string;\n index: number;\n channel?: SingleDefUnitChannel;\n geoChannel?: GeoPositionChannel;\n signals?: {data?: string; visual?: string};\n hasLegend?: boolean;\n}\n\nexport class SelectionProjectionComponent {\n public hasChannel: Partial>;\n public hasField: Record;\n public hasSelectionId: boolean;\n public timeUnit?: TimeUnitNode;\n public items: SelectionProjection[];\n\n constructor(...items: SelectionProjection[]) {\n this.items = items;\n this.hasChannel = {};\n this.hasField = {};\n this.hasSelectionId = false;\n }\n}\n\nconst project: SelectionCompiler = {\n defined: () => {\n return true; // This transform handles its own defaults, so always run parse.\n },\n\n parse: (model, selCmpt, selDef) => {\n const name = selCmpt.name;\n const proj = (selCmpt.project ??= new SelectionProjectionComponent());\n const parsed: Dict = {};\n const timeUnits: Dict = {};\n\n const signals = new Set();\n const signalName = (p: SelectionProjection, range: 'data' | 'visual') => {\n const suffix = range === 'visual' ? p.channel : p.field;\n let sg = varName(`${name}_${suffix}`);\n for (let counter = 1; signals.has(sg); counter++) {\n sg = varName(`${name}_${suffix}_${counter}`);\n }\n signals.add(sg);\n return {[range]: sg};\n };\n\n const type = selCmpt.type;\n const cfg = model.config.selection[type];\n const init =\n selDef.value !== undefined\n ? (array(selDef.value as any) as SelectionInitMapping[] | SelectionInitIntervalMapping[])\n : null;\n\n // If no explicit projection (either fields or encodings) is specified, set some defaults.\n // If an initial value is set, try to infer projections.\n let {fields, encodings} = (isObject(selDef.select) ? selDef.select : {}) as PointSelectionConfig;\n if (!fields && !encodings && init) {\n for (const initVal of init) {\n // initVal may be a scalar value to smoothen varParam -> pointSelection gradient.\n if (!isObject(initVal)) {\n continue;\n }\n\n for (const key of keys(initVal)) {\n if (isSingleDefUnitChannel(key)) {\n (encodings || (encodings = [])).push(key as SingleDefUnitChannel);\n } else {\n if (type === 'interval') {\n log.warn(log.message.INTERVAL_INITIALIZED_WITH_POS);\n encodings = cfg.encodings;\n } else {\n (fields ??= []).push(key);\n }\n }\n }\n }\n }\n\n // If no initial value is specified, use the default configuration.\n // We break this out as a separate if block (instead of an else condition)\n // to account for unprojected point selections that have scalar initial values\n if (!fields && !encodings) {\n encodings = cfg.encodings;\n if ('fields' in cfg) {\n fields = cfg.fields;\n }\n }\n\n for (const channel of encodings ?? []) {\n const fieldDef = model.fieldDef(channel);\n if (fieldDef) {\n let field = fieldDef.field;\n\n if (fieldDef.aggregate) {\n log.warn(log.message.cannotProjectAggregate(channel, fieldDef.aggregate));\n continue;\n } else if (!field) {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n continue;\n }\n\n if (fieldDef.timeUnit && !isBinnedTimeUnit(fieldDef.timeUnit)) {\n field = model.vgField(channel);\n // Construct TimeUnitComponents which will be combined into a\n // TimeUnitNode. This node may need to be inserted into the\n // dataflow if the selection is used across views that do not\n // have these time units defined.\n const component = {\n timeUnit: fieldDef.timeUnit,\n as: field,\n field: fieldDef.field\n };\n\n timeUnits[hash(component)] = component;\n }\n\n // Prevent duplicate projections on the same field.\n // TODO: what if the same field is bound to multiple channels (e.g., SPLOM diag).\n if (!parsed[field]) {\n // Determine whether the tuple will store enumerated or ranged values.\n // Interval selections store ranges for continuous scales, and enumerations otherwise.\n // Single/multi selections store ranges for binned fields, and enumerations otherwise.\n const tplType: TupleStoreType =\n type === 'interval' &&\n isScaleChannel(channel) &&\n hasContinuousDomain(model.getScaleComponent(channel).get('type'))\n ? 'R'\n : fieldDef.bin\n ? 'R-RE'\n : 'E';\n\n const p: SelectionProjection = {field, channel, type: tplType, index: proj.items.length};\n p.signals = {...signalName(p, 'data'), ...signalName(p, 'visual')};\n proj.items.push((parsed[field] = p));\n proj.hasField[field] = parsed[field];\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n\n if (isGeoPositionChannel(channel)) {\n p.geoChannel = channel;\n p.channel = getPositionChannelFromLatLong(channel);\n proj.hasChannel[p.channel] = parsed[field];\n } else {\n proj.hasChannel[channel] = parsed[field];\n }\n }\n } else {\n log.warn(log.message.cannotProjectOnChannelWithoutField(channel));\n }\n }\n\n for (const field of fields ?? []) {\n if (proj.hasField[field]) continue;\n const p: SelectionProjection = {type: 'E', field, index: proj.items.length};\n p.signals = {...signalName(p, 'data')};\n proj.items.push(p);\n proj.hasField[field] = p;\n proj.hasSelectionId = proj.hasSelectionId || field === SELECTION_ID;\n }\n\n if (init) {\n selCmpt.init = (init as any).map((v: SelectionInitMapping | SelectionInitIntervalMapping) => {\n // Selections can be initialized either with a full object that maps projections to values\n // or scalar values to smoothen the abstraction gradient from variable params to point selections.\n return proj.items.map(p =>\n isObject(v) ? (v[p.geoChannel || p.channel] !== undefined ? v[p.geoChannel || p.channel] : v[p.field]) : v\n );\n });\n }\n\n if (!isEmpty(timeUnits)) {\n proj.timeUnit = new TimeUnitNode(null, timeUnits);\n }\n },\n\n signals: (model, selCmpt, allSignals) => {\n const name = selCmpt.name + TUPLE_FIELDS;\n const hasSignal = allSignals.filter(s => s.name === name);\n return hasSignal.length > 0 || selCmpt.project.hasSelectionId\n ? allSignals\n : allSignals.concat({\n name,\n value: selCmpt.project.items.map(assembleProjection)\n });\n }\n};\n\nexport default project;\n","import {stringValue} from 'vega-util';\nimport {VL_SELECTION_RESOLVE} from '.';\nimport {isScaleChannel, ScaleChannel} from '../../channel';\nimport * as log from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {isLayerModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {SelectionProjection} from './project';\nimport {SelectionCompiler} from '.';\nimport {replacePathInField} from '../../util';\nimport {NewSignal} from 'vega';\n\nconst scaleBindings: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.resolve === 'global' && selCmpt.bind && selCmpt.bind === 'scales';\n },\n\n parse: (model, selCmpt) => {\n const bound: SelectionProjection[] = (selCmpt.scales = []);\n\n for (const proj of selCmpt.project.items) {\n const channel = proj.channel;\n\n if (!isScaleChannel(channel)) {\n continue;\n }\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n if (!scale || !hasContinuousDomain(scaleType)) {\n log.warn(log.message.SCALE_BINDINGS_CONTINUOUS);\n continue;\n }\n\n scale.set('selectionExtent', {param: selCmpt.name, field: proj.field}, true);\n bound.push(proj);\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const bound = selCmpt.scales.filter(proj => signals.filter(s => s.name === proj.signals.data).length === 0);\n\n // Top-level signals are only needed for multiview displays and if this\n // view's top-level signals haven't already been generated.\n if (!model.parent || isTopLevelLayer(model) || bound.length === 0) {\n return signals;\n }\n\n // vlSelectionResolve does not account for the behavior of bound scales in\n // multiview displays. Each unit view adds a tuple to the store, but the\n // state of the selection is the unit selection most recently updated. This\n // state is captured by the top-level signals that we insert and \"push\n // outer\" to from within the units. We need to reassemble this state into\n // the top-level named signal, except no single selCmpt has a global view.\n const namedSg: NewSignal = signals.filter(s => s.name === selCmpt.name)[0];\n let update = namedSg.update;\n if (update.indexOf(VL_SELECTION_RESOLVE) >= 0) {\n namedSg.update = `{${bound\n .map(proj => `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`)\n .join(', ')}}`;\n } else {\n for (const proj of bound) {\n const mapping = `${stringValue(replacePathInField(proj.field))}: ${proj.signals.data}`;\n if (!update.includes(mapping)) {\n update = `${update.substring(0, update.length - 1)}, ${mapping}}`;\n }\n }\n namedSg.update = update;\n }\n\n return signals.concat(bound.map(proj => ({name: proj.signals.data})));\n },\n\n signals: (model, selCmpt, signals) => {\n // Nested signals need only push to top-level signals with multiview displays.\n if (model.parent && !isTopLevelLayer(model)) {\n for (const proj of selCmpt.scales) {\n const signal: any = signals.filter(s => s.name === proj.signals.data)[0];\n signal.push = 'outer';\n delete signal.value;\n delete signal.update;\n }\n }\n\n return signals;\n }\n};\n\nexport default scaleBindings;\n\nexport function domain(model: UnitModel, channel: ScaleChannel) {\n const scale = stringValue(model.scaleName(channel));\n return `domain(${scale})`;\n}\n\nfunction isTopLevelLayer(model: Model): boolean {\n return model.parent && isLayerModel(model.parent) && (!model.parent.parent ?? isTopLevelLayer(model.parent.parent));\n}\n","import {isObject, NewSignal, OnEvent, SignalValue, Stream} from 'vega';\nimport {array, stringValue} from 'vega-util';\nimport {SelectionCompiler, SelectionComponent, STORE, TUPLE, unitName} from '.';\nimport {GeoPositionChannel, LATITUDE, LONGITUDE, ScaleChannel, X, Y} from '../../channel';\nimport {FieldName} from '../../channeldef';\nimport {warn} from '../../log';\nimport {hasContinuousDomain} from '../../scale';\nimport {IntervalSelectionConfigWithoutType, SelectionInitInterval, SELECTION_ID} from '../../selection';\nimport {keys, vals} from '../../util';\nimport {LayoutSizeIndex} from '../layoutsize/component';\nimport {isUnitModel} from '../model';\nimport {UnitModel} from '../unit';\nimport {assembleInit} from './assemble';\nimport {SelectionProjection, TUPLE_FIELDS} from './project';\nimport scales from './scales';\n\nexport const BRUSH = '_brush';\nexport const SCALE_TRIGGER = '_scale_trigger';\nexport const GEO_INIT_TICK = 'geo_interval_init_tick'; // Workaround for https://github.com/vega/vega/issues/3481\nconst INIT = '_init';\nconst CENTER = '_center';\n\n// Separate type because the \"fields\" property is only used internally and we don't want to leak it to the schema.\nexport type IntervalSelectionConfigWithField = IntervalSelectionConfigWithoutType & {fields?: FieldName[]};\n\nconst interval: SelectionCompiler<'interval'> = {\n defined: selCmpt => selCmpt.type === 'interval',\n\n parse: (model, selCmpt, selDef) => {\n if (model.hasProjection) {\n const def: IntervalSelectionConfigWithField = {...(isObject(selDef.select) ? selDef.select : {})};\n def.fields = [SELECTION_ID];\n if (!def.encodings) {\n // Remap default x/y projection\n def.encodings = selDef.value ? (keys(selDef.value) as GeoPositionChannel[]) : [LONGITUDE, LATITUDE];\n }\n\n selDef.select = {type: 'interval', ...def};\n }\n\n if (selCmpt.translate && !scales.defined(selCmpt)) {\n const filterExpr = `!event.item || event.item.mark.name !== ${stringValue(selCmpt.name + BRUSH)}`;\n for (const evt of selCmpt.events) {\n if (!evt.between) {\n warn(`${evt} is not an ordered event stream for interval selections.`);\n continue;\n }\n\n const filters = array((evt.between[0].filter ??= []));\n if (filters.indexOf(filterExpr) < 0) {\n filters.push(filterExpr);\n }\n }\n }\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const tupleSg = name + TUPLE;\n const channels = vals(selCmpt.project.hasChannel).filter(p => p.channel === X || p.channel === Y);\n const init = selCmpt.init ? selCmpt.init[0] : null;\n\n signals.push(\n ...channels.reduce((arr, proj) => arr.concat(channelSignals(model, selCmpt, proj, init && init[proj.index])), [])\n );\n\n if (!model.hasProjection) {\n // Proxy scale reactions to ensure that an infinite loop doesn't occur\n // when an interval selection filter touches the scale.\n if (!scales.defined(selCmpt)) {\n const triggerSg = name + SCALE_TRIGGER;\n const scaleTriggers = channels.map(proj => {\n const channel = proj.channel as 'x' | 'y';\n const {data: dname, visual: vname} = proj.signals;\n const scaleName = stringValue(model.scaleName(channel));\n const scaleType = model.getScaleComponent(channel).get('type');\n const toNum = hasContinuousDomain(scaleType) ? '+' : '';\n return (\n `(!isArray(${dname}) || ` +\n `(${toNum}invert(${scaleName}, ${vname})[0] === ${toNum}${dname}[0] && ` +\n `${toNum}invert(${scaleName}, ${vname})[1] === ${toNum}${dname}[1]))`\n );\n });\n\n if (scaleTriggers.length) {\n signals.push({\n name: triggerSg,\n value: {},\n on: [\n {\n events: channels.map(proj => ({scale: model.scaleName(proj.channel)})),\n update: scaleTriggers.join(' && ') + ` ? ${triggerSg} : {}`\n }\n ]\n });\n }\n }\n\n // Only add an interval to the store if it has valid data extents. Data extents\n // are set to null if pixel extents are equal to account for intervals over\n // ordinal/nominal domains which, when inverted, will still produce a valid datum.\n const dataSignals = channels.map(proj => proj.signals.data);\n const update = `unit: ${unitName(model)}, fields: ${name + TUPLE_FIELDS}, values`;\n return signals.concat({\n name: tupleSg,\n ...(init ? {init: `{${update}: ${assembleInit(init)}}`} : {}),\n ...(dataSignals.length\n ? {\n on: [\n {\n events: [{signal: dataSignals.join(' || ')}], // Prevents double invocation, see https://github.com/vega/vega/issues/1672.\n update: `${dataSignals.join(' && ')} ? {${update}: [${dataSignals}]} : null`\n }\n ]\n }\n : {})\n });\n } else {\n const projection = stringValue(model.projectionName());\n const centerSg = model.projectionName() + CENTER;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x && x.signals.visual;\n const yvname = y && y.signals.visual;\n const xinit = x ? init && init[x.index] : `${centerSg}[0]`;\n const yinit = y ? init && init[y.index] : `${centerSg}[1]`;\n const sizeSg = (layout: keyof LayoutSizeIndex) => model.getSizeSignalRef(layout).signal;\n const bbox =\n `[` +\n `[${xvname ? xvname + '[0]' : '0'}, ${yvname ? yvname + '[0]' : '0'}],` +\n `[${xvname ? xvname + '[1]' : sizeSg('width')}, ` +\n `${yvname ? yvname + '[1]' : sizeSg('height')}]` +\n `]`;\n\n if (init) {\n signals.unshift({\n name: name + INIT,\n init:\n `[scale(${projection}, [${x ? xinit[0] : xinit}, ${y ? yinit[0] : yinit}]), ` +\n `scale(${projection}, [${x ? xinit[1] : xinit}, ${y ? yinit[1] : yinit}])]`\n });\n\n if (!x || !y) {\n // If initializing a uni-dimensional brush, use the center of the view to determine the other coord\n const hasCenterSg = signals.find(s => s.name === centerSg);\n if (!hasCenterSg) {\n signals.unshift({\n name: centerSg,\n update: `invert(${projection}, [${sizeSg('width')}/2, ${sizeSg('height')}/2])`\n });\n }\n }\n }\n\n const intersect = `intersect(${bbox}, {markname: ${stringValue(model.getName('marks'))}}, unit.mark)`;\n const base = `{unit: ${unitName(model)}}`;\n const update = `vlSelectionTuples(${intersect}, ${base})`;\n const visualSignals = channels.map(proj => proj.signals.visual);\n\n return signals.concat({\n name: tupleSg,\n on: [\n {\n events: [\n ...(visualSignals.length ? [{signal: visualSignals.join(' || ')}] : []),\n ...(init ? [{signal: GEO_INIT_TICK}] : [])\n ],\n update\n }\n ]\n });\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (isUnitModel(model) && model.hasProjection && selCmpt.init) {\n // Workaround for https://github.com/vega/vega/issues/3481\n // The scenegraph isn't populated on the first pulse. So we use a timer signal\n // to re-pulse the dataflow as soon as possible. We return an object to ensure\n // this only occurs once.\n const hasTick = signals.filter(s => s.name === GEO_INIT_TICK);\n if (!hasTick.length) {\n signals.unshift({\n name: GEO_INIT_TICK,\n value: null,\n on: [\n {\n events: 'timer{1}',\n update: `${GEO_INIT_TICK} === null ? {} : ${GEO_INIT_TICK}`\n }\n ]\n });\n }\n }\n\n return signals;\n },\n\n marks: (model, selCmpt, marks) => {\n const name = selCmpt.name;\n const {x, y} = selCmpt.project.hasChannel;\n const xvname = x?.signals.visual;\n const yvname = y?.signals.visual;\n const store = `data(${stringValue(selCmpt.name + STORE)})`;\n\n // Do not add a brush if we're binding to scales\n // or we don't have a valid interval projection\n if (scales.defined(selCmpt) || (!x && !y)) {\n return marks;\n }\n\n const update: any = {\n x: x !== undefined ? {signal: `${xvname}[0]`} : {value: 0},\n y: y !== undefined ? {signal: `${yvname}[0]`} : {value: 0},\n x2: x !== undefined ? {signal: `${xvname}[1]`} : {field: {group: 'width'}},\n y2: y !== undefined ? {signal: `${yvname}[1]`} : {field: {group: 'height'}}\n };\n\n // If the selection is resolved to global, only a single interval is in\n // the store. Wrap brush mark's encodings with a production rule to test\n // this based on the `unit` property. Hide the brush mark if it corresponds\n // to a unit different from the one in the store.\n if (selCmpt.resolve === 'global') {\n for (const key of keys(update)) {\n update[key] = [\n {\n test: `${store}.length && ${store}[0].unit === ${unitName(model)}`,\n ...update[key]\n },\n {value: 0}\n ];\n }\n }\n\n // Two brush marks ensure that fill colors and other aesthetic choices do\n // not interefere with the core marks, but that the brushed region can still\n // be interacted with (e.g., dragging it around).\n const {fill, fillOpacity, cursor, ...stroke} = selCmpt.mark;\n const vgStroke = keys(stroke).reduce((def, k) => {\n def[k] = [\n {\n test: [x !== undefined && `${xvname}[0] !== ${xvname}[1]`, y !== undefined && `${yvname}[0] !== ${yvname}[1]`]\n .filter(t => t)\n .join(' && '),\n value: stroke[k]\n },\n {value: null}\n ];\n return def;\n }, {});\n\n return [\n {\n name: `${name + BRUSH}_bg`,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n fill: {value: fill},\n fillOpacity: {value: fillOpacity}\n },\n update\n }\n },\n ...marks,\n {\n name: name + BRUSH,\n type: 'rect',\n clip: true,\n encode: {\n enter: {\n ...(cursor ? {cursor: {value: cursor}} : {}),\n fill: {value: 'transparent'}\n },\n update: {...update, ...vgStroke}\n }\n }\n ];\n }\n};\nexport default interval;\n\n/**\n * Returns the visual and data signals for an interval selection.\n */\nfunction channelSignals(\n model: UnitModel,\n selCmpt: SelectionComponent<'interval'>,\n proj: SelectionProjection,\n init: SelectionInitInterval\n): NewSignal[] {\n const scaledInterval = !model.hasProjection;\n const channel = proj.channel;\n const vname = proj.signals.visual;\n\n const scaleName = stringValue(scaledInterval ? model.scaleName(channel) : model.projectionName());\n const scaled = (str: string) => `scale(${scaleName}, ${str})`;\n\n const size = model.getSizeSignalRef(channel === X ? 'width' : 'height').signal;\n const coord = `${channel}(unit)`;\n const von = selCmpt.events.reduce((def: OnEvent[], evt: Stream) => {\n return [\n ...def,\n {events: evt.between[0], update: `[${coord}, ${coord}]`}, // Brush Start\n {events: evt, update: `[${vname}[0], clamp(${coord}, 0, ${size})]`} // Brush End\n ];\n }, []);\n\n if (scaledInterval) {\n const dname = proj.signals.data;\n const hasScales = scales.defined(selCmpt);\n const scale = model.getScaleComponent(channel as ScaleChannel);\n const scaleType = scale ? scale.get('type') : undefined;\n const vinit: SignalValue = init ? {init: assembleInit(init, true, scaled)} : {value: []};\n\n // React to pan/zooms of continuous scales. Non-continuous scales\n // (band, point) cannot be pan/zoomed and any other changes\n // to their domains (e.g., filtering) should clear the brushes.\n von.push({\n events: {signal: selCmpt.name + SCALE_TRIGGER},\n update: hasContinuousDomain(scaleType) ? `[${scaled(`${dname}[0]`)}, ${scaled(`${dname}[1]`)}]` : `[0, 0]`\n });\n\n return hasScales\n ? [{name: dname, on: []}]\n : [\n {name: vname, ...vinit, on: von},\n {\n name: dname,\n ...(init ? {init: assembleInit(init)} : {}), // Cannot be `value` as `init` may require datetime exprs.\n on: [\n {\n events: {signal: vname},\n update: `${vname}[0] === ${vname}[1] ? null : invert(${scaleName}, ${vname})`\n }\n ]\n }\n ];\n } else {\n const initIdx = channel === X ? 0 : 1;\n const initSg = selCmpt.name + INIT;\n const vinit: SignalValue = init ? {init: `[${initSg}[0][${initIdx}], ${initSg}[1][${initIdx}]]`} : {value: []};\n return [{name: vname, ...vinit, on: von}];\n }\n}\n","import {Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {SelectionCompiler, TUPLE, unitName} from '.';\nimport {SELECTION_ID} from '../../selection';\nimport {vals} from '../../util';\nimport {BRUSH} from './interval';\nimport {TUPLE_FIELDS} from './project';\n\nconst point: SelectionCompiler<'point'> = {\n defined: selCmpt => selCmpt.type === 'point',\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const fieldsSg = name + TUPLE_FIELDS;\n const project = selCmpt.project;\n const datum = '(item().isVoronoi ? datum.datum : datum)';\n\n // Only add a discrete selection to the store if a datum is present _and_\n // the interaction isn't occurring on a group mark. This guards against\n // polluting interactive state with invalid values in faceted displays\n // as the group marks are also data-driven. We force the update to account\n // for constant null states but varying toggles (e.g., shift-click in\n // whitespace followed by a click in whitespace; the store should only\n // be cleared on the second click).\n const brushes = vals(model.component.selection ?? {})\n .reduce((acc, cmpt) => {\n return cmpt.type === 'interval' ? acc.concat(cmpt.name + BRUSH) : acc;\n }, [])\n .map(b => `indexof(item().mark.name, '${b}') < 0`)\n .join(' && ');\n\n const test = `datum && item().mark.marktype !== 'group' && indexof(item().mark.role, 'legend') < 0${\n brushes ? ` && ${brushes}` : ''\n }`;\n\n let update = `unit: ${unitName(model)}, `;\n\n if (selCmpt.project.hasSelectionId) {\n update += `${SELECTION_ID}: ${datum}[${stringValue(SELECTION_ID)}]`;\n } else {\n const values = project.items\n .map(p => {\n const fieldDef = model.fieldDef(p.channel);\n // Binned fields should capture extents, for a range test against the raw field.\n return fieldDef?.bin\n ? `[${datum}[${stringValue(model.vgField(p.channel, {}))}], ` +\n `${datum}[${stringValue(model.vgField(p.channel, {binSuffix: 'end'}))}]]`\n : `${datum}[${stringValue(p.field)}]`;\n })\n .join(', ');\n\n update += `fields: ${fieldsSg}, values: [${values}]`;\n }\n\n const events: Stream[] = selCmpt.events;\n return signals.concat([\n {\n name: name + TUPLE,\n on: events\n ? [\n {\n events,\n update: `${test} ? {${update}} : null`,\n force: true\n }\n ]\n : []\n }\n ]);\n }\n};\n\nexport default point;\n","import {array} from 'vega-util';\nimport {ChannelDef, ConditionalPredicate, isConditionalDef, isConditionalParameter} from '../../../channeldef';\nimport {GuideEncodingConditionalValueDef} from '../../../guide';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {expression} from '../../predicate';\nimport {parseSelectionPredicate} from '../../selection/parse';\nimport {UnitModel} from '../../unit';\n\n/**\n * Return a mixin that includes a Vega production rule for a Vega-Lite conditional channel definition\n * or a simple mixin if channel def has no condition.\n */\nexport function wrapCondition(\n model: UnitModel,\n channelDef: CD,\n vgChannel: string,\n refFn: (cDef: CD) => VgValueRef\n): VgEncodeEntry {\n const condition = isConditionalDef(channelDef) && channelDef.condition;\n const valueRef = refFn(channelDef);\n if (condition) {\n const conditions = array(condition);\n const vgConditions = conditions.map(c => {\n const conditionValueRef = refFn(c);\n if (isConditionalParameter(c)) {\n const {param, empty} = c;\n const test = parseSelectionPredicate(model, {param, empty});\n return {test, ...conditionValueRef};\n } else {\n const test = expression(model, (c as ConditionalPredicate).test); // FIXME: remove casting once TS is no longer dumb about it\n return {test, ...conditionValueRef};\n }\n });\n return {\n [vgChannel]: [...vgConditions, ...(valueRef !== undefined ? [valueRef] : [])]\n };\n } else {\n return valueRef !== undefined ? {[vgChannel]: valueRef} : {};\n }\n}\n","import {getFormatMixins, isFieldOrDatumDef, isValueDef} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function text(model: UnitModel, channel: 'text' | 'href' | 'url' | 'description' = 'text') {\n const channelDef = model.encoding[channel];\n return wrapCondition(model, channelDef, channel, cDef => textRef(cDef, model.config));\n}\n\nexport function textRef(\n channelDef: Encoding['text' | 'tooltip'],\n config: Config,\n expr: 'datum' | 'datum.datum' = 'datum'\n): VgValueRef {\n // text\n if (channelDef) {\n if (isValueDef(channelDef)) {\n return signalOrValueRef(channelDef.value);\n }\n if (isFieldOrDatumDef(channelDef)) {\n const {format, formatType} = getFormatMixins(channelDef);\n return formatSignalRef({fieldOrDatumDef: channelDef, format, formatType, expr, config});\n }\n }\n return undefined;\n}\n","import {array, isArray, isObject, isString} from 'vega-util';\nimport {isBinned} from '../../../bin';\nimport {getMainRangeChannel, isXorY, Channel, THETA, RADIUS} from '../../../channel';\nimport {\n defaultTitle,\n getFieldDef,\n getFormatMixins,\n hasConditionalFieldDef,\n isFieldDef,\n isTypedFieldDef,\n SecondaryFieldDef,\n TypedFieldDef,\n vgField\n} from '../../../channeldef';\nimport {Config} from '../../../config';\nimport {Encoding, forEach} from '../../../encoding';\nimport {StackProperties} from '../../../stack';\nimport {entries} from '../../../util';\nimport {isSignalRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {binFormatExpression, formatSignalRef} from '../../format';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\n\nexport function tooltip(model: UnitModel, opt: {reactiveGeom?: boolean} = {}) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.tooltip;\n if (isArray(channelDef)) {\n return {tooltip: tooltipRefForEncoding({tooltip: channelDef}, stack, config, opt)};\n } else {\n const datum = opt.reactiveGeom ? 'datum.datum' : 'datum';\n return wrapCondition(model, channelDef, 'tooltip', cDef => {\n // use valueRef based on channelDef first\n const tooltipRefFromChannelDef = textRef(cDef, config, datum);\n if (tooltipRefFromChannelDef) {\n return tooltipRefFromChannelDef;\n }\n\n if (cDef === null) {\n // Allow using encoding.tooltip = null to disable tooltip\n return undefined;\n }\n\n let markTooltip = getMarkPropOrConfig('tooltip', markDef, config);\n\n if (markTooltip === true) {\n markTooltip = {content: 'encoding'};\n }\n\n if (isString(markTooltip)) {\n return {value: markTooltip};\n } else if (isObject(markTooltip)) {\n // `tooltip` is `{fields: 'encodings' | 'fields'}`\n if (isSignalRef(markTooltip)) {\n return markTooltip;\n } else if (markTooltip.content === 'encoding') {\n return tooltipRefForEncoding(encoding, stack, config, opt);\n } else {\n return {signal: datum};\n }\n }\n\n return undefined;\n });\n }\n}\n\nexport function tooltipData(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const formatConfig = {...config, ...config.tooltipFormat};\n const toSkip = {};\n const expr = reactiveGeom ? 'datum.datum' : 'datum';\n const tuples: {channel: Channel; key: string; value: string}[] = [];\n\n function add(fDef: TypedFieldDef | SecondaryFieldDef, channel: Channel) {\n const mainChannel = getMainRangeChannel(channel);\n\n const fieldDef: TypedFieldDef = isTypedFieldDef(fDef)\n ? fDef\n : {\n ...fDef,\n type: (encoding[mainChannel] as TypedFieldDef).type // for secondary field def, copy type from main channel\n };\n\n const title = fieldDef.title || defaultTitle(fieldDef, formatConfig);\n const key = array(title).join(', ').replaceAll(/\"/g, '\\\\\"');\n\n let value: string;\n\n if (isXorY(channel)) {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = getFieldDef(encoding[channel2]);\n\n if (isBinned(fieldDef.bin) && fieldDef2) {\n const startField = vgField(fieldDef, {expr});\n const endField = vgField(fieldDef2, {expr});\n const {format, formatType} = getFormatMixins(fieldDef);\n value = binFormatExpression(startField, endField, format, formatType, formatConfig);\n toSkip[channel2] = true;\n }\n }\n\n if (\n (isXorY(channel) || channel === THETA || channel === RADIUS) &&\n stack &&\n stack.fieldChannel === channel &&\n stack.offset === 'normalize'\n ) {\n const {format, formatType} = getFormatMixins(fieldDef);\n value = formatSignalRef({\n fieldOrDatumDef: fieldDef,\n format,\n formatType,\n expr,\n config: formatConfig,\n normalizeStack: true\n }).signal;\n }\n\n value ??= textRef(fieldDef, formatConfig, expr).signal;\n\n tuples.push({channel, key, value});\n }\n\n forEach(encoding, (channelDef, channel) => {\n if (isFieldDef(channelDef)) {\n add(channelDef, channel);\n } else if (hasConditionalFieldDef(channelDef)) {\n add(channelDef.condition, channel);\n }\n });\n\n const out = {};\n for (const {channel, key, value} of tuples) {\n if (!toSkip[channel] && !out[key]) {\n out[key] = value;\n }\n }\n\n return out;\n}\n\nexport function tooltipRefForEncoding(\n encoding: Encoding,\n stack: StackProperties,\n config: Config,\n {reactiveGeom}: {reactiveGeom?: boolean} = {}\n) {\n const data = tooltipData(encoding, stack, config, {reactiveGeom});\n\n const keyValues = entries(data).map(([key, value]) => `\"${key}\": ${value}`);\n return keyValues.length > 0 ? {signal: `{${keyValues.join(', ')}}`} : undefined;\n}\n","import {entries, isEmpty} from '../../../util';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {VG_MARK_INDEX} from './../../../vega.schema';\nimport {UnitModel} from './../../unit';\nimport {wrapCondition} from './conditional';\nimport {textRef} from './text';\nimport {tooltipData} from './tooltip';\n\nexport function aria(model: UnitModel) {\n const {markDef, config} = model;\n\n const enableAria = getMarkPropOrConfig('aria', markDef, config);\n\n // We can ignore other aria properties if ariaHidden is true.\n if (enableAria === false) {\n // getMarkGroups sets aria to false already so we don't have to set it in the encode block\n return {};\n }\n\n return {\n ...(enableAria ? {aria: enableAria} : {}),\n ...ariaRoleDescription(model),\n ...description(model)\n };\n}\n\nfunction ariaRoleDescription(model: UnitModel) {\n const {mark, markDef, config} = model;\n\n if (config.aria === false) {\n return {};\n }\n\n const ariaRoleDesc = getMarkPropOrConfig('ariaRoleDescription', markDef, config);\n\n if (ariaRoleDesc != null) {\n return {ariaRoleDescription: {value: ariaRoleDesc}};\n }\n\n return mark in VG_MARK_INDEX ? {} : {ariaRoleDescription: {value: mark}};\n}\n\nexport function description(model: UnitModel) {\n const {encoding, markDef, config, stack} = model;\n const channelDef = encoding.description;\n\n if (channelDef) {\n return wrapCondition(model, channelDef, 'description', cDef => textRef(cDef, model.config));\n }\n\n // Use default from mark def or config if defined.\n // Functions in encode usually just return undefined but since we are defining a default below, we need to check the default here.\n const descriptionValue = getMarkPropOrConfig('description', markDef, config);\n if (descriptionValue != null) {\n return {\n description: signalOrValueRef(descriptionValue)\n };\n }\n\n if (config.aria === false) {\n return {};\n }\n\n const data = tooltipData(encoding, stack, config);\n\n if (isEmpty(data)) {\n return undefined;\n }\n\n return {\n description: {\n signal: entries(data)\n .map(([key, value], index) => `\"${index > 0 ? '; ' : ''}${key}: \" + (${value})`)\n .join(' + ')\n }\n };\n}\n","import type {SignalRef} from 'vega';\nimport {NonPositionScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {VgEncodeChannel, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\nimport * as ref from './valueref';\n\n/**\n * Return encode for non-positional channels with scales. (Text doesn't have scale.)\n */\nexport function nonPosition(\n channel: NonPositionScaleChannel,\n model: UnitModel,\n opt: {\n defaultValue?: Value | SignalRef;\n vgChannel?: VgEncodeChannel;\n defaultRef?: VgValueRef;\n } = {}\n): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {vgChannel} = opt;\n let {defaultRef, defaultValue} = opt;\n\n if (defaultRef === undefined) {\n // prettier-ignore\n defaultValue ??= getMarkPropOrConfig(channel, markDef, config, {vgChannel, ignoreVgConfig: true});\n\n if (defaultValue !== undefined) {\n defaultRef = signalOrValueRef(defaultValue);\n }\n }\n\n const channelDef = encoding[channel];\n\n return wrapCondition(model, channelDef, vgChannel ?? channel, cDef => {\n return ref.midPoint({\n channel,\n channelDef: cDef,\n markDef,\n config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null, // No need to provide stack for non-position as it does not affect mid point\n defaultRef\n });\n });\n}\n","import * as log from '../../../log';\nimport {contains} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\n\nexport function color(model: UnitModel, opt: {filled: boolean | undefined} = {filled: undefined}): VgEncodeEntry {\n const {markDef, encoding, config} = model;\n const {type: markType} = markDef;\n\n // Allow filled to be overridden (for trail's \"filled\")\n const filled = opt.filled ?? getMarkPropOrConfig('filled', markDef, config);\n\n const transparentIfNeeded = contains(['bar', 'point', 'circle', 'square', 'geoshape'], markType)\n ? 'transparent'\n : undefined;\n\n const defaultFill =\n getMarkPropOrConfig(filled === true ? 'color' : undefined, markDef, config, {vgChannel: 'fill'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === true && 'color'] ??\n // If there is no fill, always fill symbols, bar, geoshape\n // with transparent fills https://github.com/vega/vega-lite/issues/1316\n transparentIfNeeded;\n\n const defaultStroke =\n getMarkPropOrConfig(filled === false ? 'color' : undefined, markDef, config, {vgChannel: 'stroke'}) ??\n // need to add this manually as getMarkConfig normally drops config.mark[channel] if vgChannel is specified\n config.mark[filled === false && 'color'];\n\n const colorVgChannel = filled ? 'fill' : 'stroke';\n\n const fillStrokeMarkDefAndConfig: VgEncodeEntry = {\n ...(defaultFill ? {fill: signalOrValueRef(defaultFill)} : {}),\n ...(defaultStroke ? {stroke: signalOrValueRef(defaultStroke)} : {})\n };\n\n if (markDef.color && (filled ? markDef.fill : markDef.stroke)) {\n log.warn(log.message.droppingColor('property', {fill: 'fill' in markDef, stroke: 'stroke' in markDef}));\n }\n\n return {\n ...fillStrokeMarkDefAndConfig,\n ...nonPosition('color', model, {\n vgChannel: colorVgChannel,\n defaultValue: filled ? defaultFill : defaultStroke\n }),\n ...nonPosition('fill', model, {\n // if there is encoding.fill, include default fill just in case we have conditional-only fill encoding\n defaultValue: encoding.fill ? defaultFill : undefined\n }),\n ...nonPosition('stroke', model, {\n // if there is encoding.stroke, include default fill just in case we have conditional-only stroke encoding\n defaultValue: encoding.stroke ? defaultStroke : undefined\n })\n };\n}\n","import {isValueDef} from '../../../channeldef';\nimport {isPathMark} from '../../../mark';\nimport {signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {wrapCondition} from './conditional';\n\nexport function zindex(model: UnitModel) {\n const {encoding, mark} = model;\n const order = encoding.order;\n\n if (!isPathMark(mark) && isValueDef(order)) {\n return wrapCondition(model, order, 'zindex', cd => signalOrValueRef(cd.value));\n }\n return {};\n}\n","/**\n * Utility files for producing Vega ValueRef for marks\n */\nimport type {SignalRef} from 'vega';\nimport {PolarPositionChannel, PositionChannel} from '../../../channel';\nimport {Encoding} from '../../../encoding';\nimport {Mark, MarkDef} from '../../../mark';\nimport {VgValueRef} from '../../../vega.schema';\nimport {signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {midPoint} from './valueref';\n\nexport interface Offset {\n offsetType?: 'visual' | 'encoding';\n offset?: number | VgValueRef;\n}\n\nexport function positionOffset({\n channel: baseChannel,\n markDef,\n encoding = {},\n model,\n bandPosition\n}: {\n channel: PositionChannel | PolarPositionChannel;\n markDef: MarkDef;\n encoding?: Encoding;\n model?: UnitModel;\n bandPosition?: number;\n}): Offset {\n const channel = `${baseChannel}Offset` as\n | 'xOffset'\n | 'yOffset'\n | 'x2Offset'\n | 'y2Offset'\n | 'thetaOffset'\n | 'radiusOffset'\n | 'theta2Offset'\n | 'radius2Offset'; // Need to cast as the type can't be inferred automatically\n\n const defaultValue = markDef[channel];\n const channelDef = encoding[channel];\n\n if ((channel === 'xOffset' || channel === 'yOffset') && channelDef) {\n const ref = midPoint({\n channel: channel,\n channelDef,\n markDef,\n config: model?.config,\n scaleName: model.scaleName(channel),\n scale: model.getScaleComponent(channel),\n stack: null,\n defaultRef: signalOrValueRef(defaultValue),\n bandPosition\n });\n return {offsetType: 'encoding', offset: ref};\n }\n\n const markDefOffsetValue = markDef[channel];\n if (markDefOffsetValue) {\n return {offsetType: 'visual', offset: markDefOffsetValue};\n }\n\n return {};\n}\n","import {\n getMainRangeChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {isFieldDef, isFieldOrDatumDef, TypedFieldDef} from '../../../channeldef';\nimport {ScaleType} from '../../../scale';\nimport {contains} from '../../../util';\nimport {VgValueRef} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {positionOffset} from './offset';\nimport * as ref from './valueref';\n\n/**\n * Return encode for point (non-band) position channels.\n */\nexport function pointPosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n vgChannel\n }: {\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n vgChannel?: 'x' | 'y' | 'xc' | 'yc';\n }\n) {\n const {encoding, markDef, config, stack} = model;\n\n const channelDef = encoding[channel];\n const channel2Def = encoding[getSecondaryRangeChannel(channel)];\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n\n const {offset, offsetType} = positionOffset({\n channel,\n markDef,\n encoding,\n model,\n bandPosition: 0.5\n });\n\n // Get default position or position from mark def\n const defaultRef = pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n });\n\n const valueRef =\n !channelDef && isXorY(channel) && (encoding.latitude || encoding.longitude)\n ? // use geopoint output if there are lat/long and there is no point position overriding lat/long.\n {field: model.getName(channel)}\n : positionRef({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef,\n bandPosition: offsetType === 'encoding' ? 0 : undefined\n });\n\n return valueRef ? {[vgChannel || channel]: valueRef} : undefined;\n}\n\n// TODO: we need to find a way to refactor these so that scaleName is a part of scale\n// but that's complicated. For now, this is a huge step moving forward.\n\n/**\n * @return Vega ValueRef for normal x- or y-position without projection\n */\nexport function positionRef(\n params: ref.MidPointParams & {\n channel: 'x' | 'y' | 'radius' | 'theta';\n }\n): VgValueRef | VgValueRef[] {\n const {channel, channelDef, scaleName, stack, offset, markDef} = params;\n\n // This isn't a part of midPoint because we use midPoint for non-position too\n if (isFieldOrDatumDef(channelDef) && stack && channel === stack.fieldChannel) {\n if (isFieldDef(channelDef)) {\n let bandPosition = channelDef.bandPosition;\n\n if (bandPosition === undefined && markDef.type === 'text' && (channel === 'radius' || channel === 'theta')) {\n // theta and radius of text mark should use bandPosition = 0.5 by default\n // so that labels for arc marks are centered automatically\n bandPosition = 0.5;\n }\n\n if (bandPosition !== undefined) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: channelDef as TypedFieldDef, // positionRef always have type\n startSuffix: 'start',\n bandPosition,\n offset\n });\n }\n }\n // x or y use stack_end so that stacked line's point mark use stack_end too.\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'end'}, {offset});\n }\n\n return ref.midPointRefWithPositionInvalidTest(params);\n}\n\nexport function pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n}: {\n model: UnitModel;\n defaultPos: 'mid' | 'zeroOrMin' | 'zeroOrMax' | null;\n channel: PositionChannel | PolarPositionChannel;\n scaleName: string;\n scale: ScaleComponent;\n}): () => VgValueRef {\n const {markDef, config} = model;\n return () => {\n const mainChannel = getMainRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const definedValueOrConfig = getMarkPropOrConfig(channel, markDef, config, {vgChannel});\n if (definedValueOrConfig !== undefined) {\n return ref.widthHeightValueOrSignalRef(channel, definedValueOrConfig);\n }\n\n switch (defaultPos) {\n case 'zeroOrMin':\n case 'zeroOrMax':\n if (scaleName) {\n const scaleType = scale.get('type');\n if (contains([ScaleType.LOG, ScaleType.TIME, ScaleType.UTC], scaleType)) {\n // Log scales cannot have zero.\n // Zero in time scale is arbitrary, and does not affect ratio.\n // (Time is an interval level of measurement, not ratio).\n // See https://en.wikipedia.org/wiki/Level_of_measurement for more info.\n } else {\n if (scale.domainDefinitelyIncludesZero()) {\n return {\n scale: scaleName,\n value: 0\n };\n }\n }\n }\n\n if (defaultPos === 'zeroOrMin') {\n return mainChannel === 'y' ? {field: {group: 'height'}} : {value: 0};\n } else {\n // zeroOrMax\n switch (mainChannel) {\n case 'radius':\n // max of radius is min(width, height) / 2\n return {\n signal: `min(${model.width.signal},${model.height.signal})/2`\n };\n case 'theta':\n return {signal: '2*PI'};\n case 'x':\n return {field: {group: 'width'}};\n case 'y':\n return {value: 0};\n }\n }\n break;\n case 'mid': {\n const sizeRef = model[getSizeChannel(channel)];\n return {...sizeRef, mult: 0.5};\n }\n }\n // defaultPos === null\n return undefined;\n };\n}\n","import {Align, SignalRef, TextBaseline} from 'vega';\nimport {getVgPositionChannel} from '../../../channel';\nimport {Config} from '../../../config';\nimport * as log from '../../../log';\nimport {Mark, MarkDef} from '../../../mark';\nimport {isSignalRef, VgEncodeChannel} from '../../../vega.schema';\nimport {getMarkPropOrConfig} from '../../common';\n\nconst ALIGNED_X_CHANNEL: Record = {\n left: 'x',\n center: 'xc',\n right: 'x2'\n};\n\nconst BASELINED_Y_CHANNEL = {\n top: 'y',\n middle: 'yc',\n bottom: 'y2'\n};\n\nexport function vgAlignedPositionChannel(\n channel: 'x' | 'y' | 'radius' | 'theta',\n markDef: MarkDef,\n config: Config,\n defaultAlign: 'top' | 'middle' = 'middle'\n) {\n if (channel === 'radius' || channel === 'theta') {\n return getVgPositionChannel(channel);\n }\n const alignChannel = channel === 'x' ? 'align' : 'baseline';\n const align = getMarkPropOrConfig(alignChannel, markDef, config);\n\n let alignExcludingSignal: Align | TextBaseline;\n\n if (isSignalRef(align)) {\n log.warn(log.message.rangeMarkAlignmentCannotBeExpression(alignChannel));\n alignExcludingSignal = undefined;\n } else {\n alignExcludingSignal = align;\n }\n\n if (channel === 'x') {\n return ALIGNED_X_CHANNEL[alignExcludingSignal || (defaultAlign === 'top' ? 'left' : 'center')];\n } else {\n return BASELINED_Y_CHANNEL[alignExcludingSignal || defaultAlign];\n }\n}\n","import type {SignalRef} from 'vega';\nimport {getMainRangeChannel, getSecondaryRangeChannel, getSizeChannel, getVgPositionChannel} from '../../../channel';\nimport {isFieldOrDatumDef} from '../../../channeldef';\nimport * as log from '../../../log';\nimport {isRelativeBandSize, Mark, MarkConfig, MarkDef} from '../../../mark';\nimport {VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkStyleConfig} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {positionOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPosition, pointPositionDefaultRef} from './position-point';\nimport * as ref from './valueref';\n\n/**\n * Utility for area/rule position, which can be either point or range.\n * (One of the axes should be point and the other should be range.)\n */\nexport function pointOrRangePosition(\n channel: 'x' | 'y',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2,\n range\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n range: boolean;\n }\n) {\n if (range) {\n return rangePosition(channel, model, {defaultPos, defaultPos2});\n }\n return pointPosition(channel, model, {defaultPos});\n}\n\nexport function rangePosition(\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel,\n {\n defaultPos,\n defaultPos2\n }: {\n defaultPos: 'zeroOrMin' | 'zeroOrMax' | 'mid';\n defaultPos2: 'zeroOrMin' | 'zeroOrMax';\n }\n): VgEncodeEntry {\n const {markDef, config} = model;\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n\n const pos2Mixins = pointPosition2OrSize(model, defaultPos2, channel2);\n\n const vgChannel = pos2Mixins[sizeChannel]\n ? // If there is width/height, we need to position the marks based on the alignment.\n vgAlignedPositionChannel(channel, markDef, config)\n : // Otherwise, make sure to apply to the right Vg Channel (for arc mark)\n getVgPositionChannel(channel);\n\n return {\n ...pointPosition(channel, model, {defaultPos, vgChannel}),\n ...pos2Mixins\n };\n}\n\n/**\n * Return encode for x2, y2.\n * If channel is not specified, return one channel based on orientation.\n */\nfunction pointPosition2OrSize(\n model: UnitModel,\n defaultPos: 'zeroOrMin' | 'zeroOrMax',\n channel: 'x2' | 'y2' | 'radius2' | 'theta2'\n) {\n const {encoding, mark, markDef, stack, config} = model;\n\n const baseChannel = getMainRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n\n const channelDef = encoding[baseChannel];\n const scaleName = model.scaleName(baseChannel);\n const scale = model.getScaleComponent(baseChannel);\n\n const {offset} =\n channel in encoding || channel in markDef\n ? positionOffset({channel, markDef, encoding, model})\n : positionOffset({channel: baseChannel, markDef, encoding, model});\n\n if (!channelDef && (channel === 'x2' || channel === 'y2') && (encoding.latitude || encoding.longitude)) {\n const vgSizeChannel = getSizeChannel(channel);\n\n const size = model.markDef[vgSizeChannel];\n if (size != null) {\n return {\n [vgSizeChannel]: {value: size}\n };\n } else {\n return {\n [vgChannel]: {field: model.getName(channel)}\n };\n }\n }\n\n const valueRef = position2Ref({\n channel,\n channelDef,\n channel2Def: encoding[channel],\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: undefined\n });\n\n if (valueRef !== undefined) {\n return {[vgChannel]: valueRef};\n }\n\n // TODO: check width/height encoding here once we add them\n\n // no x2/y2 encoding, then try to read x2/y2 or width/height based on precedence:\n // markDef > config.style > mark-specific config (config[mark]) > general mark config (config.mark)\n\n return (\n position2orSize(channel, markDef) ||\n position2orSize(channel, {\n [channel]: getMarkStyleConfig(channel, markDef, config.style),\n [sizeChannel]: getMarkStyleConfig(sizeChannel, markDef, config.style)\n }) ||\n position2orSize(channel, config[mark]) ||\n position2orSize(channel, config.mark) || {\n [vgChannel]: pointPositionDefaultRef({\n model,\n defaultPos,\n channel,\n scaleName,\n scale\n })()\n }\n );\n}\n\nexport function position2Ref({\n channel,\n channelDef,\n channel2Def,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef\n}: ref.MidPointParams & {\n channel: 'x2' | 'y2' | 'radius2' | 'theta2';\n}): VgValueRef | VgValueRef[] {\n if (\n isFieldOrDatumDef(channelDef) &&\n stack &&\n // If fieldChannel is X and channel is X2 (or Y and Y2)\n channel.charAt(0) === stack.fieldChannel.charAt(0)\n ) {\n return ref.valueRefForFieldOrDatumDef(channelDef, scaleName, {suffix: 'start'}, {offset});\n }\n return ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: channel2Def,\n scaleName,\n scale,\n stack,\n markDef,\n config,\n offset,\n defaultRef\n });\n}\n\nfunction position2orSize(\n channel: 'x2' | 'y2' | 'radius2' | 'theta2',\n markDef: MarkConfig | MarkDef\n) {\n const sizeChannel = getSizeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n if (markDef[vgChannel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[vgChannel])};\n } else if (markDef[channel] !== undefined) {\n return {[vgChannel]: ref.widthHeightValueOrSignalRef(channel, markDef[channel])};\n } else if (markDef[sizeChannel]) {\n const dimensionSize = markDef[sizeChannel];\n if (isRelativeBandSize(dimensionSize)) {\n log.warn(log.message.relativeBandSizeNotSupported(sizeChannel));\n } else {\n return {[sizeChannel]: ref.widthHeightValueOrSignalRef(channel, dimensionSize)};\n }\n }\n return undefined;\n}\n","import type {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../../bin';\nimport {\n getOffsetChannel,\n getSecondaryRangeChannel,\n getSizeChannel,\n getVgPositionChannel,\n isPolarPositionChannel,\n isXorY,\n PolarPositionChannel,\n PositionChannel\n} from '../../../channel';\nimport {getBandPosition, getBandSize, isFieldDef, isFieldOrDatumDef, TypedFieldDef, vgField} from '../../../channeldef';\nimport {Config, getViewConfigDiscreteStep} from '../../../config';\nimport {Encoding} from '../../../encoding';\nimport * as log from '../../../log';\nimport {BandSize, isRelativeBandSize} from '../../../mark';\nimport {hasDiscreteDomain} from '../../../scale';\nimport {isSignalRef, isVgRangeStep, VgEncodeEntry, VgValueRef} from '../../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, signalOrStringValue, signalOrValueRef} from '../../common';\nimport {ScaleComponent} from '../../scale/component';\nimport {UnitModel} from '../../unit';\nimport {nonPosition} from './nonposition';\nimport {positionOffset} from './offset';\nimport {vgAlignedPositionChannel} from './position-align';\nimport {pointPositionDefaultRef} from './position-point';\nimport {rangePosition} from './position-range';\nimport * as ref from './valueref';\nimport {getOffsetScaleChannel} from '../../../channel';\nimport {getFirstDefined} from '../../../util';\nimport {Mark} from '../../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from '../../data/timeunit';\n\nexport function rectPosition(model: UnitModel, channel: 'x' | 'y' | 'theta' | 'radius'): VgEncodeEntry {\n const {config, encoding, markDef} = model;\n const mark = markDef.type;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const sizeChannel = getSizeChannel(channel);\n const channelDef = encoding[channel];\n const channelDef2 = encoding[channel2];\n\n const scale = model.getScaleComponent(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n\n const orient = markDef.orient;\n const hasSizeDef =\n encoding[sizeChannel] ?? encoding.size ?? getMarkPropOrConfig('size', markDef, config, {vgChannel: sizeChannel});\n\n const offsetScaleChannel = getOffsetChannel(channel);\n\n const isBarBand = mark === 'bar' && (channel === 'x' ? orient === 'vertical' : orient === 'horizontal');\n\n // x, x2, and width -- we must specify two of these in all conditions\n if (\n isFieldDef(channelDef) &&\n (isBinning(channelDef.bin) || isBinned(channelDef.bin) || (channelDef.timeUnit && !channelDef2)) &&\n !(hasSizeDef && !isRelativeBandSize(hasSizeDef)) &&\n !encoding[offsetScaleChannel] &&\n !hasDiscreteDomain(scaleType)\n ) {\n return rectBinPosition({\n fieldDef: channelDef,\n fieldDef2: channelDef2,\n channel,\n model\n });\n } else if (((isFieldOrDatumDef(channelDef) && hasDiscreteDomain(scaleType)) || isBarBand) && !channelDef2) {\n return positionAndSize(channelDef, channel, model);\n } else {\n return rangePosition(channel, model, {defaultPos: 'zeroOrMax', defaultPos2: 'zeroOrMin'});\n }\n}\n\nfunction defaultSizeRef(\n sizeChannel: 'width' | 'height',\n scaleName: string,\n scale: ScaleComponent,\n config: Config,\n bandSize: BandSize,\n hasFieldDef: boolean,\n mark: Mark\n): VgValueRef {\n if (isRelativeBandSize(bandSize)) {\n if (scale) {\n const scaleType = scale.get('type');\n if (scaleType === 'band') {\n let bandWidth = `bandwidth('${scaleName}')`;\n if (bandSize.band !== 1) {\n bandWidth = `${bandSize.band} * ${bandWidth}`;\n }\n const minBandSize = getMarkConfig('minBandSize', {type: mark}, config);\n return {signal: minBandSize ? `max(${signalOrStringValue(minBandSize)}, ${bandWidth})` : bandWidth};\n } else if (bandSize.band !== 1) {\n log.warn(log.message.cannotUseRelativeBandSizeWithNonBandScale(scaleType));\n bandSize = undefined;\n }\n } else {\n return {\n mult: bandSize.band,\n field: {group: sizeChannel}\n };\n }\n } else if (isSignalRef(bandSize)) {\n return bandSize;\n } else if (bandSize) {\n return {value: bandSize};\n }\n\n // no valid band size\n if (scale) {\n const scaleRange = scale.get('range');\n if (isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return {value: scaleRange.step - 2};\n }\n }\n if (!hasFieldDef) {\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner} = config.scale;\n const padding = getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner); // this part is like paddingInner in scale.ts\n if (isSignalRef(padding)) {\n return {signal: `(1 - (${padding.signal})) * ${sizeChannel}`};\n } else if (isNumber(padding)) {\n return {signal: `${1 - padding} * ${sizeChannel}`};\n }\n }\n const defaultStep = getViewConfigDiscreteStep(config.view, sizeChannel);\n return {value: defaultStep - 2};\n}\n\n/**\n * Output position encoding and its size encoding for continuous, point, and band scales.\n */\nfunction positionAndSize(\n fieldDef: Encoding['x' | 'y' | 'theta' | 'radius'],\n channel: 'x' | 'y' | 'theta' | 'radius',\n model: UnitModel\n) {\n const {markDef, encoding, config, stack} = model;\n const orient = markDef.orient;\n\n const scaleName = model.scaleName(channel);\n const scale = model.getScaleComponent(channel);\n const vgSizeChannel = getSizeChannel(channel);\n const channel2 = getSecondaryRangeChannel(channel);\n\n const offsetScaleChannel = getOffsetChannel(channel);\n const offsetScaleName = model.scaleName(offsetScaleChannel);\n const offsetScale = model.getScaleComponent(getOffsetScaleChannel(channel));\n\n // use \"size\" channel for bars, if there is orient and the channel matches the right orientation\n const useVlSizeChannel = (orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x');\n\n // Use size encoding / mark property / config if it exists\n let sizeMixins;\n if (encoding.size || markDef.size) {\n if (useVlSizeChannel) {\n sizeMixins = nonPosition('size', model, {\n vgChannel: vgSizeChannel,\n defaultRef: signalOrValueRef(markDef.size)\n });\n } else {\n log.warn(log.message.cannotApplySizeToNonOrientedMark(markDef.type));\n }\n }\n const hasSizeFromMarkOrEncoding = !!sizeMixins;\n\n // Otherwise, apply default value\n const bandSize = getBandSize({\n channel,\n fieldDef,\n markDef,\n config,\n scaleType: (scale || offsetScale)?.get('type'),\n useVlSizeChannel\n });\n\n sizeMixins = sizeMixins || {\n [vgSizeChannel]: defaultSizeRef(\n vgSizeChannel,\n offsetScaleName || scaleName,\n offsetScale || scale,\n config,\n bandSize,\n !!fieldDef,\n markDef.type\n )\n };\n\n /*\n Band scales with size value and all point scales, use xc/yc + band=0.5\n\n Otherwise (band scales that has size based on a band ref), use x/y with position band = (1 - size_band) / 2.\n In this case, size_band is the band specified in the x/y-encoding.\n By default band is 1, so `(1 - band) / 2` = 0.\n If band is 0.6, the the x/y position in such case should be `(1 - band) / 2` = 0.2\n */\n\n const defaultBandAlign =\n (scale || offsetScale)?.get('type') === 'band' && isRelativeBandSize(bandSize) && !hasSizeFromMarkOrEncoding\n ? 'top'\n : 'middle';\n\n const vgChannel = vgAlignedPositionChannel(channel, markDef, config, defaultBandAlign);\n const center = vgChannel === 'xc' || vgChannel === 'yc';\n const {offset, offsetType} = positionOffset({channel, markDef, encoding, model, bandPosition: center ? 0.5 : 0});\n\n const posRef = ref.midPointRefWithPositionInvalidTest({\n channel,\n channelDef: fieldDef,\n markDef,\n config,\n scaleName,\n scale,\n stack,\n offset,\n defaultRef: pointPositionDefaultRef({model, defaultPos: 'mid', channel, scaleName, scale}),\n bandPosition: center\n ? offsetType === 'encoding'\n ? 0\n : 0.5\n : isSignalRef(bandSize)\n ? {signal: `(1-${bandSize})/2`}\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0\n });\n\n if (vgSizeChannel) {\n return {[vgChannel]: posRef, ...sizeMixins};\n } else {\n // otherwise, we must simulate size by setting position2 = position + size\n // (for theta/radius since Vega doesn't have thetaWidth/radiusWidth)\n const vgChannel2 = getVgPositionChannel(channel2);\n const sizeRef = sizeMixins[vgSizeChannel];\n const sizeOffset = offset ? {...sizeRef, offset} : sizeRef;\n return {\n [vgChannel]: posRef,\n\n // posRef might be an array that wraps position invalid test\n [vgChannel2]: isArray(posRef)\n ? [posRef[0], {...posRef[1], offset: sizeOffset}]\n : {\n ...posRef,\n offset: sizeOffset\n }\n };\n }\n}\n\nfunction getBinSpacing(\n channel: PositionChannel | PolarPositionChannel,\n spacing: number,\n reverse: boolean | SignalRef,\n axisTranslate: number | SignalRef,\n offset: number | VgValueRef,\n minBandSize: number | SignalRef,\n bandSizeExpr: string\n) {\n if (isPolarPositionChannel(channel)) {\n return 0;\n }\n\n const isEnd = channel === 'x' || channel === 'y2';\n\n const spacingOffset = isEnd ? -spacing / 2 : spacing / 2;\n\n if (isSignalRef(reverse) || isSignalRef(offset) || isSignalRef(axisTranslate) || minBandSize) {\n const reverseExpr = signalOrStringValue(reverse);\n const offsetExpr = signalOrStringValue(offset);\n const axisTranslateExpr = signalOrStringValue(axisTranslate);\n const minBandSizeExpr = signalOrStringValue(minBandSize);\n\n const sign = isEnd ? '' : '-';\n\n const spacingAndSizeOffset = minBandSize\n ? `(${bandSizeExpr} < ${minBandSizeExpr} ? ${sign}0.5 * (${minBandSizeExpr} - (${bandSizeExpr})) : ${spacingOffset})`\n : spacingOffset;\n\n const t = axisTranslateExpr ? `${axisTranslateExpr} + ` : '';\n const r = reverseExpr ? `(${reverseExpr} ? -1 : 1) * ` : '';\n const o = offsetExpr ? `(${offsetExpr} + ${spacingAndSizeOffset})` : spacingAndSizeOffset;\n\n return {\n signal: t + r + o\n };\n } else {\n offset = offset || 0;\n return axisTranslate + (reverse ? -offset - spacingOffset : +offset + spacingOffset);\n }\n}\n\nfunction rectBinPosition({\n fieldDef,\n fieldDef2,\n channel,\n model\n}: {\n fieldDef: TypedFieldDef;\n fieldDef2?: Encoding['x2' | 'y2'];\n channel: 'x' | 'y' | 'theta' | 'radius';\n model: UnitModel;\n}) {\n const {config, markDef, encoding} = model;\n\n const scale = model.getScaleComponent(channel);\n const scaleName = model.scaleName(channel);\n const scaleType = scale ? scale.get('type') : undefined;\n const reverse = scale.get('reverse');\n\n const bandSize = getBandSize({channel, fieldDef, markDef, config, scaleType});\n\n const axis = model.component.axes[channel]?.[0];\n const axisTranslate = axis?.get('translate') ?? 0.5; // vega default is 0.5\n\n const spacing = isXorY(channel) ? getMarkPropOrConfig('binSpacing', markDef, config) ?? 0 : 0;\n\n const channel2 = getSecondaryRangeChannel(channel);\n const vgChannel = getVgPositionChannel(channel);\n const vgChannel2 = getVgPositionChannel(channel2);\n const minBandSize = getMarkConfig('minBandSize', markDef, config);\n\n const {offset} = positionOffset({channel, markDef, encoding, model, bandPosition: 0});\n const {offset: offset2} = positionOffset({channel: channel2, markDef, encoding, model, bandPosition: 0});\n\n const bandSizeExpr = ref.binSizeExpr({fieldDef, scaleName});\n const binSpacingOffset = getBinSpacing(channel, spacing, reverse, axisTranslate, offset, minBandSize, bandSizeExpr);\n const binSpacingOffset2 = getBinSpacing(\n channel2,\n spacing,\n reverse,\n axisTranslate,\n offset2 ?? offset,\n minBandSize,\n bandSizeExpr\n );\n\n const bandPositionForBandSize = isSignalRef(bandSize)\n ? {signal: `(1-${bandSize.signal})/2`}\n : isRelativeBandSize(bandSize)\n ? (1 - bandSize.band) / 2\n : 0.5;\n\n const bandPosition = getBandPosition({fieldDef, fieldDef2, markDef, config});\n\n if (isBinning(fieldDef.bin) || fieldDef.timeUnit) {\n const useRectOffsetField = fieldDef.timeUnit && bandPosition !== 0.5;\n\n return {\n [vgChannel2]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: bandPositionForBandSize,\n offset: binSpacingOffset2,\n useRectOffsetField\n }),\n [vgChannel]: rectBinRef({\n fieldDef,\n scaleName,\n bandPosition: isSignalRef(bandPositionForBandSize)\n ? {signal: `1-${bandPositionForBandSize.signal}`}\n : 1 - bandPositionForBandSize,\n offset: binSpacingOffset,\n useRectOffsetField\n })\n };\n } else if (isBinned(fieldDef.bin)) {\n const startRef = ref.valueRefForFieldOrDatumDef(fieldDef, scaleName, {}, {offset: binSpacingOffset2});\n\n if (isFieldDef(fieldDef2)) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: ref.valueRefForFieldOrDatumDef(fieldDef2, scaleName, {}, {offset: binSpacingOffset})\n };\n } else if (isBinParams(fieldDef.bin) && fieldDef.bin.step) {\n return {\n [vgChannel2]: startRef,\n [vgChannel]: {\n signal: `scale(\"${scaleName}\", ${vgField(fieldDef, {expr: 'datum'})} + ${fieldDef.bin.step})`,\n offset: binSpacingOffset\n }\n };\n }\n }\n log.warn(log.message.channelRequiredForBinned(channel2));\n return undefined;\n}\n\n/**\n * Value Ref for binned fields\n */\nfunction rectBinRef({\n fieldDef,\n scaleName,\n bandPosition,\n offset,\n useRectOffsetField\n}: {\n fieldDef: TypedFieldDef;\n scaleName: string;\n bandPosition: number | SignalRef;\n offset?: number | SignalRef;\n useRectOffsetField: boolean;\n}) {\n return ref.interpolatedSignalRef({\n scaleName,\n fieldOrDatumDef: fieldDef,\n bandPosition,\n offset,\n ...(useRectOffsetField\n ? {\n startSuffix: OFFSETTED_RECT_START_SUFFIX,\n endSuffix: OFFSETTED_RECT_END_SUFFIX\n }\n : {})\n });\n}\n","import {array} from 'vega-util';\nimport {Channel, ScaleChannel, SCALE_CHANNELS} from '../../../channel';\nimport {isPathMark, MarkDef} from '../../../mark';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry, VgValueRef, VG_MARK_CONFIGS} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {aria} from './aria';\nimport {color} from './color';\nimport {nonPosition} from './nonposition';\nimport {text} from './text';\nimport {tooltip} from './tooltip';\nimport {fieldInvalidPredicate} from './valueref';\nimport {zindex} from './zindex';\n\nexport {color} from './color';\nexport {wrapCondition} from './conditional';\nexport {nonPosition} from './nonposition';\nexport {pointPosition} from './position-point';\nexport {pointOrRangePosition, rangePosition} from './position-range';\nexport {rectPosition} from './position-rect';\nexport {text} from './text';\nexport {tooltip} from './tooltip';\n\nexport type Ignore = Record<'color' | 'size' | 'orient' | 'align' | 'baseline' | 'theta', 'ignore' | 'include'>;\n\nconst ALWAYS_IGNORE = new Set(['aria', 'width', 'height']);\n\nexport function baseEncodeEntry(model: UnitModel, ignore: Ignore) {\n const {fill = undefined, stroke = undefined} = ignore.color === 'include' ? color(model) : {};\n return {\n ...markDefProperties(model.markDef, ignore),\n ...wrapAllFieldsInvalid(model, 'fill', fill),\n ...wrapAllFieldsInvalid(model, 'stroke', stroke),\n ...nonPosition('opacity', model),\n ...nonPosition('fillOpacity', model),\n ...nonPosition('strokeOpacity', model),\n ...nonPosition('strokeWidth', model),\n ...nonPosition('strokeDash', model),\n ...zindex(model),\n ...tooltip(model),\n ...text(model, 'href'),\n ...aria(model)\n };\n}\n\n// TODO: mark VgValueRef[] as readonly after https://github.com/vega/vega/pull/1987\nfunction wrapAllFieldsInvalid(model: UnitModel, channel: Channel, valueRef: VgValueRef | VgValueRef[]): VgEncodeEntry {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n\n if (invalid === 'hide' && valueRef && !isPathMark(mark)) {\n // For non-path marks, we have to exclude invalid values (null and NaN) for scales with continuous domains.\n // For path marks, we will use \"defined\" property and skip these values instead.\n const test = allFieldsInvalidPredicate(model, {invalid: true, channels: SCALE_CHANNELS});\n if (test) {\n return {\n [channel]: [\n // prepend the invalid case\n // TODO: support custom value\n {test, value: null},\n ...array(valueRef)\n ]\n };\n }\n }\n return valueRef ? {[channel]: valueRef} : {};\n}\n\nfunction markDefProperties(mark: MarkDef, ignore: Ignore) {\n return VG_MARK_CONFIGS.reduce((m, prop) => {\n if (!ALWAYS_IGNORE.has(prop) && mark[prop] !== undefined && ignore[prop] !== 'ignore') {\n m[prop] = signalOrValueRef(mark[prop]);\n }\n return m;\n }, {});\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum'});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n","import {POSITION_SCALE_CHANNELS} from '../../../channel';\nimport {ScaleChannel} from '../../../channel';\nimport {Value} from '../../../channeldef';\nimport {hasContinuousDomain} from '../../../scale';\nimport {Dict, keys} from '../../../util';\nimport {VgEncodeEntry} from '../../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../../common';\nimport {UnitModel} from '../../unit';\nimport {fieldInvalidPredicate} from './valueref';\n\nexport function defined(model: UnitModel): VgEncodeEntry {\n const {config, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid) {\n const signal = allFieldsInvalidPredicate(model, {channels: POSITION_SCALE_CHANNELS});\n\n if (signal) {\n return {defined: {signal}};\n }\n }\n return {};\n}\n\nfunction allFieldsInvalidPredicate(\n model: UnitModel,\n {invalid = false, channels}: {invalid?: boolean; channels: ScaleChannel[]}\n) {\n const filterIndex = channels.reduce((aggregator: Dict, channel) => {\n const scaleComponent = model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const field = model.vgField(channel, {expr: 'datum', binSuffix: model.stack?.impute ? 'mid' : undefined});\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n if (field && hasContinuousDomain(scaleType)) {\n aggregator[field] = true;\n }\n }\n return aggregator;\n }, {});\n\n const fields = keys(filterIndex);\n if (fields.length > 0) {\n const op = invalid ? '||' : '&&';\n return fields.map(field => fieldInvalidPredicate(field, invalid)).join(` ${op} `);\n }\n return undefined;\n}\n\nexport function valueIfDefined(prop: string, value: Value): VgEncodeEntry {\n if (value !== undefined) {\n return {[prop]: signalOrValueRef(value)};\n }\n return undefined;\n}\n","import * as log from '../../log';\nimport {isPathMark} from '../../mark';\nimport {tooltip} from '../mark/encode';\nimport {SelectionCompiler} from '.';\n\nconst VORONOI = 'voronoi';\n\nconst nearest: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && selCmpt.nearest;\n },\n\n parse: (model, selCmpt) => {\n // Scope selection events to the voronoi mark to prevent capturing\n // events that occur on the group mark (https://github.com/vega/vega/issues/2112).\n if (selCmpt.events) {\n for (const s of selCmpt.events) {\n s.markname = model.getName(VORONOI);\n }\n }\n },\n\n marks: (model, selCmpt, marks) => {\n const {x, y} = selCmpt.project.hasChannel;\n const markType = model.mark;\n if (isPathMark(markType)) {\n log.warn(log.message.nearestNotSupportForContinuous(markType));\n return marks;\n }\n\n const cellDef = {\n name: model.getName(VORONOI),\n type: 'path',\n interactive: true,\n from: {data: model.getName('marks')},\n encode: {\n update: {\n fill: {value: 'transparent'},\n strokeWidth: {value: 0.35},\n stroke: {value: 'transparent'},\n isVoronoi: {value: true},\n ...tooltip(model, {reactiveGeom: true})\n }\n },\n transform: [\n {\n type: 'voronoi',\n x: {expr: x || !y ? 'datum.datum.x || 0' : '0'},\n y: {expr: y || !x ? 'datum.datum.y || 0' : '0'},\n size: [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')]\n }\n ]\n };\n\n let index = 0;\n let exists = false;\n marks.forEach((mark, i) => {\n const name = mark.name ?? '';\n if (name === model.component.mark[0].name) {\n index = i;\n } else if (name.indexOf(VORONOI) >= 0) {\n exists = true;\n }\n });\n\n if (!exists) {\n marks.splice(index + 1, 0, cellDef);\n }\n\n return marks;\n }\n};\n\nexport default nearest;\n","import {stringValue} from 'vega-util';\nimport {disableDirectManipulation, TUPLE} from '.';\nimport {varName} from '../../util';\nimport {assembleInit} from './assemble';\nimport nearest from './nearest';\nimport {TUPLE_FIELDS} from './project';\nimport {SelectionCompiler} from '.';\nimport {isLegendBinding} from '../../selection';\nimport {NewSignal} from 'vega';\n\nconst inputBindings: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return (\n selCmpt.type === 'point' &&\n selCmpt.resolve === 'global' &&\n selCmpt.bind &&\n selCmpt.bind !== 'scales' &&\n !isLegendBinding(selCmpt.bind)\n );\n },\n\n parse: (model, selCmpt, selDef) => disableDirectManipulation(selCmpt, selDef),\n\n topLevelSignals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const bind = selCmpt.bind;\n const init = selCmpt.init && selCmpt.init[0]; // Can only exist on single selections (one initial value).\n const datum = nearest.defined(selCmpt) ? '(item().isVoronoi ? datum.datum : datum)' : 'datum';\n\n proj.items.forEach((p, i) => {\n const sgname = varName(`${name}_${p.field}`);\n const hasSignal = signals.filter(s => s.name === sgname);\n\n if (!hasSignal.length) {\n signals.unshift({\n name: sgname,\n ...(init ? {init: assembleInit(init[i])} : {value: null}),\n on: selCmpt.events\n ? [\n {\n events: selCmpt.events,\n update: `datum && item().mark.marktype !== 'group' ? ${datum}[${stringValue(p.field)}] : null`\n }\n ]\n : [],\n bind: bind[p.field] ?? bind[p.channel] ?? bind\n });\n }\n });\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const signal: NewSignal = signals.filter(s => s.name === name + TUPLE)[0];\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.map(p => varName(`${name}_${p.field}`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n\n if (values.length) {\n signal.update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n }\n\n delete signal.value;\n delete signal.on;\n\n return signals;\n }\n};\n\nexport default inputBindings;\n","import {TUPLE, unitName} from '.';\nimport {SelectionCompiler} from '.';\n\nexport const TOGGLE = '_toggle';\n\nconst toggle: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n return selCmpt.type === 'point' && !!selCmpt.toggle;\n },\n\n signals: (model, selCmpt, signals) => {\n return signals.concat({\n name: selCmpt.name + TOGGLE,\n value: false,\n on: [{events: selCmpt.events, update: selCmpt.toggle}]\n });\n },\n\n modifyExpr: (model, selCmpt) => {\n const tpl = selCmpt.name + TUPLE;\n const signal = selCmpt.name + TOGGLE;\n\n return (\n `${signal} ? null : ${tpl}, ` +\n (selCmpt.resolve === 'global' ? `${signal} ? null : true, ` : `${signal} ? null : {unit: ${unitName(model)}}, `) +\n `${signal} ? ${tpl} : null`\n );\n }\n};\n\nexport default toggle;\n","import {Update} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {isString} from 'vega-util';\nimport {TUPLE} from '.';\nimport {varName} from '../../util';\nimport inputBindings from './inputs';\nimport toggle, {TOGGLE} from './toggle';\nimport {SelectionCompiler} from '.';\n\nconst clear: SelectionCompiler = {\n defined: selCmpt => {\n return selCmpt.clear !== undefined && selCmpt.clear !== false;\n },\n\n parse: (model, selCmpt) => {\n if (selCmpt.clear) {\n selCmpt.clear = isString(selCmpt.clear) ? parseSelector(selCmpt.clear, 'view') : selCmpt.clear;\n }\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n if (inputBindings.defined(selCmpt)) {\n for (const proj of selCmpt.project.items) {\n const idx = signals.findIndex(n => n.name === varName(`${selCmpt.name}_${proj.field}`));\n if (idx !== -1) {\n signals[idx].on.push({events: selCmpt.clear, update: 'null'});\n }\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n function addClear(idx: number, update: Update) {\n if (idx !== -1 && signals[idx].on) {\n signals[idx].on.push({events: selCmpt.clear, update});\n }\n }\n\n // Be as minimalist as possible when adding clear triggers to minimize dataflow execution.\n if (selCmpt.type === 'interval') {\n for (const proj of selCmpt.project.items) {\n const vIdx = signals.findIndex(n => n.name === proj.signals.visual);\n addClear(vIdx, '[0, 0]');\n\n if (vIdx === -1) {\n const dIdx = signals.findIndex(n => n.name === proj.signals.data);\n addClear(dIdx, 'null');\n }\n }\n } else {\n let tIdx = signals.findIndex(n => n.name === selCmpt.name + TUPLE);\n addClear(tIdx, 'null');\n\n if (toggle.defined(selCmpt)) {\n tIdx = signals.findIndex(n => n.name === selCmpt.name + TOGGLE);\n addClear(tIdx, 'false');\n }\n }\n\n return signals;\n }\n};\n\nexport default clear;\n","import {isObject, MergedStream, NewSignal, Stream} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {array, isString} from 'vega-util';\nimport {disableDirectManipulation, TUPLE} from '.';\nimport {NonPositionScaleChannel} from '../../channel';\nimport * as log from '../../log';\nimport {isLegendBinding, isLegendStreamBinding, SELECTION_ID} from '../../selection';\nimport {duplicate, vals, varName} from '../../util';\nimport {LegendComponent} from '../legend/component';\nimport {UnitModel} from '../unit';\nimport {TUPLE_FIELDS} from './project';\nimport {TOGGLE} from './toggle';\nimport {SelectionCompiler} from '.';\n\nconst legendBindings: SelectionCompiler<'point'> = {\n defined: selCmpt => {\n const spec = selCmpt.resolve === 'global' && selCmpt.bind && isLegendBinding(selCmpt.bind);\n const projLen = selCmpt.project.items.length === 1 && selCmpt.project.items[0].field !== SELECTION_ID;\n if (spec && !projLen) {\n log.warn(log.message.LEGEND_BINDINGS_MUST_HAVE_PROJECTION);\n }\n\n return spec && projLen;\n },\n\n parse: (model, selCmpt, selDef) => {\n // Allow legend items to be toggleable by default even though direct manipulation is disabled.\n const selDef_ = duplicate(selDef);\n selDef_.select = isString(selDef_.select)\n ? {type: selDef_.select, toggle: selCmpt.toggle}\n : {...selDef_.select, toggle: selCmpt.toggle};\n disableDirectManipulation(selCmpt, selDef_);\n\n if (isObject(selDef.select) && (selDef.select.on || selDef.select.clear)) {\n const legendFilter = 'event.item && indexof(event.item.mark.role, \"legend\") < 0';\n for (const evt of selCmpt.events) {\n evt.filter = array(evt.filter ?? []);\n if (!evt.filter.includes(legendFilter)) {\n evt.filter.push(legendFilter);\n }\n }\n }\n\n const evt = isLegendStreamBinding(selCmpt.bind) ? selCmpt.bind.legend : 'click';\n const stream: Stream[] = isString(evt) ? parseSelector(evt, 'view') : array(evt);\n selCmpt.bind = {legend: {merge: stream}};\n },\n\n topLevelSignals: (model, selCmpt, signals) => {\n const selName = selCmpt.name;\n const stream = isLegendStreamBinding(selCmpt.bind) && (selCmpt.bind.legend as MergedStream);\n const markName = (name: string) => (s: Stream) => {\n const ds = duplicate(s);\n ds.markname = name;\n return ds;\n };\n\n for (const proj of selCmpt.project.items) {\n if (!proj.hasLegend) continue;\n const prefix = `${varName(proj.field)}_legend`;\n const sgName = `${selName}_${prefix}`;\n const hasSignal = signals.filter(s => s.name === sgName);\n\n if (hasSignal.length === 0) {\n const events = stream.merge\n .map(markName(`${prefix}_symbols`))\n .concat(stream.merge.map(markName(`${prefix}_labels`)))\n .concat(stream.merge.map(markName(`${prefix}_entries`)));\n\n signals.unshift({\n name: sgName,\n ...(!selCmpt.init ? {value: null} : {}),\n on: [\n // Legend entries do not store values, so we need to walk the scenegraph to the symbol datum.\n {\n events,\n update: 'isDefined(datum.value) ? datum.value : item().items[0].items[0].datum.value',\n force: true\n },\n {events: stream.merge, update: `!event.item || !datum ? null : ${sgName}`, force: true}\n ]\n });\n }\n }\n\n return signals;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const proj = selCmpt.project;\n const tuple: NewSignal = signals.find(s => s.name === name + TUPLE);\n const fields = name + TUPLE_FIELDS;\n const values = proj.items.filter(p => p.hasLegend).map(p => varName(`${name}_${varName(p.field)}_legend`));\n const valid = values.map(v => `${v} !== null`).join(' && ');\n const update = `${valid} ? {fields: ${fields}, values: [${values.join(', ')}]} : null`;\n\n if (selCmpt.events && values.length > 0) {\n tuple.on.push({\n events: values.map(signal => ({signal})),\n update\n });\n } else if (values.length > 0) {\n tuple.update = update;\n delete tuple.value;\n delete tuple.on;\n }\n\n const toggle = signals.find(s => s.name === name + TOGGLE);\n const events = isLegendStreamBinding(selCmpt.bind) && selCmpt.bind.legend;\n if (toggle) {\n if (!selCmpt.events) toggle.on[0].events = events;\n else toggle.on.push({...toggle.on[0], events});\n }\n\n return signals;\n }\n};\n\nexport default legendBindings;\n\nexport function parseInteractiveLegend(\n model: UnitModel,\n channel: NonPositionScaleChannel,\n legendCmpt: LegendComponent\n) {\n const field = model.fieldDef(channel)?.field;\n for (const selCmpt of vals(model.component.selection ?? {})) {\n const proj = selCmpt.project.hasField[field] ?? selCmpt.project.hasChannel[channel];\n if (proj && legendBindings.defined(selCmpt)) {\n const legendSelections = legendCmpt.get('selections') ?? [];\n legendSelections.push(selCmpt.name);\n legendCmpt.set('selections', legendSelections, false);\n proj.hasLegend = true;\n }\n }\n}\n","import {NewSignal} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {SelectionComponent} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {UnitModel} from '../unit';\nimport {BRUSH as INTERVAL_BRUSH} from './interval';\nimport {SelectionProjection} from './project';\nimport scalesCompiler, {domain} from './scales';\nimport {SelectionCompiler} from '.';\n\nconst ANCHOR = '_translate_anchor';\nconst DELTA = '_translate_delta';\n\nconst translate: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.translate;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const anchor = name + ANCHOR;\n const {x, y} = selCmpt.project.hasChannel;\n let events = parseSelector(selCmpt.translate, 'scope');\n\n if (!boundScales) {\n events = events.map(e => ((e.between[0].markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: anchor,\n value: {},\n on: [\n {\n events: events.map(e => e.between[0]),\n update:\n '{x: x(unit), y: y(unit)' +\n (x !== undefined ? `, extent_x: ${boundScales ? domain(model, X) : `slice(${x.signals.visual})`}` : '') +\n (y !== undefined ? `, extent_y: ${boundScales ? domain(model, Y) : `slice(${y.signals.visual})`}` : '') +\n '}'\n }\n ]\n },\n {\n name: name + DELTA,\n value: {},\n on: [\n {\n events,\n update: `{x: ${anchor}.x - x(unit), y: ${anchor}.y - y(unit)}`\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default translate;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const anchor = name + ANCHOR;\n const delta = name + DELTA;\n const channel = proj.channel as ScaleChannel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const reversed = scaleCmpt && scaleCmpt.get('reverse'); // scale parsing sets this flag for fieldDef.sort\n const sign = !boundScales ? '' : channel === X ? (reversed ? '' : '-') : reversed ? '-' : '';\n const extent = `${anchor}.extent_${channel}`;\n const offset = `${sign}${delta}.${channel} / ${boundScales ? `${sizeSg}` : `span(${extent})`}`;\n const panFn =\n !boundScales || !scaleCmpt\n ? 'panLinear'\n : scaleType === 'log'\n ? 'panLog'\n : scaleType === 'symlog'\n ? 'panSymlog'\n : scaleType === 'pow'\n ? 'panPow'\n : 'panLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${panFn}(${extent}, ${offset}${arg})`;\n\n signal.on.push({\n events: {signal: delta},\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {NewSignal} from 'vega';\nimport {parseSelector} from 'vega-event-selector';\nimport {stringValue} from 'vega-util';\nimport {SelectionComponent} from '.';\nimport {ScaleChannel, X, Y} from '../../channel';\nimport {UnitModel} from '../unit';\nimport {BRUSH as INTERVAL_BRUSH} from './interval';\nimport {SelectionProjection} from './project';\nimport {default as scalesCompiler, domain} from './scales';\nimport {SelectionCompiler} from '.';\n\nconst ANCHOR = '_zoom_anchor';\nconst DELTA = '_zoom_delta';\n\nconst zoom: SelectionCompiler<'interval'> = {\n defined: selCmpt => {\n return selCmpt.type === 'interval' && selCmpt.zoom;\n },\n\n signals: (model, selCmpt, signals) => {\n const name = selCmpt.name;\n const boundScales = scalesCompiler.defined(selCmpt);\n const delta = name + DELTA;\n const {x, y} = selCmpt.project.hasChannel;\n const sx = stringValue(model.scaleName(X));\n const sy = stringValue(model.scaleName(Y));\n let events = parseSelector(selCmpt.zoom, 'scope');\n\n if (!boundScales) {\n events = events.map(e => ((e.markname = name + INTERVAL_BRUSH), e));\n }\n\n signals.push(\n {\n name: name + ANCHOR,\n on: [\n {\n events,\n update: !boundScales\n ? `{x: x(unit), y: y(unit)}`\n : '{' +\n [sx ? `x: invert(${sx}, x(unit))` : '', sy ? `y: invert(${sy}, y(unit))` : '']\n .filter(expr => expr)\n .join(', ') +\n '}'\n }\n ]\n },\n {\n name: delta,\n on: [\n {\n events,\n force: true,\n update: 'pow(1.001, event.deltaY * pow(16, event.deltaMode))'\n }\n ]\n }\n );\n\n if (x !== undefined) {\n onDelta(model, selCmpt, x, 'width', signals);\n }\n\n if (y !== undefined) {\n onDelta(model, selCmpt, y, 'height', signals);\n }\n\n return signals;\n }\n};\n\nexport default zoom;\n\nfunction onDelta(\n model: UnitModel,\n selCmpt: SelectionComponent,\n proj: SelectionProjection,\n size: 'width' | 'height',\n signals: NewSignal[]\n) {\n const name = selCmpt.name;\n const channel = proj.channel as ScaleChannel;\n const boundScales = scalesCompiler.defined(selCmpt);\n const signal = signals.filter(s => s.name === proj.signals[boundScales ? 'data' : 'visual'])[0];\n const sizeSg = model.getSizeSignalRef(size).signal;\n const scaleCmpt = model.getScaleComponent(channel);\n const scaleType = scaleCmpt && scaleCmpt.get('type');\n const base = boundScales ? domain(model, channel) : signal.name;\n const delta = name + DELTA;\n const anchor = `${name}${ANCHOR}.${channel}`;\n const zoomFn =\n !boundScales || !scaleCmpt\n ? 'zoomLinear'\n : scaleType === 'log'\n ? 'zoomLog'\n : scaleType === 'symlog'\n ? 'zoomSymlog'\n : scaleType === 'pow'\n ? 'zoomPow'\n : 'zoomLinear';\n const arg = !boundScales\n ? ''\n : scaleType === 'pow'\n ? `, ${scaleCmpt.get('exponent') ?? 1}`\n : scaleType === 'symlog'\n ? `, ${scaleCmpt.get('constant') ?? 1}`\n : '';\n const update = `${zoomFn}(${base}, ${anchor}, ${delta}${arg})`;\n\n signal.on.push({\n events: {signal: delta},\n update: boundScales ? update : `clampRange(${update}, 0, ${sizeSg})`\n });\n}\n","import {Binding, isString, Signal, Stream} from 'vega';\nimport {stringValue} from 'vega-util';\nimport {FACET_CHANNELS} from '../../channel';\nimport {\n BrushConfig,\n LegendBinding,\n SelectionInit,\n SelectionInitInterval,\n SelectionResolution,\n SelectionType\n} from '../../selection';\nimport {Dict, vals} from '../../util';\nimport {OutputNode} from '../data/dataflow';\nimport {FacetModel} from '../facet';\nimport {isFacetModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport interval from './interval';\nimport point from './point';\nimport {SelectionProjection, SelectionProjectionComponent} from './project';\nimport {SelectionParameter} from '../../selection';\nimport clear from './clear';\nimport inputs from './inputs';\nimport nearest from './nearest';\nimport project from './project';\nimport scales from './scales';\nimport legends from './legends';\nimport toggle from './toggle';\nimport translate from './translate';\nimport zoom from './zoom';\nimport {ParameterName} from '../../parameter';\n\nexport const STORE = '_store';\nexport const TUPLE = '_tuple';\nexport const MODIFY = '_modify';\nexport const SELECTION_DOMAIN = '_selection_domain_';\nexport const VL_SELECTION_RESOLVE = 'vlSelectionResolve';\n\nexport interface SelectionComponent {\n name: ParameterName;\n type: T;\n // Use conditional types for stricter type of init (as the type of init depends on selection type).\n init?: (T extends 'interval' ? SelectionInitInterval : T extends 'point' ? SelectionInit : never)[][];\n events: Stream[];\n materialized: OutputNode;\n bind?: 'scales' | Binding | Dict | LegendBinding;\n resolve: SelectionResolution;\n mark?: BrushConfig;\n project: SelectionProjectionComponent;\n scales?: SelectionProjection[];\n toggle?: string;\n translate?: any;\n zoom?: any;\n nearest?: any;\n clear?: any;\n}\n\nexport interface SelectionCompiler {\n defined: (selCmpt: SelectionComponent) => boolean;\n parse?: (model: UnitModel, selCmpt: SelectionComponent, def: SelectionParameter) => void;\n signals?: (model: UnitModel, selCmpt: SelectionComponent, signals: Signal[]) => Signal[];\n topLevelSignals?: (model: Model, selCmpt: SelectionComponent, signals: Signal[]) => Signal[];\n modifyExpr?: (model: UnitModel, selCmpt: SelectionComponent, expr: string) => string;\n marks?: (model: UnitModel, selCmpt: SelectionComponent, marks: any[]) => any[];\n}\n\n// Order matters for parsing and assembly.\nexport const selectionCompilers: SelectionCompiler[] = [\n point,\n interval,\n project,\n toggle,\n\n // Bindings may disable direct manipulation.\n inputs,\n scales,\n legends,\n\n clear,\n translate,\n zoom,\n nearest\n];\n\nfunction getFacetModel(model: Model): FacetModel {\n let parent = model.parent;\n while (parent) {\n if (isFacetModel(parent)) break;\n parent = parent.parent;\n }\n\n return parent as FacetModel;\n}\n\nexport function unitName(model: Model, {escape} = {escape: true}) {\n let name = escape ? stringValue(model.name) : model.name;\n const facetModel = getFacetModel(model);\n if (facetModel) {\n const {facet} = facetModel;\n for (const channel of FACET_CHANNELS) {\n if (facet[channel]) {\n name += ` + '__facet_${channel}_' + (facet[${stringValue(facetModel.vgField(channel))}])`;\n }\n }\n }\n return name;\n}\n\nexport function requiresSelectionId(model: Model) {\n return vals(model.component.selection ?? {}).reduce((identifier, selCmpt) => {\n return identifier || selCmpt.project.hasSelectionId;\n }, false);\n}\n\n// Binding a point selection to query widgets or legends disables default direct manipulation interaction.\n// A user can choose to re-enable it by explicitly specifying triggering input events.\nexport function disableDirectManipulation(selCmpt: SelectionComponent, selDef: SelectionParameter<'point'>) {\n if (isString(selDef.select) || !selDef.select.on) delete selCmpt.events;\n if (isString(selDef.select) || !selDef.select.clear) delete selCmpt.clear;\n if (isString(selDef.select) || !selDef.select.toggle) delete selCmpt.toggle;\n}\n","import {parseExpression} from 'vega-expression';\n\nfunction getName(node: any) {\n const name: string[] = [];\n\n if (node.type === 'Identifier') {\n return [node.name];\n }\n\n if (node.type === 'Literal') {\n return [node.value];\n }\n\n if (node.type === 'MemberExpression') {\n name.push(...getName(node.object));\n name.push(...getName(node.property));\n }\n\n return name;\n}\n\nfunction startsWithDatum(node: any): boolean {\n if (node.object.type === 'MemberExpression') {\n return startsWithDatum(node.object);\n }\n return node.object.name === 'datum';\n}\n\nexport function getDependentFields(expression: string) {\n const ast = parseExpression(expression);\n const dependents = new Set();\n // visit is missing in types https://github.com/vega/vega/issues/3298\n (ast as any).visit((node: any) => {\n if (node.type === 'MemberExpression' && startsWithDatum(node)) {\n dependents.add(getName(node).slice(1).join('.'));\n }\n });\n\n return dependents;\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {LogicalComposition} from '../../logical';\nimport {Predicate} from '../../predicate';\nimport {duplicate} from '../../util';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class FilterNode extends DataFlowNode {\n private expr: string;\n private _dependentFields: Set;\n public clone() {\n return new FilterNode(null, this.model, duplicate(this.filter));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly model: Model,\n private readonly filter: LogicalComposition\n ) {\n super(parent);\n\n // TODO: refactor this to not take a node and\n // then add a static function makeFromOperand and make the constructor take only an expression\n this.expr = expression(this.model, this.filter, this);\n\n this._dependentFields = getDependentFields(this.expr);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public assemble(): VgFilterTransform {\n return {\n type: 'filter',\n expr: this.expr\n };\n }\n\n public hash() {\n return `Filter ${this.expr}`;\n }\n}\n","import {parseSelector} from 'vega-event-selector';\nimport {array, isObject, isString, stringValue} from 'vega-util';\nimport {selectionCompilers, SelectionComponent, STORE} from '.';\nimport {warn} from '../../log';\nimport {BaseSelectionConfig, SelectionParameter, ParameterExtent} from '../../selection';\nimport {Dict, duplicate, entries, replacePathInField, varName} from '../../util';\nimport {DataFlowNode, OutputNode} from '../data/dataflow';\nimport {FilterNode} from '../data/filter';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataSourceType} from '../../data';\nimport {ParameterPredicate} from '../../predicate';\n\nexport function parseUnitSelection(model: UnitModel, selDefs: SelectionParameter[]) {\n const selCmpts: Dict> = {};\n const selectionConfig = model.config.selection;\n\n if (!selDefs || !selDefs.length) return selCmpts;\n\n for (const def of selDefs) {\n const name = varName(def.name);\n const selDef = def.select;\n const type = isString(selDef) ? selDef : selDef.type;\n const defaults: BaseSelectionConfig = isObject(selDef) ? duplicate(selDef) : {type};\n\n // Set default values from config if a property hasn't been specified,\n // or if it is true. E.g., \"translate\": true should use the default\n // event handlers for translate. However, true may be a valid value for\n // a property (e.g., \"nearest\": true).\n const cfg = selectionConfig[type];\n for (const key in cfg) {\n // Project transform applies its defaults.\n if (key === 'fields' || key === 'encodings') {\n continue;\n }\n\n if (key === 'mark') {\n defaults[key] = {...cfg[key], ...defaults[key]};\n }\n\n if (defaults[key] === undefined || defaults[key] === true) {\n defaults[key] = duplicate(cfg[key] ?? defaults[key]);\n }\n }\n\n const selCmpt: SelectionComponent = (selCmpts[name] = {\n ...defaults,\n name,\n type,\n init: def.value,\n bind: def.bind,\n events: isString(defaults.on) ? parseSelector(defaults.on, 'scope') : array(duplicate(defaults.on))\n } as any);\n\n const def_ = duplicate(def); // defensive copy to prevent compilers from causing side effects\n for (const c of selectionCompilers) {\n if (c.defined(selCmpt) && c.parse) {\n c.parse(model, selCmpt, def_);\n }\n }\n }\n\n return selCmpts;\n}\n\nexport function parseSelectionPredicate(\n model: Model,\n pred: ParameterPredicate,\n dfnode?: DataFlowNode,\n datum = 'datum'\n): string {\n const name = isString(pred) ? pred : pred.param;\n const vname = varName(name);\n const store = stringValue(vname + STORE);\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n } catch (e) {\n // If a selection isn't found, treat as a variable parameter and coerce to boolean.\n return `!!${vname}`;\n }\n\n if (selCmpt.project.timeUnit) {\n const child = dfnode ?? model.component.data.raw;\n const tunode = selCmpt.project.timeUnit.clone();\n if (child.parent) {\n tunode.insertAsParentOf(child);\n } else {\n child.parent = tunode;\n }\n }\n\n const fn = selCmpt.project.hasSelectionId ? 'vlSelectionIdTest(' : 'vlSelectionTest(';\n const resolve = selCmpt.resolve === 'global' ? ')' : `, ${stringValue(selCmpt.resolve)})`;\n const test = `${fn}${store}, ${datum}${resolve}`;\n const length = `length(data(${store}))`;\n\n return pred.empty === false ? `${length} && ${test}` : `!${length} || ${test}`;\n}\n\nexport function parseSelectionExtent(model: Model, name: string, extent: ParameterExtent) {\n const vname = varName(name);\n const encoding = extent['encoding'];\n let field = extent['field'];\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(vname, name);\n } catch (e) {\n // If a selection isn't found, treat it as a variable parameter.\n return vname;\n }\n\n if (!encoding && !field) {\n field = selCmpt.project.items[0].field;\n if (selCmpt.project.items.length > 1) {\n warn(\n 'A \"field\" or \"encoding\" must be specified when using a selection as a scale domain. ' +\n `Using \"field\": ${stringValue(field)}.`\n );\n }\n } else if (encoding && !field) {\n const encodings = selCmpt.project.items.filter(p => p.channel === encoding);\n if (!encodings.length || encodings.length > 1) {\n field = selCmpt.project.items[0].field;\n warn(\n (!encodings.length ? 'No ' : 'Multiple ') +\n `matching ${stringValue(encoding)} encoding found for selection ${stringValue(extent.param)}. ` +\n `Using \"field\": ${stringValue(field)}.`\n );\n } else {\n field = encodings[0].field;\n }\n }\n\n return `${selCmpt.name}[${stringValue(replacePathInField(field))}]`;\n}\n\nexport function materializeSelections(model: UnitModel, main: OutputNode) {\n for (const [selection, selCmpt] of entries(model.component.selection ?? {})) {\n const lookupName = model.getName(`lookup_${selection}`);\n model.component.data.outputNodes[lookupName] = selCmpt.materialized = new OutputNode(\n new FilterNode(main, model, {param: selection}),\n lookupName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n }\n}\n","import {isString} from 'vega-util';\nimport {LogicalComposition} from '../logical';\nimport {fieldFilterExpression, isSelectionPredicate, Predicate} from '../predicate';\nimport {logicalExpr} from '../util';\nimport {DataFlowNode} from './data/dataflow';\nimport {Model} from './model';\nimport {parseSelectionPredicate} from './selection/parse';\n\n/**\n * Converts a predicate into an expression.\n */\n// model is only used for selection filters.\nexport function expression(model: Model, filterOp: LogicalComposition, node?: DataFlowNode): string {\n return logicalExpr(filterOp, (predicate: Predicate) => {\n if (isString(predicate)) {\n return predicate;\n } else if (isSelectionPredicate(predicate)) {\n return parseSelectionPredicate(model, predicate, node);\n } else {\n // Filter Object\n return fieldFilterExpression(predicate);\n }\n });\n}\n","import {Axis as VgAxis, AxisEncode, NewSignal, SignalRef, Text} from 'vega';\nimport {array, isArray} from 'vega-util';\nimport {AXIS_PARTS, AXIS_PROPERTY_TYPE, CONDITIONAL_AXIS_PROP_INDEX, isConditionalAxisValue} from '../../axis';\nimport {POSITION_SCALE_CHANNELS} from '../../channel';\nimport {defaultTitle, FieldDefBase} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isText} from '../../title';\nimport {contains, getFirstDefined, isEmpty, replaceAll} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {exprFromValueRefOrSignalRef} from '../common';\nimport {Model} from '../model';\nimport {expression} from '../predicate';\nimport {AxisComponent, AxisComponentIndex} from './component';\n\nfunction assembleTitle(title: Text | FieldDefBase[] | SignalRef, config: Config): Text | SignalRef {\n if (!title) {\n return undefined;\n }\n if (isArray(title) && !isText(title)) {\n return title.map(fieldDef => defaultTitle(fieldDef, config)).join(', ');\n }\n return title;\n}\n\nfunction setAxisEncode(\n axis: Omit,\n part: keyof AxisEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | readonly VgValueRef[]\n) {\n axis.encode ??= {};\n axis.encode[part] ??= {};\n axis.encode[part].update ??= {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (axis.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleAxis(\n axisCmpt: AxisComponent,\n kind: 'main' | 'grid',\n config: Config,\n opt: {\n header: boolean; // whether this is called via a header\n } = {header: false}\n): VgAxis {\n const {disable, orient, scale, labelExpr, title, zindex, ...axis} = axisCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n for (const prop in axis) {\n const propType = AXIS_PROPERTY_TYPE[prop];\n const propValue = axis[prop];\n\n if (propType && propType !== kind && propType !== 'both') {\n // Remove properties that are not valid for this kind of axis\n delete axis[prop];\n } else if (isConditionalAxisValue(propValue)) {\n // deal with conditional axis value\n\n const {condition, ...valueOrSignalRef} = propValue;\n const conditions = array(condition);\n\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n // If there is a corresponding Vega property for the channel,\n // use Vega's custom axis encoding and delete the original axis property to avoid conflicts\n\n const vgRef = [\n ...conditions.map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return {\n test: expression(null, test),\n ...valueOrSignalCRef\n };\n }),\n valueOrSignalRef\n ];\n setAxisEncode(axis, part, vgProp, vgRef);\n delete axis[prop];\n } else if (propIndex === null) {\n // If propIndex is null, this means we support conditional axis property by converting the condition to signal instead.\n const signalRef: SignalRef = {\n signal:\n conditions\n .map(c => {\n const {test, ...valueOrSignalCRef} = c;\n return `${expression(null, test)} ? ${exprFromValueRefOrSignalRef(valueOrSignalCRef)} : `;\n })\n .join('') + exprFromValueRefOrSignalRef(valueOrSignalRef)\n };\n axis[prop] = signalRef;\n }\n } else if (isSignalRef(propValue)) {\n const propIndex = CONDITIONAL_AXIS_PROP_INDEX[prop];\n if (propIndex) {\n const {vgProp, part} = propIndex;\n setAxisEncode(axis, part, vgProp, propValue);\n delete axis[prop];\n } // else do nothing since the property already supports signal\n }\n\n // Do not pass labelAlign/Baseline = null to Vega since it won't pass the schema\n // Note that we need to use null so the default labelAlign is preserved.\n if (contains(['labelAlign', 'labelBaseline'], prop) && axis[prop] === null) {\n delete axis[prop];\n }\n }\n\n if (kind === 'grid') {\n if (!axis.grid) {\n return undefined;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n // Only need to keep encode block for grid\n const {grid} = axis.encode;\n axis.encode = {\n ...(grid ? {grid} : {})\n };\n\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n return {\n scale,\n orient,\n ...axis,\n domain: false,\n labels: false,\n aria: false, // always hide grid axis\n\n // Always set min/maxExtent to 0 to ensure that `config.axis*.minExtent` and `config.axis*.maxExtent`\n // would not affect gridAxis\n maxExtent: 0,\n minExtent: 0,\n ticks: false,\n zindex: getFirstDefined(zindex, 0) // put grid behind marks by default\n };\n } else {\n // kind === 'main'\n\n if (!opt.header && axisCmpt.mainExtracted) {\n // if mainExtracted has been extracted to a separate facet\n return undefined;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (axis.encode?.labels?.update && isSignalRef(axis.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', axis.encode.labels.update.text.signal);\n }\n setAxisEncode(axis, 'labels', 'text', {signal: expr});\n }\n\n if (axis.labelAlign === null) {\n delete axis.labelAlign;\n }\n\n // Remove unnecessary encode block\n if (axis.encode) {\n for (const part of AXIS_PARTS) {\n if (!axisCmpt.hasAxisPart(part)) {\n delete axis.encode[part];\n }\n }\n if (isEmpty(axis.encode)) {\n delete axis.encode;\n }\n }\n\n const titleString = assembleTitle(title, config);\n\n return {\n scale,\n orient,\n grid: false,\n ...(titleString ? {title: titleString} : {}),\n ...axis,\n ...(config.aria === false ? {aria: false} : {}),\n zindex: getFirstDefined(zindex, 0) // put axis line above marks by default\n };\n }\n}\n\n/**\n * Add axis signals so grid line works correctly\n * (Fix https://github.com/vega/vega-lite/issues/4226)\n */\nexport function assembleAxisSignals(model: Model): NewSignal[] {\n const {axes} = model.component;\n const signals: NewSignal[] = [];\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n if (axes[channel]) {\n for (const axis of axes[channel]) {\n if (!axis.get('disable') && !axis.get('gridScale')) {\n // If there is x-axis but no y-scale for gridScale, need to set height/width so x-axis can draw the grid with the right height. Same for y-axis and width.\n\n const sizeType = channel === 'x' ? 'height' : 'width';\n const update = model.getSizeSignalRef(sizeType).signal;\n\n if (sizeType !== update) {\n signals.push({\n name: sizeType,\n update\n });\n }\n }\n }\n }\n }\n return signals;\n}\n\nexport function assembleAxes(axisComponents: AxisComponentIndex, config: Config): VgAxis[] {\n const {x = [], y = []} = axisComponents;\n return [\n ...x.map(a => assembleAxis(a, 'grid', config)),\n ...y.map(a => assembleAxis(a, 'grid', config)),\n ...x.map(a => assembleAxis(a, 'main', config)),\n ...y.map(a => assembleAxis(a, 'main', config))\n ].filter(a => a); // filter undefined\n}\n","import {ScaleType, SignalRef} from 'vega';\nimport {array} from 'vega-util';\nimport {AxisConfig} from '../../axis';\nimport {PositionScaleChannel} from '../../channel';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {isQuantitative} from '../../scale';\nimport {keys, titleCase} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {getStyleConfig, signalOrStringValue} from '../common';\n\nfunction getAxisConfigFromConfigTypes(\n configTypes: string[],\n config: Config,\n channel: 'x' | 'y',\n orient: string | SignalRef\n) {\n // TODO: add special casing to add conditional value based on orient signal\n return Object.assign.apply(null, [\n {},\n ...configTypes.map(configType => {\n if (configType === 'axisOrient') {\n const orient1 = channel === 'x' ? 'bottom' : 'left';\n const orientConfig1 = config[channel === 'x' ? 'axisBottom' : 'axisLeft'] || {};\n const orientConfig2 = config[channel === 'x' ? 'axisTop' : 'axisRight'] || {};\n\n const props = new Set([...keys(orientConfig1), ...keys(orientConfig2)]);\n\n const conditionalOrientAxisConfig = {};\n for (const prop of props.values()) {\n conditionalOrientAxisConfig[prop] = {\n // orient is surely signal in this case\n signal: `${orient['signal']} === \"${orient1}\" ? ${signalOrStringValue(\n orientConfig1[prop]\n )} : ${signalOrStringValue(orientConfig2[prop])}`\n };\n }\n\n return conditionalOrientAxisConfig;\n }\n\n return config[configType];\n })\n ]);\n}\n\nexport type AxisConfigs = ReturnType;\n\nexport function getAxisConfigs(\n channel: PositionScaleChannel,\n scaleType: ScaleType,\n orient: string | SignalRef,\n config: Config\n) {\n const typeBasedConfigTypes =\n scaleType === 'band'\n ? ['axisDiscrete', 'axisBand']\n : scaleType === 'point'\n ? ['axisDiscrete', 'axisPoint']\n : isQuantitative(scaleType)\n ? ['axisQuantitative']\n : scaleType === 'time' || scaleType === 'utc'\n ? ['axisTemporal']\n : [];\n\n const axisChannel = channel === 'x' ? 'axisX' : 'axisY';\n const axisOrient = isSignalRef(orient) ? 'axisOrient' : `axis${titleCase(orient)}`; // axisTop, axisBottom, ...\n\n const vlOnlyConfigTypes = [\n // technically Vega does have axisBand, but if we make another separation here,\n // it will further introduce complexity in the code\n ...typeBasedConfigTypes,\n ...typeBasedConfigTypes.map(c => axisChannel + c.substr(4))\n ];\n\n const vgConfigTypes = ['axis', axisOrient, axisChannel];\n\n return {\n vlOnlyAxisConfig: getAxisConfigFromConfigTypes(vlOnlyConfigTypes, config, channel, orient),\n vgAxisConfig: getAxisConfigFromConfigTypes(vgConfigTypes, config, channel, orient),\n axisConfigStyle: getAxisConfigStyle([...vgConfigTypes, ...vlOnlyConfigTypes], config)\n };\n}\n\nexport function getAxisConfigStyle(axisConfigTypes: string[], config: Config) {\n const toMerge = [{}];\n for (const configType of axisConfigTypes) {\n // TODO: add special casing to add conditional value based on orient signal\n let style = config[configType]?.style;\n if (style) {\n style = array(style);\n for (const s of style) {\n toMerge.push(config.style[s]);\n }\n }\n }\n return Object.assign.apply(null, toMerge);\n}\nexport function getAxisConfig(\n property: keyof AxisConfig,\n styleConfigIndex: StyleConfigIndex,\n style: string | string[],\n axisConfigs: Partial = {}\n): {configFrom?: string; configValue?: any} {\n const styleConfig = getStyleConfig(property, style, styleConfigIndex);\n\n if (styleConfig !== undefined) {\n return {\n configFrom: 'style',\n configValue: styleConfig\n };\n }\n\n for (const configFrom of ['vlOnlyAxisConfig', 'vgAxisConfig', 'axisConfigStyle']) {\n if (axisConfigs[configFrom]?.[property] !== undefined) {\n return {configFrom, configValue: axisConfigs[configFrom][property]};\n }\n }\n return {};\n}\n","import {Align, AxisOrient, Orient, SignalRef} from 'vega';\nimport {isArray, isObject} from 'vega-util';\nimport {AxisInternal} from '../../axis';\nimport {isBinned, isBinning} from '../../bin';\nimport {PositionScaleChannel, X} from '../../channel';\nimport {\n DatumDef,\n isDiscrete,\n isFieldDef,\n PositionDatumDef,\n PositionFieldDef,\n toFieldDefBase,\n TypedFieldDef,\n valueArray\n} from '../../channeldef';\nimport {Config, StyleConfigIndex} from '../../config';\nimport {Mark} from '../../mark';\nimport {hasDiscreteDomain} from '../../scale';\nimport {Sort} from '../../sort';\nimport {durationExpr, normalizeTimeUnit} from '../../timeunit';\nimport {NOMINAL, ORDINAL, Type} from '../../type';\nimport {contains, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitle, mergeTitleFieldDefs} from '../common';\nimport {guideFormatType} from '../format';\nimport {UnitModel} from '../unit';\nimport {ScaleType} from './../../scale';\nimport {AxisComponentProps} from './component';\nimport {AxisConfigs, getAxisConfig} from './config';\n\nexport interface AxisRuleParams {\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef;\n axis: AxisInternal;\n channel: PositionScaleChannel;\n model: UnitModel;\n\n mark: Mark;\n scaleType: ScaleType;\n orient: Orient | SignalRef;\n labelAngle: number | SignalRef;\n format: string | SignalRef;\n formatType: ReturnType;\n config: Config;\n}\n\nexport const axisRules: {\n [k in keyof AxisComponentProps]?: (params: AxisRuleParams) => AxisComponentProps[k];\n} = {\n scale: ({model, channel}) => model.scaleName(channel),\n\n format: ({format}) => format, // we already calculate this in parse\n\n formatType: ({formatType}) => formatType, // we already calculate this in parse\n\n grid: ({fieldOrDatumDef, axis, scaleType}) => axis.grid ?? defaultGrid(scaleType, fieldOrDatumDef),\n\n gridScale: ({model, channel}) => gridScale(model, channel),\n\n labelAlign: ({axis, labelAngle, orient, channel}) =>\n axis.labelAlign || defaultLabelAlign(labelAngle, orient, channel),\n\n labelAngle: ({labelAngle}) => labelAngle, // we already calculate this in parse\n\n labelBaseline: ({axis, labelAngle, orient, channel}) =>\n axis.labelBaseline || defaultLabelBaseline(labelAngle, orient, channel),\n\n labelFlush: ({axis, fieldOrDatumDef, channel}) => axis.labelFlush ?? defaultLabelFlush(fieldOrDatumDef.type, channel),\n\n labelOverlap: ({axis, fieldOrDatumDef, scaleType}) =>\n axis.labelOverlap ??\n defaultLabelOverlap(\n fieldOrDatumDef.type,\n scaleType,\n isFieldDef(fieldOrDatumDef) && !!fieldOrDatumDef.timeUnit,\n isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined\n ),\n\n // we already calculate orient in parse\n orient: ({orient}) => orient as AxisOrient, // Need to cast until Vega supports signal\n\n tickCount: ({channel, model, axis, fieldOrDatumDef, scaleType}) => {\n const sizeType = channel === 'x' ? 'width' : channel === 'y' ? 'height' : undefined;\n const size = sizeType ? model.getSizeSignalRef(sizeType) : undefined;\n return axis.tickCount ?? defaultTickCount({fieldOrDatumDef, scaleType, size, values: axis.values});\n },\n\n tickMinStep: ({axis, format, fieldOrDatumDef}) => axis.tickMinStep ?? defaultTickMinStep({format, fieldOrDatumDef}),\n\n title: ({axis, model, channel}) => {\n if (axis.title !== undefined) {\n return axis.title;\n }\n const fieldDefTitle = getFieldDefTitle(model, channel);\n if (fieldDefTitle !== undefined) {\n return fieldDefTitle;\n }\n const fieldDef = model.typedFieldDef(channel);\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef2 = model.fieldDef(channel2);\n\n // If title not specified, store base parts of fieldDef (and fieldDef2 if exists)\n return mergeTitleFieldDefs(\n fieldDef ? [toFieldDefBase(fieldDef)] : [],\n isFieldDef(fieldDef2) ? [toFieldDefBase(fieldDef2)] : []\n );\n },\n\n values: ({axis, fieldOrDatumDef}) => values(axis, fieldOrDatumDef),\n\n zindex: ({axis, fieldOrDatumDef, mark}) => axis.zindex ?? defaultZindex(mark, fieldOrDatumDef)\n};\n\n// TODO: we need to refactor this method after we take care of config refactoring\n/**\n * Default rules for whether to show a grid should be shown for a channel.\n * If `grid` is unspecified, the default value is `true` for ordinal scales that are not binned\n */\n\nexport function defaultGrid(scaleType: ScaleType, fieldDef: TypedFieldDef | DatumDef) {\n return !hasDiscreteDomain(scaleType) && isFieldDef(fieldDef) && !isBinning(fieldDef?.bin) && !isBinned(fieldDef?.bin);\n}\n\nexport function gridScale(model: UnitModel, channel: PositionScaleChannel) {\n const gridChannel: PositionScaleChannel = channel === 'x' ? 'y' : 'x';\n if (model.getScaleComponent(gridChannel)) {\n return model.scaleName(gridChannel);\n }\n return undefined;\n}\n\nexport function getLabelAngle(\n fieldOrDatumDef: PositionFieldDef | PositionDatumDef,\n axis: AxisInternal,\n channel: PositionScaleChannel,\n styleConfig: StyleConfigIndex,\n axisConfigs?: AxisConfigs\n) {\n const labelAngle = axis?.labelAngle;\n // try axis value\n if (labelAngle !== undefined) {\n return isSignalRef(labelAngle) ? labelAngle : normalizeAngle(labelAngle);\n } else {\n // try axis config value\n const {configValue: angle} = getAxisConfig('labelAngle', styleConfig, axis?.style, axisConfigs);\n if (angle !== undefined) {\n return normalizeAngle(angle);\n } else {\n // get default value\n if (\n channel === X &&\n contains([NOMINAL, ORDINAL], fieldOrDatumDef.type) &&\n !(isFieldDef(fieldOrDatumDef) && fieldOrDatumDef.timeUnit)\n ) {\n return 270;\n }\n // no default\n return undefined;\n }\n }\n}\n\nexport function normalizeAngleExpr(angle: SignalRef) {\n return `(((${angle.signal} % 360) + 360) % 360)`;\n}\n\nexport function defaultLabelBaseline(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y',\n alwaysIncludeMiddle?: boolean\n) {\n if (angle !== undefined) {\n if (channel === 'x') {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsTop = isSignalRef(orient) ? `(${orient.signal} === \"top\")` : orient === 'top';\n return {\n signal:\n `(45 < ${a} && ${a} < 135) || (225 < ${a} && ${a} < 315) ? \"middle\" :` +\n `(${a} <= 45 || 315 <= ${a}) === ${orientIsTop} ? \"bottom\" : \"top\"`\n };\n }\n\n if ((45 < angle && angle < 135) || (225 < angle && angle < 315)) {\n return 'middle';\n }\n\n if (isSignalRef(orient)) {\n const op = angle <= 45 || 315 <= angle ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"top\" ? \"bottom\" : \"top\"`};\n }\n\n return (angle <= 45 || 315 <= angle) === (orient === 'top') ? 'bottom' : 'top';\n } else {\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsLeft = isSignalRef(orient) ? `(${orient.signal} === \"left\")` : orient === 'left';\n const middle = alwaysIncludeMiddle ? '\"middle\"' : 'null';\n return {\n signal: `${a} <= 45 || 315 <= ${a} || (135 <= ${a} && ${a} <= 225) ? ${middle} : (45 <= ${a} && ${a} <= 135) === ${orientIsLeft} ? \"top\" : \"bottom\"`\n };\n }\n\n if (angle <= 45 || 315 <= angle || (135 <= angle && angle <= 225)) {\n return alwaysIncludeMiddle ? 'middle' : null;\n }\n\n if (isSignalRef(orient)) {\n const op = 45 <= angle && angle <= 135 ? '===' : '!==';\n return {signal: `${orient.signal} ${op} \"left\" ? \"top\" : \"bottom\"`};\n }\n\n return (45 <= angle && angle <= 135) === (orient === 'left') ? 'top' : 'bottom';\n }\n }\n return undefined;\n}\n\nexport function defaultLabelAlign(\n angle: number | SignalRef,\n orient: AxisOrient | SignalRef,\n channel: 'x' | 'y'\n): Align | SignalRef {\n if (angle === undefined) {\n return undefined;\n }\n\n const isX = channel === 'x';\n const startAngle = isX ? 0 : 90;\n const mainOrient = isX ? 'bottom' : 'left';\n\n if (isSignalRef(angle)) {\n const a = normalizeAngleExpr(angle);\n const orientIsMain = isSignalRef(orient) ? `(${orient.signal} === \"${mainOrient}\")` : orient === mainOrient;\n return {\n signal:\n `(${startAngle ? `(${a} + 90)` : a} % 180 === 0) ? ${isX ? null : '\"center\"'} :` +\n `(${startAngle} < ${a} && ${a} < ${180 + startAngle}) === ${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((angle + startAngle) % 180 === 0) {\n // For bottom, use default label align so label flush still works\n return isX ? null : 'center';\n }\n\n if (isSignalRef(orient)) {\n const op = startAngle < angle && angle < 180 + startAngle ? '===' : '!==';\n const orientIsMain = `${orient.signal} ${op} \"${mainOrient}\"`;\n return {\n signal: `${orientIsMain} ? \"left\" : \"right\"`\n };\n }\n\n if ((startAngle < angle && angle < 180 + startAngle) === (orient === mainOrient)) {\n return 'left';\n }\n\n return 'right';\n}\n\nexport function defaultLabelFlush(type: Type, channel: PositionScaleChannel) {\n if (channel === 'x' && contains(['quantitative', 'temporal'], type)) {\n return true;\n }\n return undefined;\n}\n\nexport function defaultLabelOverlap(type: Type, scaleType: ScaleType, hasTimeUnit: boolean, sort?: Sort) {\n // do not prevent overlap for nominal data because there is no way to infer what the missing labels are\n if ((hasTimeUnit && !isObject(sort)) || (type !== 'nominal' && type !== 'ordinal')) {\n if (scaleType === 'log' || scaleType === 'symlog') {\n return 'greedy';\n }\n return true;\n }\n return undefined;\n}\n\nexport function defaultOrient(channel: PositionScaleChannel) {\n return channel === 'x' ? 'bottom' : 'left';\n}\n\nexport function defaultTickCount({\n fieldOrDatumDef,\n scaleType,\n size,\n values: vals\n}: {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n scaleType: ScaleType;\n size?: SignalRef;\n values?: AxisInternal['values'];\n}) {\n if (!vals && !hasDiscreteDomain(scaleType) && scaleType !== 'log') {\n if (isFieldDef(fieldOrDatumDef)) {\n if (isBinning(fieldOrDatumDef.bin)) {\n // for binned data, we don't want more ticks than maxbins\n return {signal: `ceil(${size.signal}/10)`};\n }\n\n if (\n fieldOrDatumDef.timeUnit &&\n contains(['month', 'hours', 'day', 'quarter'], normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit)\n ) {\n return undefined;\n }\n }\n\n return {signal: `ceil(${size.signal}/40)`};\n }\n\n return undefined;\n}\n\nexport function defaultTickMinStep({format, fieldOrDatumDef}: Pick) {\n if (format === 'd') {\n return 1;\n }\n\n if (isFieldDef(fieldOrDatumDef)) {\n const {timeUnit} = fieldOrDatumDef;\n if (timeUnit) {\n const signal = durationExpr(timeUnit);\n if (signal) {\n return {signal};\n }\n }\n }\n return undefined;\n}\n\nexport function getFieldDefTitle(model: UnitModel, channel: 'x' | 'y') {\n const channel2 = channel === 'x' ? 'x2' : 'y2';\n const fieldDef = model.fieldDef(channel);\n const fieldDef2 = model.fieldDef(channel2);\n\n const title1 = fieldDef ? fieldDef.title : undefined;\n const title2 = fieldDef2 ? fieldDef2.title : undefined;\n\n if (title1 && title2) {\n return mergeTitle(title1, title2);\n } else if (title1) {\n return title1;\n } else if (title2) {\n return title2;\n } else if (title1 !== undefined) {\n // falsy value to disable config\n return title1;\n } else if (title2 !== undefined) {\n // falsy value to disable config\n return title2;\n }\n\n return undefined;\n}\n\nexport function values(axis: AxisInternal, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = axis.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n\n return undefined;\n}\n\nexport function defaultZindex(mark: Mark, fieldDef: TypedFieldDef | DatumDef) {\n if (mark === 'rect' && isDiscrete(fieldDef)) {\n return 1;\n }\n return 0;\n}\n","import {FormulaTransform as VgFormulaTransform} from 'vega';\nimport {SingleDefChannel} from '../../channel';\nimport {FieldRefOption, isScaleFieldDef, TypedFieldDef, vgField} from '../../channeldef';\nimport {DateTime} from '../../datetime';\nimport {fieldFilterExpression} from '../../predicate';\nimport {isSortArray} from '../../sort';\nimport {CalculateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {ModelWithField} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {getDependentFields} from './expressions';\n\nexport class CalculateNode extends DataFlowNode {\n private _dependentFields: Set;\n\n public clone() {\n return new CalculateNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: CalculateTransform\n ) {\n super(parent);\n\n this._dependentFields = getDependentFields(this.transform.calculate);\n }\n\n public static parseAllForSortIndex(parent: DataFlowNode, model: ModelWithField) {\n // get all the encoding with sort fields from model\n model.forEachFieldDef((fieldDef: TypedFieldDef, channel: SingleDefChannel) => {\n if (!isScaleFieldDef(fieldDef)) {\n return;\n }\n if (isSortArray(fieldDef.sort)) {\n const {field, timeUnit} = fieldDef;\n const sort: (number | string | boolean | DateTime)[] = fieldDef.sort;\n // generate `datum[\"a\"] === val0 ? 0 : datum[\"a\"] === val1 ? 1 : ... : n` via FieldEqualPredicate\n const calculate =\n sort\n .map((sortValue, i) => {\n return `${fieldFilterExpression({field, timeUnit, equal: sortValue})} ? ${i} : `;\n })\n .join('') + sort.length;\n\n parent = new CalculateNode(parent, {\n calculate,\n as: sortArrayIndexField(fieldDef, channel, {forAs: true})\n });\n }\n });\n return parent;\n }\n\n public producedFields() {\n return new Set([this.transform.as]);\n }\n\n public dependentFields() {\n return this._dependentFields;\n }\n\n public assemble(): VgFormulaTransform {\n return {\n type: 'formula',\n expr: this.transform.calculate,\n as: this.transform.as\n };\n }\n\n public hash() {\n return `Calculate ${hash(this.transform)}`;\n }\n}\n\nexport function sortArrayIndexField(fieldDef: TypedFieldDef, channel: SingleDefChannel, opt?: FieldRefOption) {\n return vgField(fieldDef, {prefix: channel, suffix: 'sort_index', ...(opt ?? {})});\n}\n","import {Orient, SignalRef} from 'vega';\nimport {FacetChannel} from '../../channel';\nimport {Config} from '../../config';\nimport {Header} from '../../header';\nimport {contains, getFirstDefined} from '../../util';\nimport {HeaderChannel} from './component';\n\n/**\n * Get header channel, which can be different from facet channel when orient is specified or when the facet channel is facet.\n */\nexport function getHeaderChannel(channel: FacetChannel, orient: Orient): HeaderChannel {\n if (contains(['top', 'bottom'], orient)) {\n return 'column';\n } else if (contains(['left', 'right'], orient)) {\n return 'row';\n }\n return channel === 'row' ? 'row' : 'column';\n}\n\nexport function getHeaderProperty

>(\n prop: P,\n header: Header,\n config: Config,\n channel: FacetChannel\n): Header[P] {\n const headerSpecificConfig =\n channel === 'row' ? config.headerRow : channel === 'column' ? config.headerColumn : config.headerFacet;\n\n return getFirstDefined((header || {})[prop], headerSpecificConfig[prop], config.header[prop]);\n}\n\nexport function getHeaderProperties(\n properties: (keyof Header)[],\n header: Header,\n config: Config,\n channel: FacetChannel\n): Header {\n const props = {};\n for (const prop of properties) {\n const value = getHeaderProperty(prop, header || {}, config, channel);\n if (value !== undefined) {\n props[prop] = value;\n }\n }\n return props;\n}\n","/**\n * Utility for generating row / column headers\n */\nimport {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {FacetFieldDef} from '../../spec/facet';\n\nexport type HeaderChannel = 'row' | 'column';\nexport const HEADER_CHANNELS: HeaderChannel[] = ['row', 'column'];\n\nexport type HeaderType = 'header' | 'footer';\nexport const HEADER_TYPES: HeaderType[] = ['header', 'footer'];\n\nexport interface LayoutHeaderComponentIndex {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n}\n\n/**\n * A component that represents all header, footers and title of a Vega group with layout directive.\n */\nexport interface LayoutHeaderComponent {\n title?: Text | SignalRef;\n\n // TODO: concat can have multiple header / footer.\n // Need to redesign this part a bit.\n\n facetFieldDef?: FacetFieldDef;\n\n /**\n * An array of header components for headers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n header?: HeaderComponent[];\n\n /**\n * An array of header components for footers.\n * For facet, there should be only one header component, which is data-driven.\n * For concat, there can be multiple header components that explicitly list different axes.\n */\n footer?: HeaderComponent[];\n}\n\n/**\n * A component that represents one group of row/column-header/footer.\n */\nexport interface HeaderComponent {\n labels: boolean;\n\n sizeSignal: {signal: string};\n\n axes: VgAxis[];\n}\n","/**\n * Utility for generating row / column headers\n */\n\nimport {SignalRef, TitleAnchor, TitleConfig} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {\n CoreHeader,\n HEADER_LABEL_PROPERTIES,\n HEADER_LABEL_PROPERTIES_MAP,\n HEADER_TITLE_PROPERTIES,\n HEADER_TITLE_PROPERTIES_MAP\n} from '../../header';\nimport {isSortField} from '../../sort';\nimport {FacetFieldDef, isFacetMapping} from '../../spec/facet';\nimport {contains, isEmpty, normalizeAngle, replaceAll} from '../../util';\nimport {RowCol, VgComparator, VgMarkGroup, VgTitle} from '../../vega.schema';\nimport {defaultLabelAlign, defaultLabelBaseline} from '../axis/properties';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {formatSignalRef} from '../format';\nimport {isFacetModel, Model} from '../model';\nimport {getHeaderChannel, getHeaderProperties, getHeaderProperty} from './common';\nimport {\n HeaderChannel,\n HeaderComponent,\n HeaderType,\n HEADER_TYPES,\n LayoutHeaderComponent,\n LayoutHeaderComponentIndex\n} from './component';\n\n// TODO: rename to assembleHeaderTitleGroup\nexport function assembleTitleGroup(model: Model, channel: FacetChannel) {\n const title = model.component.layoutHeaders[channel].title;\n const config = model.config ? model.config : undefined;\n const facetFieldDef = model.component.layoutHeaders[channel].facetFieldDef\n ? model.component.layoutHeaders[channel].facetFieldDef\n : undefined;\n\n const {\n titleAnchor,\n titleAngle: ta,\n titleOrient\n } = getHeaderProperties(['titleAnchor', 'titleAngle', 'titleOrient'], facetFieldDef.header, config, channel);\n const headerChannel = getHeaderChannel(channel, titleOrient);\n\n const titleAngle = normalizeAngle(ta);\n\n return {\n name: `${channel}-title`,\n type: 'group',\n role: `${headerChannel}-title`,\n title: {\n text: title,\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-title',\n ...defaultHeaderGuideBaseline(titleAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, titleAngle, titleAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_TITLE_PROPERTIES, HEADER_TITLE_PROPERTIES_MAP)\n }\n };\n}\n\nexport function defaultHeaderGuideAlign(headerChannel: HeaderChannel, angle: number, anchor: TitleAnchor = 'middle') {\n switch (anchor) {\n case 'start':\n return {align: 'left'};\n case 'end':\n return {align: 'right'};\n }\n\n const align = defaultLabelAlign(angle, headerChannel === 'row' ? 'left' : 'top', headerChannel === 'row' ? 'y' : 'x');\n return align ? {align} : {};\n}\n\nexport function defaultHeaderGuideBaseline(angle: number, channel: FacetChannel) {\n const baseline = defaultLabelBaseline(angle, channel === 'row' ? 'left' : 'top', channel === 'row' ? 'y' : 'x', true);\n return baseline ? {baseline} : {};\n}\n\nexport function assembleHeaderGroups(model: Model, channel: HeaderChannel): VgMarkGroup[] {\n const layoutHeader = model.component.layoutHeaders[channel];\n const groups = [];\n for (const headerType of HEADER_TYPES) {\n if (layoutHeader[headerType]) {\n for (const headerComponent of layoutHeader[headerType]) {\n const group = assembleHeaderGroup(model, channel, headerType, layoutHeader, headerComponent);\n if (group != null) {\n groups.push(group);\n }\n }\n }\n }\n return groups;\n}\n\nfunction getSort(facetFieldDef: FacetFieldDef, channel: HeaderChannel): VgComparator {\n const {sort} = facetFieldDef;\n if (isSortField(sort)) {\n return {\n field: vgField(sort, {expr: 'datum'}),\n order: sort.order ?? 'ascending'\n };\n } else if (isArray(sort)) {\n return {\n field: sortArrayIndexField(facetFieldDef, channel, {expr: 'datum'}),\n order: 'ascending'\n };\n } else {\n return {\n field: vgField(facetFieldDef, {expr: 'datum'}),\n order: sort ?? 'ascending'\n };\n }\n}\n\nexport function assembleLabelTitle(\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n config: Config\n) {\n const {format, formatType, labelAngle, labelAnchor, labelOrient, labelExpr} = getHeaderProperties(\n ['format', 'formatType', 'labelAngle', 'labelAnchor', 'labelOrient', 'labelExpr'],\n facetFieldDef.header,\n config,\n channel\n );\n\n const titleTextExpr = formatSignalRef({\n fieldOrDatumDef: facetFieldDef,\n format,\n formatType,\n expr: 'parent',\n config\n }).signal;\n const headerChannel = getHeaderChannel(channel, labelOrient);\n\n return {\n text: {\n signal: labelExpr\n ? replaceAll(\n replaceAll(labelExpr, 'datum.label', titleTextExpr),\n 'datum.value',\n vgField(facetFieldDef, {expr: 'parent'})\n )\n : titleTextExpr\n },\n ...(channel === 'row' ? {orient: 'left'} : {}),\n style: 'guide-label',\n frame: 'group',\n ...defaultHeaderGuideBaseline(labelAngle, headerChannel),\n ...defaultHeaderGuideAlign(headerChannel, labelAngle, labelAnchor),\n ...assembleHeaderProperties(config, facetFieldDef, channel, HEADER_LABEL_PROPERTIES, HEADER_LABEL_PROPERTIES_MAP)\n };\n}\n\nexport function assembleHeaderGroup(\n model: Model,\n channel: HeaderChannel,\n headerType: HeaderType,\n layoutHeader: LayoutHeaderComponent,\n headerComponent: HeaderComponent\n) {\n if (headerComponent) {\n let title = null;\n const {facetFieldDef} = layoutHeader;\n const config = model.config ? model.config : undefined;\n if (facetFieldDef && headerComponent.labels) {\n const {labelOrient} = getHeaderProperties(['labelOrient'], facetFieldDef.header, config, channel);\n\n // Include label title in the header if orient aligns with the channel\n if (\n (channel === 'row' && !contains(['top', 'bottom'], labelOrient)) ||\n (channel === 'column' && !contains(['left', 'right'], labelOrient))\n ) {\n title = assembleLabelTitle(facetFieldDef, channel, config);\n }\n }\n\n const isFacetWithoutRowCol = isFacetModel(model) && !isFacetMapping(model.facet);\n\n const axes = headerComponent.axes;\n\n const hasAxes = axes?.length > 0;\n if (title || hasAxes) {\n const sizeChannel = channel === 'row' ? 'height' : 'width';\n\n return {\n name: model.getName(`${channel}_${headerType}`),\n type: 'group',\n role: `${channel}-${headerType}`,\n\n ...(layoutHeader.facetFieldDef\n ? {\n from: {data: model.getName(`${channel}_domain`)},\n sort: getSort(facetFieldDef, channel)\n }\n : {}),\n ...(hasAxes && isFacetWithoutRowCol\n ? {\n from: {data: model.getName(`facet_domain_${channel}`)}\n }\n : {}),\n\n ...(title ? {title} : {}),\n ...(headerComponent.sizeSignal\n ? {\n encode: {\n update: {\n [sizeChannel]: headerComponent.sizeSignal\n }\n }\n }\n : {}),\n ...(hasAxes ? {axes} : {})\n };\n }\n }\n return null;\n}\n\nconst LAYOUT_TITLE_BAND = {\n column: {\n start: 0,\n end: 1\n },\n row: {\n start: 1,\n end: 0\n }\n};\n\nexport function getLayoutTitleBand(titleAnchor: TitleAnchor, headerChannel: HeaderChannel) {\n return LAYOUT_TITLE_BAND[headerChannel][titleAnchor];\n}\n\nexport function assembleLayoutTitleBand(\n headerComponentIndex: LayoutHeaderComponentIndex,\n config: Config\n): RowCol {\n const titleBand = {};\n\n for (const channel of FACET_CHANNELS) {\n const headerComponent = headerComponentIndex[channel];\n if (headerComponent?.facetFieldDef) {\n const {titleAnchor, titleOrient} = getHeaderProperties(\n ['titleAnchor', 'titleOrient'],\n headerComponent.facetFieldDef.header,\n config,\n channel\n );\n\n const headerChannel = getHeaderChannel(channel, titleOrient);\n const band = getLayoutTitleBand(titleAnchor, headerChannel);\n if (band !== undefined) {\n titleBand[headerChannel] = band;\n }\n }\n }\n\n return isEmpty(titleBand) ? undefined : titleBand;\n}\n\nexport function assembleHeaderProperties(\n config: Config,\n facetFieldDef: FacetFieldDef,\n channel: FacetChannel,\n properties: (keyof CoreHeader)[],\n propertiesMap: Partial, keyof TitleConfig>>\n): Partial {\n const props = {};\n for (const prop of properties) {\n if (!propertiesMap[prop]) {\n continue;\n }\n\n const value = getHeaderProperty(prop, facetFieldDef?.header, config, channel);\n if (value !== undefined) {\n props[propertiesMap[prop]] = value;\n }\n }\n return props;\n}\n","import {InitSignal, NewSignal} from 'vega';\nimport {getViewConfigContinuousSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {getFirstDefined} from '../../util';\nimport {isSignalRef, isVgRangeStep, VgRangeStep} from '../../vega.schema';\nimport {signalOrStringValue} from '../common';\nimport {isFacetModel, Model} from '../model';\nimport {ScaleComponent} from '../scale/component';\nimport {LayoutSizeType} from './component';\n\nexport function assembleLayoutSignals(model: Model): NewSignal[] {\n return [\n ...sizeSignals(model, 'width'),\n ...sizeSignals(model, 'height'),\n ...sizeSignals(model, 'childWidth'),\n ...sizeSignals(model, 'childHeight')\n ];\n}\n\nexport function sizeSignals(model: Model, sizeType: LayoutSizeType): (NewSignal | InitSignal)[] {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const size = model.component.layoutSize.get(sizeType);\n if (!size || size === 'merged') {\n return [];\n }\n\n // Read size signal name from name map, just in case it is the top-level size signal that got renamed.\n const name = model.getSizeSignalRef(sizeType).signal;\n\n if (size === 'step') {\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = model.scaleName(channel);\n\n if (isFacetModel(model.parent)) {\n // If parent is facet and this is an independent scale, return only signal signal\n // as the width/height will be calculated using the cardinality from\n // facet's aggregate rather than reading from scale domain\n const parentResolve = model.parent.component.resolve;\n if (parentResolve.scale[channel] === 'independent') {\n return [stepSignal(scaleName, range)];\n }\n }\n\n return [\n stepSignal(scaleName, range),\n {\n name,\n update: sizeExpr(scaleName, scaleComponent, `domain('${scaleName}').length`)\n }\n ];\n }\n }\n /* istanbul ignore next: Condition should not happen -- only for warning in development. */\n throw new Error('layout size is step although width/height is not step.');\n } else if (size == 'container') {\n const isWidth = name.endsWith('width');\n const expr = isWidth ? 'containerSize()[0]' : 'containerSize()[1]';\n const defaultValue = getViewConfigContinuousSize(model.config.view, isWidth ? 'width' : 'height');\n const safeExpr = `isFinite(${expr}) ? ${expr} : ${defaultValue}`;\n return [{name, init: safeExpr, on: [{update: safeExpr, events: 'window:resize'}]}];\n } else {\n return [\n {\n name,\n value: size\n }\n ];\n }\n}\n\nfunction stepSignal(scaleName: string, range: VgRangeStep): NewSignal {\n const name = `${scaleName}_step`;\n if (isSignalRef(range.step)) {\n return {name, update: range.step.signal};\n } else {\n return {name, value: range.step};\n }\n}\n\nexport function sizeExpr(scaleName: string, scaleComponent: ScaleComponent, cardinality: string) {\n const type = scaleComponent.get('type');\n const padding = scaleComponent.get('padding');\n const paddingOuter = getFirstDefined(scaleComponent.get('paddingOuter'), padding);\n\n let paddingInner = scaleComponent.get('paddingInner');\n paddingInner =\n type === 'band'\n ? // only band has real paddingInner\n paddingInner !== undefined\n ? paddingInner\n : padding\n : // For point, as calculated in https://github.com/vega/vega-scale/blob/master/src/band.js#L128,\n // it's equivalent to have paddingInner = 1 since there is only n-1 steps between n points.\n 1;\n return `bandspace(${cardinality}, ${signalOrStringValue(paddingInner)}, ${signalOrStringValue(\n paddingOuter\n )}) * ${scaleName}_step`;\n}\n","import {Split} from '../split';\n\nexport type LayoutSize = number | 'container' | 'step' | 'merged';\n\nexport interface LayoutSizeIndex {\n width?: LayoutSize;\n\n childWidth?: LayoutSize;\n\n height?: LayoutSize;\n\n childHeight?: LayoutSize;\n}\n\nexport type LayoutSizeType = keyof LayoutSizeIndex;\n\nexport type LayoutSizeComponent = Split;\n\nexport function getSizeTypeFromLayoutSizeType(layoutSizeType: LayoutSizeType): 'width' | 'height' {\n return layoutSizeType === 'childWidth' ? 'width' : layoutSizeType === 'childHeight' ? 'height' : layoutSizeType;\n}\n","import {GuideEncodingEntry} from '../guide';\nimport {keys} from '../util';\nimport {VgEncodeChannel} from '../vega.schema';\nimport {signalOrValueRef} from './common';\nimport {wrapCondition} from './mark/encode';\nimport {UnitModel} from './unit';\n\nexport function guideEncodeEntry(encoding: GuideEncodingEntry, model: UnitModel) {\n return keys(encoding).reduce((encode, channel: VgEncodeChannel) => {\n const valueDef = encoding[channel];\n return {\n ...encode,\n ...wrapCondition(model, valueDef, channel, def => signalOrValueRef(def.value))\n };\n }, {});\n}\n","import {isXorY, ScaleChannel} from '../channel';\nimport * as log from '../log';\nimport {Resolve, ResolveMode} from '../resolve';\nimport {isConcatModel, isFacetModel, isLayerModel, Model} from './model';\n\nexport function defaultScaleResolve(channel: ScaleChannel, model: Model): ResolveMode {\n if (isFacetModel(model)) {\n return channel === 'theta' ? 'independent' : 'shared';\n } else if (isLayerModel(model)) {\n return 'shared';\n } else if (isConcatModel(model)) {\n return isXorY(channel) || channel === 'theta' || channel === 'radius' ? 'independent' : 'shared';\n }\n /* istanbul ignore next: should never reach here. */\n throw new Error('invalid model type for resolve');\n}\n\nexport function parseGuideResolve(resolve: Resolve, channel: ScaleChannel): ResolveMode {\n const channelScaleResolve = resolve.scale[channel];\n const guide = isXorY(channel) ? 'axis' : 'legend';\n\n if (channelScaleResolve === 'independent') {\n if (resolve[guide][channel] === 'shared') {\n log.warn(log.message.independentScaleMeansIndependentGuide(channel));\n }\n return 'independent';\n }\n\n return resolve[guide][channel] || 'shared';\n}\n","import {Legend as VgLegend} from 'vega';\nimport {NonPositionScaleChannel} from '../../channel';\nimport {COMMON_LEGEND_PROPERTY_INDEX, LegendInternal} from '../../legend';\nimport {Flag, keys} from '../../util';\nimport {Split} from '../split';\n\nexport type LegendComponentProps = VgLegend & {\n labelExpr?: string;\n selections?: string[];\n disable?: boolean;\n};\n\nconst LEGEND_COMPONENT_PROPERTY_INDEX: Flag = {\n ...COMMON_LEGEND_PROPERTY_INDEX,\n disable: 1,\n labelExpr: 1,\n selections: 1,\n // channel scales\n opacity: 1,\n shape: 1,\n stroke: 1,\n fill: 1,\n size: 1,\n strokeWidth: 1,\n strokeDash: 1,\n // encode\n encode: 1\n};\n\nexport const LEGEND_COMPONENT_PROPERTIES = keys(LEGEND_COMPONENT_PROPERTY_INDEX);\n\nexport class LegendComponent extends Split {}\n\nexport type LegendComponentIndex = Partial>;\n\nexport type LegendInternalIndex = Partial>;\n","import {ColorValueRef, EncodeEntry, Gradient, LegendEncode, LegendType, SignalRef, SymbolEncodeEntry} from 'vega';\nimport {array, isArray, stringValue} from 'vega-util';\nimport {COLOR, NonPositionScaleChannel, OPACITY} from '../../channel';\nimport {\n Conditional,\n DatumDef,\n hasConditionalValueDef,\n isFieldDef,\n isValueDef,\n TypedFieldDef,\n Value,\n ValueDef\n} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport {FILL_STROKE_CONFIG} from '../../mark';\nimport {getFirstDefined, isEmpty, varName} from '../../util';\nimport {applyMarkConfig, signalOrValueRef} from '../common';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport * as mixins from '../mark/encode';\nimport {STORE} from '../selection';\nimport {UnitModel} from '../unit';\nimport {LegendComponent} from './component';\n\nexport interface LegendEncodeParams {\n fieldOrDatumDef: TypedFieldDef | DatumDef;\n model: UnitModel;\n channel: NonPositionScaleChannel;\n legendCmpt: LegendComponent;\n legendType: LegendType;\n}\n\nexport const legendEncodeRules: {\n [part in keyof LegendEncode]?: (spec: EncodeEntry, params: LegendEncodeParams) => EncodeEntry;\n} = {\n symbols,\n gradient,\n labels,\n entries\n};\n\nexport function symbols(\n symbolsSpec: any,\n {fieldOrDatumDef, model, channel, legendCmpt, legendType}: LegendEncodeParams\n): SymbolEncodeEntry {\n if (legendType !== 'symbol') {\n return undefined;\n }\n\n const {markDef, encoding, config, mark} = model;\n const filled = markDef.filled && mark !== 'trail';\n\n let out = {\n ...applyMarkConfig({}, model, FILL_STROKE_CONFIG),\n ...mixins.color(model, {filled})\n } as SymbolEncodeEntry; // FIXME: remove this when VgEncodeEntry is compatible with SymbolEncodeEntry\n\n const symbolOpacity = legendCmpt.get('symbolOpacity') ?? config.legend.symbolOpacity;\n const symbolFillColor = legendCmpt.get('symbolFillColor') ?? config.legend.symbolFillColor;\n const symbolStrokeColor = legendCmpt.get('symbolStrokeColor') ?? config.legend.symbolStrokeColor;\n\n const opacity = symbolOpacity === undefined ? getMaxValue(encoding.opacity) ?? markDef.opacity : undefined;\n\n if (out.fill) {\n // for fill legend, we don't want any fill in symbol\n if (channel === 'fill' || (filled && channel === COLOR)) {\n delete out.fill;\n } else {\n if (out.fill['field']) {\n // For others, set fill to some opaque value (or nothing if a color is already set)\n if (symbolFillColor) {\n delete out.fill;\n } else {\n out.fill = signalOrValueRef(config.legend.symbolBaseFillColor ?? 'black');\n out.fillOpacity = signalOrValueRef(opacity ?? 1);\n }\n } else if (isArray(out.fill)) {\n const fill =\n getFirstConditionValue(encoding.fill ?? encoding.color) ?? markDef.fill ?? (filled && markDef.color);\n if (fill) {\n out.fill = signalOrValueRef(fill) as ColorValueRef;\n }\n }\n }\n }\n\n if (out.stroke) {\n if (channel === 'stroke' || (!filled && channel === COLOR)) {\n delete out.stroke;\n } else {\n if (out.stroke['field'] || symbolStrokeColor) {\n // For others, remove stroke field\n delete out.stroke;\n } else if (isArray(out.stroke)) {\n const stroke = getFirstDefined(\n getFirstConditionValue(encoding.stroke || encoding.color),\n markDef.stroke,\n filled ? markDef.color : undefined\n );\n if (stroke) {\n out.stroke = {value: stroke} as ColorValueRef;\n }\n }\n }\n }\n\n if (channel !== OPACITY) {\n const condition = isFieldDef(fieldOrDatumDef) && selectedCondition(model, legendCmpt, fieldOrDatumDef);\n\n if (condition) {\n out.opacity = [\n {test: condition, ...signalOrValueRef(opacity ?? 1)},\n signalOrValueRef(config.legend.unselectedOpacity)\n ];\n } else if (opacity) {\n out.opacity = signalOrValueRef(opacity);\n }\n }\n\n out = {...out, ...symbolsSpec};\n\n return isEmpty(out) ? undefined : out;\n}\n\nexport function gradient(gradientSpec: any, {model, legendType, legendCmpt}: LegendEncodeParams) {\n if (legendType !== 'gradient') {\n return undefined;\n }\n\n const {config, markDef, encoding} = model;\n\n let out: SymbolEncodeEntry = {};\n\n const gradientOpacity = legendCmpt.get('gradientOpacity') ?? config.legend.gradientOpacity;\n const opacity = gradientOpacity === undefined ? getMaxValue(encoding.opacity) || markDef.opacity : undefined;\n if (opacity) {\n // only apply opacity if it is neither zero or undefined\n out.opacity = signalOrValueRef(opacity);\n }\n\n out = {...out, ...gradientSpec};\n return isEmpty(out) ? undefined : out;\n}\n\nexport function labels(specifiedlabelsSpec: any, {fieldOrDatumDef, model, channel, legendCmpt}: LegendEncodeParams) {\n const legend = model.legend(channel) || {};\n const config = model.config;\n\n const condition = isFieldDef(fieldOrDatumDef) ? selectedCondition(model, legendCmpt, fieldOrDatumDef) : undefined;\n const opacity = condition ? [{test: condition, value: 1}, {value: config.legend.unselectedOpacity}] : undefined;\n\n const {format, formatType} = legend;\n\n let text = undefined;\n\n if (isCustomFormatType(formatType)) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n });\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (fieldOrDatumDef.type === 'quantitative' && config.numberFormatType) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n });\n } else if (\n fieldOrDatumDef.type === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n fieldOrDatumDef.timeUnit === undefined\n ) {\n text = formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n });\n }\n }\n\n const labelsSpec = {\n ...(opacity ? {opacity} : {}),\n ...(text ? {text} : {}),\n ...specifiedlabelsSpec\n };\n\n return isEmpty(labelsSpec) ? undefined : labelsSpec;\n}\n\nexport function entries(entriesSpec: any, {legendCmpt}: LegendEncodeParams) {\n const selections = legendCmpt.get('selections');\n return selections?.length ? {...entriesSpec, fill: {value: 'transparent'}} : entriesSpec;\n}\n\nfunction getMaxValue(channelDef: Encoding['opacity']) {\n return getConditionValue(channelDef, (v: number, conditionalDef) => Math.max(v, conditionalDef.value as any));\n}\n\nexport function getFirstConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape']\n): V {\n return getConditionValue(channelDef, (v: V, conditionalDef: Conditional>) => {\n return getFirstDefined(v, conditionalDef.value);\n });\n}\n\nfunction getConditionValue(\n channelDef: Encoding['fill' | 'stroke' | 'shape' | 'opacity'],\n reducer: (val: V, conditionalDef: Conditional>) => V\n): V {\n if (hasConditionalValueDef(channelDef)) {\n return array(channelDef.condition).reduce(reducer, channelDef.value as any);\n } else if (isValueDef(channelDef)) {\n return channelDef.value as any;\n }\n return undefined;\n}\n\nfunction selectedCondition(model: UnitModel, legendCmpt: LegendComponent, fieldDef: TypedFieldDef) {\n const selections = legendCmpt.get('selections');\n if (!selections?.length) return undefined;\n\n const field = stringValue(fieldDef.field);\n return selections\n .map(name => {\n const store = stringValue(varName(name) + STORE);\n return `(!length(data(${store})) || (${name}[${field}] && indexof(${name}[${field}], datum.value) >= 0))`;\n })\n .join(' || ');\n}\n","import {LabelOverlap, LegendOrient, LegendType, Orientation, SignalRef, SymbolShape} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isColorChannel} from '../../channel';\nimport {DatumDef, MarkPropFieldOrDatumDef, title as fieldDefTitle, TypedFieldDef, valueArray} from '../../channeldef';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {Legend, LegendConfig, LegendInternal} from '../../legend';\nimport {Mark, MarkDef} from '../../mark';\nimport {isContinuousToContinuous, ScaleType} from '../../scale';\nimport {TimeUnit} from '../../timeunit';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {guideFormat, guideFormatType} from '../format';\nimport {Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {NonPositionScaleChannel} from './../../channel';\nimport {LegendComponentProps} from './component';\nimport {getFirstConditionValue} from './encode';\n\nexport interface LegendRuleParams {\n legend: LegendInternal;\n channel: NonPositionScaleChannel;\n model: UnitModel;\n markDef: MarkDef;\n encoding: Encoding;\n fieldOrDatumDef: MarkPropFieldOrDatumDef;\n legendConfig: LegendConfig;\n config: Config;\n scaleType: ScaleType;\n orient: LegendOrient;\n legendType: LegendType;\n direction: Orientation;\n}\n\nexport const legendRules: {\n [k in keyof LegendComponentProps]?: (params: LegendRuleParams) => LegendComponentProps[k];\n} = {\n direction: ({direction}) => direction,\n\n format: ({fieldOrDatumDef, legend, config}) => {\n const {format, formatType} = legend;\n return guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, format, formatType, config, false);\n },\n\n formatType: ({legend, fieldOrDatumDef, scaleType}) => {\n const {formatType} = legend;\n return guideFormatType(formatType, fieldOrDatumDef, scaleType);\n },\n\n gradientLength: params => {\n const {legend, legendConfig} = params;\n return legend.gradientLength ?? legendConfig.gradientLength ?? defaultGradientLength(params);\n },\n\n labelOverlap: ({legend, legendConfig, scaleType}) =>\n legend.labelOverlap ?? legendConfig.labelOverlap ?? defaultLabelOverlap(scaleType),\n\n symbolType: ({legend, markDef, channel, encoding}) =>\n legend.symbolType ?? defaultSymbolType(markDef.type, channel, encoding.shape, markDef.shape),\n\n title: ({fieldOrDatumDef, config}) => fieldDefTitle(fieldOrDatumDef, config, {allowDisabling: true}),\n\n type: ({legendType, scaleType, channel}) => {\n if (isColorChannel(channel) && isContinuousToContinuous(scaleType)) {\n if (legendType === 'gradient') {\n return undefined;\n }\n } else if (legendType === 'symbol') {\n return undefined;\n }\n return legendType;\n }, // depended by other property, let's define upfront\n\n values: ({fieldOrDatumDef, legend}) => values(legend, fieldOrDatumDef)\n};\n\nexport function values(legend: LegendInternal, fieldOrDatumDef: TypedFieldDef | DatumDef) {\n const vals = legend.values;\n\n if (isArray(vals)) {\n return valueArray(fieldOrDatumDef, vals);\n } else if (isSignalRef(vals)) {\n return vals;\n }\n return undefined;\n}\n\nexport function defaultSymbolType(\n mark: Mark,\n channel: NonPositionScaleChannel,\n shapeChannelDef: Encoding['shape'],\n markShape: SymbolShape | SignalRef\n): SymbolShape | SignalRef {\n if (channel !== 'shape') {\n // use the value from the shape encoding or the mark config if they exist\n const shape = getFirstConditionValue(shapeChannelDef) ?? markShape;\n if (shape) {\n return shape;\n }\n }\n\n switch (mark) {\n case 'bar':\n case 'rect':\n case 'image':\n case 'square':\n return 'square';\n case 'line':\n case 'trail':\n case 'rule':\n return 'stroke';\n case 'arc':\n case 'point':\n case 'circle':\n case 'tick':\n case 'geoshape':\n case 'area':\n case 'text':\n return 'circle';\n }\n}\n\nexport function clipHeight(legendType: LegendType) {\n if (legendType === 'gradient') {\n return 20;\n }\n return undefined;\n}\n\nexport function getLegendType(params: {\n legend: LegendInternal;\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n const {legend} = params;\n\n return getFirstDefined(legend.type, defaultType(params));\n}\n\nexport function defaultType({\n channel,\n timeUnit,\n scaleType\n}: {\n channel: NonPositionScaleChannel;\n timeUnit?: TimeUnit;\n scaleType: ScaleType;\n}): LegendType {\n // Following the logic in https://github.com/vega/vega-parser/blob/master/src/parsers/legend.js\n\n if (isColorChannel(channel)) {\n if (contains(['quarter', 'month', 'day'], timeUnit)) {\n return 'symbol';\n }\n\n if (isContinuousToContinuous(scaleType)) {\n return 'gradient';\n }\n }\n return 'symbol';\n}\n\nexport function getDirection({\n legendConfig,\n legendType,\n orient,\n legend\n}: {\n orient: LegendOrient;\n legendConfig: LegendConfig;\n legendType: LegendType;\n legend: Legend;\n}): Orientation {\n return (\n legend.direction ??\n legendConfig[legendType ? 'gradientDirection' : 'symbolDirection'] ??\n defaultDirection(orient, legendType)\n );\n}\n\nexport function defaultDirection(orient: LegendOrient, legendType: LegendType): 'horizontal' | undefined {\n switch (orient) {\n case 'top':\n case 'bottom':\n return 'horizontal';\n\n case 'left':\n case 'right':\n case 'none':\n case undefined: // undefined = \"right\" in Vega\n return undefined; // vertical is Vega's default\n default:\n // top-left / ...\n // For inner legend, uses compact layout like Tableau\n return legendType === 'gradient' ? 'horizontal' : undefined;\n }\n}\n\nexport function defaultGradientLength({\n legendConfig,\n model,\n direction,\n orient,\n scaleType\n}: {\n scaleType: ScaleType;\n direction: Orientation;\n orient: LegendOrient;\n model: Model;\n legendConfig: LegendConfig;\n}) {\n const {\n gradientHorizontalMaxLength,\n gradientHorizontalMinLength,\n gradientVerticalMaxLength,\n gradientVerticalMinLength\n } = legendConfig;\n if (isContinuousToContinuous(scaleType)) {\n if (direction === 'horizontal') {\n if (orient === 'top' || orient === 'bottom') {\n return gradientLengthSignal(model, 'width', gradientHorizontalMinLength, gradientHorizontalMaxLength);\n } else {\n return gradientHorizontalMinLength;\n }\n } else {\n // vertical / undefined (Vega uses vertical by default)\n return gradientLengthSignal(model, 'height', gradientVerticalMinLength, gradientVerticalMaxLength);\n }\n }\n return undefined;\n}\n\nfunction gradientLengthSignal(model: Model, sizeType: 'width' | 'height', min: number, max: number) {\n const sizeSignal = model.getSizeSignalRef(sizeType).signal;\n return {signal: `clamp(${sizeSignal}, ${min}, ${max})`};\n}\n\nexport function defaultLabelOverlap(scaleType: ScaleType): LabelOverlap {\n if (contains(['quantile', 'threshold', 'log', 'symlog'], scaleType)) {\n return 'greedy';\n }\n return undefined;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {COLOR, NonPositionScaleChannel, SHAPE} from '../../channel';\nimport {DatumDef, FieldDef, getFieldOrDatumDef, isFieldDef, MarkPropDatumDef, MarkPropFieldDef} from '../../channeldef';\nimport {LegendInternal, LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport {GEOJSON} from '../../type';\nimport {deleteNestedProperty, isEmpty, keys, varName} from '../../util';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {isUnitModel, Model} from '../model';\nimport {parseGuideResolve} from '../resolve';\nimport {parseInteractiveLegend} from '../selection/legends';\nimport {defaultTieBreaker, Explicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {LegendComponent, LegendComponentIndex, LegendComponentProps, LEGEND_COMPONENT_PROPERTIES} from './component';\nimport {LegendEncodeParams, legendEncodeRules} from './encode';\nimport {getDirection, getLegendType, LegendRuleParams, legendRules} from './properties';\n\nexport function parseLegend(model: Model) {\n const legendComponent = isUnitModel(model) ? parseUnitLegend(model) : parseNonUnitLegend(model);\n model.component.legends = legendComponent;\n return legendComponent;\n}\n\nfunction parseUnitLegend(model: UnitModel): LegendComponentIndex {\n const {encoding} = model;\n\n const legendComponent: LegendComponentIndex = {};\n\n for (const channel of [COLOR, ...LEGEND_SCALE_CHANNELS]) {\n const def = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | MarkPropDatumDef;\n\n if (!def || !model.getScaleComponent(channel)) {\n continue;\n }\n\n if (channel === SHAPE && isFieldDef(def) && def.type === GEOJSON) {\n continue;\n }\n\n legendComponent[channel] = parseLegendForChannel(model, channel);\n }\n\n return legendComponent;\n}\n\nfunction getLegendDefWithScale(model: UnitModel, channel: NonPositionScaleChannel): VgLegend {\n const scale = model.scaleName(channel);\n if (model.mark === 'trail') {\n if (channel === 'color') {\n // trail is a filled mark, but its default symbolType (\"stroke\") should use \"stroke\"\n return {stroke: scale};\n } else if (channel === 'size') {\n return {strokeWidth: scale};\n }\n }\n\n if (channel === 'color') {\n return model.markDef.filled ? {fill: scale} : {stroke: scale};\n }\n return {[channel]: scale};\n}\n\n// eslint-disable-next-line @typescript-eslint/ban-types\nfunction isExplicit(\n value: T,\n property: keyof LegendComponentProps,\n legend: LegendInternal,\n fieldDef: FieldDef\n) {\n switch (property) {\n case 'disable':\n return legend !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n case 'values':\n // specified legend.values is already respected, but may get transformed.\n return !!legend?.values;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (property === 'title' && value === fieldDef?.title) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === (legend || {})[property];\n}\n\nexport function parseLegendForChannel(model: UnitModel, channel: NonPositionScaleChannel): LegendComponent {\n let legend = model.legend(channel);\n\n const {markDef, encoding, config} = model;\n const legendConfig = config.legend;\n const legendCmpt = new LegendComponent({}, getLegendDefWithScale(model, channel));\n parseInteractiveLegend(model, channel, legendCmpt);\n\n const disable = legend !== undefined ? !legend : legendConfig.disable;\n legendCmpt.set('disable', disable, legend !== undefined);\n if (disable) {\n return legendCmpt;\n }\n\n legend = legend || {};\n\n const scaleType = model.getScaleComponent(channel).get('type');\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldDef | DatumDef;\n const timeUnit = isFieldDef(fieldOrDatumDef) ? normalizeTimeUnit(fieldOrDatumDef.timeUnit)?.unit : undefined;\n\n const orient = legend.orient || config.legend.orient || 'right';\n const legendType = getLegendType({legend, channel, timeUnit, scaleType});\n\n const direction = getDirection({legend, legendType, orient, legendConfig});\n\n const ruleParams: LegendRuleParams = {\n legend,\n channel,\n model,\n markDef,\n encoding,\n fieldOrDatumDef,\n legendConfig,\n config,\n scaleType,\n orient,\n legendType,\n direction\n };\n\n for (const property of LEGEND_COMPONENT_PROPERTIES) {\n if (\n (legendType === 'gradient' && property.startsWith('symbol')) ||\n (legendType === 'symbol' && property.startsWith('gradient'))\n ) {\n continue;\n }\n\n const value = property in legendRules ? legendRules[property](ruleParams) : legend[property];\n if (value !== undefined) {\n const explicit = isExplicit(value, property, legend, model.fieldDef(channel));\n if (explicit || config.legend[property] === undefined) {\n legendCmpt.set(property, value, explicit);\n }\n }\n }\n\n const legendEncoding = legend?.encoding ?? {};\n const selections = legendCmpt.get('selections');\n const legendEncode: LegendEncode = {};\n\n const legendEncodeParams: LegendEncodeParams = {fieldOrDatumDef, model, channel, legendCmpt, legendType};\n\n for (const part of ['labels', 'legend', 'title', 'symbols', 'gradient', 'entries']) {\n const legendEncodingPart = guideEncodeEntry(legendEncoding[part] ?? {}, model);\n\n const value =\n part in legendEncodeRules\n ? legendEncodeRules[part](legendEncodingPart, legendEncodeParams) // apply rule\n : legendEncodingPart; // no rule -- just default values\n\n if (value !== undefined && !isEmpty(value)) {\n legendEncode[part] = {\n ...(selections?.length && isFieldDef(fieldOrDatumDef)\n ? {name: `${varName(fieldOrDatumDef.field)}_legend_${part}`}\n : {}),\n ...(selections?.length ? {interactive: !!selections} : {}),\n update: value\n };\n }\n }\n\n if (!isEmpty(legendEncode)) {\n legendCmpt.set('encode', legendEncode, !!legend?.encoding);\n }\n\n return legendCmpt;\n}\n\nfunction parseNonUnitLegend(model: Model) {\n const {legends, resolve} = model.component;\n\n for (const child of model.children) {\n parseLegend(child);\n\n for (const channel of keys(child.component.legends)) {\n resolve.legend[channel] = parseGuideResolve(model.component.resolve, channel);\n\n if (resolve.legend[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n legends[channel] = mergeLegendComponent(legends[channel], child.component.legends[channel]);\n\n if (!legends[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the legend shared.\n // Thus, mark legend as independent and remove the legend component.\n resolve.legend[channel] = 'independent';\n delete legends[channel];\n }\n }\n }\n }\n\n for (const channel of keys(legends)) {\n for (const child of model.children) {\n if (!child.component.legends[channel]) {\n // skip if the child does not have a particular legend\n continue;\n }\n\n if (resolve.legend[channel] === 'shared') {\n // After merging shared legend, make sure to remove legend from child\n delete child.component.legends[channel];\n }\n }\n }\n\n return legends;\n}\n\nexport function mergeLegendComponent(mergedLegend: LegendComponent, childLegend: LegendComponent): LegendComponent {\n if (!mergedLegend) {\n return childLegend.clone();\n }\n const mergedOrient = mergedLegend.getWithExplicit('orient');\n const childOrient = childLegend.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n // Cannot merge due to inconsistent orient\n return undefined;\n }\n\n let typeMerged = false;\n // Otherwise, let's merge\n for (const prop of LEGEND_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n mergedLegend.getWithExplicit(prop),\n childLegend.getWithExplicit(prop),\n prop,\n 'legend',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit): any => {\n switch (prop) {\n case 'symbolType':\n return mergeSymbolType(v1, v2);\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'type':\n // There are only two types. If we have different types, then prefer symbol over gradient.\n typeMerged = true;\n return makeImplicit('symbol');\n }\n return defaultTieBreaker(v1, v2, prop, 'legend');\n }\n );\n mergedLegend.setWithExplicit(prop, mergedValueWithExplicit);\n }\n if (typeMerged) {\n if (mergedLegend.implicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.implicit, ['encode', 'gradient']);\n }\n if (mergedLegend.explicit?.encode?.gradient) {\n deleteNestedProperty(mergedLegend.explicit, ['encode', 'gradient']);\n }\n }\n\n return mergedLegend;\n}\n\nfunction mergeSymbolType(st1: Explicit, st2: Explicit) {\n if (st2.value === 'circle') {\n // prefer \"circle\" over \"stroke\"\n return st2;\n }\n return st1;\n}\n","import {Legend as VgLegend, LegendEncode} from 'vega';\nimport {Config} from '../../config';\nimport {LEGEND_SCALE_CHANNELS} from '../../legend';\nimport {keys, replaceAll, stringify, vals} from '../../util';\nimport {isSignalRef, VgEncodeChannel, VgValueRef} from '../../vega.schema';\nimport {Model} from '../model';\nimport {LegendComponent} from './component';\nimport {mergeLegendComponent} from './parse';\n\nfunction setLegendEncode(\n legend: VgLegend,\n part: keyof LegendEncode,\n vgProp: VgEncodeChannel,\n vgRef: VgValueRef | VgValueRef[]\n) {\n legend.encode ??= {};\n legend.encode[part] ??= {};\n legend.encode[part].update ??= {};\n // TODO: remove as any after https://github.com/prisma/nexus-prisma/issues/291\n (legend.encode[part].update[vgProp] as any) = vgRef;\n}\n\nexport function assembleLegends(model: Model): VgLegend[] {\n const legendComponentIndex = model.component.legends;\n const legendByDomain: Record = {};\n\n for (const channel of keys(legendComponentIndex)) {\n const scaleComponent = model.getScaleComponent(channel);\n const domainHash = stringify(scaleComponent.get('domains'));\n if (legendByDomain[domainHash]) {\n for (const mergedLegendComponent of legendByDomain[domainHash]) {\n const merged = mergeLegendComponent(mergedLegendComponent, legendComponentIndex[channel]);\n if (!merged) {\n // If cannot merge, need to add this legend separately\n legendByDomain[domainHash].push(legendComponentIndex[channel]);\n }\n }\n } else {\n legendByDomain[domainHash] = [legendComponentIndex[channel].clone()];\n }\n }\n\n const legends = vals(legendByDomain)\n .flat()\n .map(l => assembleLegend(l, model.config))\n .filter(l => l !== undefined);\n\n return legends;\n}\n\nexport function assembleLegend(legendCmpt: LegendComponent, config: Config) {\n const {disable, labelExpr, selections, ...legend} = legendCmpt.combine();\n\n if (disable) {\n return undefined;\n }\n\n if (config.aria === false && legend.aria == undefined) {\n legend.aria = false;\n }\n\n if (legend.encode?.symbols) {\n const out = legend.encode.symbols.update;\n if (out.fill && out.fill['value'] !== 'transparent' && !out.stroke && !legend.stroke) {\n // For non color channel's legend, we need to override symbol stroke config from Vega config if stroke channel is not used.\n out.stroke = {value: 'transparent'};\n }\n\n // Remove properties that the legend is encoding.\n for (const property of LEGEND_SCALE_CHANNELS) {\n if (legend[property]) {\n delete out[property];\n }\n }\n }\n\n if (!legend.title) {\n // title schema doesn't include null, ''\n delete legend.title;\n }\n\n if (labelExpr !== undefined) {\n let expr = labelExpr;\n if (legend.encode?.labels?.update && isSignalRef(legend.encode.labels.update.text)) {\n expr = replaceAll(labelExpr, 'datum.label', legend.encode.labels.update.text.signal);\n }\n setLegendEncode(legend, 'labels', 'text', {signal: expr});\n }\n\n return legend;\n}\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {contains} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\n\nexport function assembleProjections(model: Model): VgProjection[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n return assembleProjectionsForModelAndChildren(model);\n } else {\n return assembleProjectionForModel(model);\n }\n}\n\nexport function assembleProjectionsForModelAndChildren(model: Model): VgProjection[] {\n return model.children.reduce((projections, child) => {\n return projections.concat(child.assembleProjections());\n }, assembleProjectionForModel(model));\n}\n\nexport function assembleProjectionForModel(model: Model): VgProjection[] {\n const component = model.component.projection;\n if (!component || component.merged) {\n return [];\n }\n\n const projection = component.combine();\n const {name} = projection; // we need to extract name so that it is always present in the output and pass TS type validation\n\n if (!component.data) {\n // generate custom projection, no automatic fitting\n return [\n {\n name,\n // translate to center by default\n ...{translate: {signal: '[width / 2, height / 2]'}},\n // parameters, overwrite default translate if specified\n ...projection\n }\n ];\n } else {\n // generate projection that uses extent fitting\n const size: SignalRef = {\n signal: `[${component.size.map(ref => ref.signal).join(', ')}]`\n };\n\n const fits: string[] = component.data.reduce((sources, data) => {\n const source: string = isSignalRef(data) ? data.signal : `data('${model.lookupDataSource(data)}')`;\n if (!contains(sources, source)) {\n // build a unique list of sources\n sources.push(source);\n }\n return sources;\n }, []);\n\n if (fits.length <= 0) {\n throw new Error(\"Projection's fit didn't find any data sources\");\n }\n\n return [\n {\n name,\n size,\n fit: {\n signal: fits.length > 1 ? `[${fits.join(', ')}]` : fits[0]\n },\n ...projection\n }\n ];\n }\n}\n","import {BaseProjection, SignalRef, Vector2} from 'vega';\nimport {ExprRef} from './expr';\nimport {MapExcludeValueRefAndReplaceSignalWith, ProjectionType} from './vega.schema';\n\nexport interface Projection\n extends MapExcludeValueRefAndReplaceSignalWith {\n /**\n * The cartographic projection to use. This value is case-insensitive, for example `\"albers\"` and `\"Albers\"` indicate the same projection type. You can find all valid projection types [in the documentation](https://vega.github.io/vega-lite/docs/projection.html#projection-types).\n *\n * __Default value:__ `equalEarth`\n */\n type?: ProjectionType | ES; // Re-declare to override docs\n\n /**\n * The projection’s scale (zoom) factor, overriding automatic fitting. The default scale is projection-specific. The scale factor corresponds linearly to the distance between projected points; however, scale factor values are not equivalent across projections.\n */\n scale?: number | ES; // Re-declare to override docs\n\n /**\n * The projection’s translation offset as a two-element array `[tx, ty]`.\n */\n translate?: Vector2 | ES; // TODO: figure what's VL default value\n}\n\n/**\n * Any property of Projection can be in config\n */\nexport type ProjectionConfig = Projection;\n\nexport const PROJECTION_PROPERTIES: (keyof Projection)[] = [\n 'type',\n 'clipAngle',\n 'clipExtent',\n 'center',\n 'rotate',\n 'precision',\n 'reflectX',\n 'reflectY',\n 'coefficient',\n 'distance',\n 'fraction',\n 'lobes',\n 'parallel',\n 'radius',\n 'ratio',\n 'spacing',\n 'tilt'\n];\n","import {Projection as VgProjection, SignalRef} from 'vega';\nimport {Projection} from '../../projection';\nimport {Split} from '../split';\n\nexport class ProjectionComponent extends Split {\n public merged = false;\n\n constructor(\n name: string,\n public specifiedProjection: Projection,\n public size: SignalRef[],\n public data: (string | SignalRef)[]\n ) {\n super(\n {...specifiedProjection}, // all explicit properties of projection\n {name} // name as initial implicit property\n );\n }\n\n /**\n * Whether the projection parameters should fit provided data.\n */\n public get isFit() {\n return !!this.data;\n }\n}\n","import type {SignalRef} from 'vega';\nimport {hasOwnProperty} from 'vega-util';\nimport {LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {replaceExprRef} from '../../expr';\nimport {PROJECTION_PROPERTIES} from '../../projection';\nimport {GEOJSON} from '../../type';\nimport {deepEqual, duplicate, every} from '../../util';\nimport {isUnitModel, Model} from '../model';\nimport {UnitModel} from '../unit';\nimport {ProjectionComponent} from './component';\n\nexport function parseProjection(model: Model) {\n model.component.projection = isUnitModel(model) ? parseUnitProjection(model) : parseNonUnitProjections(model);\n}\n\nfunction parseUnitProjection(model: UnitModel): ProjectionComponent {\n if (model.hasProjection) {\n const proj = replaceExprRef(model.specifiedProjection);\n const fit = !(proj && (proj.scale != null || proj.translate != null));\n const size = fit ? [model.getSizeSignalRef('width'), model.getSizeSignalRef('height')] : undefined;\n const data = fit ? gatherFitData(model) : undefined;\n\n const projComp = new ProjectionComponent(\n model.projectionName(true),\n {\n ...(replaceExprRef(model.config.projection) ?? {}),\n ...(proj ?? {})\n },\n size,\n data\n );\n\n if (!projComp.get('type')) {\n projComp.set('type', 'equalEarth', false);\n }\n\n return projComp;\n }\n\n return undefined;\n}\n\nfunction gatherFitData(model: UnitModel) {\n const data: (SignalRef | string)[] = [];\n\n const {encoding} = model;\n\n for (const posssiblePair of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ]) {\n if (getFieldOrDatumDef(encoding[posssiblePair[0]]) || getFieldOrDatumDef(encoding[posssiblePair[1]])) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n }\n\n if (model.channelHasField(SHAPE) && model.typedFieldDef(SHAPE).type === GEOJSON) {\n data.push({\n signal: model.getName(`geojson_${data.length}`)\n });\n }\n\n if (data.length === 0) {\n // main source is geojson, so we can just use that\n data.push(model.requestDataName(DataSourceType.Main));\n }\n\n return data;\n}\n\nfunction mergeIfNoConflict(first: ProjectionComponent, second: ProjectionComponent): ProjectionComponent {\n const allPropertiesShared = every(PROJECTION_PROPERTIES, prop => {\n // neither has the property\n if (!hasOwnProperty(first.explicit, prop) && !hasOwnProperty(second.explicit, prop)) {\n return true;\n }\n // both have property and an equal value for property\n if (\n hasOwnProperty(first.explicit, prop) &&\n hasOwnProperty(second.explicit, prop) &&\n // some properties might be signals or objects and require hashing for comparison\n deepEqual(first.get(prop), second.get(prop))\n ) {\n return true;\n }\n return false;\n });\n\n const size = deepEqual(first.size, second.size);\n if (size) {\n if (allPropertiesShared) {\n return first;\n } else if (deepEqual(first.explicit, {})) {\n return second;\n } else if (deepEqual(second.explicit, {})) {\n return first;\n }\n }\n\n // if all properties don't match, let each unit spec have its own projection\n return null;\n}\n\nfunction parseNonUnitProjections(model: Model): ProjectionComponent {\n if (model.children.length === 0) {\n return undefined;\n }\n\n let nonUnitProjection: ProjectionComponent;\n\n // parse all children first\n for (const child of model.children) {\n parseProjection(child);\n }\n\n // analyze parsed projections, attempt to merge\n const mergable = every(model.children, child => {\n const projection = child.component.projection;\n if (!projection) {\n // child layer does not use a projection\n return true;\n } else if (!nonUnitProjection) {\n // cached 'projection' is null, cache this one\n nonUnitProjection = projection;\n return true;\n } else {\n const merge = mergeIfNoConflict(nonUnitProjection, projection);\n if (merge) {\n nonUnitProjection = merge;\n }\n return !!merge;\n }\n });\n\n // if cached one and all other children share the same projection,\n if (nonUnitProjection && mergable) {\n // so we can elevate it to the layer level\n const name = model.projectionName(true);\n const modelProjection = new ProjectionComponent(\n name,\n nonUnitProjection.specifiedProjection,\n nonUnitProjection.size,\n duplicate(nonUnitProjection.data)\n );\n\n // rename and assign all others as merged\n for (const child of model.children) {\n const projection = child.component.projection;\n if (projection) {\n if (projection.isFit) {\n modelProjection.data.push(...child.component.projection.data);\n }\n child.renameProjection(projection.get('name'), name);\n projection.merged = true;\n }\n }\n\n return modelProjection;\n }\n\n return undefined;\n}\n","import {BinTransform as VgBinTransform, Transforms as VgTransform} from 'vega';\nimport {isString} from 'vega-util';\nimport {BinParams, binToString, isBinning, isParameterExtent} from '../../bin';\nimport {Channel} from '../../channel';\nimport {binRequiresRange, FieldName, isTypedFieldDef, normalizeBin, TypedFieldDef, vgField} from '../../channeldef';\nimport {Config} from '../../config';\nimport {BinTransform} from '../../transform';\nimport {Dict, duplicate, hash, isEmpty, keys, replacePathInField, unique, vals} from '../../util';\nimport {binFormatExpression} from '../format';\nimport {isUnitModel, Model, ModelWithField} from '../model';\nimport {parseSelectionExtent} from '../selection/parse';\nimport {NonPositionScaleChannel, PositionChannel} from './../../channel';\nimport {DataFlowNode} from './dataflow';\n\nfunction rangeFormula(model: ModelWithField, fieldDef: TypedFieldDef, channel: Channel, config: Config) {\n if (binRequiresRange(fieldDef, channel)) {\n // read format from axis or legend, if there is no format then use config.numberFormat\n\n const guide = isUnitModel(model)\n ? model.axis(channel as PositionChannel) ?? model.legend(channel as NonPositionScaleChannel) ?? {}\n : {};\n\n const startField = vgField(fieldDef, {expr: 'datum'});\n const endField = vgField(fieldDef, {expr: 'datum', binSuffix: 'end'});\n\n return {\n formulaAs: vgField(fieldDef, {binSuffix: 'range', forAs: true}),\n formula: binFormatExpression(startField, endField, guide.format, guide.formatType, config)\n };\n }\n return {};\n}\n\nfunction binKey(bin: BinParams, field: string) {\n return `${binToString(bin)}_${field}`;\n}\n\nfunction getSignalsFromModel(model: Model, key: string) {\n return {\n signal: model.getName(`${key}_bins`),\n extentSignal: model.getName(`${key}_extent`)\n };\n}\n\nexport function getBinSignalName(model: Model, field: string, bin: boolean | BinParams) {\n const normalizedBin = normalizeBin(bin, undefined) ?? {};\n const key = binKey(normalizedBin, field);\n return model.getName(`${key}_bins`);\n}\n\nfunction isBinTransform(t: TypedFieldDef | BinTransform): t is BinTransform {\n return 'as' in t;\n}\n\nfunction createBinComponent(t: TypedFieldDef | BinTransform, bin: boolean | BinParams, model: Model) {\n let as: [string, string];\n let span: string;\n\n if (isBinTransform(t)) {\n as = isString(t.as) ? [t.as, `${t.as}_end`] : [t.as[0], t.as[1]];\n } else {\n as = [vgField(t, {forAs: true}), vgField(t, {binSuffix: 'end', forAs: true})];\n }\n\n const normalizedBin = {...normalizeBin(bin, undefined)};\n const key = binKey(normalizedBin, t.field);\n const {signal, extentSignal} = getSignalsFromModel(model, key);\n\n if (isParameterExtent(normalizedBin.extent)) {\n const ext = normalizedBin.extent;\n span = parseSelectionExtent(model, ext.param, ext);\n delete normalizedBin.extent; // Vega-Lite selection extent map to Vega's span property.\n }\n\n const binComponent: BinComponent = {\n bin: normalizedBin,\n field: t.field,\n as: [as],\n ...(signal ? {signal} : {}),\n ...(extentSignal ? {extentSignal} : {}),\n ...(span ? {span} : {})\n };\n\n return {key, binComponent};\n}\n\nexport interface BinComponent {\n bin: BinParams;\n field: FieldName;\n extentSignal?: string;\n signal?: string;\n span?: string;\n\n /** Pairs of strings of the names of start and end signals */\n as: [string, string][];\n\n // Range Formula\n\n formula?: string;\n formulaAs?: string;\n}\n\nexport class BinNode extends DataFlowNode {\n public clone() {\n return new BinNode(null, duplicate(this.bins));\n }\n\n constructor(\n parent: DataFlowNode,\n private bins: Dict\n ) {\n super(parent);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: ModelWithField) {\n const bins = model.reduceFieldDef((binComponentIndex: Dict, fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n const {key, binComponent} = createBinComponent(fieldDef, fieldDef.bin, model);\n binComponentIndex[key] = {\n ...binComponent,\n ...binComponentIndex[key],\n ...rangeFormula(model, fieldDef, channel, model.config)\n };\n }\n return binComponentIndex;\n }, {} as Dict);\n\n if (isEmpty(bins)) {\n return null;\n }\n\n return new BinNode(parent, bins);\n }\n\n /**\n * Creates a bin node from BinTransform.\n * The optional parameter should provide\n */\n public static makeFromTransform(parent: DataFlowNode, t: BinTransform, model: Model) {\n const {key, binComponent} = createBinComponent(t, t.bin, model);\n return new BinNode(parent, {\n [key]: binComponent\n });\n }\n\n /**\n * Merge bin nodes. This method either integrates the bin config from the other node\n * or if this node already has a bin config, renames the corresponding signal in the model.\n */\n public merge(other: BinNode, renameSignal: (s1: string, s2: string) => void) {\n for (const key of keys(other.bins)) {\n if (key in this.bins) {\n renameSignal(other.bins[key].signal, this.bins[key].signal);\n // Ensure that we don't have duplicate names for signal pairs\n this.bins[key].as = unique([...this.bins[key].as, ...other.bins[key].as], hash);\n } else {\n this.bins[key] = other.bins[key];\n }\n }\n\n for (const child of other.children) {\n other.removeChild(child);\n child.parent = this;\n }\n other.remove();\n }\n\n public producedFields() {\n return new Set(\n vals(this.bins)\n .map(c => c.as)\n .flat(2)\n );\n }\n\n public dependentFields() {\n return new Set(vals(this.bins).map(c => c.field));\n }\n\n public hash() {\n return `Bin ${hash(this.bins)}`;\n }\n\n public assemble(): VgTransform[] {\n return vals(this.bins).flatMap(bin => {\n const transform: VgTransform[] = [];\n\n const [binAs, ...remainingAs] = bin.as;\n const {extent, ...params} = bin.bin;\n const binTrans: VgBinTransform = {\n type: 'bin',\n field: replacePathInField(bin.field),\n as: binAs,\n signal: bin.signal,\n ...(!isParameterExtent(extent) ? {extent} : {extent: null}),\n ...(bin.span ? {span: {signal: `span(${bin.span})`}} : {}),\n ...params\n };\n\n if (!extent && bin.extentSignal) {\n transform.push({\n type: 'extent',\n field: replacePathInField(bin.field),\n signal: bin.extentSignal\n });\n binTrans.extent = {signal: bin.extentSignal};\n }\n\n transform.push(binTrans);\n\n for (const as of remainingAs) {\n for (let i = 0; i < 2; i++) {\n transform.push({\n type: 'formula',\n expr: vgField({field: binAs[i]}, {expr: 'datum'}),\n as: as[i]\n });\n }\n }\n\n if (bin.formula) {\n transform.push({\n type: 'formula',\n expr: bin.formula,\n as: bin.formulaAs\n });\n }\n return transform;\n });\n }\n}\n","import {AggregateOp, AggregateTransform as VgAggregateTransform} from 'vega';\nimport {isArgmaxDef, isArgminDef} from '../../aggregate';\nimport {\n Channel,\n getPositionChannelFromLatLong,\n getSecondaryRangeChannel,\n isGeoPositionChannel,\n isScaleChannel,\n isXorY\n} from '../../channel';\nimport {\n binRequiresRange,\n FieldDef,\n getBandPosition,\n hasBandEnd,\n isScaleFieldDef,\n isTypedFieldDef,\n vgField\n} from '../../channeldef';\nimport * as log from '../../log';\nimport {isFieldRange} from '../../scale';\nimport {AggregateTransform} from '../../transform';\nimport {Dict, duplicate, hash, keys, replacePathInField, setEqual} from '../../util';\nimport {isUnitModel, ModelWithField} from '../model';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\nimport {isRectBasedMark} from '../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from './timeunit';\n\ntype Measures = Dict>>>;\n\nfunction addDimension(dims: Set, channel: Channel, fieldDef: FieldDef, model: ModelWithField) {\n const channelDef2 = isUnitModel(model) ? model.encoding[getSecondaryRangeChannel(channel)] : undefined;\n\n if (\n isTypedFieldDef(fieldDef) &&\n isUnitModel(model) &&\n hasBandEnd(fieldDef, channelDef2, model.markDef, model.config)\n ) {\n dims.add(vgField(fieldDef, {}));\n dims.add(vgField(fieldDef, {suffix: 'end'}));\n\n const {mark, markDef, config} = model;\n\n const bandPosition = getBandPosition({fieldDef, markDef, config});\n\n if (isRectBasedMark(mark) && bandPosition !== 0.5 && isXorY(channel)) {\n dims.add(vgField(fieldDef, {suffix: OFFSETTED_RECT_START_SUFFIX}));\n dims.add(vgField(fieldDef, {suffix: OFFSETTED_RECT_END_SUFFIX}));\n }\n\n if (fieldDef.bin && binRequiresRange(fieldDef, channel)) {\n dims.add(vgField(fieldDef, {binSuffix: 'range'}));\n }\n } else if (isGeoPositionChannel(channel)) {\n const posChannel = getPositionChannelFromLatLong(channel);\n dims.add(model.getName(posChannel));\n } else {\n dims.add(vgField(fieldDef));\n }\n if (isScaleFieldDef(fieldDef) && isFieldRange(fieldDef.scale?.range)) {\n dims.add(fieldDef.scale.range.field);\n }\n return dims;\n}\n\nfunction mergeMeasures(parentMeasures: Measures, childMeasures: Measures) {\n for (const field of keys(childMeasures)) {\n // when we merge a measure, we either have to add an aggregation operator or even a new field\n const ops = childMeasures[field];\n for (const op of keys(ops)) {\n if (field in parentMeasures) {\n // add operator to existing measure field\n parentMeasures[field][op] = new Set([...(parentMeasures[field][op] ?? []), ...ops[op]]);\n } else {\n parentMeasures[field] = {[op]: ops[op]};\n }\n }\n }\n}\n\nexport class AggregateNode extends DataFlowNode {\n public clone() {\n return new AggregateNode(null, new Set(this.dimensions), duplicate(this.measures));\n }\n\n /**\n * @param dimensions string set for dimensions\n * @param measures dictionary mapping field name => dict of aggregation functions and names to use\n */\n constructor(\n parent: DataFlowNode,\n private dimensions: Set,\n private measures: Measures\n ) {\n super(parent);\n }\n\n get groupBy() {\n return this.dimensions;\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel): AggregateNode {\n let isAggregate = false;\n model.forEachFieldDef(fd => {\n if (fd.aggregate) {\n isAggregate = true;\n }\n });\n\n const meas: Measures = {};\n const dims = new Set();\n\n if (!isAggregate) {\n // no need to create this node if the model has no aggregation\n return null;\n }\n\n model.forEachFieldDef((fieldDef, channel: Channel) => {\n const {aggregate, field} = fieldDef;\n if (aggregate) {\n if (aggregate === 'count') {\n meas['*'] ??= {};\n meas['*']['count'] = new Set([vgField(fieldDef, {forAs: true})]);\n } else {\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n const op = isArgminDef(aggregate) ? 'argmin' : 'argmax';\n const argField = aggregate[op];\n meas[argField] ??= {};\n meas[argField][op] = new Set([vgField({op, field: argField}, {forAs: true})]);\n } else {\n meas[field] ??= {};\n meas[field][aggregate] = new Set([vgField(fieldDef, {forAs: true})]);\n }\n\n // For scale channel with domain === 'unaggregated', add min/max so we can use their union as unaggregated domain\n if (isScaleChannel(channel) && model.scaleDomain(channel) === 'unaggregated') {\n meas[field] ??= {};\n meas[field]['min'] = new Set([vgField({field, aggregate: 'min'}, {forAs: true})]);\n meas[field]['max'] = new Set([vgField({field, aggregate: 'max'}, {forAs: true})]);\n }\n }\n } else {\n addDimension(dims, channel, fieldDef, model);\n }\n });\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public static makeFromTransform(parent: DataFlowNode, t: AggregateTransform): AggregateNode {\n const dims = new Set();\n const meas: Measures = {};\n\n for (const s of t.aggregate) {\n const {op, field, as} = s;\n if (op) {\n if (op === 'count') {\n meas['*'] ??= {};\n meas['*']['count'] = new Set([as ? as : vgField(s, {forAs: true})]);\n } else {\n meas[field] ??= {};\n meas[field][op] = new Set([as ? as : vgField(s, {forAs: true})]);\n }\n }\n }\n\n for (const s of t.groupby ?? []) {\n dims.add(s);\n }\n\n if (dims.size + keys(meas).length === 0) {\n return null;\n }\n\n return new AggregateNode(parent, dims, meas);\n }\n\n public merge(other: AggregateNode): boolean {\n if (setEqual(this.dimensions, other.dimensions)) {\n mergeMeasures(this.measures, other.measures);\n return true;\n }\n log.debug('different dimensions, cannot merge');\n return false;\n }\n\n public addDimensions(fields: readonly string[]) {\n fields.forEach(this.dimensions.add, this.dimensions);\n }\n\n public dependentFields() {\n return new Set([...this.dimensions, ...keys(this.measures)]);\n }\n\n public producedFields() {\n const out = new Set();\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n const m = this.measures[field][op];\n if (m.size === 0) {\n out.add(`${op}_${field}`);\n } else {\n m.forEach(out.add, out);\n }\n }\n }\n\n return out;\n }\n\n public hash() {\n return `Aggregate ${hash({dimensions: this.dimensions, measures: this.measures})}`;\n }\n\n public assemble(): VgAggregateTransform {\n const ops: AggregateOp[] = [];\n const fields: string[] = [];\n const as: string[] = [];\n\n for (const field of keys(this.measures)) {\n for (const op of keys(this.measures[field])) {\n for (const alias of this.measures[field][op]) {\n as.push(alias);\n ops.push(op);\n fields.push(field === '*' ? null : replacePathInField(field));\n }\n }\n }\n\n const result: VgAggregateTransform = {\n type: 'aggregate',\n groupby: [...this.dimensions].map(replacePathInField),\n ops,\n fields,\n as\n };\n\n return result;\n }\n}\n","import {AggregateOp} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {COLUMN, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../../channel';\nimport {vgField} from '../../channeldef';\nimport * as log from '../../log';\nimport {hasDiscreteDomain} from '../../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField} from '../../sort';\nimport {hash} from '../../util';\nimport {isVgRangeStep, VgData} from '../../vega.schema';\nimport {FacetModel} from '../facet';\nimport {HEADER_CHANNELS, HEADER_TYPES} from '../header/component';\nimport {Model} from '../model';\nimport {assembleDomain, getFieldFromDomain} from '../scale/domain';\nimport {sortArrayIndexField} from './calculate';\nimport {DataFlowNode} from './dataflow';\n\ninterface ChildIndependentFieldsWithStep {\n x?: string;\n y?: string;\n}\n\ninterface FacetChannelInfo {\n name: string;\n fields: string[];\n sortField?: EncodingSortField;\n\n sortIndexField?: string;\n}\n\n/**\n * A node that helps us track what fields we are faceting by.\n */\nexport class FacetNode extends DataFlowNode {\n private readonly column: FacetChannelInfo;\n\n private readonly row: FacetChannelInfo;\n\n private readonly facet: FacetChannelInfo;\n\n private readonly childModel: Model;\n\n /**\n * @param model The facet model.\n * @param name The name that this facet source will have.\n * @param data The source data for this facet data.\n */\n public constructor(\n parent: DataFlowNode,\n public readonly model: FacetModel,\n public readonly name: string,\n public data: string\n ) {\n super(parent);\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = model.facet[channel];\n if (fieldDef) {\n const {bin, sort} = fieldDef;\n this[channel] = {\n name: model.getName(`${channel}_domain`),\n fields: [vgField(fieldDef), ...(isBinning(bin) ? [vgField(fieldDef, {binSuffix: 'end'})] : [])],\n ...(isSortField(sort)\n ? {sortField: sort}\n : isArray(sort)\n ? {sortIndexField: sortArrayIndexField(fieldDef, channel)}\n : {})\n };\n }\n }\n this.childModel = model.child;\n }\n\n public hash() {\n let out = `Facet`;\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n out += ` ${channel.charAt(0)}:${hash(this[channel])}`;\n }\n }\n\n return out;\n }\n\n get fields() {\n const f: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]?.fields) {\n f.push(...this[channel].fields);\n }\n }\n return f;\n }\n\n public dependentFields() {\n const depFields = new Set(this.fields);\n\n for (const channel of FACET_CHANNELS) {\n if (this[channel]) {\n if (this[channel].sortField) {\n depFields.add(this[channel].sortField.field);\n }\n if (this[channel].sortIndexField) {\n depFields.add(this[channel].sortIndexField);\n }\n }\n }\n\n return depFields;\n }\n\n public producedFields() {\n return new Set(); // facet does not produce any new fields\n }\n\n /**\n * The name to reference this source is its name.\n */\n public getSource() {\n return this.name;\n }\n\n private getChildIndependentFieldsWithStep() {\n const childIndependentFieldsWithStep: ChildIndependentFieldsWithStep = {};\n\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.childModel.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n // independent scale\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.childModel, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n childIndependentFieldsWithStep[channel] = field;\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n\n return childIndependentFieldsWithStep;\n }\n\n private assembleRowColumnHeaderData(\n channel: 'row' | 'column' | 'facet',\n crossedDataName: string,\n childIndependentFieldsWithStep: ChildIndependentFieldsWithStep\n ): VgData {\n const childChannel = {row: 'y', column: 'x', facet: undefined}[channel];\n\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (childChannel && childIndependentFieldsWithStep && childIndependentFieldsWithStep[childChannel]) {\n if (crossedDataName) {\n // If there is a crossed data, calculate max\n fields.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n\n ops.push('max');\n } else {\n // If there is no crossed data, just calculate distinct\n fields.push(childIndependentFieldsWithStep[childChannel]);\n ops.push('distinct');\n }\n // Although it is technically a max, just name it distinct so it's easier to refer to it\n as.push(`distinct_${childIndependentFieldsWithStep[childChannel]}`);\n }\n\n const {sortField, sortIndexField} = this[channel];\n if (sortField) {\n const {op = DEFAULT_SORT_OP, field} = sortField;\n fields.push(field);\n ops.push(op);\n as.push(vgField(sortField, {forAs: true}));\n } else if (sortIndexField) {\n fields.push(sortIndexField);\n ops.push('max');\n as.push(sortIndexField);\n }\n\n return {\n name: this[channel].name,\n // Use data from the crossed one if it exist\n source: crossedDataName ?? this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this[channel].fields,\n ...(fields.length\n ? {\n fields,\n ops,\n as\n }\n : {})\n }\n ]\n };\n }\n\n private assembleFacetHeaderData(childIndependentFieldsWithStep: ChildIndependentFieldsWithStep) {\n const {columns} = this.model.layout;\n const {layoutHeaders} = this.model.component;\n const data: VgData[] = [];\n\n const hasSharedAxis: {row?: true; column?: true} = {};\n for (const headerChannel of HEADER_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const headers = (layoutHeaders[headerChannel] && layoutHeaders[headerChannel][headerType]) ?? [];\n for (const header of headers) {\n if (header.axes?.length > 0) {\n hasSharedAxis[headerChannel] = true;\n break;\n }\n }\n }\n\n if (hasSharedAxis[headerChannel]) {\n const cardinality = `length(data(\"${this.facet.name}\"))`;\n\n const stop =\n headerChannel === 'row'\n ? columns\n ? {signal: `ceil(${cardinality} / ${columns})`}\n : 1\n : columns\n ? {signal: `min(${cardinality}, ${columns})`}\n : {signal: cardinality};\n\n data.push({\n name: `${this.facet.name}_${headerChannel}`,\n transform: [\n {\n type: 'sequence',\n start: 0,\n stop\n }\n ]\n });\n }\n }\n\n const {row, column} = hasSharedAxis;\n\n if (row || column) {\n data.unshift(this.assembleRowColumnHeaderData('facet', null, childIndependentFieldsWithStep));\n }\n\n return data;\n }\n\n public assemble() {\n const data: VgData[] = [];\n let crossedDataName = null;\n const childIndependentFieldsWithStep = this.getChildIndependentFieldsWithStep();\n\n const {column, row, facet} = this;\n\n if (column && row && (childIndependentFieldsWithStep.x || childIndependentFieldsWithStep.y)) {\n // Need to create a cross dataset to correctly calculate cardinality\n crossedDataName = `cross_${this.column.name}_${this.row.name}`;\n\n const fields: string[] = [].concat(\n childIndependentFieldsWithStep.x ?? [],\n childIndependentFieldsWithStep.y ?? []\n );\n const ops = fields.map((): AggregateOp => 'distinct');\n\n data.push({\n name: crossedDataName,\n source: this.data,\n transform: [\n {\n type: 'aggregate',\n groupby: this.fields,\n fields,\n ops\n }\n ]\n });\n }\n\n for (const channel of [COLUMN, ROW]) {\n if (this[channel]) {\n data.push(this.assembleRowColumnHeaderData(channel, crossedDataName, childIndependentFieldsWithStep));\n }\n }\n\n if (facet) {\n const facetData = this.assembleFacetHeaderData(childIndependentFieldsWithStep);\n if (facetData) {\n data.push(...facetData);\n }\n }\n\n return data;\n }\n}\n","import {FormulaTransform as VgFormulaTransform, SignalRef} from 'vega';\nimport {isNumber, isString} from 'vega-util';\nimport {AncestorParse} from '.';\nimport {isMinMaxOp} from '../../aggregate';\nimport {getMainRangeChannel, SingleDefChannel} from '../../channel';\nimport {\n isFieldDef,\n isFieldOrDatumDefForTimeFormat,\n isScaleFieldDef,\n isTypedFieldDef,\n TypedFieldDef\n} from '../../channeldef';\nimport {isGenerator, Parse} from '../../data';\nimport {DateTime, isDateTime} from '../../datetime';\nimport * as log from '../../log';\nimport {forEachLeaf} from '../../logical';\nimport {isPathMark} from '../../mark';\nimport {\n isFieldEqualPredicate,\n isFieldGTEPredicate,\n isFieldGTPredicate,\n isFieldLTEPredicate,\n isFieldLTPredicate,\n isFieldOneOfPredicate,\n isFieldPredicate,\n isFieldRangePredicate\n} from '../../predicate';\nimport {isSortField} from '../../sort';\nimport {FilterTransform} from '../../transform';\nimport {accessPathDepth, accessPathWithDatum, Dict, duplicate, hash, keys, removePathFromField} from '../../util';\nimport {signalRefOrValue} from '../common';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {Split} from '../split';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * Remove quotes from a string.\n */\nfunction unquote(pattern: string) {\n if ((pattern.startsWith(\"'\") && pattern.endsWith(\"'\")) || (pattern.startsWith('\"') && pattern.endsWith('\"'))) {\n return pattern.slice(1, -1);\n }\n return pattern;\n}\n\n/**\n * @param field The field.\n * @param parse What to parse the field as.\n */\nfunction parseExpression(field: string, parse: string): string {\n const f = accessPathWithDatum(field);\n if (parse === 'number') {\n return `toNumber(${f})`;\n } else if (parse === 'boolean') {\n return `toBoolean(${f})`;\n } else if (parse === 'string') {\n return `toString(${f})`;\n } else if (parse === 'date') {\n return `toDate(${f})`;\n } else if (parse === 'flatten') {\n return f;\n } else if (parse.startsWith('date:')) {\n const specifier = unquote(parse.slice(5, parse.length));\n return `timeParse(${f},'${specifier}')`;\n } else if (parse.startsWith('utc:')) {\n const specifier = unquote(parse.slice(4, parse.length));\n return `utcParse(${f},'${specifier}')`;\n } else {\n log.warn(log.message.unrecognizedParse(parse));\n return null;\n }\n}\n\nexport function getImplicitFromFilterTransform(transform: FilterTransform) {\n const implicit: Dict = {};\n forEachLeaf(transform.filter, filter => {\n if (isFieldPredicate(filter)) {\n // Automatically add a parse node for filters with filter objects\n let val: string | number | boolean | DateTime | SignalRef = null;\n\n // For EqualFilter, just use the equal property.\n // For RangeFilter and OneOfFilter, all array members should have\n // the same type, so we only use the first one.\n if (isFieldEqualPredicate(filter)) {\n val = signalRefOrValue(filter.equal);\n } else if (isFieldLTEPredicate(filter)) {\n val = signalRefOrValue(filter.lte);\n } else if (isFieldLTPredicate(filter)) {\n val = signalRefOrValue(filter.lt);\n } else if (isFieldGTPredicate(filter)) {\n val = signalRefOrValue(filter.gt);\n } else if (isFieldGTEPredicate(filter)) {\n val = signalRefOrValue(filter.gte);\n } else if (isFieldRangePredicate(filter)) {\n val = filter.range[0];\n } else if (isFieldOneOfPredicate(filter)) {\n val = (filter.oneOf ?? filter['in'])[0];\n } // else -- for filter expression, we can't infer anything\n\n if (val) {\n if (isDateTime(val)) {\n implicit[filter.field] = 'date';\n } else if (isNumber(val)) {\n implicit[filter.field] = 'number';\n } else if (isString(val)) {\n implicit[filter.field] = 'string';\n }\n }\n\n if (filter.timeUnit) {\n implicit[filter.field] = 'date';\n }\n }\n });\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromEncoding(model: Model) {\n const implicit: Dict = {};\n\n function add(fieldDef: TypedFieldDef) {\n if (isFieldOrDatumDefForTimeFormat(fieldDef)) {\n implicit[fieldDef.field] = 'date';\n } else if (\n fieldDef.type === 'quantitative' &&\n isMinMaxOp(fieldDef.aggregate) // we need to parse numbers to support correct min and max\n ) {\n implicit[fieldDef.field] = 'number';\n } else if (accessPathDepth(fieldDef.field) > 1) {\n // For non-date/non-number (strings and booleans), derive a flattened field for a referenced nested field.\n // (Parsing numbers / dates already flattens numeric and temporal fields.)\n if (!(fieldDef.field in implicit)) {\n implicit[fieldDef.field] = 'flatten';\n }\n } else if (isScaleFieldDef(fieldDef) && isSortField(fieldDef.sort) && accessPathDepth(fieldDef.sort.field) > 1) {\n // Flatten fields that we sort by but that are not otherwise flattened.\n if (!(fieldDef.sort.field in implicit)) {\n implicit[fieldDef.sort.field] = 'flatten';\n }\n }\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n // Parse encoded fields\n model.forEachFieldDef((fieldDef, channel) => {\n if (isTypedFieldDef(fieldDef)) {\n add(fieldDef);\n } else {\n const mainChannel = getMainRangeChannel(channel);\n const mainFieldDef = model.fieldDef(mainChannel as SingleDefChannel) as TypedFieldDef;\n add({\n ...fieldDef,\n type: mainFieldDef.type\n });\n }\n });\n }\n\n // Parse quantitative dimension fields of path marks as numbers so that we sort them correctly.\n if (isUnitModel(model)) {\n const {mark, markDef, encoding} = model;\n if (\n isPathMark(mark) &&\n // No need to sort by dimension if we have a connected scatterplot (order channel is present)\n !model.encoding.order\n ) {\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (\n isFieldDef(dimensionChannelDef) &&\n dimensionChannelDef.type === 'quantitative' &&\n !(dimensionChannelDef.field in implicit)\n ) {\n implicit[dimensionChannelDef.field] = 'number';\n }\n }\n }\n\n return implicit;\n}\n\n/**\n * Creates a parse node for implicit parsing from a model and updates ancestorParse.\n */\nexport function getImplicitFromSelection(model: Model) {\n const implicit: Dict = {};\n\n if (isUnitModel(model) && model.component.selection) {\n for (const name of keys(model.component.selection)) {\n const selCmpt = model.component.selection[name];\n for (const proj of selCmpt.project.items) {\n if (!proj.channel && accessPathDepth(proj.field) > 1) {\n implicit[proj.field] = 'flatten';\n }\n }\n }\n }\n\n return implicit;\n}\n\nexport class ParseNode extends DataFlowNode {\n private _parse: Parse;\n\n public clone() {\n return new ParseNode(null, duplicate(this._parse));\n }\n\n constructor(parent: DataFlowNode, parse: Parse) {\n super(parent);\n\n this._parse = parse;\n }\n\n public hash() {\n return `Parse ${hash(this._parse)}`;\n }\n\n /**\n * Creates a parse node from a data.format.parse and updates ancestorParse.\n */\n public static makeExplicit(parent: DataFlowNode, model: Model, ancestorParse: AncestorParse) {\n // Custom parse\n let explicit = {};\n const data = model.data;\n if (!isGenerator(data) && data?.format?.parse) {\n explicit = data.format.parse;\n }\n\n return this.makeWithAncestors(parent, explicit, {}, ancestorParse);\n }\n\n /**\n * Creates a parse node from \"explicit\" parse and \"implicit\" parse and updates ancestorParse.\n */\n public static makeWithAncestors(\n parent: DataFlowNode,\n explicit: Parse,\n implicit: Parse,\n ancestorParse: AncestorParse\n ) {\n // We should not parse what has already been parsed in a parent (explicitly or implicitly) or what has been derived (maked as \"derived\"). We also don't need to flatten a field that has already been parsed.\n for (const field of keys(implicit)) {\n const parsedAs = ancestorParse.getWithExplicit(field);\n if (parsedAs.value !== undefined) {\n // We always ignore derived fields even if they are implicitly defined because we expect users to create the right types.\n if (\n parsedAs.explicit ||\n parsedAs.value === implicit[field] ||\n parsedAs.value === 'derived' ||\n implicit[field] === 'flatten'\n ) {\n delete implicit[field];\n } else {\n log.warn(log.message.differentParse(field, implicit[field], parsedAs.value));\n }\n }\n }\n\n for (const field of keys(explicit)) {\n const parsedAs = ancestorParse.get(field);\n if (parsedAs !== undefined) {\n // Don't parse a field again if it has been parsed with the same type already.\n if (parsedAs === explicit[field]) {\n delete explicit[field];\n } else {\n log.warn(log.message.differentParse(field, explicit[field], parsedAs));\n }\n }\n }\n\n const parse = new Split(explicit, implicit);\n\n // add the format parse from this model so that children don't parse the same field again\n ancestorParse.copyAll(parse);\n\n // copy only non-null parses\n const p: Dict = {};\n for (const key of keys(parse.combine())) {\n const val = parse.get(key);\n if (val !== null) {\n p[key] = val;\n }\n }\n\n if (keys(p).length === 0 || ancestorParse.parseNothing) {\n return null;\n }\n\n return new ParseNode(parent, p);\n }\n\n public get parse() {\n return this._parse;\n }\n\n public merge(other: ParseNode) {\n this._parse = {...this._parse, ...other.parse};\n other.remove();\n }\n\n /**\n * Assemble an object for Vega's format.parse property.\n */\n public assembleFormatParse() {\n const formatParse: Dict = {};\n for (const field of keys(this._parse)) {\n const p = this._parse[field];\n if (accessPathDepth(field) === 1) {\n formatParse[field] = p;\n }\n }\n return formatParse;\n }\n\n // format parse depends and produces all fields in its parse\n public producedFields() {\n return new Set(keys(this._parse));\n }\n\n public dependentFields() {\n return new Set(keys(this._parse));\n }\n\n public assembleTransforms(onlyNested = false): VgFormulaTransform[] {\n return keys(this._parse)\n .filter(field => (onlyNested ? accessPathDepth(field) > 1 : true))\n .map(field => {\n const expr = parseExpression(field, this._parse[field]);\n if (!expr) {\n return null;\n }\n\n const formula: VgFormulaTransform = {\n type: 'formula',\n expr,\n as: removePathFromField(field) // Vega output is always flattened\n };\n return formula;\n })\n .filter(t => t !== null);\n }\n}\n","import {SELECTION_ID} from '../../selection';\nimport {IdentifierTransform as VgIdentifierTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class IdentifierNode extends DataFlowNode {\n public clone() {\n return new IdentifierNode(null);\n }\n\n constructor(parent: DataFlowNode) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([SELECTION_ID]);\n }\n\n public hash() {\n return 'Identifier';\n }\n\n public assemble(): VgIdentifierTransform {\n return {type: 'identifier', as: SELECTION_ID};\n }\n}\n","import {GraticuleTransform as VgGraticuleTransform} from 'vega';\nimport {GraticuleParams} from '../../data';\nimport {hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\nexport class GraticuleNode extends DataFlowNode {\n public clone() {\n return new GraticuleNode(null, this.params);\n }\n\n constructor(\n parent: DataFlowNode,\n private params: true | GraticuleParams\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // there should never be a node before graticule\n }\n\n public hash() {\n return `Graticule ${hash(this.params)}`;\n }\n\n public assemble(): VgGraticuleTransform {\n return {\n type: 'graticule',\n ...(this.params === true ? {} : this.params)\n };\n }\n}\n","import {SequenceParams} from '../../data';\nimport {hash} from '../../util';\nimport {SequenceTransform as VgSequenceTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\nexport class SequenceNode extends DataFlowNode {\n public clone() {\n return new SequenceNode(null, this.params);\n }\n\n constructor(\n parent: DataFlowNode,\n private params: SequenceParams\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set([this.params.as ?? 'data']);\n }\n\n public hash() {\n return `Hash ${hash(this.params)}`;\n }\n\n public assemble(): VgSequenceTransform {\n return {\n type: 'sequence',\n ...this.params\n };\n }\n}\n","import {\n Data,\n DataFormat,\n DataFormatType,\n isGenerator,\n isInlineData,\n isNamedData,\n isSphereGenerator,\n isUrlData\n} from '../../data';\nimport {contains, isEmpty, omit} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataFlowNode} from './dataflow';\n\nexport class SourceNode extends DataFlowNode {\n private _data: Partial;\n\n private _name: string;\n\n private _generator: boolean;\n\n constructor(data: Data) {\n super(null); // source cannot have parent\n\n data ??= {name: 'source'};\n let format;\n\n if (!isGenerator(data)) {\n format = data.format ? {...omit(data.format, ['parse'])} : ({} as DataFormat);\n }\n\n if (isInlineData(data)) {\n this._data = {values: data.values};\n } else if (isUrlData(data)) {\n this._data = {url: data.url};\n\n if (!format.type) {\n // Extract extension from URL using snippet from\n // http://stackoverflow.com/questions/680929/how-to-extract-extension-from-filename-string-in-javascript\n let defaultExtension = /(?:\\.([^.]+))?$/.exec(data.url)[1];\n if (!contains(['json', 'csv', 'tsv', 'dsv', 'topojson'], defaultExtension)) {\n defaultExtension = 'json';\n }\n\n // defaultExtension has type string but we ensure that it is DataFormatType above\n format.type = defaultExtension as DataFormatType;\n }\n } else if (isSphereGenerator(data)) {\n // hardwire GeoJSON sphere data into output specification\n this._data = {values: [{type: 'Sphere'}]};\n } else if (isNamedData(data) || isGenerator(data)) {\n this._data = {};\n }\n\n // set flag to check if generator\n this._generator = isGenerator(data);\n\n // any dataset can be named\n if (data.name) {\n this._name = data.name;\n }\n\n if (format && !isEmpty(format)) {\n this._data.format = format;\n }\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields(): undefined {\n return undefined; // we don't know what this source produces\n }\n\n get data() {\n return this._data;\n }\n\n public hasName(): boolean {\n return !!this._name;\n }\n\n get isGenerator() {\n return this._generator;\n }\n\n get dataName() {\n return this._name;\n }\n\n set dataName(name: string) {\n this._name = name;\n }\n\n set parent(parent: DataFlowNode) {\n throw new Error('Source nodes have to be roots.');\n }\n\n public remove() {\n throw new Error('Source nodes are roots and cannot be removed.');\n }\n\n public hash(): string | number {\n throw new Error('Cannot hash sources');\n }\n\n public assemble(): VgData {\n return {\n name: this._name,\n ...this._data,\n transform: []\n };\n }\n}\n","import {DataFlowNode} from './dataflow';\nimport {GraticuleNode} from './graticule';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\n\n/**\n * Whether this dataflow node is the source of the dataflow that produces data i.e. a source or a generator.\n */\nexport function isDataSourceNode(node: DataFlowNode) {\n return node instanceof SourceNode || node instanceof GraticuleNode || node instanceof SequenceNode;\n}\n\n/**\n * Abstract base class for Dataflow optimizers.\n * Contains only mutation handling logic. Subclasses need to implement iteration logic.\n */\nexport abstract class Optimizer {\n #modified: boolean;\n\n constructor() {\n this.#modified = false;\n }\n\n // Once true, #modified is never set to false\n public setModified() {\n this.#modified = true;\n }\n\n get modifiedFlag() {\n return this.#modified;\n }\n\n /**\n * Run the optimization for the tree with the provided root.\n */\n public abstract optimize(root: DataFlowNode): boolean;\n}\n\n/**\n * Starts from a node and runs the optimization function (the \"run\" method) upwards to the root,\n * depending on the continue and modified flag values returned by the optimization function.\n */\nexport abstract class BottomUpOptimizer extends Optimizer {\n /**\n * Run the optimizer at the node. This method should not change the parent of the passed in node (it should only affect children).\n */\n public abstract run(node: DataFlowNode): void;\n\n /**\n * Compute a map of node depths that we can use to determine a topological sort order.\n */\n private getNodeDepths(\n node: DataFlowNode,\n depth: number,\n depths: Map\n ): Map {\n depths.set(node, depth);\n\n for (const child of node.children) {\n this.getNodeDepths(child, depth + 1, depths);\n }\n\n return depths;\n }\n\n /**\n * Run the optimizer on all nodes starting from the leaves.\n */\n public optimize(node: DataFlowNode): boolean {\n const depths = this.getNodeDepths(node, 0, new Map());\n const topologicalSort = [...depths.entries()].sort((a, b) => b[1] - a[1]);\n\n for (const tuple of topologicalSort) {\n this.run(tuple[0]);\n }\n\n return this.modifiedFlag;\n }\n}\n\n/**\n * The optimizer function (the \"run\" method), is invoked on the given node and then continues recursively.\n */\nexport abstract class TopDownOptimizer extends Optimizer {\n /**\n * Run the optimizer at the node.\n */\n public abstract run(node: DataFlowNode): void;\n\n /**\n * Run the optimizer depth first on all nodes starting from the roots.\n */\n public optimize(node: DataFlowNode): boolean {\n this.run(node);\n\n for (const child of node.children) {\n this.optimize(child);\n }\n\n return this.modifiedFlag;\n }\n}\n","import {Parse} from '../../data';\nimport {Dict, fieldIntersection, hash, hasIntersection, isEmpty, keys, some} from '../../util';\nimport {Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {ParseNode} from './formatparse';\nimport {IdentifierNode} from './identifier';\nimport {BottomUpOptimizer, isDataSourceNode, Optimizer, TopDownOptimizer} from './optimizer';\nimport {SourceNode} from './source';\nimport {TimeUnitNode} from './timeunit';\n\n/**\n * Merge identical nodes at forks by comparing hashes.\n *\n * Does not need to iterate from leaves so we implement this with recursion as it's a bit simpler.\n */\nexport class MergeIdenticalNodes extends TopDownOptimizer {\n public mergeNodes(parent: DataFlowNode, nodes: DataFlowNode[]) {\n const mergedNode = nodes.shift();\n for (const node of nodes) {\n parent.removeChild(node);\n node.parent = mergedNode;\n node.remove();\n }\n }\n\n public run(node: DataFlowNode) {\n const hashes = node.children.map(x => x.hash());\n const buckets: {hash?: DataFlowNode[]} = {};\n\n for (let i = 0; i < hashes.length; i++) {\n if (buckets[hashes[i]] === undefined) {\n buckets[hashes[i]] = [node.children[i]];\n } else {\n buckets[hashes[i]].push(node.children[i]);\n }\n }\n\n for (const k of keys(buckets)) {\n if (buckets[k].length > 1) {\n this.setModified();\n this.mergeNodes(node, buckets[k]);\n }\n }\n }\n}\n\n/**\n * Optimizer that removes identifier nodes that are not needed for selections.\n */\nexport class RemoveUnnecessaryIdentifierNodes extends TopDownOptimizer {\n private requiresSelectionId: boolean;\n\n constructor(model: Model) {\n super();\n this.requiresSelectionId = model && requiresSelectionId(model);\n }\n\n public run(node: DataFlowNode) {\n if (node instanceof IdentifierNode) {\n // Only preserve IdentifierNodes if we have default discrete selections\n // in our model tree, and if the nodes come after tuple producing nodes.\n if (\n !(\n this.requiresSelectionId &&\n (isDataSourceNode(node.parent) || node.parent instanceof AggregateNode || node.parent instanceof ParseNode)\n )\n ) {\n this.setModified();\n node.remove();\n }\n }\n }\n}\n\n/**\n * Removes duplicate time unit nodes (as determined by the name of the output field) that may be generated due to\n * selections projected over time units. Only keeps the first time unit in any branch.\n *\n * This optimizer is a custom top down optimizer that keep track of produced fields in a branch.\n */\nexport class RemoveDuplicateTimeUnits extends Optimizer {\n public optimize(node: DataFlowNode): boolean {\n this.run(node, new Set());\n\n return this.modifiedFlag;\n }\n\n public run(node: DataFlowNode, timeUnitFields: Set) {\n let producedFields = new Set();\n\n if (node instanceof TimeUnitNode) {\n producedFields = node.producedFields();\n if (hasIntersection(producedFields, timeUnitFields)) {\n this.setModified();\n node.removeFormulas(timeUnitFields);\n if (node.producedFields.length === 0) {\n node.remove();\n }\n }\n }\n\n for (const child of node.children) {\n this.run(child, new Set([...timeUnitFields, ...producedFields]));\n }\n }\n}\n\n/**\n * Remove output nodes that are not required.\n */\nexport class RemoveUnnecessaryOutputNodes extends TopDownOptimizer {\n constructor() {\n super();\n }\n\n public run(node: DataFlowNode) {\n if (node instanceof OutputNode && !node.isRequired()) {\n this.setModified();\n node.remove();\n }\n }\n}\n\n/**\n * Move parse nodes up to forks and merges them if possible.\n */\nexport class MoveParseUp extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n if (isDataSourceNode(node)) {\n return;\n }\n\n if (node.numChildren() > 1) {\n // Don't move parse further up but continue with parent.\n return;\n }\n\n for (const child of node.children) {\n if (child instanceof ParseNode) {\n if (node instanceof ParseNode) {\n this.setModified();\n node.merge(child);\n } else {\n // Don't swap with nodes that produce something that the parse node depends on (e.g. lookup).\n if (fieldIntersection(node.producedFields(), child.dependentFields())) {\n continue;\n }\n this.setModified();\n child.swapWithParent();\n }\n }\n }\n\n return;\n }\n}\n\n/**\n * Inserts an intermediate ParseNode containing all non-conflicting parse fields and removes the empty ParseNodes.\n *\n * We assume that dependent paths that do not have a parse node can be just merged.\n */\nexport class MergeParse extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const originalChildren = [...node.children];\n const parseChildren = node.children.filter((child): child is ParseNode => child instanceof ParseNode);\n\n if (node.numChildren() > 1 && parseChildren.length >= 1) {\n const commonParse: Parse = {};\n const conflictingParse = new Set();\n for (const parseNode of parseChildren) {\n const parse = parseNode.parse;\n for (const k of keys(parse)) {\n if (!(k in commonParse)) {\n commonParse[k] = parse[k];\n } else if (commonParse[k] !== parse[k]) {\n conflictingParse.add(k);\n }\n }\n }\n\n for (const field of conflictingParse) {\n delete commonParse[field];\n }\n\n if (!isEmpty(commonParse)) {\n this.setModified();\n const mergedParseNode = new ParseNode(node, commonParse);\n for (const childNode of originalChildren) {\n if (childNode instanceof ParseNode) {\n for (const key of keys(commonParse)) {\n delete childNode.parse[key];\n }\n }\n\n node.removeChild(childNode);\n childNode.parent = mergedParseNode;\n\n // remove empty parse nodes\n if (childNode instanceof ParseNode && keys(childNode.parse).length === 0) {\n childNode.remove();\n }\n }\n }\n }\n }\n}\n\n/**\n * Repeatedly remove leaf nodes that are not output or facet nodes.\n * The reason is that we don't need subtrees that don't have any output nodes.\n * Facet nodes are needed for the row or column domains.\n */\nexport class RemoveUnusedSubtrees extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n if (node instanceof OutputNode || node.numChildren() > 0 || node instanceof FacetNode) {\n // no need to continue with parent because it is output node or will have children (there was a fork)\n } else if (node instanceof SourceNode) {\n // ignore empty unused sources as they will be removed in optimizationDataflowHelper\n } else {\n this.setModified();\n node.remove();\n }\n }\n}\n\n/**\n * Merge adjacent time unit nodes.\n */\nexport class MergeTimeUnits extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const timeUnitChildren = node.children.filter((x): x is TimeUnitNode => x instanceof TimeUnitNode);\n const combination = timeUnitChildren.pop();\n for (const timeUnit of timeUnitChildren) {\n this.setModified();\n combination.merge(timeUnit);\n }\n }\n}\n\nexport class MergeAggregates extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const aggChildren = node.children.filter((child): child is AggregateNode => child instanceof AggregateNode);\n\n // Object which we'll use to map the fields which an aggregate is grouped by to\n // the set of aggregates with that grouping. This is useful as only aggregates\n // with the same group by can be merged\n const groupedAggregates: Dict = {};\n\n // Build groupedAggregates\n for (const agg of aggChildren) {\n const groupBys = hash(agg.groupBy);\n if (!(groupBys in groupedAggregates)) {\n groupedAggregates[groupBys] = [];\n }\n groupedAggregates[groupBys].push(agg);\n }\n\n // Merge aggregateNodes with same key in groupedAggregates\n for (const group of keys(groupedAggregates)) {\n const mergeableAggs = groupedAggregates[group];\n if (mergeableAggs.length > 1) {\n const mergedAggs = mergeableAggs.pop();\n for (const agg of mergeableAggs) {\n if (mergedAggs.merge(agg)) {\n node.removeChild(agg);\n agg.parent = mergedAggs;\n agg.remove();\n\n this.setModified();\n }\n }\n }\n }\n }\n}\n\n/**\n * Merge bin nodes and move them up through forks. Stop at filters, parse, identifier as we want them to stay before the bin node.\n */\nexport class MergeBins extends BottomUpOptimizer {\n constructor(private model: Model) {\n super();\n }\n\n public run(node: DataFlowNode) {\n const moveBinsUp = !(\n isDataSourceNode(node) ||\n node instanceof FilterNode ||\n node instanceof ParseNode ||\n node instanceof IdentifierNode\n );\n\n const promotableBins: BinNode[] = [];\n const remainingBins: BinNode[] = [];\n\n for (const child of node.children) {\n if (child instanceof BinNode) {\n if (moveBinsUp && !fieldIntersection(node.producedFields(), child.dependentFields())) {\n promotableBins.push(child);\n } else {\n remainingBins.push(child);\n }\n }\n }\n\n if (promotableBins.length > 0) {\n const promotedBin = promotableBins.pop();\n for (const bin of promotableBins) {\n promotedBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n if (node instanceof BinNode) {\n node.merge(promotedBin, this.model.renameSignal.bind(this.model));\n } else {\n promotedBin.swapWithParent();\n }\n }\n if (remainingBins.length > 1) {\n const remainingBin = remainingBins.pop();\n for (const bin of remainingBins) {\n remainingBin.merge(bin, this.model.renameSignal.bind(this.model));\n }\n this.setModified();\n }\n }\n}\n\n/**\n * This optimizer takes output nodes that are at a fork and moves them before the fork.\n *\n * The algorithm iterates over the children and tries to find the last output node in a chain of output nodes.\n * It then moves all output nodes before that main output node. All other children (and the children of the output nodes)\n * are inserted after the main output node.\n */\nexport class MergeOutputs extends BottomUpOptimizer {\n public run(node: DataFlowNode) {\n const children = [...node.children];\n const hasOutputChild = some(children, child => child instanceof OutputNode);\n\n if (!hasOutputChild || node.numChildren() <= 1) {\n return;\n }\n\n const otherChildren: DataFlowNode[] = [];\n\n // The output node we will connect all other nodes to.\n // Output nodes will be added before the new node, other nodes after.\n let mainOutput: OutputNode;\n\n for (const child of children) {\n if (child instanceof OutputNode) {\n let lastOutput = child;\n\n while (lastOutput.numChildren() === 1) {\n const [theChild] = lastOutput.children;\n if (theChild instanceof OutputNode) {\n lastOutput = theChild;\n } else {\n break;\n }\n }\n\n otherChildren.push(...lastOutput.children);\n\n if (mainOutput) {\n // Move the output nodes before the mainOutput. We do this by setting\n // the parent of the first not to the parent of the main output and\n // the main output's parent to the last output.\n\n // note: the child is the first output\n node.removeChild(child);\n child.parent = mainOutput.parent;\n\n mainOutput.parent.removeChild(mainOutput);\n mainOutput.parent = lastOutput;\n\n this.setModified();\n } else {\n mainOutput = lastOutput;\n }\n } else {\n otherChildren.push(child);\n }\n }\n\n if (otherChildren.length) {\n this.setModified();\n for (const child of otherChildren) {\n child.parent.removeChild(child);\n child.parent = mainOutput;\n }\n }\n }\n}\n","import {AggregateOp} from 'vega';\nimport {vgField} from '../../channeldef';\nimport {JoinAggregateTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgJoinAggregateTransform} from '../../vega.schema';\nimport {JoinAggregateFieldDef} from '../../transform';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the join aggregate transform nodes.\n */\nexport class JoinAggregateTransformNode extends DataFlowNode {\n public clone() {\n return new JoinAggregateTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: JoinAggregateTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n if (this.transform.groupby) {\n this.transform.groupby.forEach(out.add, out);\n }\n this.transform.joinaggregate\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.joinaggregate.map(this.getDefaultName));\n }\n\n private getDefaultName(joinAggregateFieldDef: JoinAggregateFieldDef): string {\n return joinAggregateFieldDef.as ?? vgField(joinAggregateFieldDef);\n }\n\n public hash() {\n return `JoinAggregateTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n for (const joinaggregate of this.transform.joinaggregate) {\n ops.push(joinaggregate.op);\n as.push(this.getDefaultName(joinaggregate));\n fields.push(joinaggregate.field === undefined ? null : joinaggregate.field);\n }\n\n const groupby = this.transform.groupby;\n\n return {\n type: 'joinaggregate',\n as,\n ops,\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {Transforms as VgTransform} from 'vega';\nimport {isArray, isString} from 'vega-util';\nimport {FieldDef, FieldName, getFieldDef, isFieldDef, isOrderOnlyDef, vgField} from '../../channeldef';\nimport {SortFields, SortOrder} from '../../sort';\nimport {StackOffset} from '../../stack';\nimport {StackTransform} from '../../transform';\nimport {duplicate, getFirstDefined, hash} from '../../util';\nimport {sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nfunction getStackByFields(model: UnitModel): string[] {\n return model.stack.stackBy.reduce((fields, by) => {\n const fieldDef = by.fieldDef;\n\n const _field = vgField(fieldDef);\n if (_field) {\n fields.push(_field);\n }\n return fields;\n }, [] as string[]);\n}\n\nexport interface StackComponent {\n /**\n * Faceted field.\n */\n facetby: string[];\n\n dimensionFieldDefs: FieldDef[];\n\n /**\n * Stack measure's field. Used in makeFromEncoding.\n */\n stackField: string;\n\n /**\n * Level of detail fields for each level in the stacked charts such as color or detail.\n * Used in makeFromEncoding.\n */\n stackby?: string[];\n\n /**\n * Field that determines order of levels in the stacked charts.\n * Used in both but optional in transform.\n */\n sort: SortFields;\n\n /** Mode for stacking marks.\n */\n offset: StackOffset;\n\n /**\n * Whether to impute the data before stacking. Used only in makeFromEncoding.\n */\n impute?: boolean;\n\n /**\n * The data fields to group by.\n */\n groupby?: FieldName[];\n /**\n * Output field names of each stack field.\n */\n as: [FieldName, FieldName];\n}\n\nfunction isValidAsArray(as: string[] | string): as is string[] {\n return isArray(as) && as.every(s => isString(s)) && as.length > 1;\n}\n\nexport class StackNode extends DataFlowNode {\n private _stack: StackComponent;\n\n public clone() {\n return new StackNode(null, duplicate(this._stack));\n }\n\n constructor(parent: DataFlowNode, stack: StackComponent) {\n super(parent);\n\n this._stack = stack;\n }\n\n public static makeFromTransform(parent: DataFlowNode, stackTransform: StackTransform) {\n const {stack, groupby, as, offset = 'zero'} = stackTransform;\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (stackTransform.sort !== undefined) {\n for (const sortField of stackTransform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(getFirstDefined(sortField.order, 'ascending'));\n }\n }\n const sort: SortFields = {\n field: sortFields,\n order: sortOrder\n };\n let normalizedAs: [string, string];\n if (isValidAsArray(as)) {\n normalizedAs = as;\n } else if (isString(as)) {\n normalizedAs = [as, `${as}_end`];\n } else {\n normalizedAs = [`${stackTransform.stack}_start`, `${stackTransform.stack}_end`];\n }\n\n return new StackNode(parent, {\n dimensionFieldDefs: [],\n stackField: stack,\n groupby,\n offset,\n sort,\n facetby: [],\n as: normalizedAs\n });\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const stackProperties = model.stack;\n const {encoding} = model;\n\n if (!stackProperties) {\n return null;\n }\n\n const {groupbyChannels, fieldChannel, offset, impute} = stackProperties;\n\n const dimensionFieldDefs = groupbyChannels\n .map(groupbyChannel => {\n const cDef = encoding[groupbyChannel];\n return getFieldDef(cDef);\n })\n .filter(def => !!def);\n\n const stackby = getStackByFields(model);\n const orderDef = model.encoding.order;\n\n let sort: SortFields;\n if (isArray(orderDef) || isFieldDef(orderDef)) {\n sort = sortParams(orderDef);\n } else {\n const sortOrder = isOrderOnlyDef(orderDef) ? orderDef.sort : fieldChannel === 'y' ? 'descending' : 'ascending';\n // default = descending by stackFields\n // FIXME is the default here correct for binned fields?\n sort = stackby.reduce(\n (s, field) => {\n s.field.push(field);\n s.order.push(sortOrder);\n return s;\n },\n {field: [], order: []}\n );\n }\n\n return new StackNode(parent, {\n dimensionFieldDefs,\n stackField: model.vgField(fieldChannel),\n facetby: [],\n stackby,\n sort,\n offset,\n impute,\n as: [\n model.vgField(fieldChannel, {suffix: 'start', forAs: true}),\n model.vgField(fieldChannel, {suffix: 'end', forAs: true})\n ]\n });\n }\n\n get stack(): StackComponent {\n return this._stack;\n }\n\n public addDimensions(fields: string[]) {\n this._stack.facetby.push(...fields);\n }\n\n public dependentFields() {\n const out = new Set();\n\n out.add(this._stack.stackField);\n\n this.getGroupbyFields().forEach(out.add, out);\n this._stack.facetby.forEach(out.add, out);\n this._stack.sort.field.forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this._stack.as);\n }\n\n public hash() {\n return `Stack ${hash(this._stack)}`;\n }\n\n private getGroupbyFields() {\n const {dimensionFieldDefs, impute, groupby} = this._stack;\n\n if (dimensionFieldDefs.length > 0) {\n return dimensionFieldDefs\n .map(dimensionFieldDef => {\n if (dimensionFieldDef.bin) {\n if (impute) {\n // For binned group by field with impute, we calculate bin_mid\n // as we cannot impute two fields simultaneously\n return [vgField(dimensionFieldDef, {binSuffix: 'mid'})];\n }\n return [\n // For binned group by field without impute, we need both bin (start) and bin_end\n vgField(dimensionFieldDef, {}),\n vgField(dimensionFieldDef, {binSuffix: 'end'})\n ];\n }\n return [vgField(dimensionFieldDef)];\n })\n .flat();\n }\n return groupby ?? [];\n }\n\n public assemble(): VgTransform[] {\n const transform: VgTransform[] = [];\n const {facetby, dimensionFieldDefs, stackField: field, stackby, sort, offset, impute, as} = this._stack;\n\n // Impute\n if (impute) {\n for (const dimensionFieldDef of dimensionFieldDefs) {\n const {bandPosition = 0.5, bin} = dimensionFieldDef;\n if (bin) {\n // As we can only impute one field at a time, we need to calculate\n // mid point for a binned field\n\n const binStart = vgField(dimensionFieldDef, {expr: 'datum'});\n const binEnd = vgField(dimensionFieldDef, {expr: 'datum', binSuffix: 'end'});\n transform.push({\n type: 'formula',\n expr: `${bandPosition}*${binStart}+${1 - bandPosition}*${binEnd}`,\n as: vgField(dimensionFieldDef, {binSuffix: 'mid', forAs: true})\n });\n }\n\n transform.push({\n type: 'impute',\n field,\n groupby: [...stackby, ...facetby],\n key: vgField(dimensionFieldDef, {binSuffix: 'mid'}),\n method: 'value',\n value: 0\n });\n }\n }\n\n // Stack\n transform.push({\n type: 'stack',\n groupby: [...this.getGroupbyFields(), ...facetby],\n field,\n sort,\n as,\n offset\n });\n\n return transform;\n }\n}\n","import {AggregateOp, WindowTransform as VgWindowTransform} from 'vega';\nimport {isAggregateOp} from '../../aggregate';\nimport {vgField} from '../../channeldef';\nimport {SortOrder} from '../../sort';\nimport {WindowFieldDef, WindowOnlyOp, WindowTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {VgComparator, VgJoinAggregateTransform} from '../../vega.schema';\nimport {unique} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the window transform nodes\n */\nexport class WindowTransformNode extends DataFlowNode {\n public clone() {\n return new WindowTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: WindowTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: string[]) {\n this.transform.groupby = unique(this.transform.groupby.concat(fields), d => d);\n }\n\n public dependentFields() {\n const out = new Set();\n\n (this.transform.groupby ?? []).forEach(out.add, out);\n (this.transform.sort ?? []).forEach(m => out.add(m.field));\n\n this.transform.window\n .map(w => w.field)\n .filter(f => f !== undefined)\n .forEach(out.add, out);\n\n return out;\n }\n\n public producedFields() {\n return new Set(this.transform.window.map(this.getDefaultName));\n }\n\n private getDefaultName(windowFieldDef: WindowFieldDef): string {\n return windowFieldDef.as ?? vgField(windowFieldDef);\n }\n\n public hash() {\n return `WindowTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgWindowTransform | VgJoinAggregateTransform {\n const fields: string[] = [];\n const ops: (AggregateOp | WindowOnlyOp)[] = [];\n const as: string[] = [];\n const params = [];\n\n for (const window of this.transform.window) {\n ops.push(window.op);\n as.push(this.getDefaultName(window));\n params.push(window.param === undefined ? null : window.param);\n fields.push(window.field === undefined ? null : window.field);\n }\n\n const frame = this.transform.frame;\n const groupby = this.transform.groupby;\n\n if (frame && frame[0] === null && frame[1] === null && ops.every(o => isAggregateOp(o))) {\n // when the window does not rely on any particular window ops or frame, switch to a simpler and more efficient joinaggregate\n return {\n type: 'joinaggregate',\n as,\n ops: ops as AggregateOp[],\n fields,\n ...(groupby !== undefined ? {groupby} : {})\n } as VgJoinAggregateTransform;\n }\n\n const sortFields: string[] = [];\n const sortOrder: SortOrder[] = [];\n if (this.transform.sort !== undefined) {\n for (const sortField of this.transform.sort) {\n sortFields.push(sortField.field);\n sortOrder.push(sortField.order ?? 'ascending');\n }\n }\n const sort: VgComparator = {\n field: sortFields,\n order: sortOrder\n };\n const ignorePeers = this.transform.ignorePeers;\n\n return {\n type: 'window',\n params,\n as,\n ops,\n fields,\n sort,\n ...(ignorePeers !== undefined ? {ignorePeers} : {}),\n ...(groupby !== undefined ? {groupby} : {}),\n ...(frame !== undefined ? {frame} : {})\n } as VgWindowTransform;\n }\n}\n","import {DataSourceType} from '../../data';\nimport {AggregateNode} from './aggregate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {FacetNode} from './facet';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {FACET_SCALE_PREFIX} from './optimize';\nimport {StackNode} from './stack';\nimport {WindowTransformNode} from './window';\n\n/**\n * Clones the subtree and ignores output nodes except for the leaves, which are renamed.\n */\nfunction cloneSubtree(facet: FacetNode) {\n function clone(node: DataFlowNode): DataFlowNode[] {\n if (!(node instanceof FacetNode)) {\n const copy = node.clone();\n\n if (copy instanceof OutputNode) {\n const newName = FACET_SCALE_PREFIX + copy.getSource();\n copy.setSource(newName);\n\n facet.model.component.data.outputNodes[newName] = copy;\n } else if (\n copy instanceof AggregateNode ||\n copy instanceof StackNode ||\n copy instanceof WindowTransformNode ||\n copy instanceof JoinAggregateTransformNode\n ) {\n copy.addDimensions(facet.fields);\n }\n for (const n of node.children.flatMap(clone)) {\n n.parent = copy;\n }\n\n return [copy];\n }\n\n return node.children.flatMap(clone);\n }\n return clone;\n}\n\n/**\n * Move facet nodes down to the next fork or output node. Also pull the main output with the facet node.\n * After moving down the facet node, make a copy of the subtree and make it a child of the main output.\n */\nexport function moveFacetDown(node: DataFlowNode) {\n if (node instanceof FacetNode) {\n if (node.numChildren() === 1 && !(node.children[0] instanceof OutputNode)) {\n // move down until we hit a fork or output node\n const child = node.children[0];\n\n if (\n child instanceof AggregateNode ||\n child instanceof StackNode ||\n child instanceof WindowTransformNode ||\n child instanceof JoinAggregateTransformNode\n ) {\n child.addDimensions(node.fields);\n }\n\n child.swapWithParent();\n moveFacetDown(node);\n } else {\n // move main to facet\n\n const facetMain = node.model.component.data.main;\n moveMainDownToFacet(facetMain);\n\n // replicate the subtree and place it before the facet's main node\n const cloner = cloneSubtree(node);\n const copy: DataFlowNode[] = node.children.map(cloner).flat();\n for (const c of copy) {\n c.parent = facetMain;\n }\n }\n } else {\n node.children.map(moveFacetDown);\n }\n}\n\nfunction moveMainDownToFacet(node: DataFlowNode) {\n if (node instanceof OutputNode && node.type === DataSourceType.Main) {\n if (node.numChildren() === 1) {\n const child = node.children[0];\n if (!(child instanceof FacetNode)) {\n child.swapWithParent();\n moveMainDownToFacet(node);\n }\n }\n }\n}\n","import {DataComponent} from '.';\nimport * as log from '../../log';\nimport {Model} from '../model';\nimport {DataFlowNode} from './dataflow';\nimport {Optimizer} from './optimizer';\nimport * as optimizers from './optimizers';\nimport {moveFacetDown} from './subtree';\n\nexport const FACET_SCALE_PREFIX = 'scale_';\nexport const MAX_OPTIMIZATION_RUNS = 5;\n\n/**\n * Iterates over a dataflow graph and checks whether all links are consistent.\n */\nexport function checkLinks(nodes: readonly DataFlowNode[]): boolean {\n for (const node of nodes) {\n for (const child of node.children) {\n if (child.parent !== node) {\n // log.error('Dataflow graph is inconsistent.', node, child);\n return false;\n }\n }\n\n if (!checkLinks(node.children)) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Run the specified optimizer on the provided nodes.\n *\n * @param optimizer The optimizer instance to run.\n * @param nodes A set of nodes to optimize.\n */\nfunction runOptimizer(optimizer: Optimizer, nodes: DataFlowNode[]): boolean {\n let modified = false;\n\n for (const node of nodes) {\n modified = optimizer.optimize(node) || modified;\n }\n\n return modified;\n}\n\nfunction optimizationDataflowHelper(dataComponent: DataComponent, model: Model, firstPass: boolean) {\n let roots = dataComponent.sources;\n let modified = false;\n\n modified = runOptimizer(new optimizers.RemoveUnnecessaryOutputNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveUnnecessaryIdentifierNodes(model), roots) || modified;\n\n // remove source nodes that don't have any children because they also don't have output nodes\n roots = roots.filter(r => r.numChildren() > 0);\n\n modified = runOptimizer(new optimizers.RemoveUnusedSubtrees(), roots) || modified;\n\n roots = roots.filter(r => r.numChildren() > 0);\n\n if (!firstPass) {\n // Only run these optimizations after the optimizer has moved down the facet node.\n // With this change, we can be more aggressive in the optimizations.\n modified = runOptimizer(new optimizers.MoveParseUp(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeBins(model), roots) || modified;\n modified = runOptimizer(new optimizers.RemoveDuplicateTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeParse(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeAggregates(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeTimeUnits(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeIdenticalNodes(), roots) || modified;\n modified = runOptimizer(new optimizers.MergeOutputs(), roots) || modified;\n }\n\n dataComponent.sources = roots;\n\n return modified;\n}\n\n/**\n * Optimizes the dataflow of the passed in data component.\n */\nexport function optimizeDataflow(data: DataComponent, model: Model) {\n // check before optimizations\n checkLinks(data.sources);\n\n let firstPassCounter = 0;\n let secondPassCounter = 0;\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, true)) {\n break;\n }\n firstPassCounter++;\n }\n\n // move facets down and make a copy of the subtree so that we can have scales at the top level\n data.sources.map(moveFacetDown);\n\n for (let i = 0; i < MAX_OPTIMIZATION_RUNS; i++) {\n if (!optimizationDataflowHelper(data, model, false)) {\n break;\n }\n secondPassCounter++;\n }\n\n // check after optimizations\n checkLinks(data.sources);\n\n if (Math.max(firstPassCounter, secondPassCounter) === MAX_OPTIMIZATION_RUNS) {\n log.warn(`Maximum optimization runs(${MAX_OPTIMIZATION_RUNS}) reached.`);\n }\n}\n","import type {SignalRef} from 'vega';\n\nexport type Rename = (oldSignalName: string) => string;\n\n/**\n * A class that behaves like a SignalRef but lazily generates the signal.\n * The provided generator function should use `Model.getSignalName` to use the correct signal name.\n */\nexport class SignalRefWrapper implements SignalRef {\n constructor(exprGenerator: () => string) {\n Object.defineProperty(this, 'signal', {\n enumerable: true,\n get: exprGenerator\n });\n }\n\n public signal: string; // for ts\n\n public static fromName(rename: Rename, signalName: string) {\n return new SignalRefWrapper(() => rename(signalName));\n }\n}\n","import type {SignalRef} from 'vega';\nimport {isObject, isString} from 'vega-util';\nimport {\n Aggregate,\n isAggregateOp,\n isArgmaxDef,\n isArgminDef,\n MULTIDOMAIN_SORT_OP_INDEX as UNIONDOMAIN_SORT_OP_INDEX,\n NonArgAggregateOp,\n SHARED_DOMAIN_OPS\n} from '../../aggregate';\nimport {isBinning, isBinParams, isParameterExtent} from '../../bin';\nimport {getSecondaryRangeChannel, isScaleChannel, ScaleChannel} from '../../channel';\nimport {\n binRequiresRange,\n getBandPosition,\n getFieldOrDatumDef,\n hasBandEnd,\n isDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr,\n vgField\n} from '../../channeldef';\nimport {CompositeAggregate} from '../../compositemark';\nimport {DataSourceType} from '../../data';\nimport {DateTime} from '../../datetime';\nimport {ExprRef} from '../../expr';\nimport * as log from '../../log';\nimport {Domain, hasDiscreteDomain, isDomainUnionWith, isParameterDomain, ScaleConfig, ScaleType} from '../../scale';\nimport {ParameterExtent} from '../../selection';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortArray, isSortByEncoding, isSortField} from '../../sort';\nimport {normalizeTimeUnit, TimeUnit, TimeUnitTransformParams} from '../../timeunit';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {\n isDataRefDomain,\n isDataRefUnionedDomain,\n isFieldRefUnionDomain,\n isSignalRef,\n VgDomain,\n VgMultiFieldsRefWithSort,\n VgNonUnionDomain,\n VgScaleDataRefWithSort,\n VgSortField,\n VgUnionSortField\n} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {sortArrayIndexField} from '../data/calculate';\nimport {FACET_SCALE_PREFIX} from '../data/optimize';\nimport {isFacetModel, isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {isRectBasedMark} from '../../mark';\nimport {OFFSETTED_RECT_END_SUFFIX, OFFSETTED_RECT_START_SUFFIX} from '../data/timeunit';\n\nexport function parseScaleDomain(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleDomain(model);\n } else {\n parseNonUnitScaleDomain(model);\n }\n}\n\nfunction parseUnitScaleDomain(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n const domains = parseDomainForChannel(model, channel);\n const localScaleCmpt = localScaleComponents[channel];\n localScaleCmpt.setWithExplicit('domains', domains);\n parseSelectionDomain(model, channel);\n\n if (model.component.data.isFaceted) {\n // get resolve from closest facet parent as this decides whether we need to refer to cloned subtree or not\n let facetParent: Model = model;\n while (!isFacetModel(facetParent) && facetParent.parent) {\n facetParent = facetParent.parent;\n }\n\n const resolve = facetParent.component.resolve.scale[channel];\n\n if (resolve === 'shared') {\n for (const domain of domains.value) {\n // Replace the scale domain with data output from a cloned subtree after the facet.\n if (isDataRefDomain(domain)) {\n // use data from cloned subtree (which is the same as data but with a prefix added once)\n domain.data = FACET_SCALE_PREFIX + domain.data.replace(FACET_SCALE_PREFIX, '');\n }\n }\n }\n }\n }\n}\n\nfunction parseNonUnitScaleDomain(model: Model) {\n for (const child of model.children) {\n parseScaleDomain(child);\n }\n\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const channel of util.keys(localScaleComponents)) {\n let domains: Explicit;\n let selectionExtent: ParameterExtent = null;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n if (domains === undefined) {\n domains = childComponent.getWithExplicit('domains');\n } else {\n domains = mergeValuesWithExplicit(\n domains,\n childComponent.getWithExplicit('domains'),\n 'domains',\n 'scale',\n domainsTieBreaker\n );\n }\n\n const se = childComponent.get('selectionExtent');\n if (selectionExtent && se && selectionExtent.param !== se.param) {\n log.warn(log.message.NEEDS_SAME_SELECTION);\n }\n selectionExtent = se;\n }\n }\n\n localScaleComponents[channel].setWithExplicit('domains', domains);\n\n if (selectionExtent) {\n localScaleComponents[channel].set('selectionExtent', selectionExtent, true);\n }\n }\n}\n\n/**\n * Remove unaggregated domain if it is not applicable\n * Add unaggregated domain if domain is not specified and config.scale.useUnaggregatedDomain is true.\n */\nfunction normalizeUnaggregatedDomain(\n domain: Domain,\n fieldDef: TypedFieldDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig\n) {\n if (domain === 'unaggregated') {\n const {valid, reason} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (!valid) {\n log.warn(reason);\n return undefined;\n }\n } else if (domain === undefined && scaleConfig.useUnaggregatedDomain) {\n // Apply config if domain is not specified.\n const {valid} = canUseUnaggregatedDomain(fieldDef, scaleType);\n if (valid) {\n return 'unaggregated';\n }\n }\n\n return domain;\n}\n\nexport function parseDomainForChannel(model: UnitModel, channel: ScaleChannel): Explicit {\n const scaleType = model.getScaleComponent(channel).get('type');\n const {encoding} = model;\n\n const domain = normalizeUnaggregatedDomain(\n model.scaleDomain(channel),\n model.typedFieldDef(channel),\n scaleType,\n model.config.scale\n );\n if (domain !== model.scaleDomain(channel)) {\n model.specifiedScales[channel] = {\n ...model.specifiedScales[channel],\n domain\n };\n }\n\n // If channel is either X or Y then union them with X2 & Y2 if they exist\n if (channel === 'x' && getFieldOrDatumDef(encoding.x2)) {\n if (getFieldOrDatumDef(encoding.x)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'x'),\n parseSingleChannelDomain(scaleType, domain, model, 'x2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'x2');\n }\n } else if (channel === 'y' && getFieldOrDatumDef(encoding.y2)) {\n if (getFieldOrDatumDef(encoding.y)) {\n return mergeValuesWithExplicit(\n parseSingleChannelDomain(scaleType, domain, model, 'y'),\n parseSingleChannelDomain(scaleType, domain, model, 'y2'),\n 'domain',\n 'scale',\n domainsTieBreaker\n );\n } else {\n return parseSingleChannelDomain(scaleType, domain, model, 'y2');\n }\n }\n return parseSingleChannelDomain(scaleType, domain, model, channel);\n}\n\nfunction mapDomainToDataSignal(\n domain: (number | string | boolean | DateTime | ExprRef | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit\n) {\n return domain.map(v => {\n const data = valueExpr(v, {timeUnit, type});\n return {signal: `{data: ${data}}`};\n });\n}\n\nfunction convertDomainIfItIsDateTime(\n domain: (number | string | boolean | DateTime | ExprRef | SignalRef | number[])[],\n type: Type,\n timeUnit: TimeUnit | TimeUnitTransformParams\n): [number[]] | [string[]] | [boolean[]] | SignalRef[] {\n // explicit value\n const normalizedTimeUnit = normalizeTimeUnit(timeUnit)?.unit;\n if (type === 'temporal' || normalizedTimeUnit) {\n return mapDomainToDataSignal(domain, type, normalizedTimeUnit);\n }\n\n return [domain] as [number[]] | [string[]] | [boolean[]]; // Date time won't make sense\n}\n\nfunction parseSingleChannelDomain(\n scaleType: ScaleType,\n domain: Domain,\n model: UnitModel,\n channel: ScaleChannel | 'x2' | 'y2'\n): Explicit {\n const {encoding, markDef, mark, config, stack} = model;\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleDatumDef | ScaleFieldDef;\n\n const {type} = fieldOrDatumDef;\n const timeUnit = fieldOrDatumDef['timeUnit'];\n\n if (isDomainUnionWith(domain)) {\n const defaultDomain = parseSingleChannelDomain(scaleType, undefined, model, channel);\n\n const unionWith = convertDomainIfItIsDateTime(domain.unionWith, type, timeUnit);\n\n return makeExplicit([...unionWith, ...defaultDomain.value]);\n } else if (isSignalRef(domain)) {\n return makeExplicit([domain]);\n } else if (domain && domain !== 'unaggregated' && !isParameterDomain(domain)) {\n return makeExplicit(convertDomainIfItIsDateTime(domain, type, timeUnit));\n }\n\n if (stack && channel === stack.fieldChannel) {\n if (stack.offset === 'normalize') {\n return makeImplicit([[0, 1]]);\n }\n\n const data = model.requestDataName(DataSourceType.Main);\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, {suffix: 'start'})\n },\n {\n data,\n field: model.vgField(channel, {suffix: 'end'})\n }\n ]);\n }\n\n const sort: undefined | true | VgSortField =\n isScaleChannel(channel) && isFieldDef(fieldOrDatumDef) ? domainSort(model, channel, scaleType) : undefined;\n\n if (isDatumDef(fieldOrDatumDef)) {\n const d = convertDomainIfItIsDateTime([fieldOrDatumDef.datum], type, timeUnit);\n return makeImplicit(d);\n }\n\n const fieldDef = fieldOrDatumDef; // now we can be sure it's a fieldDef\n if (domain === 'unaggregated') {\n const data = model.requestDataName(DataSourceType.Main);\n const {field} = fieldOrDatumDef;\n return makeImplicit([\n {\n data,\n field: vgField({field, aggregate: 'min'})\n },\n {\n data,\n field: vgField({field, aggregate: 'max'})\n }\n ]);\n } else if (isBinning(fieldDef.bin)) {\n if (hasDiscreteDomain(scaleType)) {\n if (scaleType === 'bin-ordinal') {\n // we can omit the domain as it is inferred from the `bins` property\n return makeImplicit([]);\n }\n\n // ordinal bin scale takes domain from bin_range, ordered by bin start\n // This is useful for both axis-based scale (x/y) and legend-based scale (other channels).\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n // Use range if we added it and the scale does not support computing a range as a signal.\n field: model.vgField(channel, binRequiresRange(fieldDef, channel) ? {binSuffix: 'range'} : {}),\n // we have to use a sort object if sort = true to make the sort correct by bin start\n sort:\n sort === true || !isObject(sort)\n ? {\n field: model.vgField(channel, {}),\n op: 'min' // min or max doesn't matter since we sort by the start of the bin range\n }\n : sort\n }\n ]);\n } else {\n // continuous scales\n const {bin} = fieldDef;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return makeImplicit([\n new SignalRefWrapper(() => {\n const signal = model.getSignalName(binSignal);\n return `[${signal}.start, ${signal}.stop]`;\n })\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel, {})\n }\n ]);\n }\n }\n } else if (fieldDef.timeUnit && util.contains(['time', 'utc'], scaleType)) {\n const fieldDef2 = encoding[getSecondaryRangeChannel(channel)];\n\n if (hasBandEnd(fieldDef, fieldDef2, markDef, config)) {\n const data = model.requestDataName(DataSourceType.Main);\n\n const bandPosition = getBandPosition({fieldDef, fieldDef2, markDef, config});\n const isRectWithOffset = isRectBasedMark(mark) && bandPosition !== 0.5;\n return makeImplicit([\n {\n data,\n field: model.vgField(channel, isRectWithOffset ? {suffix: OFFSETTED_RECT_START_SUFFIX} : {})\n },\n {\n data,\n field: model.vgField(channel, {suffix: isRectWithOffset ? OFFSETTED_RECT_END_SUFFIX : 'end'})\n }\n ]);\n }\n }\n if (sort) {\n return makeImplicit([\n {\n // If sort by aggregation of a specified sort field, we need to use RAW table,\n // so we can aggregate values for the scale independently from the main aggregation.\n data: util.isBoolean(sort)\n ? model.requestDataName(DataSourceType.Main)\n : model.requestDataName(DataSourceType.Raw),\n field: model.vgField(channel),\n sort\n }\n ]);\n } else {\n return makeImplicit([\n {\n data: model.requestDataName(DataSourceType.Main),\n field: model.vgField(channel)\n }\n ]);\n }\n}\n\nfunction normalizeSortField(sort: EncodingSortField, isStackedMeasure: boolean): VgSortField {\n const {op, field, order} = sort;\n return {\n // Apply default op\n op: op ?? (isStackedMeasure ? 'sum' : DEFAULT_SORT_OP),\n // flatten nested fields\n ...(field ? {field: util.replacePathInField(field)} : {}),\n\n ...(order ? {order} : {})\n };\n}\n\nfunction parseSelectionDomain(model: UnitModel, channel: ScaleChannel) {\n const scale = model.component.scales[channel];\n const spec = model.specifiedScales[channel].domain;\n const bin = model.fieldDef(channel)?.bin;\n const domain = isParameterDomain(spec) && spec;\n const extent = isBinParams(bin) && isParameterExtent(bin.extent) && bin.extent;\n\n if (domain || extent) {\n // As scale parsing occurs before selection parsing, we cannot set\n // domainRaw directly. So instead, we store the selectionExtent on\n // the scale component, and then add domainRaw during scale assembly.\n scale.set('selectionExtent', domain ?? extent, true);\n }\n}\n\nexport function domainSort(\n model: UnitModel,\n channel: ScaleChannel,\n scaleType: ScaleType\n): undefined | true | VgSortField {\n if (!hasDiscreteDomain(scaleType)) {\n return undefined;\n }\n\n // save to cast as the only exception is the geojson type for shape, which would not generate a scale\n const fieldDef = model.fieldDef(channel) as ScaleFieldDef;\n const sort = fieldDef.sort;\n\n // if the sort is specified with array, use the derived sort index field\n if (isSortArray(sort)) {\n return {\n op: 'min',\n field: sortArrayIndexField(fieldDef, channel),\n order: 'ascending'\n };\n }\n\n const {stack} = model;\n const stackDimensions = stack\n ? new Set([...stack.groupbyFields, ...stack.stackBy.map(s => s.fieldDef.field)])\n : undefined;\n\n // Sorted based on an aggregate calculation over a specified sort field (only for ordinal scale)\n if (isSortField(sort)) {\n const isStackedMeasure = stack && !stackDimensions.has(sort.field);\n return normalizeSortField(sort, isStackedMeasure);\n } else if (isSortByEncoding(sort)) {\n const {encoding, order} = sort;\n const fieldDefToSortBy = model.fieldDef(encoding);\n const {aggregate, field} = fieldDefToSortBy;\n\n const isStackedMeasure = stack && !stackDimensions.has(field);\n\n if (isArgminDef(aggregate) || isArgmaxDef(aggregate)) {\n return normalizeSortField(\n {\n field: vgField(fieldDefToSortBy),\n order\n },\n isStackedMeasure\n );\n } else if (isAggregateOp(aggregate) || !aggregate) {\n return normalizeSortField(\n {\n op: aggregate as NonArgAggregateOp, // can't be argmin/argmax since we don't support them in encoding field def\n field,\n order\n },\n isStackedMeasure\n );\n }\n } else if (sort === 'descending') {\n return {\n op: 'min',\n field: model.vgField(channel),\n order: 'descending'\n };\n } else if (util.contains(['ascending', undefined /* default =ascending*/], sort)) {\n return true;\n }\n\n // sort == null\n return undefined;\n}\n\n/**\n * Determine if a scale can use unaggregated domain.\n * @return {Boolean} Returns true if all of the following conditions apply:\n * 1. `scale.domain` is `unaggregated`\n * 2. Aggregation function is not `count` or `sum`\n * 3. The scale is quantitative or time scale.\n */\nexport function canUseUnaggregatedDomain(\n fieldDef: TypedFieldDef,\n scaleType: ScaleType\n): {valid: boolean; reason?: string} {\n const {aggregate, type} = fieldDef;\n\n if (!aggregate) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainHasNoEffectForRawField(fieldDef)\n };\n }\n\n if (isString(aggregate) && !(SHARED_DOMAIN_OPS as Set).has(aggregate)) {\n return {\n valid: false,\n reason: log.message.unaggregateDomainWithNonSharedDomainOp(aggregate)\n };\n }\n\n if (type === 'quantitative') {\n if (scaleType === 'log') {\n return {\n valid: false,\n reason: log.message.unaggregatedDomainWithLogScale(fieldDef)\n };\n }\n }\n\n return {valid: true};\n}\n\n/**\n * Tie breaker for mergeValuesWithExplicit for domains. We concat the specified values.\n */\nfunction domainsTieBreaker(\n v1: Explicit,\n v2: Explicit,\n property: 'domains',\n propertyOf: 'scale'\n) {\n if (v1.explicit && v2.explicit) {\n log.warn(log.message.mergeConflictingDomainProperty(property, propertyOf, v1.value, v2.value));\n }\n // If equal score, concat the domains so that we union them later.\n return {explicit: v1.explicit, value: [...v1.value, ...v2.value]};\n}\n\n/**\n * Converts an array of domains to a single Vega scale domain.\n */\nexport function mergeDomains(domains: VgNonUnionDomain[]): VgDomain {\n const uniqueDomains = util.unique(\n domains.map(domain => {\n // ignore sort property when computing the unique domains\n if (isDataRefDomain(domain)) {\n const {sort: _s, ...domainWithoutSort} = domain;\n return domainWithoutSort;\n }\n return domain;\n }),\n util.hash\n );\n\n const sorts: VgSortField[] = util.unique(\n domains\n .map(d => {\n if (isDataRefDomain(d)) {\n const s = d.sort;\n if (s !== undefined && !util.isBoolean(s)) {\n if ('op' in s && s.op === 'count') {\n // let's make sure that if op is count, we don't use a field\n delete s.field;\n }\n if (s.order === 'ascending') {\n // drop order: ascending as it is the default\n delete s.order;\n }\n }\n return s;\n }\n return undefined;\n })\n .filter(s => s !== undefined),\n util.hash\n );\n\n if (uniqueDomains.length === 0) {\n return undefined;\n } else if (uniqueDomains.length === 1) {\n const domain = domains[0];\n if (isDataRefDomain(domain) && sorts.length > 0) {\n let sort = sorts[0];\n if (sorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n // Get sorts with non-default ops\n const filteredSorts = sorts.filter(s => isObject(s) && 'op' in s && s.op !== 'min');\n if (sorts.every(s => isObject(s) && 'op' in s) && filteredSorts.length === 1) {\n sort = filteredSorts[0];\n } else {\n sort = true;\n }\n } else {\n // Simplify domain sort by removing field and op when the field is the same as the domain field.\n if (isObject(sort) && 'field' in sort) {\n const sortField = sort.field;\n if (domain.field === sortField) {\n sort = sort.order ? {order: sort.order} : true;\n }\n }\n }\n return {\n ...domain,\n sort\n };\n }\n return domain;\n }\n\n // only keep sort properties that work with unioned domains\n const unionDomainSorts = util.unique(\n sorts.map(s => {\n if (util.isBoolean(s) || !('op' in s) || (isString(s.op) && s.op in UNIONDOMAIN_SORT_OP_INDEX)) {\n return s as VgUnionSortField;\n }\n log.warn(log.message.domainSortDropped(s));\n return true;\n }),\n util.hash\n ) as VgUnionSortField[];\n\n let sort: VgUnionSortField;\n\n if (unionDomainSorts.length === 1) {\n sort = unionDomainSorts[0];\n } else if (unionDomainSorts.length > 1) {\n log.warn(log.message.MORE_THAN_ONE_SORT);\n sort = true;\n }\n\n const allData = util.unique(\n domains.map(d => {\n if (isDataRefDomain(d)) {\n return d.data;\n }\n return null;\n }),\n x => x\n );\n\n if (allData.length === 1 && allData[0] !== null) {\n // create a union domain of different fields with a single data source\n const domain: VgMultiFieldsRefWithSort = {\n data: allData[0],\n fields: uniqueDomains.map(d => (d as VgScaleDataRefWithSort).field),\n ...(sort ? {sort} : {})\n };\n\n return domain;\n }\n\n return {fields: uniqueDomains, ...(sort ? {sort} : {})};\n}\n\n/**\n * Return a field if a scale uses a single field.\n * Return `undefined` otherwise.\n */\nexport function getFieldFromDomain(domain: VgDomain): string {\n if (isDataRefDomain(domain) && isString(domain.field)) {\n return domain.field;\n } else if (isDataRefUnionedDomain(domain)) {\n let field;\n for (const nonUnionDomain of domain.fields) {\n if (isDataRefDomain(nonUnionDomain) && isString(nonUnionDomain.field)) {\n if (!field) {\n field = nonUnionDomain.field;\n } else if (field !== nonUnionDomain.field) {\n log.warn(log.message.FACETED_INDEPENDENT_DIFFERENT_SOURCES);\n return field;\n }\n }\n }\n log.warn(log.message.FACETED_INDEPENDENT_SAME_FIELDS_DIFFERENT_SOURCES);\n return field;\n } else if (isFieldRefUnionDomain(domain)) {\n log.warn(log.message.FACETED_INDEPENDENT_SAME_SOURCE);\n const field = domain.fields[0];\n return isString(field) ? field : undefined;\n }\n\n return undefined;\n}\n\nexport function assembleDomain(model: Model, channel: ScaleChannel) {\n const scaleComponent: ScaleComponent = model.component.scales[channel];\n\n const domains = scaleComponent.get('domains').map((domain: VgNonUnionDomain) => {\n // Correct references to data as the original domain's data was determined\n // in parseScale, which happens before parseData. Thus the original data\n // reference can be incorrect.\n if (isDataRefDomain(domain)) {\n domain.data = model.lookupDataSource(domain.data);\n }\n\n return domain;\n });\n\n // domains is an array that has to be merged into a single vega domain\n return mergeDomains(domains);\n}\n","import {isObject} from 'vega-util';\nimport {isXorY, ScaleChannel} from '../../channel';\nimport {keys} from '../../util';\nimport {isDataRefDomain, isVgRangeStep, VgRange, VgScale} from '../../vega.schema';\nimport {isConcatModel, isLayerModel, Model} from '../model';\nimport {assembleSelectionScaleDomain} from '../selection/assemble';\nimport {assembleDomain} from './domain';\n\nexport function assembleScales(model: Model): VgScale[] {\n if (isLayerModel(model) || isConcatModel(model)) {\n // For concat and layer, include scales of children too\n return model.children.reduce((scales, child) => {\n return scales.concat(assembleScales(child));\n }, assembleScalesForModel(model));\n } else {\n // For facet, child scales would not be included in the parent's scope.\n // For unit, there is no child.\n return assembleScalesForModel(model);\n }\n}\n\nexport function assembleScalesForModel(model: Model): VgScale[] {\n return keys(model.component.scales).reduce((scales: VgScale[], channel: ScaleChannel) => {\n const scaleComponent = model.component.scales[channel];\n if (scaleComponent.merged) {\n // Skipped merged scales\n return scales;\n }\n\n const scale = scaleComponent.combine();\n const {name, type, selectionExtent, domains: _d, range: _r, reverse, ...otherScaleProps} = scale;\n const range = assembleScaleRange(scale.range, name, channel, model);\n\n const domain = assembleDomain(model, channel);\n const domainRaw = selectionExtent\n ? assembleSelectionScaleDomain(model, selectionExtent, scaleComponent, domain)\n : null;\n\n scales.push({\n name,\n type,\n ...(domain ? {domain} : {}),\n ...(domainRaw ? {domainRaw} : {}),\n range,\n ...(reverse !== undefined ? {reverse: reverse as any} : {}),\n ...otherScaleProps\n });\n\n return scales;\n }, [] as VgScale[]);\n}\n\nexport function assembleScaleRange(\n scaleRange: VgRange,\n scaleName: string,\n channel: ScaleChannel,\n model?: Model\n): VgRange {\n // add signals to x/y range\n if (isXorY(channel)) {\n if (isVgRangeStep(scaleRange)) {\n // For width/height step, use a signal created in layout assemble instead of a constant step.\n return {\n step: {signal: `${scaleName}_step`}\n };\n }\n } else if (isObject(scaleRange) && isDataRefDomain(scaleRange)) {\n return {\n ...scaleRange,\n data: model.lookupDataSource(scaleRange.data)\n };\n }\n return scaleRange;\n}\n","import type {SignalRef} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {ScaleChannel} from '../../channel';\nimport {Scale, ScaleType} from '../../scale';\nimport {ParameterExtent} from '../../selection';\nimport {some} from '../../util';\nimport {VgNonUnionDomain, VgScale} from '../../vega.schema';\nimport {Explicit, Split} from '../split';\n\n/**\n * All VgDomain property except domain.\n * (We exclude domain as we have a special \"domains\" array that allow us merge them all at once in assemble.)\n */\nexport type ScaleComponentProps = Omit & {\n domains: VgNonUnionDomain[];\n selectionExtent?: ParameterExtent;\n reverse?: boolean | SignalRef; // Need override since Vega doesn't official support scale reverse yet (though it does in practice)\n};\n\nexport type Range = ScaleComponentProps['range'];\n\nexport class ScaleComponent extends Split {\n public merged = false;\n\n constructor(name: string, typeWithExplicit: Explicit) {\n super(\n {}, // no initial explicit property\n {name} // name as initial implicit property\n );\n this.setWithExplicit('type', typeWithExplicit);\n }\n\n /**\n * Whether the scale definitely includes zero in the domain\n */\n public domainDefinitelyIncludesZero() {\n if (this.get('zero') !== false) {\n return true;\n }\n return some(\n this.get('domains'),\n d => isArray(d) && d.length === 2 && isNumber(d[0]) && d[0] <= 0 && isNumber(d[1]) && d[1] >= 0\n );\n }\n}\n\nexport type ScaleComponentIndex = Partial>;\n\nexport type ScaleIndex = Partial>>;\n","import {RangeScheme, SignalRef} from 'vega';\nimport {isArray, isNumber, isObject} from 'vega-util';\nimport {isBinning} from '../../bin';\nimport {\n ANGLE,\n COLOR,\n FILL,\n FILLOPACITY,\n getOffsetScaleChannel,\n getSizeChannel,\n isXorY,\n isXorYOffset,\n OPACITY,\n PositionScaleChannel,\n RADIUS,\n ScaleChannel,\n SCALE_CHANNELS,\n SHAPE,\n SIZE,\n STROKE,\n STROKEDASH,\n STROKEOPACITY,\n STROKEWIDTH,\n THETA,\n X,\n XOFFSET,\n Y,\n YOFFSET\n} from '../../channel';\nimport {\n getBandPosition,\n getFieldOrDatumDef,\n isFieldDef,\n isFieldOrDatumDef,\n ScaleDatumDef,\n ScaleFieldDef\n} from '../../channeldef';\nimport {Config, getViewConfigDiscreteSize, getViewConfigDiscreteStep, ViewConfig} from '../../config';\nimport {DataSourceType} from '../../data';\nimport {channelHasFieldOrDatum} from '../../encoding';\nimport * as log from '../../log';\nimport {Mark} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n hasDiscreteDomain,\n isContinuousToDiscrete,\n isExtendedScheme,\n Scale,\n ScaleType,\n scaleTypeSupportProperty,\n Scheme\n} from '../../scale';\nimport {getStepFor, isStep, LayoutSizeMixins, Step} from '../../spec/base';\nimport {isDiscrete} from '../../type';\nimport * as util from '../../util';\nimport {isSignalRef, VgRange} from '../../vega.schema';\nimport {exprFromSignalRefOrValue, signalOrStringValue} from '../common';\nimport {getBinSignalName} from '../data/bin';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, makeExplicit, makeImplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex} from './component';\nimport {durationExpr} from '../../timeunit';\n\nexport const RANGE_PROPERTIES: (keyof Scale)[] = ['range', 'scheme'];\n\nexport function parseUnitScaleRange(model: UnitModel) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n // use SCALE_CHANNELS instead of scales[channel] to ensure that x, y come first!\n for (const channel of SCALE_CHANNELS) {\n const localScaleCmpt = localScaleComponents[channel];\n if (!localScaleCmpt) {\n continue;\n }\n\n const rangeWithExplicit = parseRangeForChannel(channel, model);\n\n localScaleCmpt.setWithExplicit('range', rangeWithExplicit);\n }\n}\n\nfunction getBinStepSignal(model: UnitModel, channel: 'x' | 'y'): SignalRefWrapper {\n const fieldDef = model.fieldDef(channel);\n\n if (fieldDef?.bin) {\n const {bin, field} = fieldDef;\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n\n if (isObject(bin) && bin.binned && bin.step !== undefined) {\n return new SignalRefWrapper(() => {\n const scaleName = model.scaleName(channel);\n const binCount = `(domain(\"${scaleName}\")[1] - domain(\"${scaleName}\")[0]) / ${bin.step}`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n } else if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, field, bin);\n\n // TODO: extract this to be range step signal\n return new SignalRefWrapper(() => {\n const updatedName = model.getSignalName(binSignal);\n const binCount = `(${updatedName}.stop - ${updatedName}.start) / ${updatedName}.step`;\n return `${model.getSignalName(sizeSignal)} / (${binCount})`;\n });\n }\n }\n return undefined;\n}\n\n/**\n * Return mixins that includes one of the Vega range types (explicit range, range.step, range.scheme).\n */\nexport function parseRangeForChannel(channel: ScaleChannel, model: UnitModel): Explicit {\n const specifiedScale = model.specifiedScales[channel];\n const {size} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n // Check if any of the range properties is specified.\n // If so, check if it is compatible and make sure that we only output one of the properties\n for (const property of RANGE_PROPERTIES) {\n if (specifiedScale[property] !== undefined) {\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n } else {\n switch (property) {\n case 'range': {\n const range = specifiedScale.range;\n if (isArray(range)) {\n if (isXorY(channel)) {\n return makeExplicit(\n range.map(v => {\n if (v === 'width' || v === 'height') {\n // get signal for width/height\n\n // Just like default range logic below, we use SignalRefWrapper to account for potential merges and renames.\n\n const sizeSignal = model.getName(v);\n const getSignalName = model.getSignalName.bind(model);\n return SignalRefWrapper.fromName(getSignalName, sizeSignal);\n }\n return v;\n })\n );\n }\n } else if (isObject(range)) {\n return makeExplicit({\n data: model.requestDataName(DataSourceType.Main),\n field: range.field,\n sort: {op: 'min', field: model.vgField(channel)}\n });\n }\n\n return makeExplicit(range);\n }\n case 'scheme':\n return makeExplicit(parseScheme(specifiedScale[property]));\n }\n }\n }\n }\n\n const sizeChannel = channel === X || channel === 'xOffset' ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (isStep(sizeValue)) {\n if (isXorY(channel)) {\n if (hasDiscreteDomain(scaleType)) {\n const step = getPositionStep(sizeValue, model, channel);\n // Need to be explicit so layer with step wins over layer without step\n if (step) {\n return makeExplicit({step});\n }\n } else {\n log.warn(log.message.stepDropped(sizeChannel));\n }\n } else if (isXorYOffset(channel)) {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n const positionScaleType = positionScaleCmpt.get('type');\n if (positionScaleType === 'band') {\n const step = getOffsetStep(sizeValue, scaleType);\n if (step) {\n return makeExplicit(step);\n }\n }\n }\n }\n\n const {rangeMin, rangeMax} = specifiedScale;\n const d = defaultRange(channel, model);\n\n if (\n (rangeMin !== undefined || rangeMax !== undefined) &&\n // it's ok to check just rangeMin's compatibility since rangeMin/rangeMax are the same\n scaleTypeSupportProperty(scaleType, 'rangeMin') &&\n isArray(d) &&\n d.length === 2\n ) {\n return makeExplicit([rangeMin ?? d[0], rangeMax ?? d[1]]);\n }\n\n return makeImplicit(d);\n}\n\nfunction parseScheme(scheme: Scheme | SignalRef): RangeScheme {\n if (isExtendedScheme(scheme)) {\n return {\n scheme: scheme.name,\n ...util.omit(scheme, ['name'])\n };\n }\n return {scheme};\n}\n\nfunction fullWidthOrHeightRange(\n channel: 'x' | 'y',\n model: UnitModel,\n scaleType: ScaleType,\n {center}: {center?: boolean} = {}\n) {\n // If step is null, use zero to width or height.\n // Note that we use SignalRefWrapper to account for potential merges and renames.\n const sizeType = getSizeChannel(channel);\n const sizeSignal = model.getName(sizeType);\n const getSignalName = model.getSignalName.bind(model);\n\n if (channel === Y && hasContinuousDomain(scaleType)) {\n // For y continuous scale, we have to start from the height as the bottom part has the max value.\n return center\n ? [\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal)\n ]\n : [SignalRefWrapper.fromName(getSignalName, sizeSignal), 0];\n } else {\n return center\n ? [\n SignalRefWrapper.fromName(name => `-${getSignalName(name)}/2`, sizeSignal),\n SignalRefWrapper.fromName(name => `${getSignalName(name)}/2`, sizeSignal)\n ]\n : [0, SignalRefWrapper.fromName(getSignalName, sizeSignal)];\n }\n}\n\nfunction defaultRange(channel: ScaleChannel, model: UnitModel): VgRange {\n const {size, config, mark, encoding} = model;\n\n const {type} = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const scaleType = mergedScaleCmpt.get('type');\n\n const {domain, domainMid} = model.specifiedScales[channel];\n\n switch (channel) {\n case X:\n case Y: {\n // If there is no explicit width/height for discrete x/y scales\n if (util.contains(['point', 'band'], scaleType)) {\n const positionSize = getDiscretePositionSize(channel, size, config.view);\n if (isStep(positionSize)) {\n const step = getPositionStep(positionSize, model, channel);\n return {step};\n }\n }\n\n return fullWidthOrHeightRange(channel, model, scaleType);\n }\n\n case XOFFSET:\n case YOFFSET:\n return getOffsetRange(channel, model, scaleType);\n\n case SIZE: {\n // TODO: support custom rangeMin, rangeMax\n const zero = model.component.scales[channel].get('zero');\n const rangeMin = sizeRangeMin(mark, zero, config);\n const rangeMax = sizeRangeMax(mark, size, model, config);\n if (isContinuousToDiscrete(scaleType)) {\n return interpolateRange(\n rangeMin,\n rangeMax,\n defaultContinuousToDiscreteCount(scaleType, config, domain, channel)\n );\n } else {\n return [rangeMin, rangeMax];\n }\n }\n\n case THETA:\n return [0, Math.PI * 2];\n\n case ANGLE:\n // TODO: add config.scale.min/maxAngleDegree (for point and text) and config.scale.min/maxAngleRadian (for arc) once we add arc marks.\n // (It's weird to add just config.scale.min/maxAngleDegree for now)\n return [0, 360];\n\n case RADIUS: {\n // max radius = half od min(width,height)\n return [\n 0,\n new SignalRefWrapper(() => {\n const w = model.getSignalName('width');\n const h = model.getSignalName('height');\n return `min(${w},${h})/2`;\n })\n ];\n }\n\n case STROKEWIDTH:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minStrokeWidth, config.scale.maxStrokeWidth];\n case STROKEDASH:\n return [\n // TODO: add this to Vega's config.range?\n [1, 0],\n [4, 2],\n [2, 1],\n [1, 1],\n [1, 2, 4, 2]\n ];\n case SHAPE:\n return 'symbol';\n case COLOR:\n case FILL:\n case STROKE:\n if (scaleType === 'ordinal') {\n // Only nominal data uses ordinal scale by default\n return type === 'nominal' ? 'category' : 'ordinal';\n } else {\n if (domainMid !== undefined) {\n return 'diverging';\n } else {\n return mark === 'rect' || mark === 'geoshape' ? 'heatmap' : 'ramp';\n }\n }\n case OPACITY:\n case FILLOPACITY:\n case STROKEOPACITY:\n // TODO: support custom rangeMin, rangeMax\n return [config.scale.minOpacity, config.scale.maxOpacity];\n }\n}\n\nfunction getPositionStep(step: Step, model: UnitModel, channel: PositionScaleChannel): number | SignalRef {\n const {encoding} = model;\n\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const offsetChannel = getOffsetScaleChannel(channel);\n const offsetDef = encoding[offsetChannel];\n const stepFor = getStepFor({step, offsetIsDiscrete: isFieldOrDatumDef(offsetDef) && isDiscrete(offsetDef.type)});\n\n if (stepFor === 'offset' && channelHasFieldOrDatum(encoding, offsetChannel)) {\n const offsetScaleCmpt = model.getScaleComponent(offsetChannel);\n const offsetScaleName = model.scaleName(offsetChannel);\n\n let stepCount = `domain('${offsetScaleName}').length`;\n\n if (offsetScaleCmpt.get('type') === 'band') {\n const offsetPaddingInner = offsetScaleCmpt.get('paddingInner') ?? offsetScaleCmpt.get('padding') ?? 0;\n const offsetPaddingOuter = offsetScaleCmpt.get('paddingOuter') ?? offsetScaleCmpt.get('padding') ?? 0;\n stepCount = `bandspace(${stepCount}, ${offsetPaddingInner}, ${offsetPaddingOuter})`;\n }\n\n const paddingInner = mergedScaleCmpt.get('paddingInner') ?? mergedScaleCmpt.get('padding');\n return {\n signal: `${step.step} * ${stepCount} / (1-${exprFromSignalRefOrValue(paddingInner)})`\n };\n } else {\n return step.step;\n }\n}\n\nfunction getOffsetStep(step: Step, offsetScaleType: ScaleType) {\n const stepFor = getStepFor({step, offsetIsDiscrete: hasDiscreteDomain(offsetScaleType)});\n if (stepFor === 'offset') {\n return {step: step.step};\n }\n return undefined;\n}\n\nfunction getOffsetRange(channel: string, model: UnitModel, offsetScaleType: ScaleType): VgRange {\n const positionChannel = channel === XOFFSET ? 'x' : 'y';\n const positionScaleCmpt = model.getScaleComponent(positionChannel);\n\n if (!positionScaleCmpt) {\n return fullWidthOrHeightRange(positionChannel, model, offsetScaleType, {center: true});\n }\n\n const positionScaleType = positionScaleCmpt.get('type');\n const positionScaleName = model.scaleName(positionChannel);\n\n const {markDef, config} = model;\n\n if (positionScaleType === 'band') {\n const size = getDiscretePositionSize(positionChannel, model.size, model.config.view);\n\n if (isStep(size)) {\n // step is for offset\n const step = getOffsetStep(size, offsetScaleType);\n if (step) {\n return step;\n }\n }\n // otherwise use the position\n return [0, {signal: `bandwidth('${positionScaleName}')`}];\n } else {\n // continuous scale\n const positionDef = model.encoding[positionChannel];\n if (isFieldDef(positionDef) && positionDef.timeUnit) {\n const duration = durationExpr(positionDef.timeUnit, expr => `scale('${positionScaleName}', ${expr})`);\n const padding = model.config.scale.bandWithNestedOffsetPaddingInner;\n const bandPositionOffset =\n getBandPosition({\n fieldDef: positionDef,\n markDef,\n config\n }) - 0.5;\n const bandPositionOffsetExpr = bandPositionOffset !== 0 ? ` + ${bandPositionOffset}` : '';\n if (padding) {\n const startRatio = isSignalRef(padding)\n ? `${padding.signal}/2` + bandPositionOffsetExpr\n : `${padding / 2 + bandPositionOffset}`;\n const endRatio = isSignalRef(padding)\n ? `(1 - ${padding.signal}/2)` + bandPositionOffsetExpr\n : `${1 - padding / 2 + bandPositionOffset}`;\n return [{signal: `${startRatio} * (${duration})`}, {signal: `${endRatio} * (${duration})`}];\n }\n return [0, {signal: duration}];\n }\n return util.never(`Cannot use ${channel} scale if ${positionChannel} scale is not discrete.`);\n }\n}\n\nfunction getDiscretePositionSize(\n channel: 'x' | 'y',\n size: LayoutSizeMixins,\n viewConfig: ViewConfig\n): Step | number | 'container' {\n const sizeChannel = channel === X ? 'width' : 'height';\n const sizeValue = size[sizeChannel];\n if (sizeValue) {\n return sizeValue;\n }\n return getViewConfigDiscreteSize(viewConfig, sizeChannel);\n}\n\nexport function defaultContinuousToDiscreteCount(\n scaleType: 'quantile' | 'quantize' | 'threshold',\n config: Config,\n domain: Domain,\n channel: ScaleChannel\n) {\n switch (scaleType) {\n case 'quantile':\n return config.scale.quantileCount;\n case 'quantize':\n return config.scale.quantizeCount;\n case 'threshold':\n if (domain !== undefined && isArray(domain)) {\n return domain.length + 1;\n } else {\n log.warn(log.message.domainRequiredForThresholdScale(channel));\n // default threshold boundaries for threshold scale since domain has cardinality of 2\n return 3;\n }\n }\n}\n\n/**\n * Returns the linear interpolation of the range according to the cardinality\n *\n * @param rangeMin start of the range\n * @param rangeMax end of the range\n * @param cardinality number of values in the output range\n */\nexport function interpolateRange(\n rangeMin: number | SignalRef,\n rangeMax: number | SignalRef,\n cardinality: number\n): SignalRef {\n // always return a signal since it's better to compute the sequence in Vega later\n const f = () => {\n const rMax = signalOrStringValue(rangeMax);\n const rMin = signalOrStringValue(rangeMin);\n const step = `(${rMax} - ${rMin}) / (${cardinality} - 1)`;\n return `sequence(${rMin}, ${rMax} + ${step}, ${step})`;\n };\n if (isSignalRef(rangeMax)) {\n return new SignalRefWrapper(f);\n } else {\n return {signal: f()};\n }\n}\n\nfunction sizeRangeMin(mark: Mark, zero: boolean | SignalRef, config: Config): number | SignalRef {\n if (zero) {\n if (isSignalRef(zero)) {\n return {signal: `${zero.signal} ? 0 : ${sizeRangeMin(mark, false, config)}`};\n } else {\n return 0;\n }\n }\n switch (mark) {\n case 'bar':\n case 'tick':\n return config.scale.minBandSize;\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.minStrokeWidth;\n case 'text':\n return config.scale.minFontSize;\n case 'point':\n case 'square':\n case 'circle':\n return config.scale.minSize;\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMin not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\nexport const MAX_SIZE_RANGE_STEP_RATIO = 0.95;\n\nfunction sizeRangeMax(\n mark: Mark,\n size: LayoutSizeMixins,\n model: UnitModel,\n config: Config\n): number | SignalRef {\n const xyStepSignals = {\n x: getBinStepSignal(model, 'x'),\n y: getBinStepSignal(model, 'y')\n };\n\n switch (mark) {\n case 'bar':\n case 'tick': {\n if (config.scale.maxBandSize !== undefined) {\n return config.scale.maxBandSize;\n }\n const min = minXYStep(size, xyStepSignals, config.view);\n\n if (isNumber(min)) {\n return min - 1;\n } else {\n return new SignalRefWrapper(() => `${min.signal} - 1`);\n }\n }\n case 'line':\n case 'trail':\n case 'rule':\n return config.scale.maxStrokeWidth;\n case 'text':\n return config.scale.maxFontSize;\n case 'point':\n case 'square':\n case 'circle': {\n if (config.scale.maxSize) {\n return config.scale.maxSize;\n }\n\n const pointStep = minXYStep(size, xyStepSignals, config.view);\n if (isNumber(pointStep)) {\n return Math.pow(MAX_SIZE_RANGE_STEP_RATIO * pointStep, 2);\n } else {\n return new SignalRefWrapper(() => `pow(${MAX_SIZE_RANGE_STEP_RATIO} * ${pointStep.signal}, 2)`);\n }\n }\n }\n /* istanbul ignore next: should never reach here */\n // sizeRangeMax not implemented for the mark\n throw new Error(log.message.incompatibleChannel('size', mark));\n}\n\n/**\n * @returns {number} Range step of x or y or minimum between the two if both are ordinal scale.\n */\nfunction minXYStep(\n size: LayoutSizeMixins,\n xyStepSignals: {x?: SignalRefWrapper; y?: SignalRefWrapper},\n viewConfig: ViewConfig\n): number | SignalRef {\n const widthStep = isStep(size.width) ? size.width.step : getViewConfigDiscreteStep(viewConfig, 'width');\n const heightStep = isStep(size.height) ? size.height.step : getViewConfigDiscreteStep(viewConfig, 'height');\n\n if (xyStepSignals.x || xyStepSignals.y) {\n return new SignalRefWrapper(() => {\n const exprs = [\n xyStepSignals.x ? xyStepSignals.x.signal : widthStep,\n xyStepSignals.y ? xyStepSignals.y.signal : heightStep\n ];\n return `min(${exprs.join(', ')})`;\n });\n }\n\n return Math.min(widthStep, heightStep);\n}\n","import {SignalRef, TimeInterval} from 'vega';\nimport {isArray, isNumber} from 'vega-util';\nimport {isBinned, isBinning, isBinParams} from '../../bin';\nimport {\n COLOR,\n FILL,\n getSecondaryRangeChannel,\n isXorY,\n isXorYOffset,\n POLAR_POSITION_SCALE_CHANNELS,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n STROKE\n} from '../../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldDef,\n ScaleDatumDef,\n ScaleFieldDef,\n TypedFieldDef,\n valueExpr\n} from '../../channeldef';\nimport {Config} from '../../config';\nimport {isDateTime} from '../../datetime';\nimport {channelHasNestedOffsetScale} from '../../encoding';\nimport * as log from '../../log';\nimport {Mark, MarkDef, RectConfig} from '../../mark';\nimport {\n channelScalePropertyIncompatability,\n Domain,\n hasContinuousDomain,\n isContinuousToContinuous,\n isContinuousToDiscrete,\n Scale,\n ScaleConfig,\n ScaleType,\n scaleTypeSupportProperty\n} from '../../scale';\nimport {Sort} from '../../sort';\nimport {Type} from '../../type';\nimport * as util from '../../util';\nimport {contains, getFirstDefined, keys} from '../../util';\nimport {isSignalRef, VgScale} from '../../vega.schema';\nimport {getBinSignalName} from '../data/bin';\nimport {isUnitModel, Model} from '../model';\nimport {SignalRefWrapper} from '../signal';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponentIndex, ScaleComponentProps} from './component';\nimport {parseUnitScaleRange} from './range';\n\nexport function parseScaleProperty(model: Model, property: Exclude) {\n if (isUnitModel(model)) {\n parseUnitScaleProperty(model, property);\n } else {\n parseNonUnitScaleProperty(model, property);\n }\n}\n\nfunction parseUnitScaleProperty(model: UnitModel, property: Exclude) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n const {config, encoding, markDef, specifiedScales} = model;\n\n for (const channel of keys(localScaleComponents)) {\n const specifiedScale = specifiedScales[channel];\n const localScaleCmpt = localScaleComponents[channel];\n const mergedScaleCmpt = model.getScaleComponent(channel);\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as ScaleFieldDef | ScaleDatumDef;\n\n const specifiedValue = specifiedScale[property];\n const scaleType = mergedScaleCmpt.get('type');\n const scalePadding = mergedScaleCmpt.get('padding');\n const scalePaddingInner = mergedScaleCmpt.get('paddingInner');\n\n const supportedByScaleType = scaleTypeSupportProperty(scaleType, property);\n const channelIncompatability = channelScalePropertyIncompatability(channel, property);\n\n if (specifiedValue !== undefined) {\n // If there is a specified value, check if it is compatible with scale type and channel\n if (!supportedByScaleType) {\n log.warn(log.message.scalePropertyNotWorkWithScaleType(scaleType, property, channel));\n } else if (channelIncompatability) {\n // channel\n log.warn(channelIncompatability);\n }\n }\n if (supportedByScaleType && channelIncompatability === undefined) {\n if (specifiedValue !== undefined) {\n const timeUnit = fieldOrDatumDef['timeUnit'];\n const type = fieldOrDatumDef.type;\n\n switch (property) {\n // domainMax/Min to signal if the value is a datetime object\n case 'domainMax':\n case 'domainMin':\n if (isDateTime(specifiedScale[property]) || type === 'temporal' || timeUnit) {\n localScaleCmpt.set(property, {signal: valueExpr(specifiedScale[property], {type, timeUnit})}, true);\n } else {\n localScaleCmpt.set(property, specifiedScale[property] as any, true);\n }\n break;\n default:\n localScaleCmpt.copyKeyFromObject>(\n property,\n specifiedScale\n );\n }\n } else {\n const value =\n property in scaleRules\n ? scaleRules[property]({\n model,\n channel,\n fieldOrDatumDef,\n scaleType,\n scalePadding,\n scalePaddingInner,\n domain: specifiedScale.domain,\n domainMin: specifiedScale.domainMin,\n domainMax: specifiedScale.domainMax,\n markDef,\n config,\n hasNestedOffsetScale: channelHasNestedOffsetScale(encoding, channel),\n hasSecondaryRangeChannel: !!encoding[getSecondaryRangeChannel(channel)]\n })\n : config.scale[property];\n if (value !== undefined) {\n localScaleCmpt.set(property, value, false);\n }\n }\n }\n }\n}\n\nexport interface ScaleRuleParams {\n model: Model;\n channel: ScaleChannel;\n fieldOrDatumDef: ScaleFieldDef | ScaleDatumDef;\n hasNestedOffsetScale: boolean;\n scaleType: ScaleType;\n scalePadding: number | SignalRef;\n scalePaddingInner: number | SignalRef;\n domain: Domain;\n domainMin: Scale['domainMin'];\n domainMax: Scale['domainMax'];\n markDef: MarkDef;\n config: Config;\n hasSecondaryRangeChannel: boolean;\n}\n\nexport const scaleRules: {\n [k in keyof Scale]?: (params: ScaleRuleParams) => Scale[k];\n} = {\n bins: ({model, fieldOrDatumDef}) => (isFieldDef(fieldOrDatumDef) ? bins(model, fieldOrDatumDef) : undefined),\n\n interpolate: ({channel, fieldOrDatumDef}) => interpolate(channel, fieldOrDatumDef.type),\n\n nice: ({scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef}) =>\n nice(scaleType, channel, domain, domainMin, domainMax, fieldOrDatumDef),\n\n padding: ({channel, scaleType, fieldOrDatumDef, markDef, config}) =>\n padding(channel, scaleType, config.scale, fieldOrDatumDef, markDef, config.bar),\n\n paddingInner: ({scalePadding, channel, markDef, scaleType, config, hasNestedOffsetScale}) =>\n paddingInner(scalePadding, channel, markDef.type, scaleType, config.scale, hasNestedOffsetScale),\n\n paddingOuter: ({scalePadding, channel, scaleType, scalePaddingInner, config, hasNestedOffsetScale}) =>\n paddingOuter(scalePadding, channel, scaleType, scalePaddingInner, config.scale, hasNestedOffsetScale),\n\n reverse: ({fieldOrDatumDef, scaleType, channel, config}) => {\n const sort = isFieldDef(fieldOrDatumDef) ? fieldOrDatumDef.sort : undefined;\n return reverse(scaleType, sort, channel, config.scale);\n },\n zero: ({channel, fieldOrDatumDef, domain, markDef, scaleType, config, hasSecondaryRangeChannel}) =>\n zero(channel, fieldOrDatumDef, domain, markDef, scaleType, config.scale, hasSecondaryRangeChannel)\n};\n\n// This method is here rather than in range.ts to avoid circular dependency.\nexport function parseScaleRange(model: Model) {\n if (isUnitModel(model)) {\n parseUnitScaleRange(model);\n } else {\n parseNonUnitScaleProperty(model, 'range');\n }\n}\n\nexport function parseNonUnitScaleProperty(model: Model, property: keyof (Scale | ScaleComponentProps)) {\n const localScaleComponents: ScaleComponentIndex = model.component.scales;\n\n for (const child of model.children) {\n if (property === 'range') {\n parseScaleRange(child);\n } else {\n parseScaleProperty(child, property);\n }\n }\n\n for (const channel of keys(localScaleComponents)) {\n let valueWithExplicit: Explicit;\n\n for (const child of model.children) {\n const childComponent = child.component.scales[channel];\n if (childComponent) {\n const childValueWithExplicit = childComponent.getWithExplicit(property);\n valueWithExplicit = mergeValuesWithExplicit(\n valueWithExplicit,\n childValueWithExplicit,\n property,\n 'scale',\n tieBreakByComparing((v1, v2) => {\n switch (property) {\n case 'range':\n // For step, prefer larger step\n if (v1.step && v2.step) {\n return v1.step - v2.step;\n }\n return 0;\n // TODO: precedence rule for other properties\n }\n return 0;\n })\n );\n }\n }\n localScaleComponents[channel].setWithExplicit(property, valueWithExplicit);\n }\n}\n\nexport function bins(model: Model, fieldDef: TypedFieldDef) {\n const bin = fieldDef.bin;\n if (isBinning(bin)) {\n const binSignal = getBinSignalName(model, fieldDef.field, bin);\n return new SignalRefWrapper(() => {\n return model.getSignalName(binSignal);\n });\n } else if (isBinned(bin) && isBinParams(bin) && bin.step !== undefined) {\n // start and stop will be determined from the scale domain\n return {\n step: bin.step\n };\n }\n return undefined;\n}\n\nexport function interpolate(channel: ScaleChannel, type: Type): Scale['interpolate'] {\n if (contains([COLOR, FILL, STROKE], channel) && type !== 'nominal') {\n return 'hcl';\n }\n return undefined;\n}\n\nexport function nice(\n scaleType: ScaleType,\n channel: ScaleChannel,\n specifiedDomain: Domain,\n domainMin: Scale['domainMin'],\n domainMax: Scale['domainMax'],\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef\n): boolean | TimeInterval {\n if (\n getFieldDef(fieldOrDatumDef)?.bin ||\n isArray(specifiedDomain) ||\n domainMax != null ||\n domainMin != null ||\n util.contains([ScaleType.TIME, ScaleType.UTC], scaleType)\n ) {\n return undefined;\n }\n return isXorY(channel) ? true : undefined;\n}\n\nexport function padding(\n channel: ScaleChannel,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n fieldOrDatumDef: TypedFieldDef | ScaleDatumDef,\n markDef: MarkDef,\n barConfig: RectConfig\n) {\n if (isXorY(channel)) {\n if (isContinuousToContinuous(scaleType)) {\n if (scaleConfig.continuousPadding !== undefined) {\n return scaleConfig.continuousPadding;\n }\n\n const {type, orient} = markDef;\n if (type === 'bar' && !(isFieldDef(fieldOrDatumDef) && (fieldOrDatumDef.bin || fieldOrDatumDef.timeUnit))) {\n if ((orient === 'vertical' && channel === 'x') || (orient === 'horizontal' && channel === 'y')) {\n return barConfig.continuousBandSize;\n }\n }\n }\n\n if (scaleType === ScaleType.POINT) {\n return scaleConfig.pointPadding;\n }\n }\n return undefined;\n}\n\nexport function paddingInner(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n mark: Mark,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n hasNestedOffsetScale = false\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingInner.\n return undefined;\n }\n\n if (isXorY(channel)) {\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n\n // paddingOuter would only be called if it's a band scale, just return the default for bandScale.\n const {bandPaddingInner, barBandPaddingInner, rectBandPaddingInner, bandWithNestedOffsetPaddingInner} = scaleConfig;\n\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingInner;\n }\n\n return getFirstDefined(bandPaddingInner, mark === 'bar' ? barBandPaddingInner : rectBandPaddingInner);\n } else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingInner;\n }\n }\n return undefined;\n}\n\nexport function paddingOuter(\n paddingValue: number | SignalRef,\n channel: ScaleChannel,\n scaleType: ScaleType,\n paddingInnerValue: number | SignalRef,\n scaleConfig: ScaleConfig,\n hasNestedOffsetScale = false\n) {\n if (paddingValue !== undefined) {\n // If user has already manually specified \"padding\", no need to add default paddingOuter.\n return undefined;\n }\n\n if (isXorY(channel)) {\n const {bandPaddingOuter, bandWithNestedOffsetPaddingOuter} = scaleConfig;\n if (hasNestedOffsetScale) {\n return bandWithNestedOffsetPaddingOuter;\n }\n // Padding is only set for X and Y by default.\n // Basically it doesn't make sense to add padding for color and size.\n if (scaleType === ScaleType.BAND) {\n return getFirstDefined(\n bandPaddingOuter,\n /* By default, paddingOuter is paddingInner / 2. The reason is that\n size (width/height) = step * (cardinality - paddingInner + 2 * paddingOuter).\n and we want the width/height to be integer by default.\n Note that step (by default) and cardinality are integers.) */\n isSignalRef(paddingInnerValue) ? {signal: `${paddingInnerValue.signal}/2`} : paddingInnerValue / 2\n );\n }\n } else if (isXorYOffset(channel)) {\n if (scaleType === ScaleType.POINT) {\n return 0.5; // so the point positions align with centers of band scales.\n } else if (scaleType === ScaleType.BAND) {\n return scaleConfig.offsetBandPaddingOuter;\n }\n }\n return undefined;\n}\n\nexport function reverse(\n scaleType: ScaleType,\n sort: Sort,\n channel: ScaleChannel,\n scaleConfig: ScaleConfig\n) {\n if (channel === 'x' && scaleConfig.xReverse !== undefined) {\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n if (isSignalRef(scaleConfig.xReverse)) {\n return {signal: `!${scaleConfig.xReverse.signal}`};\n } else {\n return !scaleConfig.xReverse;\n }\n }\n return scaleConfig.xReverse;\n }\n\n if (hasContinuousDomain(scaleType) && sort === 'descending') {\n // For continuous domain scales, Vega does not support domain sort.\n // Thus, we reverse range instead if sort is descending\n return true;\n }\n return undefined;\n}\n\nexport function zero(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n specifiedDomain: Domain,\n markDef: MarkDef,\n scaleType: ScaleType,\n scaleConfig: ScaleConfig,\n hasSecondaryRangeChannel: boolean\n) {\n // If users explicitly provide a domain, we should not augment zero as that will be unexpected.\n const hasCustomDomain = !!specifiedDomain && specifiedDomain !== 'unaggregated';\n if (hasCustomDomain) {\n if (hasContinuousDomain(scaleType)) {\n if (isArray(specifiedDomain)) {\n const first = specifiedDomain[0];\n const last = specifiedDomain[specifiedDomain.length - 1];\n\n if (isNumber(first) && first <= 0 && isNumber(last) && last >= 0) {\n // if the domain includes zero, make zero remain true\n return true;\n }\n }\n return false;\n }\n }\n\n // If there is no custom domain, return configZero value (=`true` as default) only for the following cases:\n\n // 1) using quantitative field with size\n // While this can be either ratio or interval fields, our assumption is that\n // ratio are more common. However, if the scaleType is discretizing scale, we want to return\n // false so that range doesn't start at zero\n if (channel === 'size' && fieldDef.type === 'quantitative' && !isContinuousToDiscrete(scaleType)) {\n return true;\n }\n\n // 2) non-binned, quantitative x-scale or y-scale\n // (For binning, we should not include zero by default because binning are calculated without zero.)\n // (For area/bar charts with ratio scale chart, we should always include zero.)\n if (\n !(isFieldDef(fieldDef) && fieldDef.bin) &&\n util.contains([...POSITION_SCALE_CHANNELS, ...POLAR_POSITION_SCALE_CHANNELS], channel)\n ) {\n const {orient, type} = markDef;\n if (contains(['bar', 'area', 'line', 'trail'], type)) {\n if ((orient === 'horizontal' && channel === 'y') || (orient === 'vertical' && channel === 'x')) {\n return false;\n }\n }\n\n if (contains(['bar', 'area'], type) && !hasSecondaryRangeChannel) {\n return true;\n }\n\n return scaleConfig?.zero;\n }\n\n return false;\n}\n","import {isBinning} from '../../bin';\nimport {\n getSizeChannel,\n isColorChannel,\n isScaleChannel,\n isXorY,\n isXorYOffset,\n rangeType,\n ScaleChannel\n} from '../../channel';\nimport {DatumDef, isFieldDef, isPositionFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport * as log from '../../log';\nimport {isRelativeBandSize, MarkDef} from '../../mark';\nimport {channelSupportScaleType, Scale, ScaleType, scaleTypeSupportDataType} from '../../scale';\nimport {normalizeTimeUnit} from '../../timeunit';\nimport * as util from '../../util';\nimport {POLAR_POSITION_SCALE_CHANNEL_INDEX} from './../../channel';\n\nexport type RangeType = 'continuous' | 'discrete' | 'flexible' | undefined;\n\n/**\n * Determine if there is a specified scale type and if it is appropriate,\n * or determine default type if type is unspecified or inappropriate.\n */\n// NOTE: CompassQL uses this method.\nexport function scaleType(\n specifiedScale: Scale,\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | DatumDef,\n mark: MarkDef,\n hasNestedOffsetScale = false\n): ScaleType {\n const defaultScaleType = defaultType(channel, fieldDef, mark, hasNestedOffsetScale);\n const {type} = specifiedScale;\n\n if (!isScaleChannel(channel)) {\n // There is no scale for these channels\n return null;\n }\n if (type !== undefined) {\n // Check if explicitly specified scale type is supported by the channel\n if (!channelSupportScaleType(channel, type)) {\n log.warn(log.message.scaleTypeNotWorkWithChannel(channel, type, defaultScaleType));\n return defaultScaleType;\n }\n\n // Check if explicitly specified scale type is supported by the data type\n if (isFieldDef(fieldDef) && !scaleTypeSupportDataType(type, fieldDef.type)) {\n log.warn(log.message.scaleTypeNotWorkWithFieldDef(type, defaultScaleType));\n return defaultScaleType;\n }\n\n return type;\n }\n\n return defaultScaleType;\n}\n\n/**\n * Determine appropriate default scale type.\n */\n// NOTE: Voyager uses this method.\nfunction defaultType(\n channel: ScaleChannel,\n fieldDef: TypedFieldDef | ScaleDatumDef,\n mark: MarkDef,\n hasNestedOffsetScale: boolean\n): ScaleType {\n switch (fieldDef.type) {\n case 'nominal':\n case 'ordinal': {\n if (isColorChannel(channel) || rangeType(channel) === 'discrete') {\n if (channel === 'shape' && fieldDef.type === 'ordinal') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'ordinal'));\n }\n return 'ordinal';\n }\n\n if (isXorY(channel) || isXorYOffset(channel)) {\n if (util.contains(['rect', 'bar', 'image', 'rule'], mark.type)) {\n // The rect/bar mark should fit into a band.\n // For rule, using band scale to make rule align with axis ticks better https://github.com/vega/vega-lite/issues/3429\n return 'band';\n }\n if (hasNestedOffsetScale) {\n // If there is a nested offset scale, then there is a \"band\" for the span of the nested scale.\n return 'band';\n }\n } else if (mark.type === 'arc' && channel in POLAR_POSITION_SCALE_CHANNEL_INDEX) {\n return 'band';\n }\n\n const dimensionSize = mark[getSizeChannel(channel)];\n if (isRelativeBandSize(dimensionSize)) {\n return 'band';\n }\n\n if (isPositionFieldOrDatumDef(fieldDef) && fieldDef.axis?.tickBand) {\n return 'band';\n }\n // Otherwise, use ordinal point scale so we can easily get center positions of the marks.\n return 'point';\n }\n\n case 'temporal':\n if (isColorChannel(channel)) {\n return 'time';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'temporal'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n } else if (isFieldDef(fieldDef) && fieldDef.timeUnit && normalizeTimeUnit(fieldDef.timeUnit).utc) {\n return 'utc';\n }\n return 'time';\n\n case 'quantitative':\n if (isColorChannel(channel)) {\n if (isFieldDef(fieldDef) && isBinning(fieldDef.bin)) {\n return 'bin-ordinal';\n }\n\n return 'linear';\n } else if (rangeType(channel) === 'discrete') {\n log.warn(log.message.discreteChannelCannotEncode(channel, 'quantitative'));\n // TODO: consider using quantize (equivalent to binning) once we have it\n return 'ordinal';\n }\n\n return 'linear';\n\n case 'geojson':\n return undefined;\n }\n\n /* istanbul ignore next: should never reach this */\n throw new Error(log.message.invalidFieldType(fieldDef.type));\n}\n","import {ScaleChannel, SCALE_CHANNELS, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, ScaleDatumDef, TypedFieldDef} from '../../channeldef';\nimport {channelHasNestedOffsetScale} from '../../encoding';\nimport {GEOSHAPE} from '../../mark';\nimport {\n NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES,\n scaleCompatible,\n ScaleType,\n scaleTypePrecedence\n} from '../../scale';\nimport {GEOJSON} from '../../type';\nimport {keys} from '../../util';\nimport {VgScale} from '../../vega.schema';\nimport {isUnitModel, Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit, tieBreakByComparing} from '../split';\nimport {UnitModel} from '../unit';\nimport {ScaleComponent, ScaleComponentIndex} from './component';\nimport {parseScaleDomain} from './domain';\nimport {parseScaleProperty, parseScaleRange} from './properties';\nimport {scaleType} from './type';\n\nexport function parseScales(model: Model, {ignoreRange}: {ignoreRange?: boolean} = {}) {\n parseScaleCore(model);\n parseScaleDomain(model);\n for (const prop of NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES) {\n parseScaleProperty(model, prop);\n }\n if (!ignoreRange) {\n // range depends on zero\n parseScaleRange(model);\n }\n}\n\nexport function parseScaleCore(model: Model) {\n if (isUnitModel(model)) {\n model.component.scales = parseUnitScaleCore(model);\n } else {\n model.component.scales = parseNonUnitScaleCore(model);\n }\n}\n\n/**\n * Parse scales for all channels of a model.\n */\nfunction parseUnitScaleCore(model: UnitModel): ScaleComponentIndex {\n const {encoding, mark, markDef} = model;\n const scaleComponents: ScaleComponentIndex = {};\n for (const channel of SCALE_CHANNELS) {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as TypedFieldDef | ScaleDatumDef; // must be typed def to have scale\n\n // Don't generate scale for shape of geoshape\n if (fieldOrDatumDef && mark === GEOSHAPE && channel === SHAPE && fieldOrDatumDef.type === GEOJSON) {\n continue;\n }\n\n let specifiedScale = fieldOrDatumDef && fieldOrDatumDef['scale'];\n if (fieldOrDatumDef && specifiedScale !== null && specifiedScale !== false) {\n specifiedScale ??= {};\n const hasNestedOffsetScale = channelHasNestedOffsetScale(encoding, channel);\n\n const sType = scaleType(specifiedScale, channel, fieldOrDatumDef, markDef, hasNestedOffsetScale);\n scaleComponents[channel] = new ScaleComponent(model.scaleName(`${channel}`, true), {\n value: sType,\n explicit: specifiedScale.type === sType\n });\n }\n }\n return scaleComponents;\n}\n\nconst scaleTypeTieBreaker = tieBreakByComparing(\n (st1: ScaleType, st2: ScaleType) => scaleTypePrecedence(st1) - scaleTypePrecedence(st2)\n);\n\nfunction parseNonUnitScaleCore(model: Model) {\n const scaleComponents: ScaleComponentIndex = (model.component.scales = {});\n\n const scaleTypeWithExplicitIndex: Partial>> = {};\n const resolve = model.component.resolve;\n\n // Parse each child scale and determine if a particular channel can be merged.\n for (const child of model.children) {\n parseScaleCore(child);\n\n // Instead of always merging right away -- check if it is compatible to merge first!\n for (const channel of keys(child.component.scales)) {\n // if resolve is undefined, set default first\n resolve.scale[channel] ??= defaultScaleResolve(channel, model);\n\n if (resolve.scale[channel] === 'shared') {\n const explicitScaleType = scaleTypeWithExplicitIndex[channel];\n const childScaleType = child.component.scales[channel].getWithExplicit('type');\n\n if (explicitScaleType) {\n if (scaleCompatible(explicitScaleType.value, childScaleType.value)) {\n // merge scale component if type are compatible\n scaleTypeWithExplicitIndex[channel] = mergeValuesWithExplicit(\n explicitScaleType,\n childScaleType,\n 'type',\n 'scale',\n scaleTypeTieBreaker\n );\n } else {\n // Otherwise, update conflicting channel to be independent\n resolve.scale[channel] = 'independent';\n // Remove from the index so they don't get merged\n delete scaleTypeWithExplicitIndex[channel];\n }\n } else {\n scaleTypeWithExplicitIndex[channel] = childScaleType;\n }\n }\n }\n }\n\n // Merge each channel listed in the index\n for (const channel of keys(scaleTypeWithExplicitIndex)) {\n // Create new merged scale component\n const name = model.scaleName(channel, true);\n const typeWithExplicit = scaleTypeWithExplicitIndex[channel];\n scaleComponents[channel] = new ScaleComponent(name, typeWithExplicit);\n\n // rename each child and mark them as merged\n for (const child of model.children) {\n const childScale = child.component.scales[channel];\n if (childScale) {\n child.renameScale(childScale.get('name'), name);\n childScale.merged = true;\n }\n }\n }\n\n return scaleComponents;\n}\n","import {\n AnchorValue,\n Axis as VgAxis,\n Legend as VgLegend,\n NewSignal,\n Projection as VgProjection,\n Signal,\n SignalRef,\n Title as VgTitle\n} from 'vega';\nimport {\n Channel,\n ExtendedChannel,\n FACET_CHANNELS,\n getPositionScaleChannel,\n isChannel,\n isScaleChannel,\n ScaleChannel,\n SingleDefChannel\n} from '../channel';\nimport {ChannelDef, FieldDef, FieldRefOption, getFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {Data, DataSourceType} from '../data';\nimport {forEach, reduce} from '../encoding';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport * as log from '../log';\nimport {Resolve} from '../resolve';\nimport {hasDiscreteDomain} from '../scale';\nimport {isFacetSpec} from '../spec';\nimport {\n extractCompositionLayout,\n GenericCompositionLayoutWithColumns,\n LayoutSizeMixins,\n SpecType,\n ViewBackground\n} from '../spec/base';\nimport {NormalizedSpec} from '../spec/index';\nimport {extractTitleConfig, isText, TitleParams} from '../title';\nimport {normalizeTransform, Transform} from '../transform';\nimport {contains, Dict, duplicate, isEmpty, keys, varName} from '../util';\nimport {isVgRangeStep, VgData, VgEncodeEntry, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {assembleAxes} from './axis/assemble';\nimport {AxisComponentIndex} from './axis/component';\nimport {signalOrValueRef} from './common';\nimport {ConcatModel} from './concat';\nimport {DataComponent} from './data';\nimport {FacetModel} from './facet';\nimport {assembleHeaderGroups, assembleLayoutTitleBand, assembleTitleGroup} from './header/assemble';\nimport {HEADER_CHANNELS, LayoutHeaderComponent} from './header/component';\nimport {LayerModel} from './layer';\nimport {sizeExpr} from './layoutsize/assemble';\nimport {\n getSizeTypeFromLayoutSizeType,\n LayoutSizeComponent,\n LayoutSizeIndex,\n LayoutSizeType\n} from './layoutsize/component';\nimport {assembleLegends} from './legend/assemble';\nimport {LegendComponentIndex} from './legend/component';\nimport {parseLegend} from './legend/parse';\nimport {assembleProjections} from './projection/assemble';\nimport {ProjectionComponent} from './projection/component';\nimport {parseProjection} from './projection/parse';\nimport {assembleScales} from './scale/assemble';\nimport {ScaleComponent, ScaleComponentIndex} from './scale/component';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {parseScales} from './scale/parse';\nimport {SelectionComponent} from './selection';\nimport {Split} from './split';\nimport {UnitModel} from './unit';\n\n/**\n * Composable Components that are intermediate results of the parsing phase of the\n * compilations. The components represents parts of the specification in a form that\n * can be easily merged (during parsing for composite specs).\n * In addition, these components are easily transformed into Vega specifications\n * during the \"assemble\" phase, which is the last phase of the compilation step.\n */\nexport interface Component {\n data: DataComponent;\n\n layoutSize: LayoutSizeComponent;\n\n layoutHeaders: {\n row?: LayoutHeaderComponent;\n column?: LayoutHeaderComponent;\n facet?: LayoutHeaderComponent;\n };\n\n mark: VgMarkGroup[];\n scales: ScaleComponentIndex;\n projection: ProjectionComponent;\n selection: Dict;\n\n /** Dictionary mapping channel to VgAxis definition */\n axes: AxisComponentIndex;\n\n /** Dictionary mapping channel to VgLegend definition */\n legends: LegendComponentIndex;\n\n resolve: Resolve;\n}\n\nexport interface NameMapInterface {\n rename(oldname: string, newName: string): void;\n has(name: string): boolean;\n get(name: string): string;\n}\n\nexport class NameMap implements NameMapInterface {\n private nameMap: Dict;\n\n constructor() {\n this.nameMap = {};\n }\n\n public rename(oldName: string, newName: string) {\n this.nameMap[oldName] = newName;\n }\n\n public has(name: string): boolean {\n return this.nameMap[name] !== undefined;\n }\n\n public get(name: string): string {\n // If the name appears in the _nameMap, we need to read its new name.\n // We have to loop over the dict just in case the new name also gets renamed.\n while (this.nameMap[name] && name !== this.nameMap[name]) {\n name = this.nameMap[name];\n }\n\n return name;\n }\n}\n\n/*\n We use type guards instead of `instanceof` as `instanceof` makes\n different parts of the compiler depend on the actual implementation of\n the model classes, which in turn depend on different parts of the compiler.\n Thus, `instanceof` leads to circular dependency problems.\n\n On the other hand, type guards only make different parts of the compiler\n depend on the type of the model classes, but not the actual implementation.\n*/\n\nexport function isUnitModel(model: Model): model is UnitModel {\n return model?.type === 'unit';\n}\n\nexport function isFacetModel(model: Model): model is FacetModel {\n return model?.type === 'facet';\n}\n\nexport function isConcatModel(model: Model): model is ConcatModel {\n return model?.type === 'concat';\n}\n\nexport function isLayerModel(model: Model): model is LayerModel {\n return model?.type === 'layer';\n}\n\nexport abstract class Model {\n public readonly name: string;\n\n public size: LayoutSizeMixins;\n\n public readonly title: TitleParams;\n public readonly description: string;\n\n public readonly data: Data | null;\n public readonly transforms: Transform[];\n public readonly layout: GenericCompositionLayoutWithColumns;\n\n /** Name map for scales, which can be renamed by a model's parent. */\n protected scaleNameMap: NameMapInterface;\n\n /** Name map for projections, which can be renamed by a model's parent. */\n protected projectionNameMap: NameMapInterface;\n\n /** Name map for signals, which can be renamed by a model's parent. */\n protected signalNameMap: NameMapInterface;\n\n public readonly component: Component;\n\n public readonly view?: ViewBackground;\n\n public abstract readonly children: Model[];\n\n constructor(\n spec: NormalizedSpec,\n public readonly type: SpecType,\n public readonly parent: Model,\n parentGivenName: string,\n public readonly config: Config,\n resolve: Resolve,\n view?: ViewBackground\n ) {\n this.parent = parent;\n this.config = config;\n this.view = replaceExprRef(view);\n\n // If name is not provided, always use parent's givenName to avoid name conflicts.\n this.name = spec.name ?? parentGivenName;\n this.title = isText(spec.title) ? {text: spec.title} : spec.title ? replaceExprRef(spec.title) : undefined;\n\n // Shared name maps\n this.scaleNameMap = parent ? parent.scaleNameMap : new NameMap();\n this.projectionNameMap = parent ? parent.projectionNameMap : new NameMap();\n this.signalNameMap = parent ? parent.signalNameMap : new NameMap();\n\n this.data = spec.data;\n\n this.description = spec.description;\n this.transforms = normalizeTransform(spec.transform ?? []);\n this.layout = type === 'layer' || type === 'unit' ? {} : extractCompositionLayout(spec, type, config);\n\n this.component = {\n data: {\n sources: parent ? parent.component.data.sources : [],\n outputNodes: parent ? parent.component.data.outputNodes : {},\n outputNodeRefCounts: parent ? parent.component.data.outputNodeRefCounts : {},\n // data is faceted if the spec is a facet spec or the parent has faceted data and data is undefined\n isFaceted: isFacetSpec(spec) || (parent?.component.data.isFaceted && spec.data === undefined)\n },\n layoutSize: new Split(),\n layoutHeaders: {row: {}, column: {}, facet: {}},\n mark: null,\n resolve: {\n scale: {},\n axis: {},\n legend: {},\n ...(resolve ? duplicate(resolve) : {})\n },\n selection: null,\n scales: null,\n projection: null,\n axes: {},\n legends: {}\n };\n }\n\n public get width(): SignalRef {\n return this.getSizeSignalRef('width');\n }\n\n public get height(): SignalRef {\n return this.getSizeSignalRef('height');\n }\n\n public parse() {\n this.parseScale();\n\n this.parseLayoutSize(); // depends on scale\n this.renameTopLevelLayoutSizeSignal();\n\n this.parseSelections();\n this.parseProjection();\n this.parseData(); // (pathorder) depends on markDef; selection filters depend on parsed selections; depends on projection because some transforms require the finalized projection name.\n this.parseAxesAndHeaders(); // depends on scale and layout size\n this.parseLegends(); // depends on scale, markDef\n this.parseMarkGroup(); // depends on data name, scale, layout size, axisGroup, and children's scale, axis, legend and mark.\n }\n\n public abstract parseData(): void;\n\n public abstract parseSelections(): void;\n\n public parseScale() {\n parseScales(this);\n }\n\n public parseProjection() {\n parseProjection(this);\n }\n\n public abstract parseLayoutSize(): void;\n\n /**\n * Rename top-level spec's size to be just width / height, ignoring model name.\n * This essentially merges the top-level spec's width/height signals with the width/height signals\n * to help us reduce redundant signals declaration.\n */\n private renameTopLevelLayoutSizeSignal() {\n if (this.getName('width') !== 'width') {\n this.renameSignal(this.getName('width'), 'width');\n }\n if (this.getName('height') !== 'height') {\n this.renameSignal(this.getName('height'), 'height');\n }\n }\n\n public abstract parseMarkGroup(): void;\n\n public abstract parseAxesAndHeaders(): void;\n\n public parseLegends() {\n parseLegend(this);\n }\n\n public abstract assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[];\n public abstract assembleSignals(): NewSignal[];\n\n public abstract assembleSelectionData(data: readonly VgData[]): readonly VgData[];\n\n public abstract assembleGroupStyle(): string | string[];\n\n private assembleEncodeFromView(view: ViewBackground): VgEncodeEntry {\n // Exclude \"style\"\n const {style: _, ...baseView} = view;\n\n const e: VgEncodeEntry = {};\n for (const property of keys(baseView)) {\n const value = baseView[property];\n if (value !== undefined) {\n e[property] = signalOrValueRef(value);\n }\n }\n\n return e;\n }\n\n public assembleGroupEncodeEntry(isTopLevel: boolean): VgEncodeEntry {\n let encodeEntry: VgEncodeEntry = {};\n if (this.view) {\n encodeEntry = this.assembleEncodeFromView(this.view);\n }\n\n if (!isTopLevel) {\n // Descriptions are already added to the top-level description so we only need to add them to the inner views.\n if (this.description) {\n encodeEntry['description'] = signalOrValueRef(this.description);\n }\n\n // For top-level spec, we can set the global width and height signal to adjust the group size.\n // For other child specs, we have to manually set width and height in the encode entry.\n if (this.type === 'unit' || this.type === 'layer') {\n return {\n width: this.getSizeSignalRef('width'),\n height: this.getSizeSignalRef('height'),\n ...(encodeEntry ?? {})\n };\n }\n }\n\n return isEmpty(encodeEntry) ? undefined : encodeEntry;\n }\n\n public assembleLayout(): VgLayout {\n if (!this.layout) {\n return undefined;\n }\n\n const {spacing, ...layout} = this.layout;\n\n const {component, config} = this;\n const titleBand = assembleLayoutTitleBand(component.layoutHeaders, config);\n\n return {\n padding: spacing,\n ...this.assembleDefaultLayout(),\n ...layout,\n ...(titleBand ? {titleBand} : {})\n };\n }\n\n protected assembleDefaultLayout(): VgLayout {\n return {};\n }\n\n public abstract assembleLayoutSignals(): NewSignal[];\n\n public assembleHeaderMarks(): VgMarkGroup[] {\n const {layoutHeaders} = this.component;\n let headerMarks = [];\n\n for (const channel of FACET_CHANNELS) {\n if (layoutHeaders[channel].title) {\n headerMarks.push(assembleTitleGroup(this, channel));\n }\n }\n\n for (const channel of HEADER_CHANNELS) {\n headerMarks = headerMarks.concat(assembleHeaderGroups(this, channel));\n }\n return headerMarks;\n }\n\n public abstract assembleMarks(): VgMarkGroup[];\n\n public assembleAxes(): VgAxis[] {\n return assembleAxes(this.component.axes, this.config);\n }\n\n public assembleLegends(): VgLegend[] {\n return assembleLegends(this);\n }\n\n public assembleProjections(): VgProjection[] {\n return assembleProjections(this);\n }\n\n public assembleTitle(): VgTitle {\n const {encoding, ...titleNoEncoding} = this.title ?? ({} as TitleParams);\n\n const title: VgTitle = {\n ...extractTitleConfig(this.config.title).nonMarkTitleProperties,\n ...titleNoEncoding,\n ...(encoding ? {encode: {update: encoding}} : {})\n };\n\n if (title.text) {\n if (contains(['unit', 'layer'], this.type)) {\n // Unit/Layer\n if (contains(['middle', undefined], title.anchor)) {\n title.frame ??= 'group';\n }\n } else {\n // composition with Vega layout\n\n // Set title = \"start\" by default for composition as \"middle\" does not look nice\n // https://github.com/vega/vega/issues/960#issuecomment-471360328\n title.anchor ??= 'start';\n }\n\n return isEmpty(title) ? undefined : title;\n }\n return undefined;\n }\n\n /**\n * Assemble the mark group for this model. We accept optional `signals` so that we can include concat top-level signals with the top-level model's local signals.\n */\n public assembleGroup(signals: Signal[] = []) {\n const group: VgMarkGroup = {};\n\n signals = signals.concat(this.assembleSignals());\n\n if (signals.length > 0) {\n group.signals = signals;\n }\n\n const layout = this.assembleLayout();\n if (layout) {\n group.layout = layout;\n }\n\n group.marks = [].concat(this.assembleHeaderMarks(), this.assembleMarks());\n\n // Only include scales if this spec is top-level or if parent is facet.\n // (Otherwise, it will be merged with upper-level's scope.)\n const scales = !this.parent || isFacetModel(this.parent) ? assembleScales(this) : [];\n if (scales.length > 0) {\n group.scales = scales;\n }\n\n const axes = this.assembleAxes();\n if (axes.length > 0) {\n group.axes = axes;\n }\n\n const legends = this.assembleLegends();\n if (legends.length > 0) {\n group.legends = legends;\n }\n\n return group;\n }\n\n public getName(text: string) {\n return varName((this.name ? `${this.name}_` : '') + text);\n }\n\n public getDataName(type: DataSourceType) {\n return this.getName(DataSourceType[type].toLowerCase());\n }\n\n /**\n * Request a data source name for the given data source type and mark that data source as required.\n * This method should be called in parse, so that all used data source can be correctly instantiated in assembleData().\n * You can lookup the correct dataset name in assemble with `lookupDataSource`.\n */\n public requestDataName(name: DataSourceType) {\n const fullName = this.getDataName(name);\n\n // Increase ref count. This is critical because otherwise we won't create a data source.\n // We also increase the ref counts on OutputNode.getSource() calls.\n const refCounts = this.component.data.outputNodeRefCounts;\n refCounts[fullName] = (refCounts[fullName] || 0) + 1;\n\n return fullName;\n }\n\n public getSizeSignalRef(layoutSizeType: LayoutSizeType): SignalRef {\n if (isFacetModel(this.parent)) {\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const scaleComponent = this.component.scales[channel];\n\n if (scaleComponent && !scaleComponent.merged) {\n // independent scale\n const type = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const scaleName = scaleComponent.get('name');\n const domain = assembleDomain(this, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n const fieldRef = vgField({aggregate: 'distinct', field}, {expr: 'datum'});\n return {\n signal: sizeExpr(scaleName, scaleComponent, fieldRef)\n };\n } else {\n log.warn(log.message.unknownField(channel));\n return null;\n }\n }\n }\n }\n\n return {\n signal: this.signalNameMap.get(this.getName(layoutSizeType))\n };\n }\n\n /**\n * Lookup the name of the datasource for an output node. You probably want to call this in assemble.\n */\n public lookupDataSource(name: string) {\n const node = this.component.data.outputNodes[name];\n\n if (!node) {\n // Name not found in map so let's just return what we got.\n // This can happen if we already have the correct name.\n return name;\n }\n\n return node.getSource();\n }\n\n public getSignalName(oldSignalName: string): string {\n return this.signalNameMap.get(oldSignalName);\n }\n\n public renameSignal(oldName: string, newName: string) {\n this.signalNameMap.rename(oldName, newName);\n }\n\n public renameScale(oldName: string, newName: string) {\n this.scaleNameMap.rename(oldName, newName);\n }\n\n public renameProjection(oldName: string, newName: string) {\n this.projectionNameMap.rename(oldName, newName);\n }\n\n /**\n * @return scale name for a given channel after the scale has been parsed and named.\n */\n public scaleName(originalScaleName: ScaleChannel | string, parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a scale can't be renamed\n // before it has the original name.\n return this.getName(originalScaleName);\n }\n\n // If there is a scale for the channel, it should either\n // be in the scale component or exist in the name map\n if (\n // If there is a scale for the channel, there should be a local scale component for it\n (isChannel(originalScaleName) && isScaleChannel(originalScaleName) && this.component.scales[originalScaleName]) ||\n // in the scale name map (the scale get merged by its parent)\n this.scaleNameMap.has(this.getName(originalScaleName))\n ) {\n return this.scaleNameMap.get(this.getName(originalScaleName));\n }\n return undefined;\n }\n\n /**\n * @return projection name after the projection has been parsed and named.\n */\n public projectionName(parse?: boolean): string {\n if (parse) {\n // During the parse phase always return a value\n // No need to refer to rename map because a projection can't be renamed\n // before it has the original name.\n return this.getName('projection');\n }\n\n if (\n (this.component.projection && !this.component.projection.merged) ||\n this.projectionNameMap.has(this.getName('projection'))\n ) {\n return this.projectionNameMap.get(this.getName('projection'));\n }\n return undefined;\n }\n\n /**\n * Corrects the data references in marks after assemble.\n */\n public correctDataNames = (mark: VgMarkGroup) => {\n // TODO: make this correct\n\n // for normal data references\n if (mark.from?.data) {\n mark.from.data = this.lookupDataSource(mark.from.data);\n }\n\n // for access to facet data\n if (mark.from?.facet?.data) {\n mark.from.facet.data = this.lookupDataSource(mark.from.facet.data);\n }\n\n return mark;\n };\n\n /**\n * Traverse a model's hierarchy to get the scale component for a particular channel.\n */\n public getScaleComponent(channel: ScaleChannel): ScaleComponent {\n /* istanbul ignore next: This is warning for debugging test */\n if (!this.component.scales) {\n throw new Error(\n 'getScaleComponent cannot be called before parseScale(). Make sure you have called parseScale or use parseUnitModelWithScale().'\n );\n }\n\n const localScaleComponent = this.component.scales[channel];\n if (localScaleComponent && !localScaleComponent.merged) {\n return localScaleComponent;\n }\n return this.parent ? this.parent.getScaleComponent(channel) : undefined;\n }\n\n /**\n * Traverse a model's hierarchy to get a particular selection component.\n */\n public getSelectionComponent(variableName: string, origName: string): SelectionComponent {\n let sel = this.component.selection[variableName];\n if (!sel && this.parent) {\n sel = this.parent.getSelectionComponent(variableName, origName);\n }\n if (!sel) {\n throw new Error(log.message.selectionNotFound(origName));\n }\n return sel;\n }\n\n /**\n * Returns true if the model has a signalRef for an axis orient.\n */\n public hasAxisOrientSignalRef() {\n return (\n this.component.axes.x?.some(a => a.hasOrientSignalRef()) ||\n this.component.axes.y?.some(a => a.hasOrientSignalRef())\n );\n }\n}\n\n/** Abstract class for UnitModel and FacetModel. Both of which can contain fieldDefs as a part of its own specification. */\nexport abstract class ModelWithField extends Model {\n public abstract fieldDef(channel: SingleDefChannel): FieldDef;\n\n /** Get \"field\" reference for Vega */\n public vgField(channel: SingleDefChannel, opt: FieldRefOption = {}) {\n const fieldDef = this.fieldDef(channel);\n\n if (!fieldDef) {\n return undefined;\n }\n\n return vgField(fieldDef, opt);\n }\n\n protected abstract getMapping(): Partial>;\n\n public reduceFieldDef(f: (acc: U, fd: FieldDef, c: Channel) => U, init: T): T {\n return reduce(\n this.getMapping(),\n (acc: U, cd: ChannelDef, c: Channel) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n return f(acc, fieldDef, c);\n }\n return acc;\n },\n init\n );\n }\n\n public forEachFieldDef(f: (fd: FieldDef, c: ExtendedChannel) => void, t?: any) {\n forEach(\n this.getMapping(),\n (cd, c) => {\n const fieldDef = getFieldDef(cd);\n if (fieldDef) {\n f(fieldDef, c);\n }\n },\n t\n );\n }\n\n public abstract channelHasField(channel: Channel): boolean;\n}\n","import {KDETransform as VgKDETransform} from 'vega';\nimport {DensityTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for density transform nodes\n */\nexport class DensityTransformNode extends DataFlowNode {\n public clone() {\n return new DensityTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: DensityTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'value', specifiedAs[1] ?? 'density'];\n }\n\n public dependentFields() {\n return new Set([this.transform.density, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `DensityTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgKDETransform {\n const {density, ...rest} = this.transform;\n const result: VgKDETransform = {\n type: 'kde',\n field: density,\n ...rest\n };\n if (this.transform.groupby) {\n result.resolve = 'shared';\n }\n return result;\n }\n}\n","import {ExtentTransform as VgExtentTransform} from 'vega';\nimport {ExtentTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class ExtentTransformNode extends DataFlowNode {\n public clone() {\n return new ExtentTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: ExtentTransform\n ) {\n super(parent);\n this.transform = duplicate(transform);\n }\n\n public dependentFields() {\n return new Set([this.transform.extent]);\n }\n\n public producedFields() {\n return new Set([]);\n }\n\n public hash() {\n return `ExtentTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgExtentTransform {\n const {extent, param} = this.transform;\n const result: VgExtentTransform = {\n type: 'extent',\n field: extent,\n signal: param\n };\n return result;\n }\n}\n","import {FilterTransform as VgFilterTransform} from 'vega';\nimport {isScaleChannel} from '../../channel';\nimport {TypedFieldDef, vgField as fieldRef} from '../../channeldef';\nimport {isPathMark} from '../../mark';\nimport {hasContinuousDomain} from '../../scale';\nimport {Dict, hash, keys} from '../../util';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class FilterInvalidNode extends DataFlowNode {\n public clone() {\n return new FilterInvalidNode(null, {...this.filter});\n }\n\n constructor(\n parent: DataFlowNode,\n public readonly filter: Dict>\n ) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: UnitModel): FilterInvalidNode {\n const {config, mark, markDef} = model;\n\n const invalid = getMarkPropOrConfig('invalid', markDef, config);\n if (invalid !== 'filter') {\n return null;\n }\n\n const filter = model.reduceFieldDef(\n (aggregator: Dict>, fieldDef, channel) => {\n const scaleComponent = isScaleChannel(channel) && model.getScaleComponent(channel);\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n\n // While discrete domain scales can handle invalid values, continuous scales can't.\n // Thus, for non-path marks, we have to filter null for scales with continuous domains.\n // (For path marks, we will use \"defined\" property and skip these values instead.)\n if (hasContinuousDomain(scaleType) && fieldDef.aggregate !== 'count' && !isPathMark(mark)) {\n aggregator[fieldDef.field] = fieldDef as any; // we know that the fieldDef is a typed field def\n }\n }\n return aggregator;\n },\n {} as Dict>\n );\n\n if (!keys(filter).length) {\n return null;\n }\n\n return new FilterInvalidNode(parent, filter);\n }\n\n public dependentFields() {\n return new Set(keys(this.filter));\n }\n\n public producedFields() {\n return new Set(); // filter does not produce any new fields\n }\n\n public hash() {\n return `FilterInvalid ${hash(this.filter)}`;\n }\n\n /**\n * Create the VgTransforms for each of the filtered fields.\n */\n public assemble(): VgFilterTransform {\n const filters = keys(this.filter).reduce((vegaFilters, field) => {\n const fieldDef = this.filter[field];\n const ref = fieldRef(fieldDef, {expr: 'datum'});\n\n if (fieldDef !== null) {\n if (fieldDef.type === 'temporal') {\n vegaFilters.push(`(isDate(${ref}) || (isValid(${ref}) && isFinite(+${ref})))`);\n } else if (fieldDef.type === 'quantitative') {\n vegaFilters.push(`isValid(${ref})`);\n vegaFilters.push(`isFinite(+${ref})`);\n } else {\n // should never get here\n }\n }\n return vegaFilters;\n }, [] as string[]);\n\n return filters.length > 0\n ? {\n type: 'filter',\n expr: filters.join(' && ')\n }\n : null;\n }\n}\n","import {FlattenTransform as VgFlattenTransform} from 'vega';\nimport {FlattenTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FlattenTransformNode extends DataFlowNode {\n public clone() {\n return new FlattenTransformNode(this.parent, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: FlattenTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const {flatten, as = []} = this.transform;\n this.transform.as = flatten.map((f, i) => as[i] ?? f);\n }\n\n public dependentFields() {\n return new Set(this.transform.flatten);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FlattenTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFlattenTransform {\n const {flatten: fields, as} = this.transform;\n\n const result: VgFlattenTransform = {\n type: 'flatten',\n fields,\n as\n };\n return result;\n }\n}\n","import {FoldTransform as VgFoldTransform} from 'vega';\nimport {FoldTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for flatten transform nodes\n */\nexport class FoldTransformNode extends DataFlowNode {\n public clone() {\n return new FoldTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: FoldTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'key', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set(this.transform.fold);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `FoldTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgFoldTransform {\n const {fold, as} = this.transform;\n const result: VgFoldTransform = {\n type: 'fold',\n fields: fold,\n as\n };\n return result;\n }\n}\n","import {Transforms as VgTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2, SHAPE} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoJSONNode extends DataFlowNode {\n public clone() {\n return new GeoJSONNode(null, duplicate(this.fields), this.geojson, this.signal);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (model.component.projection && !model.component.projection.isFit) {\n return parent;\n }\n\n let geoJsonCounter = 0;\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n if (pair[0] || pair[1]) {\n parent = new GeoJSONNode(parent, pair, null, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n if (model.channelHasField(SHAPE)) {\n const fieldDef = model.typedFieldDef(SHAPE);\n if (fieldDef.type === GEOJSON) {\n parent = new GeoJSONNode(parent, null, fieldDef.field, model.getName(`geojson_${geoJsonCounter++}`));\n }\n }\n\n return parent;\n }\n\n constructor(\n parent: DataFlowNode,\n private fields?: Vector2,\n private geojson?: string,\n private signal?: string\n ) {\n super(parent);\n }\n\n public dependentFields() {\n const fields = (this.fields ?? []).filter(isString) as string[];\n return new Set([...(this.geojson ? [this.geojson] : []), ...fields]);\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `GeoJSON ${this.geojson} ${this.signal} ${hash(this.fields)}`;\n }\n\n public assemble(): VgTransform[] {\n return [\n ...(this.geojson\n ? [\n {\n type: 'filter',\n expr: `isValid(datum[\"${this.geojson}\"])`\n } as const\n ]\n : []),\n {\n type: 'geojson',\n ...(this.fields ? {fields: this.fields} : {}),\n ...(this.geojson ? {geojson: this.geojson} : {}),\n signal: this.signal\n }\n ];\n }\n}\n","import {GeoPointTransform as VgGeoPointTransform, Vector2} from 'vega';\nimport {isString} from 'vega-util';\nimport {GeoPositionChannel, LATITUDE, LATITUDE2, LONGITUDE, LONGITUDE2} from '../../channel';\nimport {getFieldOrDatumDef, isDatumDef, isFieldDef, isValueDef} from '../../channeldef';\nimport {duplicate, hash} from '../../util';\nimport {VgExprRef} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class GeoPointNode extends DataFlowNode {\n public clone() {\n return new GeoPointNode(null, this.projection, duplicate(this.fields), duplicate(this.as));\n }\n\n constructor(\n parent: DataFlowNode,\n private projection: string,\n private fields: [string | VgExprRef, string | VgExprRef],\n private as: [string, string]\n ) {\n super(parent);\n }\n\n public static parseAll(parent: DataFlowNode, model: UnitModel): DataFlowNode {\n if (!model.projectionName()) {\n return parent;\n }\n\n for (const coordinates of [\n [LONGITUDE, LATITUDE],\n [LONGITUDE2, LATITUDE2]\n ] as Vector2[]) {\n const pair = coordinates.map(channel => {\n const def = getFieldOrDatumDef(model.encoding[channel]);\n return isFieldDef(def)\n ? def.field\n : isDatumDef(def)\n ? {expr: `${def.datum}`}\n : isValueDef(def)\n ? {expr: `${def['value']}`}\n : undefined;\n }) as [GeoPositionChannel, GeoPositionChannel];\n\n const suffix = coordinates[0] === LONGITUDE2 ? '2' : '';\n\n if (pair[0] || pair[1]) {\n parent = new GeoPointNode(parent, model.projectionName(), pair, [\n model.getName(`x${suffix}`),\n model.getName(`y${suffix}`)\n ]);\n }\n }\n\n return parent;\n }\n\n public dependentFields() {\n return new Set(this.fields.filter(isString));\n }\n\n public producedFields() {\n return new Set(this.as);\n }\n\n public hash() {\n return `Geopoint ${this.projection} ${hash(this.fields)} ${hash(this.as)}`;\n }\n\n public assemble(): VgGeoPointTransform {\n return {\n type: 'geopoint',\n projection: this.projection,\n fields: this.fields,\n as: this.as\n };\n }\n}\n","import {\n FormulaTransform as VgFormulaTransform,\n ImputeTransform as VgImputeTransform,\n SignalRef,\n WindowTransform as VgWindowTransform\n} from 'vega';\nimport {isFieldDef} from '../../channeldef';\nimport {pathGroupingFields} from '../../encoding';\nimport {ImputeSequence, ImputeTransform, isImputeSequence} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {UnitModel} from '../unit';\nimport {DataFlowNode} from './dataflow';\n\nexport class ImputeNode extends DataFlowNode {\n public clone() {\n return new ImputeNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private readonly transform: ImputeTransform\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set([this.transform.impute, this.transform.key, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set([this.transform.impute]);\n }\n\n private processSequence(keyvals: ImputeSequence): SignalRef {\n const {start = 0, stop, step} = keyvals;\n const result = [start, stop, ...(step ? [step] : [])].join(',');\n\n return {signal: `sequence(${result})`};\n }\n\n public static makeFromTransform(parent: DataFlowNode, imputeTransform: ImputeTransform): ImputeNode {\n return new ImputeNode(parent, imputeTransform);\n }\n\n public static makeFromEncoding(parent: DataFlowNode, model: UnitModel) {\n const encoding = model.encoding;\n const xDef = encoding.x;\n const yDef = encoding.y;\n\n if (isFieldDef(xDef) && isFieldDef(yDef)) {\n const imputedChannel = xDef.impute ? xDef : yDef.impute ? yDef : undefined;\n if (imputedChannel === undefined) {\n return undefined;\n }\n const keyChannel = xDef.impute ? yDef : yDef.impute ? xDef : undefined;\n const {method, value, frame, keyvals} = imputedChannel.impute;\n const groupbyFields = pathGroupingFields(model.mark, encoding);\n\n return new ImputeNode(parent, {\n impute: imputedChannel.field,\n key: keyChannel.field,\n ...(method ? {method} : {}),\n ...(value !== undefined ? {value} : {}),\n ...(frame ? {frame} : {}),\n ...(keyvals !== undefined ? {keyvals} : {}),\n ...(groupbyFields.length ? {groupby: groupbyFields} : {})\n });\n }\n return null;\n }\n\n public hash() {\n return `Impute ${hash(this.transform)}`;\n }\n\n public assemble() {\n const {impute, key, keyvals, method, groupby, value, frame = [null, null] as [null, null]} = this.transform;\n\n const imputeTransform: VgImputeTransform = {\n type: 'impute',\n field: impute,\n key,\n ...(keyvals ? {keyvals: isImputeSequence(keyvals) ? this.processSequence(keyvals) : keyvals} : {}),\n method: 'value',\n ...(groupby ? {groupby} : {}),\n value: !method || method === 'value' ? value : null\n };\n\n if (method && method !== 'value') {\n const deriveNewField: VgWindowTransform = {\n type: 'window',\n as: [`imputed_${impute}_value`],\n ops: [method],\n fields: [impute],\n frame,\n ignorePeers: false,\n ...(groupby ? {groupby} : {})\n };\n const replaceOriginal: VgFormulaTransform = {\n type: 'formula',\n expr: `datum.${impute} === null ? datum.imputed_${impute}_value : datum.${impute}`,\n as: impute\n };\n return [imputeTransform, deriveNewField, replaceOriginal];\n } else {\n return [imputeTransform];\n }\n }\n}\n","import {LoessTransform as VgLoessTransform} from 'vega';\nimport {LoessTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for loess transform nodes\n */\nexport class LoessTransformNode extends DataFlowNode {\n public clone() {\n return new LoessTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: LoessTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.loess];\n }\n\n public dependentFields() {\n return new Set([this.transform.loess, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `LoessTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgLoessTransform {\n const {loess, on, ...rest} = this.transform;\n const result: VgLoessTransform = {\n type: 'loess',\n x: on,\n y: loess,\n ...rest\n };\n return result;\n }\n}\n","import {LookupTransform as VgLookupTransform} from 'vega';\nimport {array, isString} from 'vega-util';\nimport * as log from '../../log';\nimport {isLookupData, isLookupSelection, LookupTransform} from '../../transform';\nimport {duplicate, hash, varName} from '../../util';\nimport {Model} from '../model';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {findSource} from './parse';\nimport {SourceNode} from './source';\nimport {DataSourceType} from '../../data';\n\nexport class LookupNode extends DataFlowNode {\n public clone() {\n return new LookupNode(null, duplicate(this.transform), this.secondary);\n }\n\n constructor(\n parent: DataFlowNode,\n public readonly transform: LookupTransform,\n public readonly secondary: string\n ) {\n super(parent);\n }\n\n public static make(parent: DataFlowNode, model: Model, transform: LookupTransform, counter: number) {\n const sources = model.component.data.sources;\n const {from} = transform;\n let fromOutputNode = null;\n\n if (isLookupData(from)) {\n let fromSource = findSource(from.data, sources);\n\n if (!fromSource) {\n fromSource = new SourceNode(from.data);\n sources.push(fromSource);\n }\n\n const fromOutputName = model.getName(`lookup_${counter}`);\n fromOutputNode = new OutputNode(\n fromSource,\n fromOutputName,\n DataSourceType.Lookup,\n model.component.data.outputNodeRefCounts\n );\n model.component.data.outputNodes[fromOutputName] = fromOutputNode;\n } else if (isLookupSelection(from)) {\n const selName = from.param;\n transform = {as: selName, ...transform};\n let selCmpt;\n\n try {\n selCmpt = model.getSelectionComponent(varName(selName), selName);\n } catch (e) {\n throw new Error(log.message.cannotLookupVariableParameter(selName));\n }\n\n fromOutputNode = selCmpt.materialized;\n if (!fromOutputNode) {\n throw new Error(log.message.noSameUnitLookup(selName));\n }\n }\n\n return new LookupNode(parent, transform, fromOutputNode.getSource());\n }\n\n public dependentFields() {\n return new Set([this.transform.lookup]);\n }\n\n public producedFields() {\n return new Set(this.transform.as ? array(this.transform.as) : this.transform.from.fields);\n }\n\n public hash() {\n return `Lookup ${hash({transform: this.transform, secondary: this.secondary})}`;\n }\n\n public assemble(): VgLookupTransform {\n let foreign: Partial;\n\n if (this.transform.from.fields) {\n // lookup a few fields and add create a flat output\n foreign = {\n values: this.transform.from.fields,\n ...(this.transform.as ? {as: array(this.transform.as)} : {})\n };\n } else {\n // lookup full record and nest it\n let asName = this.transform.as;\n if (!isString(asName)) {\n log.warn(log.message.NO_FIELDS_NEEDS_AS);\n asName = '_lookup';\n }\n\n foreign = {\n as: [asName]\n };\n }\n\n return {\n type: 'lookup',\n from: this.secondary,\n key: this.transform.from.key,\n fields: [this.transform.lookup],\n ...foreign,\n ...(this.transform.default ? {default: this.transform.default} : {})\n };\n }\n}\n","import {QuantileTransform as VgQuantileTransform} from 'vega';\nimport {QuantileTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for quantile transform nodes\n */\nexport class QuantileTransformNode extends DataFlowNode {\n public clone() {\n return new QuantileTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: QuantileTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? 'prob', specifiedAs[1] ?? 'value'];\n }\n\n public dependentFields() {\n return new Set([this.transform.quantile, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `QuantileTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgQuantileTransform {\n const {quantile, ...rest} = this.transform;\n const result: VgQuantileTransform = {\n type: 'quantile',\n field: quantile,\n ...rest\n };\n return result;\n }\n}\n","import {RegressionTransform as VgRegressionTransform} from 'vega';\nimport {RegressionTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for regression transform nodes\n */\nexport class RegressionTransformNode extends DataFlowNode {\n public clone() {\n return new RegressionTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: RegressionTransform\n ) {\n super(parent);\n this.transform = duplicate(transform); // duplicate to prevent side effects\n const specifiedAs = this.transform.as ?? [undefined, undefined];\n this.transform.as = [specifiedAs[0] ?? transform.on, specifiedAs[1] ?? transform.regression];\n }\n\n public dependentFields() {\n return new Set([this.transform.regression, this.transform.on, ...(this.transform.groupby ?? [])]);\n }\n\n public producedFields() {\n return new Set(this.transform.as);\n }\n\n public hash() {\n return `RegressionTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgRegressionTransform {\n const {regression, on, ...rest} = this.transform;\n const result: VgRegressionTransform = {\n type: 'regression',\n x: on,\n y: regression,\n ...rest\n };\n return result;\n }\n}\n","import {PivotTransform} from '../../transform';\nimport {duplicate, hash, unique} from '../../util';\nimport {PivotTransform as VgPivotTransform} from 'vega';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for pivot transform nodes.\n */\nexport class PivotTransformNode extends DataFlowNode {\n public clone() {\n return new PivotTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: PivotTransform\n ) {\n super(parent);\n }\n\n public addDimensions(fields: readonly string[]) {\n this.transform.groupby = unique((this.transform.groupby ?? []).concat(fields), d => d);\n }\n\n public producedFields(): undefined {\n return undefined; // return undefined so that potentially everything can depend on the pivot\n }\n\n public dependentFields() {\n return new Set([this.transform.pivot, this.transform.value, ...(this.transform.groupby ?? [])]);\n }\n\n public hash() {\n return `PivotTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgPivotTransform {\n const {pivot, value, groupby, limit, op} = this.transform;\n return {\n type: 'pivot',\n field: pivot,\n value,\n ...(limit !== undefined ? {limit} : {}),\n ...(op !== undefined ? {op} : {}),\n ...(groupby !== undefined ? {groupby} : {})\n };\n }\n}\n","import {SampleTransform as VgSampleTransform} from 'vega';\nimport {SampleTransform} from '../../transform';\nimport {duplicate, hash} from '../../util';\nimport {DataFlowNode} from './dataflow';\n\n/**\n * A class for the sample transform nodes\n */\nexport class SampleTransformNode extends DataFlowNode {\n public clone() {\n return new SampleTransformNode(null, duplicate(this.transform));\n }\n\n constructor(\n parent: DataFlowNode,\n private transform: SampleTransform\n ) {\n super(parent);\n }\n\n public dependentFields() {\n return new Set();\n }\n\n public producedFields() {\n return new Set();\n }\n\n public hash() {\n return `SampleTransform ${hash(this.transform)}`;\n }\n\n public assemble(): VgSampleTransform {\n return {\n type: 'sample',\n size: this.transform.sample\n };\n }\n}\n","import {InlineDataset, isUrlData} from '../../data';\nimport {Dict} from '../../util';\nimport {VgData} from '../../vega.schema';\nimport {DataComponent} from './';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {ExtentTransformNode} from './extent';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {ParseNode} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {PivotTransformNode} from './pivot';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nfunction makeWalkTree(data: VgData[]) {\n // to name datasources\n let datasetIndex = 0;\n\n /**\n * Recursively walk down the tree.\n */\n function walkTree(node: DataFlowNode, dataSource: VgData) {\n if (node instanceof SourceNode) {\n // If the source is a named data source or a data source with values, we need\n // to put it in a different data source. Otherwise, Vega may override the data.\n if (!node.isGenerator && !isUrlData(node.data)) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n\n if (node instanceof ParseNode) {\n if (node.parent instanceof SourceNode && !dataSource.source) {\n // If node's parent is a root source and the data source does not refer to another data source, use normal format parse\n dataSource.format = {\n ...(dataSource.format ?? {}),\n parse: node.assembleFormatParse()\n };\n\n // add calculates for all nested fields\n dataSource.transform.push(...node.assembleTransforms(true));\n } else {\n // Otherwise use Vega expression to parse\n dataSource.transform.push(...node.assembleTransforms());\n }\n }\n\n if (node instanceof FacetNode) {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n node.data = dataSource.name;\n } else {\n node.data = dataSource.source;\n }\n\n data.push(...node.assemble());\n\n // break here because the rest of the tree has to be taken care of by the facet.\n return;\n }\n\n if (\n node instanceof GraticuleNode ||\n node instanceof SequenceNode ||\n node instanceof FilterInvalidNode ||\n node instanceof FilterNode ||\n node instanceof CalculateNode ||\n node instanceof GeoPointNode ||\n node instanceof AggregateNode ||\n node instanceof LookupNode ||\n node instanceof WindowTransformNode ||\n node instanceof JoinAggregateTransformNode ||\n node instanceof FoldTransformNode ||\n node instanceof FlattenTransformNode ||\n node instanceof DensityTransformNode ||\n node instanceof LoessTransformNode ||\n node instanceof QuantileTransformNode ||\n node instanceof RegressionTransformNode ||\n node instanceof IdentifierNode ||\n node instanceof SampleTransformNode ||\n node instanceof PivotTransformNode ||\n node instanceof ExtentTransformNode\n ) {\n dataSource.transform.push(node.assemble());\n }\n\n if (\n node instanceof BinNode ||\n node instanceof TimeUnitNode ||\n node instanceof ImputeNode ||\n node instanceof StackNode ||\n node instanceof GeoJSONNode\n ) {\n dataSource.transform.push(...node.assemble());\n }\n\n if (node instanceof OutputNode) {\n if (dataSource.source && dataSource.transform.length === 0) {\n node.setSource(dataSource.source);\n } else if (node.parent instanceof OutputNode) {\n // Note that an output node may be required but we still do not assemble a\n // separate data source for it.\n node.setSource(dataSource.name);\n } else {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n // Here we set the name of the datasource we generated. From now on\n // other assemblers can use it.\n node.setSource(dataSource.name);\n\n // if this node has more than one child, we will add a datasource automatically\n if (node.numChildren() === 1) {\n data.push(dataSource);\n const newData: VgData = {\n name: null,\n source: dataSource.name,\n transform: []\n };\n dataSource = newData;\n }\n }\n }\n\n switch (node.numChildren()) {\n case 0:\n // done\n if (node instanceof OutputNode && (!dataSource.source || dataSource.transform.length > 0)) {\n // do not push empty datasources that are simply references\n data.push(dataSource);\n }\n break;\n case 1:\n walkTree(node.children[0], dataSource);\n break;\n default: {\n if (!dataSource.name) {\n dataSource.name = `data_${datasetIndex++}`;\n }\n\n let source = dataSource.name;\n if (!dataSource.source || dataSource.transform.length > 0) {\n data.push(dataSource);\n } else {\n source = dataSource.source;\n }\n\n for (const child of node.children) {\n const newData: VgData = {\n name: null,\n source,\n transform: []\n };\n walkTree(child, newData);\n }\n break;\n }\n }\n }\n\n return walkTree;\n}\n\n/**\n * Assemble data sources that are derived from faceted data.\n */\nexport function assembleFacetData(root: FacetNode): VgData[] {\n const data: VgData[] = [];\n const walkTree = makeWalkTree(data);\n\n for (const child of root.children) {\n walkTree(child, {\n source: root.name,\n name: null,\n transform: []\n });\n }\n\n return data;\n}\n\n/**\n * Create Vega data array from a given compiled model and append all of them to the given array\n *\n * @param model\n * @param data array\n * @return modified data array\n */\nexport function assembleRootData(dataComponent: DataComponent, datasets: Dict): VgData[] {\n const data: VgData[] = [];\n\n // dataComponent.sources.forEach(debug);\n // draw(dataComponent.sources);\n\n const walkTree = makeWalkTree(data);\n\n let sourceIndex = 0;\n\n for (const root of dataComponent.sources) {\n // assign a name if the source does not have a name yet\n if (!root.hasName()) {\n root.dataName = `source_${sourceIndex++}`;\n }\n\n const newData: VgData = root.assemble();\n\n walkTree(root, newData);\n }\n\n // remove empty transform arrays for cleaner output\n for (const d of data) {\n if (d.transform.length === 0) {\n delete d.transform;\n }\n }\n\n // move sources without transforms (the ones that are potentially used in lookups) to the beginning\n let whereTo = 0;\n for (const [i, d] of data.entries()) {\n if ((d.transform ?? []).length === 0 && !d.source) {\n data.splice(whereTo++, 0, data.splice(i, 1)[0]);\n }\n }\n\n // now fix the from references in lookup transforms\n for (const d of data) {\n for (const t of d.transform ?? []) {\n if (t.type === 'lookup') {\n t.from = dataComponent.outputNodes[t.from].getSource();\n }\n }\n }\n\n // inline values for datasets that are in the datastore\n for (const d of data) {\n if (d.name in datasets) {\n d.values = datasets[d.name];\n }\n }\n\n return data;\n}\n","import {AxisOrient, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {FacetChannel, FACET_CHANNELS} from '../../channel';\nimport {title as fieldDefTitle} from '../../channeldef';\nimport {contains, getFirstDefined} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {assembleAxis} from '../axis/assemble';\nimport {FacetModel} from '../facet';\nimport {parseGuideResolve} from '../resolve';\nimport {getHeaderProperty} from './common';\nimport {HeaderChannel, HeaderComponent} from './component';\n\nexport function getHeaderType(orient: AxisOrient | SignalRef) {\n if (orient === 'top' || orient === 'left' || isSignalRef(orient)) {\n // we always use header for orient signal since we can't dynamically make header becomes footer\n return 'header';\n }\n return 'footer';\n}\n\nexport function parseFacetHeaders(model: FacetModel) {\n for (const channel of FACET_CHANNELS) {\n parseFacetHeader(model, channel);\n }\n\n mergeChildAxis(model, 'x');\n mergeChildAxis(model, 'y');\n}\n\nfunction parseFacetHeader(model: FacetModel, channel: FacetChannel) {\n const {facet, config, child, component} = model;\n if (model.channelHasField(channel)) {\n const fieldDef = facet[channel];\n const titleConfig = getHeaderProperty('title', null, config, channel);\n let title = fieldDefTitle(fieldDef, config, {\n allowDisabling: true,\n includeDefault: titleConfig === undefined || !!titleConfig\n });\n\n if (child.component.layoutHeaders[channel].title) {\n // TODO: better handle multiline titles\n title = isArray(title) ? title.join(', ') : title;\n\n // merge title with child to produce \"Title / Subtitle / Sub-subtitle\"\n title += ` / ${child.component.layoutHeaders[channel].title}`;\n child.component.layoutHeaders[channel].title = null;\n }\n\n const labelOrient = getHeaderProperty('labelOrient', fieldDef.header, config, channel);\n\n const labels =\n fieldDef.header !== null ? getFirstDefined(fieldDef.header?.labels, config.header.labels, true) : false;\n const headerType = contains(['bottom', 'right'], labelOrient) ? 'footer' : 'header';\n\n component.layoutHeaders[channel] = {\n title: fieldDef.header !== null ? title : null,\n facetFieldDef: fieldDef,\n [headerType]: channel === 'facet' ? [] : [makeHeaderComponent(model, channel, labels)]\n };\n }\n}\n\nfunction makeHeaderComponent(model: FacetModel, channel: HeaderChannel, labels: boolean): HeaderComponent {\n const sizeType = channel === 'row' ? 'height' : 'width';\n\n return {\n labels,\n sizeSignal: model.child.component.layoutSize.get(sizeType) ? model.child.getSizeSignalRef(sizeType) : undefined,\n axes: []\n };\n}\n\nfunction mergeChildAxis(model: FacetModel, channel: 'x' | 'y') {\n const {child} = model;\n if (child.component.axes[channel]) {\n const {layoutHeaders, resolve} = model.component;\n resolve.axis[channel] = parseGuideResolve(resolve, channel);\n\n if (resolve.axis[channel] === 'shared') {\n // For shared axis, move the axes to facet's header or footer\n const headerChannel = channel === 'x' ? 'column' : 'row';\n\n const layoutHeader = layoutHeaders[headerChannel];\n for (const axisComponent of child.component.axes[channel]) {\n const headerType = getHeaderType(axisComponent.get('orient'));\n layoutHeader[headerType] ??= [makeHeaderComponent(model, headerChannel, false)];\n\n // FIXME: assemble shouldn't be called here, but we do it this way so we only extract the main part of the axes\n const mainAxis = assembleAxis(axisComponent, 'main', model.config, {header: true});\n if (mainAxis) {\n // LayoutHeader no longer keep track of property precedence, thus let's combine.\n layoutHeader[headerType][0].axes.push(mainAxis);\n }\n axisComponent.mainExtracted = true;\n }\n } else {\n // Otherwise do nothing for independent axes\n }\n }\n}\n","import {getPositionScaleChannel, getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getViewConfigContinuousSize, getViewConfigDiscreteSize} from '../../config';\nimport {hasDiscreteDomain} from '../../scale';\nimport {isStep} from '../../spec/base';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {ConcatModel} from '../concat';\nimport {Model} from '../model';\nimport {defaultScaleResolve} from '../resolve';\nimport {Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {getSizeTypeFromLayoutSizeType, LayoutSize, LayoutSizeIndex, LayoutSizeType} from './component';\n\nexport function parseLayerLayoutSize(model: Model) {\n parseChildrenLayoutSize(model);\n\n parseNonUnitLayoutSizeForChannel(model, 'width');\n parseNonUnitLayoutSizeForChannel(model, 'height');\n}\n\nexport function parseConcatLayoutSize(model: ConcatModel) {\n parseChildrenLayoutSize(model);\n\n // for columns === 1 (vconcat), we can completely merge width. Otherwise, we can treat merged width as childWidth.\n const widthType = model.layout.columns === 1 ? 'width' : 'childWidth';\n\n // for columns === undefined (hconcat), we can completely merge height. Otherwise, we can treat merged height as childHeight.\n const heightType = model.layout.columns === undefined ? 'height' : 'childHeight';\n\n parseNonUnitLayoutSizeForChannel(model, widthType);\n parseNonUnitLayoutSizeForChannel(model, heightType);\n}\n\nexport function parseChildrenLayoutSize(model: Model) {\n for (const child of model.children) {\n child.parseLayoutSize();\n }\n}\n\n/**\n * Merge child layout size (width or height).\n */\nfunction parseNonUnitLayoutSizeForChannel(model: Model, layoutSizeType: LayoutSizeType) {\n /*\n * For concat, the parent width or height might not be the same as the children's shared height.\n * For example, hconcat's subviews may share width, but the shared width is not the hconcat view's width.\n *\n * layoutSizeType represents the output of the view (could be childWidth/childHeight/width/height)\n * while the sizeType represents the properties of the child.\n */\n const sizeType = getSizeTypeFromLayoutSizeType(layoutSizeType);\n const channel = getPositionScaleChannel(sizeType);\n const resolve = model.component.resolve;\n const layoutSizeCmpt = model.component.layoutSize;\n\n let mergedSize: Explicit;\n // Try to merge layout size\n for (const child of model.children) {\n const childSize = child.component.layoutSize.getWithExplicit(sizeType);\n const scaleResolve = resolve.scale[channel] ?? defaultScaleResolve(channel, model);\n if (scaleResolve === 'independent' && childSize.value === 'step') {\n // Do not merge independent scales with range-step as their size depends\n // on the scale domains, which can be different between scales.\n mergedSize = undefined;\n break;\n }\n\n if (mergedSize) {\n if (scaleResolve === 'independent' && mergedSize.value !== childSize.value) {\n // For independent scale, only merge if all the sizes are the same.\n // If the values are different, abandon the merge!\n mergedSize = undefined;\n break;\n }\n mergedSize = mergeValuesWithExplicit(mergedSize, childSize, sizeType, '');\n } else {\n mergedSize = childSize;\n }\n }\n\n if (mergedSize) {\n // If merged, rename size and set size of all children.\n for (const child of model.children) {\n model.renameSignal(child.getName(sizeType), model.getName(layoutSizeType));\n child.component.layoutSize.set(sizeType, 'merged', false);\n }\n layoutSizeCmpt.setWithExplicit(layoutSizeType, mergedSize);\n } else {\n layoutSizeCmpt.setWithExplicit(layoutSizeType, {\n explicit: false,\n value: undefined\n });\n }\n}\n\nexport function parseUnitLayoutSize(model: UnitModel) {\n const {size, component} = model;\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n\n if (size[sizeType]) {\n const specifiedSize = size[sizeType];\n component.layoutSize.set(sizeType, isStep(specifiedSize) ? 'step' : specifiedSize, true);\n } else {\n const defaultSize = defaultUnitSize(model, sizeType);\n component.layoutSize.set(sizeType, defaultSize, false);\n }\n }\n}\n\nfunction defaultUnitSize(model: UnitModel, sizeType: 'width' | 'height'): LayoutSize {\n const channel = sizeType === 'width' ? 'x' : 'y';\n const config = model.config;\n const scaleComponent = model.getScaleComponent(channel);\n\n if (scaleComponent) {\n const scaleType = scaleComponent.get('type');\n const range = scaleComponent.get('range');\n\n if (hasDiscreteDomain(scaleType)) {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n if (isVgRangeStep(range) || isStep(size)) {\n // For discrete domain with range.step, use dynamic width/height\n return 'step';\n } else {\n return size;\n }\n } else {\n return getViewConfigContinuousSize(config.view, sizeType);\n }\n } else if (model.hasProjection || model.mark === 'arc') {\n // arc should use continuous size by default otherwise the pie is extremely small\n return getViewConfigContinuousSize(config.view, sizeType);\n } else {\n const size = getViewConfigDiscreteSize(config.view, sizeType);\n return isStep(size) ? size.step : size;\n }\n}\n","import {AggregateOp, LayoutAlign, NewSignal, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {isBinning} from '../bin';\nimport {COLUMN, ExtendedChannel, FacetChannel, FACET_CHANNELS, POSITION_SCALE_CHANNELS, ROW} from '../channel';\nimport {FieldName, FieldRefOption, initFieldDef, TypedFieldDef, vgField} from '../channeldef';\nimport {Config} from '../config';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport * as log from '../log';\nimport {hasDiscreteDomain} from '../scale';\nimport {DEFAULT_SORT_OP, EncodingSortField, isSortField, SortOrder} from '../sort';\nimport {NormalizedFacetSpec} from '../spec';\nimport {EncodingFacetMapping, FacetFieldDef, FacetMapping, isFacetMapping} from '../spec/facet';\nimport {keys} from '../util';\nimport {isVgRangeStep, VgData, VgLayout, VgMarkGroup} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {assembleFacetData} from './data/assemble';\nimport {sortArrayIndexField} from './data/calculate';\nimport {parseData} from './data/parse';\nimport {assembleLabelTitle} from './header/assemble';\nimport {getHeaderChannel, getHeaderProperty} from './header/common';\nimport {HEADER_CHANNELS, HEADER_TYPES} from './header/component';\nimport {parseFacetHeaders} from './header/parse';\nimport {parseChildrenLayoutSize} from './layoutsize/parse';\nimport {Model, ModelWithField} from './model';\nimport {assembleDomain, getFieldFromDomain} from './scale/domain';\nimport {assembleFacetSignals} from './selection/assemble';\n\nexport function facetSortFieldName(\n fieldDef: FacetFieldDef,\n sort: EncodingSortField,\n opt?: FieldRefOption\n) {\n return vgField(sort, {suffix: `by_${vgField(fieldDef)}`, ...(opt ?? {})});\n}\n\nexport class FacetModel extends ModelWithField {\n public readonly facet: EncodingFacetMapping;\n\n public readonly child: Model;\n\n public readonly children: Model[];\n\n constructor(spec: NormalizedFacetSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'facet', parent, parentGivenName, config, spec.resolve);\n\n this.child = buildModel(spec.spec, this, this.getName('child'), undefined, config);\n this.children = [this.child];\n\n this.facet = this.initFacet(spec.facet);\n }\n\n private initFacet(\n facet: FacetFieldDef | FacetMapping\n ): EncodingFacetMapping {\n // clone to prevent side effect to the original spec\n if (!isFacetMapping(facet)) {\n return {facet: this.initFacetFieldDef(facet, 'facet')};\n }\n\n const channels = keys(facet);\n const normalizedFacet = {};\n for (const channel of channels) {\n if (![ROW, COLUMN].includes(channel)) {\n // Drop unsupported channel\n log.warn(log.message.incompatibleChannel(channel, 'facet'));\n break;\n }\n\n const fieldDef = facet[channel];\n if (fieldDef.field === undefined) {\n log.warn(log.message.emptyFieldDef(fieldDef, channel));\n break;\n }\n\n normalizedFacet[channel] = this.initFacetFieldDef(fieldDef, channel);\n }\n\n return normalizedFacet;\n }\n\n private initFacetFieldDef(fieldDef: FacetFieldDef, channel: FacetChannel) {\n // Cast because we call initFieldDef, which assumes general FieldDef.\n // However, FacetFieldDef is a bit more constrained than the general FieldDef\n const facetFieldDef = initFieldDef(fieldDef, channel) as FacetFieldDef;\n if (facetFieldDef.header) {\n facetFieldDef.header = replaceExprRef(facetFieldDef.header);\n } else if (facetFieldDef.header === null) {\n facetFieldDef.header = null;\n }\n return facetFieldDef;\n }\n\n public channelHasField(channel: ExtendedChannel): boolean {\n return !!this.facet[channel];\n }\n\n public fieldDef(channel: ExtendedChannel): TypedFieldDef {\n return this.facet[channel];\n }\n\n public parseData() {\n this.component.data = parseData(this);\n this.child.parseData();\n }\n\n public parseLayoutSize() {\n parseChildrenLayoutSize(this);\n }\n\n public parseSelections() {\n // As a facet has a single child, the selection components are the same.\n // The child maintains its selections to assemble signals, which remain\n // within its unit.\n this.child.parseSelections();\n this.component.selection = this.child.component.selection;\n }\n\n public parseMarkGroup() {\n this.child.parseMarkGroup();\n }\n\n public parseAxesAndHeaders() {\n this.child.parseAxesAndHeaders();\n\n parseFacetHeaders(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.child.assembleSelectionTopLevelSignals(signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.child.assembleSignals();\n return [];\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.child.assembleSelectionData(data);\n }\n\n private getHeaderLayoutMixins(): VgLayout {\n const layoutMixins: VgLayout = {};\n\n for (const channel of FACET_CHANNELS) {\n for (const headerType of HEADER_TYPES) {\n const layoutHeaderComponent = this.component.layoutHeaders[channel];\n const headerComponent = layoutHeaderComponent[headerType];\n\n const {facetFieldDef} = layoutHeaderComponent;\n if (facetFieldDef) {\n const titleOrient = getHeaderProperty('titleOrient', facetFieldDef.header, this.config, channel);\n\n if (['right', 'bottom'].includes(titleOrient)) {\n const headerChannel = getHeaderChannel(channel, titleOrient);\n layoutMixins.titleAnchor ??= {};\n layoutMixins.titleAnchor[headerChannel] = 'end';\n }\n }\n\n if (headerComponent?.[0]) {\n // set header/footerBand\n const sizeType = channel === 'row' ? 'height' : 'width';\n const bandType = headerType === 'header' ? 'headerBand' : 'footerBand';\n if (channel !== 'facet' && !this.child.component.layoutSize.get(sizeType)) {\n // If facet child does not have size signal, then apply headerBand\n layoutMixins[bandType] ??= {};\n layoutMixins[bandType][channel] = 0.5;\n }\n\n if (layoutHeaderComponent.title) {\n layoutMixins.offset ??= {};\n layoutMixins.offset[channel === 'row' ? 'rowTitle' : 'columnTitle'] = 10;\n }\n }\n }\n }\n return layoutMixins;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const {column, row} = this.facet;\n\n const columns = column ? this.columnDistinctSignal() : row ? 1 : undefined;\n\n let align: LayoutAlign = 'all';\n\n // Do not align the cells if the scale corresponding to the direction is indepent.\n // We always align when we facet into both row and column.\n if (!row && this.component.resolve.scale.x === 'independent') {\n align = 'none';\n } else if (!column && this.component.resolve.scale.y === 'independent') {\n align = 'none';\n }\n\n return {\n ...this.getHeaderLayoutMixins(),\n\n ...(columns ? {columns} : {}),\n bounds: 'full',\n align\n };\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n // FIXME(https://github.com/vega/vega-lite/issues/1193): this can be incorrect if we have independent scales.\n return this.child.assembleLayoutSignals();\n }\n\n private columnDistinctSignal() {\n if (this.parent && this.parent instanceof FacetModel) {\n // For nested facet, we will add columns to group mark instead\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return undefined;\n } else {\n // In facetNode.assemble(), the name is always this.getName('column') + '_layout'.\n const facetLayoutDataName = this.getName('column_domain');\n return {signal: `length(data('${facetLayoutDataName}'))`};\n }\n }\n\n public assembleGroupStyle(): string | string[] {\n return undefined;\n }\n\n public assembleGroup(signals: NewSignal[]) {\n if (this.parent && this.parent instanceof FacetModel) {\n // Provide number of columns for layout.\n // See discussion in https://github.com/vega/vega/issues/952\n // and https://github.com/vega/vega-view/releases/tag/v1.2.6\n return {\n ...(this.channelHasField('column')\n ? {\n encode: {\n update: {\n // TODO(https://github.com/vega/vega-lite/issues/2759):\n // Correct the signal for facet of concat of facet_column\n columns: {field: vgField(this.facet.column, {prefix: 'distinct'})}\n }\n }\n }\n : {}),\n ...super.assembleGroup(signals)\n };\n }\n return super.assembleGroup(signals);\n }\n\n /**\n * Aggregate cardinality for calculating size\n */\n private getCardinalityAggregateForChild() {\n const fields: string[] = [];\n const ops: AggregateOp[] = [];\n const as: string[] = [];\n\n if (this.child instanceof FacetModel) {\n if (this.child.channelHasField('column')) {\n const field = vgField(this.child.facet.column);\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n }\n } else {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const childScaleComponent = this.child.component.scales[channel];\n if (childScaleComponent && !childScaleComponent.merged) {\n const type = childScaleComponent.get('type');\n const range = childScaleComponent.get('range');\n\n if (hasDiscreteDomain(type) && isVgRangeStep(range)) {\n const domain = assembleDomain(this.child, channel);\n const field = getFieldFromDomain(domain);\n if (field) {\n fields.push(field);\n ops.push('distinct');\n as.push(`distinct_${field}`);\n } else {\n log.warn(log.message.unknownField(channel));\n }\n }\n }\n }\n }\n return {fields, ops, as};\n }\n\n private assembleFacet() {\n const {name, data} = this.component.data.facetRoot;\n const {row, column} = this.facet;\n const {fields, ops, as} = this.getCardinalityAggregateForChild();\n const groupby: string[] = [];\n\n for (const channel of FACET_CHANNELS) {\n const fieldDef = this.facet[channel];\n if (fieldDef) {\n groupby.push(vgField(fieldDef));\n\n const {bin, sort} = fieldDef;\n\n if (isBinning(bin)) {\n groupby.push(vgField(fieldDef, {binSuffix: 'end'}));\n }\n\n if (isSortField(sort)) {\n const {field, op = DEFAULT_SORT_OP} = sort;\n const outputName = facetSortFieldName(fieldDef, sort);\n if (row && column) {\n // For crossed facet, use pre-calculate field as it requires a different groupby\n // For each calculated field, apply max and assign them to the same name as\n // all values of the same group should be the same anyway.\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n } else {\n fields.push(field);\n ops.push(op);\n as.push(outputName);\n }\n } else if (isArray(sort)) {\n const outputName = sortArrayIndexField(fieldDef, channel);\n fields.push(outputName);\n ops.push('max');\n as.push(outputName);\n }\n }\n }\n\n const cross = !!row && !!column;\n\n return {\n name,\n data,\n groupby,\n ...(cross || fields.length > 0\n ? {\n aggregate: {\n ...(cross ? {cross} : {}),\n ...(fields.length ? {fields, ops, as} : {})\n }\n }\n : {})\n };\n }\n\n private facetSortFields(channel: FacetChannel): string[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n\n if (fieldDef) {\n if (isSortField(fieldDef.sort)) {\n return [facetSortFieldName(fieldDef, fieldDef.sort, {expr: 'datum'})];\n } else if (isArray(fieldDef.sort)) {\n return [sortArrayIndexField(fieldDef, channel, {expr: 'datum'})];\n }\n return [vgField(fieldDef, {expr: 'datum'})];\n }\n return [];\n }\n\n private facetSortOrder(channel: FacetChannel): SortOrder[] {\n const {facet} = this;\n const fieldDef = facet[channel];\n if (fieldDef) {\n const {sort} = fieldDef;\n const order = (isSortField(sort) ? sort.order : !isArray(sort) && sort) || 'ascending';\n return [order];\n }\n return [];\n }\n\n private assembleLabelTitle() {\n const {facet, config} = this;\n if (facet.facet) {\n // Facet always uses title to display labels\n return assembleLabelTitle(facet.facet, 'facet', config);\n }\n\n const ORTHOGONAL_ORIENT = {\n row: ['top', 'bottom'],\n column: ['left', 'right']\n };\n\n for (const channel of HEADER_CHANNELS) {\n if (facet[channel]) {\n const labelOrient = getHeaderProperty('labelOrient', facet[channel]?.header, config, channel);\n if (ORTHOGONAL_ORIENT[channel].includes(labelOrient)) {\n // Row/Column with orthogonal labelOrient must use title to display labels\n return assembleLabelTitle(facet[channel], channel, config);\n }\n }\n }\n return undefined;\n }\n\n public assembleMarks(): VgMarkGroup[] {\n const {child} = this;\n\n // If we facet by two dimensions, we need to add a cross operator to the aggregation\n // so that we create all groups\n const facetRoot = this.component.data.facetRoot;\n const data = assembleFacetData(facetRoot);\n\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n const title = this.assembleLabelTitle() || child.assembleTitle();\n const style = child.assembleGroupStyle();\n\n const markGroup = {\n name: this.getName('cell'),\n type: 'group',\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n from: {\n facet: this.assembleFacet()\n },\n // TODO: move this to after data\n sort: {\n field: FACET_CHANNELS.map(c => this.facetSortFields(c)).flat(),\n order: FACET_CHANNELS.map(c => this.facetSortOrder(c)).flat()\n },\n ...(data.length > 0 ? {data} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup(assembleFacetSignals(this, []))\n };\n\n return [markGroup];\n }\n\n protected getMapping() {\n return this.facet;\n }\n}\n","import {AncestorParse, DataComponent} from '.';\nimport {\n Data,\n isGenerator,\n isGraticuleGenerator,\n isInlineData,\n isNamedData,\n isSequenceGenerator,\n isUrlData,\n DataSourceType,\n ParseValue\n} from '../../data';\nimport * as log from '../../log';\nimport {\n isAggregate,\n isBin,\n isCalculate,\n isDensity,\n isExtent,\n isFilter,\n isFlatten,\n isFold,\n isImpute,\n isJoinAggregate,\n isLoess,\n isLookup,\n isPivot,\n isQuantile,\n isRegression,\n isSample,\n isStack,\n isTimeUnit,\n isWindow\n} from '../../transform';\nimport {deepEqual, mergeDeep} from '../../util';\nimport {isFacetModel, isLayerModel, isUnitModel, Model} from '../model';\nimport {requiresSelectionId} from '../selection';\nimport {materializeSelections} from '../selection/parse';\nimport {AggregateNode} from './aggregate';\nimport {BinNode} from './bin';\nimport {CalculateNode} from './calculate';\nimport {DataFlowNode, OutputNode} from './dataflow';\nimport {DensityTransformNode} from './density';\nimport {ExtentTransformNode} from './extent';\nimport {FacetNode} from './facet';\nimport {FilterNode} from './filter';\nimport {FilterInvalidNode} from './filterinvalid';\nimport {FlattenTransformNode} from './flatten';\nimport {FoldTransformNode} from './fold';\nimport {\n getImplicitFromEncoding,\n getImplicitFromFilterTransform,\n getImplicitFromSelection,\n ParseNode\n} from './formatparse';\nimport {GeoJSONNode} from './geojson';\nimport {GeoPointNode} from './geopoint';\nimport {GraticuleNode} from './graticule';\nimport {IdentifierNode} from './identifier';\nimport {ImputeNode} from './impute';\nimport {JoinAggregateTransformNode} from './joinaggregate';\nimport {makeJoinAggregateFromFacet} from './joinaggregatefacet';\nimport {LoessTransformNode} from './loess';\nimport {LookupNode} from './lookup';\nimport {PivotTransformNode} from './pivot';\nimport {QuantileTransformNode} from './quantile';\nimport {RegressionTransformNode} from './regression';\nimport {SampleTransformNode} from './sample';\nimport {SequenceNode} from './sequence';\nimport {SourceNode} from './source';\nimport {StackNode} from './stack';\nimport {TimeUnitNode} from './timeunit';\nimport {WindowTransformNode} from './window';\n\nexport function findSource(data: Data, sources: SourceNode[]) {\n for (const other of sources) {\n const otherData = other.data;\n\n // if both datasets have a name defined, we cannot merge\n if (data.name && other.hasName() && data.name !== other.dataName) {\n continue;\n }\n\n const formatMesh = data['format']?.mesh;\n const otherFeature = otherData.format?.feature;\n\n // feature and mesh are mutually exclusive\n if (formatMesh && otherFeature) {\n continue;\n }\n\n // we have to extract the same feature or mesh\n const formatFeature = data['format']?.feature;\n if ((formatFeature || otherFeature) && formatFeature !== otherFeature) {\n continue;\n }\n\n const otherMesh = otherData.format?.mesh;\n if ((formatMesh || otherMesh) && formatMesh !== otherMesh) {\n continue;\n }\n\n if (isInlineData(data) && isInlineData(otherData)) {\n if (deepEqual(data.values, otherData.values)) {\n return other;\n }\n } else if (isUrlData(data) && isUrlData(otherData)) {\n if (data.url === otherData.url) {\n return other;\n }\n } else if (isNamedData(data)) {\n if (data.name === other.dataName) {\n return other;\n }\n }\n }\n return null;\n}\n\nfunction parseRoot(model: Model, sources: SourceNode[]): DataFlowNode {\n if (model.data || !model.parent) {\n // if the model defines a data source or is the root, create a source node\n\n if (model.data === null) {\n // data: null means we should ignore the parent's data so we just create a new data source\n const source = new SourceNode({values: []});\n sources.push(source);\n return source;\n }\n\n const existingSource = findSource(model.data, sources);\n\n if (existingSource) {\n if (!isGenerator(model.data)) {\n existingSource.data.format = mergeDeep({}, model.data.format, existingSource.data.format);\n }\n\n // if the new source has a name but the existing one does not, we can set it\n if (!existingSource.hasName() && model.data.name) {\n existingSource.dataName = model.data.name;\n }\n\n return existingSource;\n } else {\n const source = new SourceNode(model.data);\n sources.push(source);\n return source;\n }\n } else {\n // If we don't have a source defined (overriding parent's data), use the parent's facet root or main.\n return model.parent.component.data.facetRoot\n ? model.parent.component.data.facetRoot\n : model.parent.component.data.main;\n }\n}\n\n/**\n * Parses a transform array into a chain of connected dataflow nodes.\n */\nexport function parseTransformArray(head: DataFlowNode, model: Model, ancestorParse: AncestorParse): DataFlowNode {\n let lookupCounter = 0;\n\n for (const t of model.transforms) {\n let derivedType: ParseValue = undefined;\n let transformNode: DataFlowNode;\n\n if (isCalculate(t)) {\n transformNode = head = new CalculateNode(head, t);\n derivedType = 'derived';\n } else if (isFilter(t)) {\n const implicit = getImplicitFromFilterTransform(t);\n transformNode = head = ParseNode.makeWithAncestors(head, {}, implicit, ancestorParse) ?? head;\n\n head = new FilterNode(head, model, t.filter);\n } else if (isBin(t)) {\n transformNode = head = BinNode.makeFromTransform(head, t, model);\n derivedType = 'number';\n } else if (isTimeUnit(t)) {\n derivedType = 'date';\n const parsedAs = ancestorParse.getWithExplicit(t.field);\n // Create parse node because the input to time unit is always date.\n if (parsedAs.value === undefined) {\n head = new ParseNode(head, {[t.field]: derivedType});\n ancestorParse.set(t.field, derivedType, false);\n }\n transformNode = head = TimeUnitNode.makeFromTransform(head, t);\n } else if (isAggregate(t)) {\n transformNode = head = AggregateNode.makeFromTransform(head, t);\n derivedType = 'number';\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n } else if (isLookup(t)) {\n transformNode = head = LookupNode.make(head, model, t, lookupCounter++);\n derivedType = 'derived';\n } else if (isWindow(t)) {\n transformNode = head = new WindowTransformNode(head, t);\n derivedType = 'number';\n } else if (isJoinAggregate(t)) {\n transformNode = head = new JoinAggregateTransformNode(head, t);\n derivedType = 'number';\n } else if (isStack(t)) {\n transformNode = head = StackNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isFold(t)) {\n transformNode = head = new FoldTransformNode(head, t);\n derivedType = 'derived';\n } else if (isExtent(t)) {\n transformNode = head = new ExtentTransformNode(head, t);\n derivedType = 'derived';\n } else if (isFlatten(t)) {\n transformNode = head = new FlattenTransformNode(head, t);\n derivedType = 'derived';\n } else if (isPivot(t)) {\n transformNode = head = new PivotTransformNode(head, t);\n derivedType = 'derived';\n } else if (isSample(t)) {\n head = new SampleTransformNode(head, t);\n } else if (isImpute(t)) {\n transformNode = head = ImputeNode.makeFromTransform(head, t);\n derivedType = 'derived';\n } else if (isDensity(t)) {\n transformNode = head = new DensityTransformNode(head, t);\n derivedType = 'derived';\n } else if (isQuantile(t)) {\n transformNode = head = new QuantileTransformNode(head, t);\n derivedType = 'derived';\n } else if (isRegression(t)) {\n transformNode = head = new RegressionTransformNode(head, t);\n derivedType = 'derived';\n } else if (isLoess(t)) {\n transformNode = head = new LoessTransformNode(head, t);\n derivedType = 'derived';\n } else {\n log.warn(log.message.invalidTransformIgnored(t));\n continue;\n }\n\n if (transformNode && derivedType !== undefined) {\n for (const field of transformNode.producedFields() ?? []) {\n ancestorParse.set(field, derivedType, false);\n }\n }\n }\n\n return head;\n}\n\n/*\nDescription of the dataflow (http://asciiflow.com/):\n +--------+\n | Source |\n +---+----+\n |\n v\n FormatParse\n (explicit)\n |\n v\n Transforms\n(Filter, Calculate, Binning, TimeUnit, Aggregate, Window, ...)\n |\n v\n FormatParse\n (implicit)\n |\n v\n Binning (in `encoding`)\n |\n v\n Timeunit (in `encoding`)\n |\n v\nFormula From Sort Array\n |\n v\n +--+--+\n | Raw |\n +-----+\n |\n v\n Aggregate (in `encoding`)\n |\n v\n Stack (in `encoding`)\n |\n v\n Invalid Filter\n |\n v\n +----------+\n | Main |\n +----------+\n |\n v\n +-------+\n | Facet |----> \"column\", \"column-layout\", and \"row\"\n +-------+\n |\n v\n ...Child data...\n*/\n\nexport function parseData(model: Model): DataComponent {\n let head = parseRoot(model, model.component.data.sources);\n\n const {outputNodes, outputNodeRefCounts} = model.component.data;\n const data = model.data;\n\n const newData = data && (isGenerator(data) || isUrlData(data) || isInlineData(data));\n const ancestorParse =\n !newData && model.parent ? model.parent.component.data.ancestorParse.clone() : new AncestorParse();\n\n if (isGenerator(data)) {\n // insert generator transform\n if (isSequenceGenerator(data)) {\n head = new SequenceNode(head, data.sequence);\n } else if (isGraticuleGenerator(data)) {\n head = new GraticuleNode(head, data.graticule);\n }\n // no parsing necessary for generator\n ancestorParse.parseNothing = true;\n } else if (data?.format?.parse === null) {\n // format.parse: null means disable parsing\n ancestorParse.parseNothing = true;\n }\n\n head = ParseNode.makeExplicit(head, model, ancestorParse) ?? head;\n\n // Default discrete selections require an identifer transform to\n // uniquely identify data points. Add this transform at the head of\n // the pipeline such that the identifier field is available for all\n // subsequent datasets. During optimization, we will remove this\n // transform if it proves to be unnecessary. Additional identifier\n // transforms will be necessary when new tuples are constructed\n // (e.g., post-aggregation).\n head = new IdentifierNode(head);\n\n // HACK: This is equivalent for merging bin extent for union scale.\n // FIXME(https://github.com/vega/vega-lite/issues/2270): Correctly merge extent / bin node for shared bin scale\n const parentIsLayer = model.parent && isLayerModel(model.parent);\n if (isUnitModel(model) || isFacetModel(model)) {\n if (parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n }\n\n if (model.transforms.length > 0) {\n head = parseTransformArray(head, model, ancestorParse);\n }\n\n // create parse nodes for fields that need to be parsed (or flattened) implicitly\n const implicitSelection = getImplicitFromSelection(model);\n const implicitEncoding = getImplicitFromEncoding(model);\n head = ParseNode.makeWithAncestors(head, {}, {...implicitSelection, ...implicitEncoding}, ancestorParse) ?? head;\n\n if (isUnitModel(model)) {\n head = GeoJSONNode.parseAll(head, model);\n head = GeoPointNode.parseAll(head, model);\n }\n\n if (isUnitModel(model) || isFacetModel(model)) {\n if (!parentIsLayer) {\n head = BinNode.makeFromEncoding(head, model) ?? head;\n }\n\n head = TimeUnitNode.makeFromEncoding(head, model) ?? head;\n head = CalculateNode.parseAllForSortIndex(head, model);\n }\n\n // add an output node pre aggregation\n const rawName = model.getDataName(DataSourceType.Raw);\n const raw = new OutputNode(head, rawName, DataSourceType.Raw, outputNodeRefCounts);\n outputNodes[rawName] = raw;\n head = raw;\n\n if (isUnitModel(model)) {\n const agg = AggregateNode.makeFromEncoding(head, model);\n if (agg) {\n head = agg;\n\n if (requiresSelectionId(model)) {\n head = new IdentifierNode(head);\n }\n }\n head = ImputeNode.makeFromEncoding(head, model) ?? head;\n head = StackNode.makeFromEncoding(head, model) ?? head;\n }\n\n if (isUnitModel(model)) {\n head = FilterInvalidNode.make(head, model) ?? head;\n }\n\n // output node for marks\n const mainName = model.getDataName(DataSourceType.Main);\n const main = new OutputNode(head, mainName, DataSourceType.Main, outputNodeRefCounts);\n outputNodes[mainName] = main;\n head = main;\n\n if (isUnitModel(model)) {\n materializeSelections(model, main);\n }\n\n // add facet marker\n let facetRoot = null;\n if (isFacetModel(model)) {\n const facetName = model.getName('facet');\n\n // Derive new aggregate for facet's sort field\n // augment data source with new fields for crossed facet\n head = makeJoinAggregateFromFacet(head, model.facet) ?? head;\n\n facetRoot = new FacetNode(head, model, facetName, main.getSource());\n outputNodes[facetName] = facetRoot;\n }\n\n return {\n ...model.component.data,\n outputNodes,\n outputNodeRefCounts,\n raw,\n main,\n facetRoot,\n ancestorParse\n };\n}\n","import {vgField} from '../../channeldef';\nimport {DEFAULT_SORT_OP, isSortField} from '../../sort';\nimport {FacetMapping} from '../../spec/facet';\nimport {facetSortFieldName} from '../facet';\nimport {DataFlowNode} from './dataflow';\nimport {JoinAggregateTransformNode} from './joinaggregate';\n\nexport function makeJoinAggregateFromFacet(\n parent: DataFlowNode,\n facet: FacetMapping\n): JoinAggregateTransformNode {\n const {row, column} = facet;\n if (row && column) {\n let newParent = null;\n // only need to make one for crossed facet\n for (const fieldDef of [row, column]) {\n if (isSortField(fieldDef.sort)) {\n const {field, op = DEFAULT_SORT_OP} = fieldDef.sort;\n parent = newParent = new JoinAggregateTransformNode(parent, {\n joinaggregate: [\n {\n op,\n field,\n as: facetSortFieldName(fieldDef, fieldDef.sort, {forAs: true})\n }\n ],\n groupby: [vgField(fieldDef)]\n });\n }\n }\n return newParent;\n }\n return null;\n}\n","import {NewSignal, SignalRef} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isHConcatSpec, isVConcatSpec, NormalizedConcatSpec, NormalizedSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {buildModel} from './buildmodel';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseConcatLayoutSize} from './layoutsize/parse';\nimport {Model} from './model';\n\nexport class ConcatModel extends Model {\n public readonly children: Model[];\n\n constructor(spec: NormalizedConcatSpec, parent: Model, parentGivenName: string, config: Config) {\n super(spec, 'concat', parent, parentGivenName, config, spec.resolve);\n\n if (spec.resolve?.axis?.x === 'shared' || spec.resolve?.axis?.y === 'shared') {\n log.warn(log.message.CONCAT_CANNOT_SHARE_AXIS);\n }\n\n this.children = this.getChildren(spec).map((child, i) => {\n return buildModel(child, this, this.getName(`concat_${i}`), undefined, config);\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n for (const child of this.children) {\n child.parseAxesAndHeaders();\n }\n\n // TODO(#2415): support shared axes\n }\n\n private getChildren(spec: NormalizedConcatSpec): NormalizedSpec[] {\n if (isVConcatSpec(spec)) {\n return spec.vconcat;\n } else if (isHConcatSpec(spec)) {\n return spec.hconcat;\n }\n return spec.concat;\n }\n\n public parseLayoutSize() {\n parseConcatLayoutSize(this);\n }\n\n public parseAxisGroup(): void {\n return null;\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n public assembleSignals(): NewSignal[] {\n this.children.forEach(child => child.assembleSignals());\n return [];\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n const layoutSignals = assembleLayoutSignals(this);\n\n for (const child of this.children) {\n layoutSignals.push(...child.assembleLayoutSignals());\n }\n\n return layoutSignals;\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleMarks(): any[] {\n // only children have marks\n return this.children.map(child => {\n const title = child.assembleTitle();\n const style = child.assembleGroupStyle();\n const encodeEntry = child.assembleGroupEncodeEntry(false);\n\n return {\n type: 'group',\n name: child.getName('group'),\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n ...child.assembleGroup()\n };\n });\n }\n\n public assembleGroupStyle(): string | string[] {\n return undefined;\n }\n\n protected assembleDefaultLayout(): VgLayout {\n const columns = this.layout.columns;\n return {\n ...(columns != null ? {columns} : {}),\n bounds: 'full',\n // Use align each so it can work with multiple plots with different size\n align: 'each'\n };\n }\n}\n","import {Axis as VgAxis, SignalRef, Text} from 'vega';\nimport {\n AxisInternal,\n AxisPart,\n AxisPropsWithCondition,\n COMMON_AXIS_PROPERTIES_INDEX,\n ConditionalAxisProp\n} from '../../axis';\nimport {FieldDefBase} from '../../channeldef';\nimport {duplicate, Flag, keys} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {Split} from '../split';\n\nfunction isFalseOrNull(v: any) {\n return v === false || v === null;\n}\n\nexport type AxisComponentProps = Omit &\n Omit, 'title'> & {\n title: Text | FieldDefBase[] | SignalRef;\n labelExpr: string;\n disable: boolean;\n };\n\nconst AXIS_COMPONENT_PROPERTIES_INDEX: Flag = {\n disable: 1,\n gridScale: 1,\n scale: 1,\n ...COMMON_AXIS_PROPERTIES_INDEX,\n labelExpr: 1,\n encode: 1\n};\n\nexport const AXIS_COMPONENT_PROPERTIES = keys(AXIS_COMPONENT_PROPERTIES_INDEX);\n\nexport class AxisComponent extends Split {\n constructor(\n public readonly explicit: Partial = {},\n public readonly implicit: Partial = {},\n public mainExtracted = false\n ) {\n super();\n }\n\n public clone() {\n return new AxisComponent(duplicate(this.explicit), duplicate(this.implicit), this.mainExtracted);\n }\n\n public hasAxisPart(part: AxisPart) {\n // FIXME(https://github.com/vega/vega-lite/issues/2552) this method can be wrong if users use a Vega theme.\n\n if (part === 'axis') {\n // always has the axis container part\n return true;\n }\n\n if (part === 'grid' || part === 'title') {\n return !!this.get(part);\n }\n // Other parts are enabled by default, so they should not be false or null.\n return !isFalseOrNull(this.get(part));\n }\n\n public hasOrientSignalRef() {\n return isSignalRef(this.explicit.orient);\n }\n}\n\nexport interface AxisComponentIndex {\n x?: AxisComponent[];\n y?: AxisComponent[];\n}\n\nexport interface AxisInternalIndex {\n x?: AxisInternal;\n y?: AxisInternal;\n}\n","import {AxisEncode as VgAxisEncode, AxisOrient, SignalRef} from 'vega';\nimport {Axis, AXIS_PARTS, isAxisProperty, isConditionalAxisValue} from '../../axis';\nimport {PositionScaleChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {getFieldOrDatumDef, PositionDatumDef, PositionFieldDef} from '../../channeldef';\nimport {getFirstDefined, isEmpty, keys, normalizeAngle} from '../../util';\nimport {isSignalRef} from '../../vega.schema';\nimport {mergeTitleComponent} from '../common';\nimport {guideEncodeEntry} from '../guide';\nimport {LayerModel} from '../layer';\nimport {parseGuideResolve} from '../resolve';\nimport {defaultTieBreaker, Explicit, mergeValuesWithExplicit} from '../split';\nimport {UnitModel} from '../unit';\nimport {AxisComponent, AxisComponentIndex, AxisComponentProps, AXIS_COMPONENT_PROPERTIES} from './component';\nimport {getAxisConfig, getAxisConfigs} from './config';\nimport * as encode from './encode';\nimport {AxisRuleParams, axisRules, defaultOrient, getFieldDefTitle, getLabelAngle} from './properties';\nimport {guideFormat, guideFormatType} from '../format';\n\nexport function parseUnitAxes(model: UnitModel): AxisComponentIndex {\n return POSITION_SCALE_CHANNELS.reduce((axis, channel) => {\n if (model.component.scales[channel]) {\n axis[channel] = [parseAxis(channel, model)];\n }\n return axis;\n }, {} as AxisComponentIndex);\n}\n\nconst OPPOSITE_ORIENT: Record = {\n bottom: 'top',\n top: 'bottom',\n left: 'right',\n right: 'left'\n};\n\nexport function parseLayerAxes(model: LayerModel) {\n const {axes, resolve} = model.component;\n const axisCount: Record = {top: 0, bottom: 0, right: 0, left: 0};\n\n for (const child of model.children) {\n child.parseAxesAndHeaders();\n\n for (const channel of keys(child.component.axes)) {\n resolve.axis[channel] = parseGuideResolve(model.component.resolve, channel);\n if (resolve.axis[channel] === 'shared') {\n // If the resolve says shared (and has not been overridden)\n // We will try to merge and see if there is a conflict\n\n axes[channel] = mergeAxisComponents(axes[channel], child.component.axes[channel]);\n\n if (!axes[channel]) {\n // If merge returns nothing, there is a conflict so we cannot make the axis shared.\n // Thus, mark axis as independent and remove the axis component.\n resolve.axis[channel] = 'independent';\n delete axes[channel];\n }\n }\n }\n }\n\n // Move axes to layer's axis component and merge shared axes\n for (const channel of POSITION_SCALE_CHANNELS) {\n for (const child of model.children) {\n if (!child.component.axes[channel]) {\n // skip if the child does not have a particular axis\n continue;\n }\n\n if (resolve.axis[channel] === 'independent') {\n // If axes are independent, concat the axisComponent array.\n axes[channel] = (axes[channel] ?? []).concat(child.component.axes[channel]);\n\n // Automatically adjust orient\n for (const axisComponent of child.component.axes[channel]) {\n const {value: orient, explicit} = axisComponent.getWithExplicit('orient');\n if (isSignalRef(orient)) {\n continue;\n }\n\n if (axisCount[orient] > 0 && !explicit) {\n // Change axis orient if the number do not match\n const oppositeOrient = OPPOSITE_ORIENT[orient];\n if (axisCount[orient] > axisCount[oppositeOrient]) {\n axisComponent.set('orient', oppositeOrient, false);\n }\n }\n axisCount[orient]++;\n\n // TODO(https://github.com/vega/vega-lite/issues/2634): automatically add extra offset?\n }\n }\n\n // After merging, make sure to remove axes from child\n delete child.component.axes[channel];\n }\n\n // Show gridlines for first axis only for dual-axis chart\n if (resolve.axis[channel] === 'independent' && axes[channel] && axes[channel].length > 1) {\n for (const [index, axisCmpt] of (axes[channel] || []).entries()) {\n if (index > 0 && !!axisCmpt.get('grid') && !axisCmpt.explicit.grid) {\n axisCmpt.implicit.grid = false;\n }\n }\n }\n }\n}\n\nfunction mergeAxisComponents(\n mergedAxisCmpts: AxisComponent[],\n childAxisCmpts: readonly AxisComponent[]\n): AxisComponent[] {\n if (mergedAxisCmpts) {\n // FIXME: this is a bit wrong once we support multiple axes\n if (mergedAxisCmpts.length !== childAxisCmpts.length) {\n return undefined; // Cannot merge axis component with different number of axes.\n }\n const length = mergedAxisCmpts.length;\n for (let i = 0; i < length; i++) {\n const merged = mergedAxisCmpts[i];\n const child = childAxisCmpts[i];\n\n if (!!merged !== !!child) {\n return undefined;\n } else if (merged && child) {\n const mergedOrient = merged.getWithExplicit('orient');\n const childOrient = child.getWithExplicit('orient');\n\n if (mergedOrient.explicit && childOrient.explicit && mergedOrient.value !== childOrient.value) {\n // TODO: throw warning if resolve is explicit (We don't have info about explicit/implicit resolve yet.)\n\n // Cannot merge due to inconsistent orient\n return undefined;\n } else {\n mergedAxisCmpts[i] = mergeAxisComponent(merged, child);\n }\n }\n }\n } else {\n // For first one, return a copy of the child\n return childAxisCmpts.map(axisComponent => axisComponent.clone());\n }\n return mergedAxisCmpts;\n}\n\nfunction mergeAxisComponent(merged: AxisComponent, child: AxisComponent): AxisComponent {\n for (const prop of AXIS_COMPONENT_PROPERTIES) {\n const mergedValueWithExplicit = mergeValuesWithExplicit(\n merged.getWithExplicit(prop),\n child.getWithExplicit(prop),\n prop,\n 'axis',\n\n // Tie breaker function\n (v1: Explicit, v2: Explicit) => {\n switch (prop) {\n case 'title':\n return mergeTitleComponent(v1, v2);\n case 'gridScale':\n return {\n explicit: v1.explicit, // keep the old explicit\n value: getFirstDefined(v1.value, v2.value)\n };\n }\n return defaultTieBreaker(v1, v2, prop, 'axis');\n }\n );\n merged.setWithExplicit(prop, mergedValueWithExplicit);\n }\n return merged;\n}\n\nfunction isExplicit(\n value: T,\n property: keyof AxisComponentProps,\n axis: Axis,\n model: UnitModel,\n channel: PositionScaleChannel\n) {\n if (property === 'disable') {\n return axis !== undefined; // if axis is specified or null/false, then its enable/disable state is explicit\n }\n\n axis = axis || {};\n\n switch (property) {\n case 'titleAngle':\n case 'labelAngle':\n return value === (isSignalRef(axis.labelAngle) ? axis.labelAngle : normalizeAngle(axis.labelAngle));\n case 'values':\n return !!axis.values;\n // specified axis.values is already respected, but may get transformed.\n case 'encode':\n // both VL axis.encoding and axis.labelAngle affect VG axis.encode\n return !!axis.encoding || !!axis.labelAngle;\n case 'title':\n // title can be explicit if fieldDef.title is set\n if (value === getFieldDefTitle(model, channel)) {\n return true;\n }\n }\n // Otherwise, things are explicit if the returned value matches the specified property\n return value === axis[property];\n}\n\n/**\n * Properties to always include values from config\n */\nconst propsToAlwaysIncludeConfig = new Set([\n 'grid', // Grid is an exception because we need to set grid = true to generate another grid axis\n 'translate', // translate has dependent logic for bar's bin position and it's 0.5 by default in Vega. If a config overrides this value, we need to know.\n // the rest are not axis configs in Vega, but are in VL, so we need to set too.\n 'format',\n 'formatType',\n 'orient',\n 'labelExpr',\n 'tickCount',\n 'position',\n 'tickMinStep'\n]);\n\nfunction parseAxis(channel: PositionScaleChannel, model: UnitModel): AxisComponent {\n let axis = model.axis(channel);\n\n const axisComponent = new AxisComponent();\n\n const fieldOrDatumDef = getFieldOrDatumDef(model.encoding[channel]) as\n | PositionFieldDef\n | PositionDatumDef;\n\n const {mark, config} = model;\n\n const orient =\n axis?.orient ||\n config[channel === 'x' ? 'axisX' : 'axisY']?.orient ||\n config.axis?.orient ||\n defaultOrient(channel);\n\n const scaleType = model.getScaleComponent(channel).get('type');\n\n const axisConfigs = getAxisConfigs(channel, scaleType, orient, model.config);\n\n const disable =\n axis !== undefined ? !axis : getAxisConfig('disable', config.style, axis?.style, axisConfigs).configValue;\n axisComponent.set('disable', disable, axis !== undefined);\n if (disable) {\n return axisComponent;\n }\n\n axis = axis || {};\n\n const labelAngle = getLabelAngle(fieldOrDatumDef, axis, channel, config.style, axisConfigs);\n const formatType = guideFormatType(axis.formatType, fieldOrDatumDef, scaleType);\n const format = guideFormat(fieldOrDatumDef, fieldOrDatumDef.type, axis.format, axis.formatType, config, true);\n\n const ruleParams: AxisRuleParams = {\n fieldOrDatumDef,\n axis,\n channel,\n model,\n scaleType,\n orient,\n labelAngle,\n format,\n formatType,\n mark,\n config\n };\n // 1.2. Add properties\n for (const property of AXIS_COMPONENT_PROPERTIES) {\n const value =\n property in axisRules ? axisRules[property](ruleParams) : isAxisProperty(property) ? axis[property] : undefined;\n\n const hasValue = value !== undefined;\n\n const explicit = isExplicit(value, property, axis, model, channel);\n\n if (hasValue && explicit) {\n axisComponent.set(property, value, explicit);\n } else {\n const {configValue = undefined, configFrom = undefined} =\n isAxisProperty(property) && property !== 'values'\n ? getAxisConfig(property, config.style, axis.style, axisConfigs)\n : {};\n const hasConfigValue = configValue !== undefined;\n\n if (hasValue && !hasConfigValue) {\n // only set property if it is explicitly set or has no config value (otherwise we will accidentally override config)\n axisComponent.set(property, value, explicit);\n } else if (\n // Cases need implicit values\n // 1. Axis config that aren't available in Vega\n !(configFrom === 'vgAxisConfig') ||\n // 2. Certain properties are always included (see `propsToAlwaysIncludeConfig`'s declaration for more details)\n (propsToAlwaysIncludeConfig.has(property) && hasConfigValue) ||\n // 3. Conditional axis values and signals\n isConditionalAxisValue(configValue) ||\n isSignalRef(configValue)\n ) {\n // If a config is specified and is conditional, copy conditional value from axis config\n axisComponent.set(property, configValue, false);\n }\n }\n }\n\n // 2) Add guide encode definition groups\n const axisEncoding = axis.encoding ?? {};\n const axisEncode = AXIS_PARTS.reduce((e: VgAxisEncode, part) => {\n if (!axisComponent.hasAxisPart(part)) {\n // No need to create encode for a disabled part.\n return e;\n }\n\n const axisEncodingPart = guideEncodeEntry(axisEncoding[part] ?? {}, model);\n\n const value = part === 'labels' ? encode.labels(model, channel, axisEncodingPart) : axisEncodingPart;\n\n if (value !== undefined && !isEmpty(value)) {\n e[part] = {update: value};\n }\n return e;\n }, {} as VgAxisEncode);\n\n // FIXME: By having encode as one property, we won't have fine grained encode merging.\n if (!isEmpty(axisEncode)) {\n axisComponent.set('encode', axisEncode, !!axis.encoding || axis.labelAngle !== undefined);\n }\n\n return axisComponent;\n}\n","import {getSecondaryRangeChannel, PositionScaleChannel} from '../../channel';\nimport {channelDefType, getFieldOrDatumDef, isFieldDef, isPositionFieldOrDatumDef} from '../../channeldef';\nimport {formatCustomType, isCustomFormatType} from '../format';\nimport {UnitModel} from '../unit';\n\nexport function labels(model: UnitModel, channel: PositionScaleChannel, specifiedLabelsSpec: any) {\n const {encoding, config} = model;\n\n const fieldOrDatumDef =\n getFieldOrDatumDef(encoding[channel]) ?? getFieldOrDatumDef(encoding[getSecondaryRangeChannel(channel)]);\n const axis = model.axis(channel) || {};\n const {format, formatType} = axis;\n\n if (isCustomFormatType(formatType)) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format,\n formatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n } else if (format === undefined && formatType === undefined && config.customFormatTypes) {\n if (channelDefType(fieldOrDatumDef) === 'quantitative') {\n if (\n isPositionFieldOrDatumDef(fieldOrDatumDef) &&\n fieldOrDatumDef.stack === 'normalize' &&\n config.normalizedNumberFormatType\n ) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.normalizedNumberFormat,\n formatType: config.normalizedNumberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n } else if (config.numberFormatType) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.numberFormat,\n formatType: config.numberFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n if (\n channelDefType(fieldOrDatumDef) === 'temporal' &&\n config.timeFormatType &&\n isFieldDef(fieldOrDatumDef) &&\n !fieldOrDatumDef.timeUnit\n ) {\n return {\n text: formatCustomType({\n fieldOrDatumDef,\n field: 'datum.value',\n format: config.timeFormat,\n formatType: config.timeFormatType,\n config\n }),\n ...specifiedLabelsSpec\n };\n }\n }\n return specifiedLabelsSpec;\n}\n","import {Config} from '../../config';\nimport {VgEncodeEntry} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nfunction encodeEntry(model: UnitModel, fixedShape?: 'circle' | 'square') {\n const {config} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.nonPosition('angle', model),\n ...shapeMixins(model, config, fixedShape)\n };\n}\n\nexport function shapeMixins(model: UnitModel, config: Config, fixedShape?: 'circle' | 'square'): VgEncodeEntry {\n if (fixedShape) {\n return {shape: {value: fixedShape}};\n }\n return encode.nonPosition('shape', model);\n}\n\nexport const point: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model);\n }\n};\n\nexport const circle: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'circle');\n }\n};\n\nexport const square: MarkCompiler = {\n vgMark: 'symbol',\n encodeEntry: (model: UnitModel) => {\n return encodeEntry(model, 'square');\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rule: MarkCompiler = {\n vgMark: 'rule',\n encodeEntry: (model: UnitModel) => {\n const {markDef} = model;\n const orient = markDef.orient;\n\n if (!model.encoding.x && !model.encoding.y && !model.encoding.latitude && !model.encoding.longitude) {\n // Show nothing if we have none of x, y, lat, and long.\n return {};\n }\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: orient === 'horizontal' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'vertical' // include x2 for horizontal or line segment rule\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: orient === 'vertical' ? 'zeroOrMax' : 'mid',\n defaultPos2: 'zeroOrMin',\n range: orient !== 'horizontal' // include y2 for vertical or line segment rule\n }),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's rule size is strokeWidth\n })\n };\n }\n};\n","import type {SignalRef} from 'vega';\nimport {Config} from '../../config';\nimport {Encoding} from '../../encoding';\nimport {MarkDef} from '../../mark';\nimport {getMarkPropOrConfig} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const text: MarkCompiler = {\n vgMark: 'text',\n\n encodeEntry: (model: UnitModel) => {\n const {config, encoding} = model;\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'include',\n baseline: 'include',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'include'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.text(model),\n ...encode.nonPosition('size', model, {\n vgChannel: 'fontSize' // VL's text size is fontSize\n }),\n ...encode.nonPosition('angle', model),\n ...encode.valueIfDefined('align', align(model.markDef, encoding, config)),\n ...encode.valueIfDefined('baseline', baseline(model.markDef, encoding, config)),\n ...encode.pointPosition('radius', model, {defaultPos: null}),\n ...encode.pointPosition('theta', model, {defaultPos: null})\n };\n }\n};\n\nfunction align(markDef: MarkDef, encoding: Encoding, config: Config) {\n const a = getMarkPropOrConfig('align', markDef, config);\n if (a === undefined) {\n return 'center';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n\nfunction baseline(markDef: MarkDef, encoding: Encoding, config: Config) {\n const b = getMarkPropOrConfig('baseline', markDef, config);\n if (b === undefined) {\n return 'middle';\n }\n // If there is a config, Vega-parser will process this already.\n return undefined;\n}\n","import type {SignalRef} from 'vega';\nimport {isNumber} from 'vega-util';\nimport {getViewConfigDiscreteStep} from '../../config';\nimport {isVgRangeStep} from '../../vega.schema';\nimport {getMarkPropOrConfig, signalOrValueRef} from '../common';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const tick: MarkCompiler = {\n vgMark: 'rect',\n\n encodeEntry: (model: UnitModel) => {\n const {config, markDef} = model;\n const orient = markDef.orient;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const vgThicknessChannel = orient === 'horizontal' ? 'height' : 'width';\n\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n\n ...encode.pointPosition('x', model, {defaultPos: 'mid', vgChannel: 'xc'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid', vgChannel: 'yc'}),\n\n // size / thickness => width / height\n ...encode.nonPosition('size', model, {\n defaultValue: defaultSize(model),\n vgChannel: vgSizeChannel\n }),\n [vgThicknessChannel]: signalOrValueRef(getMarkPropOrConfig('thickness', markDef, config))\n };\n }\n};\n\nfunction defaultSize(model: UnitModel): number | SignalRef {\n const {config, markDef} = model;\n const {orient} = markDef;\n\n const vgSizeChannel = orient === 'horizontal' ? 'width' : 'height';\n const scale = model.getScaleComponent(orient === 'horizontal' ? 'x' : 'y');\n\n const markPropOrConfig =\n getMarkPropOrConfig('size', markDef, config, {vgChannel: vgSizeChannel}) ?? config.tick.bandSize;\n\n if (markPropOrConfig !== undefined) {\n return markPropOrConfig;\n } else {\n const scaleRange = scale ? scale.get('range') : undefined;\n if (scaleRange && isVgRangeStep(scaleRange) && isNumber(scaleRange.step)) {\n return (scaleRange.step * 3) / 4;\n }\n\n const defaultViewStep = getViewConfigDiscreteStep(config.view, vgSizeChannel);\n\n return (defaultViewStep * 3) / 4;\n }\n}\n","import {isArray} from 'vega-util';\nimport {FieldRefOption, isFieldDef, isValueDef, vgField} from '../../channeldef';\nimport {DataSourceType} from '../../data';\nimport {isAggregate, pathGroupingFields} from '../../encoding';\nimport {AREA, BAR, isPathMark, LINE, Mark, TRAIL} from '../../mark';\nimport {isSortByEncoding, isSortField} from '../../sort';\nimport {contains, getFirstDefined, isNullOrFalse, keys, omit, pick} from '../../util';\nimport {VgCompare, VgEncodeEntry, VG_CORNERRADIUS_CHANNELS} from '../../vega.schema';\nimport {getMarkConfig, getMarkPropOrConfig, getStyles, signalOrValueRef, sortParams} from '../common';\nimport {UnitModel} from '../unit';\nimport {arc} from './arc';\nimport {area} from './area';\nimport {bar} from './bar';\nimport {MarkCompiler} from './base';\nimport {geoshape} from './geoshape';\nimport {image} from './image';\nimport {line, trail} from './line';\nimport {circle, point, square} from './point';\nimport {rect} from './rect';\nimport {rule} from './rule';\nimport {text} from './text';\nimport {tick} from './tick';\n\nconst markCompiler: Record = {\n arc,\n area,\n bar,\n circle,\n geoshape,\n image,\n line,\n point,\n rect,\n rule,\n square,\n text,\n tick,\n trail\n};\n\nexport function parseMarkGroups(model: UnitModel): any[] {\n if (contains([LINE, AREA, TRAIL], model.mark)) {\n const details = pathGroupingFields(model.mark, model.encoding);\n if (details.length > 0) {\n return getPathGroups(model, details);\n }\n // otherwise use standard mark groups\n } else if (model.mark === BAR) {\n const hasCornerRadius = VG_CORNERRADIUS_CHANNELS.some(prop =>\n getMarkPropOrConfig(prop, model.markDef, model.config)\n );\n if (model.stack && !model.fieldDef('size') && hasCornerRadius) {\n return getGroupsForStackedBarWithCornerRadius(model);\n }\n }\n\n return getMarkGroup(model);\n}\n\nconst FACETED_PATH_PREFIX = 'faceted_path_';\n\nfunction getPathGroups(model: UnitModel, details: string[]) {\n // TODO: for non-stacked plot, map order to zindex. (Maybe rename order for layer to zindex?)\n\n return [\n {\n name: model.getName('pathgroup'),\n type: 'group',\n from: {\n facet: {\n name: FACETED_PATH_PREFIX + model.requestDataName(DataSourceType.Main),\n data: model.requestDataName(DataSourceType.Main),\n groupby: details\n }\n },\n encode: {\n update: {\n width: {field: {group: 'width'}},\n height: {field: {group: 'height'}}\n }\n },\n // With subfacet for line/area group, need to use faceted data from above.\n marks: getMarkGroup(model, {fromPrefix: FACETED_PATH_PREFIX})\n }\n ];\n}\n\nconst STACK_GROUP_PREFIX = 'stack_group_';\n\n/**\n * We need to put stacked bars into groups in order to enable cornerRadius for stacks.\n * If stack is used and the model doesn't have size encoding, we put the mark into groups,\n * and apply cornerRadius properties at the group.\n */\nfunction getGroupsForStackedBarWithCornerRadius(model: UnitModel) {\n // Generate the mark\n const [mark] = getMarkGroup(model, {fromPrefix: STACK_GROUP_PREFIX});\n\n // Get the scale for the stacked field\n const fieldScale = model.scaleName(model.stack.fieldChannel);\n const stackField = (opt: FieldRefOption = {}) => model.vgField(model.stack.fieldChannel, opt);\n // Find the min/max of the pixel value on the stacked direction\n const stackFieldGroup = (func: 'min' | 'max', expr: 'datum' | 'parent') => {\n const vgFieldMinMax = [\n stackField({prefix: 'min', suffix: 'start', expr}),\n stackField({prefix: 'max', suffix: 'start', expr}),\n stackField({prefix: 'min', suffix: 'end', expr}),\n stackField({prefix: 'max', suffix: 'end', expr})\n ];\n return `${func}(${vgFieldMinMax.map(field => `scale('${fieldScale}',${field})`).join(',')})`;\n };\n\n let groupUpdate: VgEncodeEntry;\n let innerGroupUpdate: VgEncodeEntry;\n\n // Build the encoding for group and an inner group\n if (model.stack.fieldChannel === 'x') {\n // Move cornerRadius, y/yc/y2/height properties to group\n // Group x/x2 should be the min/max of the marks within\n groupUpdate = {\n ...pick(mark.encode.update, ['y', 'yc', 'y2', 'height', ...VG_CORNERRADIUS_CHANNELS]),\n x: {signal: stackFieldGroup('min', 'datum')},\n x2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n // Inner group should revert the x translation, and pass height through\n innerGroupUpdate = {\n x: {field: {group: 'x'}, mult: -1},\n height: {field: {group: 'height'}}\n };\n // The marks should use the same height as group, without y/yc/y2 properties (because it's already done by group)\n // This is why size encoding is not supported yet\n mark.encode.update = {\n ...omit(mark.encode.update, ['y', 'yc', 'y2']),\n height: {field: {group: 'height'}}\n };\n } else {\n groupUpdate = {\n ...pick(mark.encode.update, ['x', 'xc', 'x2', 'width']),\n y: {signal: stackFieldGroup('min', 'datum')},\n y2: {signal: stackFieldGroup('max', 'datum')},\n clip: {value: true}\n };\n innerGroupUpdate = {\n y: {field: {group: 'y'}, mult: -1},\n width: {field: {group: 'width'}}\n };\n mark.encode.update = {\n ...omit(mark.encode.update, ['x', 'xc', 'x2']),\n width: {field: {group: 'width'}}\n };\n }\n\n // Deal with cornerRadius properties\n for (const key of VG_CORNERRADIUS_CHANNELS) {\n const configValue = getMarkConfig(key, model.markDef, model.config);\n // Move from mark to group\n if (mark.encode.update[key]) {\n groupUpdate[key] = mark.encode.update[key];\n delete mark.encode.update[key];\n } else if (configValue) {\n groupUpdate[key] = signalOrValueRef(configValue);\n }\n // Overwrite any cornerRadius on mark set by config --- they are already moved to the group\n if (configValue) {\n mark.encode.update[key] = {value: 0};\n }\n }\n\n const groupby: string[] = [];\n\n if (model.stack.groupbyChannels?.length > 0) {\n for (const groupbyChannel of model.stack.groupbyChannels) {\n // For bin and time unit, we have to add bin/timeunit -end channels.\n const groupByField = model.fieldDef(groupbyChannel);\n const field = vgField(groupByField);\n if (field) {\n groupby.push(field);\n }\n\n if (groupByField?.bin || groupByField?.timeUnit) {\n groupby.push(vgField(groupByField, {binSuffix: 'end'}));\n }\n }\n }\n\n const strokeProperties = [\n 'stroke',\n 'strokeWidth',\n 'strokeJoin',\n 'strokeCap',\n 'strokeDash',\n 'strokeDashOffset',\n 'strokeMiterLimit',\n 'strokeOpacity'\n ] as const;\n\n // Generate stroke properties for the group\n groupUpdate = strokeProperties.reduce((encode, prop) => {\n if (mark.encode.update[prop]) {\n return {...encode, [prop]: mark.encode.update[prop]};\n } else {\n const configValue = getMarkConfig(prop, model.markDef, model.config);\n if (configValue !== undefined) {\n return {...encode, [prop]: signalOrValueRef(configValue)};\n } else {\n return encode;\n }\n }\n }, groupUpdate);\n\n // Apply strokeForeground and strokeOffset if stroke is used\n if (groupUpdate.stroke) {\n groupUpdate.strokeForeground = {value: true};\n groupUpdate.strokeOffset = {value: 0};\n }\n\n return [\n {\n type: 'group',\n from: {\n facet: {\n data: model.requestDataName(DataSourceType.Main),\n name: STACK_GROUP_PREFIX + model.requestDataName(DataSourceType.Main),\n groupby,\n aggregate: {\n fields: [\n stackField({suffix: 'start'}),\n stackField({suffix: 'start'}),\n stackField({suffix: 'end'}),\n stackField({suffix: 'end'})\n ],\n ops: ['min', 'max', 'min', 'max']\n }\n }\n },\n encode: {\n update: groupUpdate\n },\n marks: [\n {\n type: 'group',\n encode: {update: innerGroupUpdate},\n marks: [mark]\n }\n ]\n }\n ];\n}\n\nexport function getSort(model: UnitModel): VgCompare {\n const {encoding, stack, mark, markDef, config} = model;\n const order = encoding.order;\n if (\n (!isArray(order) && isValueDef(order) && isNullOrFalse(order.value)) ||\n (!order && isNullOrFalse(getMarkPropOrConfig('order', markDef, config)))\n ) {\n return undefined;\n } else if ((isArray(order) || isFieldDef(order)) && !stack) {\n // Sort by the order field if it is specified and the field is not stacked. (For stacked field, order specify stack order.)\n return sortParams(order, {expr: 'datum'});\n } else if (isPathMark(mark)) {\n // For both line and area, we sort values based on dimension by default\n const dimensionChannel = markDef.orient === 'horizontal' ? 'y' : 'x';\n const dimensionChannelDef = encoding[dimensionChannel];\n if (isFieldDef(dimensionChannelDef)) {\n const s = dimensionChannelDef.sort;\n\n if (isArray(s)) {\n return {\n field: vgField(dimensionChannelDef, {prefix: dimensionChannel, suffix: 'sort_index', expr: 'datum'})\n };\n } else if (isSortField(s)) {\n return {\n field: vgField(\n {\n // FIXME: this op might not already exist?\n // FIXME: what if dimensionChannel (x or y) contains custom domain?\n aggregate: isAggregate(model.encoding) ? s.op : undefined,\n field: s.field\n },\n {expr: 'datum'}\n )\n };\n } else if (isSortByEncoding(s)) {\n const fieldDefToSort = model.fieldDef(s.encoding);\n return {\n field: vgField(fieldDefToSort, {expr: 'datum'}),\n order: s.order\n };\n } else if (s === null) {\n return undefined;\n } else {\n return {\n field: vgField(dimensionChannelDef, {\n // For stack with imputation, we only have bin_mid\n binSuffix: model.stack?.impute ? 'mid' : undefined,\n expr: 'datum'\n })\n };\n }\n }\n return undefined;\n }\n return undefined;\n}\n\nfunction getMarkGroup(model: UnitModel, opt: {fromPrefix: string} = {fromPrefix: ''}) {\n const {mark, markDef, encoding, config} = model;\n\n const clip = getFirstDefined(markDef.clip, scaleClip(model), projectionClip(model));\n const style = getStyles(markDef);\n const key = encoding.key;\n const sort = getSort(model);\n const interactive = interactiveFlag(model);\n const aria = getMarkPropOrConfig('aria', markDef, config);\n\n const postEncodingTransform = markCompiler[mark].postEncodingTransform\n ? markCompiler[mark].postEncodingTransform(model)\n : null;\n\n return [\n {\n name: model.getName('marks'),\n type: markCompiler[mark].vgMark,\n ...(clip ? {clip: true} : {}),\n ...(style ? {style} : {}),\n ...(key ? {key: key.field} : {}),\n ...(sort ? {sort} : {}),\n ...(interactive ? interactive : {}),\n ...(aria === false ? {aria} : {}),\n from: {data: opt.fromPrefix + model.requestDataName(DataSourceType.Main)},\n encode: {\n update: markCompiler[mark].encodeEntry(model)\n },\n ...(postEncodingTransform\n ? {\n transform: postEncodingTransform\n }\n : {})\n }\n ];\n}\n\n/**\n * If scales are bound to interval selections, we want to automatically clip\n * marks to account for panning/zooming interactions. We identify bound scales\n * by the selectionExtent property, which gets added during scale parsing.\n */\nfunction scaleClip(model: UnitModel) {\n const xScale = model.getScaleComponent('x');\n const yScale = model.getScaleComponent('y');\n return xScale?.get('selectionExtent') || yScale?.get('selectionExtent') ? true : undefined;\n}\n\n/**\n * If we use a custom projection with auto-fitting to the geodata extent,\n * we need to clip to ensure the chart size doesn't explode.\n */\nfunction projectionClip(model: UnitModel) {\n const projection = model.component.projection;\n return projection && !projection.isFit ? true : undefined;\n}\n\n/**\n * Only output interactive flags if we have selections defined somewhere in our model hierarchy.\n */\nfunction interactiveFlag(model: UnitModel) {\n if (!model.component.selection) return null;\n const unitCount = keys(model.component.selection).length;\n let parentCount = unitCount;\n let parent = model.parent;\n while (parent && parentCount === 0) {\n parentCount = keys(parent.component.selection).length;\n parent = parent.parent;\n }\n return parentCount\n ? {\n interactive: unitCount > 0 || model.mark === 'geoshape' || !!model.encoding.tooltip\n }\n : null;\n}\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const arc: MarkCompiler = {\n vgMark: 'arc',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n\n // arcs are rectangles in polar coordinates\n ...encode.rectPosition(model, 'radius'),\n ...encode.rectPosition(model, 'theta')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const area: MarkCompiler = {\n vgMark: 'area',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'include',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointOrRangePosition('x', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'horizontal'\n }),\n ...encode.pointOrRangePosition('y', model, {\n defaultPos: 'zeroOrMin',\n defaultPos2: 'zeroOrMin',\n range: model.markDef.orient === 'vertical'\n }),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const bar: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n","import {GeoShapeTransform as VgGeoShapeTransform} from 'vega';\nimport {isFieldDef, vgField} from '../../channeldef';\nimport {GEOJSON} from '../../type';\nimport {VgPostEncodingTransform} from '../../vega.schema';\nimport {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const geoshape: MarkCompiler = {\n vgMark: 'shape',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n })\n };\n },\n postEncodingTransform: (model: UnitModel): VgPostEncodingTransform[] => {\n const {encoding} = model;\n const shapeDef = encoding.shape;\n\n const transform: VgGeoShapeTransform = {\n type: 'geoshape',\n projection: model.projectionName(),\n // as: 'shape',\n ...(shapeDef && isFieldDef(shapeDef) && shapeDef.type === GEOJSON\n ? {field: vgField(shapeDef, {expr: 'datum'})}\n : {})\n };\n return [transform];\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const image: MarkCompiler = {\n vgMark: 'image',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'ignore',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y'),\n ...encode.text(model, 'url')\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const line: MarkCompiler = {\n vgMark: 'line',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'ignore',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model, {\n vgChannel: 'strokeWidth' // VL's line size is strokeWidth\n }),\n ...encode.defined(model)\n };\n }\n};\n\nexport const trail: MarkCompiler = {\n vgMark: 'trail',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n size: 'include',\n orient: 'ignore',\n theta: 'ignore'\n }),\n ...encode.pointPosition('x', model, {defaultPos: 'mid'}),\n ...encode.pointPosition('y', model, {defaultPos: 'mid'}),\n ...encode.nonPosition('size', model),\n ...encode.defined(model)\n };\n }\n};\n","import {UnitModel} from '../unit';\nimport {MarkCompiler} from './base';\nimport * as encode from './encode';\n\nexport const rect: MarkCompiler = {\n vgMark: 'rect',\n encodeEntry: (model: UnitModel) => {\n return {\n ...encode.baseEncodeEntry(model, {\n align: 'ignore',\n baseline: 'ignore',\n color: 'include',\n orient: 'ignore',\n size: 'ignore',\n theta: 'ignore'\n }),\n ...encode.rectPosition(model, 'x'),\n ...encode.rectPosition(model, 'y')\n };\n }\n};\n","import {NewSignal, SignalRef} from 'vega';\nimport {isArray} from 'vega-util';\nimport {Axis, AxisInternal, isConditionalAxisValue} from '../axis';\nimport {\n Channel,\n GEOPOSITION_CHANNELS,\n NonPositionScaleChannel,\n NONPOSITION_SCALE_CHANNELS,\n PositionChannel,\n POSITION_SCALE_CHANNELS,\n ScaleChannel,\n SCALE_CHANNELS,\n SingleDefChannel,\n supportLegend,\n X,\n Y\n} from '../channel';\nimport {\n getFieldDef,\n getFieldOrDatumDef,\n isFieldOrDatumDef,\n isTypedFieldDef,\n MarkPropFieldOrDatumDef,\n PositionFieldDef\n} from '../channeldef';\nimport {Config} from '../config';\nimport {isGraticuleGenerator} from '../data';\nimport * as vlEncoding from '../encoding';\nimport {Encoding, initEncoding} from '../encoding';\nimport {ExprRef, replaceExprRef} from '../expr';\nimport {LegendInternal} from '../legend';\nimport {GEOSHAPE, isMarkDef, Mark, MarkDef} from '../mark';\nimport {Projection} from '../projection';\nimport {Domain, Scale} from '../scale';\nimport {isSelectionParameter, SelectionParameter} from '../selection';\nimport {LayoutSizeMixins, NormalizedUnitSpec} from '../spec';\nimport {isFrameMixins} from '../spec/base';\nimport {stack, StackProperties} from '../stack';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {AxisInternalIndex} from './axis/component';\nimport {parseUnitAxes} from './axis/parse';\nimport {signalOrValueRefWithCondition, signalRefOrValue} from './common';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {initLayoutSize} from './layoutsize/init';\nimport {parseUnitLayoutSize} from './layoutsize/parse';\nimport {LegendInternalIndex} from './legend/component';\nimport {defaultFilled, initMarkdef} from './mark/init';\nimport {parseMarkGroups} from './mark/mark';\nimport {isLayerModel, Model, ModelWithField} from './model';\nimport {ScaleIndex} from './scale/component';\nimport {\n assembleTopLevelSignals,\n assembleUnitSelectionData,\n assembleUnitSelectionMarks,\n assembleUnitSelectionSignals\n} from './selection/assemble';\nimport {parseUnitSelection} from './selection/parse';\n\n/**\n * Internal model of Vega-Lite specification for the compiler.\n */\nexport class UnitModel extends ModelWithField {\n public readonly markDef: MarkDef;\n public readonly encoding: Encoding;\n\n public readonly specifiedScales: ScaleIndex = {};\n\n public readonly stack: StackProperties;\n\n protected specifiedAxes: AxisInternalIndex = {};\n\n protected specifiedLegends: LegendInternalIndex = {};\n\n public specifiedProjection: Projection = {};\n\n public readonly selection: SelectionParameter[] = [];\n public children: Model[] = [];\n\n constructor(\n spec: NormalizedUnitSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins = {},\n config: Config\n ) {\n super(spec, 'unit', parent, parentGivenName, config, undefined, isFrameMixins(spec) ? spec.view : undefined);\n\n const markDef = isMarkDef(spec.mark) ? {...spec.mark} : {type: spec.mark};\n const mark = markDef.type;\n\n // Need to init filled before other mark properties because encoding depends on filled but other mark properties depend on types inside encoding\n if (markDef.filled === undefined) {\n markDef.filled = defaultFilled(markDef, config, {\n graticule: spec.data && isGraticuleGenerator(spec.data)\n });\n }\n\n const encoding = (this.encoding = initEncoding(spec.encoding || {}, mark, markDef.filled, config));\n this.markDef = initMarkdef(markDef, encoding, config);\n\n this.size = initLayoutSize({\n encoding,\n size: isFrameMixins(spec)\n ? {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n }\n : parentGivenSize\n });\n\n // calculate stack properties\n this.stack = stack(this.markDef, encoding);\n this.specifiedScales = this.initScales(mark, encoding);\n\n this.specifiedAxes = this.initAxes(encoding);\n this.specifiedLegends = this.initLegends(encoding);\n this.specifiedProjection = spec.projection;\n\n // Selections will be initialized upon parse.\n this.selection = (spec.params ?? []).filter(p => isSelectionParameter(p)) as SelectionParameter[];\n }\n\n public get hasProjection(): boolean {\n const {encoding} = this;\n const isGeoShapeMark = this.mark === GEOSHAPE;\n const hasGeoPosition = encoding && GEOPOSITION_CHANNELS.some(channel => isFieldOrDatumDef(encoding[channel]));\n return isGeoShapeMark || hasGeoPosition;\n }\n\n /**\n * Return specified Vega-Lite scale domain for a particular channel\n * @param channel\n */\n public scaleDomain(channel: ScaleChannel): Domain {\n const scale = this.specifiedScales[channel];\n return scale ? scale.domain : undefined;\n }\n\n public axis(channel: PositionChannel): AxisInternal {\n return this.specifiedAxes[channel];\n }\n\n public legend(channel: NonPositionScaleChannel): LegendInternal {\n return this.specifiedLegends[channel];\n }\n\n private initScales(mark: Mark, encoding: Encoding): ScaleIndex {\n return SCALE_CHANNELS.reduce((scales, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as\n | PositionFieldDef\n | MarkPropFieldOrDatumDef;\n if (fieldOrDatumDef) {\n scales[channel] = this.initScale(fieldOrDatumDef.scale ?? {});\n }\n return scales;\n }, {} as ScaleIndex);\n }\n\n private initScale(scale: Scale): Scale {\n const {domain, range} = scale;\n // TODO: we could simplify this function if we had a recursive replace function\n const scaleInternal = replaceExprRef(scale);\n if (isArray(domain)) {\n scaleInternal.domain = domain.map(signalRefOrValue);\n }\n if (isArray(range)) {\n scaleInternal.range = range.map(signalRefOrValue);\n }\n return scaleInternal as Scale;\n }\n\n private initAxes(encoding: Encoding): AxisInternalIndex {\n return POSITION_SCALE_CHANNELS.reduce((_axis, channel) => {\n // Position Axis\n\n // TODO: handle ConditionFieldDef\n const channelDef = encoding[channel];\n if (\n isFieldOrDatumDef(channelDef) ||\n (channel === X && isFieldOrDatumDef(encoding.x2)) ||\n (channel === Y && isFieldOrDatumDef(encoding.y2))\n ) {\n const axisSpec = isFieldOrDatumDef(channelDef) ? channelDef.axis : undefined;\n\n _axis[channel] = axisSpec\n ? this.initAxis({...axisSpec}) // convert truthy value to object\n : axisSpec;\n }\n return _axis;\n }, {});\n }\n\n private initAxis(axis: Axis): Axis {\n const props = keys(axis);\n const axisInternal = {};\n for (const prop of props) {\n const val = axis[prop];\n axisInternal[prop as any] = isConditionalAxisValue(val)\n ? signalOrValueRefWithCondition(val)\n : signalRefOrValue(val);\n }\n return axisInternal;\n }\n\n private initLegends(encoding: Encoding): LegendInternalIndex {\n return NONPOSITION_SCALE_CHANNELS.reduce((_legend, channel) => {\n const fieldOrDatumDef = getFieldOrDatumDef(encoding[channel]) as MarkPropFieldOrDatumDef;\n\n if (fieldOrDatumDef && supportLegend(channel)) {\n const legend = fieldOrDatumDef.legend;\n _legend[channel] = legend\n ? replaceExprRef(legend) // convert truthy value to object\n : legend;\n }\n\n return _legend;\n }, {});\n }\n\n public parseData() {\n this.component.data = parseData(this);\n }\n\n public parseLayoutSize() {\n parseUnitLayoutSize(this);\n }\n\n public parseSelections() {\n this.component.selection = parseUnitSelection(this, this.selection);\n }\n\n public parseMarkGroup() {\n this.component.mark = parseMarkGroups(this);\n }\n\n public parseAxesAndHeaders() {\n this.component.axes = parseUnitAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: any[]): NewSignal[] {\n return assembleTopLevelSignals(this, signals);\n }\n\n public assembleSignals(): NewSignal[] {\n return [...assembleAxisSignals(this), ...assembleUnitSelectionSignals(this, [])];\n }\n\n public assembleSelectionData(data: readonly VgData[]): VgData[] {\n return assembleUnitSelectionData(this, data);\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return assembleLayoutSignals(this);\n }\n\n public assembleMarks() {\n let marks = this.component.mark ?? [];\n\n // If this unit is part of a layer, selections should augment\n // all in concert rather than each unit individually. This\n // ensures correct interleaving of clipping and brushed marks.\n if (!this.parent || !isLayerModel(this.parent)) {\n marks = assembleUnitSelectionMarks(this, marks);\n }\n\n return marks.map(this.correctDataNames);\n }\n public assembleGroupStyle(): string | string[] {\n const {style} = this.view || {};\n if (style !== undefined) {\n return style;\n }\n if (this.encoding.x || this.encoding.y) {\n return 'cell';\n } else {\n return 'view';\n }\n }\n\n protected getMapping() {\n return this.encoding;\n }\n\n public get mark(): Mark {\n return this.markDef.type;\n }\n\n public channelHasField(channel: Channel) {\n return vlEncoding.channelHasField(this.encoding, channel);\n }\n\n public fieldDef(channel: SingleDefChannel) {\n const channelDef = this.encoding[channel];\n return getFieldDef(channelDef);\n }\n\n public typedFieldDef(channel: SingleDefChannel) {\n const fieldDef = this.fieldDef(channel);\n if (isTypedFieldDef(fieldDef)) {\n return fieldDef;\n }\n return null;\n }\n}\n","import {getSizeChannel, POSITION_SCALE_CHANNELS} from '../../channel';\nimport {isContinuousFieldOrDatumDef} from '../../channeldef';\nimport {Encoding} from '../../encoding';\nimport * as log from '../../log';\nimport {isStep, LayoutSizeMixins} from '../../spec/base';\n\nexport function initLayoutSize({encoding, size}: {encoding: Encoding; size: LayoutSizeMixins}) {\n for (const channel of POSITION_SCALE_CHANNELS) {\n const sizeType = getSizeChannel(channel);\n if (isStep(size[sizeType])) {\n if (isContinuousFieldOrDatumDef(encoding[channel])) {\n delete size[sizeType];\n log.warn(log.message.stepDropped(sizeType));\n }\n }\n }\n\n return size;\n}\n","import {Legend as VgLegend, NewSignal, SignalRef, Title as VgTitle} from 'vega';\nimport {array} from 'vega-util';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedLayerSpec} from '../spec';\nimport {keys} from '../util';\nimport {VgData, VgLayout} from '../vega.schema';\nimport {assembleAxisSignals} from './axis/assemble';\nimport {parseLayerAxes} from './axis/parse';\nimport {parseData} from './data/parse';\nimport {assembleLayoutSignals} from './layoutsize/assemble';\nimport {parseLayerLayoutSize} from './layoutsize/parse';\nimport {assembleLegends} from './legend/assemble';\nimport {Model} from './model';\nimport {assembleLayerSelectionMarks} from './selection/assemble';\nimport {UnitModel} from './unit';\n\nexport class LayerModel extends Model {\n // HACK: This should be (LayerModel | UnitModel)[], but setting the correct type leads to weird error.\n // So I'm just putting generic Model for now\n public readonly children: Model[];\n\n constructor(\n spec: NormalizedLayerSpec,\n parent: Model,\n parentGivenName: string,\n parentGivenSize: LayoutSizeMixins,\n config: Config\n ) {\n super(spec, 'layer', parent, parentGivenName, config, spec.resolve, spec.view);\n\n const layoutSize = {\n ...parentGivenSize,\n ...(spec.width ? {width: spec.width} : {}),\n ...(spec.height ? {height: spec.height} : {})\n };\n\n this.children = spec.layer.map((layer, i) => {\n if (isLayerSpec(layer)) {\n return new LayerModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n } else if (isUnitSpec(layer)) {\n return new UnitModel(layer, this, this.getName(`layer_${i}`), layoutSize, config);\n }\n\n throw new Error(log.message.invalidSpec(layer));\n });\n }\n\n public parseData() {\n this.component.data = parseData(this);\n for (const child of this.children) {\n child.parseData();\n }\n }\n\n public parseLayoutSize() {\n parseLayerLayoutSize(this);\n }\n\n public parseSelections() {\n // Merge selections up the hierarchy so that they may be referenced\n // across unit specs. Persist their definitions within each child\n // to assemble signals which remain within output Vega unit groups.\n this.component.selection = {};\n for (const child of this.children) {\n child.parseSelections();\n for (const key of keys(child.component.selection)) {\n this.component.selection[key] = child.component.selection[key];\n }\n }\n }\n\n public parseMarkGroup() {\n for (const child of this.children) {\n child.parseMarkGroup();\n }\n }\n\n public parseAxesAndHeaders() {\n parseLayerAxes(this);\n }\n\n public assembleSelectionTopLevelSignals(signals: NewSignal[]): NewSignal[] {\n return this.children.reduce((sg, child) => child.assembleSelectionTopLevelSignals(sg), signals);\n }\n\n // TODO: Support same named selections across children.\n public assembleSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleSignals());\n }, assembleAxisSignals(this));\n }\n\n public assembleLayoutSignals(): NewSignal[] {\n return this.children.reduce((signals, child) => {\n return signals.concat(child.assembleLayoutSignals());\n }, assembleLayoutSignals(this));\n }\n\n public assembleSelectionData(data: readonly VgData[]): readonly VgData[] {\n return this.children.reduce((db, child) => child.assembleSelectionData(db), data);\n }\n\n public assembleGroupStyle(): string | string[] {\n const uniqueStyles = new Set();\n for (const child of this.children) {\n for (const style of array(child.assembleGroupStyle())) {\n uniqueStyles.add(style);\n }\n }\n const styles = Array.from(uniqueStyles);\n return styles.length > 1 ? styles : styles.length === 1 ? styles[0] : undefined;\n }\n\n public assembleTitle(): VgTitle {\n let title = super.assembleTitle();\n if (title) {\n return title;\n }\n // If title does not provide layer, look into children\n for (const child of this.children) {\n title = child.assembleTitle();\n if (title) {\n return title;\n }\n }\n return undefined;\n }\n\n public assembleLayout(): VgLayout {\n return null;\n }\n\n public assembleMarks(): any[] {\n return assembleLayerSelectionMarks(\n this,\n this.children.flatMap(child => {\n return child.assembleMarks();\n })\n );\n }\n\n public assembleLegends(): VgLegend[] {\n return this.children.reduce((legends, child) => {\n return legends.concat(child.assembleLegends());\n }, assembleLegends(this));\n }\n}\n","import type {SignalRef} from 'vega';\nimport {Config} from '../config';\nimport * as log from '../log';\nimport {isAnyConcatSpec, isFacetSpec, isLayerSpec, isUnitSpec, LayoutSizeMixins, NormalizedSpec} from '../spec';\nimport {ConcatModel} from './concat';\nimport {FacetModel} from './facet';\nimport {LayerModel} from './layer';\nimport {Model} from './model';\nimport {UnitModel} from './unit';\n\nexport function buildModel(\n spec: NormalizedSpec,\n parent: Model,\n parentGivenName: string,\n unitSize: LayoutSizeMixins,\n config: Config\n): Model {\n if (isFacetSpec(spec)) {\n return new FacetModel(spec, parent, parentGivenName, config);\n } else if (isLayerSpec(spec)) {\n return new LayerModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isUnitSpec(spec)) {\n return new UnitModel(spec, parent, parentGivenName, unitSize, config);\n } else if (isAnyConcatSpec(spec)) {\n return new ConcatModel(spec, parent, parentGivenName, config);\n }\n throw new Error(log.message.invalidSpec(spec));\n}\n","import pkg from '../package.json';\nexport const version = pkg.version;\n\nexport {compile} from './compile/compile';\nexport type {Config} from './config';\nexport {normalize} from './normalize';\nexport type {TopLevelSpec} from './spec';\nexport * from './util';\n","import {AutoSizeType, LoggerInterface, Spec as VgSpec} from 'vega';\nimport {isString, mergeConfig} from 'vega-util';\nimport {getPositionScaleChannel} from '../channel';\nimport * as vlFieldDef from '../channeldef';\nimport {Config, initConfig, stripAndRedirectConfig} from '../config';\nimport * as log from '../log';\nimport {normalize} from '../normalize';\nimport {assembleParameterSignals} from '../parameter';\nimport {LayoutSizeMixins, TopLevel, TopLevelSpec} from '../spec';\nimport {\n AutoSizeParams,\n Datasets,\n extractTopLevelProperties,\n getFitType,\n isFitType,\n TopLevelProperties\n} from '../spec/toplevel';\nimport {Dict, keys} from '../util';\nimport {buildModel} from './buildmodel';\nimport {assembleRootData} from './data/assemble';\nimport {optimizeDataflow} from './data/optimize';\nimport {Model} from './model';\n\nexport interface CompileOptions {\n /**\n * Sets a Vega-Lite configuration.\n */\n config?: Config;\n\n /**\n * Sets a custom logger.\n */\n logger?: LoggerInterface;\n\n /**\n * Sets a field title formatter.\n */\n fieldTitle?: vlFieldDef.FieldTitleFormatter;\n}\n\n/**\n * Vega-Lite's main function, for compiling Vega-Lite spec into Vega spec.\n *\n * At a high-level, we make the following transformations in different phases:\n *\n * Input spec\n * |\n * | (Normalization)\n * v\n * Normalized Spec (Row/Column channels in single-view specs becomes faceted specs, composite marks becomes layered specs.)\n * |\n * | (Build Model)\n * v\n * A model tree of the spec\n * |\n * | (Parse)\n * v\n * A model tree with parsed components (intermediate structure of visualization primitives in a format that can be easily merged)\n * |\n * | (Optimize)\n * v\n * A model tree with parsed components with the data component optimized\n * |\n * | (Assemble)\n * v\n * Vega spec\n *\n * @param inputSpec The Vega-Lite specification.\n * @param opt Optional arguments passed to the Vega-Lite compiler.\n * @returns An object containing the compiled Vega spec and normalized Vega-Lite spec.\n */\nexport function compile(inputSpec: TopLevelSpec, opt: CompileOptions = {}) {\n // 0. Augment opt with default opts\n if (opt.logger) {\n // set the singleton logger to the provided logger\n log.set(opt.logger);\n }\n\n if (opt.fieldTitle) {\n // set the singleton field title formatter\n vlFieldDef.setTitleFormatter(opt.fieldTitle);\n }\n\n try {\n // 1. Initialize config by deep merging default config with the config provided via option and the input spec.\n const config = initConfig(mergeConfig(opt.config, inputSpec.config));\n\n // 2. Normalize: Convert input spec -> normalized spec\n\n // - Decompose all extended unit specs into composition of unit spec. For example, a box plot get expanded into multiple layers of bars, ticks, and rules. The shorthand row/column channel is also expanded to a facet spec.\n // - Normalize autosize and width or height spec\n const spec = normalize(inputSpec, config);\n\n // 3. Build Model: normalized spec -> Model (a tree structure)\n\n // This phases instantiates the models with default config by doing a top-down traversal. This allows us to pass properties that child models derive from their parents via their constructors.\n // See the abstract `Model` class and its children (UnitModel, LayerModel, FacetModel, ConcatModel) for different types of models.\n const model: Model = buildModel(spec, null, '', undefined, config);\n\n // 4 Parse: Model --> Model with components\n\n // Note that components = intermediate representations that are equivalent to Vega specs.\n // We need these intermediate representation because we need to merge many visualization \"components\" like projections, scales, axes, and legends.\n // We will later convert these components into actual Vega specs in the assemble phase.\n\n // In this phase, we do a bottom-up traversal over the whole tree to\n // parse for each type of components once (e.g., data, layout, mark, scale).\n // By doing bottom-up traversal, we start parsing components of unit specs and\n // then merge child components of parent composite specs.\n //\n // Please see inside model.parse() for order of different components parsed.\n model.parse();\n\n // drawDataflow(model.component.data.sources);\n\n // 5. Optimize the dataflow. This will modify the data component of the model.\n optimizeDataflow(model.component.data, model);\n\n // drawDataflow(model.component.data.sources);\n\n // 6. Assemble: convert model components --> Vega Spec.\n const vgSpec = assembleTopLevelModel(\n model,\n getTopLevelProperties(inputSpec, spec.autosize, config, model),\n inputSpec.datasets,\n inputSpec.usermeta\n );\n\n return {\n spec: vgSpec,\n normalized: spec\n };\n } finally {\n // Reset the singleton logger if a logger is provided\n if (opt.logger) {\n log.reset();\n }\n // Reset the singleton field title formatter if provided\n if (opt.fieldTitle) {\n vlFieldDef.resetTitleFormatter();\n }\n }\n}\n\nfunction getTopLevelProperties(\n inputSpec: TopLevel,\n autosize: AutoSizeType | AutoSizeParams,\n config: Config,\n model: Model\n) {\n const width = model.component.layoutSize.get('width');\n const height = model.component.layoutSize.get('height');\n if (autosize === undefined) {\n autosize = {type: 'pad'};\n if (model.hasAxisOrientSignalRef()) {\n autosize.resize = true;\n }\n } else if (isString(autosize)) {\n autosize = {type: autosize};\n }\n if (width && height && isFitType(autosize.type)) {\n if (width === 'step' && height === 'step') {\n log.warn(log.message.droppingFit());\n autosize.type = 'pad';\n } else if (width === 'step' || height === 'step') {\n // effectively XOR, because else if\n\n // get step dimension\n const sizeType = width === 'step' ? 'width' : 'height';\n // log that we're dropping fit for respective channel\n log.warn(log.message.droppingFit(getPositionScaleChannel(sizeType)));\n\n // setting type to inverse fit (so if we dropped fit-x, type is now fit-y)\n const inverseSizeType = sizeType === 'width' ? 'height' : 'width';\n autosize.type = getFitType(inverseSizeType);\n }\n }\n\n return {\n ...(keys(autosize).length === 1 && autosize.type\n ? autosize.type === 'pad'\n ? {}\n : {autosize: autosize.type}\n : {autosize}),\n ...extractTopLevelProperties(config, false),\n ...extractTopLevelProperties(inputSpec, true)\n };\n}\n\n/*\n * Assemble the top-level model to a Vega spec.\n *\n * Note: this couldn't be `model.assemble()` since the top-level model\n * needs some special treatment to generate top-level properties.\n */\nfunction assembleTopLevelModel(\n model: Model,\n topLevelProperties: TopLevelProperties & LayoutSizeMixins,\n datasets: Datasets = {},\n usermeta: Dict\n): VgSpec {\n // Config with Vega-Lite only config removed.\n const vgConfig = model.config ? stripAndRedirectConfig(model.config) : undefined;\n\n const data = [].concat(\n model.assembleSelectionData([]),\n // only assemble data in the root\n assembleRootData(model.component.data, datasets)\n );\n\n const projections = model.assembleProjections();\n const title = model.assembleTitle();\n const style = model.assembleGroupStyle();\n const encodeEntry = model.assembleGroupEncodeEntry(true);\n\n let layoutSignals = model.assembleLayoutSignals();\n\n // move width and height signals with values to top level\n layoutSignals = layoutSignals.filter(signal => {\n if ((signal.name === 'width' || signal.name === 'height') && signal.value !== undefined) {\n topLevelProperties[signal.name] = +signal.value;\n return false;\n }\n return true;\n });\n\n const {params, ...otherTopLevelProps} = topLevelProperties;\n\n return {\n $schema: 'https://vega.github.io/schema/vega/v5.json',\n ...(model.description ? {description: model.description} : {}),\n ...otherTopLevelProps,\n ...(title ? {title} : {}),\n ...(style ? {style} : {}),\n ...(encodeEntry ? {encode: {update: encodeEntry}} : {}),\n data,\n ...(projections.length > 0 ? {projections} : {}),\n ...model.assembleGroup([\n ...layoutSignals,\n ...model.assembleSelectionTopLevelSignals([]),\n ...assembleParameterSignals(params)\n ]),\n ...(vgConfig ? {config: vgConfig} : {}),\n ...(usermeta ? {usermeta} : {})\n };\n}\n"],"names":["isLogicalOr","op","or","isLogicalAnd","and","isLogicalNot","not","forEachLeaf","fn","subop","normalizeLogicalComposition","normalizer","map","o","duplicate","structuredClone","never","message","Error","pick","obj","props","copy","prop","hasOwnProperty","omit","hash","a","isNumber","str","isString","stringify","length","h","i","charCodeAt","isNullOrFalse","x","contains","array","item","includes","some","arr","f","k","entries","every","mergeDeep","dest","_len","arguments","src","Array","_key","s","deepMerge_","property","keys","writeConfig","unique","values","results","u","v","val","push","setEqual","b","size","e","has","hasIntersection","key","prefixGenerator","prefixes","Set","wrappedWithAccessors","splitAccessPath","y","computedPrefixes","_","slice","join","add","fieldIntersection","undefined","isEmpty","prototype","this","Object","vals","isBoolean","varName","alphanumericS","replace","match","logicalExpr","cb","deleteNestedProperty","orderedProps","shift","titleCase","charAt","toUpperCase","substr","accessPathWithDatum","path","datum","pieces","prefix","stringValue","flatAccessWithDatum","escapePathAccess","string","replacePathInField","replaceAll","find","replacement","RegExp","removePathFromField","accessPathDepth","getFirstDefined","_len2","args","_key2","arg","idCounter","uniqueId","id","String","internalField","name","isInternalField","startsWith","normalizeAngle","angle","isNumeric","value","isNaN","parseFloat","clonedProto","getPrototypeOf","deepEqual","constructor","isArray","Map","get","ArrayBuffer","isView","source","flags","valueOf","toString","ks","call","data","seen","_stringify","node","toJSON","isFinite","JSON","out","TypeError","seenIndex","sort","splice","ROW","COLUMN","FACET","X","Y","X2","Y2","XOFFSET","YOFFSET","RADIUS","RADIUS2","THETA","THETA2","LATITUDE","LONGITUDE","LATITUDE2","LONGITUDE2","COLOR","FILL","STROKE","SHAPE","SIZE","ANGLE","OPACITY","FILLOPACITY","STROKEOPACITY","STROKEWIDTH","STROKEDASH","TEXT","ORDER","DETAIL","KEY","TOOLTIP","HREF","URL","DESCRIPTION","POLAR_POSITION_CHANNEL_INDEX","theta","theta2","radius","radius2","isPolarPositionChannel","c","GEO_POSIITON_CHANNEL_INDEX","longitude","longitude2","latitude","latitude2","getPositionChannelFromLatLong","channel","isGeoPositionChannel","GEOPOSITION_CHANNELS","UNIT_CHANNEL_INDEX","x2","y2","xOffset","yOffset","color","fill","stroke","opacity","fillOpacity","strokeOpacity","strokeWidth","strokeDash","shape","order","text","detail","tooltip","href","url","description","isColorChannel","FACET_CHANNEL_INDEX","row","column","facet","FACET_CHANNELS","CHANNEL_INDEX","CHANNELS","_o","_d","_tt1","SINGLE_DEF_CHANNEL_INDEX","_r","_c","_f","SINGLE_DEF_UNIT_CHANNEL_INDEX","isChannel","SECONDARY_RANGE_CHANNEL","isSecondaryRangeChannel","getMainRangeChannel","getVgPositionChannel","getSecondaryRangeChannel","getSizeChannel","getOffsetChannel","getOffsetScaleChannel","getMainChannelFromOffsetChannel","UNIT_CHANNELS","_x","_y","_x2","_y2","_xo","_yo","_latitude","_longitude","_latitude2","_longitude2","_theta","_theta2","_radius","_radius2","NONPOSITION_CHANNEL_INDEX","NONPOSITION_CHANNELS","POSITION_SCALE_CHANNEL_INDEX","POSITION_SCALE_CHANNELS","isXorY","POLAR_POSITION_SCALE_CHANNEL_INDEX","POLAR_POSITION_SCALE_CHANNELS","getPositionScaleChannel","sizeType","OFFSET_SCALE_CHANNEL_INDEX","isXorYOffset","_t","_tt","_hr","_u","_al","_dd","_k","_oo","NONPOSITION_SCALE_CHANNEL_INDEX","NONPOSITION_SCALE_CHANNELS","SCALE_CHANNEL_INDEX","SCALE_CHANNELS","isScaleChannel","supportMark","mark","ALL_MARKS","ALL_MARKS_EXCEPT_GEOSHAPE","area","bar","image","rect","rule","circle","point","square","tick","line","trail","geoshape","arc","getSupportedMark","_g","rangeType","AGGREGATE_OP_INDEX","argmax","argmin","average","count","distinct","product","max","mean","median","min","missing","q1","q3","ci0","ci1","stderr","stdev","stdevp","sum","valid","variance","variancep","MULTIDOMAIN_SORT_OP_INDEX","isArgminDef","isArgmaxDef","isAggregateOp","COUNTING_OPS","isCountingAggregateOp","aggregate","SUM_OPS","SHARED_DOMAIN_OPS","binToString","bin","normalizeBin","p","isParameterExtent","isBinning","isBinParams","binned","isBinned","isObject","extent","autoMaxBins","isExprRef","expr","replaceExprRef","index","newIndex","signalRefOrValue","extractTitleConfig","titleConfig","anchor","frame","offset","orient","limit","subtitleColor","subtitleFont","subtitleFontSize","subtitleFontStyle","subtitleFontWeight","subtitleLineHeight","subtitlePadding","rest","nonMarkTitleProperties","subtitle","titleMarkConfig","subtitleMarkConfig","isText","isSignalRef","signal","isVgRangeStep","range","isDataRefDomain","domain","VG_MARK_CONFIGS","aria","ariaRole","ariaRoleDescription","blend","strokeCap","strokeDashOffset","strokeJoin","strokeOffset","strokeMiterLimit","startAngle","endAngle","padAngle","innerRadius","outerRadius","interpolate","tension","align","baseline","dir","dx","dy","ellipsis","font","fontSize","fontWeight","fontStyle","lineBreak","lineHeight","cursor","cornerRadius","cornerRadiusTopLeft","cornerRadiusTopRight","cornerRadiusBottomLeft","cornerRadiusBottomRight","aspect","width","height","smooth","VG_MARK_INDEX","group","symbol","VG_CORNERRADIUS_CHANNELS","signalOrValueRefWithCondition","condition","conditionalSignalRefOrValue","signalOrValueRef","exprFromValueRefOrSignalRef","ref","signalOrStringValue","applyMarkConfig","model","propsList","getMarkConfig","markDef","config","getStyles","concat","type","style","getMarkPropOrConfig","opt","vgChannel","ignoreVgConfig","getMarkStyleConfig","styleConfigIndex","getStyleConfig","styles","styleConfig","sortParams","orderDef","fieldRefOption","reduce","orderChannelDef","field","vgField","mergeTitleFieldDefs","f1","f2","merged","forEach","fdToMerge","fieldDef1","mergeTitle","title1","title2","mergeTitleComponent","v1","v2","v1Val","v2Val","explicit","invalidSpec","spec","FIT_NON_SINGLE","containerSizeNonSingle","containerSizeNotCompatibleWithAutosize","droppingFit","unknownField","cannotProjectOnChannelWithoutField","cannotProjectAggregate","selectionNotSupported","NEEDS_SAME_SELECTION","columnsNotSupportByRowCol","differentParse","local","ancestor","customFormatTypeNotAllowed","offsetNestedInsideContinuousPositionScaleDropped","mainChannel","invalidFieldType","droppingColor","emptyFieldDef","fieldDef","incompatibleChannel","markOrFacet","when","channelShouldBeDiscrete","channelShouldBeDiscreteOrDiscretizing","discreteChannelCannotEncode","unaggregateDomainHasNoEffectForRawField","unaggregateDomainWithNonSharedDomainOp","unaggregatedDomainWithLogScale","scalePropertyNotWorkWithScaleType","scaleType","propName","stepDropped","MORE_THAN_ONE_SORT","invalidTimeUnit","unitName","errorBand1DNotSupport","channelRequiredForBinned","main","logger","Warn","current","warn","isDateTime","part","TIMEUNIT_PARTS","MONTHS","SHORT_MONTHS","m","DAYS","SHORT_DAYS","d","dateTimeParts","normalize","parts","day","log","year","month","lowerM","toLowerCase","monthIndex","indexOf","shortM","shortMonthIndex","normalizeMonth","quarter","q","normalizeQuarter","date","lowerD","dayIndex","shortD","shortDayIndex","normalizeDay","timeUnit","unit","dateTimeToExpr","utc","LOCAL_SINGLE_TIMEUNIT_INDEX","week","dayofyear","hours","minutes","seconds","milliseconds","isBinnedTimeUnit","isBinnedTimeUnitString","isUTCTimeUnit","t","VEGALITE_TIMEFORMAT","getTimeUnitParts","filter","containsTimeUnit","getSmallestTimeUnitPart","fullTimeUnit","fieldExpr","end","fieldRef","lastTimeUnit","dateExpr","dateTimeExprToExpr","timeUnitSpecifierExpression","normalizeTimeUnit","params","substring","durationExpr","wrap","normalizedTimeUnit","smallestUnitPart","startDate","step","getDateTimePartAndStep","DATE_PARTS","isDatePart","isFieldEqualPredicate","predicate","equal","isFieldLTPredicate","lt","isFieldLTEPredicate","lte","isFieldGTPredicate","gt","isFieldGTEPredicate","gte","isFieldRangePredicate","isFieldOneOfPredicate","oneOf","in","isFieldPredicate","predicateValueExpr","valueExpr","wrapTime","fieldFilterExpression","useInRange","rawFieldExpr","timeUnitFieldExpr","predicateValuesExpr","isFieldValidPredicate","fieldValidPredicate","lower","upper","exprs","normalizePredicate","isContinuous","isDiscrete","QUANTITATIVE","ORDINAL","TEMPORAL","NOMINAL","GEOJSON","ScaleType","LINEAR","LOG","POW","SQRT","SYMLOG","IDENTITY","SEQUENTIAL","TIME","UTC","QUANTILE","QUANTIZE","THRESHOLD","BIN_ORDINAL","POINT","BAND","SCALE_CATEGORY_INDEX","linear","pow","sqrt","symlog","identity","sequential","time","ordinal","band","quantile","quantize","threshold","scaleCompatible","scaleType1","scaleType2","scaleCategory1","scaleCategory2","SCALE_PRECEDENCE_INDEX","scaleTypePrecedence","QUANTITATIVE_SCALES","CONTINUOUS_TO_CONTINUOUS_SCALES","isQuantitative","CONTINUOUS_TO_DISCRETE_SCALES","CONTINUOUS_DOMAIN_SCALES","DISCRETE_DOMAIN_SCALES","hasDiscreteDomain","hasContinuousDomain","isContinuousToContinuous","isContinuousToDiscrete","isParameterDomain","rangeMax","rangeMin","scheme","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTY_INDEX","domainMax","domainMin","domainMid","domainRaw","bins","reverse","round","clamp","nice","base","exponent","constant","zero","padding","paddingInner","paddingOuter","NON_TYPE_DOMAIN_RANGE_VEGA_SCALE_PROPERTIES","scaleTypeSupportProperty","channelScalePropertyIncompatability","Mark","ARC","AREA","BAR","IMAGE","LINE","RECT","RULE","TICK","TRAIL","CIRCLE","SQUARE","GEOSHAPE","isPathMark","isRectBasedMark","PRIMITIVE_MARKS","isMarkDef","FILL_STROKE_CONFIG","VL_ONLY_MARK_CONFIG_PROPERTIES","filled","invalid","timeUnitBandSize","timeUnitBandPosition","MARK_CONFIGS","isRelativeBandSize","BAR_CORNER_RADIUS_INDEX","horizontal","vertical","defaultBarConfig","binSpacing","continuousBandSize","minBandSize","defaultRectConfig","midPointRefWithPositionInvalidTest","channelDef","scale","midPoint","isFieldDef","_ref","fieldInvalidTestValueRef","wrapPositionInvalidTest","test","fieldInvalidPredicate","valueRefForFieldOrDatumDef","scaleName","encode","isDatumDef","interpolatedSignalRef","_ref2","fieldOrDatumDef","fieldOrDatumDef2","startSuffix","endSuffix","bandPosition","start","suffix","_ref4","channel2Def","stack","defaultRef","isFieldOrDatumDef","isTypedFieldDef","getBandPosition","fieldDef2","impute","binSuffix","binRequiresRange","isValueDef","offsetMixins","widthHeightValueOrSignalRef","isFunction","isCustomFormatType","formatType","customFormatExpr","format","BIN_RANGE_DELIMITER","formatSignalRef","normalizeStack","formatCustomType","fieldToFormat","channelDefType","customFormatTypes","normalizedNumberFormatType","normalizedNumberFormat","numberFormatType","numberFormat","timeFormatType","timeFormat","isFieldOrDatumDefForTimeFormat","_ref5","rawTimeFormat","isUTCScale","formatExpression","timeFormatExpression","isScaleFieldDef","specifiedFormat","binFormatExpression","formatExpr","datumDef","datumDefToExpr","guideFormat","omitTimeFormatConfig","isPositionFieldOrDatumDef","guideFormatType","_ref3","binNumberFormatExpr","startField","endField","DEFAULT_SORT_OP","SORT_BY_CHANNEL_INDEX","isSortByChannel","isSortByEncoding","isSortField","isSortArray","isFacetMapping","isFacetFieldDef","isFacetSpec","toFieldDefBase","isSortableFieldDef","getBandSize","useVlSizeChannel","sizeChannel","discreteBandSize","hasBandEnd","isOrderOnlyDef","isConditionalDef","hasConditionalFieldDef","hasConditionalFieldOrDatumDef","isContinuousFieldOrDatumDef","cd","isNumericDataDef","isUnbinnedQuantitativeFieldOrDatumDef","isMarkPropFieldOrDatumDef","isStringFieldOrDatumDef","toStringFieldDef","argAccessor","isCount","nofn","isOpFieldDef","tu","timeUnitToString","forAs","def","defaultTitleFormatter","fieldTitle","timeUnitParams","maxbins","functionalTitleFormatter","countTitle","verbalTitleFormatter","titleFormatter","setTitleFormatter","formatter","title","allowDisabling","includeDefault","guideTitle","getGuide","defaultTitle","axis","legend","header","getFormatMixins","guide","getFieldDef","getFieldOrDatumDef","initChannelDef","initFieldOrDatumDef","fd","guideType","newGuide","initFieldDef","initDatumDef","compositeMark","fullType","getFullName","newType","defaultType","compatible","warning","COMPATIBLE","channelCompatibility","encoding","sub","labelOrient","titleOrient","undefinedIfExprNotRequired","isTime","isLocalSingleTimeUnit","Date","parse","valueArray","console","CONDITIONAL_AXIS_PROP_INDEX","labelAlign","vgProp","labelBaseline","labelColor","labelFont","labelFontSize","labelFontStyle","labelFontWeight","labelOpacity","labelOffset","labelPadding","gridColor","gridDash","gridDashOffset","gridOpacity","gridWidth","tickColor","tickDash","tickDashOffset","tickOpacity","tickSize","tickWidth","isConditionalAxisValue","AXIS_PARTS","AXIS_PROPERTY_TYPE","grid","gridCap","gridScale","domainCap","domainColor","domainDash","domainDashOffset","domainOpacity","domainWidth","labelAngle","labelBound","labelFlush","labelFlushOffset","labelLimit","labelLineHeight","labelOverlap","labels","labelSeparation","maxExtent","minExtent","position","tickCap","tickMinStep","tickOffset","tickRound","ticks","titleAlign","titleAnchor","titleAngle","titleBaseline","titleColor","titleFont","titleFontSize","titleFontStyle","titleFontWeight","titleLimit","titleLineHeight","titleOpacity","titlePadding","titleX","titleY","tickBand","tickCount","tickExtra","translate","zindex","COMMON_AXIS_PROPERTIES_INDEX","AXIS_PROPERTIES_INDEX","labelExpr","isAxisProperty","AXIS_CONFIGS","axisBand","axisBottom","axisDiscrete","axisLeft","axisPoint","axisQuantitative","axisRight","axisTemporal","axisTop","axisX","axisXBand","axisXDiscrete","axisXPoint","axisXQuantitative","axisXTemporal","axisY","axisYBand","axisYDiscrete","axisYPoint","axisYQuantitative","axisYTemporal","isUnitSpec","CompositeMarkNormalizer","run","hasMatchingType","channelHasField","channelHasFieldOrDatum","channelHasNestedOffsetScale","isAggregate","extractTransformsFromEncoding","oldEncoding","groupby","timeUnits","aggOp","remaining","isTitleDefined","newField","newFieldDef","aggregateEntry","as","secondaryChannel","isNonPositionScaleChannel","markChannelCompatible","markSupported","primaryFieldDef","normalizeEncoding","normalizedEncoding","newChannelDef","mapping","thisArg","el","pathGroupingFields","details","getCompositeMarkTooltip","tooltipSummary","continuousAxisChannelDef","encodingWithoutContinuousAxis","withFieldName","fieldPrefix","titlePrefix","mainTitle","getTitle","escape","channelDefArray","fieldDefs","makeCompositeAggregatePartFactory","compositeMarkDef","continuousAxis","sharedEncoding","compositeMarkConfig","partName","positionPrefix","endPositionPrefix","extraEncoding","partLayerMixins","partBaseSpec","clip","compositeMarkContinuousAxis","continuousAxisChannelDef2","continuousAxisChannelDefError","continuousAxisChannelDefError2","filterAggregateFromChannelDef","continuousAxisWithoutAggregate","compositeMarkOrient","xAggregate","yAggregate","BOXPLOT","boxPlotNormalizer","normalizeBoxPlot","getBoxPlotType","_encoding","projection","_p","outerSpec","boxplot","sizeValue","boxPlotType","transform","ticksOrient","boxOrient","customTooltipWithoutAggregatedField","continuousFieldName","boxplotSpecificAggregate","boxParamsQuartiles","postAggregateCalculates","calculate","oldContinuousAxisChannelDef","oldEncodingWithoutContinuousAxis","filteredEncoding","customTooltipWithAggregatedField","filterTooltipWithAggregatedField","boxParams","encodingWithoutSizeColorAndContinuousAxis","makeBoxPlotPart","makeBoxPlotExtent","makeBoxPlotBox","makeBoxPlotMidTick","fiveSummaryTooltipEncoding","endTick","whiskerTooltipEncoding","whiskerLayers","boxLayers","layer","lowerBoxExpr","upperBoxExpr","iqrExpr","lowerWhiskerExpr","upperWhiskerExpr","joinaggregateTransform","joinaggregate","filteredWhiskerSpec","encodingWithoutSizeColorContinuousAxisAndTooltip","axisWithoutTitle","outlierLayersMixins","filteredLayersMixins","filteredLayersMixinsTransforms","unshift","continousAxisField","ERRORBAR","errorBarNormalizer","normalizeErrorBar","tooltipEncoding","errorBarParams","makeErrorBarPart","errorbar","thickness","errorBarOrientAndInputType","xError","xError2","yError","yError2","errorBarIsInputTypeRaw","inputType","isTypeAggregatedUpperLower","errorBarIsInputTypeAggregatedUpperLower","isTypeAggregatedError","errorBarIsInputTypeAggregatedError","errorBarSpecificAggregate","tooltipTitleWithFieldName","center","getTitlePrefix","centerOp","lowerExtentOp","upperExtentOp","postAggregateCalculate","errorBarAggregationAndCalculation","oldContinuousAxisChannelDef2","oldContinuousAxisChannelDefError","oldContinuousAxisChannelDefError2","oldAggregate","oldGroupBy","operation","ERRORBAND","errorBandNormalizer","normalizeErrorBand","errorBandDef","makeErrorBandPart","errorband","is2D","bandMark","bordersMark","compositeMarkRegistry","VL_ONLY_LEGEND_CONFIG","HEADER_TITLE_PROPERTIES_MAP","HEADER_LABEL_PROPERTIES_MAP","labelAnchor","HEADER_TITLE_PROPERTIES","HEADER_LABEL_PROPERTIES","HEADER_CONFIGS","headerRow","headerColumn","headerFacet","LEGEND_SCALE_CHANNELS","SELECTION_ID","defaultConfig","on","fields","toggle","resolve","clear","interval","encodings","zoom","isLegendBinding","bind","isLegendStreamBinding","isSelectionParameter","param","assembleParameterSignals","signals","init","update","isConcatSpec","isVConcatSpec","isHConcatSpec","getStepFor","offsetIsDiscrete","for","isStep","isFrameMixins","COMPOSITION_LAYOUT_PROPERTIES","bounds","columns","spacing","getViewConfigContinuousSize","viewConfig","getViewConfigDiscreteStep","getViewConfigDiscreteSize","DEFAULT_STEP","background","view","continuousWidth","continuousHeight","box","outliers","borders","pointPadding","barBandPaddingInner","rectBandPaddingInner","bandWithNestedOffsetPaddingInner","bandWithNestedOffsetPaddingOuter","minFontSize","maxFontSize","minOpacity","maxOpacity","minSize","minStrokeWidth","maxStrokeWidth","quantileCount","quantizeCount","gradientHorizontalMaxLength","gradientHorizontalMinLength","gradientVerticalMaxLength","gradientVerticalMinLength","unselectedOpacity","selection","defaultSelectionConfig","tab10","DEFAULT_FONT_SIZE","guideLabel","groupTitle","groupSubtitle","DEFAULT_COLOR","blue","orange","red","teal","green","yellow","purple","pink","brown","gray0","gray1","gray2","gray3","gray4","gray5","gray6","gray7","gray8","gray9","gray10","gray11","gray12","gray13","gray14","gray15","getAxisConfigInternal","axisConfig","axisConfigInternal","configPropsWithExpr","initConfig","specifiedConfig","restConfig","mergedConfig","mergeConfig","fontConfig","cell","category","colorSignalConfig","fontSizeSignalConfig","outputConfig","markConfigType","axisConfigType","headerConfigType","styleConfigInternal","getStyleConfigInternal","MARK_STYLES","VL_ONLY_CONFIG_PROPERTIES","VL_ONLY_ALL_MARK_SPECIFIC_CONFIG_PROPERTY_INDEX","stripAndRedirectConfig","markType","vlOnlyMarkSpecificConfigs","redirectConfigToStyleConfig","redirectTitleConfig","toProp","compositeMarkPart","isLayerSpec","SpecMapper","mapFacet","isRepeatSpec","mapRepeat","mapHConcat","mapVConcat","mapConcat","mapLayerOrUnit","mapLayer","mapUnit","subspec","hconcat","vconcat","STACK_OFFSET_INDEX","STACKABLE_MARKS","STACK_BY_DEFAULT_MARKS","isUnbinnedQuantitative","potentialStackedChannel","isCartesian","xDef","yDef","fieldChannel","stackedFieldDef","stackedField","dimensionChannel","getDimensionChannel","groupbyChannels","groupbyFields","dimensionDef","dimensionField","dimensionOffsetChannel","dimensionOffsetDef","dimensionOffsetField","stackBy","sc","cDef","initMarkdef","originalMarkDef","specifiedOrient","xIsMeasure","yIsMeasure","xIsTemporal","yIsTemporal","cornerRadiusEnd","newProps","BAR_CORNER_RADIUS_END_INDEX","newProp","dropLineAndPoint","_point","_line","dropLineAndPointFromConfig","getPointOverlay","markConfig","getLineOverlay","PathOverlayNormalizer","_defineProperty","normParams","pointOverlay","lineOverlay","stackProps","overlayEncoding","stackFieldChannel","replaceRepeaterInFacet","repeater","replaceRepeaterInMapping","replaceRepeaterInFieldDef","replaceRepeaterInEncoding","replaceRepeatInProp","repeat","replaceRepeaterInFieldOrDatumDef","replaceRepeaterInChannelDef","channelDefWithoutCondition","RuleForRangedLineNormalizer","mainChannelDef","hasX2","hasY2","mergeEncoding","parentEncoding","channels","parentChannelDef","mergedChannelDef","mergeProjection","parentProjection","isFilter","isLookup","isPivot","isDensity","isQuantile","isRegression","isLoess","isSample","isWindow","isJoinAggregate","isFlatten","isCalculate","isBin","isImpute","isTimeUnit","isStack","isFold","isExtent","normalizeTransforms","tx","normalizeBinExtent","from","normalizeChannelDef","enc","cond","ext","normalizeSelectionComposition","pred","empty","emptySelections","selectionPredicates","TopLevelSelectionsNormalizer","selections","super","views","method","proto","addSpecNameToParams","normalizedSpec","topLevelSelectionNormalizer","coreNormalizer","selectionCompatNormalizer","normalizeGenericSpec","autosize","sizeInfo","isFitCompatible","autosizeDefault","_normalizeAutoSize","normalizeAutoSize","hasRow","hasColumn","hasFacet","mapFacetedUnit","specWithReplacedEncoding","repeaterPrefix","n","mapUnitWithParentEncodingOrProjection","normalizeLayerOrUnit","unitNormalizer","nonFacetUnitNormalizers","isLayerRepeatSpec","mapLayerRepeat","mapNonLayerRepeat","childSpec","layerValue","childRepeater","childName","child","remainingProperties","repeatValues","repeatValue","rowValue","columnValue","mergedProjection","mergedEncoding","facetMapping","layout","getFacetMappingAndLayout","newEncoding","facets","defWithoutLayout","otherParams","selDef","select","TOP_LEVEL_PROPERTIES","extractTopLevelProperties","includeParams","Split","implicit","clone","combine","getWithExplicit","setWithExplicit","set","copyKeyFromSplit","copyKeyFromObject","copyAll","other","makeExplicit","makeImplicit","tieBreakByComparing","compare","propertyOf","diff","defaultTieBreaker","mergeValuesWithExplicit","tieBreaker","AncestorParse","parseNothing","isUrlData","isInlineData","isNamedData","isGenerator","isSequenceGenerator","isSphereGenerator","isGraticuleGenerator","DataSourceType","assembleProjection","proj","hasLegend","assembleInit","isExpr","assembled","dateTimeToTimestamp","assembleUnitSelectionSignals","selCmpt","component","modifyExpr","TUPLE","selectionCompilers","defined","MODIFY","events","STORE","cleanupEmptyOnArray","assembleFacetSignals","getName","parseSelector","assembleUnitSelectionMarks","marks","DataFlowNode","parent","debugName","_parent","addChild","children","_children","numChildren","loc","removeChild","oldChild","remove","insertAsParentOf","swapWithParent","newParent","OutputNode","cloneObj","_source","_name","refCounts","dependentFields","producedFields","_hash","getSource","isRequired","setSource","isTimeUnitTransformComponent","timeUnitComponent","offsetAs","TimeUnitNode","makeFromEncoding","formula","reduceFieldDef","isUnitModel","rectBandPosition","makeFromTransform","merge","removeFormulas","newFormula","fieldAs","assemble","transforms","startEnd","units","timezone","offsetedRectFormulas","escapedField","offsetExpr","endAs","OFFSETTED_RECT_START_SUFFIX","OFFSETTED_RECT_END_SUFFIX","smallestUnit","startExpr","endExpr","interpolateExpr","fraction","TUPLE_FIELDS","SelectionProjectionComponent","items","hasChannel","hasField","hasSelectionId","project","parsed","signalName","sg","counter","cfg","initVal","getScaleComponent","geoChannel","allSignals","scaleBindings","bound","scales","topLevelSignals","isTopLevelLayer","namedSg","VL_SELECTION_RESOLVE","isLayerModel","BRUSH","SCALE_TRIGGER","GEO_INIT_TICK","INIT","hasProjection","filterExpr","evt","between","filters","tupleSg","scaledInterval","vname","visual","projectionName","scaled","getSizeSignalRef","coord","von","dname","hasScales","vinit","initIdx","initSg","channelSignals","centerSg","xvname","yvname","xinit","yinit","sizeSg","bbox","visualSignals","triggerSg","scaleTriggers","toNum","dataSignals","store","vgStroke","enter","fieldsSg","brushes","acc","cmpt","force","wrapCondition","refFn","valueRef","conditionValueRef","isConditionalParameter","parseSelectionPredicate","expression","textRef","tooltipRefForEncoding","reactiveGeom","tooltipRefFromChannelDef","markTooltip","content","tooltipData","formatConfig","tooltipFormat","toSkip","tuples","fDef","channel2","keyValues","enableAria","ariaRoleDesc","descriptionValue","nonPosition","defaultValue","transparentIfNeeded","defaultFill","defaultStroke","colorVgChannel","fillStrokeMarkDefAndConfig","positionOffset","baseChannel","offsetType","markDefOffsetValue","pointPosition","defaultPos","pointPositionDefaultRef","positionRef","definedValueOrConfig","domainDefinitelyIncludesZero","mult","ALIGNED_X_CHANNEL","left","right","BASELINED_Y_CHANNEL","top","middle","bottom","vgAlignedPositionChannel","defaultAlign","alignChannel","alignExcludingSignal","pointOrRangePosition","defaultPos2","rangePosition","pos2Mixins","vgSizeChannel","position2Ref","position2orSize","pointPosition2OrSize","dimensionSize","rectPosition","channelDef2","hasSizeDef","offsetScaleChannel","isBarBand","offsetScaleName","offsetScale","sizeMixins","hasSizeFromMarkOrEncoding","bandSize","defaultSizeRef","defaultBandAlign","posRef","vgChannel2","sizeRef","sizeOffset","positionAndSize","axes","axisTranslate","offset2","bandSizeExpr","binSpacingOffset","getBinSpacing","binSpacingOffset2","bandPositionForBandSize","useRectOffsetField","rectBinRef","startRef","rectBinPosition","hasFieldDef","bandWidth","scaleRange","bandPaddingInner","isEnd","spacingOffset","reverseExpr","axisTranslateExpr","minBandSizeExpr","spacingAndSizeOffset","ALWAYS_IGNORE","baseEncodeEntry","ignore","markDefProperties","wrapAllFieldsInvalid","filterIndex","aggregator","scaleComponent","allFieldsInvalidPredicate","valueIfDefined","VORONOI","nearest","markname","cellDef","interactive","isVoronoi","exists","inputBindings","disableDirectManipulation","sgname","TOGGLE","tpl","idx","findIndex","addClear","vIdx","tIdx","legendBindings","projLen","selDef_","legendFilter","stream","selName","markName","ds","sgName","tuple","ANCHOR","DELTA","boundScales","scalesCompiler","INTERVAL_BRUSH","onDelta","delta","scaleCmpt","reversed","sx","sy","inputs","legends","facetModel","isFacetModel","getFacetModel","requiresSelectionId","identifier","object","startsWithDatum","getDependentFields","ast","parseExpression","dependents","visit","FilterNode","_dependentFields","dfnode","getSelectionComponent","raw","tunode","parseSelectionExtent","filterOp","isSelectionPredicate","setAxisEncode","vgRef","assembleAxis","axisCmpt","kind","disable","propType","propValue","valueOrSignalRef","conditions","propIndex","valueOrSignalCRef","signalRef","mainExtracted","hasAxisPart","titleString","assembleTitle","assembleAxisSignals","getAxisConfigFromConfigTypes","configTypes","assign","apply","configType","orient1","orientConfig1","orientConfig2","conditionalOrientAxisConfig","getAxisConfigStyle","axisConfigTypes","toMerge","getAxisConfig","axisConfigs","configFrom","configValue","axisRules","defaultGrid","gridChannel","_ref6","defaultLabelAlign","_ref7","_ref8","defaultLabelBaseline","_ref9","defaultLabelFlush","_ref10","hasTimeUnit","defaultLabelOverlap","_ref11","_ref12","_ref17","defaultTickCount","_ref13","_ref18","defaultTickMinStep","_ref14","fieldDefTitle","getFieldDefTitle","typedFieldDef","_ref15","_ref16","defaultZindex","normalizeAngleExpr","alwaysIncludeMiddle","isX","mainOrient","CalculateNode","parseAllForSortIndex","forEachFieldDef","sortValue","sortArrayIndexField","getHeaderChannel","getHeaderProperty","headerSpecificConfig","getHeaderProperties","properties","HEADER_CHANNELS","HEADER_TYPES","assembleTitleGroup","layoutHeaders","facetFieldDef","ta","headerChannel","role","defaultHeaderGuideBaseline","defaultHeaderGuideAlign","assembleHeaderProperties","assembleHeaderGroups","layoutHeader","groups","headerType","headerComponent","assembleHeaderGroup","getSort","assembleLabelTitle","titleTextExpr","isFacetWithoutRowCol","hasAxes","sizeSignal","LAYOUT_TITLE_BAND","getLayoutTitleBand","propertiesMap","assembleLayoutSignals","sizeSignals","layoutSize","stepSignal","sizeExpr","isWidth","endsWith","safeExpr","cardinality","getSizeTypeFromLayoutSizeType","layoutSizeType","guideEncodeEntry","valueDef","defaultScaleResolve","isConcatModel","parseGuideResolve","channelScaleResolve","LEGEND_COMPONENT_PROPERTIES","clipHeight","columnPadding","direction","fillColor","gradientLength","gradientOpacity","gradientStrokeColor","gradientStrokeWidth","gradientThickness","gridAlign","legendX","legendY","rowPadding","strokeColor","symbolDash","symbolDashOffset","symbolFillColor","symbolLimit","symbolOffset","symbolOpacity","symbolSize","symbolStrokeColor","symbolStrokeWidth","symbolType","LegendComponent","legendEncodeRules","symbols","symbolsSpec","legendCmpt","legendType","mixins","getMaxValue","symbolBaseFillColor","getFirstConditionValue","selectedCondition","gradient","gradientSpec","specifiedlabelsSpec","labelsSpec","entriesSpec","getConditionValue","conditionalDef","Math","reducer","hasConditionalValueDef","legendRules","legendConfig","gradientLengthSignal","defaultGradientLength","shapeChannelDef","markShape","defaultSymbolType","getLegendType","getDirection","defaultDirection","parseLegend","legendComponent","parseLegendForChannel","parseUnitLegend","mergeLegendComponent","parseNonUnitLegend","isExplicit","getLegendDefWithScale","legendSelections","parseInteractiveLegend","ruleParams","legendEncoding","legendEncode","legendEncodeParams","legendEncodingPart","mergedLegend","childLegend","mergedOrient","childOrient","typeMerged","mergedValueWithExplicit","mergeSymbolType","st1","st2","assembleLegends","legendComponentIndex","legendByDomain","domainHash","mergedLegendComponent","flat","l","setLegendEncode","assembleLegend","assembleProjections","projections","assembleProjectionForModel","assembleProjectionsForModelAndChildren","fits","sources","lookupDataSource","fit","PROJECTION_PROPERTIES","ProjectionComponent","specifiedProjection","isFit","parseProjection","posssiblePair","requestDataName","Main","gatherFitData","projComp","parseUnitProjection","nonUnitProjection","mergable","first","second","allPropertiesShared","mergeIfNoConflict","modelProjection","renameProjection","parseNonUnitProjections","rangeFormula","formulaAs","binKey","getBinSignalName","createBinComponent","span","isBinTransform","normalizedBin","extentSignal","getSignalsFromModel","binComponent","BinNode","binComponentIndex","renameSignal","flatMap","binAs","remainingAs","binTrans","addDimension","dims","posChannel","isFieldRange","AggregateNode","dimensions","measures","groupBy","meas","argField","scaleDomain","parentMeasures","childMeasures","ops","mergeMeasures","debug","addDimensions","alias","FacetNode","sortField","sortIndexField","childModel","depFields","getChildIndependentFieldsWithStep","childIndependentFieldsWithStep","childScaleComponent","getFieldFromDomain","assembleDomain","assembleRowColumnHeaderData","crossedDataName","childChannel","assembleFacetHeaderData","hasSharedAxis","headers","stop","facetData","unquote","pattern","getImplicitFromFilterTransform","getImplicitFromEncoding","mainFieldDef","dimensionChannelDef","ParseNode","_parse","ancestorParse","makeWithAncestors","parsedAs","assembleFormatParse","formatParse","assembleTransforms","onlyNested","IdentifierNode","GraticuleNode","SequenceNode","SourceNode","_data","defaultExtension","exec","_generator","hasName","dataName","isDataSourceNode","_modified","WeakMap","Optimizer","_classPrivateFieldInitSpec","writable","_classPrivateFieldSet","setModified","modifiedFlag","BottomUpOptimizer","getNodeDepths","depth","depths","optimize","topologicalSort","TopDownOptimizer","MergeIdenticalNodes","mergeNodes","nodes","mergedNode","hashes","buckets","RemoveUnnecessaryIdentifierNodes","RemoveDuplicateTimeUnits","timeUnitFields","RemoveUnnecessaryOutputNodes","MoveParseUp","MergeParse","originalChildren","parseChildren","commonParse","conflictingParse","parseNode","mergedParseNode","childNode","RemoveUnusedSubtrees","MergeTimeUnits","timeUnitChildren","combination","pop","MergeAggregates","aggChildren","groupedAggregates","agg","groupBys","mergeableAggs","mergedAggs","MergeBins","moveBinsUp","promotableBins","remainingBins","promotedBin","remainingBin","MergeOutputs","otherChildren","mainOutput","lastOutput","theChild","JoinAggregateTransformNode","w","getDefaultName","joinAggregateFieldDef","StackNode","_stack","stackTransform","sortFields","sortOrder","normalizedAs","isValidAsArray","dimensionFieldDefs","stackField","facetby","stackProperties","groupbyChannel","stackby","by","_field","getStackByFields","getGroupbyFields","dimensionFieldDef","binStart","binEnd","WindowTransformNode","window","windowFieldDef","ignorePeers","moveFacetDown","facetMain","moveMainDownToFacet","cloner","newName","FACET_SCALE_PREFIX","outputNodes","MAX_OPTIMIZATION_RUNS","checkLinks","runOptimizer","optimizer","modified","optimizationDataflowHelper","dataComponent","firstPass","roots","optimizers","r","SignalRefWrapper","exprGenerator","defineProperty","enumerable","fromName","rename","parseScaleDomain","localScaleComponents","util","domains","parseDomainForChannel","parseSelectionDomain","isFaceted","facetParent","parseUnitScaleDomain","selectionExtent","childComponent","domainsTieBreaker","se","parseNonUnitScaleDomain","scaleConfig","reason","canUseUnaggregatedDomain","useUnaggregatedDomain","normalizeUnaggregatedDomain","specifiedScales","parseSingleChannelDomain","convertDomainIfItIsDateTime","mapDomainToDataSignal","isDomainUnionWith","defaultDomain","unionWith","stackDimensions","normalizeSortField","fieldDefToSortBy","isStackedMeasure","domainSort","Raw","binSignal","getSignalName","isRectWithOffset","mergeDomains","uniqueDomains","_s","domainWithoutSort","sorts","filteredSorts","unionDomainSorts","UNIONDOMAIN_SORT_OP_INDEX","allData","isDataRefUnionedDomain","nonUnionDomain","isFieldRefUnionDomain","assembleScales","assembleScalesForModel","otherScaleProps","assembleScaleRange","parsedExtent","assembleSelectionScaleDomain","ScaleComponent","typeWithExplicit","RANGE_PROPERTIES","getBinStepSignal","binCount","updatedName","parseRangeForChannel","specifiedScale","supportedByScaleType","channelIncompatability","parseScheme","getPositionStep","positionChannel","getOffsetStep","mergedScaleCmpt","positionSize","getDiscretePositionSize","fullWidthOrHeightRange","offsetScaleType","positionScaleCmpt","positionScaleType","positionScaleName","positionDef","duration","bandPositionOffset","bandPositionOffsetExpr","getOffsetRange","sizeRangeMin","xyStepSignals","maxBandSize","minXYStep","maxSize","pointStep","MAX_SIZE_RANGE_STEP_RATIO","sizeRangeMax","rMax","rMin","interpolateRange","defaultContinuousToDiscreteCount","PI","defaultRange","isExtendedScheme","offsetChannel","offsetDef","offsetScaleCmpt","stepCount","widthStep","heightStep","parseScaleProperty","localScaleCmpt","specifiedValue","scalePadding","scalePaddingInner","scaleRules","hasNestedOffsetScale","hasSecondaryRangeChannel","parseUnitScaleProperty","parseNonUnitScaleProperty","specifiedDomain","barConfig","continuousPadding","paddingValue","offsetBandPaddingInner","paddingInnerValue","bandPaddingOuter","offsetBandPaddingOuter","xReverse","last","parseScaleRange","rangeWithExplicit","parseUnitScaleRange","valueWithExplicit","defaultScaleType","CHANNEL","channelSupportScaleType","specifiedType","fieldDefType","parseScaleCore","scaleComponents","sType","parseUnitScaleCore","scaleTypeWithExplicitIndex","explicitScaleType","childScaleType","scaleTypeTieBreaker","childScale","renameScale","parseNonUnitScaleCore","NameMap","nameMap","oldName","Model","parentGivenName","scaleNameMap","projectionNameMap","signalNameMap","specType","compositionConfig","spacingConfig","extractCompositionLayout","outputNodeRefCounts","parseScale","parseLayoutSize","renameTopLevelLayoutSizeSignal","parseSelections","parseData","parseAxesAndHeaders","parseLegends","parseMarkGroup","ignoreRange","parseScales","assembleEncodeFromView","baseView","assembleGroupEncodeEntry","isTopLevel","encodeEntry","assembleLayout","titleBand","headerComponentIndex","assembleLayoutTitleBand","assembleDefaultLayout","assembleHeaderMarks","headerMarks","assembleAxes","axisComponents","titleNoEncoding","assembleGroup","assembleSignals","assembleMarks","getDataName","fullName","oldSignalName","originalScaleName","localScaleComponent","variableName","origName","sel","hasAxisOrientSignalRef","hasOrientSignalRef","ModelWithField","r1","getMapping","DensityTransformNode","specifiedAs","density","result","ExtentTransformNode","FilterInvalidNode","make","vegaFilters","FlattenTransformNode","flatten","FoldTransformNode","fold","GeoJSONNode","geojson","parseAll","geoJsonCounter","coordinates","pair","GeoPointNode","ImputeNode","processSequence","keyvals","imputeTransform","imputedChannel","keyChannel","LoessTransformNode","loess","LookupNode","secondary","fromOutputNode","isLookupData","fromSource","findSource","fromOutputName","Lookup","isLookupSelection","materialized","lookup","foreign","asName","default","QuantileTransformNode","RegressionTransformNode","regression","PivotTransformNode","pivot","SampleTransformNode","sample","makeWalkTree","datasetIndex","walkTree","dataSource","getHeaderType","parseFacetHeader","makeHeaderComponent","mergeChildAxis","axisComponent","mainAxis","parseChildrenLayoutSize","parseNonUnitLayoutSizeForChannel","layoutSizeCmpt","mergedSize","childSize","scaleResolve","defaultUnitSize","facetSortFieldName","FacetModel","buildModel","initFacet","initFacetFieldDef","normalizedFacet","parseFacetHeaders","assembleSelectionTopLevelSignals","assembleSelectionData","getHeaderLayoutMixins","layoutMixins","layoutHeaderComponent","bandType","columnDistinctSignal","assembleGroupStyle","getCardinalityAggregateForChild","assembleFacet","facetRoot","outputName","cross","facetSortFields","facetSortOrder","ORTHOGONAL_ORIENT","root","assembleFacetData","otherData","formatMesh","mesh","otherFeature","feature","formatFeature","otherMesh","head","existingSource","parseRoot","sequence","graticule","parentIsLayer","lookupCounter","derivedType","transformNode","parseTransformArray","implicitSelection","getImplicitFromSelection","implicitEncoding","rawName","mainName","lookupName","materializeSelections","facetName","makeJoinAggregateFromFacet","ConcatModel","getChildren","widthType","heightType","parseConcatLayoutSize","parseAxisGroup","layoutSignals","db","AXIS_COMPONENT_PROPERTIES_INDEX","AXIS_COMPONENT_PROPERTIES","AxisComponent","OPPOSITE_ORIENT","mergeAxisComponents","mergedAxisCmpts","childAxisCmpts","mergeAxisComponent","propsToAlwaysIncludeConfig","parseAxis","defaultOrient","typeBasedConfigTypes","axisChannel","axisOrient","vlOnlyConfigTypes","vgConfigTypes","vlOnlyAxisConfig","vgAxisConfig","axisConfigStyle","getAxisConfigs","getLabelAngle","hasValue","hasConfigValue","axisEncoding","axisEncode","axisEncodingPart","specifiedLabelsSpec","fixedShape","shapeMixins","vgMark","vgThicknessChannel","defaultSize","markPropOrConfig","markCompiler","postEncodingTransform","shapeDef","parseMarkGroups","FACETED_PATH_PREFIX","getMarkGroup","fromPrefix","getPathGroups","hasCornerRadius","STACK_GROUP_PREFIX","fieldScale","stackFieldGroup","func","groupUpdate","innerGroupUpdate","groupByField","strokeForeground","getGroupsForStackedBarWithCornerRadius","xScale","yScale","scaleClip","projectionClip","unitCount","parentCount","interactiveFlag","UnitModel","parentGivenSize","filledConfig","defaultFilled","defs","initEncoding","initLayoutSize","initScales","specifiedAxes","initAxes","specifiedLegends","initLegends","isGeoShapeMark","hasGeoPosition","initScale","scaleInternal","_axis","axisSpec","initAxis","axisInternal","_legend","supportLegend","specifiedSize","parseUnitLayoutSize","selDefs","selCmpts","selectionConfig","defaults","def_","parseUnitSelection","hasSelections","isPoint","assembleTopLevelSignals","dataCopy","assembleUnitSelectionData","correctDataNames","vlEncoding","LayerModel","axisCount","oppositeOrient","parseLayerAxes","uniqueStyles","assembleLayerSelectionMarks","unitSize","isAnyConcatSpec","version","pkg","inputSpec","newLogger","vlFieldDef","firstPassCounter","secondPassCounter","optimizeDataflow","vgSpec","topLevelProperties","datasets","usermeta","vgConfig","sourceIndex","newData","whereTo","assembleRootData","otherTopLevelProps","$schema","assembleTopLevelModel","resize","autoSizeType","inverseSizeType","getFitType","getTopLevelProperties","normalized","dict","dictKeys","otherKeys"],"mappings":"+RAcO,SAASA,EAAYC,GAC1B,QAASA,EAAGC,EACd,CAEO,SAASC,EAAaF,GAC3B,QAASA,EAAGG,GACd,CAEO,SAASC,EAAaJ,GAC3B,QAASA,EAAGK,GACd,CAEO,SAASC,EAAeN,EAA2BO,GACxD,GAAIH,EAAaJ,GACfM,EAAYN,EAAGK,IAAKE,QACf,GAAIL,EAAaF,GACtB,IAAK,MAAMQ,KAASR,EAAGG,IACrBG,EAAYE,EAAOD,QAEhB,GAAIR,EAAYC,GACrB,IAAK,MAAMQ,KAASR,EAAGC,GACrBK,EAAYE,EAAOD,QAGrBA,EAAGP,EAEP,CAEO,SAASS,EACdT,EACAU,GAEA,OAAIN,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