@feltmaps/js-sdk 1.6.0-next.1 → 1.6.0-next.2
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.cjs +1 -1
- package/dist/client.d.cts +3 -1012
- package/dist/client.d.ts +3 -1012
- package/dist/client.js +1 -1
- package/dist/{types-0PFYQhMS.d.cts → controller-C5gGWnaM.d.cts} +1026 -20
- package/dist/{types-0PFYQhMS.d.ts → controller-C5gGWnaM.d.ts} +1026 -20
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +91 -72
- package/dist/handler.d.ts +91 -72
- package/dist/handler.js +1 -1
- package/package.json +3 -3
- package/handler.d.ts +0 -4311
- package/handler.js +0 -1
- package/types-0PFYQhMS.d.ts +0 -7510
|
@@ -4137,6 +4137,315 @@ interface ElementGroupChangeCallbackParams {
|
|
|
4137
4137
|
elementGroup: ElementGroup | null;
|
|
4138
4138
|
}
|
|
4139
4139
|
|
|
4140
|
+
/**
|
|
4141
|
+
* The Elements controller allows you to get information about the elements on the
|
|
4142
|
+
* map, and make changes to their visibility.
|
|
4143
|
+
*
|
|
4144
|
+
* @group Controller
|
|
4145
|
+
* @public
|
|
4146
|
+
*/
|
|
4147
|
+
interface ElementsController {
|
|
4148
|
+
/**
|
|
4149
|
+
* Get a single element from the map by its id.
|
|
4150
|
+
*
|
|
4151
|
+
* @example
|
|
4152
|
+
* ```typescript
|
|
4153
|
+
* const element = await felt.getElement("element-1");
|
|
4154
|
+
* ```
|
|
4155
|
+
* @returns The requested element.
|
|
4156
|
+
*/
|
|
4157
|
+
getElement(
|
|
4158
|
+
/**
|
|
4159
|
+
* The id of the element you want to get.
|
|
4160
|
+
*/
|
|
4161
|
+
id: string): Promise<Element | null>;
|
|
4162
|
+
/**
|
|
4163
|
+
* Get the geometry of an element in GeoJSON geometry format.
|
|
4164
|
+
*
|
|
4165
|
+
* For most element types, the geometry returned is based on the `coordinates`
|
|
4166
|
+
* property of the element, with some differences:
|
|
4167
|
+
*
|
|
4168
|
+
* - For Circle elements, the geometry is a Polygon drawn from the `center` and
|
|
4169
|
+
* `radius` properties.
|
|
4170
|
+
*
|
|
4171
|
+
* - Path elements become MultiLineString geometries.
|
|
4172
|
+
*
|
|
4173
|
+
* - Marker elements return a MultiLineString of the path traced by the user
|
|
4174
|
+
* as they drew the marker. Note that this is not the polygon formed by filled-in
|
|
4175
|
+
* "pen" stroke, which doesn't exactly follow the path traced by the user as it
|
|
4176
|
+
* is smoothed and interpolated to create a continuous line.
|
|
4177
|
+
*
|
|
4178
|
+
* - Text, Note and Image elements do not return geometry, so will return `null`.
|
|
4179
|
+
*
|
|
4180
|
+
*
|
|
4181
|
+
* @example
|
|
4182
|
+
* ```typescript
|
|
4183
|
+
* const geometry = await felt.getElementGeometry("element-1");
|
|
4184
|
+
* console.log(geometry?.type, geometry?.coordinates);
|
|
4185
|
+
* ```
|
|
4186
|
+
*/
|
|
4187
|
+
getElementGeometry(
|
|
4188
|
+
/**
|
|
4189
|
+
* The id of the element you want to get the geometry of.
|
|
4190
|
+
*/
|
|
4191
|
+
id: string): Promise<GeoJsonGeometry | null>;
|
|
4192
|
+
/**
|
|
4193
|
+
* Gets elements from the map, according to the constraints supplied. If no
|
|
4194
|
+
* constraints are supplied, all elements will be returned.
|
|
4195
|
+
*
|
|
4196
|
+
* @remarks The elements in the map, ordered by the order specified in Felt. This is not
|
|
4197
|
+
* necessarily the order that they are drawn in, as Felt draws points above
|
|
4198
|
+
* lines and lines above polygons, for instance.
|
|
4199
|
+
*
|
|
4200
|
+
* @example
|
|
4201
|
+
* ```typescript
|
|
4202
|
+
* const elements = await felt.getElements();
|
|
4203
|
+
* ```
|
|
4204
|
+
* @returns All elements on the map.
|
|
4205
|
+
*/
|
|
4206
|
+
getElements(
|
|
4207
|
+
/**
|
|
4208
|
+
* The constraints to apply to the elements returned from the map.
|
|
4209
|
+
*/
|
|
4210
|
+
constraint?: GetElementsConstraint): Promise<Array<Element | null>>;
|
|
4211
|
+
/**
|
|
4212
|
+
* Get an element group from the map by its id.
|
|
4213
|
+
*
|
|
4214
|
+
* @example
|
|
4215
|
+
* ```typescript
|
|
4216
|
+
* const elementGroup = await felt.getElementGroup("element-group-1");
|
|
4217
|
+
* ```
|
|
4218
|
+
* @returns The requested element group.
|
|
4219
|
+
*/
|
|
4220
|
+
getElementGroup(id: string): Promise<ElementGroup | null>;
|
|
4221
|
+
/**
|
|
4222
|
+
* Gets element groups from the map, according to the filters supplied. If no
|
|
4223
|
+
* constraints are supplied, all element groups will be returned in rendering order.
|
|
4224
|
+
*
|
|
4225
|
+
* @example
|
|
4226
|
+
* ```typescript
|
|
4227
|
+
* const elementGroups = await felt.getElementGroups({ ids: ["element-group-1", "element-group-2"] });
|
|
4228
|
+
* ```
|
|
4229
|
+
* @returns The requested element groups.
|
|
4230
|
+
*/
|
|
4231
|
+
getElementGroups(
|
|
4232
|
+
/**
|
|
4233
|
+
* The constraints to apply to the element groups returned from the map.
|
|
4234
|
+
*/
|
|
4235
|
+
constraint?: GetElementGroupsConstraint): Promise<Array<ElementGroup | null>>;
|
|
4236
|
+
/**
|
|
4237
|
+
* Hide or show element groups with the given ids.
|
|
4238
|
+
*
|
|
4239
|
+
* @example
|
|
4240
|
+
* ```typescript
|
|
4241
|
+
* felt.setElementGroupVisibility({ show: ["element-group-1", "element-group-2"], hide: ["element-group-3"] });
|
|
4242
|
+
* ```
|
|
4243
|
+
*/
|
|
4244
|
+
setElementGroupVisibility(visibility: SetVisibilityRequest): Promise<void>;
|
|
4245
|
+
/**
|
|
4246
|
+
* Adds a listener for when an element is created.
|
|
4247
|
+
*
|
|
4248
|
+
* @returns A function to unsubscribe from the listener
|
|
4249
|
+
*
|
|
4250
|
+
* @event
|
|
4251
|
+
* @example
|
|
4252
|
+
* ```typescript
|
|
4253
|
+
* const unsubscribe = felt.onElementCreate({
|
|
4254
|
+
* handler: (element) => console.log(element.id),
|
|
4255
|
+
* });
|
|
4256
|
+
*
|
|
4257
|
+
* // later on...
|
|
4258
|
+
* unsubscribe();
|
|
4259
|
+
* ```
|
|
4260
|
+
*/
|
|
4261
|
+
onElementCreate(args: {
|
|
4262
|
+
/**
|
|
4263
|
+
* The handler that is called when an element is created.
|
|
4264
|
+
*
|
|
4265
|
+
* This will fire when elements are created programatically, or when the
|
|
4266
|
+
* user starts creating an element with a drawing tool.
|
|
4267
|
+
*
|
|
4268
|
+
* When the user creates an element with a drawing tool, it can begin in
|
|
4269
|
+
* an invalid state, such as if you've just placed a single point in a polygon.
|
|
4270
|
+
*
|
|
4271
|
+
* You can use the `isBeingCreated` property to determine if the element is
|
|
4272
|
+
* still being created by a drawing tool.
|
|
4273
|
+
*
|
|
4274
|
+
* If you want to know when the element is finished being created, you can
|
|
4275
|
+
* use the {@link ElementsController.onElementCreateEnd | `onElementCreateEnd`} listener.
|
|
4276
|
+
*
|
|
4277
|
+
* @param change - An object describing the change that occurred.
|
|
4278
|
+
*/
|
|
4279
|
+
handler: (change: ElementChangeCallbackParams) => void;
|
|
4280
|
+
}): VoidFunction;
|
|
4281
|
+
/**
|
|
4282
|
+
* Listens for when a new element is finished being created by a drawing tool.
|
|
4283
|
+
*
|
|
4284
|
+
* This differs from the {@link ElementsController.onElementCreate | `onElementCreate`} listener, which fires whenever an
|
|
4285
|
+
* element is first created. This fires when the user finishes creating an element
|
|
4286
|
+
* which could be after a series of interactions.
|
|
4287
|
+
*
|
|
4288
|
+
* For example, when creating a polygon, the user places a series of points then
|
|
4289
|
+
* finishes by pressing Enter or Escape. Or when creating a Place element, they
|
|
4290
|
+
* add the marker, type a label, then finally deselect the element.
|
|
4291
|
+
*
|
|
4292
|
+
* @returns A function to unsubscribe from the listener
|
|
4293
|
+
*
|
|
4294
|
+
* @event
|
|
4295
|
+
* @example
|
|
4296
|
+
* ```typescript
|
|
4297
|
+
* const unsubscribe = felt.onToolCreatedElement({
|
|
4298
|
+
* handler: (params) => console.log(params),
|
|
4299
|
+
* });
|
|
4300
|
+
*
|
|
4301
|
+
* // later on...
|
|
4302
|
+
* unsubscribe();
|
|
4303
|
+
* ```
|
|
4304
|
+
*/
|
|
4305
|
+
onElementCreateEnd(args: {
|
|
4306
|
+
/**
|
|
4307
|
+
* The handler to call whenever this event fires.
|
|
4308
|
+
*
|
|
4309
|
+
* @param params - An object containing the element that was created.
|
|
4310
|
+
*/
|
|
4311
|
+
handler: (params: {
|
|
4312
|
+
element: Element;
|
|
4313
|
+
}) => void;
|
|
4314
|
+
}): VoidFunction;
|
|
4315
|
+
/**
|
|
4316
|
+
* Adds a listener for when an element changes.
|
|
4317
|
+
*
|
|
4318
|
+
* This will fire when an element is being edited, either on the map by the user
|
|
4319
|
+
* or programatically.
|
|
4320
|
+
*
|
|
4321
|
+
* Like the {@link ElementsController.onElementCreate | `onElementCreate`} listener, this will fire when an element is
|
|
4322
|
+
* still being created by a drawing tool.
|
|
4323
|
+
*
|
|
4324
|
+
* You can check the {@link ElementChangeCallbackParams.isBeingCreated | `isBeingCreated`} property to determine if the element is
|
|
4325
|
+
* still being created by a drawing tool.
|
|
4326
|
+
*
|
|
4327
|
+
* @returns A function to unsubscribe from the listener
|
|
4328
|
+
*
|
|
4329
|
+
* @event
|
|
4330
|
+
* @example
|
|
4331
|
+
* ```typescript
|
|
4332
|
+
* const unsubscribe = felt.onElementChange({
|
|
4333
|
+
* options: { id: "element-1" },
|
|
4334
|
+
* handler: ({element}) => console.log(element.id),
|
|
4335
|
+
* });
|
|
4336
|
+
*
|
|
4337
|
+
* // later on...
|
|
4338
|
+
* unsubscribe();
|
|
4339
|
+
* ```
|
|
4340
|
+
*/
|
|
4341
|
+
onElementChange(args: {
|
|
4342
|
+
options: {
|
|
4343
|
+
/**
|
|
4344
|
+
* The id of the element to listen for changes to.
|
|
4345
|
+
*/
|
|
4346
|
+
id: string;
|
|
4347
|
+
};
|
|
4348
|
+
/**
|
|
4349
|
+
* The handler that is called when the element changes.
|
|
4350
|
+
*/
|
|
4351
|
+
handler: (
|
|
4352
|
+
/**
|
|
4353
|
+
* An object describing the change that occurred.
|
|
4354
|
+
*/
|
|
4355
|
+
change: ElementChangeCallbackParams) => void;
|
|
4356
|
+
}): VoidFunction;
|
|
4357
|
+
/**
|
|
4358
|
+
* Adds a listener for when an element is deleted.
|
|
4359
|
+
*
|
|
4360
|
+
* @returns A function to unsubscribe from the listener
|
|
4361
|
+
*
|
|
4362
|
+
* @event
|
|
4363
|
+
* @example
|
|
4364
|
+
* ```typescript
|
|
4365
|
+
* const unsubscribe = felt.onElementDelete({
|
|
4366
|
+
* options: { id: "element-1" },
|
|
4367
|
+
* handler: () => console.log("element-1 deleted"),
|
|
4368
|
+
* });
|
|
4369
|
+
*
|
|
4370
|
+
* // later on...
|
|
4371
|
+
* unsubscribe();
|
|
4372
|
+
* ```
|
|
4373
|
+
*/
|
|
4374
|
+
onElementDelete(args: {
|
|
4375
|
+
options: {
|
|
4376
|
+
/**
|
|
4377
|
+
* The id of the element to listen for deletions of.
|
|
4378
|
+
*/
|
|
4379
|
+
id: string;
|
|
4380
|
+
};
|
|
4381
|
+
/**
|
|
4382
|
+
* The handler that is called when the element is deleted.
|
|
4383
|
+
*/
|
|
4384
|
+
handler: () => void;
|
|
4385
|
+
}): VoidFunction;
|
|
4386
|
+
/**
|
|
4387
|
+
* Adds a listener for when an element group changes.
|
|
4388
|
+
*
|
|
4389
|
+
* @returns A function to unsubscribe from the listener
|
|
4390
|
+
*
|
|
4391
|
+
* @event
|
|
4392
|
+
* @example
|
|
4393
|
+
* ```typescript
|
|
4394
|
+
* const unsubscribe = felt.onElementGroupChange({
|
|
4395
|
+
* options: { id: "element-group-1" },
|
|
4396
|
+
* handler: elementGroup => console.log(elementGroup.id),
|
|
4397
|
+
* });
|
|
4398
|
+
*
|
|
4399
|
+
* // later on...
|
|
4400
|
+
* unsubscribe();
|
|
4401
|
+
* ```
|
|
4402
|
+
*/
|
|
4403
|
+
onElementGroupChange(args: {
|
|
4404
|
+
options: {
|
|
4405
|
+
id: string;
|
|
4406
|
+
};
|
|
4407
|
+
handler: (change: ElementGroupChangeCallbackParams) => void;
|
|
4408
|
+
}): VoidFunction;
|
|
4409
|
+
/**
|
|
4410
|
+
* Create a new element on the map.
|
|
4411
|
+
*
|
|
4412
|
+
* @example
|
|
4413
|
+
* ```typescript
|
|
4414
|
+
* const element = await felt.createElement({ type: "Place", coordinates: [10, 10] });
|
|
4415
|
+
* ```
|
|
4416
|
+
*/
|
|
4417
|
+
createElement(element: ElementCreate): Promise<Element>;
|
|
4418
|
+
/**
|
|
4419
|
+
* Update an element on the map.
|
|
4420
|
+
*
|
|
4421
|
+
* @example
|
|
4422
|
+
* ```typescript
|
|
4423
|
+
* // Update a place element's coordinates
|
|
4424
|
+
* await felt.updateElement({
|
|
4425
|
+
* id: "element-1",
|
|
4426
|
+
* coordinates: [10, 20]
|
|
4427
|
+
* });
|
|
4428
|
+
*
|
|
4429
|
+
* // Update a polygon's style
|
|
4430
|
+
* await felt.updateElement({
|
|
4431
|
+
* id: "element-2",
|
|
4432
|
+
* color: "#ABC123",
|
|
4433
|
+
* fillOpacity: 0.5
|
|
4434
|
+
* });
|
|
4435
|
+
* ```
|
|
4436
|
+
*/
|
|
4437
|
+
updateElement(element: ElementUpdate): Promise<Element>;
|
|
4438
|
+
/**
|
|
4439
|
+
* Delete an element from the map.
|
|
4440
|
+
*
|
|
4441
|
+
* @example
|
|
4442
|
+
* ```typescript
|
|
4443
|
+
* await felt.deleteElement("element-1");
|
|
4444
|
+
* ```
|
|
4445
|
+
*/
|
|
4446
|
+
deleteElement(id: string): Promise<void>;
|
|
4447
|
+
}
|
|
4448
|
+
|
|
4140
4449
|
/**
|
|
4141
4450
|
* A LayerFeature is a single geographical item in a layer.
|
|
4142
4451
|
*
|
|
@@ -5443,13 +5752,10 @@ interface LayerFilters {
|
|
|
5443
5752
|
* @group Filters
|
|
5444
5753
|
*/
|
|
5445
5754
|
type GeometryFilter = FeltBoundary | PolygonGeometry | MultiPolygonGeometry | LngLatTuple[];
|
|
5446
|
-
|
|
5447
|
-
/**
|
|
5448
|
-
* The boundary for a layer
|
|
5449
|
-
*/
|
|
5450
|
-
type LayerBoundary = MultiPolygonGeometry;
|
|
5451
5755
|
/**
|
|
5452
5756
|
* All the different sources for boundaries for a layer, including their combined result.
|
|
5757
|
+
*
|
|
5758
|
+
* @group Filters
|
|
5453
5759
|
*/
|
|
5454
5760
|
interface LayerBoundaries {
|
|
5455
5761
|
/**
|
|
@@ -5457,7 +5763,7 @@ interface LayerBoundaries {
|
|
|
5457
5763
|
*
|
|
5458
5764
|
* When there are multiple spatial filters, they are combined into a multi-polygon.
|
|
5459
5765
|
*/
|
|
5460
|
-
spatialFilters:
|
|
5766
|
+
spatialFilters: MultiPolygonGeometry | null;
|
|
5461
5767
|
/**
|
|
5462
5768
|
* Boundaries that are set ephemerally by viewers in their own session.
|
|
5463
5769
|
*
|
|
@@ -5465,14 +5771,14 @@ interface LayerBoundaries {
|
|
|
5465
5771
|
* method is called. There is no way to set these in the Felt UI - they can only be
|
|
5466
5772
|
* set using the SDK.
|
|
5467
5773
|
*/
|
|
5468
|
-
ephemeral:
|
|
5774
|
+
ephemeral: GeometryFilter | null;
|
|
5469
5775
|
/**
|
|
5470
5776
|
* The combined result of all the boundaries set on the layer.
|
|
5471
5777
|
*
|
|
5472
5778
|
* Each different source of boundary is intersected to produce the combined result.
|
|
5473
5779
|
*
|
|
5474
5780
|
*/
|
|
5475
|
-
combined:
|
|
5781
|
+
combined: MultiPolygonGeometry | null;
|
|
5476
5782
|
}
|
|
5477
5783
|
|
|
5478
5784
|
declare const AggregateMethodSchema: z.ZodEnum<["avg", "max", "min", "sum", "median"]>;
|
|
@@ -6602,7 +6908,7 @@ interface LayersController {
|
|
|
6602
6908
|
*
|
|
6603
6909
|
* Passing `null` clears the ephemeral boundary for the layer.
|
|
6604
6910
|
*/
|
|
6605
|
-
boundary:
|
|
6911
|
+
boundary: GeometryFilter | null;
|
|
6606
6912
|
}): Promise<void>;
|
|
6607
6913
|
/**
|
|
6608
6914
|
* Adds a listener for when a layer's spatial boundaries change.
|
|
@@ -6974,6 +7280,64 @@ interface MapInteractionEvent {
|
|
|
6974
7280
|
rasterValues: Array<RasterValue>;
|
|
6975
7281
|
}
|
|
6976
7282
|
|
|
7283
|
+
/**
|
|
7284
|
+
* The Interactions controller allows you to observe interactions with the map
|
|
7285
|
+
*
|
|
7286
|
+
* @group Controller
|
|
7287
|
+
* @public
|
|
7288
|
+
*/
|
|
7289
|
+
interface InteractionsController {
|
|
7290
|
+
/**
|
|
7291
|
+
* Allows you to be notified the user clicks on the map.
|
|
7292
|
+
*
|
|
7293
|
+
* @returns A function to unsubscribe from the listener
|
|
7294
|
+
*
|
|
7295
|
+
* @event
|
|
7296
|
+
* @example
|
|
7297
|
+
* ```typescript
|
|
7298
|
+
* const unsubscribe = felt.onPointerClick({
|
|
7299
|
+
* handler: (event) => console.log(event.center, event.features),
|
|
7300
|
+
* });
|
|
7301
|
+
*
|
|
7302
|
+
* // later on...
|
|
7303
|
+
* unsubscribe();
|
|
7304
|
+
* ```
|
|
7305
|
+
*/
|
|
7306
|
+
onPointerClick(params: {
|
|
7307
|
+
handler: (event: MapInteractionEvent) => void;
|
|
7308
|
+
}): VoidFunction;
|
|
7309
|
+
/**
|
|
7310
|
+
* Allows you to be notified the user moves the mouse over the map.
|
|
7311
|
+
*
|
|
7312
|
+
* @returns A function to unsubscribe from the listener
|
|
7313
|
+
*
|
|
7314
|
+
* @event
|
|
7315
|
+
* @example
|
|
7316
|
+
* ```typescript
|
|
7317
|
+
* // Track mouse movement and features under cursor
|
|
7318
|
+
* const unsubscribe = felt.onPointerMove({
|
|
7319
|
+
* handler: (event) => {
|
|
7320
|
+
* console.log("Mouse position:", event.center);
|
|
7321
|
+
* console.log("Features under cursor:", event.features);
|
|
7322
|
+
* }
|
|
7323
|
+
* });
|
|
7324
|
+
*
|
|
7325
|
+
* // later on...
|
|
7326
|
+
* unsubscribe();
|
|
7327
|
+
* ```
|
|
7328
|
+
*/
|
|
7329
|
+
onPointerMove(
|
|
7330
|
+
/**
|
|
7331
|
+
* Params for the listener
|
|
7332
|
+
*/
|
|
7333
|
+
params: {
|
|
7334
|
+
/**
|
|
7335
|
+
* The handler function
|
|
7336
|
+
*/
|
|
7337
|
+
handler: (event: MapInteractionEvent) => void;
|
|
7338
|
+
}): VoidFunction;
|
|
7339
|
+
}
|
|
7340
|
+
|
|
6977
7341
|
/**
|
|
6978
7342
|
* The details of a map.
|
|
6979
7343
|
*
|
|
@@ -6994,6 +7358,27 @@ type MapDetails = {
|
|
|
6994
7358
|
description: string | null;
|
|
6995
7359
|
};
|
|
6996
7360
|
|
|
7361
|
+
/**
|
|
7362
|
+
* @group Controller
|
|
7363
|
+
* @public
|
|
7364
|
+
*/
|
|
7365
|
+
interface MiscController {
|
|
7366
|
+
/**
|
|
7367
|
+
* Gets the details of the map.
|
|
7368
|
+
*
|
|
7369
|
+
* @example
|
|
7370
|
+
* ```typescript
|
|
7371
|
+
* const details = await felt.getMapDetails();
|
|
7372
|
+
* console.log({
|
|
7373
|
+
* id: details.id,
|
|
7374
|
+
* title: details.title,
|
|
7375
|
+
* description: details.description,
|
|
7376
|
+
* });
|
|
7377
|
+
* ```
|
|
7378
|
+
*/
|
|
7379
|
+
getMapDetails(): Promise<MapDetails>;
|
|
7380
|
+
}
|
|
7381
|
+
|
|
6997
7382
|
/**
|
|
6998
7383
|
* A reference to any kind of entity in the map.
|
|
6999
7384
|
*
|
|
@@ -7111,16 +7496,117 @@ declare const FeatureSelectionSchema: z.ZodObject<{
|
|
|
7111
7496
|
} | undefined;
|
|
7112
7497
|
}>;
|
|
7113
7498
|
|
|
7114
|
-
|
|
7115
|
-
|
|
7116
|
-
|
|
7117
|
-
|
|
7118
|
-
|
|
7119
|
-
|
|
7120
|
-
|
|
7121
|
-
|
|
7122
|
-
|
|
7123
|
-
|
|
7499
|
+
/**
|
|
7500
|
+
* The Selection controller allows you to listen for changes to the selection on the map.
|
|
7501
|
+
*
|
|
7502
|
+
* @group Controller
|
|
7503
|
+
* @public
|
|
7504
|
+
*/
|
|
7505
|
+
interface SelectionController {
|
|
7506
|
+
/**
|
|
7507
|
+
* Gets the current selection as a list of entity identifiers.
|
|
7508
|
+
*
|
|
7509
|
+
* @example
|
|
7510
|
+
* ```typescript
|
|
7511
|
+
* const selection = await felt.getSelection();
|
|
7512
|
+
* ```
|
|
7513
|
+
*/
|
|
7514
|
+
getSelection(): Promise<EntityNode[]>;
|
|
7515
|
+
/**
|
|
7516
|
+
* Adds a listener for when the selection changes.
|
|
7517
|
+
*
|
|
7518
|
+
* @returns A function to unsubscribe from the listener
|
|
7519
|
+
*
|
|
7520
|
+
* @event
|
|
7521
|
+
* @example
|
|
7522
|
+
* ```typescript
|
|
7523
|
+
* const unsubscribe = felt.onSelectionChange({
|
|
7524
|
+
* handler: ({selection}) => console.log(selection),
|
|
7525
|
+
* });
|
|
7526
|
+
*
|
|
7527
|
+
* // later on...
|
|
7528
|
+
* unsubscribe();
|
|
7529
|
+
* ```
|
|
7530
|
+
*/
|
|
7531
|
+
onSelectionChange(params: {
|
|
7532
|
+
handler: (change: {
|
|
7533
|
+
/**
|
|
7534
|
+
* The new selection. In the case where there are multiple entities selected,
|
|
7535
|
+
* the array describes the chronological and semeantic order of the selection.
|
|
7536
|
+
*
|
|
7537
|
+
* Entities of the same type that are selected later will appear later in the
|
|
7538
|
+
* list, but there are cases where multiple entity types can be selected at once,
|
|
7539
|
+
* such as elements and features. In this case, the order of the _types_ of entities
|
|
7540
|
+
* tells you which are considered more semantically important.
|
|
7541
|
+
*
|
|
7542
|
+
* For example, if a feature and element are selected, the feature will be at the
|
|
7543
|
+
* tail of the list because pressing Escape will deselect the feature first, then
|
|
7544
|
+
* pressing Escape again will deselect the element.
|
|
7545
|
+
*/
|
|
7546
|
+
selection: EntityNode[];
|
|
7547
|
+
}) => void;
|
|
7548
|
+
}): VoidFunction;
|
|
7549
|
+
/**
|
|
7550
|
+
* Selects a feature on a layer. This will show the feature's popup, modal or
|
|
7551
|
+
* sidebar (if configured) and highlight the feature.
|
|
7552
|
+
*
|
|
7553
|
+
* @example
|
|
7554
|
+
* ```typescript
|
|
7555
|
+
* felt.selectFeature({
|
|
7556
|
+
* id: 123,
|
|
7557
|
+
* layerId: "my-layer",
|
|
7558
|
+
* showPopup: true,
|
|
7559
|
+
* fitViewport: { maxZoom: 15 },
|
|
7560
|
+
* });
|
|
7561
|
+
* ```
|
|
7562
|
+
*/
|
|
7563
|
+
selectFeature(params: FeatureSelection): Promise<void>;
|
|
7564
|
+
/**
|
|
7565
|
+
* Clears the current selection. This clears the selection of
|
|
7566
|
+
*
|
|
7567
|
+
* @example
|
|
7568
|
+
* ```typescript
|
|
7569
|
+
*
|
|
7570
|
+
* // Removes all features and elements from the selection
|
|
7571
|
+
* felt.clearSelection();
|
|
7572
|
+
*
|
|
7573
|
+
* // Removes only features from the selection
|
|
7574
|
+
* felt.clearSelection({ features: true });
|
|
7575
|
+
*
|
|
7576
|
+
* // Removes only elements from the selection
|
|
7577
|
+
* felt.clearSelection({ elements: true });
|
|
7578
|
+
* ```
|
|
7579
|
+
*
|
|
7580
|
+
* @default
|
|
7581
|
+
* ```typescript
|
|
7582
|
+
* { features: true, elements: true }
|
|
7583
|
+
* ```
|
|
7584
|
+
*
|
|
7585
|
+
* @param params - The parameters to clear the selection. If this is not provided,
|
|
7586
|
+
* both features and elements will be cleared.
|
|
7587
|
+
*/
|
|
7588
|
+
clearSelection(params?: {
|
|
7589
|
+
/**
|
|
7590
|
+
* Whether to clear the features from the selection.
|
|
7591
|
+
*/
|
|
7592
|
+
features?: boolean;
|
|
7593
|
+
/**
|
|
7594
|
+
* Whether to clear the elements from the selection.
|
|
7595
|
+
*/
|
|
7596
|
+
elements?: boolean;
|
|
7597
|
+
}): Promise<void>;
|
|
7598
|
+
}
|
|
7599
|
+
|
|
7600
|
+
declare const ToolSchema: z.ZodEnum<["pin", "line", "route", "polygon", "circle", "marker", "highlighter", "text", "note", "link"]>;
|
|
7601
|
+
type ToolType = z.infer<typeof ToolSchema>;
|
|
7602
|
+
type ConfigurableToolType = keyof ToolSettingsMap;
|
|
7603
|
+
declare const PinToolSettingsSchema: z.ZodObject<{
|
|
7604
|
+
symbol: z.ZodString;
|
|
7605
|
+
color: z.ZodString;
|
|
7606
|
+
frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
|
|
7607
|
+
afterCreation: z.ZodEnum<["enter name", "add another", "select"]>;
|
|
7608
|
+
}, "strip", z.ZodTypeAny, {
|
|
7609
|
+
symbol: string;
|
|
7124
7610
|
color: string;
|
|
7125
7611
|
frame: "frame-circle" | "frame-square" | null;
|
|
7126
7612
|
afterCreation: "enter name" | "add another" | "select";
|
|
@@ -7360,6 +7846,335 @@ type ToolSettingsMap = {
|
|
|
7360
7846
|
type PlaceFrame = "frame-circle" | "frame-square" | null;
|
|
7361
7847
|
type PlaceSymbol = "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}:` & {});
|
|
7362
7848
|
|
|
7849
|
+
/**
|
|
7850
|
+
* The Tools controller allows you to let users draw elements on the map.
|
|
7851
|
+
*
|
|
7852
|
+
* @group Controller
|
|
7853
|
+
* @public
|
|
7854
|
+
*/
|
|
7855
|
+
interface ToolsController {
|
|
7856
|
+
/**
|
|
7857
|
+
* Sets the tool to use for drawing elements on the map.
|
|
7858
|
+
*
|
|
7859
|
+
* @param tool - The tool to set.
|
|
7860
|
+
*
|
|
7861
|
+
* @example
|
|
7862
|
+
* ```typescript
|
|
7863
|
+
* // Set the tool to "marker"
|
|
7864
|
+
* await felt.setTool("marker");
|
|
7865
|
+
*
|
|
7866
|
+
* // put down the tool
|
|
7867
|
+
* await felt.setTool(null);
|
|
7868
|
+
* ```
|
|
7869
|
+
*/
|
|
7870
|
+
setTool(tool: ToolType | null): void;
|
|
7871
|
+
/**
|
|
7872
|
+
* Gets the current tool, if any is in use.
|
|
7873
|
+
*
|
|
7874
|
+
* @returns The current tool, or `null` if no tool is in use.
|
|
7875
|
+
*
|
|
7876
|
+
* @example
|
|
7877
|
+
* ```typescript
|
|
7878
|
+
* const tool = await felt.getTool(); // "marker", "polygon", etc.
|
|
7879
|
+
* ```
|
|
7880
|
+
*/
|
|
7881
|
+
getTool(): Promise<ToolType | null>;
|
|
7882
|
+
/**
|
|
7883
|
+
* Listens for changes to the current tool.
|
|
7884
|
+
*
|
|
7885
|
+
* @returns A function to unsubscribe from the listener
|
|
7886
|
+
*
|
|
7887
|
+
* @example
|
|
7888
|
+
* ```typescript
|
|
7889
|
+
* const unsubscribe = felt.onToolChange({
|
|
7890
|
+
* handler: tool => console.log(tool),
|
|
7891
|
+
* });
|
|
7892
|
+
*
|
|
7893
|
+
* // later on...
|
|
7894
|
+
* unsubscribe();
|
|
7895
|
+
* ```
|
|
7896
|
+
*/
|
|
7897
|
+
onToolChange(args: {
|
|
7898
|
+
/**
|
|
7899
|
+
* This callback is called with the current tool whenever the tool changes.
|
|
7900
|
+
*
|
|
7901
|
+
* @param tool - The current tool, or `null` if no tool is in use.
|
|
7902
|
+
*/
|
|
7903
|
+
handler: (tool: ToolType | null) => void;
|
|
7904
|
+
}): VoidFunction;
|
|
7905
|
+
/**
|
|
7906
|
+
* Sets the settings for the current tool.
|
|
7907
|
+
*
|
|
7908
|
+
* @example
|
|
7909
|
+
* ```typescript
|
|
7910
|
+
* // Set the settings for the marker tool
|
|
7911
|
+
* await felt.setToolSettings({
|
|
7912
|
+
* tool: "marker",
|
|
7913
|
+
* color: "#FE17",
|
|
7914
|
+
* });
|
|
7915
|
+
* ```
|
|
7916
|
+
*
|
|
7917
|
+
* @param settings - The settings to set.
|
|
7918
|
+
*/
|
|
7919
|
+
setToolSettings(settings: InputToolSettings): void;
|
|
7920
|
+
/**
|
|
7921
|
+
* Gets the settings for the chosen tool
|
|
7922
|
+
*
|
|
7923
|
+
* @example
|
|
7924
|
+
* ```typescript
|
|
7925
|
+
* const settings = await felt.getToolSettings("marker");
|
|
7926
|
+
* ```
|
|
7927
|
+
*
|
|
7928
|
+
* @returns The settings for the chosen tool.
|
|
7929
|
+
*/
|
|
7930
|
+
getToolSettings<T extends ConfigurableToolType>(tool: T): Promise<ToolSettingsMap[T]>;
|
|
7931
|
+
/**
|
|
7932
|
+
* Listens for changes to the settings on all tools.
|
|
7933
|
+
*
|
|
7934
|
+
* @example
|
|
7935
|
+
* ```typescript
|
|
7936
|
+
* const unsubscribe = felt.onToolSettingsChange({
|
|
7937
|
+
* handler: settings => console.log(settings),
|
|
7938
|
+
* });
|
|
7939
|
+
*
|
|
7940
|
+
* // later on...
|
|
7941
|
+
* unsubscribe();
|
|
7942
|
+
* ```
|
|
7943
|
+
* @returns A function to unsubscribe from the listener
|
|
7944
|
+
*/
|
|
7945
|
+
onToolSettingsChange(args: {
|
|
7946
|
+
handler: (settings: ToolSettingsChangeEvent) => void;
|
|
7947
|
+
}): VoidFunction;
|
|
7948
|
+
}
|
|
7949
|
+
|
|
7950
|
+
/**
|
|
7951
|
+
* @public
|
|
7952
|
+
*/
|
|
7953
|
+
interface UiControlsOptions extends zInfer<typeof UiControlsOptionsSchema> {
|
|
7954
|
+
}
|
|
7955
|
+
/**
|
|
7956
|
+
* @internal
|
|
7957
|
+
* @ignore
|
|
7958
|
+
*/
|
|
7959
|
+
declare const UiControlsOptionsSchema: z.ZodObject<{
|
|
7960
|
+
/**
|
|
7961
|
+
* Whether or not the legend is shown.
|
|
7962
|
+
*
|
|
7963
|
+
* @defaultValue true
|
|
7964
|
+
*/
|
|
7965
|
+
showLegend: z.ZodOptional<z.ZodBoolean>;
|
|
7966
|
+
/**
|
|
7967
|
+
* When co-operative gestures are enabled, the pan and zoom gestures are
|
|
7968
|
+
* adjusted to work better when the map is embedded in another page.
|
|
7969
|
+
*
|
|
7970
|
+
* @remarks
|
|
7971
|
+
* On mobile devices, enabling co-operative gestures will allow the user to
|
|
7972
|
+
* pan past the embedded map with a single finger drag. To pan the map, they
|
|
7973
|
+
* must use two fingers.
|
|
7974
|
+
*
|
|
7975
|
+
* On desktop devices, enabling co-operative gestures allows the user to
|
|
7976
|
+
* scroll past the embedded map using their scroll wheel or trackpad. To
|
|
7977
|
+
* zoom the map, they must hold the Ctrl (Windows) or Command key (Mac) while
|
|
7978
|
+
* scrolling.
|
|
7979
|
+
*
|
|
7980
|
+
* @defaultValue true
|
|
7981
|
+
*/
|
|
7982
|
+
cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
|
|
7983
|
+
/**
|
|
7984
|
+
* Whether or not the full screen button is shown in an embedded map.
|
|
7985
|
+
*
|
|
7986
|
+
* @remarks
|
|
7987
|
+
* When clicked, this will open the map in a new tab or window.
|
|
7988
|
+
*
|
|
7989
|
+
* @defaultValue true
|
|
7990
|
+
*/
|
|
7991
|
+
fullScreenButton: z.ZodOptional<z.ZodBoolean>;
|
|
7992
|
+
/**
|
|
7993
|
+
* Whether or not the geolocation button is shown in an embedded map.
|
|
7994
|
+
*
|
|
7995
|
+
* @remarks
|
|
7996
|
+
* The geolocation feature will plot your position on the map. If you
|
|
7997
|
+
* click the button again, it will start tracking your position.
|
|
7998
|
+
*
|
|
7999
|
+
* @defaultValue false
|
|
8000
|
+
*/
|
|
8001
|
+
geolocation: z.ZodOptional<z.ZodBoolean>;
|
|
8002
|
+
/**
|
|
8003
|
+
* Whether or not the zoom controls are shown in an embedded map.
|
|
8004
|
+
*
|
|
8005
|
+
* @remarks
|
|
8006
|
+
* This does not affect whether or not the map can be zoomed, just
|
|
8007
|
+
* the display of the zoom controls in the bottom right corner of the map.
|
|
8008
|
+
*
|
|
8009
|
+
* @defaultValue true
|
|
8010
|
+
*/
|
|
8011
|
+
zoomControls: z.ZodOptional<z.ZodBoolean>;
|
|
8012
|
+
/**
|
|
8013
|
+
* Whether or not the scale bar is shown in an embedded map.
|
|
8014
|
+
*
|
|
8015
|
+
* @defaultValue true
|
|
8016
|
+
*/
|
|
8017
|
+
scaleBar: z.ZodOptional<z.ZodBoolean>;
|
|
8018
|
+
}, "strip", z.ZodTypeAny, {
|
|
8019
|
+
showLegend?: boolean | undefined;
|
|
8020
|
+
cooperativeGestures?: boolean | undefined;
|
|
8021
|
+
fullScreenButton?: boolean | undefined;
|
|
8022
|
+
geolocation?: boolean | undefined;
|
|
8023
|
+
zoomControls?: boolean | undefined;
|
|
8024
|
+
scaleBar?: boolean | undefined;
|
|
8025
|
+
}, {
|
|
8026
|
+
showLegend?: boolean | undefined;
|
|
8027
|
+
cooperativeGestures?: boolean | undefined;
|
|
8028
|
+
fullScreenButton?: boolean | undefined;
|
|
8029
|
+
geolocation?: boolean | undefined;
|
|
8030
|
+
zoomControls?: boolean | undefined;
|
|
8031
|
+
scaleBar?: boolean | undefined;
|
|
8032
|
+
}>;
|
|
8033
|
+
/**
|
|
8034
|
+
* The options for which parts of the Felt UI can be shown when interacting with
|
|
8035
|
+
* features and elements on the map.
|
|
8036
|
+
*
|
|
8037
|
+
* Switching these off can be useful if you add your own click, selection or hover
|
|
8038
|
+
* handlers for features and elements.
|
|
8039
|
+
*
|
|
8040
|
+
* @public
|
|
8041
|
+
*/
|
|
8042
|
+
interface UiOnMapInteractionsOptions extends zInfer<typeof UiOnMapInteractionsOptionsSchema> {
|
|
8043
|
+
}
|
|
8044
|
+
/**
|
|
8045
|
+
* @internal
|
|
8046
|
+
* @ignore
|
|
8047
|
+
*/
|
|
8048
|
+
declare const UiOnMapInteractionsOptionsSchema: z.ZodObject<{
|
|
8049
|
+
/**
|
|
8050
|
+
* Set this to `false` to prevent the panel that shows information about a selected
|
|
8051
|
+
* feature from being shown.
|
|
8052
|
+
*/
|
|
8053
|
+
featureSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
8054
|
+
/**
|
|
8055
|
+
* Set this to `false` to prevent the panel that shows information about a hovered
|
|
8056
|
+
* feature from being shown.
|
|
8057
|
+
*/
|
|
8058
|
+
featureHoverPanel: z.ZodOptional<z.ZodBoolean>;
|
|
8059
|
+
/**
|
|
8060
|
+
* Set this to `false` to prevent the panel that shows information about a selected
|
|
8061
|
+
* element from being shown.
|
|
8062
|
+
*/
|
|
8063
|
+
elementSelectPanel: z.ZodOptional<z.ZodBoolean>;
|
|
8064
|
+
/**
|
|
8065
|
+
* Set this to `false` to prevent clicking on a map link element from opening that link
|
|
8066
|
+
* in a new tab or window.
|
|
8067
|
+
*/
|
|
8068
|
+
linkClickOpen: z.ZodOptional<z.ZodBoolean>;
|
|
8069
|
+
/**
|
|
8070
|
+
* Set this to `false` to prevent clicking on an image element from opening the image
|
|
8071
|
+
* in a lightbox.
|
|
8072
|
+
*/
|
|
8073
|
+
imageLightboxOpen: z.ZodOptional<z.ZodBoolean>;
|
|
8074
|
+
}, "strip", z.ZodTypeAny, {
|
|
8075
|
+
featureSelectPanel?: boolean | undefined;
|
|
8076
|
+
featureHoverPanel?: boolean | undefined;
|
|
8077
|
+
elementSelectPanel?: boolean | undefined;
|
|
8078
|
+
linkClickOpen?: boolean | undefined;
|
|
8079
|
+
imageLightboxOpen?: boolean | undefined;
|
|
8080
|
+
}, {
|
|
8081
|
+
featureSelectPanel?: boolean | undefined;
|
|
8082
|
+
featureHoverPanel?: boolean | undefined;
|
|
8083
|
+
elementSelectPanel?: boolean | undefined;
|
|
8084
|
+
linkClickOpen?: boolean | undefined;
|
|
8085
|
+
imageLightboxOpen?: boolean | undefined;
|
|
8086
|
+
}>;
|
|
8087
|
+
|
|
8088
|
+
/**
|
|
8089
|
+
* The UI controller allows you to control various aspects of the Felt UI in your embedded map.
|
|
8090
|
+
*
|
|
8091
|
+
* This includes enabling/disabling UI controls, managing on-map interactions, and controlling
|
|
8092
|
+
* the visibility of UI components like the data table.
|
|
8093
|
+
*
|
|
8094
|
+
* @group Controller
|
|
8095
|
+
* @public
|
|
8096
|
+
*/
|
|
8097
|
+
interface UiController {
|
|
8098
|
+
/**
|
|
8099
|
+
* Updates the UI controls on the embedded map.
|
|
8100
|
+
*
|
|
8101
|
+
* @example
|
|
8102
|
+
* ```typescript
|
|
8103
|
+
* // Show some UI controls
|
|
8104
|
+
* await felt.updateUiControls({
|
|
8105
|
+
* showLegend: true,
|
|
8106
|
+
* fullScreenButton: true,
|
|
8107
|
+
* });
|
|
8108
|
+
*
|
|
8109
|
+
* // Disable some UI options
|
|
8110
|
+
* await felt.updateUiControls({
|
|
8111
|
+
* cooperativeGestures: false,
|
|
8112
|
+
* geolocation: false,
|
|
8113
|
+
* });
|
|
8114
|
+
* ```
|
|
8115
|
+
*
|
|
8116
|
+
* @param controls - The controls to update.
|
|
8117
|
+
*/
|
|
8118
|
+
updateUiControls(controls: UiControlsOptions): void;
|
|
8119
|
+
/**
|
|
8120
|
+
* Control the on-map UI shown when interacting with features and elements.
|
|
8121
|
+
*
|
|
8122
|
+
* If you add your own click, selection or hover handlers you may want to disable
|
|
8123
|
+
* various parts of the Felt UI. This method allows you to control the visibility of
|
|
8124
|
+
* various parts of the UI that might otherwise be shown when people click or hover
|
|
8125
|
+
* on things.
|
|
8126
|
+
*
|
|
8127
|
+
* This does not affect selection. That means that selectable features and elements
|
|
8128
|
+
* will still be selected when clicked.
|
|
8129
|
+
*
|
|
8130
|
+
* @example
|
|
8131
|
+
* ```typescript
|
|
8132
|
+
* // Disable UI when hovering or selecting features
|
|
8133
|
+
* await felt.setOnMapInteractionsUi({
|
|
8134
|
+
* featureSelectPanel: false,
|
|
8135
|
+
* featureHoverPanel: false,
|
|
8136
|
+
* });
|
|
8137
|
+
* ```
|
|
8138
|
+
*/
|
|
8139
|
+
setOnMapInteractionsUi(options: UiOnMapInteractionsOptions): void;
|
|
8140
|
+
/**
|
|
8141
|
+
* Shows a data table view for the specified layer, optionally sorted by a given attribute.
|
|
8142
|
+
*
|
|
8143
|
+
* @example
|
|
8144
|
+
* ```typescript
|
|
8145
|
+
* // Show data table with default sorting
|
|
8146
|
+
* await felt.showLayerDataTable({
|
|
8147
|
+
* layerId: "layer-1",
|
|
8148
|
+
* });
|
|
8149
|
+
*
|
|
8150
|
+
* // Show data table sorted by height in descending order
|
|
8151
|
+
* await felt.showLayerDataTable({
|
|
8152
|
+
* layerId: "layer-1",
|
|
8153
|
+
* sorting: {
|
|
8154
|
+
* attribute: "height",
|
|
8155
|
+
* direction: "desc",
|
|
8156
|
+
* },
|
|
8157
|
+
* });
|
|
8158
|
+
*
|
|
8159
|
+
* // Show the data table pane with no table visible
|
|
8160
|
+
* await felt.showLayerDataTable();
|
|
8161
|
+
* ```
|
|
8162
|
+
*/
|
|
8163
|
+
showLayerDataTable(params?: {
|
|
8164
|
+
layerId: string;
|
|
8165
|
+
sorting?: SortConfig;
|
|
8166
|
+
}): Promise<void>;
|
|
8167
|
+
/**
|
|
8168
|
+
* Hides the data table.
|
|
8169
|
+
*
|
|
8170
|
+
* @example
|
|
8171
|
+
* ```typescript
|
|
8172
|
+
* await felt.hideLayerDataTable();
|
|
8173
|
+
* ```
|
|
8174
|
+
*/
|
|
8175
|
+
hideLayerDataTable(): Promise<void>;
|
|
8176
|
+
}
|
|
8177
|
+
|
|
7363
8178
|
/**
|
|
7364
8179
|
* The input type for setting the viewport to a particular center and zoom.
|
|
7365
8180
|
*
|
|
@@ -7507,4 +8322,195 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
|
|
|
7507
8322
|
bounds: [number, number, number, number];
|
|
7508
8323
|
}>;
|
|
7509
8324
|
|
|
7510
|
-
|
|
8325
|
+
/**
|
|
8326
|
+
* The viewport controller allows you to control the viewport of the map.
|
|
8327
|
+
*
|
|
8328
|
+
* You can get the current viewport, move the viewport, and be notified when
|
|
8329
|
+
* the viewport changes.
|
|
8330
|
+
*
|
|
8331
|
+
* @group Controller
|
|
8332
|
+
* @public
|
|
8333
|
+
*/
|
|
8334
|
+
interface ViewportController {
|
|
8335
|
+
/**
|
|
8336
|
+
* Gets the current state of the viewport.
|
|
8337
|
+
*
|
|
8338
|
+
* @example
|
|
8339
|
+
* ```typescript
|
|
8340
|
+
* // Get current viewport state
|
|
8341
|
+
* const viewport = await felt.getViewport();
|
|
8342
|
+
* console.log({
|
|
8343
|
+
* center: viewport.center,
|
|
8344
|
+
* zoom: viewport.zoom,
|
|
8345
|
+
* });
|
|
8346
|
+
* ```
|
|
8347
|
+
*/
|
|
8348
|
+
getViewport(): Promise<ViewportState>;
|
|
8349
|
+
/**
|
|
8350
|
+
* Moves the map to the specified location.
|
|
8351
|
+
*
|
|
8352
|
+
* @example
|
|
8353
|
+
* ```typescript
|
|
8354
|
+
* felt.setViewport({
|
|
8355
|
+
* center: { latitude: 0, longitude: 0 },
|
|
8356
|
+
* zoom: 10,
|
|
8357
|
+
* });
|
|
8358
|
+
* ```
|
|
8359
|
+
*/
|
|
8360
|
+
setViewport(viewport: SetViewportCenterZoomParams): void;
|
|
8361
|
+
/**
|
|
8362
|
+
* Gets the current state of the viewport constraints.
|
|
8363
|
+
*
|
|
8364
|
+
* @example
|
|
8365
|
+
* ```typescript
|
|
8366
|
+
* // Get current viewport constraints
|
|
8367
|
+
* const constraints = await felt.getViewportConstraints();
|
|
8368
|
+
* if (constraints) {
|
|
8369
|
+
* console.log({
|
|
8370
|
+
* bounds: constraints.bounds,
|
|
8371
|
+
* minZoom: constraints.minZoom,
|
|
8372
|
+
* maxZoom: constraints.maxZoom
|
|
8373
|
+
* });
|
|
8374
|
+
* } else {
|
|
8375
|
+
* console.log("No viewport constraints set");
|
|
8376
|
+
* }
|
|
8377
|
+
* ```
|
|
8378
|
+
*/
|
|
8379
|
+
getViewportConstraints(): Promise<ViewportConstraints | null>;
|
|
8380
|
+
/**
|
|
8381
|
+
* Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
|
|
8382
|
+
*
|
|
8383
|
+
* @example
|
|
8384
|
+
* ```typescript
|
|
8385
|
+
* felt.setViewportConstraints({
|
|
8386
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
8387
|
+
* minZoom: 1,
|
|
8388
|
+
* maxZoom: 23,
|
|
8389
|
+
* });
|
|
8390
|
+
* ```
|
|
8391
|
+
*
|
|
8392
|
+
* @example
|
|
8393
|
+
* every constraint is optional
|
|
8394
|
+
* ```typescript
|
|
8395
|
+
* felt.setViewportConstraints({
|
|
8396
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
8397
|
+
* });
|
|
8398
|
+
* ```
|
|
8399
|
+
*
|
|
8400
|
+
* @example
|
|
8401
|
+
* if a constraint is null, it will be removed but keeping the others
|
|
8402
|
+
* ```typescript
|
|
8403
|
+
* felt.setViewportConstraints({ bounds: null });
|
|
8404
|
+
* ```
|
|
8405
|
+
*
|
|
8406
|
+
* @example
|
|
8407
|
+
* if method receives null, it will remove the constraints
|
|
8408
|
+
* ```typescript
|
|
8409
|
+
* felt.setViewportConstraints(null);
|
|
8410
|
+
* ```
|
|
8411
|
+
*/
|
|
8412
|
+
setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
|
|
8413
|
+
/**
|
|
8414
|
+
* Fits the map to the specified bounds.
|
|
8415
|
+
*
|
|
8416
|
+
* @example
|
|
8417
|
+
* ```typescript
|
|
8418
|
+
* const west = -122.4194;
|
|
8419
|
+
* const south = 37.7749;
|
|
8420
|
+
* const east = -122.4194;
|
|
8421
|
+
* const north = 37.7749;
|
|
8422
|
+
* felt.fitViewportToBounds({ bounds: [west, south, east, north] });
|
|
8423
|
+
* ```
|
|
8424
|
+
*/
|
|
8425
|
+
fitViewportToBounds(bounds: ViewportFitBoundsParams): void;
|
|
8426
|
+
/**
|
|
8427
|
+
* Adds a listener for when the viewport changes.
|
|
8428
|
+
*
|
|
8429
|
+
* @returns A function to unsubscribe from the listener
|
|
8430
|
+
*
|
|
8431
|
+
* @event
|
|
8432
|
+
* @example
|
|
8433
|
+
* ```typescript
|
|
8434
|
+
* const unsubscribe = felt.onViewportMove({
|
|
8435
|
+
* handler: viewport => console.log(viewport.center.latitude),
|
|
8436
|
+
* });
|
|
8437
|
+
*
|
|
8438
|
+
* // later on...
|
|
8439
|
+
* unsubscribe();
|
|
8440
|
+
* ```
|
|
8441
|
+
*/
|
|
8442
|
+
onViewportMove(args: {
|
|
8443
|
+
/**
|
|
8444
|
+
* This callback is called with the current viewport state whenever
|
|
8445
|
+
* the viewport changes.
|
|
8446
|
+
*
|
|
8447
|
+
* @param viewport - The current viewport state.
|
|
8448
|
+
*/
|
|
8449
|
+
handler: (viewport: ViewportState) => void;
|
|
8450
|
+
}): VoidFunction;
|
|
8451
|
+
/**
|
|
8452
|
+
* Adds a listener for when the viewport move ends, which is when the user
|
|
8453
|
+
* stops dragging or zooming the map, animations have finished, or inertial
|
|
8454
|
+
* dragging ends.
|
|
8455
|
+
*
|
|
8456
|
+
* @returns A function to unsubscribe from the listener
|
|
8457
|
+
*
|
|
8458
|
+
* @event
|
|
8459
|
+
* @example
|
|
8460
|
+
* ```typescript
|
|
8461
|
+
* const unsubscribe = felt.onViewportMoveEnd({
|
|
8462
|
+
* handler: viewport => console.log(viewport.center.latitude),
|
|
8463
|
+
* });
|
|
8464
|
+
*
|
|
8465
|
+
* // later on...
|
|
8466
|
+
* unsubscribe();
|
|
8467
|
+
* ```
|
|
8468
|
+
*/
|
|
8469
|
+
onViewportMoveEnd(args: {
|
|
8470
|
+
handler: (viewport: ViewportState) => void;
|
|
8471
|
+
}): VoidFunction;
|
|
8472
|
+
/**
|
|
8473
|
+
* Adds a listener for when the map is idle, which is defined as:
|
|
8474
|
+
* - No transitions are in progress
|
|
8475
|
+
* - The user is not interacting with the map, e.g. by panning or zooming
|
|
8476
|
+
* - All tiles for the current viewport have been loaded
|
|
8477
|
+
* - Any fade transitions (e.g. for labels) have completed
|
|
8478
|
+
*
|
|
8479
|
+
* @returns A function to unsubscribe from the listener
|
|
8480
|
+
*
|
|
8481
|
+
* @event
|
|
8482
|
+
* @example
|
|
8483
|
+
* ```typescript
|
|
8484
|
+
* const unsubscribe = felt.onMapIdle({ handler: () => console.log("map is idle") });
|
|
8485
|
+
*
|
|
8486
|
+
* // later on...
|
|
8487
|
+
* unsubscribe();
|
|
8488
|
+
* ```
|
|
8489
|
+
*/
|
|
8490
|
+
onMapIdle(args: {
|
|
8491
|
+
handler: () => void;
|
|
8492
|
+
}): VoidFunction;
|
|
8493
|
+
}
|
|
8494
|
+
|
|
8495
|
+
/**
|
|
8496
|
+
* This is the main interface for interacting with a Felt map.
|
|
8497
|
+
*
|
|
8498
|
+
* This interface is composed of the various controllers, each having a
|
|
8499
|
+
* different area of responsibility.
|
|
8500
|
+
*
|
|
8501
|
+
* All the methods are listed here, but each controller is documented on its
|
|
8502
|
+
* own to make it easier to find related methods and events.
|
|
8503
|
+
*
|
|
8504
|
+
* @group Controller
|
|
8505
|
+
* @public
|
|
8506
|
+
*/
|
|
8507
|
+
interface FeltController extends ViewportController, UiController, LayersController, ElementsController, SelectionController, InteractionsController, ToolsController, InteractionsController, MiscController {
|
|
8508
|
+
/**
|
|
8509
|
+
* The iframe element containing the Felt map, if it is an embedded map.
|
|
8510
|
+
*
|
|
8511
|
+
* @readonly
|
|
8512
|
+
*/
|
|
8513
|
+
iframe: HTMLIFrameElement | null;
|
|
8514
|
+
}
|
|
8515
|
+
|
|
8516
|
+
export type { LayerChangeCallbackParams as $, TextElementUpdate as A, ElementsController as B, CircleElementCreate as C, MapInteractionEvent as D, Element as E, FeltController as F, GetElementGroupsConstraint as G, HighlighterElementCreate as H, ImageElementCreate as I, InteractionsController as J, CreateLayersFromGeoJsonParams as K, LinkElementRead as L, MarkerElementCreate as M, NoteElementCreate as N, DataOnlyLayer as O, PathElementCreate as P, FeltTiledVectorSource as Q, GeoJsonDataVectorSource as R, GeoJsonFileVectorSource as S, TextElementCreate as T, UiControlsOptions as U, ViewportCenterZoom as V, GeoJsonUrlVectorSource as W, GetLayerGroupsConstraint as X, GetLayersConstraint as Y, GetRenderedFeaturesConstraint as Z, Layer as _, CircleElementRead as a, SetVisibilityRequest as a$, LayerCommon as a0, LayerGroup as a1, LayerGroupChangeCallbackParams as a2, LayerProcessingStatus as a3, LegendItem as a4, LegendItemChangeCallbackParams as a5, LegendItemIdentifier as a6, LegendItemsConstraint as a7, RasterBand as a8, RasterLayer as a9, GetLayerHistogramParams as aA, MultiAggregationConfig as aB, ValueConfiguration as aC, LayersController as aD, MapDetails as aE, MiscController as aF, ElementGroupNode as aG, ElementNode as aH, EntityNode as aI, FeatureNode as aJ, FeatureSelection as aK, LayerGroupNode as aL, LayerNode as aM, SelectionController as aN, FeltBoundary as aO, FeltZoom as aP, GeoJsonFeature as aQ, GeoJsonGeometry as aR, GeoJsonProperties as aS, LatLng as aT, LineStringGeometry as aU, LngLatTuple as aV, MultiLineStringGeometry as aW, MultiPointGeometry as aX, MultiPolygonGeometry as aY, PointGeometry as aZ, PolygonGeometry as a_, RasterLayerSource as aa, UpdateLayerParams as ab, VectorLayer as ac, LayerFeature as ad, RasterValue as ae, LayerSchema as af, LayerSchemaAttribute as ag, LayerSchemaBooleanAttribute as ah, LayerSchemaCommonAttribute as ai, LayerSchemaDateAttribute as aj, LayerSchemaDateTimeAttribute as ak, LayerSchemaNumericAttribute as al, LayerSchemaTextAttribute as am, FilterExpression as an, FilterLogicGate as ao, FilterTernary as ap, Filters as aq, GeometryFilter as ar, LayerBoundaries as as, LayerFilters as at, AggregationConfig as au, AggregationMethod as av, GetLayerCalculationParams as aw, GetLayerCategoriesGroup as ax, GetLayerCategoriesParams as ay, GetLayerHistogramBin as az, CircleElementUpdate as b, SortConfig as b0, SortDirection as b1, CircleToolSettings as b2, ConfigurableToolType as b3, HighlighterToolSettings as b4, InputToolSettings as b5, LineToolSettings as b6, MarkerToolSettings as b7, NoteToolSettings as b8, PinToolSettings as b9, PlaceFrame as ba, PlaceSymbol as bb, PolygonToolSettings as bc, RouteToolSettings as bd, TextToolSettings as be, ToolSettingsChangeEvent as bf, ToolSettingsMap as bg, ToolType as bh, ToolsController as bi, UiOnMapInteractionsOptions as bj, UiController as bk, SetViewportCenterZoomParams as bl, ViewportConstraints as bm, ViewportFitBoundsParams as bn, ViewportState as bo, ViewportController as bp, UnwrapPromise as bq, UnionToIntersection as br, PromiseOrNot as bs, ElementChangeCallbackParams as c, ElementCreate as d, ElementGroup as e, ElementGroupChangeCallbackParams as f, ElementUpdate as g, GetElementsConstraint as h, HighlighterElementRead as i, HighlighterElementUpdate as j, ImageElementRead as k, ImageElementUpdate as l, MarkerElementRead as m, MarkerElementUpdate as n, NoteElementRead as o, NoteElementUpdate as p, PathElementRead as q, PathElementUpdate as r, PlaceElementCreate as s, PlaceElementRead as t, PlaceElementUpdate as u, PolygonElementCreate as v, PolygonElementRead as w, PolygonElementUpdate as x, TextElementRead as y, zInfer as z };
|