@emuanalytics/flow-rdf-core 4.1.8 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (27) hide show
  1. package/dist/index.d.mts +322 -4
  2. package/dist/index.d.ts +322 -4
  3. package/dist/index.mjs +6 -0
  4. package/dist/lib/map/flow-core-map.mjs +120 -13
  5. package/dist/lib/map/plugins/index.d.mts +252 -223
  6. package/dist/lib/map/plugins/index.d.ts +252 -223
  7. package/dist/lib/map/plugins/selection/selection.plugin.mjs +73 -7
  8. package/dist/lib/map/plugins/selection/source-selection.mjs +12 -0
  9. package/dist/lib/map-style/composite/builder.mjs +31 -0
  10. package/dist/lib/map-style/composite/editing.mjs +123 -0
  11. package/dist/lib/map-style/composite/expand.mjs +182 -0
  12. package/dist/lib/map-style/composite/stored-format.mjs +18 -0
  13. package/dist/lib/map-style/composite/validate.mjs +376 -0
  14. package/dist/lib/map-style/flow-style/builder.mjs +97 -0
  15. package/dist/lib/map-style/flow-style/data-driven.mjs +164 -0
  16. package/dist/lib/map-style/flow-style/expand.mjs +145 -0
  17. package/dist/lib/map-style/flow-style/literals.mjs +58 -0
  18. package/dist/lib/map-style/flow-style/stored-format.mjs +93 -0
  19. package/dist/lib/map-style/flow-style/validate.mjs +117 -0
  20. package/dist/lib/map-style/flow-style/values.mjs +249 -0
  21. package/dist/lib/map-style/map-data-source.mjs +9 -0
  22. package/dist/lib/map-style/map-layer.mjs +555 -17
  23. package/dist/lib/map-style/map-style.mjs +250 -39
  24. package/dist/package.json.mjs +1 -1
  25. package/dist/shared/{flow-rdf-core.1ee62df9.d.mts → flow-rdf-core.62a36d8b.d.mts} +1077 -234
  26. package/dist/shared/{flow-rdf-core.1ee62df9.d.ts → flow-rdf-core.62a36d8b.d.ts} +1077 -234
  27. package/package.json +1 -1
@@ -593,216 +593,280 @@ declare class Debugger<TState extends StateStore = StateStore> {
593
593
  private logStateValue;
594
594
  }
595
595
 
596
+ declare class MapLayerStyleBuilder {
597
+ private static _styleBuilders;
598
+ static registerStyleBuilder(layerType: string, builder: typeof MapLayerStyleBuilder): void;
599
+ static createStyleBuilder(layerType: string): MapLayerStyleBuilder;
600
+ private _styles;
601
+ /**
602
+ * Whether this layer is displayed.
603
+ *
604
+ * @param value - visible value (default `true`)
605
+ */
606
+ visibility(value: boolean | StyleExpression): this;
607
+ /**
608
+ * Create a style specification string.
609
+ *
610
+ * Call this method after setting all style properties
611
+ * on the style builder.
612
+ *
613
+ * @returns Layer style specification string
614
+ */
615
+ build(): string;
616
+ /**
617
+ * Format and add style property to the style builder.
618
+ */
619
+ protected addStyle(property: string, value: unknown): void;
620
+ private formatValue;
621
+ }
622
+ declare class StyleExpression {
623
+ private _expr;
624
+ __styleExpression: string;
625
+ constructor(_expr: string);
626
+ toString(): string;
627
+ }
628
+ declare function expr(expr: string): StyleExpression;
629
+
596
630
  /**
597
- * A Flo.w RDF reactive expression - used internally to parse and evaluate {@link MapLayer}
598
- * style [expressions](/flow-rdf/flow-rdf-core/expression-reference/). An expression can be evaluated
599
- * and its MapLibre-compatible representation can be generated.
631
+ * Geometry of a flow style: `circle`, `line` or `fill`.
632
+ *
633
+ * A flow layer becomes a MapLibre layer of this type, plus an outline layer for `fill` and a label layer when the style
634
+ * has label text.
635
+ *
636
+ * @experimental
637
+ */
638
+ type FlowStyleLayerType = 'circle' | 'line' | 'fill';
639
+ /**
640
+ * Named size used by {@link FlowStyle} sizes: `x-small`, `small`, `medium`, `large` or `x-large`.
641
+ *
642
+ * Each size property (`strokeWidth`, `labelSize` and `radius`) maps a named size to its own zoom-dependent size, which
643
+ * grows from zoom 0 to zoom 20.
644
+ *
645
+ * @experimental
646
+ */
647
+ type FlowStyleNamedSize = 'x-small' | 'small' | 'medium' | 'large' | 'x-large';
648
+ /**
649
+ * Size used by {@link FlowStyle}: a number in pixels or a {@link FlowStyleNamedSize}.
650
+ *
651
+ * @experimental
652
+ */
653
+ type FlowStyleSize = number | FlowStyleNamedSize;
654
+ /**
655
+ * Options for one row of a {@link FlowStyleDataDriven} table. They apply to string keys in `match` mode only.
656
+ *
657
+ * @experimental
658
+ */
659
+ interface FlowStyleDataDrivenOptions {
660
+ /** Set to `true` to match the key as a regular expression rather than as a string. */
661
+ regexp?: boolean;
662
+ /** Set to `true` to match case-sensitively. Defaults to `false`. */
663
+ caseSensitive?: boolean;
664
+ }
665
+ /**
666
+ * The structured form of a data-driven {@link FlowStyle} property: a table that maps the values of a feature property
667
+ * to style values. Visual editors read and write this form, and {@link dataDrivenExpression} turns it into a reactive
668
+ * expression.
669
+ *
670
+ * ## Modes
671
+ *
672
+ * | Mode | Keys | Result |
673
+ * | --- | --- | --- |
674
+ * | `match` | Strings or numbers | The value of the first row whose key matches the feature property, or `default`. String keys match case-insensitively unless `caseSensitive` is set, and as regular expressions when `regexp` is set. |
675
+ * | `step` | Numbers | The value of the row with the largest key that is less than or equal to the feature property, or `default` when there is none or the property is missing. |
676
+ * | `interpolate` | Numbers | A value interpolated linearly between the rows, or `default` when the property is not a number. |
677
+ * | `off` | Any | Always `default`. The table is kept for editing. |
678
+ *
679
+ * @typeParam T - Type of the style values.
680
+ *
681
+ * @experimental
682
+ */
683
+ interface FlowStyleDataDriven<T> {
684
+ /** Table mode: `match`, `step`, `interpolate` or `off`. */
685
+ mode: 'match' | 'step' | 'interpolate' | 'off';
686
+ /** Feature property to read. It may contain spaces and quotes. */
687
+ attribute: string;
688
+ /** Style value used when no row applies, and always in `off` mode. */
689
+ default: T;
690
+ /** Table rows, each a key, the style value for that key and optional match options. */
691
+ values: [key: string | number, value: T, options?: FlowStyleDataDrivenOptions][];
692
+ }
693
+ /**
694
+ * A {@link FlowStyle} property value given as a reactive expression.
695
+ *
696
+ * Only `value` is rendered. When `dataDriven` is present, `value` is generated from it with
697
+ * {@link dataDrivenExpression}. If `value` is not what `dataDriven` generates, or there is no `dataDriven`, the
698
+ * expression was written by hand, and an editor should treat it as code rather than as a table.
699
+ *
700
+ * @typeParam T - Type of the style values in `dataDriven`.
701
+ *
702
+ * @experimental
703
+ */
704
+ interface FlowStyleExpression<T> {
705
+ /** Always `expression`. */
706
+ type: 'expression';
707
+ /** Reactive expression, as a string or a number. This is the only part that is rendered. */
708
+ value: string | number;
709
+ /** Structured form that `value` is generated from, for editors. */
710
+ dataDriven?: FlowStyleDataDriven<T>;
711
+ }
712
+ /**
713
+ * A {@link FlowStyle} property value: a plain value, which is always a literal, or a {@link FlowStyleExpression}.
714
+ *
715
+ * @typeParam T - Type of the plain value.
716
+ *
717
+ * @experimental
718
+ */
719
+ type FlowStyleProperty<T> = T | FlowStyleExpression<T>;
720
+ /**
721
+ * Flow style: Flo.w's simplified layer style, and its stored format (version 2).
722
+ *
723
+ * A flow style uses drawing-program properties rather than MapLibre paint and layout properties. Build one with
724
+ * {@link flowLayerStyle}, and check one read from storage with {@link validateFlowStyle}. Plain values are literals:
725
+ * `'@name'` is the string `@name`, not a feature property. Use a {@link FlowStyleExpression} for anything computed.
726
+ *
727
+ * Unknown keys are kept when the style is saved and reported as warnings by {@link validateFlowStyle}. See
728
+ * [Flow Style](/flow-rdf/flow-rdf-core/flow-style) for the properties, values and versions.
600
729
  *
601
730
  * @example
731
+ * A circle style with a data-driven fill color and a label:
602
732
  * ```js
603
- * const ex = new ReactiveExpression('1 + 2');
604
- * console.log(ex.value); // 3
605
- * console.log(ex.maplibreExpression); // ['+', 1, 2]
733
+ * const style = {
734
+ * type: 'circle',
735
+ * version: 2,
736
+ * fillColor: { type: 'expression', value: `case(get("type") =* 'civil', '#1e88e5', 'gray')` },
737
+ * radius: 'medium',
738
+ * labelText: { type: 'expression', value: '@name' }
739
+ * };
606
740
  * ```
607
741
  *
742
+ * @experimental
743
+ */
744
+ interface FlowStyle {
745
+ /** Geometry: `circle`, `line` or `fill`. */
746
+ type: FlowStyleLayerType;
747
+ /** Stored format version. Always `2`. */
748
+ version: 2;
749
+ /** Fill color of circles and polygons. */
750
+ fillColor?: FlowStyleProperty<string>;
751
+ /** Color of circle outlines, polygon outlines and lines. */
752
+ strokeColor?: FlowStyleProperty<string>;
753
+ /** Width of circle outlines, polygon outlines and lines. */
754
+ strokeWidth?: FlowStyleProperty<FlowStyleSize>;
755
+ /** Circle radius. Only used by `circle` styles. */
756
+ radius?: FlowStyleProperty<FlowStyleSize>;
757
+ /** Opacity from `0` to `1`, applied to the geometry, its outline and its label. */
758
+ opacity?: FlowStyleProperty<number>;
759
+ /** Label text. A label is drawn only when this is set and not empty. */
760
+ labelText?: FlowStyleProperty<string>;
761
+ /** Label text color. */
762
+ labelColor?: FlowStyleProperty<string>;
763
+ /** Color of the halo around the label text. */
764
+ labelHaloColor?: FlowStyleProperty<string>;
765
+ /** Label text size. */
766
+ labelSize?: FlowStyleProperty<FlowStyleSize>;
767
+ /** Set to `false` to hide the layer. */
768
+ visibility?: FlowStyleProperty<boolean>;
769
+ /** Unknown keys, kept as they are. */
770
+ [key: string]: unknown;
771
+ }
772
+ /**
773
+ * A value passed to a {@link FlowLayerStyleBuilder} method: a plain value, which is a literal, a reactive expression
774
+ * made with {@link expr}, or a {@link FlowStyleDataDriven} table.
775
+ *
776
+ * @typeParam T - Type of the plain value.
608
777
  *
778
+ * @experimental
609
779
  */
610
- declare class ReactiveExpression<TState extends StateStore = StateStore, R = any> {
611
- private static parser;
612
- private static customFunctions;
780
+ type FlowValue<T> = T | StyleExpression | FlowStyleDataDriven<T>;
781
+ /**
782
+ * Builds a {@link FlowStyle}. Create one with {@link flowLayerStyle}.
783
+ *
784
+ * Each method sets one property and returns the builder. A plain value is a literal, an {@link expr} value is a
785
+ * reactive expression, and a {@link FlowStyleDataDriven} table becomes an expression with the table attached.
786
+ *
787
+ * @experimental
788
+ */
789
+ interface FlowLayerStyleBuilder {
613
790
  /**
614
- * Returns `true` if the specified custom function has been registered.
791
+ * Sets the fill color of circles and polygons.
615
792
  *
616
- * @param fn - The custom function name
793
+ * @param value - Color, expression or data-driven table.
617
794
  */
618
- static hasCustomFunction(fn: string): boolean;
795
+ fillColor(value: FlowValue<string>): this;
619
796
  /**
620
- * Register a custom function to be used in reactive expressions.
797
+ * Sets the color of circle outlines, polygon outlines and lines.
621
798
  *
622
- * @param fn - The custom function to register
799
+ * @param value - Color, expression or data-driven table.
623
800
  */
624
- static registerCustomFunction(fn: FlowCoreExpressionCustomFunction): void;
625
- private _expression;
626
- private parsedResult;
627
- private _store;
801
+ strokeColor(value: FlowValue<string>): this;
628
802
  /**
629
- * Parses a program string into a map of properties and their associated {@link ReactiveExpression}.
630
- *
631
- * The program string should be a series of property/expression pairs separated by semicolons as follows:
632
- *
633
- * ```js
634
- * const program = `
635
- * prop1: 1 + 2;
636
- * prop2: 'a string';
637
- * prop3: $stateProp * 3;
638
- * `;
639
- *
640
- * const parsedProgram = ReactiveExpression.parseProgram(program);
641
- * // {
642
- * // prop1: ReactiveExpression,
643
- * // prop2: ReactiveExpression,
644
- * // prop3: ReactiveExpression
645
- * // }
646
- *
647
- * ```
803
+ * Sets the width of circle outlines, polygon outlines and lines.
648
804
  *
649
- * @param program - The program to parse
650
- * @returns A map of property names and their associated expressions.
805
+ * @param value - Width in pixels, named size, expression or data-driven table.
651
806
  */
652
- static parseProgram(program: string): {
653
- [key: string]: ReactiveExpression;
654
- };
807
+ strokeWidth(value: FlowValue<FlowStyleSize>): this;
655
808
  /**
656
- * Generates the MapLibre-compatible representation of this expression.
657
- *
658
- * This is used internally when creating MapLibre style specifications
659
- * from Flo.w RDF {@link MapLayer} styles.
660
- *
661
- * This getter is a reactive `computed` and will re-evaluate within a
662
- * reactive context when the expression value changes.
809
+ * Sets the circle radius. Only used by `circle` styles.
663
810
  *
664
- * @computed
665
- *
666
- * @returns The MapLibre-compatible representation of this expression
811
+ * @param value - Radius in pixels, named size, expression or data-driven table.
667
812
  */
668
- get maplibreExpression(): ParserExpression | undefined;
813
+ radius(value: FlowValue<FlowStyleSize>): this;
669
814
  /**
670
- * Evaluates the expression and returns the result.
671
- *
672
- * This getter is a reactive `computed` and will re-evaluate within a
673
- * reactive context when the expression value changes.
815
+ * Sets the opacity of the geometry, its outline and its label.
674
816
  *
675
- * @example
676
- * ```js
677
- * const ex = new ReactiveExpression('1 + 2');
678
- * console.log(ex.value); // 3
679
- * ```
680
- *
681
- * @computed
682
- *
683
- * @returns - The result of evaluating the expression
817
+ * @param value - Opacity from `0` to `1`, expression or data-driven table.
684
818
  */
685
- get value(): R;
819
+ opacity(value: FlowValue<number>): this;
686
820
  /**
687
- * Returns details of parsing errors if the expression could not be parsed.
688
- */
689
- get parseError(): FlowCoreExpressionError | null;
690
- /**
691
- * Returns the original expression string passed to the constructor.
692
- */
693
- get expression(): string;
694
- /**
695
- * Returns the state store bound to the expression.
696
- */
697
- get store(): TState | null;
698
- /**
699
- * Constructs a new `ReactiveExpression`.
821
+ * Sets the label text. Use an expression such as `expr('@name')` to label each feature with a feature property.
700
822
  *
701
- * @example
702
- * ```js
703
- * const ex = new ReactiveExpression('1 + 2');
704
- * console.log(ex.value); // 3
705
- * ```
706
- *
707
- * @param expression - the string representation of the expression
708
- * @param parsedExpression - Used internally to bypass parsing when evaluating a program.
823
+ * @param value - Text, expression or data-driven table.
709
824
  */
710
- constructor(expression: string, parsedExpression?: ParserExpression);
825
+ labelText(value: FlowValue<string>): this;
711
826
  /**
712
- * Binds a {@link StateStore} to the expression. The state store is used to resolve
713
- * state variables in the expression.
827
+ * Sets the label text color.
714
828
  *
715
- * Note: If no state store is bound, the expression will not be able to resolve
716
- * state variables and will return `null` when evaluated. A console warning will
717
- * be logged.
718
- *
719
- * @param store {@link StateStore} to bind to the expression
720
- * @returns
829
+ * @param value - Color, expression or data-driven table.
721
830
  */
722
- bindState(store: TState | null): this;
831
+ labelColor(value: FlowValue<string>): this;
723
832
  /**
724
- * Returns a subscribable stream, which produces the value of the expression
725
- * whenever a reactive update causes the expression to re-evaluate.
833
+ * Sets the color of the halo around the label text.
726
834
  *
727
- * @example
728
- * ```js
729
- * const ex = new ReactiveExpression('$val * 2');
730
- * const subscription = ex.toStream().subscribe((value) => console.log(value));
731
- * ...
732
- * subscription.unsubscribe();
733
- * ```
734
- *
735
- * @param fireImmediately - If `true`, the stream will fire immediately with the current value.
736
- * If `false` the stream will only fire when the value changes.
737
- *
738
- * @returns A subscribable stream of the expression value
835
+ * @param value - Color, expression or data-driven table.
739
836
  */
740
- toStream(fireImmediately?: boolean): IObservableStream<R>;
741
- private evaluateExpression;
742
- private expandCustomFunctions;
743
- private isParseError;
744
- private isFunctionExpression;
745
- private formatName;
746
- }
747
-
748
- interface FlowCoreExpressionCustomFunction {
749
- name: string;
750
- initialize?: () => void;
751
- fn: FlowCoreExpressionCustomFunctionSignature;
752
- }
753
- type FlowCoreExpressionCustomFunctionSignature = <TState extends StateStore = any>(expr: ParserFunctionExpression, parentExpression: ReactiveExpression) => ParserExpression;
754
- interface FlowCoreExpressionCustomFunctions {
755
- [name: string]: FlowCoreExpressionCustomFunction;
756
- }
757
- type ParserExpression = number | string | boolean | null | ParserFunctionExpression;
758
- type ParserFunctionExpression = [string, ...any[]];
759
- interface ParserProgram {
760
- [key: string]: ParserExpressionWithIndex;
761
- }
762
- interface ParserExpressionWithIndex {
763
- expr: ParserExpression;
764
- start: ParserIndex;
765
- end: ParserIndex;
766
- }
767
- interface ParserIndex {
768
- offset: number;
769
- line: number;
770
- column: number;
771
- }
772
-
773
- declare class MapLayerStyleBuilder {
774
- private static _styleBuilders;
775
- static registerStyleBuilder(layerType: string, builder: typeof MapLayerStyleBuilder): void;
776
- static createStyleBuilder(layerType: string): MapLayerStyleBuilder;
777
- private _styles;
837
+ labelHaloColor(value: FlowValue<string>): this;
778
838
  /**
779
- * Whether this layer is displayed.
839
+ * Sets the label text size.
780
840
  *
781
- * @param value - visible value (default `true`)
841
+ * @param value - Size in pixels, named size, expression or data-driven table.
782
842
  */
783
- visibility(value: boolean | StyleExpression): this;
843
+ labelSize(value: FlowValue<FlowStyleSize>): this;
784
844
  /**
785
- * Create a style specification string.
786
- *
787
- * Call this method after setting all style properties
788
- * on the style builder.
845
+ * Sets whether the layer is visible.
789
846
  *
790
- * @returns Layer style specification string
847
+ * @param value - Visibility, expression or data-driven table.
791
848
  */
792
- build(): string;
849
+ visibility(value: FlowValue<boolean>): this;
793
850
  /**
794
- * Format and add style property to the style builder.
851
+ * Returns the flow style in its stored format, with `version` always set.
852
+ *
853
+ * @returns The flow style.
795
854
  */
796
- protected addStyle(property: string, value: unknown): void;
797
- private formatValue;
855
+ build(): FlowStyle;
798
856
  }
799
- declare class StyleExpression {
800
- private _expr;
801
- __styleExpression: string;
802
- constructor(_expr: string);
803
- toString(): string;
857
+ /**
858
+ * A problem found in a flow style by {@link validateFlowStyle}.
859
+ *
860
+ * @experimental
861
+ */
862
+ interface FlowStyleIssue {
863
+ /** Path of the problem in the style, for example `fillColor.dataDriven.values[2]`. Empty for the whole style. */
864
+ path: string;
865
+ /** Description of the problem. */
866
+ message: string;
867
+ /** Severity: `error` when the rule is left out, `warning` when it still renders. */
868
+ severity: 'error' | 'warning';
804
869
  }
805
- declare function expr(expr: string): StyleExpression;
806
870
 
807
871
  /**
808
872
  * WARNING - this file is auto generated
@@ -1708,82 +1772,398 @@ declare class HillshadeLayerStyleBuilder extends MapLayerStyleBuilder {
1708
1772
  */
1709
1773
  hillshadeIlluminationAnchor(value: ('map' | 'viewport') | StyleExpression): this;
1710
1774
  /**
1711
- * Intensity of the hillshade
1775
+ * Intensity of the hillshade
1776
+ *
1777
+ * @param value - hillshade-exaggeration value (default `0.5`)
1778
+ */
1779
+ hillshadeExaggeration(value: number | StyleExpression): this;
1780
+ /**
1781
+ * The shading color of areas that face away from the light source.
1782
+ *
1783
+ * @param value - hillshade-shadow-color value (default `#000000`)
1784
+ */
1785
+ hillshadeShadowColor(value: string | StyleExpression): this;
1786
+ /**
1787
+ * The shading color of areas that faces towards the light source.
1788
+ *
1789
+ * @param value - hillshade-highlight-color value (default `#FFFFFF`)
1790
+ */
1791
+ hillshadeHighlightColor(value: string | StyleExpression): this;
1792
+ /**
1793
+ * The shading color used to accentuate rugged terrain like sharp cliffs and gorges.
1794
+ *
1795
+ * @param value - hillshade-accent-color value (default `#000000`)
1796
+ */
1797
+ hillshadeAccentColor(value: string | StyleExpression): this;
1798
+ }
1799
+ /**
1800
+ * Style builder for 'background' layers.
1801
+ */
1802
+ declare class BackgroundLayerStyleBuilder extends MapLayerStyleBuilder {
1803
+ /**
1804
+ * The color with which the background will be drawn.
1805
+ *
1806
+ * @param value - background-color value (default `#000000`)
1807
+ */
1808
+ backgroundColor(value: string | StyleExpression): this;
1809
+ /**
1810
+ * Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
1811
+ *
1812
+ * @param value - background-pattern value
1813
+ */
1814
+ backgroundPattern(value: string | StyleExpression): this;
1815
+ /**
1816
+ * The opacity at which the background will be drawn.
1817
+ *
1818
+ * @param value - background-opacity value (default `1`)
1819
+ */
1820
+ backgroundOpacity(value: number | StyleExpression): this;
1821
+ }
1822
+ declare function layerStyle(layerType: 'fill'): FillLayerStyleBuilder;
1823
+ declare function layerStyle(layerType: 'line'): LineLayerStyleBuilder;
1824
+ declare function layerStyle(layerType: 'symbol'): SymbolLayerStyleBuilder;
1825
+ declare function layerStyle(layerType: 'circle'): CircleLayerStyleBuilder;
1826
+ declare function layerStyle(layerType: 'heatmap'): HeatmapLayerStyleBuilder;
1827
+ declare function layerStyle(layerType: 'fill-extrusion'): FillExtrusionLayerStyleBuilder;
1828
+ declare function layerStyle(layerType: 'raster'): RasterLayerStyleBuilder;
1829
+ declare function layerStyle(layerType: 'hillshade'): HillshadeLayerStyleBuilder;
1830
+ declare function layerStyle(layerType: 'background'): BackgroundLayerStyleBuilder;
1831
+
1832
+ /**
1833
+ * A Flo.w RDF reactive expression - used internally to parse and evaluate {@link MapLayer}
1834
+ * style [expressions](/flow-rdf/flow-rdf-core/expression-reference/). An expression can be evaluated
1835
+ * and its MapLibre-compatible representation can be generated.
1836
+ *
1837
+ * @example
1838
+ * ```js
1839
+ * const ex = new ReactiveExpression('1 + 2');
1840
+ * console.log(ex.value); // 3
1841
+ * console.log(ex.maplibreExpression); // ['+', 1, 2]
1842
+ * ```
1843
+ *
1844
+ *
1845
+ */
1846
+ declare class ReactiveExpression<TState extends StateStore = StateStore, R = any> {
1847
+ private static parser;
1848
+ private static customFunctions;
1849
+ /**
1850
+ * Returns `true` if the specified custom function has been registered.
1851
+ *
1852
+ * @param fn - The custom function name
1853
+ */
1854
+ static hasCustomFunction(fn: string): boolean;
1855
+ /**
1856
+ * Register a custom function to be used in reactive expressions.
1857
+ *
1858
+ * @param fn - The custom function to register
1859
+ */
1860
+ static registerCustomFunction(fn: FlowCoreExpressionCustomFunction): void;
1861
+ private _expression;
1862
+ private parsedResult;
1863
+ private _store;
1864
+ /**
1865
+ * Parses a program string into a map of properties and their associated {@link ReactiveExpression}.
1866
+ *
1867
+ * The program string should be a series of property/expression pairs separated by semicolons as follows:
1868
+ *
1869
+ * ```js
1870
+ * const program = `
1871
+ * prop1: 1 + 2;
1872
+ * prop2: 'a string';
1873
+ * prop3: $stateProp * 3;
1874
+ * `;
1875
+ *
1876
+ * const parsedProgram = ReactiveExpression.parseProgram(program);
1877
+ * // {
1878
+ * // prop1: ReactiveExpression,
1879
+ * // prop2: ReactiveExpression,
1880
+ * // prop3: ReactiveExpression
1881
+ * // }
1882
+ *
1883
+ * ```
1884
+ *
1885
+ * @param program - The program to parse
1886
+ * @returns A map of property names and their associated expressions.
1887
+ */
1888
+ static parseProgram(program: string): {
1889
+ [key: string]: ReactiveExpression;
1890
+ };
1891
+ /**
1892
+ * Generates the MapLibre-compatible representation of this expression.
1893
+ *
1894
+ * This is used internally when creating MapLibre style specifications
1895
+ * from Flo.w RDF {@link MapLayer} styles.
1896
+ *
1897
+ * This getter is a reactive `computed` and will re-evaluate within a
1898
+ * reactive context when the expression value changes.
1899
+ *
1900
+ * @computed
1901
+ *
1902
+ * @returns The MapLibre-compatible representation of this expression
1903
+ */
1904
+ get maplibreExpression(): ParserExpression | undefined;
1905
+ /**
1906
+ * Evaluates the expression and returns the result.
1907
+ *
1908
+ * This getter is a reactive `computed` and will re-evaluate within a
1909
+ * reactive context when the expression value changes.
1910
+ *
1911
+ * @example
1912
+ * ```js
1913
+ * const ex = new ReactiveExpression('1 + 2');
1914
+ * console.log(ex.value); // 3
1915
+ * ```
1916
+ *
1917
+ * @computed
1918
+ *
1919
+ * @returns - The result of evaluating the expression
1920
+ */
1921
+ get value(): R;
1922
+ /**
1923
+ * Returns details of parsing errors if the expression could not be parsed.
1924
+ */
1925
+ get parseError(): FlowCoreExpressionError | null;
1926
+ /**
1927
+ * Returns the original expression string passed to the constructor.
1928
+ */
1929
+ get expression(): string;
1930
+ /**
1931
+ * Returns the state store bound to the expression.
1932
+ */
1933
+ get store(): TState | null;
1934
+ /**
1935
+ * Constructs a new `ReactiveExpression`.
1936
+ *
1937
+ * @example
1938
+ * ```js
1939
+ * const ex = new ReactiveExpression('1 + 2');
1940
+ * console.log(ex.value); // 3
1941
+ * ```
1942
+ *
1943
+ * @param expression - the string representation of the expression
1944
+ * @param parsedExpression - Used internally to bypass parsing when evaluating a program.
1945
+ */
1946
+ constructor(expression: string, parsedExpression?: ParserExpression);
1947
+ /**
1948
+ * Binds a {@link StateStore} to the expression. The state store is used to resolve
1949
+ * state variables in the expression.
1950
+ *
1951
+ * Note: If no state store is bound, the expression will not be able to resolve
1952
+ * state variables and will return `null` when evaluated. A console warning will
1953
+ * be logged.
1954
+ *
1955
+ * @param store {@link StateStore} to bind to the expression
1956
+ * @returns
1957
+ */
1958
+ bindState(store: TState | null): this;
1959
+ /**
1960
+ * Returns a subscribable stream, which produces the value of the expression
1961
+ * whenever a reactive update causes the expression to re-evaluate.
1962
+ *
1963
+ * @example
1964
+ * ```js
1965
+ * const ex = new ReactiveExpression('$val * 2');
1966
+ * const subscription = ex.toStream().subscribe((value) => console.log(value));
1967
+ * ...
1968
+ * subscription.unsubscribe();
1969
+ * ```
1970
+ *
1971
+ * @param fireImmediately - If `true`, the stream will fire immediately with the current value.
1972
+ * If `false` the stream will only fire when the value changes.
1973
+ *
1974
+ * @returns A subscribable stream of the expression value
1975
+ */
1976
+ toStream(fireImmediately?: boolean): IObservableStream<R>;
1977
+ private evaluateExpression;
1978
+ private expandCustomFunctions;
1979
+ private isParseError;
1980
+ private isFunctionExpression;
1981
+ private formatName;
1982
+ }
1983
+
1984
+ interface FlowCoreExpressionCustomFunction {
1985
+ name: string;
1986
+ initialize?: () => void;
1987
+ fn: FlowCoreExpressionCustomFunctionSignature;
1988
+ }
1989
+ type FlowCoreExpressionCustomFunctionSignature = <TState extends StateStore = any>(expr: ParserFunctionExpression, parentExpression: ReactiveExpression) => ParserExpression;
1990
+ interface FlowCoreExpressionCustomFunctions {
1991
+ [name: string]: FlowCoreExpressionCustomFunction;
1992
+ }
1993
+ type ParserExpression = number | string | boolean | null | ParserFunctionExpression;
1994
+ type ParserFunctionExpression = [string, ...any[]];
1995
+ interface ParserProgram {
1996
+ [key: string]: ParserExpressionWithIndex;
1997
+ }
1998
+ interface ParserExpressionWithIndex {
1999
+ expr: ParserExpression;
2000
+ start: ParserIndex;
2001
+ end: ParserIndex;
2002
+ }
2003
+ interface ParserIndex {
2004
+ offset: number;
2005
+ line: number;
2006
+ column: number;
2007
+ }
2008
+
2009
+ interface MapLayerOptions {
2010
+ /** Layer ID. */
2011
+ id: string;
2012
+ /**
2013
+ * Layer type: a MapLibre layer type, or `flow` for a flow layer. A flow layer is styled with a flow style (see
2014
+ * {@link style}) and renders as the MapLibre layers it needs: for a flow layer `airports`, the geometry layer
2015
+ * `airports` (`circle`, `line` or `fill`), the outline `airports__stroke` (`line`, for `fill` only) and the label
2016
+ * `airports__label` (`symbol`, when the style has label text). Each goes to its own type's insertion point in the
2017
+ * base style, or, with `above` or `below`, the group goes there in order.
1712
2018
  *
1713
- * @param value - hillshade-exaggeration value (default `0.5`)
2019
+ * The `filter`, `minZoom`, `maxZoom`, `interactive` and `metadata` options apply to every MapLibre layer of a flow
2020
+ * layer. Labels are never interactive. Click and hover events, and the map plugins, report the flow layer's `id`.
2021
+ *
2022
+ * Flow layers are experimental. See [Flow Style](/flow-rdf/flow-rdf-core/flow-style) for the flow style format.
1714
2023
  */
1715
- hillshadeExaggeration(value: number | StyleExpression): this;
2024
+ type: MapLayerType | 'flow';
2025
+ /** Map data source to display. */
2026
+ source: string;
2027
+ /** Map data source layer to display. (Applicable to 'vector'-type data sources). */
2028
+ sourceLayer?: string;
2029
+ /** Enable feature hover effect and click handling. */
2030
+ interactive?: boolean;
2031
+ /** Minimum visible zoom level. */
2032
+ minZoom?: number;
2033
+ /** Maximum visible zoom level. */
2034
+ maxZoom?: number;
2035
+ above?: string;
2036
+ below?: string;
2037
+ filter?: string;
1716
2038
  /**
1717
- * The shading color of areas that face away from the light source.
2039
+ * Shows or hides the layer: a reactive expression, such as `'$showAirports'`, or a boolean. It overrides the
2040
+ * `visibility` of the layer's style, and of every MapLibre layer of a flow layer. Change it with
2041
+ * {@link MapLayer.setVisibility}.
1718
2042
  *
1719
- * @param value - hillshade-shadow-color value (default `#000000`)
2043
+ * @experimental
1720
2044
  */
1721
- hillshadeShadowColor(value: string | StyleExpression): this;
2045
+ visibility?: string | boolean;
1722
2046
  /**
1723
- * The shading color of areas that faces towards the light source.
2047
+ * Layer style. For a MapLibre layer type, a style program, such as one built with {@link layerStyle}. For a `flow`
2048
+ * layer, a version 2 {@link FlowStyle}, such as one built with {@link flowLayerStyle}.
1724
2049
  *
1725
- * @param value - hillshade-highlight-color value (default `#FFFFFF`)
2050
+ * A flow layer never throws on a bad flow style: it renders the valid properties and lists the problems in
2051
+ * {@link MapLayer.issues}.
1726
2052
  */
1727
- hillshadeHighlightColor(value: string | StyleExpression): this;
2053
+ style?: string | FlowStyle;
1728
2054
  /**
1729
- * The shading color used to accentuate rugged terrain like sharp cliffs and gorges.
2055
+ * Metadata copied to the `metadata` of the layer's MapLibre layers. Use it to attach application data to a layer,
2056
+ * such as the group it belongs to.
1730
2057
  *
1731
- * @param value - hillshade-accent-color value (default `#000000`)
2058
+ * @experimental
1732
2059
  */
1733
- hillshadeAccentColor(value: string | StyleExpression): this;
2060
+ metadata?: Record<string, unknown>;
1734
2061
  }
1735
2062
  /**
1736
- * Style builder for 'background' layers.
2063
+ * Options of a composite layer: a {@link MapLayer} with `type: 'composite'`, which renders a
2064
+ * {@link CompositeLayerSpecification}, several sub-layers and the data sources they draw, as one layer. Add one with
2065
+ * `map.addLayer()`, as any other layer.
2066
+ *
2067
+ * - **Data sources**: the spec's data sources are added with the layer, by their own IDs, and shared with every other
2068
+ * composite layer that brings the same ID: the first one added gives the options, and a later one with other
2069
+ * options is reported as a map error. A data source the application has added with the same ID is used instead, and
2070
+ * is never removed. A sub-layer can also draw a data source the application has added. A data source is removed with
2071
+ * the last composite layer that brings it, and `map.removeSource()` throws while a composite layer uses it.
2072
+ * - **Sub-layers**: a sub-layer `points` of the composite layer `user_x` renders as the MapLibre layer
2073
+ * `user_x__points`, with `user_x__points__stroke` and `user_x__points__label` for a flow style that needs them. Each
2074
+ * goes to its type's insertion point in the base style or, with `above` or `below`, the whole composite layer goes
2075
+ * there, in order.
2076
+ * - **Shared settings**: `filter` is ANDed with each sub-layer's own filter; `visibility` overrides the sub-layers'
2077
+ * own; a sub-layer is interactive when both `interactive` and its own rule say so; `minZoom` and `maxZoom` narrow
2078
+ * each sub-layer's range; and `metadata` is merged into every MapLibre layer's metadata, with
2079
+ * `{composite: true, compositeParentLayer: <layer ID>, compositeSubLayer: <sub-layer ID>}`.
2080
+ * - **The composite layer is what you address**: `map.getLayer()` and `map.getLayers()` return it, not its
2081
+ * sub-layers, and click and hover events and the map plugins report a feature from any sub-layer as the composite
2082
+ * layer's.
2083
+ *
2084
+ * A composite layer never throws on bad spec content: the valid sub-layers and data sources render, and
2085
+ * {@link MapLayer.issues} lists the problems, each also emitted once as a map `error`. Edit a composite layer with
2086
+ * {@link MapLayer.setStyle}, and save its {@link MapLayer.compositeSpec}.
2087
+ *
2088
+ * Data source selection options (`selectionMode` and the rest) need the `SelectionPlugin`, and `@@hover` styling
2089
+ * needs the `HoverEffectPlugin`. Without the `SelectionPlugin`, a composite layer that declares selection emits one
2090
+ * map error and renders without selection.
2091
+ *
2092
+ * @example
2093
+ * A stored map layer (version 1), filtered and edited:
2094
+ * ```js
2095
+ * const layer = map.addLayer({
2096
+ * id: row.id,
2097
+ * type: 'composite',
2098
+ * style: row.layerSpec,
2099
+ * filter: queryFilter,
2100
+ * visibility: '$showDiscovery',
2101
+ * below: 'anchor-discovery',
2102
+ * metadata: { mapLayerType: row.type }
2103
+ * });
2104
+ * layer.setStyle(updateCompositeFlowStyle(layer.compositeSpec, 'circle-layer', { fillColor: '#bbff00' }));
2105
+ * save(layer.compositeSpec); // still version 1
2106
+ * ```
2107
+ *
2108
+ * @experimental
1737
2109
  */
1738
- declare class BackgroundLayerStyleBuilder extends MapLayerStyleBuilder {
1739
- /**
1740
- * The color with which the background will be drawn.
1741
- *
1742
- * @param value - background-color value (default `#000000`)
1743
- */
1744
- backgroundColor(value: string | StyleExpression): this;
1745
- /**
1746
- * Name of image in sprite to use for drawing an image background. For seamless patterns, image width and height must be a factor of two (2, 4, 8, ..., 512). Note that zoom-dependent expressions will be evaluated only at integer zoom levels.
1747
- *
1748
- * @param value - background-pattern value
1749
- */
1750
- backgroundPattern(value: string | StyleExpression): this;
2110
+ interface CompositeLayerOptions {
2111
+ /** Layer ID. It prefixes the IDs of the layer's MapLibre layers. */
2112
+ id: string;
2113
+ /** Always `composite`. */
2114
+ type: 'composite';
1751
2115
  /**
1752
- * The opacity at which the background will be drawn.
1753
- *
1754
- * @param value - background-opacity value (default `1`)
2116
+ * The composite layer spec, version 1 or 2: a stored map layer's `layerSpec`, or one built with
2117
+ * {@link compositeLayerSpec}.
1755
2118
  */
1756
- backgroundOpacity(value: number | StyleExpression): this;
1757
- }
1758
- declare function layerStyle(layerType: 'fill'): FillLayerStyleBuilder;
1759
- declare function layerStyle(layerType: 'line'): LineLayerStyleBuilder;
1760
- declare function layerStyle(layerType: 'symbol'): SymbolLayerStyleBuilder;
1761
- declare function layerStyle(layerType: 'circle'): CircleLayerStyleBuilder;
1762
- declare function layerStyle(layerType: 'heatmap'): HeatmapLayerStyleBuilder;
1763
- declare function layerStyle(layerType: 'fill-extrusion'): FillExtrusionLayerStyleBuilder;
1764
- declare function layerStyle(layerType: 'raster'): RasterLayerStyleBuilder;
1765
- declare function layerStyle(layerType: 'hillshade'): HillshadeLayerStyleBuilder;
1766
- declare function layerStyle(layerType: 'background'): BackgroundLayerStyleBuilder;
1767
-
1768
- interface MapLayerOptions {
1769
- /** Layer ID. */
1770
- id: string;
1771
- /** Layer type. */
1772
- type: MapLayerType;
1773
- /** Map data source to display. */
1774
- source: string;
1775
- /** Map data source layer to display. (Applicable to 'vector'-type data sources). */
1776
- sourceLayer?: string;
1777
- /** Enable feature hover effect and click handling. */
2119
+ style: CompositeLayerSpecification;
2120
+ /** Filter: a reactive expression, ANDed with each sub-layer's own filter. */
2121
+ filter?: string;
2122
+ /** Shows or hides every sub-layer: a reactive expression or a boolean. It overrides the sub-layers' own visibility. */
2123
+ visibility?: string | boolean;
2124
+ /** Set to `false` to leave every sub-layer out of click and hover results. Defaults to `true`. */
1778
2125
  interactive?: boolean;
1779
- /** Minimum visible zoom level. */
2126
+ /** Minimum visible zoom level. If set, it narrows each sub-layer's own range. */
1780
2127
  minZoom?: number;
1781
- /** Maximum visible zoom level. */
2128
+ /** Maximum visible zoom level. If set, it narrows each sub-layer's own range. */
1782
2129
  maxZoom?: number;
2130
+ /** ID of a layer to place the composite layer's MapLibre layers above, in order. */
1783
2131
  above?: string;
2132
+ /** ID of a layer to place the composite layer's MapLibre layers below, in order. */
1784
2133
  below?: string;
1785
- filter?: string;
2134
+ /** Metadata merged into the `metadata` of every MapLibre layer of the composite layer. */
2135
+ metadata?: Record<string, unknown>;
2136
+ }
2137
+ /**
2138
+ * One MapLibre layer of a {@link MapLayer} that renders as several, given to the layer with
2139
+ * {@link MapLayer.setSubLayers}. The layer's `filter`, `minZoom`, `maxZoom`, `interactive`, `metadata` and the
2140
+ * visibility from {@link MapLayer.setVisibility} apply to every sub-layer.
2141
+ *
2142
+ * @internal
2143
+ */
2144
+ interface MapSubLayerOptions {
2145
+ /** MapLibre layer ID, in full (for example `airports__stroke`). Unique on the map. */
2146
+ id: string;
2147
+ /** MapLibre layer type. */
2148
+ type: MapLayerType;
2149
+ /** Style program for the MapLibre layer type, as {@link MapLayerOptions.style}. */
1786
2150
  style?: string;
2151
+ /** Set to `false` to leave the sub-layer out of click and hover results. ANDed with the layer's. Defaults to `true`. */
2152
+ interactive?: boolean;
2153
+ /** Keys merged over the layer's metadata, for this sub-layer only. */
2154
+ metadata?: Record<string, unknown>;
2155
+ /** Map data source to display. Defaults to the layer's source. */
2156
+ source?: string;
2157
+ /**
2158
+ * Map data source layer to display. Defaults to the layer's source layer when the sub-layer uses the layer's source.
2159
+ */
2160
+ sourceLayer?: string;
2161
+ /** Filter for this sub-layer, ANDed with the layer's. */
2162
+ filter?: string;
2163
+ /** Minimum visible zoom level, within the layer's range. */
2164
+ minZoom?: number;
2165
+ /** Maximum visible zoom level, within the layer's range. */
2166
+ maxZoom?: number;
1787
2167
  }
1788
2168
  type MapLayerExpression = ParserExpression;
1789
2169
  interface MapLayerSpecification {
@@ -1826,29 +2206,249 @@ declare class MapLayer {
1826
2206
  private _filter;
1827
2207
  private _paintProps;
1828
2208
  private _layoutProps;
2209
+ private _visibility;
2210
+ private _subLayers;
2211
+ private _ownedSources;
2212
+ private _ownedSourcesListeners;
2213
+ private _flow;
2214
+ private _composite;
2215
+ private _mapSources;
2216
+ private _issues;
2217
+ private _invalidInteractive;
2218
+ /**
2219
+ * The specification of the layer's own MapLibre layer. A layer that renders as several MapLibre layers, such as a
2220
+ * flow layer, doesn't render this one.
2221
+ */
1829
2222
  get layerSpecification(): MapLayerSpecification;
2223
+ /**
2224
+ * The specifications of every MapLibre layer the layer renders as, in draw order: its sub-layers', or its own.
2225
+ *
2226
+ * @internal
2227
+ */
2228
+ get layerSpecifications(): MapLayerSpecification[];
2229
+ /**
2230
+ * IDs of the MapLibre layers the layer renders as, in draw order.
2231
+ *
2232
+ * @internal
2233
+ */
2234
+ get maplibreLayerIds(): string[];
2235
+ /**
2236
+ * IDs of the MapLibre layers whose features click and hover events report, as this layer.
2237
+ *
2238
+ * @internal
2239
+ */
2240
+ get interactiveLayerIds(): string[];
2241
+ /**
2242
+ * IDs of the map data sources the layer's MapLibre layers display.
2243
+ *
2244
+ * @internal
2245
+ */
2246
+ get sourceIds(): string[];
2247
+ /**
2248
+ * The layer's sub-layers, or `null` for a layer that renders as one MapLibre layer.
2249
+ *
2250
+ * @internal
2251
+ */
2252
+ get subLayers(): readonly MapSubLayerOptions[] | null;
2253
+ /**
2254
+ * The data sources the layer brings with it (see {@link setOwnedSources}), or `null` for none.
2255
+ *
2256
+ * @internal
2257
+ */
2258
+ get ownedSources(): readonly MapDataSourceOptions[] | null;
2259
+ /**
2260
+ * Layer metadata, copied to the `metadata` of the layer's MapLibre layers.
2261
+ *
2262
+ * @experimental
2263
+ */
2264
+ get metadata(): Record<string, unknown> | undefined;
2265
+ /**
2266
+ * A flow layer's style, in its stored format and version, ready to save. A copy: change the layer with
2267
+ * {@link setStyle} and {@link setStyleProperty}. `undefined` for a MapLibre layer.
2268
+ *
2269
+ * Reading it in a MobX reaction, or a component that renders from state, tracks changes to the style.
2270
+ *
2271
+ * @experimental
2272
+ */
2273
+ get flowStyle(): FlowStyle | undefined;
2274
+ /**
2275
+ * A composite layer's spec, in its stored format and version (a version 1 spec stays version 1), ready to save. A
2276
+ * copy: change the layer with {@link setStyle}. `undefined` for any other layer type.
2277
+ *
2278
+ * Reading it in a MobX reaction, or a component that renders from state, tracks changes to the spec.
2279
+ *
2280
+ * @experimental
2281
+ */
2282
+ get compositeSpec(): CompositeLayerSpecification | undefined;
2283
+ /**
2284
+ * The problems with a flow layer's style or a composite layer's spec, updated whenever the style changes. An `error`
2285
+ * means a property, a sub-layer, a data source or the whole style isn't rendered; a `warning` means it is rendered
2286
+ * anyway. Each has the path of the problem in the style or spec, such as `layers[1].style.fillColor`. Empty for a
2287
+ * MapLibre layer, which throws on a bad style instead.
2288
+ *
2289
+ * A composite layer on a map also lists each sub-layer whose data source is neither in the spec nor on the map, and
2290
+ * so isn't rendered, and the map emits each new issue of a composite layer as an `error` event.
2291
+ *
2292
+ * The list is observable: read it in a MobX reaction to follow it.
2293
+ *
2294
+ * @experimental
2295
+ */
2296
+ get issues(): FlowStyleIssue[];
1830
2297
  get id(): string;
1831
2298
  get type(): string;
2299
+ /** The data source the layer displays. Empty for a composite layer, whose sub-layers name their own. */
1832
2300
  get source(): string;
1833
2301
  get interactive(): boolean;
1834
2302
  get above(): string | undefined;
1835
2303
  get below(): string | undefined;
1836
- constructor(options: MapLayerOptions);
2304
+ constructor(options: MapLayerOptions | CompositeLayerOptions);
1837
2305
  bindState(state: StateStore | null): this;
1838
2306
  setMinZoom(zoom: number): this;
1839
2307
  setMaxZoom(zoom: number): this;
1840
2308
  setInteractive(interactive: boolean): this;
1841
2309
  setAbove(layerId: string | undefined): this;
1842
2310
  setBelow(layerId: string | undefined): this;
1843
- setStyle(styleProgram: string): void;
1844
2311
  /**
1845
- * Set an individual style property.
2312
+ * Replaces the layer's style.
2313
+ *
2314
+ * - **MapLibre layer types**: sets each property of a style program, such as one built with {@link layerStyle}.
2315
+ * Properties the program doesn't set are kept. Throws on an invalid program or an unknown property.
2316
+ * - **Flow layers**: replaces the whole flow style with a version 2 {@link FlowStyle}, such as one built with
2317
+ * {@link flowLayerStyle}. The layer's MapLibre layers are updated in place, without reloading the source. Never
2318
+ * throws: a property with a problem isn't rendered, the rest is, and {@link issues} lists the problems.
2319
+ * - **Composite layers**: replaces the whole spec with a {@link CompositeLayerSpecification}, such as one edited with
2320
+ * {@link updateCompositeFlowStyle}, in one update of the map: MapLibre layers whose IDs persist keep their place
2321
+ * and are restyled, data sources whose options are unchanged aren't reloaded, and a spec equal to the current one
2322
+ * changes nothing. The spec keeps its own version. Never throws: {@link issues} lists the problems.
2323
+ *
2324
+ * @param style - Style program for a MapLibre layer, flow style for a flow layer, or spec for a composite layer.
2325
+ */
2326
+ setStyle(style: string | FlowStyle | CompositeLayerSpecification): void;
2327
+ /**
2328
+ * Sets or removes one style property. Its value follows different rules for MapLibre layers and flow layers.
2329
+ *
2330
+ * - **MapLibre layer types**: `property` is a MapLibre paint or layout property, such as `circle-color`, and a string
2331
+ * `value` is a reactive expression, so `'red'` is the color red and `'@color'` the feature property `color`.
2332
+ * Throws on an unknown property or an expression that doesn't parse.
2333
+ * - **Flow layers**: `property` is a {@link FlowStyle} property, such as `fillColor`, and `value` follows flow
2334
+ * rules, as in {@link flowLayerStyle}: a bare value is a literal, so `'@color'` is the text `@color`; `expr('…')`
2335
+ * makes a reactive expression, such as `expr('@color')` or `expr("@@hover ? 'yellow' : 'white'")`; and a
2336
+ * {@link FlowStyleDataDriven} table makes an expression with the table attached. The layer's MapLibre layers are
2337
+ * updated in place, without reloading the source, and {@link flowStyle} returns the edited style. Never throws:
2338
+ * {@link issues} lists any problems.
2339
+ * - **Composite layers**: throws. Edit the spec instead, with {@link updateCompositeFlowStyle}, and give it to
2340
+ * {@link setStyle}.
2341
+ *
2342
+ * @example
2343
+ * The same edit on a MapLibre layer and on a flow layer:
2344
+ * ```js
2345
+ * circleLayer.setStyleProperty('circle-stroke-color', "@@hover ? 'yellow' : 'white'");
2346
+ * flowLayer.setStyleProperty('strokeColor', expr("@@hover ? 'yellow' : 'white'"));
2347
+ * ```
2348
+ *
2349
+ * @param property - Property name.
2350
+ * @param value - Property value, or `null` to remove the property.
2351
+ */
2352
+ setStyleProperty(property: string, value: FlowValue<string | number | boolean> | FlowStyleExpression<unknown> | null): void;
2353
+ /**
2354
+ * Sets or clears the layer's filter.
1846
2355
  *
1847
- * @param property Property name.
1848
- * @param expression Property style expression.
2356
+ * @param expression - Reactive expression that a feature must match to be drawn. Specify `null`, or an empty
2357
+ * string, to clear the filter.
2358
+ * @throws `FlowCoreExpressionError` if the expression doesn't parse.
1849
2359
  */
1850
- setStyleProperty(property: string, expression: string | null): void;
1851
2360
  setFilter(expression: string | null): void;
2361
+ /**
2362
+ * Shows or hides the layer, and every MapLibre layer of a flow or composite layer, overriding the `visibility` of
2363
+ * their styles.
2364
+ *
2365
+ * @param visibility - Reactive expression, such as `'$showAirports'`, or boolean. Specify `null` to leave visibility
2366
+ * to the styles.
2367
+ * @throws `FlowCoreExpressionError` if the expression doesn't parse.
2368
+ * @experimental
2369
+ */
2370
+ setVisibility(visibility: string | boolean | null): void;
2371
+ /**
2372
+ * Makes the layer render as an ordered group of MapLibre layers, its sub-layers, instead of one. The first sub-layer
2373
+ * is drawn lowest. Replacing the sub-layers updates the map in place: MapLibre layers whose IDs persist are restyled,
2374
+ * and their sources aren't reloaded. The layer's own style program isn't rendered while it has sub-layers.
2375
+ *
2376
+ * @param subLayers - Sub-layers in draw order. An empty list renders nothing. Specify `null` to render the layer as
2377
+ * one MapLibre layer again.
2378
+ * @throws {@link FlowCoreError} if two sub-layers have the same ID, or a sub-layer's type, style program or filter
2379
+ * is invalid. The layer's sub-layers are then unchanged.
2380
+ * @internal
2381
+ */
2382
+ setSubLayers(subLayers: readonly MapSubLayerOptions[] | null): void;
2383
+ /**
2384
+ * Declares the data sources the layer brings with it, so that its sub-layers can display them. The map's
2385
+ * `MapStyle` adds each one, by ID, while a layer on the map brings it, and shares it between the layers that
2386
+ * bring the same ID: the first layer added to the map gives its options, and a later one that gives different
2387
+ * options is reported as a style problem. A source the app added with the same ID is used instead, and is never
2388
+ * removed. Changing the list updates the map in place: a source whose options are unchanged keeps its
2389
+ * `MapDataSource`, so it isn't reloaded.
2390
+ *
2391
+ * @param sources - Options of each data source. Specify `null`, or an empty list, to bring none.
2392
+ * @throws {@link FlowCoreError} if two sources have the same ID, or a source's type is invalid. The layer's sources
2393
+ * are then unchanged.
2394
+ * @internal
2395
+ */
2396
+ setOwnedSources(sources: readonly MapDataSourceOptions[] | null): void;
2397
+ /**
2398
+ * Calls a listener, synchronously, whenever {@link setOwnedSources} is called: `MapStyle` uses it to add and
2399
+ * remove the sources in the same action.
2400
+ *
2401
+ * @returns A function that removes the listener.
2402
+ * @internal
2403
+ */
2404
+ observeOwnedSources(listener: () => void): () => void;
2405
+ /**
2406
+ * Tells the layer which data sources are on its map, while it is on one: a composite layer lists each sub-layer
2407
+ * whose data source is missing in {@link issues}. `MapStyle` sets it when the layer is added, and clears it when the
2408
+ * layer is removed.
2409
+ *
2410
+ * @param lookup - Whether a data source ID is on the map, read reactively; `null` when the layer isn't on a map.
2411
+ * @internal
2412
+ */
2413
+ setMapSources(lookup: ((id: string) => boolean) | null): void;
2414
+ /**
2415
+ * Loads a version 1 flow style, the legacy stored format, into a flow layer, with its geometry. The layer then keeps
2416
+ * version 1: {@link setStyleProperty} writes version 1 forms, {@link setStyle} converts a version 2 style to version 1
2417
+ * (keeping the layer's geometry), and {@link flowStyle} returns version 1, so the style saves back in the format old
2418
+ * CAA Analyser reads. Loading and saving an unchanged style gives a deep-equal style. Never throws.
2419
+ *
2420
+ * Use `createVersion1FlowLayer()` (`flow-style/version1-flow-layer.ts`) to build such a layer.
2421
+ *
2422
+ * @param style - The style as stored: a version 1 style (`type: 'flow'`, `version` 1 or missing), or anything else,
2423
+ * which {@link issues} reports.
2424
+ * @param geometry - The geometry: the composite sub-layer's `type`, `circle`, `line` or `fill`.
2425
+ * @internal
2426
+ */
2427
+ setVersion1FlowStyle(style: unknown, geometry: unknown): void;
2428
+ /** Replaces a flow layer's style, under the version rules of the layer. */
2429
+ private replaceFlowStyle;
2430
+ /**
2431
+ * A version 2 style, written in version 1 form for a version 1 layer: each property as {@link setStyleProperty}
2432
+ * writes it. The layer's geometry stays; a different one in the style is a warning.
2433
+ */
2434
+ private convertToVersion1;
2435
+ /** Sets or removes one property of a flow layer's style, under the style's version rules. */
2436
+ private setFlowStyleProperty;
2437
+ /** Sets a flow layer's style, and renders it as sub-layers. */
2438
+ private updateFlowLayer;
2439
+ /** Replaces a composite layer's spec: its sources and sub-layers, in the action that calls it. */
2440
+ private replaceCompositeSpec;
2441
+ /**
2442
+ * A composite layer's issues: the expansion's, and, on a map, its sub-layers' missing data sources. A sub-layer
2443
+ * source that isn't in the spec's data sources is a warning in the spec alone; on the map it's nothing if the map
2444
+ * has the source, and an error if it doesn't, since the sub-layer then isn't rendered.
2445
+ */
2446
+ private get compositeIssues();
2447
+ /** The spec path of the sub-layer that gave a MapLibre layer, from its metadata. */
2448
+ private compositeSubLayerPath;
2449
+ /** The MapLibre layer specification of a sub-layer, with the layer's shared settings applied. */
2450
+ private subLayerSpecification;
2451
+ private visibilityValue;
1852
2452
  private formattedName;
1853
2453
  private getPropertyMetadata;
1854
2454
  private static initializePropertyMetadataIndex;
@@ -1878,6 +2478,43 @@ interface MapDataSourceOptions {
1878
2478
  flowHost?: string;
1879
2479
  /** Set to override application-wide API key for this data source */
1880
2480
  flowApiKey?: string;
2481
+ /**
2482
+ * Selection options for the data source. If specified, the
2483
+ * {@link flow-rdf-core/plugins!SelectionPlugin | SelectionPlugin} enables selection for the data source when the
2484
+ * plugin is installed or the data source is added, in either order, as if
2485
+ * {@link flow-rdf-core/plugins!SelectionPlugin.enableSelection | SelectionPlugin.enableSelection} had been called. A
2486
+ * later `enableSelection` call for the data source replaces it. If not specified, selection is set up only by calling
2487
+ * `enableSelection`.
2488
+ *
2489
+ * The `featureId` property must be set for features to be selected.
2490
+ *
2491
+ * @experimental
2492
+ */
2493
+ selection?: SelectionOptions;
2494
+ }
2495
+ /**
2496
+ * Selection mode used by {@link SelectionOptions}: `single`, `multi` or `none`. See
2497
+ * {@link flow-rdf-core/plugins!SelectionPlugin | SelectionPlugin} for the behavior of each mode.
2498
+ */
2499
+ type SelectionMode = 'single' | 'multi' | 'none';
2500
+ /**
2501
+ * Selection options for a map data source, declared with {@link MapDataSourceOptions.selection} or passed to
2502
+ * {@link flow-rdf-core/plugins!SelectionPlugin.enableSelection | SelectionPlugin.enableSelection}. See
2503
+ * {@link flow-rdf-core/plugins!SelectionPlugin | SelectionPlugin} for more details.
2504
+ */
2505
+ interface SelectionOptions {
2506
+ /** Clear mode for selection */
2507
+ clear?: boolean | 'group';
2508
+ /** Selection group ID - applies when `clear` mode is set to `group`. */
2509
+ group?: string;
2510
+ /** Selection mode: `single` or `multi` */
2511
+ mode: SelectionMode;
2512
+ /** ID of popup to display when selecting a feature. */
2513
+ popup?: string;
2514
+ /** Reactive state property to bind to selection state. */
2515
+ selectionState?: string;
2516
+ /** Map data source layer. Note that this is only required for custom vector data sources. */
2517
+ sourceLayer?: string;
1881
2518
  }
1882
2519
  interface MapDataSourceSpecification {
1883
2520
  type: MapDataSourceType;
@@ -1913,6 +2550,178 @@ interface MapStyleSpecification {
1913
2550
  layers: Array<MapLayerSpecification>;
1914
2551
  }
1915
2552
 
2553
+ /**
2554
+ * A composite layer spec: several sub-layers, in flow style or MapLibre style, and the data sources they draw, stored
2555
+ * as one object. It is the stored format of Flo.w Engine map layers (their `layerSpec`).
2556
+ *
2557
+ * There are two versions of the stored format:
2558
+ *
2559
+ * - **Version 2**, the current one, has `version: 2`. Its sub-layers ({@link CompositeSubLayerSpecification}) have the
2560
+ * shape of `MapLayerOptions`: `{type: 'flow', style: FlowStyle}` or a MapLibre type with a style program. Build one
2561
+ * with {@link compositeLayerSpec}.
2562
+ * - **Version 1** is the legacy format CAA Analyser stores. A spec with no `version` is version 1. Its sub-layers
2563
+ * ({@link CompositeSubLayerSpecificationV1}) take their geometry from `type` and wrap their style as
2564
+ * `{type: 'flow', …}` or `{type: 'maplibre', style}`. Version 1 specs are read and written as they are, and are
2565
+ * never upgraded.
2566
+ *
2567
+ * Every object in a spec keeps keys it doesn't know, so a spec read from storage, edited and saved loses nothing.
2568
+ * Check a spec with {@link validateCompositeLayer}, and edit one with {@link updateCompositeFlowStyle} and
2569
+ * {@link setCompositeSubLayerFilter}, which write in the spec's own version.
2570
+ *
2571
+ * @experimental
2572
+ */
2573
+ interface CompositeLayerSpecification {
2574
+ /** Stored format version. A missing `version` means 1; `2` is required from version 2 on. Any other value is an error. */
2575
+ version?: number;
2576
+ /** ID written by CAA Analyser. Not used: the composite layer's own ID prefixes its MapLibre layers. */
2577
+ id?: string;
2578
+ /**
2579
+ * The sub-layers, in draw order, bottom to top. Required: a spec with no layers, such as an empty object, renders
2580
+ * nothing, and {@link validateCompositeLayer} reports it.
2581
+ */
2582
+ layers?: (CompositeSubLayerSpecification | CompositeSubLayerSpecificationV1)[];
2583
+ /** The data sources the sub-layers draw. */
2584
+ dataSources?: CompositeDataSourceSpecification[];
2585
+ /** Unknown keys, kept as they are. */
2586
+ [key: string]: unknown;
2587
+ }
2588
+ /**
2589
+ * The options every composite sub-layer has, in both versions of the stored format.
2590
+ *
2591
+ * @experimental
2592
+ */
2593
+ interface CompositeSubLayerBase {
2594
+ /** Sub-layer ID, unique within the spec. Its MapLibre layers' IDs are `<composite layer ID>__<id>`. */
2595
+ id: string;
2596
+ /** Data source ID: one in the spec's `dataSources`, or a source the application has added to the map. */
2597
+ source: string;
2598
+ /** Filter: a reactive expression, ANDed with the composite layer's. An empty string means no filter. */
2599
+ filter?: string;
2600
+ /**
2601
+ * Set to `false` to leave the sub-layer out of click and hover results. Flow-style sub-layers default to `true`.
2602
+ * MapLibre-style sub-layers default to `true` in version 2 and `false` in version 1, as in legacy.
2603
+ */
2604
+ interactive?: boolean;
2605
+ /** Minimum visible zoom level. Defaults to `0`. */
2606
+ minZoom?: number;
2607
+ /** Maximum visible zoom level. Defaults to `18`. */
2608
+ maxZoom?: number;
2609
+ /** Unknown keys, kept as they are. */
2610
+ [key: string]: unknown;
2611
+ }
2612
+ /**
2613
+ * A version 2 composite sub-layer. It has the shape of `MapLayerOptions`: either a flow layer, with `type: 'flow'` and a
2614
+ * {@link FlowStyle} (which carries its own geometry and `version`), or a MapLibre layer type with a style program, such
2615
+ * as one built with {@link layerStyle}.
2616
+ *
2617
+ * @example
2618
+ * ```js
2619
+ * const points = { id: 'points', type: 'flow', source: 'uk_airports', style: flowLayerStyle('circle').build() };
2620
+ * const icons = { id: 'icons', type: 'symbol', source: 'uk_airports', style: "icon-image: 'airport';" };
2621
+ * ```
2622
+ *
2623
+ * @experimental
2624
+ */
2625
+ type CompositeSubLayerSpecification = (CompositeSubLayerBase & {
2626
+ /** Always `flow`. */
2627
+ type: 'flow';
2628
+ /** Version 2 flow style. */
2629
+ style: FlowStyle;
2630
+ }) | (CompositeSubLayerBase & {
2631
+ /** MapLibre layer type. */
2632
+ type: MapLayerType;
2633
+ /** Style program, such as one built with {@link layerStyle}. */
2634
+ style: string;
2635
+ });
2636
+ /**
2637
+ * A version 1 composite sub-layer, the legacy stored format. Its `type` is the geometry, and its style is wrapped:
2638
+ * `{type: 'flow', …}` for a version 1 flow style, drawn with that geometry, or `{type: 'maplibre', style}` for a style
2639
+ * program. A `symbol` sub-layer needs a MapLibre style.
2640
+ *
2641
+ * MapLibre-style sub-layers are interactive only with `interactive: true`, as in legacy.
2642
+ *
2643
+ * @experimental
2644
+ */
2645
+ interface CompositeSubLayerSpecificationV1 extends CompositeSubLayerBase {
2646
+ /** Geometry. */
2647
+ type: 'circle' | 'line' | 'fill' | 'symbol';
2648
+ /** Stored but not used, as in legacy: the composite layer's own `above` places all its sub-layers. */
2649
+ above?: string;
2650
+ /** Stored but not used, as in legacy: the composite layer's own `below` places all its sub-layers. */
2651
+ below?: string;
2652
+ /** The style: a version 1 flow style, or a MapLibre style program. */
2653
+ style: {
2654
+ type: 'flow';
2655
+ [key: string]: unknown;
2656
+ } | {
2657
+ type: 'maplibre';
2658
+ /** Style program. */
2659
+ style: string;
2660
+ [key: string]: unknown;
2661
+ };
2662
+ }
2663
+ /**
2664
+ * A data source of a composite layer spec. Its ID isn't prefixed with the composite layer's, so composite layers that
2665
+ * name the same data source share it.
2666
+ *
2667
+ * @experimental
2668
+ */
2669
+ interface CompositeDataSourceSpecification {
2670
+ /** Data source ID, shared by every composite layer that uses it. */
2671
+ id: string;
2672
+ /** Data source type. A version 1 data source without `type` is `vector`, as in legacy. */
2673
+ type: MapDataSourceType;
2674
+ /** Dataset or tile source ID, or a URL, taken literally; or, starting with `$`, an application state property. */
2675
+ src: string;
2676
+ /** Feature property to use as the unique feature ID. Selection needs it. */
2677
+ featureId?: string;
2678
+ /** Limit applied to dataset queries. */
2679
+ limit?: number;
2680
+ /** API key for this data source, in place of the application's. */
2681
+ apiKey?: string;
2682
+ /** Set to `true` to cluster GeoJSON points. */
2683
+ cluster?: boolean;
2684
+ /** Cluster radius, for GeoJSON point clustering. */
2685
+ clusterRadius?: number;
2686
+ /** Maximum zoom level to cluster points on, for GeoJSON point clustering. */
2687
+ clusterMaxZoom?: number;
2688
+ /** Selection mode: `single`, `multi` or `none` (the default). Selection needs `featureId` and the `SelectionPlugin`. */
2689
+ selectionMode?: SelectionMode;
2690
+ /** Application state property bound to the selection. A leading `$` is ignored. */
2691
+ selectionState?: string;
2692
+ /** Whether selecting a feature of another data source clears this one's selection: always, never or by group. */
2693
+ selectionClear?: boolean | 'group';
2694
+ /** Selection group, for `selectionClear: 'group'`. */
2695
+ selectionGroup?: string;
2696
+ /** Unknown keys, kept as they are. */
2697
+ [key: string]: unknown;
2698
+ }
2699
+ /**
2700
+ * Builds a version 2 {@link CompositeLayerSpecification}. Create one with {@link compositeLayerSpec}.
2701
+ *
2702
+ * @experimental
2703
+ */
2704
+ interface CompositeLayerSpecBuilder {
2705
+ /**
2706
+ * Adds a data source.
2707
+ *
2708
+ * @param source - Data source.
2709
+ */
2710
+ dataSource(source: CompositeDataSourceSpecification): this;
2711
+ /**
2712
+ * Adds a sub-layer on top of those already added.
2713
+ *
2714
+ * @param layer - Version 2 sub-layer.
2715
+ */
2716
+ layer(layer: CompositeSubLayerSpecification): this;
2717
+ /**
2718
+ * Returns the spec in its stored format, with `version` always set.
2719
+ *
2720
+ * @returns The composite layer spec.
2721
+ */
2722
+ build(): CompositeLayerSpecification;
2723
+ }
2724
+
1916
2725
  interface FlowEngineEndpoint {
1917
2726
  host: string;
1918
2727
  apiKey?: string;
@@ -1926,6 +2735,13 @@ declare class MapDataSource {
1926
2735
  get id(): string;
1927
2736
  get type(): MapDataSourceType;
1928
2737
  get featureId(): string | undefined;
2738
+ /**
2739
+ * Selection options the data source declares, which the
2740
+ * {@link flow-rdf-core/plugins!SelectionPlugin | SelectionPlugin} enables. See {@link MapDataSourceOptions.selection}.
2741
+ *
2742
+ * @experimental
2743
+ */
2744
+ get selection(): SelectionOptions | undefined;
1929
2745
  get dataSourceSpecification(): MapDataSourceSpecification;
1930
2746
  constructor(options: MapDataSourceOptions);
1931
2747
  bindState(state: StateStore | null): this;
@@ -2692,6 +3508,10 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2692
3508
  private _resolveInitialized;
2693
3509
  private _style;
2694
3510
  private _styleUpdateSubscription;
3511
+ private _reportedStyleProblems;
3512
+ private _reportedCompositeIssues;
3513
+ private _checkedCompositeSelection;
3514
+ private _compositeLayerReaction;
2695
3515
  private _throttledMouseMove;
2696
3516
  private _maplibreMap;
2697
3517
  /**
@@ -2773,7 +3593,9 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2773
3593
  */
2774
3594
  get imageRegistry(): ImageRegistry;
2775
3595
  /**
2776
- * Adds a {@link MapLayer} to the map.
3596
+ * Adds a {@link MapLayer} to the map. Throws if the map has no data source the layer uses, or if another map layer
3597
+ * already uses the layer's ID or one of its MapLibre layer IDs. A layer with the ID of a base style layer restyles
3598
+ * that layer, as before.
2777
3599
  *
2778
3600
  * @example
2779
3601
  * Create a new circle layer and add it to the map:
@@ -2792,8 +3614,9 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2792
3614
  */
2793
3615
  addLayer(layer: MapLayer): MapLayer;
2794
3616
  /**
2795
- * Creates a new {@link MapLayer} instance using the provided options
2796
- * and adds it to the map.
3617
+ * Creates a new {@link MapLayer} instance using the provided options and adds it to the map. Throws if the map has
3618
+ * no data source the layer uses, or if another map layer already uses the layer's ID or one of its MapLibre layer
3619
+ * IDs. A layer with the ID of a base style layer restyles that layer, as before.
2797
3620
  *
2798
3621
  * @example
2799
3622
  * Create a new circle layer and add it to the map in a single step:
@@ -2807,8 +3630,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2807
3630
  * .build()
2808
3631
  * });
2809
3632
  * ```
3633
+ *
3634
+ * A composite layer (`type: 'composite'`, see {@link CompositeLayerOptions}) brings its own data sources, and never
3635
+ * throws on its spec: {@link MapLayer.issues} lists the problems, and the map emits each as an `error` event.
2810
3636
  */
2811
- addLayer(layerOptions: MapLayerOptions): MapLayer;
3637
+ addLayer(layerOptions: MapLayerOptions | CompositeLayerOptions): MapLayer;
2812
3638
  /**
2813
3639
  * Adds a {@link MapDataSource} to the map.
2814
3640
  */
@@ -3104,14 +3930,31 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
3104
3930
  * @param plugins - Array of plugin constructors to register
3105
3931
  */
3106
3932
  usePlugins(plugins: PluginConstructor[]): void;
3933
+ /** Makes a source use the map's Flo.w endpoint to expand dataset and tile source IDs to URLs. */
3934
+ private prepareSource;
3107
3935
  private get formattedName();
3108
3936
  private bindMapEvents;
3109
3937
  private featureFromMaplibreFeature;
3110
3938
  /**
3111
3939
  * Queries the rendered features of interactive layers at the mouse position, in top-down draw order so the first
3112
- * is the one drawn on top.
3940
+ * is the one drawn on top. A feature from a sub-layer reports the {@link MapLayer} it belongs to.
3113
3941
  */
3114
3942
  private queryFeatures;
3943
+ /**
3944
+ * Follows the composite layers on the map: emits each new issue of each one as a map error, and checks that a
3945
+ * composite layer that declares selection has the SelectionPlugin to enable it.
3946
+ */
3947
+ private watchCompositeLayers;
3948
+ /** Emits each issue of a composite layer that wasn't among its issues when last reported. */
3949
+ private reportCompositeIssues;
3950
+ /**
3951
+ * Emits one error for each composite layer that declares selection while the SelectionPlugin isn't installed. The
3952
+ * check waits for the code that added the layer to finish, so that it can install the plugin after the layer.
3953
+ */
3954
+ private checkCompositeSelection;
3955
+ private hasPlugin;
3956
+ /** Reports each new problem that {@link MapStyle} found while building the style as a map error. */
3957
+ private reportStyleProblems;
3115
3958
  private featureQueryBox;
3116
3959
  private handleLoading;
3117
3960
  private handleMissingImage;
@@ -3495,4 +4338,4 @@ declare class FlowContext<TState extends StateStore = StateStore> {
3495
4338
  evaluateExpression(expr: string): any;
3496
4339
  }
3497
4340
 
3498
- export { type MapOptions as $, type Annotation as A, BackgroundLayerStyleBuilder as B, CircleLayerStyleBuilder as C, DEFAULT_CONTEXT_ID as D, type MapLayerExpression as E, type FlowContextOptions as F, type MapLayerSpecification as G, HeatmapLayerStyleBuilder as H, type MapLayerPropertyMetadataIndex as I, type MapDataSourceType as J, type MapDataSourceOptions as K, LineLayerStyleBuilder as L, type MapStyleSpecification as M, type MapDataSourceSpecification as N, type MapGeojsonData as O, type ParserExpression as P, QueryRegistry as Q, ReactiveExpression as R, StateStore as S, type MapAnimationOptions as T, type MapCenterOptions as U, type MapFeature as V, type MapFeatureIdentifier as W, type MapPaddingOptions as X, type MapSourceIdentifier as Y, MapFeatureStream as Z, type FeatureStreamOptions as _, MapDataSource as a, FlowCoreMap as a0, type MapEventTypes as a1, type MapEventType as a2, MapEvent as a3, MapMouseEvent as a4, MapSourceEvent as a5, MapLoadingEvent as a6, MapStyleChangeEvent as a7, type MapPopupTemplateFn as a8, type MapPopupOptions as a9, type PluginEventsType as aA, type PluginConstructor as aB, type EventHandlers as aC, MapPopup as aa, Query as ab, query as ac, queryMany as ad, queryOne as ae, type QueryResultFormat as af, type QueryAttribute as ag, type QueryWhereClauses as ah, type QueryExtraParams as ai, type QueryOrderClause as aj, type QuerySampleOptions as ak, type QueryDefinition as al, type QueryOptions as am, type QueryDefinitionFn as an, type QueryResultTransformFn as ao, traceReaction as ap, type Path as aq, type PathValue as ar, type StoreConstructor as as, type StoreAnnotations as at, type SerializationFormat as au, type MapFeatureId as av, MapPluginBase as aw, PluginManager as ax, type PartialBy as ay, type PluginOptionsType as az, MapLayer as b, FlowContext as c, FlowCoreError as d, FlowCoreExpressionError as e, FlowMapError as f, MapRegistry as g, type FlowCoreExpressionCustomFunction as h, type FlowCoreExpressionCustomFunctionSignature as i, type FlowCoreExpressionCustomFunctions as j, type ParserExpressionWithIndex as k, type ParserFunctionExpression as l, type ParserIndex as m, type ParserProgram as n, type FlowEngineEndpoint as o, type MapLayerType as p, FillLayerStyleBuilder as q, SymbolLayerStyleBuilder as r, FillExtrusionLayerStyleBuilder as s, RasterLayerStyleBuilder as t, HillshadeLayerStyleBuilder as u, layerStyle as v, MapLayerStyleBuilder as w, StyleExpression as x, expr as y, type MapLayerOptions as z };
4341
+ export { expr as $, type Annotation as A, type FlowStyleNamedSize as B, type CompositeLayerSpecBuilder as C, DEFAULT_CONTEXT_ID as D, type FlowStyleProperty as E, type FlowStyle as F, type FlowStyleSize as G, type FlowValue as H, type FlowEngineEndpoint as I, type MapLayerType as J, FillLayerStyleBuilder as K, LineLayerStyleBuilder as L, MapDataSource as M, SymbolLayerStyleBuilder as N, CircleLayerStyleBuilder as O, type ParserExpression as P, QueryRegistry as Q, ReactiveExpression as R, StateStore as S, HeatmapLayerStyleBuilder as T, FillExtrusionLayerStyleBuilder as U, RasterLayerStyleBuilder as V, HillshadeLayerStyleBuilder as W, BackgroundLayerStyleBuilder as X, layerStyle as Y, MapLayerStyleBuilder as Z, StyleExpression as _, type CompositeLayerSpecification as a, type MapLayerOptions as a0, type CompositeLayerOptions as a1, type MapSubLayerOptions as a2, type MapLayerExpression as a3, type MapLayerSpecification as a4, type MapLayerPropertyMetadataIndex as a5, type MapDataSourceType as a6, type MapDataSourceOptions as a7, type SelectionMode as a8, type SelectionOptions as a9, type QueryResultFormat as aA, type QueryAttribute as aB, type QueryWhereClauses as aC, type QueryExtraParams as aD, type QueryOrderClause as aE, type QuerySampleOptions as aF, type QueryDefinition as aG, type QueryOptions as aH, type QueryDefinitionFn as aI, type QueryResultTransformFn as aJ, traceReaction as aK, type Path as aL, type PathValue as aM, type StoreConstructor as aN, type StoreAnnotations as aO, type SerializationFormat as aP, MapPluginBase as aQ, PluginManager as aR, type PartialBy as aS, type MapFeatureId as aT, type PluginOptionsType as aU, type PluginEventsType as aV, type PluginConstructor as aW, type EventHandlers as aX, type MapDataSourceSpecification as aa, type MapGeojsonData as ab, type MapAnimationOptions as ac, type MapCenterOptions as ad, type MapFeature as ae, type MapFeatureIdentifier as af, type MapPaddingOptions as ag, type MapSourceIdentifier as ah, MapFeatureStream as ai, type FeatureStreamOptions as aj, type MapOptions as ak, FlowCoreMap as al, type MapEventTypes as am, type MapEventType as an, MapEvent as ao, MapMouseEvent as ap, MapSourceEvent as aq, MapLoadingEvent as ar, MapStyleChangeEvent as as, type MapPopupTemplateFn as at, type MapPopupOptions as au, MapPopup as av, Query as aw, query as ax, queryMany as ay, queryOne as az, type FlowStyleIssue as b, type FlowStyleLayerType as c, type FlowLayerStyleBuilder as d, type FlowStyleDataDriven as e, type MapStyleSpecification as f, MapLayer as g, type FlowContextOptions as h, FlowContext as i, FlowCoreError as j, FlowCoreExpressionError as k, FlowMapError as l, MapRegistry as m, type FlowCoreExpressionCustomFunction as n, type FlowCoreExpressionCustomFunctionSignature as o, type FlowCoreExpressionCustomFunctions as p, type ParserExpressionWithIndex as q, type ParserFunctionExpression as r, type ParserIndex as s, type ParserProgram as t, type CompositeDataSourceSpecification as u, type CompositeSubLayerBase as v, type CompositeSubLayerSpecification as w, type CompositeSubLayerSpecificationV1 as x, type FlowStyleDataDrivenOptions as y, type FlowStyleExpression as z };