@feltmaps/js-sdk
Version:
An SDK for Felt maps
169 lines (164 loc) • 10.6 kB
TypeScript
import { z as zInfer, U as UiControlsOptions, V as ViewportCenterZoom, F as FeltController } from './controller-Dpyt1fNF.js';
export { au as AggregatedGridConfig, av as AggregationConfig, aw as AggregationMethod, C as CircleElementCreate, a as CircleElementRead, b as CircleElementUpdate, b8 as CircleToolSettings, b9 as ConfigurableToolType, ax as CountGridConfig, bp as CreateActionTriggerParams, K as CreateLayersFromGeoJsonParams, bq as CreateOrUpdatePanelParams, br as CreatePanelElementsParams, O as DataOnlyLayer, bs as DeletePanelElementsParams, E as Element, c as ElementChangeCallbackParams, d as ElementCreate, e as ElementGroup, f as ElementGroupChangeCallbackParams, aM as ElementGroupNode, aN as ElementNode, g as ElementUpdate, B as ElementsController, aO as EntityNode, aP as FeatureNode, aQ as FeatureSelection, aU as FeltBoundary, Q as FeltTiledVectorSource, aV as FeltZoom, an as FilterExpression, ao as FilterLogicGate, ap as FilterTernary, aq as Filters, R as GeoJsonDataVectorSource, aW as GeoJsonFeature, S as GeoJsonFileVectorSource, aX as GeoJsonGeometry, aY as GeoJsonProperties, W as GeoJsonUrlVectorSource, ar as GeometryFilter, G as GetElementGroupsConstraint, h as GetElementsConstraint, ay as GetLayerCalculationParams, az as GetLayerCategoriesGroup, aA as GetLayerCategoriesParams, X as GetLayerGroupsConstraint, aB as GetLayerHistogramBin, aC as GetLayerHistogramParams, aD as GetLayerPrecomputedCalculationParams, Y as GetLayersConstraint, Z as GetRenderedFeaturesConstraint, aE as GridConfig, aF as GridType, H as HighlighterElementCreate, i as HighlighterElementRead, j as HighlighterElementUpdate, ba as HighlighterToolSettings, I as ImageElementCreate, k as ImageElementRead, l as ImageElementUpdate, bb as InputToolSettings, J as InteractionsController, aZ as LatLng, _ as Layer, as as LayerBoundaries, $ as LayerChangeCallbackParams, a0 as LayerCommon, ad as LayerFeature, at as LayerFilters, a1 as LayerGroup, a2 as LayerGroupChangeCallbackParams, aR as LayerGroupNode, aS as LayerNode, a3 as LayerProcessingStatus, af as LayerSchema, ag as LayerSchemaAttribute, ah as LayerSchemaBooleanAttribute, ai as LayerSchemaCommonAttribute, aj as LayerSchemaDateAttribute, ak as LayerSchemaDateTimeAttribute, al as LayerSchemaNumericAttribute, am as LayerSchemaTextAttribute, aJ as LayersController, a4 as LegendItem, a5 as LegendItemChangeCallbackParams, a6 as LegendItemIdentifier, a7 as LegendItemsConstraint, a_ as LineStringGeometry, bc as LineToolSettings, L as LinkElementRead, a$ as LngLatTuple, aK as MapDetails, D as MapInteractionEvent, M as MarkerElementCreate, m as MarkerElementRead, n as MarkerElementUpdate, bd as MarkerToolSettings, aL as MiscController, aG as MultiAggregationConfig, b0 as MultiLineStringGeometry, b1 as MultiPointGeometry, b2 as MultiPolygonGeometry, N as NoteElementCreate, o as NoteElementRead, p as NoteElementUpdate, be as NoteToolSettings, bt as OnMapInteractionsOptions, P as PathElementCreate, q as PathElementRead, r as PathElementUpdate, bf as PinToolSettings, s as PlaceElementCreate, t as PlaceElementRead, u as PlaceElementUpdate, bg as PlaceFrame, bh as PlaceSymbol, bw as PlacementForUIElement, b3 as PointGeometry, v as PolygonElementCreate, w as PolygonElementRead, x as PolygonElementUpdate, b4 as PolygonGeometry, bi as PolygonToolSettings, aH as PrecomputedAggregationMethod, a8 as RasterBand, a9 as RasterLayer, aa as RasterLayerSource, ae as RasterValue, bj as RouteToolSettings, aT as SelectionController, cd as SetViewportCenterZoomParams, b5 as SetVisibilityRequest, b6 as SortConfig, b7 as SortDirection, T as TextElementCreate, y as TextElementRead, A as TextElementUpdate, bk as TextToolSettings, bl as ToolSettingsChangeEvent, bm as ToolSettingsMap, bn as ToolType, bo as ToolsController, cb as UIActionTriggerCreate, bz as UIButtonElement, bA as UIButtonElementCreate, bB as UIButtonElementUpdate, bX as UIButtonRowElement, bY as UIButtonRowElementCreate, bZ as UIButtonRowElementUpdate, b_ as UICheckboxGroupElement, b$ as UICheckboxGroupElementCreate, c0 as UICheckboxGroupElementUpdate, ca as UIControlElementOption, bI as UIDividerElement, bJ as UIDividerElementCreate, bK as UIDividerElementUpdate, bF as UIFlexibleSpaceElement, bG as UIFlexibleSpaceElementCreate, bH as UIFlexibleSpaceElementUpdate, bU as UIGridContainerElement, bV as UIGridContainerElementCreate, bW as UIGridContainerElementUpdate, c7 as UIIframeElement, c8 as UIIframeElementCreate, c9 as UIIframeElementUpdate, bx as UIPanel, by as UIPanelCreateOrUpdate, bR as UIPanelElement, bS as UIPanelElementCreate, bT as UIPanelElementUpdate, c1 as UIRadioGroupElement, c2 as UIRadioGroupElementCreate, c3 as UIRadioGroupElementUpdate, bO as UISelectElement, bP as UISelectElementCreate, bQ as UISelectElementUpdate, bC as UITextElement, bD as UITextElementCreate, bE as UITextElementUpdate, bL as UITextInputElement, bM as UITextInputElementCreate, bN as UITextInputElementUpdate, c4 as UIToggleGroupElement, c5 as UIToggleGroupElementCreate, c6 as UIToggleGroupElementUpdate, cc as UiController, bu as UpdateActionTriggerParams, ab as UpdateLayerParams, bv as UpdatePanelElementsParams, aI as ValueConfiguration, ac as VectorLayer, ce as ViewportConstraints, ch as ViewportController, cf as ViewportFitBoundsParams, cg as ViewportState } from './controller-Dpyt1fNF.js';
import { z } from 'zod';
/**
* @group Instantiation
* @public
*/
interface FeltEmbedOptions extends zInfer<typeof FeltEmbedOptionsSchema> {
uiControls?: UiControlsOptions;
initialViewport?: ViewportCenterZoom;
}
/**
* @internal
*/
declare const FeltEmbedOptionsSchema: z.ZodObject<{
/**
* @hidden
*/
origin: z.ZodOptional<z.ZodString>;
/**
* A short-lived (15 minutes) authentication token to use for showing embeds that are configured to be
* private.
*/
token: z.ZodOptional<z.ZodString>;
uiControls: z.ZodOptional<z.ZodObject<{
showLegend: z.ZodOptional<z.ZodBoolean>;
cooperativeGestures: z.ZodOptional<z.ZodBoolean>;
fullScreenButton: z.ZodOptional<z.ZodBoolean>;
geolocation: z.ZodOptional<z.ZodBoolean>;
zoomControls: z.ZodOptional<z.ZodBoolean>;
scaleBar: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
showLegend?: boolean | undefined;
cooperativeGestures?: boolean | undefined;
fullScreenButton?: boolean | undefined;
geolocation?: boolean | undefined;
zoomControls?: boolean | undefined;
scaleBar?: boolean | undefined;
}, {
showLegend?: boolean | undefined;
cooperativeGestures?: boolean | undefined;
fullScreenButton?: boolean | undefined;
geolocation?: boolean | undefined;
zoomControls?: boolean | undefined;
scaleBar?: boolean | undefined;
}>>;
initialViewport: z.ZodOptional<z.ZodObject<{
center: z.ZodObject<{
latitude: z.ZodNumber;
longitude: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
latitude: number;
longitude: number;
}, {
latitude: number;
longitude: number;
}>;
zoom: z.ZodNumber;
}, "strip", z.ZodTypeAny, {
center: {
latitude: number;
longitude: number;
};
zoom: number;
}, {
center: {
latitude: number;
longitude: number;
};
zoom: number;
}>>;
}, "strip", z.ZodTypeAny, {
origin?: string | undefined;
token?: string | undefined;
uiControls?: {
showLegend?: boolean | undefined;
cooperativeGestures?: boolean | undefined;
fullScreenButton?: boolean | undefined;
geolocation?: boolean | undefined;
zoomControls?: boolean | undefined;
scaleBar?: boolean | undefined;
} | undefined;
initialViewport?: {
center: {
latitude: number;
longitude: number;
};
zoom: number;
} | undefined;
}, {
origin?: string | undefined;
token?: string | undefined;
uiControls?: {
showLegend?: boolean | undefined;
cooperativeGestures?: boolean | undefined;
fullScreenButton?: boolean | undefined;
geolocation?: boolean | undefined;
zoomControls?: boolean | undefined;
scaleBar?: boolean | undefined;
} | undefined;
initialViewport?: {
center: {
latitude: number;
longitude: number;
};
zoom: number;
} | undefined;
}>;
/**
* Use the {@link Felt} object to embed a new iframe, or connect to an existing embedded
* iframe.
*
* Once you have connected to a Felt map (either by embedding or connecting to an existing
* iframe), you can use the {@link FeltController} object to control the map.
*
* To see what you can do with the map, see the documentation for the {@link FeltController}
* interface and its constituent controllers.
*
* @example
* ```typescript
* // embed the map
* const map = await Felt.embed(container, "felt-map-abc-123");
*
* // now the map is loaded and connected, you can use the FeltController interface
* // to control the map. For instance, to get information about the layers
* const layers = await map.getLayers();
*
* // Or to set the viewport to a specific location and zoom level
* await map.setViewport({
* center: { latitude: 37.8113, longitude: -122.2682 },
* zoom: 10,
* });
* ```
*
* @module Main
*/
/**
* The Felt SDK is a library for embedding Felt maps into your website,
* allowing you to control and inspect the map programmatically.
*
* @public
*
* @group Instantiation
*/
declare const Felt: {
/**
* Embeds a Felt map into the provided container, returning a promise that resolves
* to a {@link FeltController} object that you can use to control the map.
*
* @param container - The container element to embed the map into.
* @param mapId - The ID of the map to embed.
* @param options - The options to configure the map.
* @returns A promise for a {@link FeltController}.
*/
embed(container: HTMLElement, mapId: string, options?: FeltEmbedOptions): Promise<FeltController>;
/**
* Binds to an existing Felt map iframe.
*
* @param feltWindow - The iframe element containing the Felt map.
* @returns
*/
connect(feltWindow: Pick<Window, "postMessage">): Promise<FeltController>;
};
export { Felt, FeltController, type FeltEmbedOptions, UiControlsOptions, ViewportCenterZoom };