@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.
@@ -1,1203 +0,0 @@
1
- import { ZodRawShape, objectOutputType, ZodTypeAny, z } from 'zod';
2
-
3
- /**
4
- * A selection of generic utility types
5
- */
6
-
7
- type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
8
- type PromiseOrNot<T> = T | Promise<T>;
9
- /**
10
- * A better type inference for zod schemas that retains the TSDoc comments
11
- * from the members in the compiled output.
12
- */
13
- type zInfer<T extends {
14
- shape: ZodRawShape;
15
- }> = objectOutputType<T["shape"], ZodTypeAny, "strip">;
16
-
17
- /**
18
- * @group Elements
19
- */
20
- interface Element {
21
- /**
22
- * The string identifying the element
23
- */
24
- id: string;
25
- /**
26
- * The type of element, such as a Place, Polygon, Line, Route, etc.
27
- */
28
- type: string;
29
- /**
30
- * The ID of the element group that the element belongs to, or null
31
- * if the element is not inside an element group.
32
- */
33
- groupId: string | null;
34
- /**
35
- * The name of the element can be displayed in the Legend, depending
36
- * on how the element's legend is configured in its style.
37
- */
38
- name: string | null;
39
- /**
40
- * The element description forms part of the element's metadata. This is visible
41
- * to users via the element info button in the legend.
42
- */
43
- description: string | null;
44
- /**
45
- * The attributes of the element, which can be added via the Element Inspector
46
- * under the Detail tab.
47
- */
48
- attributes: Record<string, unknown>;
49
- }
50
- /**
51
- * @group Element Groups
52
- */
53
- interface ElementGroup {
54
- /**
55
- * A string identifying the element group.
56
- */
57
- id: string;
58
- /**
59
- * The name of the element group. This is shown in the legend.
60
- */
61
- name: string;
62
- /**
63
- * The caption of the element group. This is shown in the legend.
64
- */
65
- caption: string | null;
66
- /**
67
- * The ids of the elements in the element group.
68
- *
69
- * @remarks
70
- * You can use these ids to get the full element objects via the `getElements` method.
71
- */
72
- elementIds: Array<string>;
73
- /**
74
- * Whether the element group is visible or not.
75
- */
76
- visible: boolean;
77
- /**
78
- * Whether the element group is shown in the legend or not.
79
- */
80
- shownInLegend: boolean;
81
- }
82
- /**
83
- * The constraints to apply when getting elements.
84
- *
85
- * @group Elements
86
- */
87
- interface GetElementsConstraint extends zInfer<typeof GetElementsConstraintSchema> {
88
- }
89
- declare const GetElementsConstraintSchema: z.ZodObject<{
90
- /**
91
- * The ids of the elements to get.
92
- */
93
- ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
94
- }, "strip", z.ZodTypeAny, {
95
- ids?: string[] | undefined;
96
- }, {
97
- ids?: string[] | undefined;
98
- }>;
99
- /**
100
- * The constraints to apply when getting element groups.
101
- *
102
- * @group Element Groups
103
- */
104
- interface GetElementGroupsConstraint extends zInfer<typeof GetElementGroupsConstraintSchema> {
105
- }
106
- /**
107
- * @ignore
108
- */
109
- declare const GetElementGroupsConstraintSchema: z.ZodObject<{
110
- /**
111
- * The ids of the element groups to get.
112
- */
113
- ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
114
- }, "strip", z.ZodTypeAny, {
115
- ids?: string[] | undefined;
116
- }, {
117
- ids?: string[] | undefined;
118
- }>;
119
- /**
120
- * The parameters for the `onElementChange` listener.
121
- *
122
- * @group Elements
123
- */
124
- interface ElementChangeCallbackParams {
125
- /**
126
- * The new data for the element or null if the element was removed.
127
- */
128
- element: Element | null;
129
- }
130
- /**
131
- * The parameters for the `onElementGroupChange` listener.
132
- *
133
- * @group Element Groups
134
- */
135
- interface ElementGroupChangeCallbackParams {
136
- elementGroup: ElementGroup | null;
137
- }
138
-
139
- /**
140
- * Represents a point in world coordinates.
141
- */
142
- interface LatLng {
143
- latitude: number;
144
- longitude: number;
145
- }
146
- /**
147
- * A tuple representing a longitude and latitude coordinate.
148
- *
149
- * This is used hen serializing geometry because that's the standard used in
150
- * GeoJSON.
151
- */
152
- type LngLatTuple = [longitude: number, latitude: number];
153
- /**
154
- * A GeoJSON-like point geometry.
155
- */
156
- type PointGeometry = {
157
- type: "Point";
158
- coordinates: LngLatTuple;
159
- };
160
- /**
161
- * A GeoJSON-like polygon geometry.
162
- */
163
- type PolygonGeometry = {
164
- type: "Polygon";
165
- coordinates: LngLatTuple[][];
166
- };
167
- /**
168
- * A GeoJSON-like multi-polygon geometry.
169
- */
170
- type MultiPolygonGeometry = {
171
- type: "MultiPolygon";
172
- coordinates: PolygonGeometry["coordinates"][];
173
- };
174
- /**
175
- * A GeoJSON-like line string geometry.
176
- */
177
- type LineStringGeometry = {
178
- type: "LineString";
179
- coordinates: LngLatTuple[];
180
- };
181
- /**
182
- * A GeoJSON-like multi-line string geometry.
183
- */
184
- type MultiLineStringGeometry = {
185
- type: "MultiLineString";
186
- coordinates: LineStringGeometry["coordinates"][];
187
- };
188
- /**
189
- * A GeoJSON-like geometry of any type
190
- */
191
- type Geometry = PointGeometry | PolygonGeometry | LineStringGeometry | MultiLineStringGeometry | MultiPolygonGeometry;
192
- /**
193
- * @ignore
194
- * @internal
195
- */
196
- declare const FeltZoomSchema: z.ZodNumber;
197
- /**
198
- * The zoom level of the map.
199
- *
200
- * It is a floating-point number between 1 and 23, where 1 is the most
201
- * zoomed out and 23 is the most zoomed in.
202
- *
203
- * @group Types
204
- * @public
205
- */
206
- type FeltZoom = z.infer<typeof FeltZoomSchema>;
207
- /**
208
- * @ignore
209
- * @internal
210
- */
211
- declare const FeltBoundarySchema: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
212
- /**
213
- * The edges of the map in the form of a bounding box.
214
- *
215
- * The boundary is a tuple of the form `[west, south, east, north]`.
216
- *
217
- * @group Types
218
- * @public
219
- */
220
- type FeltBoundary = z.infer<typeof FeltBoundarySchema>;
221
- /**
222
- * The parameters for the methods that change the visibility of entities.
223
- *
224
- * @public
225
- * @category Visibility
226
- */
227
- interface SetVisibilityRequest extends zInfer<typeof SetVisibilityRequestSchema> {
228
- }
229
- /**
230
- * @internal
231
- */
232
- declare const SetVisibilityRequestSchema: z.ZodObject<{
233
- /**
234
- * The ids of the entities you want to change the visibility of.
235
- */
236
- show: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
237
- hide: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
238
- }, "strip", z.ZodTypeAny, {
239
- show?: string[] | undefined;
240
- hide?: string[] | undefined;
241
- }, {
242
- show?: string[] | undefined;
243
- hide?: string[] | undefined;
244
- }>;
245
-
246
- /**
247
- * A feature is a single geographical item in a layer.
248
- * The unique ID for a feature is a compound key made up of the layer ID and the feature ID.
249
- */
250
- interface Feature {
251
- /**
252
- * The identifier of the feature, unique within the layer.
253
- */
254
- id: string | number;
255
- /**
256
- * The identifier of the layer that the feature belongs to.
257
- */
258
- layerId: string;
259
- /**
260
- * The type of geometry of the feature.
261
- */
262
- geometryType: "Point" | "LineString" | "Polygon" | "MultiPolygon" | (string & {});
263
- /**
264
- * The properties of the feature, as a bag of attributes.
265
- */
266
- properties: Record<string, unknown>;
267
- }
268
- /**
269
- * A raster pixel value for a specific layer.
270
- *
271
- * @interface
272
- */
273
- type RasterValue = {
274
- /**
275
- * The value of the pixel.
276
- */
277
- value: number;
278
- /**
279
- * The ID of the layer that the pixel belongs to.
280
- */
281
- layerId: string;
282
- /**
283
- * The name of the category that the pixel belongs to.
284
- */
285
- categoryName: null | string;
286
- /**
287
- * The color of the pixel. Each value is between 0 and 255.
288
- */
289
- color: null | {
290
- r: number;
291
- g: number;
292
- b: number;
293
- a: number;
294
- };
295
- };
296
-
297
- /**
298
- * This describes the processing status of a layer.
299
- *
300
- * The various values are:
301
- * - `processing`: The layer has been uploaded or updated and is still processing.
302
- * - `completed`: The layer has been processed and can be viewed on the map.
303
- * - `failed`: The layer failed to process and cannot be viewed on the map.
304
- * - `incomplete`: The layer has not been processed.
305
- *
306
- * @group Layers
307
- */
308
- type LayerProcessingStatus = z.infer<typeof LayerProcessingStatusSchema>;
309
- declare const LayerProcessingStatusSchema: z.ZodEnum<["processing", "completed", "failed", "incomplete"]>;
310
- /**
311
- * @group Layers
312
- */
313
- interface Layer {
314
- /**
315
- * The string identifying the layer
316
- */
317
- id: string;
318
- /**
319
- * The ID of the layer group that the layer belongs to.
320
- *
321
- * Layers that appear at the root level in Felt will not have a group ID.
322
- */
323
- groupId: string | null;
324
- /**
325
- * The name of the layer can be displayed in the Legend, depending
326
- * on how the layer's legend is configured in its style.
327
- */
328
- name: string;
329
- /**
330
- * The layer's caption is shown in the legend.
331
- */
332
- caption: string | null;
333
- /**
334
- * The layer description forms part of the layer's metadata. This is visible
335
- * to users via the layer info button in the legend.
336
- */
337
- description: string | null;
338
- /**
339
- * Whether the layer is visible or not.
340
- */
341
- visible: boolean;
342
- /**
343
- * Whether the layer is shown in the legend or not.
344
- */
345
- shownInLegend: boolean;
346
- /**
347
- * The FSL style for the layer.
348
- *
349
- * See the [FSL documentation](https://developers.felt.com/felt-style-language) for details
350
- * on how to read and write styles.
351
- *
352
- * As the types of the styles are very complex, we return `object` here and advise that you
353
- * program defensively while reading the styles.
354
- */
355
- style: object;
356
- /**
357
- * The current processing status of the layer.
358
- */
359
- status: LayerProcessingStatus;
360
- /**
361
- * The geometry type of the layer.
362
- *
363
- * @remarks
364
- * This will generally be one of:
365
- * - `"Point"`
366
- * - `"Line"`
367
- * - `"Polygon"`
368
- * - `"Raster"`
369
- * - `null`
370
- *
371
- * When the layer is processing, or it is a data-only layer, it will be null. You should
372
- * expect this to be able to be any string, however, as more geometry types can be added
373
- * in the future.
374
- */
375
- geometryType: string | null;
376
- /**
377
- * The bounding box of the layer. If the layer is processing, or the bounds have otherwise
378
- * not been calculated or are not available, this will be `null`.
379
- *
380
- * {@link FeltBoundary}
381
- */
382
- bounds: FeltBoundary | null;
383
- }
384
- /**
385
- * @group Layer Groups
386
- */
387
- interface LayerGroup {
388
- /**
389
- * A string identifying the layer group.
390
- */
391
- id: string;
392
- /**
393
- * The name of the layer group. This is shown in the legend.
394
- */
395
- name: string;
396
- /**
397
- * The caption of the layer group. This is shown in the legend.
398
- */
399
- caption: string | null;
400
- /**
401
- * The ids of the layers in the layer group.
402
- *
403
- * @remarks
404
- * You can use these ids to get the full layer objects via the `getLayers` method.
405
- */
406
- layerIds: Array<string>;
407
- /**
408
- * Whether the layer group is visible or not.
409
- */
410
- visible: boolean;
411
- /**
412
- * Whether the layer group is shown in the legend or not.
413
- */
414
- shownInLegend: boolean;
415
- /**
416
- * The bounding box of the layer group.
417
- *
418
- * {@link FeltBoundary}
419
- */
420
- bounds: FeltBoundary | null;
421
- }
422
- /**
423
- * The constraints to apply when getting layers.
424
- *
425
- * @group Layers
426
- */
427
- interface GetLayersConstraint extends zInfer<typeof GetLayersConstraintSchema> {
428
- }
429
- /**
430
- * @ignore
431
- */
432
- declare const GetLayersConstraintSchema: z.ZodObject<{
433
- /**
434
- * The ids of the layers to get.
435
- */
436
- ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
437
- }, "strip", z.ZodTypeAny, {
438
- ids?: string[] | undefined;
439
- }, {
440
- ids?: string[] | undefined;
441
- }>;
442
- /**
443
- * The constraints to apply when getting layer groups.
444
- *
445
- * @group Layer Groups
446
- */
447
- interface GetLayerGroupsConstraint extends zInfer<typeof GetLayerGroupsFilterSchema> {
448
- }
449
- /**
450
- * @ignore
451
- */
452
- declare const GetLayerGroupsFilterSchema: z.ZodObject<{
453
- /**
454
- * The ids of the layer groups to get.
455
- */
456
- ids: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
457
- }, "strip", z.ZodTypeAny, {
458
- ids?: string[] | undefined;
459
- }, {
460
- ids?: string[] | undefined;
461
- }>;
462
- /**
463
- * The parameters for the `onLayerChange` listener.
464
- *
465
- * @group Layers
466
- */
467
- interface LayerChangeCallbackParams {
468
- /**
469
- * The new data for the layer or null if the layer was removed.
470
- */
471
- layer: Layer | null;
472
- }
473
- /**
474
- * The parameters for the `onLayerGroupChange` listener.
475
- *
476
- * @group Layer Groups
477
- */
478
- interface LayerGroupChangeCallbackParams {
479
- layerGroup: LayerGroup | null;
480
- }
481
- /**
482
- * A legend item, which often represents a sub-class of features in a
483
- * layer in the case of categorical or classed layers.
484
- *
485
- * @group Legend Items
486
- */
487
- interface LegendItem extends LegendItemIdentifier {
488
- /**
489
- * The title of the legend item.
490
- */
491
- title: string | Array<string>;
492
- /**
493
- * Whether the title depends on the zoom level or not. If it does, you
494
- * need to call `getLegendItem` when the zoom level changes.
495
- *
496
- * Note that as the zoom level changes, the `onLegendItemChange` handler
497
- * will not be called, so you need to call `getLegendItem` yourself.
498
- */
499
- titleDependsOnZoom: boolean;
500
- /**
501
- * Whether the legend item is visible or not.
502
- */
503
- visible: boolean;
504
- }
505
- /**
506
- * The identifier for a legend item. It is a compound key of the layer to
507
- * which the legend item belongs and the legend item's own id.
508
- *
509
- * @group Legend Items
510
- */
511
- interface LegendItemIdentifier extends zInfer<typeof LegendItemIdentifierSchema> {
512
- }
513
- /** @ignore */
514
- declare const LegendItemIdentifierSchema: z.ZodObject<{
515
- /**
516
- * The id of the legend item.
517
- */
518
- id: z.ZodString;
519
- /**
520
- * The id of the layer the legend item belongs to.
521
- */
522
- layerId: z.ZodString;
523
- }, "strip", z.ZodTypeAny, {
524
- id: string;
525
- layerId: string;
526
- }, {
527
- id: string;
528
- layerId: string;
529
- }>;
530
- /**
531
- * Constraints for legend items. If nothing is passed, all legend items will be returned.
532
- *
533
- * @group Legend Items
534
- */
535
- interface LegendItemsConstraint extends zInfer<typeof LegendItemsConstraintSchema> {
536
- }
537
- /** @ignore */
538
- declare const LegendItemsConstraintSchema: z.ZodObject<{
539
- /**
540
- * Array of legend item identifiers to constrain by.
541
- */
542
- ids: z.ZodOptional<z.ZodArray<z.ZodObject<{
543
- /**
544
- * The id of the legend item.
545
- */
546
- id: z.ZodString;
547
- /**
548
- * The id of the layer the legend item belongs to.
549
- */
550
- layerId: z.ZodString;
551
- }, "strip", z.ZodTypeAny, {
552
- id: string;
553
- layerId: string;
554
- }, {
555
- id: string;
556
- layerId: string;
557
- }>, "many">>;
558
- /**
559
- * Array of layer ids to constrain legend items by.
560
- */
561
- layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
562
- }, "strip", z.ZodTypeAny, {
563
- ids?: {
564
- id: string;
565
- layerId: string;
566
- }[] | undefined;
567
- layerIds?: string[] | undefined;
568
- }, {
569
- ids?: {
570
- id: string;
571
- layerId: string;
572
- }[] | undefined;
573
- layerIds?: string[] | undefined;
574
- }>;
575
- /**
576
- * The parameters for the `onLegendItemChange` listener.
577
- *
578
- * @group Legend Items
579
- */
580
- interface LegendItemChangeCallbackParams {
581
- /**
582
- * The new data for the legend item or null if the legend item was removed.
583
- */
584
- legendItem: LegendItem | null;
585
- }
586
- /**
587
- * Constraints for the `getRenderedFeatures` method. This can include layer constriants, spatial constraints, or both. If no constraints are
588
- * provided, all rendered features will be returned.
589
- *
590
- * @group Layers
591
- */
592
- interface GetRenderedFeaturesConstraint extends zInfer<typeof GetRenderedFeaturesConstraintSchema> {
593
- /**
594
- * The area to query for rendered features. This can be specific coordinates or a {@link FeltBoundary}. If omitted, the entire viewport will be queried.
595
- */
596
- areaQuery?: {
597
- coordinates: LatLng;
598
- } | {
599
- boundary: FeltBoundary;
600
- };
601
- }
602
- /** @ignore */
603
- declare const GetRenderedFeaturesConstraintSchema: z.ZodObject<{
604
- /**
605
- * The ids of the layers to get rendered features for.
606
- */
607
- layerIds: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
608
- areaQuery: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
609
- coordinates: z.ZodObject<{
610
- latitude: z.ZodNumber;
611
- longitude: z.ZodNumber;
612
- }, "strip", z.ZodTypeAny, {
613
- latitude: number;
614
- longitude: number;
615
- }, {
616
- latitude: number;
617
- longitude: number;
618
- }>;
619
- }, "strip", z.ZodTypeAny, {
620
- coordinates: {
621
- latitude: number;
622
- longitude: number;
623
- };
624
- }, {
625
- coordinates: {
626
- latitude: number;
627
- longitude: number;
628
- };
629
- }>, z.ZodObject<{
630
- boundary: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
631
- }, "strip", z.ZodTypeAny, {
632
- boundary: [number, number, number, number];
633
- }, {
634
- boundary: [number, number, number, number];
635
- }>]>>;
636
- }, "strip", z.ZodTypeAny, {
637
- layerIds?: string[] | undefined;
638
- areaQuery?: {
639
- coordinates: {
640
- latitude: number;
641
- longitude: number;
642
- };
643
- } | {
644
- boundary: [number, number, number, number];
645
- } | undefined;
646
- }, {
647
- layerIds?: string[] | undefined;
648
- areaQuery?: {
649
- coordinates: {
650
- latitude: number;
651
- longitude: number;
652
- };
653
- } | {
654
- boundary: [number, number, number, number];
655
- } | undefined;
656
- }>;
657
-
658
- /**
659
- * @group Filters
660
- */
661
- type FilterLogicGate = z.infer<typeof FilterLogicGateSchema>;
662
- declare const FilterLogicGateSchema: z.ZodEnum<["and", "or"]>;
663
- /**
664
- * @group Filters
665
- */
666
- type FilterExpression = z.infer<typeof FilterExpressionSchema>;
667
- declare const FilterExpressionSchema: z.ZodUnion<[z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["in", "ni"]>, z.ZodUnion<[z.ZodArray<z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>, "many">, z.ZodNull]>], null>, z.ZodTuple<[z.ZodUnion<[z.ZodString, z.ZodNull]>, z.ZodEnum<["lt", "gt", "le", "ge", "eq", "ne", "cn", "nc", "is", "isnt"]>, z.ZodUnion<[z.ZodNumber, z.ZodString, z.ZodBoolean, z.ZodNull]>], null>]>;
668
- /**
669
- * @group Filters
670
- */
671
- type FilterTernary = [
672
- FilterTernary | FilterExpression | null | boolean,
673
- FilterLogicGate,
674
- FilterTernary | FilterExpression | null | boolean
675
- ];
676
- /**
677
- *
678
- * Filters can be used to change which features in a layer are rendered. Filters can be
679
- * applied to a layer by the `setLayerFilters` method on the Felt controller.
680
- *
681
- * @remarks
682
- * The possible operators are:
683
- * - `lt`: Less than
684
- * - `gt`: Greater than
685
- * - `le`: Less than or equal to
686
- * - `ge`: Greater than or equal to
687
- * - `eq`: Equal to
688
- * - `ne`: Not equal to
689
- * - `cn`: Contains
690
- * - `nc`: Does not contain
691
- *
692
- * The allowed boolean operators are:
693
- * - `and`: Logical AND
694
- * - `or`: Logical OR
695
- *
696
- * @example
697
- * ```typescript
698
- * // a simple filter
699
- * felt.setLayerFilters({
700
- * layerId: "layer-1",
701
- * filters: ["AREA", "gt", 30_000],
702
- * });
703
- *
704
- * // compound filters can be constructed using boolean logic:
705
- * felt.setLayerFilters({
706
- * layerId: "layer-1",
707
- * filters: [["AREA", "gt", 30_000], "and", ["COLOR", "eq", "red"]]
708
- * })
709
- * ```
710
- *
711
- * @group Filters
712
- */
713
- type Filters = FilterTernary | FilterExpression | null | boolean;
714
- /**
715
- * The filters that are currently set on a layer.
716
- *
717
- * A layer's filters are the combination of various different places
718
- * in which filters can be applied.
719
- *
720
- * @group Filters
721
- */
722
- interface LayerFilters {
723
- /**
724
- * Filters that are set in the layer's style. These are the lowest level
725
- * of filters, and can only be set by editing the map.
726
- */
727
- style: Filters;
728
- /**
729
- * Filters that are set in the layer's components, which are interactive
730
- * elements in the legend. These can be set by viewers for their own session,
731
- * but their default value can be set by the map creator.
732
- */
733
- components: Filters;
734
- /**
735
- * Filters that are set ephemerally by viewers in their own session.
736
- *
737
- * These are the filters that are set when the `setLayerFilters` method is
738
- * called. There is no way to set these in the Felt UI - they can only be
739
- * set using the SDK.
740
- */
741
- ephemeral: Filters;
742
- /**
743
- * The combined result of all the filters set on the layer.
744
- */
745
- combined: Filters;
746
- }
747
-
748
- /**
749
- * The event object passed to the interaction listeners.
750
- */
751
- interface MapInteractionEvent {
752
- /**
753
- * The cursor position in world coordinates.
754
- */
755
- coordinate: LatLng;
756
- /**
757
- * The vector features that are under the cursor.
758
- */
759
- features: Array<Feature>;
760
- /**
761
- * The raster pixel values that are under the cursor.
762
- */
763
- rasterValues: Array<RasterValue>;
764
- }
765
-
766
- /**
767
- * A reference to any kind of entity in the map.
768
- *
769
- * @remarks
770
- * EntityNodes are used when you have some collection of entities and you need to
771
- *
772
- * @group Entity Node
773
- */
774
- type EntityNode = ElementNode | ElementGroupNode | LayerNode | LayerGroupNode | FeatureNode;
775
- /**
776
- * References an element on the map.
777
- *
778
- * @interface
779
- * @group Entity Nodes
780
- */
781
- type ElementNode = {
782
- type: "element";
783
- entity: Element;
784
- };
785
- /**
786
- * References an element group.
787
- *
788
- * @interface
789
- * @group Entity Nodes
790
- */
791
- type ElementGroupNode = {
792
- type: "elementGroup";
793
- entity: ElementGroup;
794
- };
795
- /**
796
- * References a layer on the map.
797
- *
798
- * @interface
799
- * @group Entity Nodes
800
- */
801
- type LayerNode = {
802
- type: "layer";
803
- entity: Layer;
804
- };
805
- /**
806
- * References a layer group on the map.
807
- *
808
- * @interface
809
- * @group Entity Nodes
810
- */
811
- type LayerGroupNode = {
812
- type: "layerGroup";
813
- entity: LayerGroup;
814
- };
815
- /**
816
- * References a feature on the map.
817
- *
818
- * @interface
819
- * @group Entity Nodes
820
- */
821
- type FeatureNode = {
822
- type: "feature";
823
- entity: Feature;
824
- };
825
- /**
826
- * The options for selecting a feature in a layer.
827
- */
828
- interface FeatureSelection extends zInfer<typeof FeatureSelectionSchema> {
829
- }
830
- /**
831
- * @ignore
832
- */
833
- declare const FeatureSelectionSchema: z.ZodObject<{
834
- /**
835
- * The id of the feature to select.
836
- */
837
- id: z.ZodUnion<[z.ZodString, z.ZodNumber]>;
838
- /**
839
- * The id of the layer that the feature belongs to.
840
- */
841
- layerId: z.ZodString;
842
- /**
843
- * Whether to show the feature's popup, if it is configured in the layer's style.
844
- *
845
- * @default true
846
- */
847
- showPopup: z.ZodOptional<z.ZodBoolean>;
848
- /**
849
- * Whether to center the view on the feature after selecting it.
850
- *
851
- * When true, the viewport will be centered on the feature and zoomed to fit the feature
852
- * in the viewport. If you need to control the zoom level to prevent it zooming in too
853
- * far, you can pass an object with a `maxZoom` property.
854
- *
855
- * This is useful for avoiding zooming in too far on point features, or if you want
856
- * to maintain the current zoom level.
857
- *
858
- * @default true
859
- */
860
- fitViewport: z.ZodOptional<z.ZodUnion<[z.ZodBoolean, z.ZodObject<{
861
- maxZoom: z.ZodNumber;
862
- }, "strip", z.ZodTypeAny, {
863
- maxZoom: number;
864
- }, {
865
- maxZoom: number;
866
- }>]>>;
867
- }, "strip", z.ZodTypeAny, {
868
- id: string | number;
869
- layerId: string;
870
- showPopup?: boolean | undefined;
871
- fitViewport?: boolean | {
872
- maxZoom: number;
873
- } | undefined;
874
- }, {
875
- id: string | number;
876
- layerId: string;
877
- showPopup?: boolean | undefined;
878
- fitViewport?: boolean | {
879
- maxZoom: number;
880
- } | undefined;
881
- }>;
882
-
883
- declare const ToolSchema: z.ZodEnum<["pin", "line", "route", "polygon", "circle", "marker", "highlighter", "text", "note", "link"]>;
884
- type ToolType = z.infer<typeof ToolSchema>;
885
- type ConfigurableToolType = keyof ToolSettingsMap;
886
- declare const PinToolSettingsSchema: z.ZodObject<{
887
- color: z.ZodString;
888
- symbol: z.ZodString;
889
- frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
890
- }, "strip", z.ZodTypeAny, {
891
- symbol: string;
892
- color: string;
893
- frame: "frame-circle" | "frame-square" | null;
894
- }, {
895
- symbol: string;
896
- color: string;
897
- frame: "frame-circle" | "frame-square" | null;
898
- }>;
899
- interface PinToolSettings extends zInfer<typeof PinToolSettingsSchema> {
900
- symbol: PinSymbol;
901
- }
902
- declare const LineToolSettingsSchema: z.ZodObject<{
903
- color: z.ZodString;
904
- strokeOpacity: z.ZodNumber;
905
- strokeWidth: z.ZodNumber;
906
- strokeStyle: z.ZodEnum<["solid", "dashed", "dotted"]>;
907
- distanceMarker: z.ZodBoolean;
908
- }, "strip", z.ZodTypeAny, {
909
- color: string;
910
- strokeOpacity: number;
911
- strokeWidth: number;
912
- strokeStyle: "solid" | "dashed" | "dotted";
913
- distanceMarker: boolean;
914
- }, {
915
- color: string;
916
- strokeOpacity: number;
917
- strokeWidth: number;
918
- strokeStyle: "solid" | "dashed" | "dotted";
919
- distanceMarker: boolean;
920
- }>;
921
- interface LineToolSettings extends zInfer<typeof LineToolSettingsSchema> {
922
- }
923
- declare const RouteToolSettingsSchema: z.ZodObject<{
924
- color: z.ZodString;
925
- routingMode: z.ZodEnum<["driving", "cycling", "walking", "flying"]>;
926
- strokeOpacity: z.ZodNumber;
927
- strokeWidth: z.ZodNumber;
928
- strokeStyle: z.ZodEnum<["solid", "dashed", "dotted"]>;
929
- distanceMarker: z.ZodBoolean;
930
- endCaps: z.ZodBoolean;
931
- }, "strip", z.ZodTypeAny, {
932
- color: string;
933
- strokeOpacity: number;
934
- strokeWidth: number;
935
- strokeStyle: "solid" | "dashed" | "dotted";
936
- distanceMarker: boolean;
937
- routingMode: "driving" | "cycling" | "walking" | "flying";
938
- endCaps: boolean;
939
- }, {
940
- color: string;
941
- strokeOpacity: number;
942
- strokeWidth: number;
943
- strokeStyle: "solid" | "dashed" | "dotted";
944
- distanceMarker: boolean;
945
- routingMode: "driving" | "cycling" | "walking" | "flying";
946
- endCaps: boolean;
947
- }>;
948
- interface RouteToolSettings extends zInfer<typeof RouteToolSettingsSchema> {
949
- }
950
- declare const PolygonToolSettingsSchema: z.ZodObject<{
951
- color: z.ZodString;
952
- fillOpacity: z.ZodNumber;
953
- strokeOpacity: z.ZodNumber;
954
- strokeWidth: z.ZodNumber;
955
- strokeStyle: z.ZodEnum<["solid", "dashed", "dotted"]>;
956
- areaMarker: z.ZodBoolean;
957
- }, "strip", z.ZodTypeAny, {
958
- color: string;
959
- strokeOpacity: number;
960
- strokeWidth: number;
961
- strokeStyle: "solid" | "dashed" | "dotted";
962
- fillOpacity: number;
963
- areaMarker: boolean;
964
- }, {
965
- color: string;
966
- strokeOpacity: number;
967
- strokeWidth: number;
968
- strokeStyle: "solid" | "dashed" | "dotted";
969
- fillOpacity: number;
970
- areaMarker: boolean;
971
- }>;
972
- interface PolygonToolSettings extends zInfer<typeof PolygonToolSettingsSchema> {
973
- }
974
- declare const CircleToolSettingsSchema: z.ZodObject<{
975
- color: z.ZodString;
976
- fillOpacity: z.ZodNumber;
977
- strokeOpacity: z.ZodNumber;
978
- strokeWidth: z.ZodNumber;
979
- strokeStyle: z.ZodEnum<["solid", "dashed", "dotted"]>;
980
- radiusMarker: z.ZodBoolean;
981
- }, "strip", z.ZodTypeAny, {
982
- color: string;
983
- strokeOpacity: number;
984
- strokeWidth: number;
985
- strokeStyle: "solid" | "dashed" | "dotted";
986
- fillOpacity: number;
987
- radiusMarker: boolean;
988
- }, {
989
- color: string;
990
- strokeOpacity: number;
991
- strokeWidth: number;
992
- strokeStyle: "solid" | "dashed" | "dotted";
993
- fillOpacity: number;
994
- radiusMarker: boolean;
995
- }>;
996
- interface CircleToolSettings extends zInfer<typeof CircleToolSettingsSchema> {
997
- }
998
- declare const MarkerToolSettingsSchema: z.ZodObject<{
999
- color: z.ZodString;
1000
- opacity: z.ZodNumber;
1001
- size: z.ZodNumber;
1002
- }, "strip", z.ZodTypeAny, {
1003
- color: string;
1004
- opacity: number;
1005
- size: number;
1006
- }, {
1007
- color: string;
1008
- opacity: number;
1009
- size: number;
1010
- }>;
1011
- interface MarkerToolSettings extends zInfer<typeof MarkerToolSettingsSchema> {
1012
- }
1013
- declare const HighlighterToolSettingsSchema: z.ZodObject<{
1014
- color: z.ZodString;
1015
- opacity: z.ZodNumber;
1016
- size: z.ZodNumber;
1017
- }, "strip", z.ZodTypeAny, {
1018
- color: string;
1019
- opacity: number;
1020
- size: number;
1021
- }, {
1022
- color: string;
1023
- opacity: number;
1024
- size: number;
1025
- }>;
1026
- interface HighlighterToolSettings extends zInfer<typeof HighlighterToolSettingsSchema> {
1027
- }
1028
- declare const TextToolSettingsSchema: z.ZodObject<{
1029
- color: z.ZodString;
1030
- align: z.ZodEnum<["left", "center", "right"]>;
1031
- style: z.ZodEnum<["italic", "light", "regular", "caps"]>;
1032
- }, "strip", z.ZodTypeAny, {
1033
- style: "italic" | "light" | "regular" | "caps";
1034
- color: string;
1035
- align: "center" | "left" | "right";
1036
- }, {
1037
- style: "italic" | "light" | "regular" | "caps";
1038
- color: string;
1039
- align: "center" | "left" | "right";
1040
- }>;
1041
- interface TextToolSettings extends zInfer<typeof TextToolSettingsSchema> {
1042
- }
1043
- declare const NoteToolSettingsSchema: z.ZodObject<{
1044
- color: z.ZodString;
1045
- align: z.ZodEnum<["left", "center", "right"]>;
1046
- style: z.ZodEnum<["italic", "light", "regular", "caps"]>;
1047
- }, "strip", z.ZodTypeAny, {
1048
- style: "italic" | "light" | "regular" | "caps";
1049
- color: string;
1050
- align: "center" | "left" | "right";
1051
- }, {
1052
- style: "italic" | "light" | "regular" | "caps";
1053
- color: string;
1054
- align: "center" | "left" | "right";
1055
- }>;
1056
- interface NoteToolSettings extends zInfer<typeof NoteToolSettingsSchema> {
1057
- }
1058
- type InputToolSettings = {
1059
- [K in ConfigurableToolType]: Partial<ToolSettingsMap[K]> & {
1060
- tool: K;
1061
- };
1062
- }[ConfigurableToolType];
1063
- type ToolSettingsChangeEvent = {
1064
- [K in ConfigurableToolType]: ToolSettingsMap[K] & {
1065
- tool: K;
1066
- };
1067
- }[ConfigurableToolType];
1068
- type ToolSettingsMap = {
1069
- pin: PinToolSettings;
1070
- line: LineToolSettings;
1071
- route: RouteToolSettings;
1072
- polygon: PolygonToolSettings;
1073
- circle: CircleToolSettings;
1074
- marker: MarkerToolSettings;
1075
- highlighter: HighlighterToolSettings;
1076
- text: TextToolSettings;
1077
- note: NoteToolSettings;
1078
- };
1079
- type PinFrame = "frame-circle" | "frame-square" | null;
1080
- type PinSymbol = "dot" | "square" | "diamond" | "triangle" | "x" | "plus" | "circle-line" | "circle-slash" | "star" | "heart" | "hexagon" | "octagon" | "pedestrian" | "bicycle" | "wheelchair" | "airport" | "car" | "bus" | "train" | "truck" | "ferry" | "sailboat" | "electric-service" | "gas-service" | "blood-clinic" | "badge" | "traffic-light" | "traffic-cone" | "road-sign-caution" | "person" | "restroom" | "house" | "work" | "letter" | "hotel" | "factory" | "hospital" | "religious-facility" | "school" | "government" | "university" | "bank" | "landmark" | "museum" | "clothing" | "shopping" | "store" | "bar" | "pub" | "cafe" | "food" | "park" | "amusement-park" | "camping-tent" | "cabin" | "picnic" | "water-refill" | "trailhead" | "guidepost" | "viewpoint" | "camera" | "us-football" | "football" | "tennis" | "binoculars" | "swimming" | "zap" | "battery-full" | "battery-half" | "battery-low" | "boom" | "radar" | "wind-turbine" | "solar-panel" | "antenna" | "telephone-pole" | "oil-well" | "oil-barrel" | "railroad-track" | "bridge" | "lighthouse" | "lock-closed" | "lock-open" | "wifi" | "trash" | "recycle" | "tree" | "flower" | "leaf" | "fire" | "mountain" | "snowy-mountain" | "volcano" | "island" | "wave" | "hot-springs" | "water" | "lake" | "ocean" | "animal" | "bird" | "duck" | "dog" | "fish" | "beach" | "wetland" | "sun" | "moon" | "cloud" | "partial-sun" | "rain" | "lightning" | "snowflake" | "wind" | "snow" | "fog" | "sleet" | "hurricane" | "warning" | "parking" | "info" | "circle-exclamation" | "circle-triangle" | "circle-x" | "circle-plus" | (`:${string}:` & {});
1081
-
1082
- /**
1083
- * The input type for setting the viewport to a particular center and zoom.
1084
- *
1085
- * @group Types
1086
- */
1087
- interface ViewportCenterZoom extends zInfer<typeof ViewportCenterZoomSchema> {
1088
- /**
1089
- * The center of the viewport in latitude and longitude.
1090
- */
1091
- center: LatLng;
1092
- /**
1093
- * The zoom level of the viewport.
1094
- */
1095
- zoom: FeltZoom;
1096
- }
1097
- declare const ViewportCenterZoomSchema: z.ZodObject<{
1098
- center: z.ZodObject<{
1099
- latitude: z.ZodNumber;
1100
- longitude: z.ZodNumber;
1101
- }, "strip", z.ZodTypeAny, {
1102
- latitude: number;
1103
- longitude: number;
1104
- }, {
1105
- latitude: number;
1106
- longitude: number;
1107
- }>;
1108
- zoom: z.ZodNumber;
1109
- }, "strip", z.ZodTypeAny, {
1110
- center: {
1111
- latitude: number;
1112
- longitude: number;
1113
- };
1114
- zoom: number;
1115
- }, {
1116
- center: {
1117
- latitude: number;
1118
- longitude: number;
1119
- };
1120
- zoom: number;
1121
- }>;
1122
- /**
1123
- * @group Types
1124
- *
1125
- * The current state of the viewport, including the derived bounds.
1126
- */
1127
- interface ViewportState {
1128
- /**
1129
- * The center of the viewport in latitude and longitude.
1130
- *
1131
- * {@link LatLng}
1132
- */
1133
- center: LatLng;
1134
- /**
1135
- * The zoom level of the viewport.
1136
- *
1137
- * {@link FeltZoom}
1138
- */
1139
- zoom: FeltZoom;
1140
- /**
1141
- * The bounding box of the viewport.
1142
- *
1143
- * This is derived, and depends on the center and zoom of the viewport, as
1144
- * well as its size.
1145
- *
1146
- * {@link FeltBoundary}
1147
- */
1148
- bounds: FeltBoundary;
1149
- }
1150
- /**
1151
- * The parameters for the `setViewport` method.
1152
- *
1153
- * @group Types
1154
- */
1155
- interface SetViewportCenterZoomParams extends zInfer<typeof SetViewportCenterZoomParamsSchema> {
1156
- }
1157
- declare const SetViewportCenterZoomParamsSchema: z.ZodObject<{
1158
- center: z.ZodOptional<z.ZodObject<{
1159
- latitude: z.ZodNumber;
1160
- longitude: z.ZodNumber;
1161
- }, "strip", z.ZodTypeAny, {
1162
- latitude: number;
1163
- longitude: number;
1164
- }, {
1165
- latitude: number;
1166
- longitude: number;
1167
- }>>;
1168
- zoom: z.ZodOptional<z.ZodNumber>;
1169
- }, "strip", z.ZodTypeAny, {
1170
- center?: {
1171
- latitude: number;
1172
- longitude: number;
1173
- } | undefined;
1174
- zoom?: number | undefined;
1175
- }, {
1176
- center?: {
1177
- latitude: number;
1178
- longitude: number;
1179
- } | undefined;
1180
- zoom?: number | undefined;
1181
- }>;
1182
- /**
1183
- * The parameters for the `fitViewportToBounds` method.
1184
- *
1185
- * @group Types
1186
- */
1187
- interface ViewportFitBoundsParams extends zInfer<typeof ViewportFitBoundsParamsSchema> {
1188
- /**
1189
- * The bounds to fit the viewport to.
1190
- *
1191
- * {@link FeltBoundary}
1192
- */
1193
- bounds: FeltBoundary;
1194
- }
1195
- declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
1196
- bounds: z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>;
1197
- }, "strip", z.ZodTypeAny, {
1198
- bounds: [number, number, number, number];
1199
- }, {
1200
- bounds: [number, number, number, number];
1201
- }>;
1202
-
1203
- export type { PolygonGeometry as $, FilterExpression as A, FilterLogicGate as B, ConfigurableToolType as C, FilterTernary as D, Element as E, Filters as F, Geometry as G, ElementGroupNode as H, InputToolSettings as I, ElementNode as J, FeatureNode as K, Layer as L, MapInteractionEvent as M, LayerGroupNode as N, LayerNode as O, FeltBoundary as P, FeltZoom as Q, RasterValue as R, SetVisibilityRequest as S, ToolType as T, LatLng as U, ViewportState as V, LineStringGeometry as W, LngLatTuple as X, MultiLineStringGeometry as Y, MultiPolygonGeometry as Z, PointGeometry as _, GetElementsConstraint as a, CircleToolSettings as a0, HighlighterToolSettings as a1, LineToolSettings as a2, MarkerToolSettings as a3, NoteToolSettings as a4, PinFrame as a5, PinSymbol as a6, PinToolSettings as a7, PolygonToolSettings as a8, RouteToolSettings as a9, TextToolSettings as aa, UnionToIntersection as ab, PromiseOrNot as ac, ElementGroup as b, GetElementGroupsConstraint as c, ElementChangeCallbackParams as d, ElementGroupChangeCallbackParams as e, GetLayersConstraint as f, LayerChangeCallbackParams as g, LayerGroup as h, GetLayerGroupsConstraint as i, LayerGroupChangeCallbackParams as j, LegendItemIdentifier as k, LegendItem as l, LegendItemsConstraint as m, LegendItemChangeCallbackParams as n, LayerFilters as o, GetRenderedFeaturesConstraint as p, Feature as q, EntityNode as r, FeatureSelection as s, ToolSettingsMap as t, ToolSettingsChangeEvent as u, SetViewportCenterZoomParams as v, ViewportFitBoundsParams as w, ViewportCenterZoom as x, LayerProcessingStatus as y, zInfer as z };