@feltmaps/js-sdk 1.5.0-next.1 → 1.5.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { E as Element, G as Geometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, L as Layer, f as GetLayersConstraint, g as LayerChangeCallbackParams, h as LayerGroup, i as GetLayerGroupsConstraint, j as LayerGroupChangeCallbackParams, k as LegendItemIdentifier, l as LegendItem, m as LegendItemsConstraint, n as LegendItemChangeCallbackParams, o as LayerFilters, F as Filters, p as GetRenderedFeaturesConstraint, q as Feature, M as MapInteractionEvent, r as EntityNode, s as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, v as SetViewportCenterZoomParams, w as ViewportFitBoundsParams, x as ViewportCenterZoom } from './types-CVxZMwC_.js';
2
- export { a0 as CircleToolSettings, H as ElementGroupNode, J as ElementNode, K as FeatureNode, P as FeltBoundary, Q as FeltZoom, A as FilterExpression, B as FilterLogicGate, D as FilterTernary, a1 as HighlighterToolSettings, U as LatLng, N as LayerGroupNode, O as LayerNode, y as LayerProcessingStatus, W as LineStringGeometry, a2 as LineToolSettings, X as LngLatTuple, a3 as MarkerToolSettings, Y as MultiLineStringGeometry, Z as MultiPolygonGeometry, a4 as NoteToolSettings, a5 as PinFrame, a6 as PinSymbol, a7 as PinToolSettings, _ as PointGeometry, $ as PolygonGeometry, a8 as PolygonToolSettings, R as RasterValue, a9 as RouteToolSettings, aa as TextToolSettings } from './types-CVxZMwC_.js';
1
+ import { E as Element, G as GeoJsonGeometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as LayerFeature, t as GeoJsonFeature, u as GetLayerCategoriesParams, v as GetLayerCategoriesGroup, w as GetLayerHistogramParams, x as GetLayerHistogramBin, A as AggregationMethod, y as GetLayerCalculationParams, M as MapInteractionEvent, z as MapDetails, B as EntityNode, C as FeatureSelection, T as ToolType, I as InputToolSettings, D as ConfigurableToolType, H as ToolSettingsMap, J as ToolSettingsChangeEvent, K as zInfer, N as SortConfig, V as ViewportState, O as SetViewportCenterZoomParams, P as ViewportConstraints, Q as ViewportFitBoundsParams, R as ViewportCenterZoom } from './types-CWwhAtt1.js';
2
+ export { aq as AggregationConfig, U as CircleElementCreate, W as CircleElementRead, X as CircleElementUpdate, aK as CircleToolSettings, at as ElementGroupNode, au as ElementNode, av as FeatureNode, ay as FeltBoundary, az as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aA as GeoJsonProperties, Y as HighlighterElementCreate, Z as HighlighterElementRead, _ as HighlighterElementUpdate, aL as HighlighterToolSettings, $ as ImageElementCreate, a0 as ImageElementRead, a1 as ImageElementUpdate, aB as LatLng, aw as LayerGroupNode, ax as LayerNode, al as LayerProcessingStatus, aC as LineStringGeometry, aM as LineToolSettings, a2 as LinkElementRead, aD as LngLatTuple, a3 as MarkerElementCreate, a4 as MarkerElementRead, a5 as MarkerElementUpdate, aN as MarkerToolSettings, ar as MultiAggregationConfig, aE as MultiLineStringGeometry, aF as MultiPointGeometry, aG as MultiPolygonGeometry, a6 as NoteElementCreate, a7 as NoteElementRead, a8 as NoteElementUpdate, aO as NoteToolSettings, a9 as PathElementCreate, aa as PathElementRead, ab as PathElementUpdate, aP as PinToolSettings, ac as PlaceElementCreate, ad as PlaceElementRead, ae as PlaceElementUpdate, aQ as PlaceFrame, aR as PlaceSymbol, aH as PointGeometry, af as PolygonElementCreate, ag as PolygonElementRead, ah as PolygonElementUpdate, aI as PolygonGeometry, aS as PolygonToolSettings, am as RasterValue, aT as RouteToolSettings, aJ as SortDirection, ai as TextElementCreate, aj as TextElementRead, ak as TextElementUpdate, aU as TextToolSettings, as as ValueConfiguration } from './types-CWwhAtt1.js';
3
3
  import { z } from 'zod';
4
4
 
5
5
  /**
@@ -37,7 +37,7 @@ interface ElementsController {
37
37
  /**
38
38
  * The id of the element you want to get the geometry of.
39
39
  */
40
- id: string): Promise<Geometry | null>;
40
+ id: string): Promise<GeoJsonGeometry | null>;
41
41
  /**
42
42
  * Gets elements from the map, according to the constraints supplied. If no
43
43
  * constraints are supplied, all elements will be returned.
@@ -62,7 +62,7 @@ interface ElementsController {
62
62
  *
63
63
  * @example
64
64
  * ```typescript
65
- * felt.getElementGroup("element-group-1");
65
+ * const elementGroup = await felt.getElementGroup("element-group-1");
66
66
  * ```
67
67
  * @returns The requested element group.
68
68
  */
@@ -91,9 +91,87 @@ interface ElementsController {
91
91
  * ```
92
92
  */
93
93
  setElementGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
94
+ /**
95
+ * Adds a listener for when an element is created.
96
+ *
97
+ * @returns A function to unsubscribe from the listener
98
+ *
99
+ * @event
100
+ * @example
101
+ * ```typescript
102
+ * const unsubscribe = felt.onElementCreate({
103
+ * handler: (element) => console.log(element.id),
104
+ * });
105
+ *
106
+ * // later on...
107
+ * unsubscribe();
108
+ * ```
109
+ */
110
+ onElementCreate(args: {
111
+ /**
112
+ * The handler that is called when an element is created.
113
+ *
114
+ * This will fire when elements are created programatically, or when the
115
+ * user starts creating an element with a drawing tool.
116
+ *
117
+ * When the user creates an element with a drawing tool, it can begin in
118
+ * an invalid state, such as if you've just placed a single point in a polygon.
119
+ *
120
+ * You can use the `isBeingCreated` property to determine if the element is
121
+ * still being created by a drawing tool.
122
+ *
123
+ * If you want to know when the element is finished being created, you can
124
+ * use the `onToolCreateElementEnd` listener.
125
+ *
126
+ * @param change - An object describing the change that occurred.
127
+ */
128
+ handler: (change: ElementChangeCallbackParams) => void;
129
+ }): VoidFunction;
130
+ /**
131
+ * Listens for when a new element is finished being created by a drawing tool.
132
+ *
133
+ * This differs from the `onElementCreate` listener, which fires whenever an
134
+ * element is first created. This fires when the user finishes creating an element
135
+ * which could be after a series of interactions.
136
+ *
137
+ * For example, when creating a polygon, the user places a series of points then
138
+ * finishes by pressing Enter or Escape. Or when creating a Place element, they
139
+ * add the marker, type a label, then finally deselect the element.
140
+ *
141
+ * @returns A function to unsubscribe from the listener
142
+ *
143
+ * @example
144
+ * ```typescript
145
+ * const unsubscribe = felt.onToolCreatedElement({
146
+ * handler: (params) => console.log(params),
147
+ * });
148
+ *
149
+ * // later on...
150
+ * unsubscribe();
151
+ * ```
152
+ */
153
+ onElementCreateEnd(args: {
154
+ /**
155
+ * The handler to call whenever this event fires.
156
+ *
157
+ * @param params - An object containing the element that was created.
158
+ */
159
+ handler: (params: {
160
+ element: Element;
161
+ }) => void;
162
+ }): VoidFunction;
94
163
  /**
95
164
  * Adds a listener for when an element changes.
96
165
  *
166
+ * This will fire when an element is being edited, either on the map by the user
167
+ * or programatically.
168
+ *
169
+ * Like the `onElementCreate` listener, this will fire when an element is
170
+ * still being created by a drawing tool.
171
+ *
172
+ * You can check the `isBeingCreated` property to determine if the element is
173
+ * still being created by a drawing tool.
174
+ *
97
175
  * @returns A function to unsubscribe from the listener
98
176
  *
99
177
  * @event
@@ -124,6 +202,35 @@ interface ElementsController {
124
202
  */
125
203
  change: ElementChangeCallbackParams) => void;
126
204
  }): VoidFunction;
205
+ /**
206
+ * Adds a listener for when an element is deleted.
207
+ *
208
+ * @returns A function to unsubscribe from the listener
209
+ *
210
+ * @event
211
+ * @example
212
+ * ```typescript
213
+ * const unsubscribe = felt.onElementDelete({
214
+ * options: { id: "element-1" },
215
+ * handler: (element) => console.log(element.id),
216
+ * });
217
+ *
218
+ * // later on...
219
+ * unsubscribe();
220
+ * ```
221
+ */
222
+ onElementDelete(args: {
223
+ options: {
224
+ /**
225
+ * The id of the element to listen for deletions of.
226
+ */
227
+ id: string;
228
+ };
229
+ /**
230
+ * The handler that is called when the element is deleted.
231
+ */
232
+ handler: () => void;
233
+ }): VoidFunction;
127
234
  /**
128
235
  * Adds a listener for when an element group changes.
129
236
  *
@@ -147,6 +254,44 @@ interface ElementsController {
147
254
  };
148
255
  handler: (change: ElementGroupChangeCallbackParams) => void;
149
256
  }): VoidFunction;
257
+ /**
258
+ * Create a new element on the map.
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * const element = await felt.createElement({ type: "Place", coordinates: [10, 10] });
263
+ * ```
264
+ */
265
+ createElement(element: ElementCreate): Promise<Element>;
266
+ /**
267
+ * Update an element on the map.
268
+ *
269
+ * @example
270
+ * ```typescript
271
+ * // Update a place element's coordinates
272
+ * await felt.updateElement({
273
+ * id: "element-1",
274
+ * coordinates: [10, 20]
275
+ * });
276
+ *
277
+ * // Update a polygon's style
278
+ * await felt.updateElement({
279
+ * id: "element-2",
280
+ * color: "#FF0000",
281
+ * fillOpacity: 0.5
282
+ * });
283
+ * ```
284
+ */
285
+ updateElement(element: ElementUpdate): Promise<Element>;
286
+ /**
287
+ * Delete an element from the map.
288
+ *
289
+ * @example
290
+ * ```typescript
291
+ * await felt.deleteElement("element-1");
292
+ * ```
293
+ */
294
+ deleteElement(id: string): Promise<void>;
150
295
  }
151
296
 
152
297
  /**
@@ -165,7 +310,7 @@ interface LayersController {
165
310
  *
166
311
  * @example
167
312
  * ```typescript
168
- * const layers = await felt.getLayer({ ids: ["layer-1", "layer-2"] });
313
+ * const layer = await felt.getLayer("layer-1");
169
314
  * ```
170
315
  * @returns The requested layer.
171
316
  */
@@ -286,7 +431,7 @@ interface LayersController {
286
431
  *
287
432
  * @example
288
433
  * ```typescript
289
- * felt.getLayerGroup("layer-group-1");
434
+ * const layerGroup = await felt.getLayerGroup("layer-group-1");
290
435
  * ```
291
436
  * @returns The requested layer group.
292
437
  */
@@ -426,7 +571,7 @@ interface LayersController {
426
571
  *
427
572
  * @example
428
573
  * ```typescript
429
- * felt.setLayerFilters({
574
+ * await felt.setLayerFilters({
430
575
  * layerId: "layer-1",
431
576
  * filters: ["AREA", "gt", 30_000],
432
577
  * });
@@ -449,6 +594,41 @@ interface LayersController {
449
594
  */
450
595
  note?: string;
451
596
  }): Promise<void>;
597
+ /**
598
+ * Adds a listener for when a layer's filters change.
599
+ *
600
+ * @returns A function to unsubscribe from the listener
601
+ *
602
+ * @remarks
603
+ * This event fires whenever any type of filter changes on the layer, including
604
+ * ephemeral filters set via the SDK, style-based filters, or filters set through
605
+ * the Felt UI via Components.
606
+ *
607
+ * @event
608
+ * @example
609
+ * ```typescript
610
+ * const unsubscribe = felt.onLayerFiltersChange({
611
+ * options: { layerId: "layer-1" },
612
+ * handler: ({combined, ephemeral, style, components}) => {
613
+ * console.log("Layer filters updated:", {
614
+ * combined, // All filters combined
615
+ * ephemeral, // Filters set via SDK
616
+ * style, // Filters from layer style
617
+ * components // Filters from UI components
618
+ * });
619
+ * },
620
+ * });
621
+ *
622
+ * // later on...
623
+ * unsubscribe();
624
+ * ```
625
+ */
626
+ onLayerFiltersChange(params: {
627
+ options: {
628
+ layerId: string;
629
+ };
630
+ handler: (change: LayerFilters) => void;
631
+ }): VoidFunction;
452
632
  /**
453
633
  * Get the features that are currently **rendered** on the map in the viewport.
454
634
  *
@@ -466,7 +646,190 @@ interface LayersController {
466
646
  /**
467
647
  * The constraints to apply to the features returned from the map.
468
648
  */
469
- params?: GetRenderedFeaturesConstraint): Promise<Array<Feature>>;
649
+ params?: GetRenderedFeaturesConstraint): Promise<Array<LayerFeature>>;
650
+ /**
651
+ * Get a feature from the map by its ID and layer ID.
652
+ *
653
+ * The response is a {@link LayerFeature} object, which does not include the
654
+ * geometry of the feature.
655
+ *
656
+ * You may want to use this when you don't need the geometry of a feature,
657
+ * but you know the ID of the feature you need.
658
+ *
659
+ * @example
660
+ * ```typescript
661
+ * const feature = await felt.getFeature({ layerId: "layer-1", id: 123 });
662
+ * ```
663
+ */
664
+ getFeature(params: {
665
+ id: string | number;
666
+ layerId: string;
667
+ }): Promise<LayerFeature | null>;
668
+ /**
669
+ * Get a feature in GeoJSON format from the map by its ID and layer ID.
670
+ *
671
+ * The response is a GeoJSON Feature object with the complete geometry of the
672
+ *
673
+ * @example
674
+ * ```typescript
675
+ * const feature = await felt.getGeoJsonFeature({ layerId: "layer-1", id: 123 });
676
+ * ```
677
+ */
678
+ getGeoJsonFeature(params: {
679
+ id: string | number;
680
+ layerId: string;
681
+ }): Promise<GeoJsonFeature | null>;
682
+ /**
683
+ * Gets values from a layer grouped by a given attribute.
684
+ *
685
+ * @remarks
686
+ * Groups features in your layer by unique values in the specified attribute and calculates
687
+ * a value for each group. By default, this value is the count of features in each group.
688
+ *
689
+ * You can apply filters in two ways:
690
+ * 1. At the top level (using `boundary` and `filters`), which affects both what categories
691
+ * are included and how values are calculated
692
+ * 2. In the `values` configuration, which only affects the values but keeps all categories
693
+ *
694
+ * This two-level filtering is particularly useful when you want to compare subsets of data
695
+ * while maintaining consistent categories. For example, you might want to show the distribution
696
+ * of all building types in a city, but only count buildings built after 2000 in each category.
697
+ *
698
+ * @example
699
+ * ```typescript
700
+ * // Basic grouping: Count of buildings by type
701
+ * const buildingsByType = await felt.getCategoryData({
702
+ * layerId: "buildings",
703
+ * attribute: "type"
704
+ * });
705
+ *
706
+ * // Filtered grouping: Only count buildings in downtown
707
+ * const downtownBuildingsByType = await felt.getCategoryData({
708
+ * layerId: "buildings",
709
+ * attribute: "type",
710
+ * boundary: [-122.43, 47.60, -122.33, 47.62] // downtown boundary
711
+ * });
712
+ *
713
+ * // Advanced: Show all building types, but only sum floor area of recent buildings
714
+ * const recentBuildingAreaByType = await felt.getCategoryData({
715
+ * layerId: "buildings",
716
+ * attribute: "type",
717
+ * values: {
718
+ * filters: ["year_built", "gte", 2000],
719
+ * aggregation: {
720
+ * method: "sum",
721
+ * attribute: "floor_area"
722
+ * }
723
+ * }
724
+ * });
725
+ *
726
+ * // Compare residential density across neighborhoods while only counting recent buildings
727
+ * const newBuildingDensityByNeighborhood = await felt.getCategoryData({
728
+ * layerId: "buildings",
729
+ * attribute: "neighborhood",
730
+ * values: {
731
+ * filters: ["year_built", "gte", 2000],
732
+ * aggregation: {
733
+ * method: "avg",
734
+ * attribute: "units_per_acre"
735
+ * }
736
+ * }
737
+ * });
738
+ * ```
739
+ */
740
+ getCategoryData(params: GetLayerCategoriesParams): Promise<Array<GetLayerCategoriesGroup>>;
741
+ /**
742
+ * Gets a histogram of values from a layer for a given attribute.
743
+ *
744
+ * @remarks
745
+ * Creates bins (ranges) for numeric data and counts how many features fall into each bin,
746
+ * or returns aggregated values for each bin.
747
+ *
748
+ * You can control how the bins are created using the `steps` parameter, choosing from
749
+ * several methods like equal intervals, quantiles, or natural breaks (Jenks), or passing
750
+ * in the step values directly if you know how you want to bin the data.
751
+ *
752
+ * Like getCategoryData, you can apply filters in two ways:
753
+ * 1. At the top level (using `boundary` and `filters`), which affects both how the bins
754
+ * are calculated and what features are counted in each bin
755
+ * 2. In the `values` configuration, which only affects what gets counted but keeps the
756
+ * bin ranges the same
757
+ *
758
+ * This is particularly useful when you want to compare distributions while keeping
759
+ * consistent bin ranges. For example, you might want to compare the distribution of
760
+ * building heights in different years while using the same height ranges.
761
+ *
762
+ * @example
763
+ * ```typescript
764
+ * // Basic histogram: Building heights in 5 natural break bins
765
+ * const buildingHeights = await felt.getHistogramData({
766
+ * layerId: "buildings",
767
+ * attribute: "height",
768
+ * steps: { type: "jenks", count: 5 }
769
+ * });
770
+ *
771
+ * // Compare old vs new buildings using the same height ranges
772
+ * const oldBuildingHeights = await felt.getHistogramData({
773
+ * layerId: "buildings",
774
+ * attribute: "height",
775
+ * steps: [0, 20, 50, 100, 200, 500],
776
+ * values: {
777
+ * filters: ["year_built", "lt", 1950]
778
+ * }
779
+ * });
780
+ *
781
+ * const newBuildingHeights = await felt.getHistogramData({
782
+ * layerId: "buildings",
783
+ * attribute: "height",
784
+ * steps: [0, 20, 50, 100, 200, 500], // Same ranges as above
785
+ * values: {
786
+ * filters: ["year_built", "gte", 1950]
787
+ * }
788
+ * });
789
+ * ```
790
+ */
791
+ getHistogramData(params: GetLayerHistogramParams): Promise<Array<GetLayerHistogramBin>>;
792
+ /**
793
+ * Calculates a single aggregate value for a layer based on the provided configuration.
794
+ *
795
+ * @remarks
796
+ * Performs statistical calculations on your data, like counting features or computing
797
+ * averages, sums, etc. You can focus your calculation on specific areas or subsets
798
+ * of your data using boundaries and filters.
799
+ *
800
+ * When no aggregation is specified, it counts features. When an aggregation is provided,
801
+ * it performs that calculation (average, sum, etc.) on the specified attribute.
802
+ *
803
+ * @example
804
+ * ```typescript
805
+ * // Count all residential buildings
806
+ * const residentialCount = await felt.getAggregates({
807
+ * layerId: "buildings",
808
+ * filters: ["type", "eq", "residential"]
809
+ * });
810
+ *
811
+ * // Calculate average home value in a specific neighborhood
812
+ * const avgHomeValue = await felt.getAggregates({
813
+ * layerId: "buildings",
814
+ * boundary: [-122.43, 47.60, -122.33, 47.62], // neighborhood boundary
815
+ * aggregation: {
816
+ * method: "avg",
817
+ * attribute: "assessed_value"
818
+ * }
819
+ * });
820
+ *
821
+ * // Find the maximum building height for buildings built after 2000
822
+ * const maxNewBuildingHeight = await felt.getAggregates({
823
+ * layerId: "buildings",
824
+ * filters: ["year_built", "gte", 2000],
825
+ * aggregation: {
826
+ * method: "max",
827
+ * attribute: "height"
828
+ * }
829
+ * });
830
+ * ```
831
+ */
832
+ getAggregates<T extends AggregationMethod | "count">(params: GetLayerCalculationParams<T>): Promise<Record<T, number | null>>;
470
833
  }
471
834
 
472
835
  /**
@@ -503,8 +866,12 @@ interface InteractionsController {
503
866
  * @event
504
867
  * @example
505
868
  * ```typescript
869
+ * // Track mouse movement and features under cursor
506
870
  * const unsubscribe = felt.onPointerMove({
507
- * handler: (event) => console.log(event.center, event.features),
871
+ * handler: (event) => {
872
+ * console.log("Mouse position:", event.center);
873
+ * console.log("Features under cursor:", event.features);
874
+ * }
508
875
  * });
509
876
  *
510
877
  * // later on...
@@ -523,6 +890,27 @@ interface InteractionsController {
523
890
  }): VoidFunction;
524
891
  }
525
892
 
893
+ /**
894
+ * @group Controller
895
+ * @public
896
+ */
897
+ interface MiscController {
898
+ /**
899
+ * Gets the details of the map.
900
+ *
901
+ * @example
902
+ * ```typescript
903
+ * const details = await felt.getMapDetails();
904
+ * console.log({
905
+ * id: details.id,
906
+ * title: details.title,
907
+ * description: details.description,
908
+ * });
909
+ * ```
910
+ */
911
+ getMapDetails(): Promise<MapDetails>;
912
+ }
913
+
526
914
  /**
527
915
  * The Selection controller allows you to listen for changes to the selection on the map.
528
916
  *
@@ -637,12 +1025,12 @@ interface ToolsController {
637
1025
  * @param tool - The tool to set.
638
1026
  *
639
1027
  * @example
640
- * ```ts
1028
+ * ```typescript
641
1029
  * // Set the tool to "marker"
642
- * felt.setTool("marker");
1030
+ * await felt.setTool("marker");
643
1031
  *
644
1032
  * // put down the tool
645
- * felt.setTool(null);
1033
+ * await felt.setTool(null);
646
1034
  * ```
647
1035
  */
648
1036
  setTool(tool: ToolType | null): void;
@@ -652,7 +1040,7 @@ interface ToolsController {
652
1040
  * @returns The current tool, or `null` if no tool is in use.
653
1041
  *
654
1042
  * @example
655
- * ```ts
1043
+ * ```typescript
656
1044
  * const tool = await felt.getTool(); // "marker", "polygon", etc.
657
1045
  * ```
658
1046
  */
@@ -663,7 +1051,7 @@ interface ToolsController {
663
1051
  * @returns A function to unsubscribe from the listener
664
1052
  *
665
1053
  * @example
666
- * ```ts
1054
+ * ```typescript
667
1055
  * const unsubscribe = felt.onToolChange({
668
1056
  * handler: tool => console.log(tool),
669
1057
  * });
@@ -683,18 +1071,41 @@ interface ToolsController {
683
1071
  /**
684
1072
  * Sets the settings for the current tool.
685
1073
  *
1074
+ * @example
1075
+ * ```typescript
1076
+ * // Set the settings for the marker tool
1077
+ * await felt.setToolSettings({
1078
+ * tool: "marker",
1079
+ * color: "#FE17",
1080
+ * });
1081
+ * ```
1082
+ *
686
1083
  * @param settings - The settings to set.
687
1084
  */
688
1085
  setToolSettings(settings: InputToolSettings): void;
689
1086
  /**
690
- * Gets the settings for the current tool.
1087
+ * Gets the settings for the chosen tool
691
1088
  *
692
- * @returns The settings for the current tool.
1089
+ * @example
1090
+ * ```typescript
1091
+ * const settings = await felt.getToolSettings("marker");
1092
+ * ```
1093
+ *
1094
+ * @returns The settings for the chosen tool.
693
1095
  */
694
1096
  getToolSettings<T extends ConfigurableToolType>(tool: T): Promise<ToolSettingsMap[T]>;
695
1097
  /**
696
1098
  * Listens for changes to the settings on all tools.
697
1099
  *
1100
+ * @example
1101
+ * ```typescript
1102
+ * const unsubscribe = felt.onToolSettingsChange({
1103
+ * handler: settings => console.log(settings),
1104
+ * });
1105
+ *
1106
+ * // later on...
1107
+ * unsubscribe();
1108
+ * ```
698
1109
  * @returns A function to unsubscribe from the listener
699
1110
  */
700
1111
  onToolSettingsChange(args: {
@@ -841,8 +1252,10 @@ declare const UiOnMapInteractionsOptionsSchema: z.ZodObject<{
841
1252
  }>;
842
1253
 
843
1254
  /**
844
- * The UI controller allows you to enable and disable UI controls on the
845
- * embedded map.
1255
+ * The UI controller allows you to control various aspects of the Felt UI in your embedded map.
1256
+ *
1257
+ * This includes enabling/disabling UI controls, managing on-map interactions, and controlling
1258
+ * the visibility of UI components like the data table.
846
1259
  *
847
1260
  * @group Controller
848
1261
  * @public
@@ -851,6 +1264,21 @@ interface UiController {
851
1264
  /**
852
1265
  * Updates the UI controls on the embedded map.
853
1266
  *
1267
+ * @example
1268
+ * ```typescript
1269
+ * // Show some UI controls
1270
+ * await felt.updateUiControls({
1271
+ * showLegend: true,
1272
+ * fullScreenButton: true,
1273
+ * });
1274
+ *
1275
+ * // Disable some UI options
1276
+ * await felt.updateUiControls({
1277
+ * cooperativeGestures: false,
1278
+ * geolocation: false,
1279
+ * });
1280
+ * ```
1281
+ *
854
1282
  * @param controls - The controls to update.
855
1283
  */
856
1284
  updateUiControls(controls: UiControlsOptions): void;
@@ -864,8 +1292,53 @@ interface UiController {
864
1292
  *
865
1293
  * This does not affect selection. That means that selectable features and elements
866
1294
  * will still be selected when clicked.
1295
+ *
1296
+ * @example
1297
+ * ```typescript
1298
+ * // Disable UI when hovering or selecting features
1299
+ * await felt.setOnMapInteractionsUi({
1300
+ * featureSelectPanel: false,
1301
+ * featureHoverPanel: false,
1302
+ * });
1303
+ * ```
867
1304
  */
868
1305
  setOnMapInteractionsUi(options: UiOnMapInteractionsOptions): void;
1306
+ /**
1307
+ * Shows a data table view for the specified layer, optionally sorted by a given attribute.
1308
+ *
1309
+ * @example
1310
+ * ```typescript
1311
+ * // Show data table with default sorting
1312
+ * await felt.showLayerDataTable({
1313
+ * layerId: "layer-1",
1314
+ * });
1315
+ *
1316
+ * // Show data table sorted by height in descending order
1317
+ * await felt.showLayerDataTable({
1318
+ * layerId: "layer-1",
1319
+ * sorting: {
1320
+ * attribute: "height",
1321
+ * direction: "desc",
1322
+ * },
1323
+ * });
1324
+ *
1325
+ * // Show the data table pane with no table visible
1326
+ * await felt.showLayerDataTable();
1327
+ * ```
1328
+ */
1329
+ showLayerDataTable(params?: {
1330
+ layerId: string;
1331
+ sorting?: SortConfig;
1332
+ }): Promise<void>;
1333
+ /**
1334
+ * Hides the data table.
1335
+ *
1336
+ * @example
1337
+ * ```typescript
1338
+ * await felt.hideLayerDataTable();
1339
+ * ```
1340
+ */
1341
+ hideLayerDataTable(): Promise<void>;
869
1342
  }
870
1343
 
871
1344
  /**
@@ -880,6 +1353,16 @@ interface UiController {
880
1353
  interface ViewportController {
881
1354
  /**
882
1355
  * Gets the current state of the viewport.
1356
+ *
1357
+ * @example
1358
+ * ```typescript
1359
+ * // Get current viewport state
1360
+ * const viewport = await felt.getViewport();
1361
+ * console.log({
1362
+ * center: viewport.center,
1363
+ * zoom: viewport.zoom,
1364
+ * });
1365
+ * ```
883
1366
  */
884
1367
  getViewport(): Promise<ViewportState>;
885
1368
  /**
@@ -894,6 +1377,58 @@ interface ViewportController {
894
1377
  * ```
895
1378
  */
896
1379
  setViewport(viewport: SetViewportCenterZoomParams): void;
1380
+ /**
1381
+ * Gets the current state of the viewport constraints.
1382
+ *
1383
+ * @example
1384
+ * ```typescript
1385
+ * // Get current viewport constraints
1386
+ * const constraints = await felt.getViewportConstraints();
1387
+ * if (constraints) {
1388
+ * console.log({
1389
+ * bounds: constraints.bounds,
1390
+ * minZoom: constraints.minZoom,
1391
+ * maxZoom: constraints.maxZoom
1392
+ * });
1393
+ * } else {
1394
+ * console.log("No viewport constraints set");
1395
+ * }
1396
+ * ```
1397
+ */
1398
+ getViewportConstraints(): Promise<ViewportConstraints | null>;
1399
+ /**
1400
+ * Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
1401
+ *
1402
+ * @example
1403
+ * ```typescript
1404
+ * felt.setViewportConstraints({
1405
+ * bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
1406
+ * minZoom: 1,
1407
+ * maxZoom: 23,
1408
+ * });
1409
+ * ```
1410
+ *
1411
+ * @example
1412
+ * every constraint is optional
1413
+ * ```typescript
1414
+ * felt.setViewportConstraints({
1415
+ * bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
1416
+ * });
1417
+ * ```
1418
+ *
1419
+ * @example
1420
+ * if a constraint is null, it will be removed but keeping the others
1421
+ * ```typescript
1422
+ * felt.setViewportConstraints({ bounds: null });
1423
+ * ```
1424
+ *
1425
+ * @example
1426
+ * if method receives null, it will remove the constraints
1427
+ * ```typescript
1428
+ * felt.setViewportConstraints(null);
1429
+ * ```
1430
+ */
1431
+ setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
897
1432
  /**
898
1433
  * Fits the map to the specified bounds.
899
1434
  *
@@ -988,7 +1523,7 @@ interface ViewportController {
988
1523
  * @group Controller
989
1524
  * @public
990
1525
  */
991
- interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController {
1526
+ interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
992
1527
  /**
993
1528
  * The iframe element containing the Felt map, if it is an embedded map.
994
1529
  *
@@ -1053,17 +1588,17 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1053
1588
  }>;
1054
1589
  zoom: z.ZodNumber;
1055
1590
  }, "strip", z.ZodTypeAny, {
1591
+ zoom: number;
1056
1592
  center: {
1057
1593
  latitude: number;
1058
1594
  longitude: number;
1059
1595
  };
1060
- zoom: number;
1061
1596
  }, {
1597
+ zoom: number;
1062
1598
  center: {
1063
1599
  latitude: number;
1064
1600
  longitude: number;
1065
1601
  };
1066
- zoom: number;
1067
1602
  }>>;
1068
1603
  }, "strip", z.ZodTypeAny, {
1069
1604
  origin?: string | undefined;
@@ -1077,11 +1612,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1077
1612
  scaleBar?: boolean | undefined;
1078
1613
  } | undefined;
1079
1614
  initialViewport?: {
1615
+ zoom: number;
1080
1616
  center: {
1081
1617
  latitude: number;
1082
1618
  longitude: number;
1083
1619
  };
1084
- zoom: number;
1085
1620
  } | undefined;
1086
1621
  }, {
1087
1622
  origin?: string | undefined;
@@ -1095,11 +1630,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1095
1630
  scaleBar?: boolean | undefined;
1096
1631
  } | undefined;
1097
1632
  initialViewport?: {
1633
+ zoom: number;
1098
1634
  center: {
1099
1635
  latitude: number;
1100
1636
  longitude: number;
1101
1637
  };
1102
- zoom: number;
1103
1638
  } | undefined;
1104
1639
  }>;
1105
1640
 
@@ -1159,4 +1694,4 @@ declare const Felt: {
1159
1694
  connect(feltWindow: Window): Promise<FeltController>;
1160
1695
  };
1161
1696
 
1162
- export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, type ViewportController, ViewportFitBoundsParams, ViewportState };
1697
+ export { AggregationMethod, ConfigurableToolType, Element, ElementChangeCallbackParams, ElementCreate, ElementGroup, ElementGroupChangeCallbackParams, ElementUpdate, type ElementsController, EntityNode, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, GeoJsonFeature, GeoJsonGeometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerCalculationParams, GetLayerCategoriesGroup, GetLayerCategoriesParams, GetLayerGroupsConstraint, GetLayerHistogramBin, GetLayerHistogramParams, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFeature, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapDetails, MapInteractionEvent, type MiscController, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, SortConfig, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };