@feltmaps/js-sdk 1.0.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.
@@ -0,0 +1,946 @@
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, z as zInfer, V as ViewportState, s as SetViewportCenterZoomParams, t as ViewportFitBoundsParams, u as ViewportCenterZoom } from './types-0v6svQ9V.cjs';
2
+ export { A as ElementGroupNode, B as ElementNode, C as FeatureNode, I as FeltBoundary, J as FeltZoom, w as FilterExpression, x as FilterLogicGate, y as FilterTernary, K as LatLng, D as LayerGroupNode, H as LayerNode, v as LayerProcessingStatus, N as LineStringGeometry, O as LngLatTuple, P as MultiLineStringGeometry, Q as MultiPolygonGeometry, T as PointGeometry, U as PolygonGeometry, R as RasterValue } from './types-0v6svQ9V.cjs';
3
+ import { z } from 'zod';
4
+
5
+ /**
6
+ * The Elements controller allows you to get information about the elements on the
7
+ * map, and make changes to their visibility.
8
+ *
9
+ * @group Controller
10
+ * @public
11
+ */
12
+ interface ElementsController {
13
+ /**
14
+ * Get a single element from the map by its id.
15
+ *
16
+ * @example
17
+ * ```typescript
18
+ * const element = await felt.getElement("element-1");
19
+ * ```
20
+ * @returns The requested element.
21
+ */
22
+ getElement(
23
+ /**
24
+ * The id of the element you want to get.
25
+ */
26
+ id: string): Promise<Element | null>;
27
+ /**
28
+ * Get the geometry of an element.
29
+ *
30
+ * @example
31
+ * ```typescript
32
+ * const geometry = await felt.getElementGeometry("element-1");
33
+ * console.log(geometry?.type, geometry?.coordinates);
34
+ * ```
35
+ */
36
+ getElementGeometry(
37
+ /**
38
+ * The id of the element you want to get the geometry of.
39
+ */
40
+ id: string): Promise<Geometry | null>;
41
+ /**
42
+ * Gets elements from the map, according to the constraints supplied. If no
43
+ * constraints are supplied, all elements will be returned.
44
+ *
45
+ * @remarks The elements in the map, ordered by the order specified in Felt. This is not
46
+ * necessarily the order that they are drawn in, as Felt draws points above
47
+ * lines and lines above polygons, for instance.
48
+ *
49
+ * @example
50
+ * ```typescript
51
+ * const elements = await felt.getElements();
52
+ * ```
53
+ * @returns All elements on the map.
54
+ */
55
+ getElements(
56
+ /**
57
+ * The constraints to apply to the elements returned from the map.
58
+ */
59
+ constraint?: GetElementsConstraint): Promise<Array<Element | null>>;
60
+ /**
61
+ * Get an element group from the map by its id.
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * felt.getElementGroup("element-group-1");
66
+ * ```
67
+ * @returns The requested element group.
68
+ */
69
+ getElementGroup(id: string): Promise<ElementGroup | null>;
70
+ /**
71
+ * Gets element groups from the map, according to the filters supplied. If no
72
+ * constraints are supplied, all element groups will be returned in rendering order.
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * const elementGroups = await felt.getElementGroups({ ids: ["element-group-1", "element-group-2"] });
77
+ * ```
78
+ * @returns The requested element groups.
79
+ */
80
+ getElementGroups(
81
+ /**
82
+ * The constraints to apply to the element groups returned from the map.
83
+ */
84
+ constraint?: GetElementGroupsConstraint): Promise<Array<ElementGroup | null>>;
85
+ /**
86
+ * Hide or show element groups with the given ids.
87
+ *
88
+ * @example
89
+ * ```typescript
90
+ * felt.setElementGroupVisibility({ show: ["element-group-1", "element-group-2"], hide: ["element-group-3"] });
91
+ * ```
92
+ */
93
+ setElementGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
94
+ /**
95
+ * Adds a listener for when an element changes.
96
+ *
97
+ * @returns A function to unsubscribe from the listener
98
+ *
99
+ * @event
100
+ * @example
101
+ * ```typescript
102
+ * const unsubscribe = felt.onElementChange({
103
+ * options: { id: "element-1" },
104
+ * handler: ({element}) => console.log(element.id),
105
+ * });
106
+ *
107
+ * // later on...
108
+ * unsubscribe();
109
+ * ```
110
+ */
111
+ onElementChange(args: {
112
+ options: {
113
+ /**
114
+ * The id of the element to listen for changes to.
115
+ */
116
+ id: string;
117
+ };
118
+ /**
119
+ * The handler that is called when the element changes.
120
+ */
121
+ handler: (
122
+ /**
123
+ * An object describing the change that occurred.
124
+ */
125
+ change: ElementChangeCallbackParams) => void;
126
+ }): VoidFunction;
127
+ /**
128
+ * Adds a listener for when an element group changes.
129
+ *
130
+ * @returns A function to unsubscribe from the listener
131
+ *
132
+ * @event
133
+ * @example
134
+ * ```typescript
135
+ * const unsubscribe = felt.onElementGroupChange({
136
+ * options: { id: "element-group-1" },
137
+ * handler: elementGroup => console.log(elementGroup.id),
138
+ * });
139
+ *
140
+ * // later on...
141
+ * unsubscribe();
142
+ * ```
143
+ */
144
+ onElementGroupChange(args: {
145
+ options: {
146
+ id: string;
147
+ };
148
+ handler: (change: ElementGroupChangeCallbackParams) => void;
149
+ }): VoidFunction;
150
+ }
151
+
152
+ /**
153
+ * The Layers controller allows you to get information about the layers on the
154
+ * map, and make changes to their visibility.
155
+ *
156
+ * Layers can be organised into groups, and their groups can also have their
157
+ * visibility toggled.
158
+ *
159
+ * @group Controller
160
+ * @public
161
+ */
162
+ interface LayersController {
163
+ /**
164
+ * Get a single layer from the map by its id.
165
+ *
166
+ * @example
167
+ * ```typescript
168
+ * const layers = await felt.getLayer({ ids: ["layer-1", "layer-2"] });
169
+ * ```
170
+ * @returns The requested layer.
171
+ */
172
+ getLayer(
173
+ /**
174
+ * The id of the layer you want to get.
175
+ */
176
+ id: string): Promise<Layer | null>;
177
+ /**
178
+ * Gets layers from the map, according to the constraints supplied. If no
179
+ * constraints are supplied, all layers will be returned.
180
+ *
181
+ * @remarks The layers in the map, ordered by the order specified in Felt. This is not
182
+ * necessarily the order that they are drawn in, as Felt draws points above
183
+ * lines and lines above polygons, for instance.
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * const layers = await felt.getLayers();
188
+ * ```
189
+ * @returns All layers on the map.
190
+ */
191
+ getLayers(
192
+ /**
193
+ * The constraints to apply to the layers returned from the map.
194
+ */
195
+ constraint?: GetLayersConstraint): Promise<Array<Layer | null>>;
196
+ /**
197
+ * Hide or show layers with the given ids.
198
+ *
199
+ * @example
200
+ * ```typescript
201
+ * felt.setLayerVisibility({ show: ["layer-1", "layer-2"], hide: ["layer-3"] });
202
+ * ```
203
+ */
204
+ setLayerVisibility(visibility: SetVisibilityRequest): Promise<void>;
205
+ /**
206
+ * Adds a listener for when a layer changes.
207
+ *
208
+ * @returns A function to unsubscribe from the listener
209
+ *
210
+ * @event
211
+ * @example
212
+ * ```typescript
213
+ * const unsubscribe = felt.onLayerChange({
214
+ * options: { id: "layer-1" },
215
+ * handler: ({layer}) => console.log(layer.bounds),
216
+ * });
217
+ *
218
+ * // later on...
219
+ * unsubscribe();
220
+ * ```
221
+ */
222
+ onLayerChange(args: {
223
+ options: {
224
+ /**
225
+ * The id of the layer to listen for changes to.
226
+ */
227
+ id: string;
228
+ };
229
+ /**
230
+ * The handler that is called when the layer changes.
231
+ */
232
+ handler: (
233
+ /**
234
+ * An object describing the change that occurred.
235
+ */
236
+ change: LayerChangeCallbackParams) => void;
237
+ }): VoidFunction;
238
+ /**
239
+ * Get a layer group from the map by its id.
240
+ *
241
+ * @example
242
+ * ```typescript
243
+ * felt.getLayerGroup("layer-group-1");
244
+ * ```
245
+ * @returns The requested layer group.
246
+ */
247
+ getLayerGroup(id: string): Promise<LayerGroup | null>;
248
+ /**
249
+ * Gets layer groups from the map, according to the constraints supplied. If no
250
+ * constraints are supplied, all layer groups will be returned in rendering order.
251
+ *
252
+ * @example
253
+ * ```typescript
254
+ * const layerGroups = await felt.getLayerGroups({ ids: ["layer-group-1", "layer-group-2"] });
255
+ * ```
256
+ * @returns The requested layer groups.
257
+ */
258
+ getLayerGroups(
259
+ /**
260
+ * The constraints to apply to the layer groups returned from the map.
261
+ */
262
+ constraint?: GetLayerGroupsConstraint): Promise<Array<LayerGroup | null>>;
263
+ /**
264
+ * Hide or show layer groups with the given ids.
265
+ *
266
+ * @example
267
+ * ```typescript
268
+ * felt.setLayerGroupVisibility({ show: ["layer-group-1", "layer-group-2"], hide: ["layer-group-3"] });
269
+ * ```
270
+ */
271
+ setLayerGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
272
+ /**
273
+ * Adds a listener for when a layer group changes.
274
+ *
275
+ * @returns A function to unsubscribe from the listener
276
+ *
277
+ * @event
278
+ * @example
279
+ * ```typescript
280
+ * const unsubscribe = felt.onLayerGroupChange({
281
+ * options: { id: "layer-group-1" },
282
+ * handler: ({layerGroup}) => console.log(layerGroup.id),
283
+ * });
284
+ *
285
+ * // later on...
286
+ * unsubscribe();
287
+ * ```
288
+ */
289
+ onLayerGroupChange(args: {
290
+ options: {
291
+ id: string;
292
+ };
293
+ handler: (change: LayerGroupChangeCallbackParams) => void;
294
+ }): VoidFunction;
295
+ /**
296
+ * Allows you to get the state of a single legend item.
297
+ *
298
+ * @example
299
+ * ```typescript
300
+ * const legendItem = await felt.getLegendItem({
301
+ * id: "legend-item-1",
302
+ * layerId: "layer-1",
303
+ * })
304
+ * ```
305
+ */
306
+ getLegendItem(id: LegendItemIdentifier): Promise<LegendItem | null>;
307
+ /**
308
+ * Allows you to obtain the state of several legend items, by passing in
309
+ * constraints describing which legend items you want.
310
+ *
311
+ * If you do not pass any constraints, you will receive all legend items.
312
+ *
313
+ * @example
314
+ * ```typescript
315
+ * const legendItems = await felt.getLegendItems({layerId: "layer-1"});
316
+ * ```
317
+ */
318
+ getLegendItems(constraint?: LegendItemsConstraint): Promise<Array<LegendItem | null>>;
319
+ /**
320
+ * Hide or show legend items with the given identifiers.
321
+ *
322
+ * @example
323
+ * ```typescript
324
+ * felt.setLegendItemVisibility({
325
+ * show: [{layerId: "layer-group-1", id: "item-1-0"}],
326
+ * hide: [{layerId: "layer-group-2", id: "item-2-0"}],
327
+ * })
328
+ * ```
329
+ */
330
+ setLegendItemVisibility(visibility: {
331
+ show?: Array<LegendItemIdentifier>;
332
+ hide?: Array<LegendItemIdentifier>;
333
+ }): Promise<void>;
334
+ /**
335
+ * Adds a listener for when a legend item changes.
336
+ *
337
+ * @returns A function to unsubscribe from the listener
338
+ *
339
+ * @event
340
+ * @example
341
+ * ```typescript
342
+ * const unsubscribe = felt.onLegendItemChange({
343
+ * options: { layerId: "layer-1", id: "item-1-0" },
344
+ * handler: ({legendItem}) => console.log(legendItem.visible),
345
+ * });
346
+ *
347
+ * // later on...
348
+ * unsubscribe();
349
+ * ```
350
+ */
351
+ onLegendItemChange(args: {
352
+ options: LegendItemIdentifier;
353
+ handler: (change: LegendItemChangeCallbackParams) => void;
354
+ }): VoidFunction;
355
+ /**
356
+ * Get the filters for a layer.
357
+ *
358
+ * @remarks
359
+ * The return type gives you the filters split up into the various sources
360
+ * that make up the overall filters for a layer.
361
+ *
362
+ * @example
363
+ * ```typescript
364
+ * const filters = await felt.getLayerFilters("layer-1");
365
+ * console.log(filters.combined, filters.style, filters.ephemeral, filters.components);
366
+ * ```
367
+ */
368
+ getLayerFilters(layerId: string): Promise<LayerFilters | null>;
369
+ /**
370
+ * Sets the **ephemeral** filters for a layer.
371
+ *
372
+ * @example
373
+ * ```typescript
374
+ * felt.setLayerFilters({
375
+ * layerId: "layer-1",
376
+ * filters: ["AREA", "gt", 30_000],
377
+ * });
378
+ * ```
379
+ */
380
+ setLayerFilters(params: {
381
+ /**
382
+ * The layer that you want to set the filters for.
383
+ */
384
+ layerId: string;
385
+ /**
386
+ * The filters to set for the layer. This will replace any ephemeral filters
387
+ * that are currently set for the layer.
388
+ */
389
+ filters: Filters;
390
+ }): Promise<void>;
391
+ /**
392
+ * Get the features that are currently **rendered** on the map in the viewport.
393
+ *
394
+ * Note that this is explicitly about the features that are rendered, which isn't
395
+ * necessarily a complete list of all the features in the viewport. This is because
396
+ * of the way features are tiled: at low zoom levels or high feature densities, many
397
+ * features are omitted from what is rendered on the screen.
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * const features = await felt.getRenderedFeatures();
402
+ * ```
403
+ */
404
+ getRenderedFeatures(
405
+ /**
406
+ * The constraints to apply to the features returned from the map.
407
+ */
408
+ params?: GetRenderedFeaturesConstraint): Promise<Array<Feature>>;
409
+ }
410
+
411
+ /**
412
+ * The Interactions controller allows you to observe interactions with the map
413
+ *
414
+ * @group Controller
415
+ * @public
416
+ */
417
+ interface InteractionsController {
418
+ /**
419
+ * Allows you to be notified the user clicks on the map.
420
+ *
421
+ * @returns A function to unsubscribe from the listener
422
+ *
423
+ * @event
424
+ * @example
425
+ * ```typescript
426
+ * const unsubscribe = felt.onPointerClick({
427
+ * handler: (event) => console.log(event.center, event.features),
428
+ * });
429
+ *
430
+ * // later on...
431
+ * unsubscribe();
432
+ * ```
433
+ */
434
+ onPointerClick(params: {
435
+ handler: (event: MapInteractionEvent) => void;
436
+ }): VoidFunction;
437
+ /**
438
+ * Allows you to be notified the user moves the mouse over the map.
439
+ *
440
+ * @returns A function to unsubscribe from the listener
441
+ *
442
+ * @event
443
+ * @example
444
+ * ```typescript
445
+ * const unsubscribe = felt.onPointerMove({
446
+ * handler: (event) => console.log(event.center, event.features),
447
+ * });
448
+ *
449
+ * // later on...
450
+ * unsubscribe();
451
+ * ```
452
+ */
453
+ onPointerMove(
454
+ /**
455
+ * Params for the listener
456
+ */
457
+ params: {
458
+ /**
459
+ * The handler function
460
+ */
461
+ handler: (event: MapInteractionEvent) => void;
462
+ }): VoidFunction;
463
+ }
464
+
465
+ /**
466
+ * The Selection controller allows you to listen for changes to the selection on the map.
467
+ *
468
+ * @group Controller
469
+ * @public
470
+ */
471
+ interface SelectionController {
472
+ /**
473
+ * Gets the current selection as a list of entity identifiers.
474
+ *
475
+ * @example
476
+ * ```typescript
477
+ * const selection = await felt.getSelection();
478
+ * ```
479
+ */
480
+ getSelection(): Promise<EntityNode[]>;
481
+ /**
482
+ * Adds a listener for when the selection changes.
483
+ *
484
+ * @returns A function to unsubscribe from the listener
485
+ *
486
+ * @event
487
+ * @example
488
+ * ```typescript
489
+ * const unsubscribe = felt.onSelectionChange({
490
+ * handler: ({selection}) => console.log(selection),
491
+ * });
492
+ *
493
+ * // later on...
494
+ * unsubscribe();
495
+ * ```
496
+ */
497
+ onSelectionChange(params: {
498
+ handler: (change: {
499
+ /**
500
+ * The new selection. In the case where there are multiple entities selected,
501
+ * the array describes the chronological and semeantic order of the selection.
502
+ *
503
+ * Entities of the same type that are selected later will appear later in the
504
+ * list, but there are cases where multiple entity types can be selected at once,
505
+ * such as elements and features. In this case, the order of the _types_ of entities
506
+ * tells you which are considered more semantically important.
507
+ *
508
+ * For example, if a feature and element are selected, the feature will be at the
509
+ * tail of the list because pressing Escape will deselect the feature first, then
510
+ * pressing Escape again will deselect the element.
511
+ */
512
+ selection: EntityNode[];
513
+ }) => void;
514
+ }): VoidFunction;
515
+ }
516
+
517
+ /**
518
+ * @public
519
+ */
520
+ interface UiControlsOptions extends zInfer<typeof UiControlsOptionsSchema> {
521
+ }
522
+ /**
523
+ * @internal
524
+ * @ignore
525
+ */
526
+ declare const UiControlsOptionsSchema: z.ZodObject<{
527
+ /**
528
+ * Whether or not the legend is shown.
529
+ *
530
+ * @defaultValue true
531
+ */
532
+ showLegend: z.ZodOptional<z.ZodBoolean>;
533
+ /**
534
+ * When co-operative gestures are enabled, the pan and zoom gestures are
535
+ * adjusted to work better when the map is embedded in another page.
536
+ *
537
+ * @remarks
538
+ * On mobile devices, enabling co-operative gestures will allow the user to
539
+ * pan past the embedded map with a single finger drag. To pan the map, they
540
+ * must use two fingers.
541
+ *
542
+ * On desktop devices, enabling co-operative gestures allows the user to
543
+ * scroll past the embedded map using their scroll wheel or trackpad. To
544
+ * zoom the map, they must hold the Ctrl (Windows) or Command key (Mac) while
545
+ * scrolling.
546
+ *
547
+ * @defaultValue true
548
+ */
549
+ cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
550
+ /**
551
+ * Whether or not the full screen button is shown in an embedded map.
552
+ *
553
+ * @remarks
554
+ * When clicked, this will open the map in a new tab or window.
555
+ *
556
+ * @defaultValue true
557
+ */
558
+ fullScreenButton: z.ZodOptional<z.ZodBoolean>;
559
+ /**
560
+ * Whether or not the geolocation button is shown in an embedded map.
561
+ *
562
+ * @remarks
563
+ * The geolocation feature will plot your position on the map. If you
564
+ * click the button again, it will start tracking your position.
565
+ *
566
+ * @defaultValue false
567
+ */
568
+ geolocation: z.ZodOptional<z.ZodBoolean>;
569
+ /**
570
+ * Whether or not the zoom controls are shown in an embedded map.
571
+ *
572
+ * @remarks
573
+ * This does not affect whether or not the map can be zoomed, just
574
+ * the display of the zoom controls in the bottom right corner of the map.
575
+ *
576
+ * @defaultValue true
577
+ */
578
+ zoomControls: z.ZodOptional<z.ZodBoolean>;
579
+ /**
580
+ * Whether or not the scale bar is shown in an embedded map.
581
+ *
582
+ * @defaultValue true
583
+ */
584
+ scaleBar: z.ZodOptional<z.ZodBoolean>;
585
+ }, "strip", z.ZodTypeAny, {
586
+ showLegend?: boolean | undefined;
587
+ cooperativeGestures?: boolean | undefined;
588
+ fullScreenButton?: boolean | undefined;
589
+ geolocation?: boolean | undefined;
590
+ zoomControls?: boolean | undefined;
591
+ scaleBar?: boolean | undefined;
592
+ }, {
593
+ showLegend?: boolean | undefined;
594
+ cooperativeGestures?: boolean | undefined;
595
+ fullScreenButton?: boolean | undefined;
596
+ geolocation?: boolean | undefined;
597
+ zoomControls?: boolean | undefined;
598
+ scaleBar?: boolean | undefined;
599
+ }>;
600
+ /**
601
+ * The options for which parts of the Felt UI can be shown when interacting with
602
+ * features and elements on the map.
603
+ *
604
+ * Switching these off can be useful if you add your own click, selection or hover
605
+ * handlers for features and elements.
606
+ *
607
+ * @public
608
+ */
609
+ interface UiOnMapInteractionsOptions extends zInfer<typeof UiOnMapInteractionsOptionsSchema> {
610
+ }
611
+ /**
612
+ * @internal
613
+ * @ignore
614
+ */
615
+ declare const UiOnMapInteractionsOptionsSchema: z.ZodObject<{
616
+ /**
617
+ * Set this to `false` to prevent the panel that shows information about a selected
618
+ * feature from being shown.
619
+ */
620
+ featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
621
+ /**
622
+ * Set this to `false` to prevent the panel that shows information about a hovered
623
+ * feature from being shown.
624
+ */
625
+ featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
626
+ /**
627
+ * Set this to `false` to prevent the panel that shows information about a selected
628
+ * element from being shown.
629
+ */
630
+ elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
631
+ /**
632
+ * Set this to `false` to prevent clicking on a map link element from opening that link
633
+ * in a new tab or window.
634
+ */
635
+ linkClickOpen: z.ZodOptional<z.ZodBoolean>;
636
+ /**
637
+ * Set this to `false` to prevent clicking on an image element from opening the image
638
+ * in a lightbox.
639
+ */
640
+ imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
641
+ }, "strip", z.ZodTypeAny, {
642
+ featureSelectPanel?: boolean | undefined;
643
+ featureHoverPanel?: boolean | undefined;
644
+ elementSelectPanel?: boolean | undefined;
645
+ linkClickOpen?: boolean | undefined;
646
+ imageLightboxOpen?: boolean | undefined;
647
+ }, {
648
+ featureSelectPanel?: boolean | undefined;
649
+ featureHoverPanel?: boolean | undefined;
650
+ elementSelectPanel?: boolean | undefined;
651
+ linkClickOpen?: boolean | undefined;
652
+ imageLightboxOpen?: boolean | undefined;
653
+ }>;
654
+
655
+ /**
656
+ * The UI controller allows you to enable and disable UI controls on the
657
+ * embedded map.
658
+ *
659
+ * @group Controller
660
+ * @public
661
+ */
662
+ interface UiController {
663
+ /**
664
+ * Updates the UI controls on the embedded map.
665
+ *
666
+ * @param controls - The controls to update.
667
+ */
668
+ updateUiControls(controls: UiControlsOptions): void;
669
+ /**
670
+ * Control the on-map UI shown when interacting with features and elements.
671
+ *
672
+ * If you add your own click, selection or hover handlers you may want to disable
673
+ * various parts of the Felt UI. This method allows you to control the visibility of
674
+ * various parts of the UI that might otherwise be shown when people click or hover
675
+ * on things.
676
+ *
677
+ * This does not affect selection. That means that selectable features and elements
678
+ * will still be selected when clicked.
679
+ */
680
+ setOnMapInteractionsUi(options: UiOnMapInteractionsOptions): void;
681
+ }
682
+
683
+ /**
684
+ * The viewport controller allows you to control the viewport of the map.
685
+ *
686
+ * You can get the current viewport, move the viewport, and be notified when
687
+ * the viewport changes.
688
+ *
689
+ * @group Controller
690
+ * @public
691
+ */
692
+ interface ViewportController {
693
+ /**
694
+ * Gets the current state of the viewport.
695
+ */
696
+ getViewport(): Promise<ViewportState>;
697
+ /**
698
+ * Moves the map to the specified location.
699
+ *
700
+ * @example
701
+ * ```typescript
702
+ * felt.setViewport({
703
+ * center: { latitude: 0, longitude: 0 },
704
+ * zoom: 10,
705
+ * });
706
+ * ```
707
+ */
708
+ setViewport(viewport: SetViewportCenterZoomParams): void;
709
+ /**
710
+ * Fits the map to the specified bounds.
711
+ *
712
+ * @example
713
+ * ```typescript
714
+ * const west = -122.4194;
715
+ * const south = 37.7749;
716
+ * const east = -122.4194;
717
+ * const north = 37.7749;
718
+ * felt.fitViewportToBounds({ bounds: [west, south, east, north] });
719
+ * ```
720
+ */
721
+ fitViewportToBounds(bounds: ViewportFitBoundsParams): void;
722
+ /**
723
+ * Adds a listener for when the viewport changes.
724
+ *
725
+ * @returns A function to unsubscribe from the listener
726
+ *
727
+ * @event
728
+ * @example
729
+ * ```typescript
730
+ * const unsubscribe = felt.onViewportMove({
731
+ * handler: viewport => console.log(viewport.center.latitude),
732
+ * });
733
+ *
734
+ * // later on...
735
+ * unsubscribe();
736
+ * ```
737
+ */
738
+ onViewportMove(args: {
739
+ /**
740
+ * This callback is called with the current viewport state whenever
741
+ * the viewport changes.
742
+ *
743
+ * @param viewport - The current viewport state.
744
+ */
745
+ handler: (viewport: ViewportState) => void;
746
+ }): VoidFunction;
747
+ /**
748
+ * Adds a listener for when the viewport move ends, which is when the user
749
+ * stops dragging or zooming the map, animations have finished, or inertial
750
+ * dragging ends.
751
+ *
752
+ * @returns A function to unsubscribe from the listener
753
+ *
754
+ * @event
755
+ * @example
756
+ * ```typescript
757
+ * const unsubscribe = felt.onViewportMoveEnd({
758
+ * handler: viewport => console.log(viewport.center.latitude),
759
+ * });
760
+ *
761
+ * // later on...
762
+ * unsubscribe();
763
+ * ```
764
+ */
765
+ onViewportMoveEnd(args: {
766
+ handler: (viewport: ViewportState) => void;
767
+ }): VoidFunction;
768
+ }
769
+
770
+ /**
771
+ * This is the main interface for interacting with a Felt map.
772
+ *
773
+ * This interface is composed of the various controllers, each having a
774
+ * different area of responsibility.
775
+ *
776
+ * All the methods are listed here, but each controller is documented on its
777
+ * own to make it easier to find related methods and events.
778
+ *
779
+ * @group Controller
780
+ * @public
781
+ */
782
+ interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController {
783
+ /**
784
+ * The iframe element containing the Felt map, if it is an embedded map.
785
+ *
786
+ * @readonly
787
+ */
788
+ iframe: HTMLIFrameElement | null;
789
+ }
790
+
791
+ /**
792
+ * @group Instantiation
793
+ * @public
794
+ */
795
+ interface FeltEmbedOptions extends zInfer<typeof FeltEmbedOptionsSchema> {
796
+ uiControls: UiControlsOptions;
797
+ initialViewport?: ViewportCenterZoom;
798
+ }
799
+ /**
800
+ * @internal
801
+ */
802
+ declare const FeltEmbedOptionsSchema: z.ZodObject<{
803
+ /**
804
+ * @hidden
805
+ */
806
+ origin: z.ZodOptional<z.ZodString>;
807
+ uiControls: z.ZodObject<{
808
+ showLegend: z.ZodOptional<z.ZodBoolean>;
809
+ cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
810
+ fullScreenButton: z.ZodOptional<z.ZodBoolean>;
811
+ geolocation: z.ZodOptional<z.ZodBoolean>;
812
+ zoomControls: z.ZodOptional<z.ZodBoolean>;
813
+ scaleBar: z.ZodOptional<z.ZodBoolean>;
814
+ }, "strip", z.ZodTypeAny, {
815
+ showLegend?: boolean | undefined;
816
+ cooperativeGestures?: boolean | undefined;
817
+ fullScreenButton?: boolean | undefined;
818
+ geolocation?: boolean | undefined;
819
+ zoomControls?: boolean | undefined;
820
+ scaleBar?: boolean | undefined;
821
+ }, {
822
+ showLegend?: boolean | undefined;
823
+ cooperativeGestures?: boolean | undefined;
824
+ fullScreenButton?: boolean | undefined;
825
+ geolocation?: boolean | undefined;
826
+ zoomControls?: boolean | undefined;
827
+ scaleBar?: boolean | undefined;
828
+ }>;
829
+ initialViewport: z.ZodOptional<z.ZodObject<{
830
+ center: z.ZodObject<{
831
+ latitude: z.ZodNumber;
832
+ longitude: z.ZodNumber;
833
+ }, "strip", z.ZodTypeAny, {
834
+ latitude: number;
835
+ longitude: number;
836
+ }, {
837
+ latitude: number;
838
+ longitude: number;
839
+ }>;
840
+ zoom: z.ZodNumber;
841
+ }, "strip", z.ZodTypeAny, {
842
+ center: {
843
+ latitude: number;
844
+ longitude: number;
845
+ };
846
+ zoom: number;
847
+ }, {
848
+ center: {
849
+ latitude: number;
850
+ longitude: number;
851
+ };
852
+ zoom: number;
853
+ }>>;
854
+ }, "strip", z.ZodTypeAny, {
855
+ uiControls: {
856
+ showLegend?: boolean | undefined;
857
+ cooperativeGestures?: boolean | undefined;
858
+ fullScreenButton?: boolean | undefined;
859
+ geolocation?: boolean | undefined;
860
+ zoomControls?: boolean | undefined;
861
+ scaleBar?: boolean | undefined;
862
+ };
863
+ origin?: string | undefined;
864
+ initialViewport?: {
865
+ center: {
866
+ latitude: number;
867
+ longitude: number;
868
+ };
869
+ zoom: number;
870
+ } | undefined;
871
+ }, {
872
+ uiControls: {
873
+ showLegend?: boolean | undefined;
874
+ cooperativeGestures?: boolean | undefined;
875
+ fullScreenButton?: boolean | undefined;
876
+ geolocation?: boolean | undefined;
877
+ zoomControls?: boolean | undefined;
878
+ scaleBar?: boolean | undefined;
879
+ };
880
+ origin?: string | undefined;
881
+ initialViewport?: {
882
+ center: {
883
+ latitude: number;
884
+ longitude: number;
885
+ };
886
+ zoom: number;
887
+ } | undefined;
888
+ }>;
889
+
890
+ /**
891
+ * Use the {@link Felt} object to embed a new iframe, or connect to an existing embedded
892
+ * iframe.
893
+ *
894
+ * Once you have connected to a Felt map (either by embedding or connecting to an existing
895
+ * iframe), you can use the {@link FeltController} object to control the map.
896
+ *
897
+ * To see what you can do with the map, see the documentation for the {@link FeltController}
898
+ * interface and its constituent controllers.
899
+ *
900
+ * @example
901
+ * ```typescript
902
+ * // embed the map
903
+ * const map = await Felt.embed(container, "felt-map-abc-123");
904
+ *
905
+ * // now the map is loaded and connected, you can use the FeltController interface
906
+ * // to control the map. For instance, to get information about the layers
907
+ * const layers = await map.getLayers();
908
+ *
909
+ * // Or to set the viewport to a specific location and zoom level
910
+ * await map.setViewport({
911
+ * center: { latitude: 37.8113, longitude: -122.2682 },
912
+ * zoom: 10,
913
+ * });
914
+ * ```
915
+ *
916
+ * @module Main
917
+ */
918
+
919
+ /**
920
+ * The Felt SDK is a library for embedding Felt maps into your website,
921
+ * allowing you to control and inspect the map programmatically.
922
+ *
923
+ * @public
924
+ *
925
+ * @group Instantiation
926
+ */
927
+ declare const Felt: {
928
+ /**
929
+ * Embeds a Felt map into the provided container.
930
+ *
931
+ * @param container - The container element to embed the map into.
932
+ * @param mapId - The ID of the map to embed.
933
+ * @param options - The options to configure the map.
934
+ * @returns
935
+ */
936
+ embed(container: HTMLElement, mapId: string, options?: FeltEmbedOptions): Promise<FeltController>;
937
+ /**
938
+ * Binds to an existing Felt map iframe.
939
+ *
940
+ * @param feltWindow - The iframe element containing the Felt map.
941
+ * @returns
942
+ */
943
+ connect(feltWindow: Window): Promise<FeltController>;
944
+ };
945
+
946
+ export { Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, type UiController, type UiControlsOptions, ViewportCenterZoom, type ViewportController, ViewportFitBoundsParams, ViewportState };