@feltmaps/js-sdk 1.5.0-next.1 → 1.5.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 +40 -3
- package/dist/client.d.ts +40 -3
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +43 -1
- package/dist/handler.d.ts +43 -1
- package/dist/handler.js +1 -1
- package/dist/{types-CVxZMwC_.d.cts → types-BLsf5GHN.d.cts} +29 -3
- package/dist/{types-CVxZMwC_.d.ts → types-BLsf5GHN.d.ts} +29 -3
- package/handler.d.ts +43 -1
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-CVxZMwC_.d.ts → types-BLsf5GHN.d.ts} +29 -3
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)g(e,n,{get:r[n],enumerable:!0})},
|
|
1
|
+
"use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var M=Object.prototype.hasOwnProperty;var b=(e,r)=>{for(var n in r)g(e,n,{get:r[n],enumerable:!0})},I=(e,r,n,i)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of S(r))!M.call(e,s)&&s!==n&&g(e,s,{get:()=>r[s],enumerable:!(i=F(r,s))||i.enumerable});return e};var f=e=>I(g({},"__esModule",{value:!0}),e);var x={};b(x,{Felt:()=>P});module.exports=f(x);function o(e,r){return({handler:n,options:i})=>{let s=new MessageChannel,a=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:i?{eventName:r,id:a,options:i}:{eventName:r,id:a}},"*",[s.port2]),s.port1.onmessage=l=>{n(l.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:a},"*")}}}function t(e,r){return n=>{let i=new MessageChannel;return e.postMessage({type:r,params:n},"*",[i.port2]),new Promise((s,a)=>{i.port1.onmessage=l=>{l.data&&typeof l.data=="object"&&"__error__"in l.data?a(new Error(l.data.__error__)):s(l.data),i.port1.close(),i.port2.close()}})}}var u=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:o(e,"onElementChange"),onElementGroupChange:o(e,"onElementGroupChange")});var C=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var h=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:o(e,"onLayerChange"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:o(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:o(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),getRenderedFeatures:t(e,"getRenderedFeatures")});var L=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var T=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:o(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:o(e,"onToolSettingsChange")});var v=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var V=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:o(e,"onViewportMove"),onViewportMoveEnd:o(e,"onViewportMoveEnd"),onMapIdle:o(e,"onMapIdle")});function E(e){return{iframe:null,...V(e),...v(e),...h(e),...u(e),...L(e),...C(e),...T(e)}}var P={embed(e,r,n){let i={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},s=n?.origin??i.origin,a=new URL(`${s}/embed/map/${r}`),l={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},y={...i.uiControls,...n?.uiControls};for(let[m,d]of G(y))d!=null&&a.searchParams.set(l[m],d?"1":"0");if(n?.token&&a.searchParams.set("token",n.token),n?.initialViewport){let m=n.initialViewport;a.searchParams.set("loc",`${m.center.latitude},${m.center.longitude},${m.zoom}z`)}let c=e.tagName==="IFRAME",p=c?e:e.ownerDocument.createElement("iframe");return p.src=a.toString(),c||(p.style.width="100%",p.style.height="100%",p.style.border="none",p.style.margin="0",e.appendChild(p)),p.referrerPolicy="strict-origin-when-cross-origin",new Promise((m,d)=>{p.addEventListener("load",()=>{p.contentWindow==null?d(new Error("Failed to load Felt map")):m(p.contentWindow)},{once:!0})}).then(P.connect).then(m=>(Object.defineProperties(m,{iframe:{value:p,writable:!1,configurable:!1}}),m))},connect(e){let r=E(e);return new Promise((n,i)=>{let s=setTimeout(()=>{i(new Error("Failed to load Felt map")),clearInterval(l)},5e3),a=new MessageChannel,l=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[a.port2])},100);a.port1.onmessage=y=>{y.data===!0&&(clearInterval(l),clearTimeout(s),a.port1.close(),a.port2.close(),n(r))}})}},G=Object.entries;0&&(module.exports={Felt});
|
package/dist/client.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as Geometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, L as Layer, f as GetLayersConstraint, g as LayerChangeCallbackParams, h as LayerGroup, i as GetLayerGroupsConstraint, j as LayerGroupChangeCallbackParams, k as LegendItemIdentifier, l as LegendItem, m as LegendItemsConstraint, n as LegendItemChangeCallbackParams, o as LayerFilters, F as Filters, p as GetRenderedFeaturesConstraint, q as Feature, M as MapInteractionEvent, r as EntityNode, s as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, v as SetViewportCenterZoomParams, w as
|
|
2
|
-
export {
|
|
1
|
+
import { E as Element, G as Geometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, L as Layer, f as GetLayersConstraint, g as LayerChangeCallbackParams, h as LayerGroup, i as GetLayerGroupsConstraint, j as LayerGroupChangeCallbackParams, k as LegendItemIdentifier, l as LegendItem, m as LegendItemsConstraint, n as LegendItemChangeCallbackParams, o as LayerFilters, F as Filters, p as GetRenderedFeaturesConstraint, q as Feature, M as MapInteractionEvent, r as EntityNode, s as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, v as SetViewportCenterZoomParams, w as ViewportConstraints, x as ViewportFitBoundsParams, y as ViewportCenterZoom } from './types-BLsf5GHN.cjs';
|
|
2
|
+
export { a1 as CircleToolSettings, J as ElementGroupNode, K as ElementNode, N as FeatureNode, Q as FeltBoundary, U as FeltZoom, B as FilterExpression, D as FilterLogicGate, H as FilterTernary, a2 as HighlighterToolSettings, W as LatLng, O as LayerGroupNode, P as LayerNode, A as LayerProcessingStatus, X as LineStringGeometry, a3 as LineToolSettings, Y as LngLatTuple, a4 as MarkerToolSettings, Z as MultiLineStringGeometry, _ as MultiPolygonGeometry, a5 as NoteToolSettings, a6 as PinFrame, a7 as PinSymbol, a8 as PinToolSettings, $ as PointGeometry, a0 as PolygonGeometry, a9 as PolygonToolSettings, R as RasterValue, aa as RouteToolSettings, ab as TextToolSettings } from './types-BLsf5GHN.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -894,6 +894,43 @@ interface ViewportController {
|
|
|
894
894
|
* ```
|
|
895
895
|
*/
|
|
896
896
|
setViewport(viewport: SetViewportCenterZoomParams): void;
|
|
897
|
+
/**
|
|
898
|
+
* Gets the current state of the viewport constraints.
|
|
899
|
+
*/
|
|
900
|
+
getViewportConstraints(): Promise<ViewportConstraints | null>;
|
|
901
|
+
/**
|
|
902
|
+
* Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* ```typescript
|
|
906
|
+
* felt.setViewportConstraints({
|
|
907
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
908
|
+
* minZoom: 1,
|
|
909
|
+
* maxZoom: 23,
|
|
910
|
+
* });
|
|
911
|
+
* ```
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* every constraint is optional
|
|
915
|
+
* ```typescript
|
|
916
|
+
* felt.setViewportConstraints({
|
|
917
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
918
|
+
* });
|
|
919
|
+
* ```
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* if a constraint is null, it will be removed but keeping the others
|
|
923
|
+
* ```typescript
|
|
924
|
+
* felt.setViewportConstraints({ bounds: null });
|
|
925
|
+
* ```
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* if method receives null, it will remove the constraints
|
|
929
|
+
* ```typescript
|
|
930
|
+
* felt.setViewportConstraints(null);
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
933
|
+
setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
|
|
897
934
|
/**
|
|
898
935
|
* Fits the map to the specified bounds.
|
|
899
936
|
*
|
|
@@ -1159,4 +1196,4 @@ declare const Felt: {
|
|
|
1159
1196
|
connect(feltWindow: Window): Promise<FeltController>;
|
|
1160
1197
|
};
|
|
1161
1198
|
|
|
1162
|
-
export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
|
1199
|
+
export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as Element, G as Geometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, L as Layer, f as GetLayersConstraint, g as LayerChangeCallbackParams, h as LayerGroup, i as GetLayerGroupsConstraint, j as LayerGroupChangeCallbackParams, k as LegendItemIdentifier, l as LegendItem, m as LegendItemsConstraint, n as LegendItemChangeCallbackParams, o as LayerFilters, F as Filters, p as GetRenderedFeaturesConstraint, q as Feature, M as MapInteractionEvent, r as EntityNode, s as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, v as SetViewportCenterZoomParams, w as
|
|
2
|
-
export {
|
|
1
|
+
import { E as Element, G as Geometry, a as GetElementsConstraint, b as ElementGroup, c as GetElementGroupsConstraint, S as SetVisibilityRequest, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, L as Layer, f as GetLayersConstraint, g as LayerChangeCallbackParams, h as LayerGroup, i as GetLayerGroupsConstraint, j as LayerGroupChangeCallbackParams, k as LegendItemIdentifier, l as LegendItem, m as LegendItemsConstraint, n as LegendItemChangeCallbackParams, o as LayerFilters, F as Filters, p as GetRenderedFeaturesConstraint, q as Feature, M as MapInteractionEvent, r as EntityNode, s as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, z as zInfer, V as ViewportState, v as SetViewportCenterZoomParams, w as ViewportConstraints, x as ViewportFitBoundsParams, y as ViewportCenterZoom } from './types-BLsf5GHN.js';
|
|
2
|
+
export { a1 as CircleToolSettings, J as ElementGroupNode, K as ElementNode, N as FeatureNode, Q as FeltBoundary, U as FeltZoom, B as FilterExpression, D as FilterLogicGate, H as FilterTernary, a2 as HighlighterToolSettings, W as LatLng, O as LayerGroupNode, P as LayerNode, A as LayerProcessingStatus, X as LineStringGeometry, a3 as LineToolSettings, Y as LngLatTuple, a4 as MarkerToolSettings, Z as MultiLineStringGeometry, _ as MultiPolygonGeometry, a5 as NoteToolSettings, a6 as PinFrame, a7 as PinSymbol, a8 as PinToolSettings, $ as PointGeometry, a0 as PolygonGeometry, a9 as PolygonToolSettings, R as RasterValue, aa as RouteToolSettings, ab as TextToolSettings } from './types-BLsf5GHN.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -894,6 +894,43 @@ interface ViewportController {
|
|
|
894
894
|
* ```
|
|
895
895
|
*/
|
|
896
896
|
setViewport(viewport: SetViewportCenterZoomParams): void;
|
|
897
|
+
/**
|
|
898
|
+
* Gets the current state of the viewport constraints.
|
|
899
|
+
*/
|
|
900
|
+
getViewportConstraints(): Promise<ViewportConstraints | null>;
|
|
901
|
+
/**
|
|
902
|
+
* Constrains the map viewport so it stays inside certain bounds and/or certain zoom levels.
|
|
903
|
+
*
|
|
904
|
+
* @example
|
|
905
|
+
* ```typescript
|
|
906
|
+
* felt.setViewportConstraints({
|
|
907
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
908
|
+
* minZoom: 1,
|
|
909
|
+
* maxZoom: 23,
|
|
910
|
+
* });
|
|
911
|
+
* ```
|
|
912
|
+
*
|
|
913
|
+
* @example
|
|
914
|
+
* every constraint is optional
|
|
915
|
+
* ```typescript
|
|
916
|
+
* felt.setViewportConstraints({
|
|
917
|
+
* bounds: [-122.5372532, 37.6652478, -122.1927016, 37.881707],
|
|
918
|
+
* });
|
|
919
|
+
* ```
|
|
920
|
+
*
|
|
921
|
+
* @example
|
|
922
|
+
* if a constraint is null, it will be removed but keeping the others
|
|
923
|
+
* ```typescript
|
|
924
|
+
* felt.setViewportConstraints({ bounds: null });
|
|
925
|
+
* ```
|
|
926
|
+
*
|
|
927
|
+
* @example
|
|
928
|
+
* if method receives null, it will remove the constraints
|
|
929
|
+
* ```typescript
|
|
930
|
+
* felt.setViewportConstraints(null);
|
|
931
|
+
* ```
|
|
932
|
+
*/
|
|
933
|
+
setViewportConstraints(constraints: Partial<ViewportConstraints> | null): void;
|
|
897
934
|
/**
|
|
898
935
|
* Fits the map to the specified bounds.
|
|
899
936
|
*
|
|
@@ -1159,4 +1196,4 @@ declare const Felt: {
|
|
|
1159
1196
|
connect(feltWindow: Window): Promise<FeltController>;
|
|
1160
1197
|
};
|
|
1161
1198
|
|
|
1162
|
-
export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
|
1199
|
+
export { ConfigurableToolType, Element, ElementChangeCallbackParams, ElementGroup, ElementGroupChangeCallbackParams, type ElementsController, EntityNode, Feature, FeatureSelection, Felt, type FeltController, type FeltEmbedOptions, Filters, Geometry, GetElementGroupsConstraint, GetElementsConstraint, GetLayerGroupsConstraint, GetLayersConstraint, GetRenderedFeaturesConstraint, InputToolSettings, type InteractionsController, Layer, LayerChangeCallbackParams, LayerFilters, LayerGroup, LayerGroupChangeCallbackParams, type LayersController, LegendItem, LegendItemChangeCallbackParams, LegendItemIdentifier, LegendItemsConstraint, MapInteractionEvent, type UiOnMapInteractionsOptions as OnMapInteractionsOptions, type SelectionController, SetViewportCenterZoomParams, SetVisibilityRequest, ToolSettingsChangeEvent, ToolSettingsMap, ToolType, type ToolsController, type UiController, type UiControlsOptions, ViewportCenterZoom, ViewportConstraints, type ViewportController, ViewportFitBoundsParams, ViewportState };
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function o(e,m){return({handler:n,options:s})=>{let a=new MessageChannel,r=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:m,id:r,options:s}:{eventName:m,id:r}},"*",[a.port2]),a.port1.onmessage=i=>{n(i.data)},()=>{a.port1.onmessage=null,a.port1.close(),a.port2.close(),e.postMessage({type:"felt.removeListener",id:r},"*")}}}function t(e,m){return n=>{let s=new MessageChannel;return e.postMessage({type:m,params:n},"*",[s.port2]),new Promise((a,r)=>{s.port1.onmessage=i=>{i.data&&typeof i.data=="object"&&"__error__"in i.data?r(new Error(i.data.__error__)):a(i.data),s.port1.close(),s.port2.close()}})}}var c=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:o(e,"onElementChange"),onElementGroupChange:o(e,"onElementGroupChange")});var u=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var C=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:o(e,"onLayerChange"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:o(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:o(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),getRenderedFeatures:t(e,"getRenderedFeatures")});var h=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var L=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:o(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:o(e,"onToolSettingsChange")});var T=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var v=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:o(e,"onViewportMove"),onViewportMoveEnd:o(e,"onViewportMoveEnd"),onMapIdle:o(e,"onMapIdle")});function
|
|
1
|
+
function o(e,m){return({handler:n,options:s})=>{let a=new MessageChannel,r=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:m,id:r,options:s}:{eventName:m,id:r}},"*",[a.port2]),a.port1.onmessage=i=>{n(i.data)},()=>{a.port1.onmessage=null,a.port1.close(),a.port2.close(),e.postMessage({type:"felt.removeListener",id:r},"*")}}}function t(e,m){return n=>{let s=new MessageChannel;return e.postMessage({type:m,params:n},"*",[s.port2]),new Promise((a,r)=>{s.port1.onmessage=i=>{i.data&&typeof i.data=="object"&&"__error__"in i.data?r(new Error(i.data.__error__)):a(i.data),s.port1.close(),s.port2.close()}})}}var c=e=>({getElement:t(e,"getElement"),getElementGeometry:t(e,"getElementGeometry"),getElements:t(e,"getElements"),setElementGroupVisibility:t(e,"setElementGroupVisibility"),getElementGroup:t(e,"getElementGroup"),getElementGroups:t(e,"getElementGroups"),onElementChange:o(e,"onElementChange"),onElementGroupChange:o(e,"onElementGroupChange")});var u=e=>({onPointerClick:o(e,"onPointerClick"),onPointerMove:o(e,"onPointerMove")});var C=e=>({getLayer:t(e,"getLayer"),getLayers:t(e,"getLayers"),setLayerVisibility:t(e,"setLayerVisibility"),setLayerStyle:t(e,"setLayerStyle"),setLayerLegendVisibility:t(e,"setLayerLegendVisibility"),onLayerChange:o(e,"onLayerChange"),getLayerGroup:t(e,"getLayerGroup"),getLayerGroups:t(e,"getLayerGroups"),setLayerGroupVisibility:t(e,"setLayerGroupVisibility"),setLayerGroupLegendVisibility:t(e,"setLayerGroupLegendVisibility"),onLayerGroupChange:o(e,"onLayerGroupChange"),getLegendItem:t(e,"getLegendItem"),getLegendItems:t(e,"getLegendItems"),setLegendItemVisibility:t(e,"setLegendItemVisibility"),onLegendItemChange:o(e,"onLegendItemChange"),getLayerFilters:t(e,"getLayerFilters"),setLayerFilters:t(e,"setLayerFilters"),getRenderedFeatures:t(e,"getRenderedFeatures")});var h=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var L=e=>({setTool:t(e,"setTool"),getTool:t(e,"getTool"),onToolChange:o(e,"onToolChange"),setToolSettings:t(e,"setToolSettings"),getToolSettings:t(e,"getToolSettings"),onToolSettingsChange:o(e,"onToolSettingsChange")});var T=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi")});var v=e=>({getViewport:t(e,"getViewport"),setViewport:t(e,"setViewport"),getViewportConstraints:t(e,"getViewportConstraints"),setViewportConstraints:t(e,"setViewportConstraints"),fitViewportToBounds:t(e,"fitViewportToBounds"),onViewportMove:o(e,"onViewportMove"),onViewportMoveEnd:o(e,"onViewportMoveEnd"),onMapIdle:o(e,"onMapIdle")});function V(e){return{iframe:null,...v(e),...T(e),...C(e),...c(e),...h(e),...u(e),...L(e)}}var E={embed(e,m,n){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},a=n?.origin??s.origin,r=new URL(`${a}/embed/map/${m}`),i={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},y={...s.uiControls,...n?.uiControls};for(let[p,d]of P(y))d!=null&&r.searchParams.set(i[p],d?"1":"0");if(n?.token&&r.searchParams.set("token",n.token),n?.initialViewport){let p=n.initialViewport;r.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let g=e.tagName==="IFRAME",l=g?e:e.ownerDocument.createElement("iframe");return l.src=r.toString(),g||(l.style.width="100%",l.style.height="100%",l.style.border="none",l.style.margin="0",e.appendChild(l)),l.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,d)=>{l.addEventListener("load",()=>{l.contentWindow==null?d(new Error("Failed to load Felt map")):p(l.contentWindow)},{once:!0})}).then(E.connect).then(p=>(Object.defineProperties(p,{iframe:{value:l,writable:!1,configurable:!1}}),p))},connect(e){let m=V(e);return new Promise((n,s)=>{let a=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(i)},5e3),r=new MessageChannel,i=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[r.port2])},100);r.port1.onmessage=y=>{y.data===!0&&(clearInterval(i),clearTimeout(a),r.port1.close(),r.port2.close(),n(m))}})}},P=Object.entries;export{E as Felt};
|
package/dist/handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var Se=(o,s)=>{for(var h in s)v(o,h,{get:s[h],enumerable:!0})},be=(o,s,h,L)=>{if(s&&typeof s=="object"||typeof s=="function")for(let u of fe(s))!he.call(o,u)&&u!==h&&v(o,u,{get:()=>s[u],enumerable:!(L=ue(s,u))||L.enumerable});return o};var Me=o=>be(v({},"__esModule",{value:!0}),o);var Ot={};Se(Ot,{createMessageHandler:()=>Ft});module.exports=Me(Ot);var l=require("zod");var f=require("zod");var g=require("zod");function t(o,s){return g.z.strictObject({type:g.z.literal(o),params:s})}function S(o,s){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string(),options:s})}function m(o){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string()})}var c=require("zod"),V=c.z.number(),P=c.z.number(),z=c.z.object({latitude:P,longitude:V}),Z=c.z.number().min(1).max(23),I=c.z.tuple([V,P,V,P]),b=c.z.object({show:c.z.array(c.z.string()).optional(),hide:c.z.array(c.z.string()).optional()});var M=require("zod"),U=M.z.object({ids:M.z.array(M.z.string()).optional()}),B=M.z.object({ids:M.z.array(M.z.string()).optional()});var Le=t("getElement",f.z.string()),xe=t("getElementGeometry",f.z.string()),Ge=t("getElements",U.optional()),Ie=t("getElementGroup",f.z.string()),Te=t("getElementGroups",B.optional()),Ce=t("setElementGroupVisibility",b),ze=S("onElementChange",f.z.object({id:f.z.string()})),Fe=S("onElementGroupChange",f.z.object({id:f.z.string()})),A={methods:[Le,xe,Ge,Ie,Te,Ce],listeners:[ze,Fe]};var Ee=m("onPointerClick"),we=m("onPointerMove"),q={methods:null,listeners:[Ee,we]};var i=require("zod");var n=require("zod"),ve=n.z.enum(["in","ni"]),Ve=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),_t=n.z.enum(["and","or"]),H=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),W=n.z.string().or(n.z.null()),Pe=n.z.tuple([W,ve,n.z.array(H).or(n.z.null())]),ke=n.z.tuple([W,Ve,H]),k=n.z.union([Pe,ke]),O=n.z.tuple([n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()]))]),K=n.z.union([O,k,n.z.null(),n.z.boolean()]);var r=require("zod");var $t=r.z.enum(["processing","completed","failed","incomplete"]),_=r.z.object({ids:r.z.array(r.z.string()).optional()}),Q=r.z.object({ids:r.z.array(r.z.string()).optional()}),x=r.z.object({id:r.z.string(),layerId:r.z.string()}),D=r.z.object({ids:x.array().optional(),layerIds:r.z.string().array().optional()}),$=r.z.object({layerIds:r.z.array(r.z.string()).optional(),areaQuery:r.z.union([r.z.object({coordinates:z}),r.z.object({boundary:I})]).optional()});var Oe=t("getLayer",i.z.string()),je=t("getLayers",_.optional()),Ne=t("setLayerVisibility",b),Re=S("onLayerChange",i.z.object({id:i.z.string()})),Ze=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),Ue=t("setLayerLegendVisibility",b),Be=t("getLayerGroup",i.z.string()),Ae=t("getLayerGroups",Q.optional()),qe=t("setLayerGroupVisibility",b),He=t("setLayerGroupLegendVisibility",b),We=S("onLayerGroupChange",i.z.object({id:i.z.string()})),Ke=t("getLegendItem",x),_e=t("getLegendItems",D.optional()),Qe=S("onLegendItemChange",x),De=t("setLegendItemVisibility",i.z.object({show:x.array().optional(),hide:x.array().optional()})),$e=t("getLayerFilters",i.z.string()),Je=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:K,note:i.z.string().optional()})),Xe=t("getRenderedFeatures",$.optional()),J={methods:[Oe,je,Ne,Ze,Ue,Be,Ae,qe,He,Ke,_e,De,$e,Je,Xe],listeners:[Re,We,Qe]};var T=require("zod");var d=require("zod"),X=d.z.object({id:d.z.string().or(d.z.number()),layerId:d.z.string(),showPopup:d.z.boolean().optional(),fitViewport:d.z.boolean().or(d.z.object({maxZoom:d.z.number()})).optional()});var Ye=t("getSelection",T.z.undefined()),et=m("onSelectionChange"),tt=t("selectFeature",X),ot=t("clearSelection",T.z.object({features:T.z.boolean().optional(),elements:T.z.boolean().optional()}).optional()),Y={methods:[Ye,tt,ot],listeners:[et]};var re=require("zod");var e=require("zod"),ee=["pin","line","route","polygon","circle","marker","highlighter","text","note"],te=e.z.enum([...ee,"link"]),oe=e.z.enum(ee),nt=e.z.object({color:e.z.string(),symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable()}),rt=e.z.object({color:e.z.string(),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean()}),st=e.z.object({color:e.z.string(),routingMode:e.z.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean(),endCaps:e.z.boolean()}),it=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),areaMarker:e.z.boolean()}),at=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),radiusMarker:e.z.boolean()}),lt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100)}),pt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(200)}),mt=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ct=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ne=e.z.discriminatedUnion("tool",[nt.partial().extend({tool:e.z.literal("pin")}),rt.partial().extend({tool:e.z.literal("line")}),st.partial().extend({tool:e.z.literal("route")}),it.partial().extend({tool:e.z.literal("polygon")}),at.partial().extend({tool:e.z.literal("circle")}),lt.partial().extend({tool:e.z.literal("marker")}),pt.partial().extend({tool:e.z.literal("highlighter")}),mt.partial().extend({tool:e.z.literal("text")}),ct.partial().extend({tool:e.z.literal("note")})]);var yt=t("setTool",te.nullable()),gt=t("getTool",re.z.undefined()),dt=m("onToolChange"),ut=t("setToolSettings",ne),ft=t("getToolSettings",oe),ht=m("onToolSettingsChange"),se={methods:[yt,gt,ut,ft],listeners:[dt,ht]};var a=require("zod"),ie=a.z.object({showLegend:a.z.boolean().optional(),cooperativeGestures:a.z.boolean().optional(),fullScreenButton:a.z.boolean().optional(),geolocation:a.z.boolean().optional(),zoomControls:a.z.boolean().optional(),scaleBar:a.z.boolean().optional()}),ae=a.z.object({featureSelectPanel:a.z.boolean().optional(),featureHoverPanel:a.z.boolean().optional(),elementSelectPanel:a.z.boolean().optional(),linkClickOpen:a.z.boolean().optional(),imageLightboxOpen:a.z.boolean().optional()});var St=t("updateUiControls",ie),bt=t("setOnMapInteractionsUi",ae),le={methods:[St,bt],listeners:null};var j=require("zod");var C=require("zod");var F=C.z.object({center:z,zoom:Z}),pe=C.z.object({center:F.shape.center.optional(),zoom:F.shape.zoom.optional()}),me=C.z.object({minZoom:F.shape.zoom.nullish(),maxZoom:F.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),ce=C.z.object({bounds:I});var Mt=t("getViewport",j.z.undefined()),Lt=t("setViewport",pe),xt=t("getViewportConstraints",j.z.undefined()),Gt=t("setViewportConstraints",me),It=t("fitViewportToBounds",ce),Tt=m("onViewportMove"),Ct=m("onViewportMoveEnd"),zt=m("onMapIdle"),ye={methods:[Lt,Mt,xt,Gt,It],listeners:[Tt,Ct,zt]};var N=[le,ye,J,A,Y,q,se];function Ft(o,s,h){let L=new Map;async function u(y){if(!kt.safeParse(y.data).success){h?.onUnknownMessage?.(y.data);return}let R=de.safeParse(y.data);if(!R.success){h?.onInvalidMessage?.(y.data);return}let{data:p}=R;if(p.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let G="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:w=>{y.ports[0]?.postMessage(w)}}:{handler:w=>{y.ports[0]?.postMessage(w)}},E=s.listeners[p.event.eventName](G);L.set(p.event.id,E)}else if(p.type==="felt.removeListener")L.get(p.id)?.(),L.delete(p.id);else try{let G=s.methods[p.type],E=await G(p.params);y.ports[0]?.postMessage(E)}catch(G){y.ports[0]?.postMessage({__error__:Et(G)})}}return o.addEventListener("message",u),()=>{o.removeEventListener("message",u)}}function Et(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}var ge={methods:N.map(o=>o.methods??[]).flat(),listeners:N.map(o=>o.listeners??[]).flat()},wt=l.z.discriminatedUnion("eventName",[l.z.strictObject({eventName:l.z.literal("")}),...ge.listeners]),vt=l.z.strictObject({type:l.z.literal("felt.addListener"),event:wt}),Vt=l.z.strictObject({type:l.z.literal("felt.removeListener"),id:l.z.string()}),Pt=l.z.strictObject({type:l.z.literal("felt.ready")}),de=l.z.discriminatedUnion("type",[Pt,vt,Vt,...ge.methods]),kt=l.z.object({type:l.z.enum(de.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/dist/handler.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams,
|
|
3
|
+
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams, H as FilterTernary, r as EntityNode, T as ToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, V as ViewportState, w as ViewportConstraints, ac as UnionToIntersection, ad as PromiseOrNot } from './types-BLsf5GHN.cjs';
|
|
4
4
|
|
|
5
5
|
type Method<TRequest extends {
|
|
6
6
|
type: string;
|
|
@@ -1321,6 +1321,46 @@ declare const GotoViewportMessage: z.ZodObject<{
|
|
|
1321
1321
|
};
|
|
1322
1322
|
type: "setViewport";
|
|
1323
1323
|
}>;
|
|
1324
|
+
declare const GetViewportConstraintsMessage: z.ZodObject<{
|
|
1325
|
+
type: z.ZodLiteral<"getViewportConstraints">;
|
|
1326
|
+
params: z.ZodUndefined;
|
|
1327
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1328
|
+
type: "getViewportConstraints";
|
|
1329
|
+
params?: undefined;
|
|
1330
|
+
}, {
|
|
1331
|
+
type: "getViewportConstraints";
|
|
1332
|
+
params?: undefined;
|
|
1333
|
+
}>;
|
|
1334
|
+
declare const SetViewportConstraintsMessage: z.ZodObject<{
|
|
1335
|
+
type: z.ZodLiteral<"setViewportConstraints">;
|
|
1336
|
+
params: z.ZodNullable<z.ZodObject<{
|
|
1337
|
+
minZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1338
|
+
maxZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1339
|
+
bounds: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>>;
|
|
1340
|
+
}, "strip", z.ZodTypeAny, {
|
|
1341
|
+
minZoom?: number | null | undefined;
|
|
1342
|
+
maxZoom?: number | null | undefined;
|
|
1343
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1344
|
+
}, {
|
|
1345
|
+
minZoom?: number | null | undefined;
|
|
1346
|
+
maxZoom?: number | null | undefined;
|
|
1347
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1348
|
+
}>>;
|
|
1349
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1350
|
+
params: {
|
|
1351
|
+
minZoom?: number | null | undefined;
|
|
1352
|
+
maxZoom?: number | null | undefined;
|
|
1353
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1354
|
+
} | null;
|
|
1355
|
+
type: "setViewportConstraints";
|
|
1356
|
+
}, {
|
|
1357
|
+
params: {
|
|
1358
|
+
minZoom?: number | null | undefined;
|
|
1359
|
+
maxZoom?: number | null | undefined;
|
|
1360
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1361
|
+
} | null;
|
|
1362
|
+
type: "setViewportConstraints";
|
|
1363
|
+
}>;
|
|
1324
1364
|
declare const ViewportFitBoundsMessage: z.ZodObject<{
|
|
1325
1365
|
type: z.ZodLiteral<"fitViewportToBounds">;
|
|
1326
1366
|
params: z.ZodObject<{
|
|
@@ -1345,6 +1385,8 @@ type ViewportSchema = {
|
|
|
1345
1385
|
methods: {
|
|
1346
1386
|
getViewport: Method<zInfer<typeof GetViewportMessage>, ViewportState>;
|
|
1347
1387
|
setViewport: Method<zInfer<typeof GotoViewportMessage>, void>;
|
|
1388
|
+
getViewportConstraints: Method<zInfer<typeof GetViewportConstraintsMessage>, ViewportConstraints | null>;
|
|
1389
|
+
setViewportConstraints: Method<zInfer<typeof SetViewportConstraintsMessage>, void>;
|
|
1348
1390
|
fitViewportToBounds: Method<zInfer<typeof ViewportFitBoundsMessage>, void>;
|
|
1349
1391
|
};
|
|
1350
1392
|
listeners: {
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams,
|
|
3
|
+
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams, H as FilterTernary, r as EntityNode, T as ToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, V as ViewportState, w as ViewportConstraints, ac as UnionToIntersection, ad as PromiseOrNot } from './types-BLsf5GHN.js';
|
|
4
4
|
|
|
5
5
|
type Method<TRequest extends {
|
|
6
6
|
type: string;
|
|
@@ -1321,6 +1321,46 @@ declare const GotoViewportMessage: z.ZodObject<{
|
|
|
1321
1321
|
};
|
|
1322
1322
|
type: "setViewport";
|
|
1323
1323
|
}>;
|
|
1324
|
+
declare const GetViewportConstraintsMessage: z.ZodObject<{
|
|
1325
|
+
type: z.ZodLiteral<"getViewportConstraints">;
|
|
1326
|
+
params: z.ZodUndefined;
|
|
1327
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1328
|
+
type: "getViewportConstraints";
|
|
1329
|
+
params?: undefined;
|
|
1330
|
+
}, {
|
|
1331
|
+
type: "getViewportConstraints";
|
|
1332
|
+
params?: undefined;
|
|
1333
|
+
}>;
|
|
1334
|
+
declare const SetViewportConstraintsMessage: z.ZodObject<{
|
|
1335
|
+
type: z.ZodLiteral<"setViewportConstraints">;
|
|
1336
|
+
params: z.ZodNullable<z.ZodObject<{
|
|
1337
|
+
minZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1338
|
+
maxZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1339
|
+
bounds: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>>;
|
|
1340
|
+
}, "strip", z.ZodTypeAny, {
|
|
1341
|
+
minZoom?: number | null | undefined;
|
|
1342
|
+
maxZoom?: number | null | undefined;
|
|
1343
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1344
|
+
}, {
|
|
1345
|
+
minZoom?: number | null | undefined;
|
|
1346
|
+
maxZoom?: number | null | undefined;
|
|
1347
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1348
|
+
}>>;
|
|
1349
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1350
|
+
params: {
|
|
1351
|
+
minZoom?: number | null | undefined;
|
|
1352
|
+
maxZoom?: number | null | undefined;
|
|
1353
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1354
|
+
} | null;
|
|
1355
|
+
type: "setViewportConstraints";
|
|
1356
|
+
}, {
|
|
1357
|
+
params: {
|
|
1358
|
+
minZoom?: number | null | undefined;
|
|
1359
|
+
maxZoom?: number | null | undefined;
|
|
1360
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1361
|
+
} | null;
|
|
1362
|
+
type: "setViewportConstraints";
|
|
1363
|
+
}>;
|
|
1324
1364
|
declare const ViewportFitBoundsMessage: z.ZodObject<{
|
|
1325
1365
|
type: z.ZodLiteral<"fitViewportToBounds">;
|
|
1326
1366
|
params: z.ZodObject<{
|
|
@@ -1345,6 +1385,8 @@ type ViewportSchema = {
|
|
|
1345
1385
|
methods: {
|
|
1346
1386
|
getViewport: Method<zInfer<typeof GetViewportMessage>, ViewportState>;
|
|
1347
1387
|
setViewport: Method<zInfer<typeof GotoViewportMessage>, void>;
|
|
1388
|
+
getViewportConstraints: Method<zInfer<typeof GetViewportConstraintsMessage>, ViewportConstraints | null>;
|
|
1389
|
+
setViewportConstraints: Method<zInfer<typeof SetViewportConstraintsMessage>, void>;
|
|
1348
1390
|
fitViewportToBounds: Method<zInfer<typeof ViewportFitBoundsMessage>, void>;
|
|
1349
1391
|
};
|
|
1350
1392
|
listeners: {
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as l}from"zod";import{z as f}from"zod";import{z as y}from"zod";function t(n,h){return y.strictObject({type:y.literal(n),params:h})}function d(n,h){return y.strictObject({eventName:y.literal(n),id:y.string(),options:h})}function p(n){return y.strictObject({eventName:y.literal(n),id:y.string()})}import{z as m}from"zod";var
|
|
1
|
+
import{z as l}from"zod";import{z as f}from"zod";import{z as y}from"zod";function t(n,h){return y.strictObject({type:y.literal(n),params:h})}function d(n,h){return y.strictObject({eventName:y.literal(n),id:y.string(),options:h})}function p(n){return y.strictObject({eventName:y.literal(n),id:y.string()})}import{z as m}from"zod";var E=m.number(),w=m.number(),x=m.object({latitude:w,longitude:E}),N=m.number().min(1).max(23),L=m.tuple([E,w,E,w]),u=m.object({show:m.array(m.string()).optional(),hide:m.array(m.string()).optional()});import{z as S}from"zod";var R=S.object({ids:S.array(S.string()).optional()}),Z=S.object({ids:S.array(S.string()).optional()});var ge=t("getElement",f.string()),de=t("getElementGeometry",f.string()),ue=t("getElements",R.optional()),fe=t("getElementGroup",f.string()),he=t("getElementGroups",Z.optional()),Se=t("setElementGroupVisibility",u),be=d("onElementChange",f.object({id:f.string()})),Me=d("onElementGroupChange",f.object({id:f.string()})),U={methods:[ge,de,ue,fe,he,Se],listeners:[be,Me]};var Le=p("onPointerClick"),xe=p("onPointerMove"),B={methods:null,listeners:[Le,xe]};import{z as s}from"zod";import{z as o}from"zod";var Ge=o.enum(["in","ni"]),Ie=o.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),At=o.enum(["and","or"]),A=o.union([o.number(),o.string(),o.boolean(),o.null()]),q=o.string().or(o.null()),Te=o.tuple([q,Ge,o.array(A).or(o.null())]),Ce=o.tuple([q,Ie,A]),v=o.union([Te,Ce]),V=o.tuple([o.lazy(()=>o.union([V,v,o.null(),o.boolean()])),o.enum(["and","or"]),o.lazy(()=>o.union([V,v,o.null(),o.boolean()]))]),H=o.union([V,v,o.null(),o.boolean()]);import{z as r}from"zod";var Kt=r.enum(["processing","completed","failed","incomplete"]),W=r.object({ids:r.array(r.string()).optional()}),K=r.object({ids:r.array(r.string()).optional()}),b=r.object({id:r.string(),layerId:r.string()}),_=r.object({ids:b.array().optional(),layerIds:r.string().array().optional()}),Q=r.object({layerIds:r.array(r.string()).optional(),areaQuery:r.union([r.object({coordinates:x}),r.object({boundary:L})]).optional()});var ze=t("getLayer",s.string()),Fe=t("getLayers",W.optional()),Ee=t("setLayerVisibility",u),we=d("onLayerChange",s.object({id:s.string()})),ve=t("setLayerStyle",s.object({id:s.string(),style:s.object({}).passthrough()})),Ve=t("setLayerLegendVisibility",u),Pe=t("getLayerGroup",s.string()),ke=t("getLayerGroups",K.optional()),Oe=t("setLayerGroupVisibility",u),je=t("setLayerGroupLegendVisibility",u),Ne=d("onLayerGroupChange",s.object({id:s.string()})),Re=t("getLegendItem",b),Ze=t("getLegendItems",_.optional()),Ue=d("onLegendItemChange",b),Be=t("setLegendItemVisibility",s.object({show:b.array().optional(),hide:b.array().optional()})),Ae=t("getLayerFilters",s.string()),qe=t("setLayerFilters",s.object({layerId:s.string(),filters:H,note:s.string().optional()})),He=t("getRenderedFeatures",Q.optional()),D={methods:[ze,Fe,Ee,ve,Ve,Pe,ke,Oe,je,Re,Ze,Be,Ae,qe,He],listeners:[we,Ne,Ue]};import{z as G}from"zod";import{z as g}from"zod";var $=g.object({id:g.string().or(g.number()),layerId:g.string(),showPopup:g.boolean().optional(),fitViewport:g.boolean().or(g.object({maxZoom:g.number()})).optional()});var We=t("getSelection",G.undefined()),Ke=p("onSelectionChange"),_e=t("selectFeature",$),Qe=t("clearSelection",G.object({features:G.boolean().optional(),elements:G.boolean().optional()}).optional()),J={methods:[We,_e,Qe],listeners:[Ke]};import{z as rt}from"zod";import{z as e}from"zod";var X=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Y=e.enum([...X,"link"]),ee=e.enum(X),De=e.object({color:e.string(),symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable()}),$e=e.object({color:e.string(),strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"]),distanceMarker:e.boolean()}),Je=e.object({color:e.string(),routingMode:e.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"]),distanceMarker:e.boolean(),endCaps:e.boolean()}),Xe=e.object({color:e.string(),fillOpacity:e.number().min(0).max(1),strokeOpacity:e.number().min(0).max(1),strokeWidth:e.number().min(0),strokeStyle:e.enum(["solid","dashed","dotted"]),areaMarker:e.boolean()}),Ye=e.object({color:e.string(),fillOpacity:e.number().min(0).max(1),strokeOpacity:e.number().min(0).max(1),strokeWidth:e.number().min(0),strokeStyle:e.enum(["solid","dashed","dotted"]),radiusMarker:e.boolean()}),et=e.object({color:e.string(),opacity:e.number().min(0).max(1),size:e.number().min(0).max(100)}),tt=e.object({color:e.string(),opacity:e.number().min(0).max(1),size:e.number().min(0).max(200)}),ot=e.object({color:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"])}),nt=e.object({color:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"])}),te=e.discriminatedUnion("tool",[De.partial().extend({tool:e.literal("pin")}),$e.partial().extend({tool:e.literal("line")}),Je.partial().extend({tool:e.literal("route")}),Xe.partial().extend({tool:e.literal("polygon")}),Ye.partial().extend({tool:e.literal("circle")}),et.partial().extend({tool:e.literal("marker")}),tt.partial().extend({tool:e.literal("highlighter")}),ot.partial().extend({tool:e.literal("text")}),nt.partial().extend({tool:e.literal("note")})]);var st=t("setTool",Y.nullable()),it=t("getTool",rt.undefined()),at=p("onToolChange"),lt=t("setToolSettings",te),pt=t("getToolSettings",ee),mt=p("onToolSettingsChange"),oe={methods:[st,it,lt,pt],listeners:[at,mt]};import{z as a}from"zod";var ne=a.object({showLegend:a.boolean().optional(),cooperativeGestures:a.boolean().optional(),fullScreenButton:a.boolean().optional(),geolocation:a.boolean().optional(),zoomControls:a.boolean().optional(),scaleBar:a.boolean().optional()}),re=a.object({featureSelectPanel:a.boolean().optional(),featureHoverPanel:a.boolean().optional(),elementSelectPanel:a.boolean().optional(),linkClickOpen:a.boolean().optional(),imageLightboxOpen:a.boolean().optional()});var ct=t("updateUiControls",ne),yt=t("setOnMapInteractionsUi",re),se={methods:[ct,yt],listeners:null};import{z as pe}from"zod";import{z as T}from"zod";var I=T.object({center:x,zoom:N}),ie=T.object({center:I.shape.center.optional(),zoom:I.shape.zoom.optional()}),ae=T.object({minZoom:I.shape.zoom.nullish(),maxZoom:I.shape.zoom.nullish(),bounds:L.nullish()}).nullable(),le=T.object({bounds:L});var gt=t("getViewport",pe.undefined()),dt=t("setViewport",ie),ut=t("getViewportConstraints",pe.undefined()),ft=t("setViewportConstraints",ae),ht=t("fitViewportToBounds",le),St=p("onViewportMove"),bt=p("onViewportMoveEnd"),Mt=p("onMapIdle"),me={methods:[dt,gt,ut,ft,ht],listeners:[St,bt,Mt]};var P=[se,me,D,U,J,B,oe];function Oo(n,h,k){let C=new Map;async function O(c){if(!Ct.safeParse(c.data).success){k?.onUnknownMessage?.(c.data);return}let j=ye.safeParse(c.data);if(!j.success){k?.onInvalidMessage?.(c.data);return}let{data:i}=j;if(i.type==="felt.ready")c.ports[0]?.postMessage(!0);else if(i.type==="felt.addListener"){if(i.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let M="options"in i.event?{options:"options"in i.event?i.event.options:void 0,handler:F=>{c.ports[0]?.postMessage(F)}}:{handler:F=>{c.ports[0]?.postMessage(F)}},z=h.listeners[i.event.eventName](M);C.set(i.event.id,z)}else if(i.type==="felt.removeListener")C.get(i.id)?.(),C.delete(i.id);else try{let M=h.methods[i.type],z=await M(i.params);c.ports[0]?.postMessage(z)}catch(M){c.ports[0]?.postMessage({__error__:Lt(M)})}}return n.addEventListener("message",O),()=>{n.removeEventListener("message",O)}}function Lt(n){return n instanceof Error?n.message:typeof n=="object"&&n!==null&&"message"in n?String(n.message):typeof n=="string"?n:"Unknown error"}var ce={methods:P.map(n=>n.methods??[]).flat(),listeners:P.map(n=>n.listeners??[]).flat()},xt=l.discriminatedUnion("eventName",[l.strictObject({eventName:l.literal("")}),...ce.listeners]),Gt=l.strictObject({type:l.literal("felt.addListener"),event:xt}),It=l.strictObject({type:l.literal("felt.removeListener"),id:l.string()}),Tt=l.strictObject({type:l.literal("felt.ready")}),ye=l.discriminatedUnion("type",[Tt,Gt,It,...ce.methods]),Ct=l.object({type:l.enum(ye.options.map(n=>n.shape.type.value))});export{Oo as createMessageHandler};
|
|
@@ -1120,9 +1120,9 @@ declare const ViewportCenterZoomSchema: z.ZodObject<{
|
|
|
1120
1120
|
zoom: number;
|
|
1121
1121
|
}>;
|
|
1122
1122
|
/**
|
|
1123
|
-
* @group Types
|
|
1124
|
-
*
|
|
1125
1123
|
* The current state of the viewport, including the derived bounds.
|
|
1124
|
+
*
|
|
1125
|
+
* @group Types
|
|
1126
1126
|
*/
|
|
1127
1127
|
interface ViewportState {
|
|
1128
1128
|
/**
|
|
@@ -1179,6 +1179,32 @@ declare const SetViewportCenterZoomParamsSchema: z.ZodObject<{
|
|
|
1179
1179
|
} | undefined;
|
|
1180
1180
|
zoom?: number | undefined;
|
|
1181
1181
|
}>;
|
|
1182
|
+
/**
|
|
1183
|
+
* The constraints for the viewport. Used to ensure that the viewport stays
|
|
1184
|
+
* within certain bounds and zoom levels.
|
|
1185
|
+
*
|
|
1186
|
+
* @group Types
|
|
1187
|
+
*/
|
|
1188
|
+
interface ViewportConstraints {
|
|
1189
|
+
/**
|
|
1190
|
+
* The minimum zoom level for the viewport.
|
|
1191
|
+
*
|
|
1192
|
+
* {@link FeltZoom}
|
|
1193
|
+
*/
|
|
1194
|
+
minZoom: FeltZoom | null;
|
|
1195
|
+
/**
|
|
1196
|
+
* The maximum zoom level for the viewport.
|
|
1197
|
+
*
|
|
1198
|
+
* {@link FeltZoom}
|
|
1199
|
+
*/
|
|
1200
|
+
maxZoom: FeltZoom | null;
|
|
1201
|
+
/**
|
|
1202
|
+
* The bounds for the viewport.
|
|
1203
|
+
*
|
|
1204
|
+
* {@link FeltBoundary}
|
|
1205
|
+
*/
|
|
1206
|
+
bounds: FeltBoundary | null;
|
|
1207
|
+
}
|
|
1182
1208
|
/**
|
|
1183
1209
|
* The parameters for the `fitViewportToBounds` method.
|
|
1184
1210
|
*
|
|
@@ -1200,4 +1226,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
|
|
|
1200
1226
|
bounds: [number, number, number, number];
|
|
1201
1227
|
}>;
|
|
1202
1228
|
|
|
1203
|
-
export type {
|
|
1229
|
+
export type { PointGeometry as $, LayerProcessingStatus as A, FilterExpression as B, ConfigurableToolType as C, FilterLogicGate as D, Element as E, Filters as F, Geometry as G, FilterTernary as H, InputToolSettings as I, ElementGroupNode as J, ElementNode as K, Layer as L, MapInteractionEvent as M, FeatureNode as N, LayerGroupNode as O, LayerNode as P, FeltBoundary as Q, RasterValue as R, SetVisibilityRequest as S, ToolType as T, FeltZoom as U, ViewportState as V, LatLng as W, LineStringGeometry as X, LngLatTuple as Y, MultiLineStringGeometry as Z, MultiPolygonGeometry as _, GetElementsConstraint as a, PolygonGeometry as a0, CircleToolSettings as a1, HighlighterToolSettings as a2, LineToolSettings as a3, MarkerToolSettings as a4, NoteToolSettings as a5, PinFrame as a6, PinSymbol as a7, PinToolSettings as a8, PolygonToolSettings as a9, RouteToolSettings as aa, TextToolSettings as ab, UnionToIntersection as ac, PromiseOrNot as ad, 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, ViewportConstraints as w, ViewportFitBoundsParams as x, ViewportCenterZoom as y, zInfer as z };
|
|
@@ -1120,9 +1120,9 @@ declare const ViewportCenterZoomSchema: z.ZodObject<{
|
|
|
1120
1120
|
zoom: number;
|
|
1121
1121
|
}>;
|
|
1122
1122
|
/**
|
|
1123
|
-
* @group Types
|
|
1124
|
-
*
|
|
1125
1123
|
* The current state of the viewport, including the derived bounds.
|
|
1124
|
+
*
|
|
1125
|
+
* @group Types
|
|
1126
1126
|
*/
|
|
1127
1127
|
interface ViewportState {
|
|
1128
1128
|
/**
|
|
@@ -1179,6 +1179,32 @@ declare const SetViewportCenterZoomParamsSchema: z.ZodObject<{
|
|
|
1179
1179
|
} | undefined;
|
|
1180
1180
|
zoom?: number | undefined;
|
|
1181
1181
|
}>;
|
|
1182
|
+
/**
|
|
1183
|
+
* The constraints for the viewport. Used to ensure that the viewport stays
|
|
1184
|
+
* within certain bounds and zoom levels.
|
|
1185
|
+
*
|
|
1186
|
+
* @group Types
|
|
1187
|
+
*/
|
|
1188
|
+
interface ViewportConstraints {
|
|
1189
|
+
/**
|
|
1190
|
+
* The minimum zoom level for the viewport.
|
|
1191
|
+
*
|
|
1192
|
+
* {@link FeltZoom}
|
|
1193
|
+
*/
|
|
1194
|
+
minZoom: FeltZoom | null;
|
|
1195
|
+
/**
|
|
1196
|
+
* The maximum zoom level for the viewport.
|
|
1197
|
+
*
|
|
1198
|
+
* {@link FeltZoom}
|
|
1199
|
+
*/
|
|
1200
|
+
maxZoom: FeltZoom | null;
|
|
1201
|
+
/**
|
|
1202
|
+
* The bounds for the viewport.
|
|
1203
|
+
*
|
|
1204
|
+
* {@link FeltBoundary}
|
|
1205
|
+
*/
|
|
1206
|
+
bounds: FeltBoundary | null;
|
|
1207
|
+
}
|
|
1182
1208
|
/**
|
|
1183
1209
|
* The parameters for the `fitViewportToBounds` method.
|
|
1184
1210
|
*
|
|
@@ -1200,4 +1226,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
|
|
|
1200
1226
|
bounds: [number, number, number, number];
|
|
1201
1227
|
}>;
|
|
1202
1228
|
|
|
1203
|
-
export type {
|
|
1229
|
+
export type { PointGeometry as $, LayerProcessingStatus as A, FilterExpression as B, ConfigurableToolType as C, FilterLogicGate as D, Element as E, Filters as F, Geometry as G, FilterTernary as H, InputToolSettings as I, ElementGroupNode as J, ElementNode as K, Layer as L, MapInteractionEvent as M, FeatureNode as N, LayerGroupNode as O, LayerNode as P, FeltBoundary as Q, RasterValue as R, SetVisibilityRequest as S, ToolType as T, FeltZoom as U, ViewportState as V, LatLng as W, LineStringGeometry as X, LngLatTuple as Y, MultiLineStringGeometry as Z, MultiPolygonGeometry as _, GetElementsConstraint as a, PolygonGeometry as a0, CircleToolSettings as a1, HighlighterToolSettings as a2, LineToolSettings as a3, MarkerToolSettings as a4, NoteToolSettings as a5, PinFrame as a6, PinSymbol as a7, PinToolSettings as a8, PolygonToolSettings as a9, RouteToolSettings as aa, TextToolSettings as ab, UnionToIntersection as ac, PromiseOrNot as ad, 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, ViewportConstraints as w, ViewportFitBoundsParams as x, ViewportCenterZoom as y, zInfer as z };
|
package/handler.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as zod from 'zod';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
-
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams,
|
|
3
|
+
import { z as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, h as LayerGroup, l as LegendItem, o as LayerFilters, q as Feature, g as LayerChangeCallbackParams, j as LayerGroupChangeCallbackParams, n as LegendItemChangeCallbackParams, H as FilterTernary, r as EntityNode, T as ToolType, t as ToolSettingsMap, u as ToolSettingsChangeEvent, V as ViewportState, w as ViewportConstraints, ac as UnionToIntersection, ad as PromiseOrNot } from './types-BLsf5GHN.js';
|
|
4
4
|
|
|
5
5
|
type Method<TRequest extends {
|
|
6
6
|
type: string;
|
|
@@ -1321,6 +1321,46 @@ declare const GotoViewportMessage: z.ZodObject<{
|
|
|
1321
1321
|
};
|
|
1322
1322
|
type: "setViewport";
|
|
1323
1323
|
}>;
|
|
1324
|
+
declare const GetViewportConstraintsMessage: z.ZodObject<{
|
|
1325
|
+
type: z.ZodLiteral<"getViewportConstraints">;
|
|
1326
|
+
params: z.ZodUndefined;
|
|
1327
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1328
|
+
type: "getViewportConstraints";
|
|
1329
|
+
params?: undefined;
|
|
1330
|
+
}, {
|
|
1331
|
+
type: "getViewportConstraints";
|
|
1332
|
+
params?: undefined;
|
|
1333
|
+
}>;
|
|
1334
|
+
declare const SetViewportConstraintsMessage: z.ZodObject<{
|
|
1335
|
+
type: z.ZodLiteral<"setViewportConstraints">;
|
|
1336
|
+
params: z.ZodNullable<z.ZodObject<{
|
|
1337
|
+
minZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1338
|
+
maxZoom: z.ZodOptional<z.ZodNullable<z.ZodNumber>>;
|
|
1339
|
+
bounds: z.ZodOptional<z.ZodNullable<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>>;
|
|
1340
|
+
}, "strip", z.ZodTypeAny, {
|
|
1341
|
+
minZoom?: number | null | undefined;
|
|
1342
|
+
maxZoom?: number | null | undefined;
|
|
1343
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1344
|
+
}, {
|
|
1345
|
+
minZoom?: number | null | undefined;
|
|
1346
|
+
maxZoom?: number | null | undefined;
|
|
1347
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1348
|
+
}>>;
|
|
1349
|
+
}, z.UnknownKeysParam, z.ZodTypeAny, {
|
|
1350
|
+
params: {
|
|
1351
|
+
minZoom?: number | null | undefined;
|
|
1352
|
+
maxZoom?: number | null | undefined;
|
|
1353
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1354
|
+
} | null;
|
|
1355
|
+
type: "setViewportConstraints";
|
|
1356
|
+
}, {
|
|
1357
|
+
params: {
|
|
1358
|
+
minZoom?: number | null | undefined;
|
|
1359
|
+
maxZoom?: number | null | undefined;
|
|
1360
|
+
bounds?: [number, number, number, number] | null | undefined;
|
|
1361
|
+
} | null;
|
|
1362
|
+
type: "setViewportConstraints";
|
|
1363
|
+
}>;
|
|
1324
1364
|
declare const ViewportFitBoundsMessage: z.ZodObject<{
|
|
1325
1365
|
type: z.ZodLiteral<"fitViewportToBounds">;
|
|
1326
1366
|
params: z.ZodObject<{
|
|
@@ -1345,6 +1385,8 @@ type ViewportSchema = {
|
|
|
1345
1385
|
methods: {
|
|
1346
1386
|
getViewport: Method<zInfer<typeof GetViewportMessage>, ViewportState>;
|
|
1347
1387
|
setViewport: Method<zInfer<typeof GotoViewportMessage>, void>;
|
|
1388
|
+
getViewportConstraints: Method<zInfer<typeof GetViewportConstraintsMessage>, ViewportConstraints | null>;
|
|
1389
|
+
setViewportConstraints: Method<zInfer<typeof SetViewportConstraintsMessage>, void>;
|
|
1348
1390
|
fitViewportToBounds: Method<zInfer<typeof ViewportFitBoundsMessage>, void>;
|
|
1349
1391
|
};
|
|
1350
1392
|
listeners: {
|
package/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var v=Object.defineProperty;var
|
|
1
|
+
"use strict";var v=Object.defineProperty;var ue=Object.getOwnPropertyDescriptor;var fe=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var Se=(o,s)=>{for(var h in s)v(o,h,{get:s[h],enumerable:!0})},be=(o,s,h,L)=>{if(s&&typeof s=="object"||typeof s=="function")for(let u of fe(s))!he.call(o,u)&&u!==h&&v(o,u,{get:()=>s[u],enumerable:!(L=ue(s,u))||L.enumerable});return o};var Me=o=>be(v({},"__esModule",{value:!0}),o);var Ot={};Se(Ot,{createMessageHandler:()=>Ft});module.exports=Me(Ot);var l=require("zod");var f=require("zod");var g=require("zod");function t(o,s){return g.z.strictObject({type:g.z.literal(o),params:s})}function S(o,s){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string(),options:s})}function m(o){return g.z.strictObject({eventName:g.z.literal(o),id:g.z.string()})}var c=require("zod"),V=c.z.number(),P=c.z.number(),z=c.z.object({latitude:P,longitude:V}),Z=c.z.number().min(1).max(23),I=c.z.tuple([V,P,V,P]),b=c.z.object({show:c.z.array(c.z.string()).optional(),hide:c.z.array(c.z.string()).optional()});var M=require("zod"),U=M.z.object({ids:M.z.array(M.z.string()).optional()}),B=M.z.object({ids:M.z.array(M.z.string()).optional()});var Le=t("getElement",f.z.string()),xe=t("getElementGeometry",f.z.string()),Ge=t("getElements",U.optional()),Ie=t("getElementGroup",f.z.string()),Te=t("getElementGroups",B.optional()),Ce=t("setElementGroupVisibility",b),ze=S("onElementChange",f.z.object({id:f.z.string()})),Fe=S("onElementGroupChange",f.z.object({id:f.z.string()})),A={methods:[Le,xe,Ge,Ie,Te,Ce],listeners:[ze,Fe]};var Ee=m("onPointerClick"),we=m("onPointerMove"),q={methods:null,listeners:[Ee,we]};var i=require("zod");var n=require("zod"),ve=n.z.enum(["in","ni"]),Ve=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),_t=n.z.enum(["and","or"]),H=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),W=n.z.string().or(n.z.null()),Pe=n.z.tuple([W,ve,n.z.array(H).or(n.z.null())]),ke=n.z.tuple([W,Ve,H]),k=n.z.union([Pe,ke]),O=n.z.tuple([n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([O,k,n.z.null(),n.z.boolean()]))]),K=n.z.union([O,k,n.z.null(),n.z.boolean()]);var r=require("zod");var $t=r.z.enum(["processing","completed","failed","incomplete"]),_=r.z.object({ids:r.z.array(r.z.string()).optional()}),Q=r.z.object({ids:r.z.array(r.z.string()).optional()}),x=r.z.object({id:r.z.string(),layerId:r.z.string()}),D=r.z.object({ids:x.array().optional(),layerIds:r.z.string().array().optional()}),$=r.z.object({layerIds:r.z.array(r.z.string()).optional(),areaQuery:r.z.union([r.z.object({coordinates:z}),r.z.object({boundary:I})]).optional()});var Oe=t("getLayer",i.z.string()),je=t("getLayers",_.optional()),Ne=t("setLayerVisibility",b),Re=S("onLayerChange",i.z.object({id:i.z.string()})),Ze=t("setLayerStyle",i.z.object({id:i.z.string(),style:i.z.object({}).passthrough()})),Ue=t("setLayerLegendVisibility",b),Be=t("getLayerGroup",i.z.string()),Ae=t("getLayerGroups",Q.optional()),qe=t("setLayerGroupVisibility",b),He=t("setLayerGroupLegendVisibility",b),We=S("onLayerGroupChange",i.z.object({id:i.z.string()})),Ke=t("getLegendItem",x),_e=t("getLegendItems",D.optional()),Qe=S("onLegendItemChange",x),De=t("setLegendItemVisibility",i.z.object({show:x.array().optional(),hide:x.array().optional()})),$e=t("getLayerFilters",i.z.string()),Je=t("setLayerFilters",i.z.object({layerId:i.z.string(),filters:K,note:i.z.string().optional()})),Xe=t("getRenderedFeatures",$.optional()),J={methods:[Oe,je,Ne,Ze,Ue,Be,Ae,qe,He,Ke,_e,De,$e,Je,Xe],listeners:[Re,We,Qe]};var T=require("zod");var d=require("zod"),X=d.z.object({id:d.z.string().or(d.z.number()),layerId:d.z.string(),showPopup:d.z.boolean().optional(),fitViewport:d.z.boolean().or(d.z.object({maxZoom:d.z.number()})).optional()});var Ye=t("getSelection",T.z.undefined()),et=m("onSelectionChange"),tt=t("selectFeature",X),ot=t("clearSelection",T.z.object({features:T.z.boolean().optional(),elements:T.z.boolean().optional()}).optional()),Y={methods:[Ye,tt,ot],listeners:[et]};var re=require("zod");var e=require("zod"),ee=["pin","line","route","polygon","circle","marker","highlighter","text","note"],te=e.z.enum([...ee,"link"]),oe=e.z.enum(ee),nt=e.z.object({color:e.z.string(),symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable()}),rt=e.z.object({color:e.z.string(),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean()}),st=e.z.object({color:e.z.string(),routingMode:e.z.enum(["driving","cycling","walking","flying"]),strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"]),distanceMarker:e.z.boolean(),endCaps:e.z.boolean()}),it=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),areaMarker:e.z.boolean()}),at=e.z.object({color:e.z.string(),fillOpacity:e.z.number().min(0).max(1),strokeOpacity:e.z.number().min(0).max(1),strokeWidth:e.z.number().min(0),strokeStyle:e.z.enum(["solid","dashed","dotted"]),radiusMarker:e.z.boolean()}),lt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100)}),pt=e.z.object({color:e.z.string(),opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(200)}),mt=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ct=e.z.object({color:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"])}),ne=e.z.discriminatedUnion("tool",[nt.partial().extend({tool:e.z.literal("pin")}),rt.partial().extend({tool:e.z.literal("line")}),st.partial().extend({tool:e.z.literal("route")}),it.partial().extend({tool:e.z.literal("polygon")}),at.partial().extend({tool:e.z.literal("circle")}),lt.partial().extend({tool:e.z.literal("marker")}),pt.partial().extend({tool:e.z.literal("highlighter")}),mt.partial().extend({tool:e.z.literal("text")}),ct.partial().extend({tool:e.z.literal("note")})]);var yt=t("setTool",te.nullable()),gt=t("getTool",re.z.undefined()),dt=m("onToolChange"),ut=t("setToolSettings",ne),ft=t("getToolSettings",oe),ht=m("onToolSettingsChange"),se={methods:[yt,gt,ut,ft],listeners:[dt,ht]};var a=require("zod"),ie=a.z.object({showLegend:a.z.boolean().optional(),cooperativeGestures:a.z.boolean().optional(),fullScreenButton:a.z.boolean().optional(),geolocation:a.z.boolean().optional(),zoomControls:a.z.boolean().optional(),scaleBar:a.z.boolean().optional()}),ae=a.z.object({featureSelectPanel:a.z.boolean().optional(),featureHoverPanel:a.z.boolean().optional(),elementSelectPanel:a.z.boolean().optional(),linkClickOpen:a.z.boolean().optional(),imageLightboxOpen:a.z.boolean().optional()});var St=t("updateUiControls",ie),bt=t("setOnMapInteractionsUi",ae),le={methods:[St,bt],listeners:null};var j=require("zod");var C=require("zod");var F=C.z.object({center:z,zoom:Z}),pe=C.z.object({center:F.shape.center.optional(),zoom:F.shape.zoom.optional()}),me=C.z.object({minZoom:F.shape.zoom.nullish(),maxZoom:F.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),ce=C.z.object({bounds:I});var Mt=t("getViewport",j.z.undefined()),Lt=t("setViewport",pe),xt=t("getViewportConstraints",j.z.undefined()),Gt=t("setViewportConstraints",me),It=t("fitViewportToBounds",ce),Tt=m("onViewportMove"),Ct=m("onViewportMoveEnd"),zt=m("onMapIdle"),ye={methods:[Lt,Mt,xt,Gt,It],listeners:[Tt,Ct,zt]};var N=[le,ye,J,A,Y,q,se];function Ft(o,s,h){let L=new Map;async function u(y){if(!kt.safeParse(y.data).success){h?.onUnknownMessage?.(y.data);return}let R=de.safeParse(y.data);if(!R.success){h?.onInvalidMessage?.(y.data);return}let{data:p}=R;if(p.type==="felt.ready")y.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let G="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:w=>{y.ports[0]?.postMessage(w)}}:{handler:w=>{y.ports[0]?.postMessage(w)}},E=s.listeners[p.event.eventName](G);L.set(p.event.id,E)}else if(p.type==="felt.removeListener")L.get(p.id)?.(),L.delete(p.id);else try{let G=s.methods[p.type],E=await G(p.params);y.ports[0]?.postMessage(E)}catch(G){y.ports[0]?.postMessage({__error__:Et(G)})}}return o.addEventListener("message",u),()=>{o.removeEventListener("message",u)}}function Et(o){return o instanceof Error?o.message:typeof o=="object"&&o!==null&&"message"in o?String(o.message):typeof o=="string"?o:"Unknown error"}var ge={methods:N.map(o=>o.methods??[]).flat(),listeners:N.map(o=>o.listeners??[]).flat()},wt=l.z.discriminatedUnion("eventName",[l.z.strictObject({eventName:l.z.literal("")}),...ge.listeners]),vt=l.z.strictObject({type:l.z.literal("felt.addListener"),event:wt}),Vt=l.z.strictObject({type:l.z.literal("felt.removeListener"),id:l.z.string()}),Pt=l.z.strictObject({type:l.z.literal("felt.ready")}),de=l.z.discriminatedUnion("type",[Pt,vt,Vt,...ge.methods]),kt=l.z.object({type:l.z.enum(de.options.map(o=>o.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/package.json
CHANGED
|
@@ -1120,9 +1120,9 @@ declare const ViewportCenterZoomSchema: z.ZodObject<{
|
|
|
1120
1120
|
zoom: number;
|
|
1121
1121
|
}>;
|
|
1122
1122
|
/**
|
|
1123
|
-
* @group Types
|
|
1124
|
-
*
|
|
1125
1123
|
* The current state of the viewport, including the derived bounds.
|
|
1124
|
+
*
|
|
1125
|
+
* @group Types
|
|
1126
1126
|
*/
|
|
1127
1127
|
interface ViewportState {
|
|
1128
1128
|
/**
|
|
@@ -1179,6 +1179,32 @@ declare const SetViewportCenterZoomParamsSchema: z.ZodObject<{
|
|
|
1179
1179
|
} | undefined;
|
|
1180
1180
|
zoom?: number | undefined;
|
|
1181
1181
|
}>;
|
|
1182
|
+
/**
|
|
1183
|
+
* The constraints for the viewport. Used to ensure that the viewport stays
|
|
1184
|
+
* within certain bounds and zoom levels.
|
|
1185
|
+
*
|
|
1186
|
+
* @group Types
|
|
1187
|
+
*/
|
|
1188
|
+
interface ViewportConstraints {
|
|
1189
|
+
/**
|
|
1190
|
+
* The minimum zoom level for the viewport.
|
|
1191
|
+
*
|
|
1192
|
+
* {@link FeltZoom}
|
|
1193
|
+
*/
|
|
1194
|
+
minZoom: FeltZoom | null;
|
|
1195
|
+
/**
|
|
1196
|
+
* The maximum zoom level for the viewport.
|
|
1197
|
+
*
|
|
1198
|
+
* {@link FeltZoom}
|
|
1199
|
+
*/
|
|
1200
|
+
maxZoom: FeltZoom | null;
|
|
1201
|
+
/**
|
|
1202
|
+
* The bounds for the viewport.
|
|
1203
|
+
*
|
|
1204
|
+
* {@link FeltBoundary}
|
|
1205
|
+
*/
|
|
1206
|
+
bounds: FeltBoundary | null;
|
|
1207
|
+
}
|
|
1182
1208
|
/**
|
|
1183
1209
|
* The parameters for the `fitViewportToBounds` method.
|
|
1184
1210
|
*
|
|
@@ -1200,4 +1226,4 @@ declare const ViewportFitBoundsParamsSchema: z.ZodObject<{
|
|
|
1200
1226
|
bounds: [number, number, number, number];
|
|
1201
1227
|
}>;
|
|
1202
1228
|
|
|
1203
|
-
export type {
|
|
1229
|
+
export type { PointGeometry as $, LayerProcessingStatus as A, FilterExpression as B, ConfigurableToolType as C, FilterLogicGate as D, Element as E, Filters as F, Geometry as G, FilterTernary as H, InputToolSettings as I, ElementGroupNode as J, ElementNode as K, Layer as L, MapInteractionEvent as M, FeatureNode as N, LayerGroupNode as O, LayerNode as P, FeltBoundary as Q, RasterValue as R, SetVisibilityRequest as S, ToolType as T, FeltZoom as U, ViewportState as V, LatLng as W, LineStringGeometry as X, LngLatTuple as Y, MultiLineStringGeometry as Z, MultiPolygonGeometry as _, GetElementsConstraint as a, PolygonGeometry as a0, CircleToolSettings as a1, HighlighterToolSettings as a2, LineToolSettings as a3, MarkerToolSettings as a4, NoteToolSettings as a5, PinFrame as a6, PinSymbol as a7, PinToolSettings as a8, PolygonToolSettings as a9, RouteToolSettings as aa, TextToolSettings as ab, UnionToIntersection as ac, PromiseOrNot as ad, 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, ViewportConstraints as w, ViewportFitBoundsParams as x, ViewportCenterZoom as y, zInfer as z };
|