@emuanalytics/flow-rdf-core 4.1.7 → 4.2.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.
@@ -593,6 +593,281 @@ 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
+
630
+ /**
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.
729
+ *
730
+ * @example
731
+ * A circle style with a data-driven fill color and a label:
732
+ * ```js
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
+ * };
740
+ * ```
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.
777
+ *
778
+ * @experimental
779
+ */
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 {
790
+ /**
791
+ * Sets the fill color of circles and polygons.
792
+ *
793
+ * @param value - Color, expression or data-driven table.
794
+ */
795
+ fillColor(value: FlowValue<string>): this;
796
+ /**
797
+ * Sets the color of circle outlines, polygon outlines and lines.
798
+ *
799
+ * @param value - Color, expression or data-driven table.
800
+ */
801
+ strokeColor(value: FlowValue<string>): this;
802
+ /**
803
+ * Sets the width of circle outlines, polygon outlines and lines.
804
+ *
805
+ * @param value - Width in pixels, named size, expression or data-driven table.
806
+ */
807
+ strokeWidth(value: FlowValue<FlowStyleSize>): this;
808
+ /**
809
+ * Sets the circle radius. Only used by `circle` styles.
810
+ *
811
+ * @param value - Radius in pixels, named size, expression or data-driven table.
812
+ */
813
+ radius(value: FlowValue<FlowStyleSize>): this;
814
+ /**
815
+ * Sets the opacity of the geometry, its outline and its label.
816
+ *
817
+ * @param value - Opacity from `0` to `1`, expression or data-driven table.
818
+ */
819
+ opacity(value: FlowValue<number>): this;
820
+ /**
821
+ * Sets the label text. Use an expression such as `expr('@name')` to label each feature with a feature property.
822
+ *
823
+ * @param value - Text, expression or data-driven table.
824
+ */
825
+ labelText(value: FlowValue<string>): this;
826
+ /**
827
+ * Sets the label text color.
828
+ *
829
+ * @param value - Color, expression or data-driven table.
830
+ */
831
+ labelColor(value: FlowValue<string>): this;
832
+ /**
833
+ * Sets the color of the halo around the label text.
834
+ *
835
+ * @param value - Color, expression or data-driven table.
836
+ */
837
+ labelHaloColor(value: FlowValue<string>): this;
838
+ /**
839
+ * Sets the label text size.
840
+ *
841
+ * @param value - Size in pixels, named size, expression or data-driven table.
842
+ */
843
+ labelSize(value: FlowValue<FlowStyleSize>): this;
844
+ /**
845
+ * Sets whether the layer is visible.
846
+ *
847
+ * @param value - Visibility, expression or data-driven table.
848
+ */
849
+ visibility(value: FlowValue<boolean>): this;
850
+ /**
851
+ * Returns the flow style in its stored format, with `version` always set.
852
+ *
853
+ * @returns The flow style.
854
+ */
855
+ build(): FlowStyle;
856
+ }
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';
869
+ }
870
+
596
871
  /**
597
872
  * A Flo.w RDF reactive expression - used internally to parse and evaluate {@link MapLayer}
598
873
  * style [expressions](/flow-rdf/flow-rdf-core/expression-reference/). An expression can be evaluated
@@ -770,40 +1045,6 @@ interface ParserIndex {
770
1045
  column: number;
771
1046
  }
772
1047
 
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;
778
- /**
779
- * Whether this layer is displayed.
780
- *
781
- * @param value - visible value (default `true`)
782
- */
783
- visibility(value: boolean | StyleExpression): this;
784
- /**
785
- * Create a style specification string.
786
- *
787
- * Call this method after setting all style properties
788
- * on the style builder.
789
- *
790
- * @returns Layer style specification string
791
- */
792
- build(): string;
793
- /**
794
- * Format and add style property to the style builder.
795
- */
796
- protected addStyle(property: string, value: unknown): void;
797
- private formatValue;
798
- }
799
- declare class StyleExpression {
800
- private _expr;
801
- __styleExpression: string;
802
- constructor(_expr: string);
803
- toString(): string;
804
- }
805
- declare function expr(expr: string): StyleExpression;
806
-
807
1048
  /**
808
1049
  * WARNING - this file is auto generated
809
1050
  */
@@ -1768,8 +2009,19 @@ declare function layerStyle(layerType: 'background'): BackgroundLayerStyleBuilde
1768
2009
  interface MapLayerOptions {
1769
2010
  /** Layer ID. */
1770
2011
  id: string;
1771
- /** Layer type. */
1772
- type: MapLayerType;
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.
2018
+ *
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.
2023
+ */
2024
+ type: MapLayerType | 'flow';
1773
2025
  /** Map data source to display. */
1774
2026
  source: string;
1775
2027
  /** Map data source layer to display. (Applicable to 'vector'-type data sources). */
@@ -1783,7 +2035,52 @@ interface MapLayerOptions {
1783
2035
  above?: string;
1784
2036
  below?: string;
1785
2037
  filter?: string;
2038
+ /**
2039
+ * Layer style. For a MapLibre layer type, a style program, such as one built with {@link layerStyle}. For a `flow`
2040
+ * layer, a version 2 {@link FlowStyle}, such as one built with {@link flowLayerStyle}.
2041
+ *
2042
+ * A flow layer never throws on a bad flow style: it renders the valid properties and lists the problems in
2043
+ * {@link MapLayer.issues}.
2044
+ */
2045
+ style?: string | FlowStyle;
2046
+ /**
2047
+ * Metadata copied to the `metadata` of the layer's MapLibre layers. Use it to attach application data to a layer,
2048
+ * such as the group it belongs to.
2049
+ *
2050
+ * @experimental
2051
+ */
2052
+ metadata?: Record<string, unknown>;
2053
+ }
2054
+ /**
2055
+ * One MapLibre layer of a {@link MapLayer} that renders as several, given to the layer with
2056
+ * {@link MapLayer.setSubLayers}. The layer's `filter`, `minZoom`, `maxZoom`, `interactive`, `metadata` and the
2057
+ * visibility from {@link MapLayer.setVisibility} apply to every sub-layer.
2058
+ *
2059
+ * @internal
2060
+ */
2061
+ interface MapSubLayerOptions {
2062
+ /** MapLibre layer ID, in full (for example `airports__stroke`). Unique on the map. */
2063
+ id: string;
2064
+ /** MapLibre layer type. */
2065
+ type: MapLayerType;
2066
+ /** Style program for the MapLibre layer type, as {@link MapLayerOptions.style}. */
1786
2067
  style?: string;
2068
+ /** Set to `false` to leave the sub-layer out of click and hover results. ANDed with the layer's. Defaults to `true`. */
2069
+ interactive?: boolean;
2070
+ /** Keys merged over the layer's metadata, for this sub-layer only. */
2071
+ metadata?: Record<string, unknown>;
2072
+ /** Map data source to display. Defaults to the layer's source. */
2073
+ source?: string;
2074
+ /**
2075
+ * Map data source layer to display. Defaults to the layer's source layer when the sub-layer uses the layer's source.
2076
+ */
2077
+ sourceLayer?: string;
2078
+ /** Filter for this sub-layer, ANDed with the layer's. */
2079
+ filter?: string;
2080
+ /** Minimum visible zoom level, within the layer's range. */
2081
+ minZoom?: number;
2082
+ /** Maximum visible zoom level, within the layer's range. */
2083
+ maxZoom?: number;
1787
2084
  }
1788
2085
  type MapLayerExpression = ParserExpression;
1789
2086
  interface MapLayerSpecification {
@@ -1826,7 +2123,71 @@ declare class MapLayer {
1826
2123
  private _filter;
1827
2124
  private _paintProps;
1828
2125
  private _layoutProps;
2126
+ private _visibility;
2127
+ private _subLayers;
2128
+ private _flow;
2129
+ private _issues;
2130
+ private _invalidInteractive;
2131
+ /**
2132
+ * The specification of the layer's own MapLibre layer. A layer that renders as several MapLibre layers, such as a
2133
+ * flow layer, doesn't render this one.
2134
+ */
1829
2135
  get layerSpecification(): MapLayerSpecification;
2136
+ /**
2137
+ * The specifications of every MapLibre layer the layer renders as, in draw order: its sub-layers', or its own.
2138
+ *
2139
+ * @internal
2140
+ */
2141
+ get layerSpecifications(): MapLayerSpecification[];
2142
+ /**
2143
+ * IDs of the MapLibre layers the layer renders as, in draw order.
2144
+ *
2145
+ * @internal
2146
+ */
2147
+ get maplibreLayerIds(): string[];
2148
+ /**
2149
+ * IDs of the MapLibre layers whose features click and hover events report, as this layer.
2150
+ *
2151
+ * @internal
2152
+ */
2153
+ get interactiveLayerIds(): string[];
2154
+ /**
2155
+ * IDs of the map data sources the layer's MapLibre layers display.
2156
+ *
2157
+ * @internal
2158
+ */
2159
+ get sourceIds(): string[];
2160
+ /**
2161
+ * The layer's sub-layers, or `null` for a layer that renders as one MapLibre layer.
2162
+ *
2163
+ * @internal
2164
+ */
2165
+ get subLayers(): readonly MapSubLayerOptions[] | null;
2166
+ /**
2167
+ * Layer metadata, copied to the `metadata` of the layer's MapLibre layers.
2168
+ *
2169
+ * @experimental
2170
+ */
2171
+ get metadata(): Record<string, unknown> | undefined;
2172
+ /**
2173
+ * A flow layer's style, in its stored format and version, ready to save. A copy: change the layer with
2174
+ * {@link setStyle} and {@link setStyleProperty}. `undefined` for a MapLibre layer.
2175
+ *
2176
+ * Reading it in a MobX reaction, or a component that renders from state, tracks changes to the style.
2177
+ *
2178
+ * @experimental
2179
+ */
2180
+ get flowStyle(): FlowStyle | undefined;
2181
+ /**
2182
+ * The problems with a flow layer's style, updated whenever the style changes. An `error` means a property, or the
2183
+ * whole style, isn't rendered; a `warning` means it is rendered anyway. Empty for a MapLibre layer, which throws on a
2184
+ * bad style instead.
2185
+ *
2186
+ * The list is observable: read it in a MobX reaction to follow it.
2187
+ *
2188
+ * @experimental
2189
+ */
2190
+ get issues(): FlowStyleIssue[];
1830
2191
  get id(): string;
1831
2192
  get type(): string;
1832
2193
  get source(): string;
@@ -1840,15 +2201,90 @@ declare class MapLayer {
1840
2201
  setInteractive(interactive: boolean): this;
1841
2202
  setAbove(layerId: string | undefined): this;
1842
2203
  setBelow(layerId: string | undefined): this;
1843
- setStyle(styleProgram: string): void;
1844
2204
  /**
1845
- * Set an individual style property.
2205
+ * Replaces the layer's style.
2206
+ *
2207
+ * - **MapLibre layer types**: sets each property of a style program, such as one built with {@link layerStyle}.
2208
+ * Properties the program doesn't set are kept. Throws on an invalid program or an unknown property.
2209
+ * - **Flow layers**: replaces the whole flow style with a version 2 {@link FlowStyle}, such as one built with
2210
+ * {@link flowLayerStyle}. The layer's MapLibre layers are updated in place, without reloading the source. Never
2211
+ * throws: a property with a problem isn't rendered, the rest is, and {@link issues} lists the problems.
2212
+ *
2213
+ * @param style - Style program for a MapLibre layer, or flow style for a flow layer.
2214
+ */
2215
+ setStyle(style: string | FlowStyle): void;
2216
+ /**
2217
+ * Sets or removes one style property. Its value follows different rules for MapLibre layers and flow layers.
2218
+ *
2219
+ * - **MapLibre layer types**: `property` is a MapLibre paint or layout property, such as `circle-color`, and a string
2220
+ * `value` is a reactive expression, so `'red'` is the color red and `'@color'` the feature property `color`.
2221
+ * Throws on an unknown property or an expression that doesn't parse.
2222
+ * - **Flow layers**: `property` is a {@link FlowStyle} property, such as `fillColor`, and `value` follows flow
2223
+ * rules, as in {@link flowLayerStyle}: a bare value is a literal, so `'@color'` is the text `@color`; `expr('…')`
2224
+ * makes a reactive expression, such as `expr('@color')` or `expr("@@hover ? 'yellow' : 'white'")`; and a
2225
+ * {@link FlowStyleDataDriven} table makes an expression with the table attached. The layer's MapLibre layers are
2226
+ * updated in place, without reloading the source, and {@link flowStyle} returns the edited style. Never throws:
2227
+ * {@link issues} lists any problems.
2228
+ *
2229
+ * @example
2230
+ * The same edit on a MapLibre layer and on a flow layer:
2231
+ * ```js
2232
+ * circleLayer.setStyleProperty('circle-stroke-color', "@@hover ? 'yellow' : 'white'");
2233
+ * flowLayer.setStyleProperty('strokeColor', expr("@@hover ? 'yellow' : 'white'"));
2234
+ * ```
1846
2235
  *
1847
- * @param property Property name.
1848
- * @param expression Property style expression.
2236
+ * @param property - Property name.
2237
+ * @param value - Property value, or `null` to remove the property.
1849
2238
  */
1850
- setStyleProperty(property: string, expression: string | null): void;
2239
+ setStyleProperty(property: string, value: FlowValue<string | number | boolean> | FlowStyleExpression<unknown> | null): void;
1851
2240
  setFilter(expression: string | null): void;
2241
+ /**
2242
+ * Shows or hides every MapLibre layer of the layer, overriding the `visibility` of their style programs.
2243
+ *
2244
+ * @param visibility - Reactive expression or boolean. Specify `null` to leave visibility to the style programs.
2245
+ * @internal
2246
+ */
2247
+ setVisibility(visibility: string | boolean | null): void;
2248
+ /**
2249
+ * Makes the layer render as an ordered group of MapLibre layers, its sub-layers, instead of one. The first sub-layer
2250
+ * is drawn lowest. Replacing the sub-layers updates the map in place: MapLibre layers whose IDs persist are restyled,
2251
+ * and their sources aren't reloaded. The layer's own style program isn't rendered while it has sub-layers.
2252
+ *
2253
+ * @param subLayers - Sub-layers in draw order. An empty list renders nothing. Specify `null` to render the layer as
2254
+ * one MapLibre layer again.
2255
+ * @throws {@link FlowCoreError} if two sub-layers have the same ID, or a sub-layer's type, style program or filter
2256
+ * is invalid. The layer's sub-layers are then unchanged.
2257
+ * @internal
2258
+ */
2259
+ setSubLayers(subLayers: readonly MapSubLayerOptions[] | null): void;
2260
+ /**
2261
+ * Loads a version 1 flow style, the legacy stored format, into a flow layer, with its geometry. The layer then keeps
2262
+ * version 1: {@link setStyleProperty} writes version 1 forms, {@link setStyle} converts a version 2 style to version 1
2263
+ * (keeping the layer's geometry), and {@link flowStyle} returns version 1, so the style saves back in the format old
2264
+ * CAA Analyser reads. Loading and saving an unchanged style gives a deep-equal style. Never throws.
2265
+ *
2266
+ * Use `createVersion1FlowLayer()` (`flow-style/version1-flow-layer.ts`) to build such a layer.
2267
+ *
2268
+ * @param style - The style as stored: a version 1 style (`type: 'flow'`, `version` 1 or missing), or anything else,
2269
+ * which {@link issues} reports.
2270
+ * @param geometry - The geometry: the composite sub-layer's `type`, `circle`, `line` or `fill`.
2271
+ * @internal
2272
+ */
2273
+ setVersion1FlowStyle(style: unknown, geometry: unknown): void;
2274
+ /** Replaces a flow layer's style, under the version rules of the layer. */
2275
+ private replaceFlowStyle;
2276
+ /**
2277
+ * A version 2 style, written in version 1 form for a version 1 layer: each property as {@link setStyleProperty}
2278
+ * writes it. The layer's geometry stays; a different one in the style is a warning.
2279
+ */
2280
+ private convertToVersion1;
2281
+ /** Sets or removes one property of a flow layer's style, under the style's version rules. */
2282
+ private setFlowStyleProperty;
2283
+ /** Sets a flow layer's style, and renders it as sub-layers. */
2284
+ private updateFlowLayer;
2285
+ /** The MapLibre layer specification of a sub-layer, with the layer's shared settings applied. */
2286
+ private subLayerSpecification;
2287
+ private visibilityValue;
1852
2288
  private formattedName;
1853
2289
  private getPropertyMetadata;
1854
2290
  private static initializePropertyMetadataIndex;
@@ -2692,6 +3128,7 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2692
3128
  private _resolveInitialized;
2693
3129
  private _style;
2694
3130
  private _styleUpdateSubscription;
3131
+ private _reportedStyleProblems;
2695
3132
  private _throttledMouseMove;
2696
3133
  private _maplibreMap;
2697
3134
  /**
@@ -2773,7 +3210,9 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2773
3210
  */
2774
3211
  get imageRegistry(): ImageRegistry;
2775
3212
  /**
2776
- * Adds a {@link MapLayer} to the map.
3213
+ * Adds a {@link MapLayer} to the map. Throws if the map has no data source the layer uses, or if another map layer
3214
+ * already uses the layer's ID or one of its MapLibre layer IDs. A layer with the ID of a base style layer restyles
3215
+ * that layer, as before.
2777
3216
  *
2778
3217
  * @example
2779
3218
  * Create a new circle layer and add it to the map:
@@ -2792,8 +3231,9 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
2792
3231
  */
2793
3232
  addLayer(layer: MapLayer): MapLayer;
2794
3233
  /**
2795
- * Creates a new {@link MapLayer} instance using the provided options
2796
- * and adds it to the map.
3234
+ * Creates a new {@link MapLayer} instance using the provided options and adds it to the map. Throws if the map has
3235
+ * no data source the layer uses, or if another map layer already uses the layer's ID or one of its MapLibre layer
3236
+ * IDs. A layer with the ID of a base style layer restyles that layer, as before.
2797
3237
  *
2798
3238
  * @example
2799
3239
  * Create a new circle layer and add it to the map in a single step:
@@ -3109,9 +3549,11 @@ declare class FlowCoreMap<TState extends StateStore = StateStore> extends EventE
3109
3549
  private featureFromMaplibreFeature;
3110
3550
  /**
3111
3551
  * 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.
3552
+ * is the one drawn on top. A feature from a sub-layer reports the {@link MapLayer} it belongs to.
3113
3553
  */
3114
3554
  private queryFeatures;
3555
+ /** Reports each new problem that {@link MapStyle} found while building the style as a map error. */
3556
+ private reportStyleProblems;
3115
3557
  private featureQueryBox;
3116
3558
  private handleLoading;
3117
3559
  private handleMissingImage;
@@ -3495,4 +3937,4 @@ declare class FlowContext<TState extends StateStore = StateStore> {
3495
3937
  evaluateExpression(expr: string): any;
3496
3938
  }
3497
3939
 
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 };
3940
+ export { type MapDataSourceType as $, type Annotation as A, type MapLayerType as B, FillLayerStyleBuilder as C, DEFAULT_CONTEXT_ID as D, SymbolLayerStyleBuilder as E, type FlowStyleLayerType as F, CircleLayerStyleBuilder as G, HeatmapLayerStyleBuilder as H, FillExtrusionLayerStyleBuilder as I, RasterLayerStyleBuilder as J, HillshadeLayerStyleBuilder as K, LineLayerStyleBuilder as L, type MapStyleSpecification as M, BackgroundLayerStyleBuilder as N, layerStyle as O, type ParserExpression as P, QueryRegistry as Q, ReactiveExpression as R, StateStore as S, MapLayerStyleBuilder as T, StyleExpression as U, expr as V, type MapLayerOptions as W, type MapSubLayerOptions as X, type MapLayerExpression as Y, type MapLayerSpecification as Z, type MapLayerPropertyMetadataIndex as _, type FlowLayerStyleBuilder as a, type MapDataSourceOptions as a0, type MapDataSourceSpecification as a1, type MapGeojsonData as a2, type MapAnimationOptions as a3, type MapCenterOptions as a4, type MapFeature as a5, type MapFeatureIdentifier as a6, type MapPaddingOptions as a7, type MapSourceIdentifier as a8, MapFeatureStream as a9, type QueryResultTransformFn as aA, traceReaction as aB, type Path as aC, type PathValue as aD, type StoreConstructor as aE, type StoreAnnotations as aF, type SerializationFormat as aG, type MapFeatureId as aH, MapPluginBase as aI, PluginManager as aJ, type PartialBy as aK, type PluginOptionsType as aL, type PluginEventsType as aM, type PluginConstructor as aN, type EventHandlers as aO, type FeatureStreamOptions as aa, type MapOptions as ab, FlowCoreMap as ac, type MapEventTypes as ad, type MapEventType as ae, MapEvent as af, MapMouseEvent as ag, MapSourceEvent as ah, MapLoadingEvent as ai, MapStyleChangeEvent as aj, type MapPopupTemplateFn as ak, type MapPopupOptions as al, MapPopup as am, Query as an, query as ao, queryMany as ap, queryOne as aq, type QueryResultFormat as ar, type QueryAttribute as as, type QueryWhereClauses as at, type QueryExtraParams as au, type QueryOrderClause as av, type QuerySampleOptions as aw, type QueryDefinition as ax, type QueryOptions as ay, type QueryDefinitionFn as az, type FlowStyleDataDriven as b, type FlowStyleIssue as c, MapDataSource as d, MapLayer as e, type FlowContextOptions as f, FlowContext as g, FlowCoreError as h, FlowCoreExpressionError as i, FlowMapError as j, MapRegistry as k, type FlowCoreExpressionCustomFunction as l, type FlowCoreExpressionCustomFunctionSignature as m, type FlowCoreExpressionCustomFunctions as n, type ParserExpressionWithIndex as o, type ParserFunctionExpression as p, type ParserIndex as q, type ParserProgram as r, type FlowStyle as s, type FlowStyleDataDrivenOptions as t, type FlowStyleExpression as u, type FlowStyleNamedSize as v, type FlowStyleProperty as w, type FlowStyleSize as x, type FlowValue as y, type FlowEngineEndpoint as z };