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

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, z as LayerSchema, M as MapInteractionEvent, B as MapDetails, C as EntityNode, D as FeatureSelection, T as ToolType, I as InputToolSettings, H as ConfigurableToolType, J as ToolSettingsMap, K as ToolSettingsChangeEvent, N as zInfer, O as SortConfig, V as ViewportState, P as SetViewportCenterZoomParams, Q as ViewportConstraints, R as ViewportFitBoundsParams, U as ViewportCenterZoom } from './types-CI-GVo6N.js';
2
+ export { ay as AggregationConfig, W as CircleElementCreate, X as CircleElementRead, Y as CircleElementUpdate, aS as CircleToolSettings, aB as ElementGroupNode, aC as ElementNode, aD as FeatureNode, aG as FeltBoundary, aH as FeltZoom, av as FilterExpression, aw as FilterLogicGate, ax as FilterTernary, aI as GeoJsonProperties, Z as HighlighterElementCreate, _ as HighlighterElementRead, $ as HighlighterElementUpdate, aT as HighlighterToolSettings, a0 as ImageElementCreate, a1 as ImageElementRead, a2 as ImageElementUpdate, aJ as LatLng, aE as LayerGroupNode, aF as LayerNode, am as LayerProcessingStatus, ao as LayerSchemaAttribute, ap as LayerSchemaBooleanAttribute, aq as LayerSchemaCommmonAttribute, ar as LayerSchemaDateAttribute, as as LayerSchemaDateTimeAttribute, at as LayerSchemaNumericAttribute, au as LayerSchemaTextAttribute, aK as LineStringGeometry, aU as LineToolSettings, a3 as LinkElementRead, aL as LngLatTuple, a4 as MarkerElementCreate, a5 as MarkerElementRead, a6 as MarkerElementUpdate, aV as MarkerToolSettings, az as MultiAggregationConfig, aM as MultiLineStringGeometry, aN as MultiPointGeometry, aO as MultiPolygonGeometry, a7 as NoteElementCreate, a8 as NoteElementRead, a9 as NoteElementUpdate, aW as NoteToolSettings, aa as PathElementCreate, ab as PathElementRead, ac as PathElementUpdate, aX as PinToolSettings, ad as PlaceElementCreate, ae as PlaceElementRead, af as PlaceElementUpdate, aY as PlaceFrame, aZ as PlaceSymbol, aP as PointGeometry, ag as PolygonElementCreate, ah as PolygonElementRead, ai as PolygonElementUpdate, aQ as PolygonGeometry, a_ as PolygonToolSettings, an as RasterValue, a$ as RouteToolSettings, aR as SortDirection, aj as TextElementCreate, ak as TextElementRead, al as TextElementUpdate, b0 as TextToolSettings, aA as ValueConfiguration } from './types-CI-GVo6N.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,207 @@ 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>>;
833
+ /**
834
+ * Get the schema for a layer.
835
+ *
836
+ * @remarks
837
+ * The schema describes the structure of the data in a layer, including the attributes
838
+ * that are available on the features in the layer.
839
+ *
840
+ * This can be useful to build generic UIs that need to know the structure of the data in
841
+ * a layer, such as a dropdown to choose an attribute.
842
+ *
843
+ * @example
844
+ * ```typescript
845
+ * const schema = await felt.getLayerSchema({ layerId: "layer-1" });
846
+ * const attributeIds = schema.attributes.map((attr) => attr.id);
847
+ * ```
848
+ */
849
+ getLayerSchema(layerId: string): Promise<LayerSchema>;
470
850
  }
471
851
 
472
852
  /**
@@ -503,8 +883,12 @@ interface InteractionsController {
503
883
  * @event
504
884
  * @example
505
885
  * ```typescript
886
+ * // Track mouse movement and features under cursor
506
887
  * const unsubscribe = felt.onPointerMove({
507
- * handler: (event) => console.log(event.center, event.features),
888
+ * handler: (event) => {
889
+ * console.log("Mouse position:", event.center);
890
+ * console.log("Features under cursor:", event.features);
891
+ * }
508
892
  * });
509
893
  *
510
894
  * // later on...
@@ -523,6 +907,27 @@ interface InteractionsController {
523
907
  }): VoidFunction;
524
908
  }
525
909
 
910
+ /**
911
+ * @group Controller
912
+ * @public
913
+ */
914
+ interface MiscController {
915
+ /**
916
+ * Gets the details of the map.
917
+ *
918
+ * @example
919
+ * ```typescript
920
+ * const details = await felt.getMapDetails();
921
+ * console.log({
922
+ * id: details.id,
923
+ * title: details.title,
924
+ * description: details.description,
925
+ * });
926
+ * ```
927
+ */
928
+ getMapDetails(): Promise<MapDetails>;
929
+ }
930
+
526
931
  /**
527
932
  * The Selection controller allows you to listen for changes to the selection on the map.
528
933
  *
@@ -637,12 +1042,12 @@ interface ToolsController {
637
1042
  * @param tool - The tool to set.
638
1043
  *
639
1044
  * @example
640
- * ```ts
1045
+ * ```typescript
641
1046
  * // Set the tool to "marker"
642
- * felt.setTool("marker");
1047
+ * await felt.setTool("marker");
643
1048
  *
644
1049
  * // put down the tool
645
- * felt.setTool(null);
1050
+ * await felt.setTool(null);
646
1051
  * ```
647
1052
  */
648
1053
  setTool(tool: ToolType | null): void;
@@ -652,7 +1057,7 @@ interface ToolsController {
652
1057
  * @returns The current tool, or `null` if no tool is in use.
653
1058
  *
654
1059
  * @example
655
- * ```ts
1060
+ * ```typescript
656
1061
  * const tool = await felt.getTool(); // "marker", "polygon", etc.
657
1062
  * ```
658
1063
  */
@@ -663,7 +1068,7 @@ interface ToolsController {
663
1068
  * @returns A function to unsubscribe from the listener
664
1069
  *
665
1070
  * @example
666
- * ```ts
1071
+ * ```typescript
667
1072
  * const unsubscribe = felt.onToolChange({
668
1073
  * handler: tool => console.log(tool),
669
1074
  * });
@@ -683,18 +1088,41 @@ interface ToolsController {
683
1088
  /**
684
1089
  * Sets the settings for the current tool.
685
1090
  *
1091
+ * @example
1092
+ * ```typescript
1093
+ * // Set the settings for the marker tool
1094
+ * await felt.setToolSettings({
1095
+ * tool: "marker",
1096
+ * color: "#FE17",
1097
+ * });
1098
+ * ```
1099
+ *
686
1100
  * @param settings - The settings to set.
687
1101
  */
688
1102
  setToolSettings(settings: InputToolSettings): void;
689
1103
  /**
690
- * Gets the settings for the current tool.
1104
+ * Gets the settings for the chosen tool
691
1105
  *
692
- * @returns The settings for the current tool.
1106
+ * @example
1107
+ * ```typescript
1108
+ * const settings = await felt.getToolSettings("marker");
1109
+ * ```
1110
+ *
1111
+ * @returns The settings for the chosen tool.
693
1112
  */
694
1113
  getToolSettings<T extends ConfigurableToolType>(tool: T): Promise<ToolSettingsMap[T]>;
695
1114
  /**
696
1115
  * Listens for changes to the settings on all tools.
697
1116
  *
1117
+ * @example
1118
+ * ```typescript
1119
+ * const unsubscribe = felt.onToolSettingsChange({
1120
+ * handler: settings => console.log(settings),
1121
+ * });
1122
+ *
1123
+ * // later on...
1124
+ * unsubscribe();
1125
+ * ```
698
1126
  * @returns A function to unsubscribe from the listener
699
1127
  */
700
1128
  onToolSettingsChange(args: {
@@ -841,8 +1269,10 @@ declare const UiOnMapInteractionsOptionsSchema: z.ZodObject<{
841
1269
  }>;
842
1270
 
843
1271
  /**
844
- * The UI controller allows you to enable and disable UI controls on the
845
- * embedded map.
1272
+ * The UI controller allows you to control various aspects of the Felt UI in your embedded map.
1273
+ *
1274
+ * This includes enabling/disabling UI controls, managing on-map interactions, and controlling
1275
+ * the visibility of UI components like the data table.
846
1276
  *
847
1277
  * @group Controller
848
1278
  * @public
@@ -851,6 +1281,21 @@ interface UiController {
851
1281
  /**
852
1282
  * Updates the UI controls on the embedded map.
853
1283
  *
1284
+ * @example
1285
+ * ```typescript
1286
+ * // Show some UI controls
1287
+ * await felt.updateUiControls({
1288
+ * showLegend: true,
1289
+ * fullScreenButton: true,
1290
+ * });
1291
+ *
1292
+ * // Disable some UI options
1293
+ * await felt.updateUiControls({
1294
+ * cooperativeGestures: false,
1295
+ * geolocation: false,
1296
+ * });
1297
+ * ```
1298
+ *
854
1299
  * @param controls - The controls to update.
855
1300
  */
856
1301
  updateUiControls(controls: UiControlsOptions): void;
@@ -864,8 +1309,53 @@ interface UiController {
864
1309
  *
865
1310
  * This does not affect selection. That means that selectable features and elements
866
1311
  * will still be selected when clicked.
1312
+ *
1313
+ * @example
1314
+ * ```typescript
1315
+ * // Disable UI when hovering or selecting features
1316
+ * await felt.setOnMapInteractionsUi({
1317
+ * featureSelectPanel: false,
1318
+ * featureHoverPanel: false,
1319
+ * });
1320
+ * ```
867
1321
  */
868
1322
  setOnMapInteractionsUi(options: UiOnMapInteractionsOptions): void;
1323
+ /**
1324
+ * Shows a data table view for the specified layer, optionally sorted by a given attribute.
1325
+ *
1326
+ * @example
1327
+ * ```typescript
1328
+ * // Show data table with default sorting
1329
+ * await felt.showLayerDataTable({
1330
+ * layerId: "layer-1",
1331
+ * });
1332
+ *
1333
+ * // Show data table sorted by height in descending order
1334
+ * await felt.showLayerDataTable({
1335
+ * layerId: "layer-1",
1336
+ * sorting: {
1337
+ * attribute: "height",
1338
+ * direction: "desc",
1339
+ * },
1340
+ * });
1341
+ *
1342
+ * // Show the data table pane with no table visible
1343
+ * await felt.showLayerDataTable();
1344
+ * ```
1345
+ */
1346
+ showLayerDataTable(params?: {
1347
+ layerId: string;
1348
+ sorting?: SortConfig;
1349
+ }): Promise<void>;
1350
+ /**
1351
+ * Hides the data table.
1352
+ *
1353
+ * @example
1354
+ * ```typescript
1355
+ * await felt.hideLayerDataTable();
1356
+ * ```
1357
+ */
1358
+ hideLayerDataTable(): Promise<void>;
869
1359
  }
870
1360
 
871
1361
  /**
@@ -880,6 +1370,16 @@ interface UiController {
880
1370
  interface ViewportController {
881
1371
  /**
882
1372
  * Gets the current state of the viewport.
1373
+ *
1374
+ * @example
1375
+ * ```typescript
1376
+ * // Get current viewport state
1377
+ * const viewport = await felt.getViewport();
1378
+ * console.log({
1379
+ * center: viewport.center,
1380
+ * zoom: viewport.zoom,
1381
+ * });
1382
+ * ```
883
1383
  */
884
1384
  getViewport(): Promise<ViewportState>;
885
1385
  /**
@@ -894,6 +1394,58 @@ interface ViewportController {
894
1394
  * ```
895
1395
  */
896
1396
  setViewport(viewport: SetViewportCenterZoomParams): void;
1397
+ /**
1398
+ * Gets the current state of the viewport constraints.
1399
+ *
1400
+ * @example
1401
+ * ```typescript
1402
+ * // Get current viewport constraints
1403
+ * const constraints = await felt.getViewportConstraints();
1404
+ * if (constraints) {
1405
+ * console.log({
1406
+ * bounds: constraints.bounds,
1407
+ * minZoom: constraints.minZoom,
1408
+ * maxZoom: constraints.maxZoom
1409
+ * });
1410
+ * } else {
1411
+ * console.log("No viewport constraints set");
1412
+ * }
1413
+ * ```
1414
+ */
1415
+ getViewportConstraints(): Promise<ViewportConstraints | null>;
1416
+ /**
1417
+ * Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
1418
+ *
1419
+ * @example
1420
+ * ```typescript
1421
+ * felt.setViewportConstraints({
1422
+ * bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
1423
+ * minZoom: 1,
1424
+ * maxZoom: 23,
1425
+ * });
1426
+ * ```
1427
+ *
1428
+ * @example
1429
+ * every constraint is optional
1430
+ * ```typescript
1431
+ * felt.setViewportConstraints({
1432
+ * bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
1433
+ * });
1434
+ * ```
1435
+ *
1436
+ * @example
1437
+ * if a constraint is null, it will be removed but keeping the others
1438
+ * ```typescript
1439
+ * felt.setViewportConstraints({ bounds: null });
1440
+ * ```
1441
+ *
1442
+ * @example
1443
+ * if method receives null, it will remove the constraints
1444
+ * ```typescript
1445
+ * felt.setViewportConstraints(null);
1446
+ * ```
1447
+ */
1448
+ setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
897
1449
  /**
898
1450
  * Fits the map to the specified bounds.
899
1451
  *
@@ -988,7 +1540,7 @@ interface ViewportController {
988
1540
  * @group Controller
989
1541
  * @public
990
1542
  */
991
- interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController {
1543
+ interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
992
1544
  /**
993
1545
  * The iframe element containing the Felt map, if it is an embedded map.
994
1546
  *
@@ -1053,17 +1605,17 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1053
1605
  }>;
1054
1606
  zoom: z.ZodNumber;
1055
1607
  }, "strip", z.ZodTypeAny, {
1608
+ zoom: number;
1056
1609
  center: {
1057
1610
  latitude: number;
1058
1611
  longitude: number;
1059
1612
  };
1060
- zoom: number;
1061
1613
  }, {
1614
+ zoom: number;
1062
1615
  center: {
1063
1616
  latitude: number;
1064
1617
  longitude: number;
1065
1618
  };
1066
- zoom: number;
1067
1619
  }>>;
1068
1620
  }, "strip", z.ZodTypeAny, {
1069
1621
  origin?: string | undefined;
@@ -1077,11 +1629,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1077
1629
  scaleBar?: boolean | undefined;
1078
1630
  } | undefined;
1079
1631
  initialViewport?: {
1632
+ zoom: number;
1080
1633
  center: {
1081
1634
  latitude: number;
1082
1635
  longitude: number;
1083
1636
  };
1084
- zoom: number;
1085
1637
  } | undefined;
1086
1638
  }, {
1087
1639
  origin?: string | undefined;
@@ -1095,11 +1647,11 @@ declare const FeltEmbedOptionsSchema: z.ZodObject<{
1095
1647
  scaleBar?: boolean | undefined;
1096
1648
  } | undefined;
1097
1649
  initialViewport?: {
1650
+ zoom: number;
1098
1651
  center: {
1099
1652
  latitude: number;
1100
1653
  longitude: number;
1101
1654
  };
1102
- zoom: number;
1103
1655
  } | undefined;
1104
1656
  }>;
1105
1657
 
@@ -1159,4 +1711,4 @@ declare const Felt: {
1159
1711
  connect(feltWindow: Window): Promise<FeltController>;
1160
1712
  };
1161
1713
 
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 };
1714
+ 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, LayerSchema, 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 };