@feltmaps/js-sdk 1.5.0-next.7 → 1.5.0-next.8
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 +37 -2
- package/dist/client.d.ts +37 -2
- package/dist/client.js +1 -1
- package/dist/handler.cjs +1 -1
- package/dist/handler.d.cts +30 -1
- package/dist/handler.d.ts +30 -1
- package/dist/handler.js +1 -1
- package/dist/{types-XLCA2cX-.d.cts → types-BXCTpxot.d.cts} +13 -0
- package/dist/{types-XLCA2cX-.d.ts → types-BXCTpxot.d.ts} +13 -0
- package/handler.d.ts +30 -1
- package/handler.js +1 -1
- package/package.json +1 -1
- package/{types-XLCA2cX-.d.ts → types-BXCTpxot.d.ts} +13 -0
package/dist/client.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var g=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var F=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var G=(e,n)=>{for(var r in n)g(e,r,{get:n[r],enumerable:!0})},I=(e,n,r,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of b(n))!S.call(e,l)&&l!==r&&g(e,l,{get:()=>n[l],enumerable:!(s=F(n,l))||s.enumerable});return e};var x=e=>I(g({},"__esModule",{value:!0}),e);var K={};G(K,{Felt:()=>M});module.exports=x(K);function o(e,n){return r=>{let s=new MessageChannel,l=r.handler,a="options"in r?r.options:void 0,i=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:a?{eventName:n,id:i,options:a}:{eventName:n,id:i}},"*",[s.port2]),s.port1.onmessage=d=>{l(d.data)},()=>{s.port1.onmessage=null,s.port1.close(),s.port2.close(),e.postMessage({type:"felt.removeListener",id:i},"*")}}}function t(e,n){return r=>{let s=new MessageChannel;return e.postMessage({type:n,params:r},"*",[s.port2]),new Promise((l,a)=>{s.port1.onmessage=i=>{i.data&&typeof i.data=="object"&&"__error__"in i.data?a(new Error(i.data.__error__)):l(i.data),s.port1.close(),s.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"),onElementCreate:o(e,"onElementCreate"),onElementCreateEnd:o(e,"onElementCreateEnd"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});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"),onLayerFiltersChange:o(e,"onLayerFiltersChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates")});var L=e=>({getMapDetails:t(e,"getMapDetails")});var T=e=>({onSelectionChange:o(e,"onSelectionChange"),getSelection:t(e,"getSelection"),selectFeature:t(e,"selectFeature"),clearSelection:t(e,"clearSelection")});var E=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"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});var P=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,...P(e),...v(e),...h(e),...u(e),...T(e),...C(e),...E(e),...L(e)}}var M={embed(e,n,r){let s={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},l=r?.origin??s.origin,a=new URL(`${l}/embed/map/${n}`),i={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...s.uiControls,...r?.uiControls};for(let[p,y]of f(d))y!=null&&a.searchParams.set(i[p],y?"1":"0");if(r?.token&&a.searchParams.set("token",r.token),r?.initialViewport){let p=r.initialViewport;a.searchParams.set("loc",`${p.center.latitude},${p.center.longitude},${p.zoom}z`)}let c=e.tagName==="IFRAME",m=c?e:e.ownerDocument.createElement("iframe");return m.src=a.toString(),c||(m.style.width="100%",m.style.height="100%",m.style.border="none",m.style.margin="0",e.appendChild(m)),m.referrerPolicy="strict-origin-when-cross-origin",new Promise((p,y)=>{m.addEventListener("load",()=>{m.contentWindow==null?y(new Error("Failed to load Felt map")):p(m.contentWindow)},{once:!0})}).then(M.connect).then(p=>(Object.defineProperties(p,{iframe:{value:m,writable:!1,configurable:!1}}),p))},connect(e){let n=V(e);return new Promise((r,s)=>{let l=setTimeout(()=>{s(new Error("Failed to load Felt map")),clearInterval(i)},5e3),a=new MessageChannel,i=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[a.port2])},100);a.port1.onmessage=d=>{d.data===!0&&(clearInterval(i),clearTimeout(l),a.port1.close(),a.port2.close(),r(n))}})}},f=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, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, t as GetLayerCategoriesParams, u as GetLayerCategoriesGroup, v as GetLayerHistogramParams, w as GetLayerHistogramBin, A as AggregationMethod, x as GetLayerCalculationParams, M as MapInteractionEvent, y as MapDetails, z as EntityNode, B as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, J as zInfer, K as SortConfig, V as ViewportState, N as SetViewportCenterZoomParams, O as ViewportConstraints, P as ViewportFitBoundsParams, Q as ViewportCenterZoom } from './types-
|
|
2
|
-
export { ap as AggregationConfig, R as CircleElementCreate, U as CircleElementRead, W as CircleElementUpdate, aH as CircleToolSettings, as as ElementGroupNode, at as ElementNode, au as FeatureNode, ax as FeltBoundary, ay as FeltZoom, am as FilterExpression, an as FilterLogicGate, ao as FilterTernary, X as HighlighterElementCreate, Y as HighlighterElementRead, Z as HighlighterElementUpdate, aI as HighlighterToolSettings, _ as ImageElementCreate, $ as ImageElementRead, a0 as ImageElementUpdate, az as LatLng, av as LayerGroupNode, aw as LayerNode, ak as LayerProcessingStatus, aA as LineStringGeometry, aJ as LineToolSettings, a1 as LinkElementRead, aB as LngLatTuple, a2 as MarkerElementCreate, a3 as MarkerElementRead, a4 as MarkerElementUpdate, aK as MarkerToolSettings, aq as MultiAggregationConfig, aC as MultiLineStringGeometry, aD as MultiPolygonGeometry, a5 as NoteElementCreate, a6 as NoteElementRead, a7 as NoteElementUpdate, aL as NoteToolSettings, a8 as PathElementCreate, a9 as PathElementRead, aa as PathElementUpdate, aM as PinToolSettings, ab as PlaceElementCreate, ac as PlaceElementRead, ad as PlaceElementUpdate, aN as PlaceFrame, aO as PlaceSymbol, aE as PointGeometry, ae as PolygonElementCreate, af as PolygonElementRead, ag as PolygonElementUpdate, aF as PolygonGeometry, aP as PolygonToolSettings, al as RasterValue, aQ as RouteToolSettings, aG as SortDirection, ah as TextElementCreate, ai as TextElementRead, aj as TextElementUpdate, aR as TextToolSettings, ar as ValueConfiguration } from './types-
|
|
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, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, t as GetLayerCategoriesParams, u as GetLayerCategoriesGroup, v as GetLayerHistogramParams, w as GetLayerHistogramBin, A as AggregationMethod, x as GetLayerCalculationParams, M as MapInteractionEvent, y as MapDetails, z as EntityNode, B as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, J as zInfer, K as SortConfig, V as ViewportState, N as SetViewportCenterZoomParams, O as ViewportConstraints, P as ViewportFitBoundsParams, Q as ViewportCenterZoom } from './types-BXCTpxot.cjs';
|
|
2
|
+
export { ap as AggregationConfig, R as CircleElementCreate, U as CircleElementRead, W as CircleElementUpdate, aH as CircleToolSettings, as as ElementGroupNode, at as ElementNode, au as FeatureNode, ax as FeltBoundary, ay as FeltZoom, am as FilterExpression, an as FilterLogicGate, ao as FilterTernary, X as HighlighterElementCreate, Y as HighlighterElementRead, Z as HighlighterElementUpdate, aI as HighlighterToolSettings, _ as ImageElementCreate, $ as ImageElementRead, a0 as ImageElementUpdate, az as LatLng, av as LayerGroupNode, aw as LayerNode, ak as LayerProcessingStatus, aA as LineStringGeometry, aJ as LineToolSettings, a1 as LinkElementRead, aB as LngLatTuple, a2 as MarkerElementCreate, a3 as MarkerElementRead, a4 as MarkerElementUpdate, aK as MarkerToolSettings, aq as MultiAggregationConfig, aC as MultiLineStringGeometry, aD as MultiPolygonGeometry, a5 as NoteElementCreate, a6 as NoteElementRead, a7 as NoteElementUpdate, aL as NoteToolSettings, a8 as PathElementCreate, a9 as PathElementRead, aa as PathElementUpdate, aM as PinToolSettings, ab as PlaceElementCreate, ac as PlaceElementRead, ad as PlaceElementUpdate, aN as PlaceFrame, aO as PlaceSymbol, aE as PointGeometry, ae as PolygonElementCreate, af as PolygonElementRead, ag as PolygonElementUpdate, aF as PolygonGeometry, aP as PolygonToolSettings, al as RasterValue, aQ as RouteToolSettings, aG as SortDirection, ah as TextElementCreate, ai as TextElementRead, aj as TextElementUpdate, aR as TextToolSettings, ar as ValueConfiguration } from './types-BXCTpxot.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -573,6 +573,41 @@ interface LayersController {
|
|
|
573
573
|
*/
|
|
574
574
|
note?: string;
|
|
575
575
|
}): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Adds a listener for when a layer's filters change.
|
|
578
|
+
*
|
|
579
|
+
* @returns A function to unsubscribe from the listener
|
|
580
|
+
*
|
|
581
|
+
* @remarks
|
|
582
|
+
* This event fires whenever any type of filter changes on the layer, including
|
|
583
|
+
* ephemeral filters set via the SDK, style-based filters, or filters set through
|
|
584
|
+
* the Felt UI via Components.
|
|
585
|
+
*
|
|
586
|
+
* @event
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* const unsubscribe = felt.onLayerFiltersChange({
|
|
590
|
+
* options: { layerId: "layer-1" },
|
|
591
|
+
* handler: ({combined, ephemeral, style, components}) => {
|
|
592
|
+
* console.log("Layer filters updated:", {
|
|
593
|
+
* combined, // All filters combined
|
|
594
|
+
* ephemeral, // Filters set via SDK
|
|
595
|
+
* style, // Filters from layer style
|
|
596
|
+
* components // Filters from UI components
|
|
597
|
+
* });
|
|
598
|
+
* },
|
|
599
|
+
* });
|
|
600
|
+
*
|
|
601
|
+
* // later on...
|
|
602
|
+
* unsubscribe();
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
onLayerFiltersChange(params: {
|
|
606
|
+
options: {
|
|
607
|
+
layerId: string;
|
|
608
|
+
};
|
|
609
|
+
handler: (change: LayerFilters) => void;
|
|
610
|
+
}): VoidFunction;
|
|
576
611
|
/**
|
|
577
612
|
* Get the features that are currently **rendered** on the map in the viewport.
|
|
578
613
|
*
|
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, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, t as GetLayerCategoriesParams, u as GetLayerCategoriesGroup, v as GetLayerHistogramParams, w as GetLayerHistogramBin, A as AggregationMethod, x as GetLayerCalculationParams, M as MapInteractionEvent, y as MapDetails, z as EntityNode, B as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, J as zInfer, K as SortConfig, V as ViewportState, N as SetViewportCenterZoomParams, O as ViewportConstraints, P as ViewportFitBoundsParams, Q as ViewportCenterZoom } from './types-
|
|
2
|
-
export { ap as AggregationConfig, R as CircleElementCreate, U as CircleElementRead, W as CircleElementUpdate, aH as CircleToolSettings, as as ElementGroupNode, at as ElementNode, au as FeatureNode, ax as FeltBoundary, ay as FeltZoom, am as FilterExpression, an as FilterLogicGate, ao as FilterTernary, X as HighlighterElementCreate, Y as HighlighterElementRead, Z as HighlighterElementUpdate, aI as HighlighterToolSettings, _ as ImageElementCreate, $ as ImageElementRead, a0 as ImageElementUpdate, az as LatLng, av as LayerGroupNode, aw as LayerNode, ak as LayerProcessingStatus, aA as LineStringGeometry, aJ as LineToolSettings, a1 as LinkElementRead, aB as LngLatTuple, a2 as MarkerElementCreate, a3 as MarkerElementRead, a4 as MarkerElementUpdate, aK as MarkerToolSettings, aq as MultiAggregationConfig, aC as MultiLineStringGeometry, aD as MultiPolygonGeometry, a5 as NoteElementCreate, a6 as NoteElementRead, a7 as NoteElementUpdate, aL as NoteToolSettings, a8 as PathElementCreate, a9 as PathElementRead, aa as PathElementUpdate, aM as PinToolSettings, ab as PlaceElementCreate, ac as PlaceElementRead, ad as PlaceElementUpdate, aN as PlaceFrame, aO as PlaceSymbol, aE as PointGeometry, ae as PolygonElementCreate, af as PolygonElementRead, ag as PolygonElementUpdate, aF as PolygonGeometry, aP as PolygonToolSettings, al as RasterValue, aQ as RouteToolSettings, aG as SortDirection, ah as TextElementCreate, ai as TextElementRead, aj as TextElementUpdate, aR as TextToolSettings, ar as ValueConfiguration } from './types-
|
|
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, f as ElementCreate, g as ElementUpdate, L as Layer, h as GetLayersConstraint, i as LayerChangeCallbackParams, j as LayerGroup, k as GetLayerGroupsConstraint, l as LayerGroupChangeCallbackParams, m as LegendItemIdentifier, n as LegendItem, o as LegendItemsConstraint, p as LegendItemChangeCallbackParams, q as LayerFilters, F as Filters, r as GetRenderedFeaturesConstraint, s as Feature, t as GetLayerCategoriesParams, u as GetLayerCategoriesGroup, v as GetLayerHistogramParams, w as GetLayerHistogramBin, A as AggregationMethod, x as GetLayerCalculationParams, M as MapInteractionEvent, y as MapDetails, z as EntityNode, B as FeatureSelection, T as ToolType, I as InputToolSettings, C as ConfigurableToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, J as zInfer, K as SortConfig, V as ViewportState, N as SetViewportCenterZoomParams, O as ViewportConstraints, P as ViewportFitBoundsParams, Q as ViewportCenterZoom } from './types-BXCTpxot.js';
|
|
2
|
+
export { ap as AggregationConfig, R as CircleElementCreate, U as CircleElementRead, W as CircleElementUpdate, aH as CircleToolSettings, as as ElementGroupNode, at as ElementNode, au as FeatureNode, ax as FeltBoundary, ay as FeltZoom, am as FilterExpression, an as FilterLogicGate, ao as FilterTernary, X as HighlighterElementCreate, Y as HighlighterElementRead, Z as HighlighterElementUpdate, aI as HighlighterToolSettings, _ as ImageElementCreate, $ as ImageElementRead, a0 as ImageElementUpdate, az as LatLng, av as LayerGroupNode, aw as LayerNode, ak as LayerProcessingStatus, aA as LineStringGeometry, aJ as LineToolSettings, a1 as LinkElementRead, aB as LngLatTuple, a2 as MarkerElementCreate, a3 as MarkerElementRead, a4 as MarkerElementUpdate, aK as MarkerToolSettings, aq as MultiAggregationConfig, aC as MultiLineStringGeometry, aD as MultiPolygonGeometry, a5 as NoteElementCreate, a6 as NoteElementRead, a7 as NoteElementUpdate, aL as NoteToolSettings, a8 as PathElementCreate, a9 as PathElementRead, aa as PathElementUpdate, aM as PinToolSettings, ab as PlaceElementCreate, ac as PlaceElementRead, ad as PlaceElementUpdate, aN as PlaceFrame, aO as PlaceSymbol, aE as PointGeometry, ae as PolygonElementCreate, af as PolygonElementRead, ag as PolygonElementUpdate, aF as PolygonGeometry, aP as PolygonToolSettings, al as RasterValue, aQ as RouteToolSettings, aG as SortDirection, ah as TextElementCreate, ai as TextElementRead, aj as TextElementUpdate, aR as TextToolSettings, ar as ValueConfiguration } from './types-BXCTpxot.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -573,6 +573,41 @@ interface LayersController {
|
|
|
573
573
|
*/
|
|
574
574
|
note?: string;
|
|
575
575
|
}): Promise<void>;
|
|
576
|
+
/**
|
|
577
|
+
* Adds a listener for when a layer's filters change.
|
|
578
|
+
*
|
|
579
|
+
* @returns A function to unsubscribe from the listener
|
|
580
|
+
*
|
|
581
|
+
* @remarks
|
|
582
|
+
* This event fires whenever any type of filter changes on the layer, including
|
|
583
|
+
* ephemeral filters set via the SDK, style-based filters, or filters set through
|
|
584
|
+
* the Felt UI via Components.
|
|
585
|
+
*
|
|
586
|
+
* @event
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* const unsubscribe = felt.onLayerFiltersChange({
|
|
590
|
+
* options: { layerId: "layer-1" },
|
|
591
|
+
* handler: ({combined, ephemeral, style, components}) => {
|
|
592
|
+
* console.log("Layer filters updated:", {
|
|
593
|
+
* combined, // All filters combined
|
|
594
|
+
* ephemeral, // Filters set via SDK
|
|
595
|
+
* style, // Filters from layer style
|
|
596
|
+
* components // Filters from UI components
|
|
597
|
+
* });
|
|
598
|
+
* },
|
|
599
|
+
* });
|
|
600
|
+
*
|
|
601
|
+
* // later on...
|
|
602
|
+
* unsubscribe();
|
|
603
|
+
* ```
|
|
604
|
+
*/
|
|
605
|
+
onLayerFiltersChange(params: {
|
|
606
|
+
options: {
|
|
607
|
+
layerId: string;
|
|
608
|
+
};
|
|
609
|
+
handler: (change: LayerFilters) => void;
|
|
610
|
+
}): VoidFunction;
|
|
576
611
|
/**
|
|
577
612
|
* Get the features that are currently **rendered** on the map in the viewport.
|
|
578
613
|
*
|
package/dist/client.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
function o(e,m){return n=>{let r=new MessageChannel,p=n.handler,s="options"in n?n.options:void 0,a=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:m,id:a,options:s}:{eventName:m,id:a}},"*",[r.port2]),r.port1.onmessage=d=>{p(d.data)},()=>{r.port1.onmessage=null,r.port1.close(),r.port2.close(),e.postMessage({type:"felt.removeListener",id:a},"*")}}}function t(e,m){return n=>{let r=new MessageChannel;return e.postMessage({type:m,params:n},"*",[r.port2]),new Promise((p,s)=>{r.port1.onmessage=a=>{a.data&&typeof a.data=="object"&&"__error__"in a.data?s(new Error(a.data.__error__)):p(a.data),r.port1.close(),r.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"),onElementCreate:o(e,"onElementCreate"),onElementCreateEnd:o(e,"onElementCreateEnd"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});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"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates")});var h=e=>({getMapDetails:t(e,"getMapDetails")});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 E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});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 P(e){return{iframe:null,...v(e),...E(e),...C(e),...c(e),...L(e),...u(e),...T(e),...h(e)}}var V={embed(e,m,n){let r={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},p=n?.origin??r.origin,s=new URL(`${p}/embed/map/${m}`),a={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...r.uiControls,...n?.uiControls};for(let[l,y]of M(d))y!=null&&s.searchParams.set(a[l],y?"1":"0");if(n?.token&&s.searchParams.set("token",n.token),n?.initialViewport){let l=n.initialViewport;s.searchParams.set("loc",`${l.center.latitude},${l.center.longitude},${l.zoom}z`)}let g=e.tagName==="IFRAME",i=g?e:e.ownerDocument.createElement("iframe");return i.src=s.toString(),g||(i.style.width="100%",i.style.height="100%",i.style.border="none",i.style.margin="0",e.appendChild(i)),i.referrerPolicy="strict-origin-when-cross-origin",new Promise((l,y)=>{i.addEventListener("load",()=>{i.contentWindow==null?y(new Error("Failed to load Felt map")):l(i.contentWindow)},{once:!0})}).then(V.connect).then(l=>(Object.defineProperties(l,{iframe:{value:i,writable:!1,configurable:!1}}),l))},connect(e){let m=P(e);return new Promise((n,r)=>{let p=setTimeout(()=>{r(new Error("Failed to load Felt map")),clearInterval(a)},5e3),s=new MessageChannel,a=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[s.port2])},100);s.port1.onmessage=d=>{d.data===!0&&(clearInterval(a),clearTimeout(p),s.port1.close(),s.port2.close(),n(m))}})}},M=Object.entries;export{V as Felt};
|
|
1
|
+
function o(e,m){return n=>{let r=new MessageChannel,p=n.handler,s="options"in n?n.options:void 0,a=crypto.randomUUID();return e.postMessage({type:"felt.addListener",event:s?{eventName:m,id:a,options:s}:{eventName:m,id:a}},"*",[r.port2]),r.port1.onmessage=d=>{p(d.data)},()=>{r.port1.onmessage=null,r.port1.close(),r.port2.close(),e.postMessage({type:"felt.removeListener",id:a},"*")}}}function t(e,m){return n=>{let r=new MessageChannel;return e.postMessage({type:m,params:n},"*",[r.port2]),new Promise((p,s)=>{r.port1.onmessage=a=>{a.data&&typeof a.data=="object"&&"__error__"in a.data?s(new Error(a.data.__error__)):p(a.data),r.port1.close(),r.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"),onElementCreate:o(e,"onElementCreate"),onElementCreateEnd:o(e,"onElementCreateEnd"),onElementDelete:o(e,"onElementDelete"),onElementGroupChange:o(e,"onElementGroupChange"),createElement:t(e,"createElement"),updateElement:t(e,"updateElement"),deleteElement:t(e,"deleteElement")});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"),onLayerFiltersChange:o(e,"onLayerFiltersChange"),getRenderedFeatures:t(e,"getRenderedFeatures"),getCategoryData:t(e,"getCategoryData"),getHistogramData:t(e,"getHistogramData"),getAggregates:t(e,"getAggregates")});var h=e=>({getMapDetails:t(e,"getMapDetails")});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 E=e=>({updateUiControls:t(e,"updateUiControls"),setOnMapInteractionsUi:t(e,"setOnMapInteractionsUi"),showLayerDataTable:t(e,"showLayerDataTable"),hideLayerDataTable:t(e,"hideLayerDataTable")});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 P(e){return{iframe:null,...v(e),...E(e),...C(e),...c(e),...L(e),...u(e),...T(e),...h(e)}}var V={embed(e,m,n){let r={uiControls:{showLegend:!0,cooperativeGestures:!0,fullScreenButton:!0,geolocation:!1,zoomControls:!0,scaleBar:!0},initialViewport:void 0,origin:"https://felt.com"},p=n?.origin??r.origin,s=new URL(`${p}/embed/map/${m}`),a={showLegend:"legend",cooperativeGestures:"cooperativeGestures",fullScreenButton:"link",geolocation:"geolocation",zoomControls:"zoomControls",scaleBar:"scaleBar"},d={...r.uiControls,...n?.uiControls};for(let[l,y]of M(d))y!=null&&s.searchParams.set(a[l],y?"1":"0");if(n?.token&&s.searchParams.set("token",n.token),n?.initialViewport){let l=n.initialViewport;s.searchParams.set("loc",`${l.center.latitude},${l.center.longitude},${l.zoom}z`)}let g=e.tagName==="IFRAME",i=g?e:e.ownerDocument.createElement("iframe");return i.src=s.toString(),g||(i.style.width="100%",i.style.height="100%",i.style.border="none",i.style.margin="0",e.appendChild(i)),i.referrerPolicy="strict-origin-when-cross-origin",new Promise((l,y)=>{i.addEventListener("load",()=>{i.contentWindow==null?y(new Error("Failed to load Felt map")):l(i.contentWindow)},{once:!0})}).then(V.connect).then(l=>(Object.defineProperties(l,{iframe:{value:i,writable:!1,configurable:!1}}),l))},connect(e){let m=P(e);return new Promise((n,r)=>{let p=setTimeout(()=>{r(new Error("Failed to load Felt map")),clearInterval(a)},5e3),s=new MessageChannel,a=setInterval(()=>{e.postMessage({type:"felt.ready"},"*",[s.port2])},100);s.port1.onmessage=d=>{d.data===!0&&(clearInterval(a),clearTimeout(p),s.port1.close(),s.port2.close(),n(m))}})}},M=Object.entries;export{V as Felt};
|
package/dist/handler.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,s)=>{for(var E in s)Z(r,E,{get:s[E],enumerable:!0})},st=(r,s,E,F)=>{if(s&&typeof s=="object"||typeof s=="function")for(let L of nt(s))!at.call(r,L)&&L!==E&&Z(r,L,{get:()=>s[L],enumerable:!(F=rt(s,L))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var er={};it(er,{createMessageHandler:()=>Ko});module.exports=lt(er);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,s){return f.z.strictObject({type:f.z.literal(r),params:s})}function C(r,s){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:s})}function l(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:I}),de=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),pt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(pt.shape.coordinates)}),ye=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),mt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:mt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),J=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),S={type:!0,coordinates:!0},x={id:!0},ee=he.partial().required(S).omit(x),j=K.partial().required(S).omit(x),te=_.partial().required(S).omit(x),oe=fe.partial().required(S).required({radius:!0}).omit(x),re=Q.partial().required(S).omit(x),ne=$.partial().required(S).omit(x),ae=J.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),ie=X.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),dt=Y.partial().required(S).required({imageUrl:!0}).omit(x),Me=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,dt,ae,ie]);var ir=K.omit({coordinates:!0}),sr=_.omit({coordinates:!0});var lr=Q.omit({coordinates:!0}),pr=$.omit({coordinates:!0}),mr=J.omit({coordinates:!0}),cr=X.omit({coordinates:!0}),gr=Y.omit({coordinates:!0}),dr=gt.omit({coordinates:!0}),M={type:!0,id:!0},yt=he.partial().required(M),ut=K.partial().required(M),ht=_.partial().required(M),ft=fe.partial().required(M),St=Q.partial().required(M),xt=$.partial().required(M),Mt=J.partial().required(M).omit({coordinates:!0,name:!0}),bt=X.partial().required(M).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(M),be=e.z.discriminatedUnion("type",[yt,ut,ht,ft,St,xt,Mt,bt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",y.z.string()),It=t("getElementGeometry",y.z.string()),Gt=t("getElements",Le.optional()),Et=t("getElementGroup",y.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=C("onElementChange",y.z.object({id:y.z.string()})),Ft=l("onElementCreate"),kt=l("onElementCreateEnd"),wt=C("onElementDelete",y.z.object({id:y.z.string()})),vt=C("onElementGroupChange",y.z.object({id:y.z.string()})),Vt=t("createElement",Me),Ot=t("updateElement",be),Ut=t("deleteElement",y.z.string()),Ie={methods:[Ct,It,Gt,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,wt,vt]};var Rt=l("onPointerClick"),Nt=l("onPointerMove"),Ge={methods:null,listeners:[Rt,Nt]};var p=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),qt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),br=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),At=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,qt,Ee]),se=n.z.union([At,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,de,o.z.array(I)]),Pe=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Gr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Wt=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Zt,Wt,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Er=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:Dt});var i=require("zod");var Pr=i.z.enum(["processing","completed","failed","incomplete"]),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),Ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),Oe=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ue=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Kt=t("getLayer",p.z.string()),_t=t("getLayers",ve.optional()),Qt=t("setLayerVisibility",z),$t=C("onLayerChange",p.z.object({id:p.z.string()})),Jt=t("setLayerStyle",p.z.object({id:p.z.string(),style:p.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",p.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=C("onLayerGroupChange",p.z.object({id:p.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=C("onLegendItemChange",k),so=t("setLegendItemVisibility",p.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",p.z.string()),po=t("setLayerFilters",p.z.object({layerId:p.z.string(),filters:P,note:p.z.string().optional()})),mo=t("getRenderedFeatures",Ue.optional()),co=t("getCategoryData",Fe),go=t("getHistogramData",ke),yo=t("getAggregates",we),Re={methods:[Kt,_t,Qt,Jt,Xt,Yt,eo,to,oo,no,ao,so,lo,po,mo,co,go,yo],listeners:[$t,ro,io]};var Ne=require("zod");var uo=t("getMapDetails",Ne.z.undefined()),je={methods:[uo],listeners:[]};var v=require("zod");var b=require("zod"),qe=b.z.object({id:b.z.string().or(b.z.number()),layerId:b.z.string(),showPopup:b.z.boolean().optional(),fitViewport:b.z.boolean().or(b.z.object({maxZoom:b.z.number()})).optional()});var ho=t("getSelection",v.z.undefined()),fo=l("onSelectionChange"),So=t("selectFeature",qe),xo=t("clearSelection",v.z.object({features:v.z.boolean().optional(),elements:v.z.boolean().optional()}).optional()),Ae={methods:[ho,So,xo],listeners:[fo]};var We=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=m.z.enum([...He,"link"]),De=m.z.enum(He),Mo=ee.pick({color:!0,symbol:!0,frame:!0}).required(),bo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Lo=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Co=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Io=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Go=re.pick({color:!0,opacity:!0,size:!0}).required(),Eo=ne.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),To=ae.pick({color:!0,align:!0,style:!0}).required(),zo=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[Mo.partial().extend({tool:m.z.literal("pin")}),bo.partial().extend({tool:m.z.literal("line")}),Lo.partial().extend({tool:m.z.literal("route")}),Co.partial().extend({tool:m.z.literal("polygon")}),Io.partial().extend({tool:m.z.literal("circle")}),Go.partial().extend({tool:m.z.literal("marker")}),Eo.partial().extend({tool:m.z.literal("highlighter")}),To.partial().extend({tool:m.z.literal("text")}),zo.partial().extend({tool:m.z.literal("note")})]);var Po=t("setTool",Be.nullable()),Fo=t("getTool",We.z.undefined()),ko=l("onToolChange"),wo=t("setToolSettings",Ze),vo=t("getToolSettings",De),Vo=l("onToolSettingsChange"),Ke={methods:[Po,Fo,wo,vo],listeners:[ko,Vo]};var A=require("zod");var c=require("zod"),_e=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Qe=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Oo=t("updateUiControls",_e),Uo=t("setOnMapInteractionsUi",Qe),Ro=t("showLayerDataTable",A.z.object({layerId:A.z.string(),sorting:ue.optional()}).optional()),No=t("hideLayerDataTable",A.z.undefined()),$e={methods:[Oo,Uo,Ro,No],listeners:null};var pe=require("zod");var V=require("zod");var H=V.z.object({center:R,zoom:ye}),Je=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var jo=t("getViewport",pe.z.undefined()),qo=t("setViewport",Je),Ao=t("getViewportConstraints",pe.z.undefined()),Ho=t("setViewportConstraints",Xe),Bo=t("fitViewportToBounds",Ye),Do=l("onViewportMove"),Zo=l("onViewportMoveEnd"),Wo=l("onMapIdle"),et={methods:[qo,jo,Ao,Ho,Bo],listeners:[Do,Zo,Wo]};var me=[$e,et,Re,Ie,Ae,Ge,Ke,je];function Ko(r,s,E){let F=new Map;async function L(h){if(!Yo.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ce;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let w="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=s.listeners[d.event.eventName](w);F.set(d.event.id,B)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let w=s.methods[d.type],B=await w(d.params);h.ports[0]?.postMessage(B)}catch(w){h.ports[0]?.postMessage({__error__:_o(w)})}}return r.addEventListener("message",L),()=>{r.removeEventListener("message",L)}}function _o(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:me.map(r=>r.methods??[]).flat(),listeners:me.map(r=>r.listeners??[]).flat()},Qo=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),$o=g.z.strictObject({type:g.z.literal("felt.addListener"),event:Qo}),Jo=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Xo=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[Xo,$o,Jo,...tt.methods]),Yo=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,l)=>{for(var E in l)Z(r,E,{get:l[E],enumerable:!0})},st=(r,l,E,F)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of nt(l))!at.call(r,C)&&C!==E&&Z(r,C,{get:()=>l[C],enumerable:!(F=rt(l,C))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var tr={};it(tr,{createMessageHandler:()=>_o});module.exports=lt(tr);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function p(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:I}),de=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),pt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(pt.shape.coordinates)}),ye=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),mt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:mt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),J=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),x={type:!0,coordinates:!0},M={id:!0},ee=he.partial().required(x).omit(M),j=K.partial().required(x).omit(M),te=_.partial().required(x).omit(M),oe=fe.partial().required(x).required({radius:!0}).omit(M),re=Q.partial().required(x).omit(M),ne=$.partial().required(x).omit(M),ae=J.partial().required(x).required({text:!0}).omit(M).omit({coordinates:!0,name:!0}),ie=X.partial().required(x).required({text:!0}).omit(M).omit({coordinates:!0,name:!0}),dt=Y.partial().required(x).required({imageUrl:!0}).omit(M),Me=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,dt,ae,ie]);var sr=K.omit({coordinates:!0}),lr=_.omit({coordinates:!0});var pr=Q.omit({coordinates:!0}),mr=$.omit({coordinates:!0}),cr=J.omit({coordinates:!0}),gr=X.omit({coordinates:!0}),dr=Y.omit({coordinates:!0}),yr=gt.omit({coordinates:!0}),b={type:!0,id:!0},yt=he.partial().required(b),ut=K.partial().required(b),ht=_.partial().required(b),ft=fe.partial().required(b),St=Q.partial().required(b),xt=$.partial().required(b),Mt=J.partial().required(b).omit({coordinates:!0,name:!0}),bt=X.partial().required(b).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(b),be=e.z.discriminatedUnion("type",[yt,ut,ht,ft,St,xt,Mt,bt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",y.z.string()),It=t("getElementGeometry",y.z.string()),Gt=t("getElements",Le.optional()),Et=t("getElementGroup",y.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=S("onElementChange",y.z.object({id:y.z.string()})),Ft=p("onElementCreate"),kt=p("onElementCreateEnd"),wt=S("onElementDelete",y.z.object({id:y.z.string()})),vt=S("onElementGroupChange",y.z.object({id:y.z.string()})),Vt=t("createElement",Me),Ot=t("updateElement",be),Ut=t("deleteElement",y.z.string()),Ie={methods:[Ct,It,Gt,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,wt,vt]};var Rt=p("onPointerClick"),Nt=p("onPointerMove"),Ge={methods:null,listeners:[Rt,Nt]};var s=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),qt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Lr=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),At=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,qt,Ee]),se=n.z.union([At,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,de,o.z.array(I)]),Pe=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Er=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Wt=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Zt,Wt,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Tr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:Dt});var i=require("zod");var Fr=i.z.enum(["processing","completed","failed","incomplete"]),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),Ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),Oe=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ue=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Kt=t("getLayer",s.z.string()),_t=t("getLayers",ve.optional()),Qt=t("setLayerVisibility",z),$t=S("onLayerChange",s.z.object({id:s.z.string()})),Jt=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",s.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=S("onLayerGroupChange",s.z.object({id:s.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=S("onLegendItemChange",k),so=t("setLegendItemVisibility",s.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",s.z.string()),po=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:P,note:s.z.string().optional()})),mo=S("onLayerFiltersChange",s.z.object({layerId:s.z.string()})),co=t("getRenderedFeatures",Ue.optional()),go=t("getCategoryData",Fe),yo=t("getHistogramData",ke),uo=t("getAggregates",we),Re={methods:[Kt,_t,Qt,Jt,Xt,Yt,eo,to,oo,no,ao,so,lo,po,co,go,yo,uo],listeners:[$t,ro,io,mo]};var Ne=require("zod");var ho=t("getMapDetails",Ne.z.undefined()),je={methods:[ho],listeners:[]};var v=require("zod");var L=require("zod"),qe=L.z.object({id:L.z.string().or(L.z.number()),layerId:L.z.string(),showPopup:L.z.boolean().optional(),fitViewport:L.z.boolean().or(L.z.object({maxZoom:L.z.number()})).optional()});var fo=t("getSelection",v.z.undefined()),So=p("onSelectionChange"),xo=t("selectFeature",qe),Mo=t("clearSelection",v.z.object({features:v.z.boolean().optional(),elements:v.z.boolean().optional()}).optional()),Ae={methods:[fo,xo,Mo],listeners:[So]};var We=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=m.z.enum([...He,"link"]),De=m.z.enum(He),bo=ee.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),Lo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Co=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Io=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Go=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Eo=re.pick({color:!0,opacity:!0,size:!0}).required(),To=ne.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),zo=ae.pick({color:!0,align:!0,style:!0}).required(),Po=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[bo.partial().extend({tool:m.z.literal("pin")}),Lo.partial().extend({tool:m.z.literal("line")}),Co.partial().extend({tool:m.z.literal("route")}),Io.partial().extend({tool:m.z.literal("polygon")}),Go.partial().extend({tool:m.z.literal("circle")}),Eo.partial().extend({tool:m.z.literal("marker")}),To.partial().extend({tool:m.z.literal("highlighter")}),zo.partial().extend({tool:m.z.literal("text")}),Po.partial().extend({tool:m.z.literal("note")})]);var Fo=t("setTool",Be.nullable()),ko=t("getTool",We.z.undefined()),wo=p("onToolChange"),vo=t("setToolSettings",Ze),Vo=t("getToolSettings",De),Oo=p("onToolSettingsChange"),Ke={methods:[Fo,ko,vo,Vo],listeners:[wo,Oo]};var A=require("zod");var c=require("zod"),_e=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Qe=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Uo=t("updateUiControls",_e),Ro=t("setOnMapInteractionsUi",Qe),No=t("showLayerDataTable",A.z.object({layerId:A.z.string(),sorting:ue.optional()}).optional()),jo=t("hideLayerDataTable",A.z.undefined()),$e={methods:[Uo,Ro,No,jo],listeners:null};var pe=require("zod");var V=require("zod");var H=V.z.object({center:R,zoom:ye}),Je=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var qo=t("getViewport",pe.z.undefined()),Ao=t("setViewport",Je),Ho=t("getViewportConstraints",pe.z.undefined()),Bo=t("setViewportConstraints",Xe),Do=t("fitViewportToBounds",Ye),Zo=p("onViewportMove"),Wo=p("onViewportMoveEnd"),Ko=p("onMapIdle"),et={methods:[Ao,qo,Ho,Bo,Do],listeners:[Zo,Wo,Ko]};var me=[$e,et,Re,Ie,Ae,Ge,Ke,je];function _o(r,l,E){let F=new Map;async function C(h){if(!er.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ce;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let w="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=l.listeners[d.event.eventName](w);F.set(d.event.id,B)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let w=l.methods[d.type],B=await w(d.params);h.ports[0]?.postMessage(B)}catch(w){h.ports[0]?.postMessage({__error__:Qo(w)})}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}function Qo(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:me.map(r=>r.methods??[]).flat(),listeners:me.map(r=>r.listeners??[]).flat()},$o=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),Jo=g.z.strictObject({type:g.z.literal("felt.addListener"),event:$o}),Xo=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Yo=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[Yo,Jo,Xo,...tt.methods]),er=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/dist/handler.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-
|
|
2
|
+
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-BXCTpxot.cjs';
|
|
3
3
|
|
|
4
4
|
type Method<TRequest extends {
|
|
5
5
|
type: string;
|
|
@@ -1888,6 +1888,29 @@ declare const SetFiltersMessage: z.ZodObject<{
|
|
|
1888
1888
|
};
|
|
1889
1889
|
type: "setLayerFilters";
|
|
1890
1890
|
}>;
|
|
1891
|
+
declare const OnLayerFiltersChangeMessage: z.ZodObject<{
|
|
1892
|
+
eventName: z.ZodLiteral<"onLayerFiltersChange">;
|
|
1893
|
+
id: z.ZodString;
|
|
1894
|
+
options: z.ZodObject<{
|
|
1895
|
+
layerId: z.ZodString;
|
|
1896
|
+
}, "strip", z.ZodTypeAny, {
|
|
1897
|
+
layerId: string;
|
|
1898
|
+
}, {
|
|
1899
|
+
layerId: string;
|
|
1900
|
+
}>;
|
|
1901
|
+
}, "strict", z.ZodTypeAny, {
|
|
1902
|
+
options: {
|
|
1903
|
+
layerId: string;
|
|
1904
|
+
};
|
|
1905
|
+
id: string;
|
|
1906
|
+
eventName: "onLayerFiltersChange";
|
|
1907
|
+
}, {
|
|
1908
|
+
options: {
|
|
1909
|
+
layerId: string;
|
|
1910
|
+
};
|
|
1911
|
+
id: string;
|
|
1912
|
+
eventName: "onLayerFiltersChange";
|
|
1913
|
+
}>;
|
|
1891
1914
|
declare const GetRenderedFeaturesMessage: z.ZodObject<{
|
|
1892
1915
|
type: z.ZodLiteral<"getRenderedFeatures">;
|
|
1893
1916
|
params: z.ZodOptional<z.ZodObject<{
|
|
@@ -2408,6 +2431,7 @@ type LayersSchema = {
|
|
|
2408
2431
|
onLayerChange: Listener<zInfer<typeof OnLayerChangeMessage.shape.options>, LayerChangeCallbackParams>;
|
|
2409
2432
|
onLayerGroupChange: Listener<zInfer<typeof OnLayerGroupChangeMessage.shape.options>, LayerGroupChangeCallbackParams>;
|
|
2410
2433
|
onLegendItemChange: Listener<zInfer<typeof OnLegendItemChangeMessage.shape.options>, LegendItemChangeCallbackParams>;
|
|
2434
|
+
onLayerFiltersChange: Listener<zInfer<typeof OnLayerFiltersChangeMessage.shape.options>, LayerFilters>;
|
|
2411
2435
|
};
|
|
2412
2436
|
};
|
|
2413
2437
|
|
|
@@ -2551,6 +2575,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2551
2575
|
symbol: z.ZodOptional<z.ZodString>;
|
|
2552
2576
|
color: z.ZodOptional<z.ZodString>;
|
|
2553
2577
|
frame: z.ZodOptional<z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>>;
|
|
2578
|
+
afterCreation: z.ZodOptional<z.ZodEnum<["enter name", "add another", "select"]>>;
|
|
2554
2579
|
}, {
|
|
2555
2580
|
tool: z.ZodLiteral<"pin">;
|
|
2556
2581
|
}>, "strip", z.ZodTypeAny, {
|
|
@@ -2558,11 +2583,13 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2558
2583
|
symbol?: string | undefined;
|
|
2559
2584
|
color?: string | undefined;
|
|
2560
2585
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2586
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2561
2587
|
}, {
|
|
2562
2588
|
tool: "pin";
|
|
2563
2589
|
symbol?: string | undefined;
|
|
2564
2590
|
color?: string | undefined;
|
|
2565
2591
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2592
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2566
2593
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
2567
2594
|
color: z.ZodOptional<z.ZodString>;
|
|
2568
2595
|
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2734,6 +2761,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2734
2761
|
symbol?: string | undefined;
|
|
2735
2762
|
color?: string | undefined;
|
|
2736
2763
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2764
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2737
2765
|
} | {
|
|
2738
2766
|
tool: "line";
|
|
2739
2767
|
color?: string | undefined;
|
|
@@ -2794,6 +2822,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2794
2822
|
symbol?: string | undefined;
|
|
2795
2823
|
color?: string | undefined;
|
|
2796
2824
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2825
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2797
2826
|
} | {
|
|
2798
2827
|
tool: "line";
|
|
2799
2828
|
color?: string | undefined;
|
package/dist/handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-
|
|
2
|
+
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-BXCTpxot.js';
|
|
3
3
|
|
|
4
4
|
type Method<TRequest extends {
|
|
5
5
|
type: string;
|
|
@@ -1888,6 +1888,29 @@ declare const SetFiltersMessage: z.ZodObject<{
|
|
|
1888
1888
|
};
|
|
1889
1889
|
type: "setLayerFilters";
|
|
1890
1890
|
}>;
|
|
1891
|
+
declare const OnLayerFiltersChangeMessage: z.ZodObject<{
|
|
1892
|
+
eventName: z.ZodLiteral<"onLayerFiltersChange">;
|
|
1893
|
+
id: z.ZodString;
|
|
1894
|
+
options: z.ZodObject<{
|
|
1895
|
+
layerId: z.ZodString;
|
|
1896
|
+
}, "strip", z.ZodTypeAny, {
|
|
1897
|
+
layerId: string;
|
|
1898
|
+
}, {
|
|
1899
|
+
layerId: string;
|
|
1900
|
+
}>;
|
|
1901
|
+
}, "strict", z.ZodTypeAny, {
|
|
1902
|
+
options: {
|
|
1903
|
+
layerId: string;
|
|
1904
|
+
};
|
|
1905
|
+
id: string;
|
|
1906
|
+
eventName: "onLayerFiltersChange";
|
|
1907
|
+
}, {
|
|
1908
|
+
options: {
|
|
1909
|
+
layerId: string;
|
|
1910
|
+
};
|
|
1911
|
+
id: string;
|
|
1912
|
+
eventName: "onLayerFiltersChange";
|
|
1913
|
+
}>;
|
|
1891
1914
|
declare const GetRenderedFeaturesMessage: z.ZodObject<{
|
|
1892
1915
|
type: z.ZodLiteral<"getRenderedFeatures">;
|
|
1893
1916
|
params: z.ZodOptional<z.ZodObject<{
|
|
@@ -2408,6 +2431,7 @@ type LayersSchema = {
|
|
|
2408
2431
|
onLayerChange: Listener<zInfer<typeof OnLayerChangeMessage.shape.options>, LayerChangeCallbackParams>;
|
|
2409
2432
|
onLayerGroupChange: Listener<zInfer<typeof OnLayerGroupChangeMessage.shape.options>, LayerGroupChangeCallbackParams>;
|
|
2410
2433
|
onLegendItemChange: Listener<zInfer<typeof OnLegendItemChangeMessage.shape.options>, LegendItemChangeCallbackParams>;
|
|
2434
|
+
onLayerFiltersChange: Listener<zInfer<typeof OnLayerFiltersChangeMessage.shape.options>, LayerFilters>;
|
|
2411
2435
|
};
|
|
2412
2436
|
};
|
|
2413
2437
|
|
|
@@ -2551,6 +2575,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2551
2575
|
symbol: z.ZodOptional<z.ZodString>;
|
|
2552
2576
|
color: z.ZodOptional<z.ZodString>;
|
|
2553
2577
|
frame: z.ZodOptional<z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>>;
|
|
2578
|
+
afterCreation: z.ZodOptional<z.ZodEnum<["enter name", "add another", "select"]>>;
|
|
2554
2579
|
}, {
|
|
2555
2580
|
tool: z.ZodLiteral<"pin">;
|
|
2556
2581
|
}>, "strip", z.ZodTypeAny, {
|
|
@@ -2558,11 +2583,13 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2558
2583
|
symbol?: string | undefined;
|
|
2559
2584
|
color?: string | undefined;
|
|
2560
2585
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2586
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2561
2587
|
}, {
|
|
2562
2588
|
tool: "pin";
|
|
2563
2589
|
symbol?: string | undefined;
|
|
2564
2590
|
color?: string | undefined;
|
|
2565
2591
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2592
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2566
2593
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
2567
2594
|
color: z.ZodOptional<z.ZodString>;
|
|
2568
2595
|
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2734,6 +2761,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2734
2761
|
symbol?: string | undefined;
|
|
2735
2762
|
color?: string | undefined;
|
|
2736
2763
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2764
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2737
2765
|
} | {
|
|
2738
2766
|
tool: "line";
|
|
2739
2767
|
color?: string | undefined;
|
|
@@ -2794,6 +2822,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2794
2822
|
symbol?: string | undefined;
|
|
2795
2823
|
color?: string | undefined;
|
|
2796
2824
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2825
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2797
2826
|
} | {
|
|
2798
2827
|
tool: "line";
|
|
2799
2828
|
color?: string | undefined;
|
package/dist/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{z as g}from"zod";import{z as y}from"zod";import{z as x}from"zod";function t(a,T){return x.strictObject({type:x.literal(a),params:T})}function M(a,T){return x.strictObject({eventName:x.literal(a),id:x.string(),options:T})}function s(a){return x.strictObject({eventName:x.literal(a),id:x.string()})}import{z as n}from"zod";var F=n.number(),k=n.number(),w=n.object({latitude:k,longitude:F}),b=n.tuple([F,k]),me=n.object({type:n.literal("Point"),coordinates:b}),ce=n.object({type:n.literal("Polygon"),coordinates:n.array(n.array(b))}),et=n.object({type:n.literal("LineString"),coordinates:n.array(b)}),L=n.object({type:n.literal("MultiLineString"),coordinates:n.array(et.shape.coordinates)}),ge=n.number().min(1).max(23),I=n.tuple([F,k,F,k]),G=n.object({show:n.array(n.string()).optional(),hide:n.array(n.string()).optional()}),tt=n.enum(["asc","desc"]),de=n.object({attribute:n.string(),direction:tt});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),v=e.object({imageUrl:e.string().nullable()}),H=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),ot=e.enum(["meter","kilometer","foot","mile"]),ye=d.extend(v.shape).extend({type:e.literal("Place"),coordinates:me.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),B=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Path"),coordinates:L.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),D=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Polygon"),coordinates:L.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),ue=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Circle"),coordinates:b,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:ot.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),Z=d.extend({type:e.literal("Marker"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),W=d.extend({type:e.literal("Highlighter"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1)}),he=e.object({position:b,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:L.shape.coordinates}),fe=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),K=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Text")}),_=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),Q=d.extend({type:e.literal("Image"),coordinates:L.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),rt=d.extend({type:e.literal("Link"),coordinates:L.shape.coordinates,url:e.string()}),h={type:!0,coordinates:!0},f={id:!0},$=ye.partial().required(h).omit(f),V=B.partial().required(h).omit(f),J=D.partial().required(h).omit(f),X=ue.partial().required(h).required({radius:!0}).omit(f),Y=Z.partial().required(h).omit(f),ee=W.partial().required(h).omit(f),te=K.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),oe=_.partial().required(h).required({text:!0}).omit(f).omit({coordinates:!0,name:!0}),nt=Q.partial().required(h).required({imageUrl:!0}).omit(f),Se=e.discriminatedUnion("type",[$,V,J,X,Y,ee,nt,te,oe]);var Yo=B.omit({coordinates:!0}),er=D.omit({coordinates:!0});var tr=Z.omit({coordinates:!0}),or=W.omit({coordinates:!0}),rr=K.omit({coordinates:!0}),nr=_.omit({coordinates:!0}),ar=Q.omit({coordinates:!0}),ir=rt.omit({coordinates:!0}),S={type:!0,id:!0},at=ye.partial().required(S),it=B.partial().required(S),st=D.partial().required(S),lt=ue.partial().required(S),pt=Z.partial().required(S),mt=W.partial().required(S),ct=K.partial().required(S).omit({coordinates:!0,name:!0}),gt=_.partial().required(S).omit({coordinates:!0,name:!0}),dt=Q.partial().required(S),xe=e.discriminatedUnion("type",[at,it,st,lt,pt,mt,ct,gt,dt]),Me=e.object({ids:e.array(e.string()).optional()}),be=e.object({ids:e.array(e.string()).optional()});var yt=t("getElement",y.string()),ut=t("getElementGeometry",y.string()),ht=t("getElements",Me.optional()),ft=t("getElementGroup",y.string()),St=t("getElementGroups",be.optional()),xt=t("setElementGroupVisibility",G),Mt=M("onElementChange",y.object({id:y.string()})),bt=s("onElementCreate"),Lt=s("onElementCreateEnd"),Ct=M("onElementDelete",y.object({id:y.string()})),It=M("onElementGroupChange",y.object({id:y.string()})),Gt=t("createElement",Se),Et=t("updateElement",xe),Tt=t("deleteElement",y.string()),Le={methods:[yt,ut,ht,ft,St,xt,Gt,Et,Tt],listeners:[Mt,bt,Lt,Ct,It]};var zt=s("onPointerClick"),Pt=s("onPointerMove"),Ce={methods:null,listeners:[zt,Pt]};import{z as l}from"zod";import{z as r}from"zod";var Ft=r.enum(["in","ni"]),kt=r.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),hr=r.enum(["and","or"]),Ie=r.union([r.number(),r.string(),r.boolean(),r.null()]),Ge=r.string().or(r.null()),wt=r.tuple([Ge,Ft,r.array(Ie).or(r.null())]),vt=r.tuple([Ge,kt,Ie]),re=r.union([wt,vt]),ne=r.tuple([r.lazy(()=>r.union([ne,re,r.null(),r.boolean()])),r.enum(["and","or"]),r.lazy(()=>r.union([ne,re,r.null(),r.boolean()]))]),E=r.union([ne,re,r.null(),r.boolean()]);import{z as o}from"zod";var Ee=o.enum(["avg","max","min","sum","median"]),Vt=o.object({method:Ee,attribute:o.string()}),Ot=o.object({methods:o.array(o.union([Ee,o.literal("count")])),attribute:o.string().optional()}),O=o.union([I,ce,o.array(b)]),Te=o.object({boundary:O.optional(),filters:E.optional(),aggregation:Vt.optional()}),ze=o.object({layerId:o.string(),attribute:o.string(),limit:o.number().optional(),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),br=o.object({key:o.union([o.number(),o.string(),o.boolean()]),value:o.number().nullable()}),Ut=o.object({type:o.literal("equal-intervals"),count:o.number()}),Rt=o.object({type:o.literal("time-interval"),interval:o.enum(["hour","day","week","month","year"])}),Pe=o.object({layerId:o.string(),attribute:o.string(),steps:o.union([Ut,Rt,o.array(o.number())]),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),Lr=o.object({min:o.number(),max:o.number(),value:o.number()}),Fe=o.object({layerId:o.string(),boundary:O.optional(),filters:E.optional(),aggregation:Ot});import{z as i}from"zod";var Er=i.enum(["processing","completed","failed","incomplete"]),ke=i.object({ids:i.array(i.string()).optional()}),we=i.object({ids:i.array(i.string()).optional()}),z=i.object({id:i.string(),layerId:i.string()}),ve=i.object({ids:z.array().optional(),layerIds:i.string().array().optional()}),Ve=i.object({layerIds:i.array(i.string()).optional(),areaQuery:i.union([i.object({coordinates:w}),i.object({boundary:I})]).optional()});var Nt=t("getLayer",l.string()),jt=t("getLayers",ke.optional()),qt=t("setLayerVisibility",G),At=M("onLayerChange",l.object({id:l.string()})),Ht=t("setLayerStyle",l.object({id:l.string(),style:l.object({}).passthrough()})),Bt=t("setLayerLegendVisibility",G),Dt=t("getLayerGroup",l.string()),Zt=t("getLayerGroups",we.optional()),Wt=t("setLayerGroupVisibility",G),Kt=t("setLayerGroupLegendVisibility",G),_t=M("onLayerGroupChange",l.object({id:l.string()})),Qt=t("getLegendItem",z),$t=t("getLegendItems",ve.optional()),Jt=M("onLegendItemChange",z),Xt=t("setLegendItemVisibility",l.object({show:z.array().optional(),hide:z.array().optional()})),Yt=t("getLayerFilters",l.string()),eo=t("setLayerFilters",l.object({layerId:l.string(),filters:E,note:l.string().optional()})),to=t("getRenderedFeatures",Ve.optional()),oo=t("getCategoryData",ze),ro=t("getHistogramData",Pe),no=t("getAggregates",Fe),Oe={methods:[Nt,jt,qt,Ht,Bt,Dt,Zt,Wt,Kt,Qt,$t,Xt,Yt,eo,to,oo,ro,no],listeners:[At,_t,Jt]};import{z as ao}from"zod";var io=t("getMapDetails",ao.undefined()),Ue={methods:[io],listeners:[]};import{z as U}from"zod";import{z as C}from"zod";var Re=C.object({id:C.string().or(C.number()),layerId:C.string(),showPopup:C.boolean().optional(),fitViewport:C.boolean().or(C.object({maxZoom:C.number()})).optional()});var so=t("getSelection",U.undefined()),lo=s("onSelectionChange"),po=t("selectFeature",Re),mo=t("clearSelection",U.object({features:U.boolean().optional(),elements:U.boolean().optional()}).optional()),Ne={methods:[so,po,mo],listeners:[lo]};import{z as bo}from"zod";import{z as m}from"zod";var je=["pin","line","route","polygon","circle","marker","highlighter","text","note"],qe=m.enum([...je,"link"]),Ae=m.enum(je),co=$.pick({color:!0,symbol:!0,frame:!0}).required(),go=V.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),yo=V.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),uo=J.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),ho=X.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),fo=Y.pick({color:!0,opacity:!0,size:!0}).required(),So=ee.pick({color:!0,opacity:!0}).extend({size:m.number().min(0).max(200)}).required(),xo=te.pick({color:!0,align:!0,style:!0}).required(),Mo=oe.pick({color:!0,align:!0,style:!0}).required(),He=m.discriminatedUnion("tool",[co.partial().extend({tool:m.literal("pin")}),go.partial().extend({tool:m.literal("line")}),yo.partial().extend({tool:m.literal("route")}),uo.partial().extend({tool:m.literal("polygon")}),ho.partial().extend({tool:m.literal("circle")}),fo.partial().extend({tool:m.literal("marker")}),So.partial().extend({tool:m.literal("highlighter")}),xo.partial().extend({tool:m.literal("text")}),Mo.partial().extend({tool:m.literal("note")})]);var Lo=t("setTool",qe.nullable()),Co=t("getTool",bo.undefined()),Io=s("onToolChange"),Go=t("setToolSettings",He),Eo=t("getToolSettings",Ae),To=s("onToolSettingsChange"),Be={methods:[Lo,Co,Go,Eo],listeners:[Io,To]};import{z as ae}from"zod";import{z as c}from"zod";var De=c.object({showLegend:c.boolean().optional(),cooperativeGestures:c.boolean().optional(),fullScreenButton:c.boolean().optional(),geolocation:c.boolean().optional(),zoomControls:c.boolean().optional(),scaleBar:c.boolean().optional()}),Ze=c.object({featureSelectPanel:c.boolean().optional(),featureHoverPanel:c.boolean().optional(),elementSelectPanel:c.boolean().optional(),linkClickOpen:c.boolean().optional(),imageLightboxOpen:c.boolean().optional()});var zo=t("updateUiControls",De),Po=t("setOnMapInteractionsUi",Ze),Fo=t("showLayerDataTable",ae.object({layerId:ae.string(),sorting:de.optional()}).optional()),ko=t("hideLayerDataTable",ae.undefined()),We={methods:[zo,Po,Fo,ko],listeners:null};import{z as $e}from"zod";import{z as N}from"zod";var R=N.object({center:w,zoom:ge}),Ke=N.object({center:R.shape.center.optional(),zoom:R.shape.zoom.optional()}),_e=N.object({minZoom:R.shape.zoom.nullish(),maxZoom:R.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),Qe=N.object({bounds:I});var wo=t("getViewport",$e.undefined()),vo=t("setViewport",Ke),Vo=t("getViewportConstraints",$e.undefined()),Oo=t("setViewportConstraints",_e),Uo=t("fitViewportToBounds",Qe),Ro=s("onViewportMove"),No=s("onViewportMoveEnd"),jo=s("onMapIdle"),Je={methods:[vo,wo,Vo,Oo,Uo],listeners:[Ro,No,jo]};var ie=[We,Je,Oe,Le,Ne,Ce,Be,Ue];function Cn(a,T,se){let j=new Map;async function le(u){if(!Zo.safeParse(u.data).success){se?.onUnknownMessage?.(u.data);return}let pe=Ye.safeParse(u.data);if(!pe.success){se?.onInvalidMessage?.(u.data);return}let{data:p}=pe;if(p.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(p.type==="felt.addListener"){if(p.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let P="options"in p.event?{options:"options"in p.event?p.event.options:void 0,handler:A=>{u.ports[0]?.postMessage(A)}}:{handler:A=>{u.ports[0]?.postMessage(A)}},q=T.listeners[p.event.eventName](P);j.set(p.event.id,q)}else if(p.type==="felt.removeListener")j.get(p.id)?.(),j.delete(p.id);else try{let P=T.methods[p.type],q=await P(p.params);u.ports[0]?.postMessage(q)}catch(P){u.ports[0]?.postMessage({__error__:qo(P)})}}return a.addEventListener("message",le),()=>{a.removeEventListener("message",le)}}function qo(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}var Xe={methods:ie.map(a=>a.methods??[]).flat(),listeners:ie.map(a=>a.listeners??[]).flat()},Ao=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...Xe.listeners]),Ho=g.strictObject({type:g.literal("felt.addListener"),event:Ao}),Bo=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),Do=g.strictObject({type:g.literal("felt.ready")}),Ye=g.discriminatedUnion("type",[Do,Ho,Bo,...Xe.methods]),Zo=g.object({type:g.enum(Ye.options.map(a=>a.shape.type.value))});export{Cn as createMessageHandler};
|
|
1
|
+
import{z as g}from"zod";import{z as y}from"zod";import{z as M}from"zod";function t(a,T){return M.strictObject({type:M.literal(a),params:T})}function h(a,T){return M.strictObject({eventName:M.literal(a),id:M.string(),options:T})}function l(a){return M.strictObject({eventName:M.literal(a),id:M.string()})}import{z as n}from"zod";var F=n.number(),k=n.number(),w=n.object({latitude:k,longitude:F}),b=n.tuple([F,k]),me=n.object({type:n.literal("Point"),coordinates:b}),ce=n.object({type:n.literal("Polygon"),coordinates:n.array(n.array(b))}),et=n.object({type:n.literal("LineString"),coordinates:n.array(b)}),L=n.object({type:n.literal("MultiLineString"),coordinates:n.array(et.shape.coordinates)}),ge=n.number().min(1).max(23),I=n.tuple([F,k,F,k]),G=n.object({show:n.array(n.string()).optional(),hide:n.array(n.string()).optional()}),tt=n.enum(["asc","desc"]),de=n.object({attribute:n.string(),direction:tt});import{z as e}from"zod";var d=e.object({id:e.string(),groupId:e.string().nullable(),color:e.string(),name:e.union([e.string(),e.null()]),description:e.union([e.string(),e.null()]),attributes:e.record(e.string(),e.unknown())}),v=e.object({imageUrl:e.string().nullable()}),H=e.object({strokeOpacity:e.number(),strokeWidth:e.number(),strokeStyle:e.enum(["solid","dashed","dotted"])}),ot=e.enum(["meter","kilometer","foot","mile"]),ye=d.extend(v.shape).extend({type:e.literal("Place"),coordinates:me.shape.coordinates,symbol:e.string(),frame:e.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.boolean()}),B=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Path"),coordinates:L.shape.coordinates,distanceMarker:e.boolean(),endCaps:e.boolean(),routingMode:e.enum(["driving","cycling","walking","flying"]).nullable()}),D=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Polygon"),coordinates:L.shape.coordinates,fillOpacity:e.number().min(0).max(1),areaMarker:e.boolean()}),ue=d.extend(v.shape).extend(H.shape).extend({type:e.literal("Circle"),coordinates:b,radius:e.number(),radiusDisplayAngle:e.number(),radiusDisplayUnit:ot.nullable(),fillOpacity:e.number().min(0).max(1),radiusMarker:e.boolean()}),Z=d.extend({type:e.literal("Marker"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1),size:e.number().min(0).max(100),zoom:e.number().min(0).max(23)}),W=d.extend({type:e.literal("Highlighter"),coordinates:L.shape.coordinates,opacity:e.number().min(0).max(1)}),he=e.object({position:b,rotation:e.number(),scale:e.number(),zoom:e.number().min(0).max(23),coordinates:L.shape.coordinates}),fe=e.object({text:e.string(),align:e.enum(["left","center","right"]),style:e.enum(["italic","light","regular","caps"]),name:e.string()}),K=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Text")}),_=d.extend(he.shape).extend(fe.shape).extend({type:e.literal("Note"),widthScale:e.number().min(0)}),Q=d.extend({type:e.literal("Image"),coordinates:L.shape.coordinates,imageUrl:e.string(),opacity:e.number().min(0).max(1)}).omit({color:!0}),rt=d.extend({type:e.literal("Link"),coordinates:L.shape.coordinates,url:e.string()}),f={type:!0,coordinates:!0},S={id:!0},$=ye.partial().required(f).omit(S),V=B.partial().required(f).omit(S),J=D.partial().required(f).omit(S),X=ue.partial().required(f).required({radius:!0}).omit(S),Y=Z.partial().required(f).omit(S),ee=W.partial().required(f).omit(S),te=K.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),oe=_.partial().required(f).required({text:!0}).omit(S).omit({coordinates:!0,name:!0}),nt=Q.partial().required(f).required({imageUrl:!0}).omit(S),Se=e.discriminatedUnion("type",[$,V,J,X,Y,ee,nt,te,oe]);var er=B.omit({coordinates:!0}),tr=D.omit({coordinates:!0});var or=Z.omit({coordinates:!0}),rr=W.omit({coordinates:!0}),nr=K.omit({coordinates:!0}),ar=_.omit({coordinates:!0}),ir=Q.omit({coordinates:!0}),sr=rt.omit({coordinates:!0}),x={type:!0,id:!0},at=ye.partial().required(x),it=B.partial().required(x),st=D.partial().required(x),lt=ue.partial().required(x),pt=Z.partial().required(x),mt=W.partial().required(x),ct=K.partial().required(x).omit({coordinates:!0,name:!0}),gt=_.partial().required(x).omit({coordinates:!0,name:!0}),dt=Q.partial().required(x),xe=e.discriminatedUnion("type",[at,it,st,lt,pt,mt,ct,gt,dt]),Me=e.object({ids:e.array(e.string()).optional()}),be=e.object({ids:e.array(e.string()).optional()});var yt=t("getElement",y.string()),ut=t("getElementGeometry",y.string()),ht=t("getElements",Me.optional()),ft=t("getElementGroup",y.string()),St=t("getElementGroups",be.optional()),xt=t("setElementGroupVisibility",G),Mt=h("onElementChange",y.object({id:y.string()})),bt=l("onElementCreate"),Lt=l("onElementCreateEnd"),Ct=h("onElementDelete",y.object({id:y.string()})),It=h("onElementGroupChange",y.object({id:y.string()})),Gt=t("createElement",Se),Et=t("updateElement",xe),Tt=t("deleteElement",y.string()),Le={methods:[yt,ut,ht,ft,St,xt,Gt,Et,Tt],listeners:[Mt,bt,Lt,Ct,It]};var zt=l("onPointerClick"),Pt=l("onPointerMove"),Ce={methods:null,listeners:[zt,Pt]};import{z as s}from"zod";import{z as r}from"zod";var Ft=r.enum(["in","ni"]),kt=r.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),fr=r.enum(["and","or"]),Ie=r.union([r.number(),r.string(),r.boolean(),r.null()]),Ge=r.string().or(r.null()),wt=r.tuple([Ge,Ft,r.array(Ie).or(r.null())]),vt=r.tuple([Ge,kt,Ie]),re=r.union([wt,vt]),ne=r.tuple([r.lazy(()=>r.union([ne,re,r.null(),r.boolean()])),r.enum(["and","or"]),r.lazy(()=>r.union([ne,re,r.null(),r.boolean()]))]),E=r.union([ne,re,r.null(),r.boolean()]);import{z as o}from"zod";var Ee=o.enum(["avg","max","min","sum","median"]),Vt=o.object({method:Ee,attribute:o.string()}),Ot=o.object({methods:o.array(o.union([Ee,o.literal("count")])),attribute:o.string().optional()}),O=o.union([I,ce,o.array(b)]),Te=o.object({boundary:O.optional(),filters:E.optional(),aggregation:Vt.optional()}),ze=o.object({layerId:o.string(),attribute:o.string(),limit:o.number().optional(),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),Lr=o.object({key:o.union([o.number(),o.string(),o.boolean()]),value:o.number().nullable()}),Ut=o.object({type:o.literal("equal-intervals"),count:o.number()}),Rt=o.object({type:o.literal("time-interval"),interval:o.enum(["hour","day","week","month","year"])}),Pe=o.object({layerId:o.string(),attribute:o.string(),steps:o.union([Ut,Rt,o.array(o.number())]),boundary:O.optional(),filters:E.optional(),values:Te.optional()}),Cr=o.object({min:o.number(),max:o.number(),value:o.number()}),Fe=o.object({layerId:o.string(),boundary:O.optional(),filters:E.optional(),aggregation:Ot});import{z as i}from"zod";var Tr=i.enum(["processing","completed","failed","incomplete"]),ke=i.object({ids:i.array(i.string()).optional()}),we=i.object({ids:i.array(i.string()).optional()}),z=i.object({id:i.string(),layerId:i.string()}),ve=i.object({ids:z.array().optional(),layerIds:i.string().array().optional()}),Ve=i.object({layerIds:i.array(i.string()).optional(),areaQuery:i.union([i.object({coordinates:w}),i.object({boundary:I})]).optional()});var Nt=t("getLayer",s.string()),jt=t("getLayers",ke.optional()),qt=t("setLayerVisibility",G),At=h("onLayerChange",s.object({id:s.string()})),Ht=t("setLayerStyle",s.object({id:s.string(),style:s.object({}).passthrough()})),Bt=t("setLayerLegendVisibility",G),Dt=t("getLayerGroup",s.string()),Zt=t("getLayerGroups",we.optional()),Wt=t("setLayerGroupVisibility",G),Kt=t("setLayerGroupLegendVisibility",G),_t=h("onLayerGroupChange",s.object({id:s.string()})),Qt=t("getLegendItem",z),$t=t("getLegendItems",ve.optional()),Jt=h("onLegendItemChange",z),Xt=t("setLegendItemVisibility",s.object({show:z.array().optional(),hide:z.array().optional()})),Yt=t("getLayerFilters",s.string()),eo=t("setLayerFilters",s.object({layerId:s.string(),filters:E,note:s.string().optional()})),to=h("onLayerFiltersChange",s.object({layerId:s.string()})),oo=t("getRenderedFeatures",Ve.optional()),ro=t("getCategoryData",ze),no=t("getHistogramData",Pe),ao=t("getAggregates",Fe),Oe={methods:[Nt,jt,qt,Ht,Bt,Dt,Zt,Wt,Kt,Qt,$t,Xt,Yt,eo,oo,ro,no,ao],listeners:[At,_t,Jt,to]};import{z as io}from"zod";var so=t("getMapDetails",io.undefined()),Ue={methods:[so],listeners:[]};import{z as U}from"zod";import{z as C}from"zod";var Re=C.object({id:C.string().or(C.number()),layerId:C.string(),showPopup:C.boolean().optional(),fitViewport:C.boolean().or(C.object({maxZoom:C.number()})).optional()});var lo=t("getSelection",U.undefined()),po=l("onSelectionChange"),mo=t("selectFeature",Re),co=t("clearSelection",U.object({features:U.boolean().optional(),elements:U.boolean().optional()}).optional()),Ne={methods:[lo,mo,co],listeners:[po]};import{z as Lo}from"zod";import{z as p}from"zod";var je=["pin","line","route","polygon","circle","marker","highlighter","text","note"],qe=p.enum([...je,"link"]),Ae=p.enum(je),go=$.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:p.enum(["enter name","add another","select"])}).required(),yo=V.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),uo=V.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),ho=J.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),fo=X.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),So=Y.pick({color:!0,opacity:!0,size:!0}).required(),xo=ee.pick({color:!0,opacity:!0}).extend({size:p.number().min(0).max(200)}).required(),Mo=te.pick({color:!0,align:!0,style:!0}).required(),bo=oe.pick({color:!0,align:!0,style:!0}).required(),He=p.discriminatedUnion("tool",[go.partial().extend({tool:p.literal("pin")}),yo.partial().extend({tool:p.literal("line")}),uo.partial().extend({tool:p.literal("route")}),ho.partial().extend({tool:p.literal("polygon")}),fo.partial().extend({tool:p.literal("circle")}),So.partial().extend({tool:p.literal("marker")}),xo.partial().extend({tool:p.literal("highlighter")}),Mo.partial().extend({tool:p.literal("text")}),bo.partial().extend({tool:p.literal("note")})]);var Co=t("setTool",qe.nullable()),Io=t("getTool",Lo.undefined()),Go=l("onToolChange"),Eo=t("setToolSettings",He),To=t("getToolSettings",Ae),zo=l("onToolSettingsChange"),Be={methods:[Co,Io,Eo,To],listeners:[Go,zo]};import{z as ae}from"zod";import{z as c}from"zod";var De=c.object({showLegend:c.boolean().optional(),cooperativeGestures:c.boolean().optional(),fullScreenButton:c.boolean().optional(),geolocation:c.boolean().optional(),zoomControls:c.boolean().optional(),scaleBar:c.boolean().optional()}),Ze=c.object({featureSelectPanel:c.boolean().optional(),featureHoverPanel:c.boolean().optional(),elementSelectPanel:c.boolean().optional(),linkClickOpen:c.boolean().optional(),imageLightboxOpen:c.boolean().optional()});var Po=t("updateUiControls",De),Fo=t("setOnMapInteractionsUi",Ze),ko=t("showLayerDataTable",ae.object({layerId:ae.string(),sorting:de.optional()}).optional()),wo=t("hideLayerDataTable",ae.undefined()),We={methods:[Po,Fo,ko,wo],listeners:null};import{z as $e}from"zod";import{z as N}from"zod";var R=N.object({center:w,zoom:ge}),Ke=N.object({center:R.shape.center.optional(),zoom:R.shape.zoom.optional()}),_e=N.object({minZoom:R.shape.zoom.nullish(),maxZoom:R.shape.zoom.nullish(),bounds:I.nullish()}).nullable(),Qe=N.object({bounds:I});var vo=t("getViewport",$e.undefined()),Vo=t("setViewport",Ke),Oo=t("getViewportConstraints",$e.undefined()),Uo=t("setViewportConstraints",_e),Ro=t("fitViewportToBounds",Qe),No=l("onViewportMove"),jo=l("onViewportMoveEnd"),qo=l("onMapIdle"),Je={methods:[Vo,vo,Oo,Uo,Ro],listeners:[No,jo,qo]};var ie=[We,Je,Oe,Le,Ne,Ce,Be,Ue];function In(a,T,se){let j=new Map;async function le(u){if(!Wo.safeParse(u.data).success){se?.onUnknownMessage?.(u.data);return}let pe=Ye.safeParse(u.data);if(!pe.success){se?.onInvalidMessage?.(u.data);return}let{data:m}=pe;if(m.type==="felt.ready")u.ports[0]?.postMessage(!0);else if(m.type==="felt.addListener"){if(m.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let P="options"in m.event?{options:"options"in m.event?m.event.options:void 0,handler:A=>{u.ports[0]?.postMessage(A)}}:{handler:A=>{u.ports[0]?.postMessage(A)}},q=T.listeners[m.event.eventName](P);j.set(m.event.id,q)}else if(m.type==="felt.removeListener")j.get(m.id)?.(),j.delete(m.id);else try{let P=T.methods[m.type],q=await P(m.params);u.ports[0]?.postMessage(q)}catch(P){u.ports[0]?.postMessage({__error__:Ao(P)})}}return a.addEventListener("message",le),()=>{a.removeEventListener("message",le)}}function Ao(a){return a instanceof Error?a.message:typeof a=="object"&&a!==null&&"message"in a?String(a.message):typeof a=="string"?a:"Unknown error"}var Xe={methods:ie.map(a=>a.methods??[]).flat(),listeners:ie.map(a=>a.listeners??[]).flat()},Ho=g.discriminatedUnion("eventName",[g.strictObject({eventName:g.literal("")}),...Xe.listeners]),Bo=g.strictObject({type:g.literal("felt.addListener"),event:Ho}),Do=g.strictObject({type:g.literal("felt.removeListener"),id:g.string()}),Zo=g.strictObject({type:g.literal("felt.ready")}),Ye=g.discriminatedUnion("type",[Zo,Bo,Do,...Xe.methods]),Wo=g.object({type:g.enum(Ye.options.map(a=>a.shape.type.value))});export{In as createMessageHandler};
|
|
@@ -2855,17 +2855,30 @@ declare const PinToolSettingsSchema: z.ZodObject<{
|
|
|
2855
2855
|
symbol: z.ZodString;
|
|
2856
2856
|
color: z.ZodString;
|
|
2857
2857
|
frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
|
|
2858
|
+
afterCreation: z.ZodEnum<["enter name", "add another", "select"]>;
|
|
2858
2859
|
}, "strip", z.ZodTypeAny, {
|
|
2859
2860
|
symbol: string;
|
|
2860
2861
|
color: string;
|
|
2861
2862
|
frame: "frame-circle" | "frame-square" | null;
|
|
2863
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2862
2864
|
}, {
|
|
2863
2865
|
symbol: string;
|
|
2864
2866
|
color: string;
|
|
2865
2867
|
frame: "frame-circle" | "frame-square" | null;
|
|
2868
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2866
2869
|
}>;
|
|
2867
2870
|
interface PinToolSettings extends zInfer<typeof PinToolSettingsSchema> {
|
|
2868
2871
|
symbol: PlaceSymbol;
|
|
2872
|
+
/**
|
|
2873
|
+
* What to do after creating the Place element.
|
|
2874
|
+
*
|
|
2875
|
+
* - `"enter name"`: Enter a name for the Place, focusing the name input.
|
|
2876
|
+
* - `"add another"`: Add another Place, leaving the tool still selected.
|
|
2877
|
+
* - `"none"`: Puts the tool down and selects the new Place element.
|
|
2878
|
+
*
|
|
2879
|
+
* @defaultValue `"enter name"`
|
|
2880
|
+
*/
|
|
2881
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2869
2882
|
}
|
|
2870
2883
|
declare const LineToolSettingsSchema: z.ZodObject<{
|
|
2871
2884
|
color: z.ZodString;
|
|
@@ -2855,17 +2855,30 @@ declare const PinToolSettingsSchema: z.ZodObject<{
|
|
|
2855
2855
|
symbol: z.ZodString;
|
|
2856
2856
|
color: z.ZodString;
|
|
2857
2857
|
frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
|
|
2858
|
+
afterCreation: z.ZodEnum<["enter name", "add another", "select"]>;
|
|
2858
2859
|
}, "strip", z.ZodTypeAny, {
|
|
2859
2860
|
symbol: string;
|
|
2860
2861
|
color: string;
|
|
2861
2862
|
frame: "frame-circle" | "frame-square" | null;
|
|
2863
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2862
2864
|
}, {
|
|
2863
2865
|
symbol: string;
|
|
2864
2866
|
color: string;
|
|
2865
2867
|
frame: "frame-circle" | "frame-square" | null;
|
|
2868
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2866
2869
|
}>;
|
|
2867
2870
|
interface PinToolSettings extends zInfer<typeof PinToolSettingsSchema> {
|
|
2868
2871
|
symbol: PlaceSymbol;
|
|
2872
|
+
/**
|
|
2873
|
+
* What to do after creating the Place element.
|
|
2874
|
+
*
|
|
2875
|
+
* - `"enter name"`: Enter a name for the Place, focusing the name input.
|
|
2876
|
+
* - `"add another"`: Add another Place, leaving the tool still selected.
|
|
2877
|
+
* - `"none"`: Puts the tool down and selects the new Place element.
|
|
2878
|
+
*
|
|
2879
|
+
* @defaultValue `"enter name"`
|
|
2880
|
+
*/
|
|
2881
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2869
2882
|
}
|
|
2870
2883
|
declare const LineToolSettingsSchema: z.ZodObject<{
|
|
2871
2884
|
color: z.ZodString;
|
package/handler.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
|
-
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-
|
|
2
|
+
import { J as zInfer, E as Element, G as Geometry, b as ElementGroup, d as ElementChangeCallbackParams, e as ElementGroupChangeCallbackParams, M as MapInteractionEvent, L as Layer, j as LayerGroup, n as LegendItem, q as LayerFilters, s as Feature, u as GetLayerCategoriesGroup, w as GetLayerHistogramBin, A as AggregationMethod, i as LayerChangeCallbackParams, l as LayerGroupChangeCallbackParams, p as LegendItemChangeCallbackParams, ao as FilterTernary, y as MapDetails, z as EntityNode, T as ToolType, D as ToolSettingsMap, H as ToolSettingsChangeEvent, V as ViewportState, O as ViewportConstraints, aS as UnionToIntersection, aT as PromiseOrNot } from './types-BXCTpxot.js';
|
|
3
3
|
|
|
4
4
|
type Method<TRequest extends {
|
|
5
5
|
type: string;
|
|
@@ -1888,6 +1888,29 @@ declare const SetFiltersMessage: z.ZodObject<{
|
|
|
1888
1888
|
};
|
|
1889
1889
|
type: "setLayerFilters";
|
|
1890
1890
|
}>;
|
|
1891
|
+
declare const OnLayerFiltersChangeMessage: z.ZodObject<{
|
|
1892
|
+
eventName: z.ZodLiteral<"onLayerFiltersChange">;
|
|
1893
|
+
id: z.ZodString;
|
|
1894
|
+
options: z.ZodObject<{
|
|
1895
|
+
layerId: z.ZodString;
|
|
1896
|
+
}, "strip", z.ZodTypeAny, {
|
|
1897
|
+
layerId: string;
|
|
1898
|
+
}, {
|
|
1899
|
+
layerId: string;
|
|
1900
|
+
}>;
|
|
1901
|
+
}, "strict", z.ZodTypeAny, {
|
|
1902
|
+
options: {
|
|
1903
|
+
layerId: string;
|
|
1904
|
+
};
|
|
1905
|
+
id: string;
|
|
1906
|
+
eventName: "onLayerFiltersChange";
|
|
1907
|
+
}, {
|
|
1908
|
+
options: {
|
|
1909
|
+
layerId: string;
|
|
1910
|
+
};
|
|
1911
|
+
id: string;
|
|
1912
|
+
eventName: "onLayerFiltersChange";
|
|
1913
|
+
}>;
|
|
1891
1914
|
declare const GetRenderedFeaturesMessage: z.ZodObject<{
|
|
1892
1915
|
type: z.ZodLiteral<"getRenderedFeatures">;
|
|
1893
1916
|
params: z.ZodOptional<z.ZodObject<{
|
|
@@ -2408,6 +2431,7 @@ type LayersSchema = {
|
|
|
2408
2431
|
onLayerChange: Listener<zInfer<typeof OnLayerChangeMessage.shape.options>, LayerChangeCallbackParams>;
|
|
2409
2432
|
onLayerGroupChange: Listener<zInfer<typeof OnLayerGroupChangeMessage.shape.options>, LayerGroupChangeCallbackParams>;
|
|
2410
2433
|
onLegendItemChange: Listener<zInfer<typeof OnLegendItemChangeMessage.shape.options>, LegendItemChangeCallbackParams>;
|
|
2434
|
+
onLayerFiltersChange: Listener<zInfer<typeof OnLayerFiltersChangeMessage.shape.options>, LayerFilters>;
|
|
2411
2435
|
};
|
|
2412
2436
|
};
|
|
2413
2437
|
|
|
@@ -2551,6 +2575,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2551
2575
|
symbol: z.ZodOptional<z.ZodString>;
|
|
2552
2576
|
color: z.ZodOptional<z.ZodString>;
|
|
2553
2577
|
frame: z.ZodOptional<z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>>;
|
|
2578
|
+
afterCreation: z.ZodOptional<z.ZodEnum<["enter name", "add another", "select"]>>;
|
|
2554
2579
|
}, {
|
|
2555
2580
|
tool: z.ZodLiteral<"pin">;
|
|
2556
2581
|
}>, "strip", z.ZodTypeAny, {
|
|
@@ -2558,11 +2583,13 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2558
2583
|
symbol?: string | undefined;
|
|
2559
2584
|
color?: string | undefined;
|
|
2560
2585
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2586
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2561
2587
|
}, {
|
|
2562
2588
|
tool: "pin";
|
|
2563
2589
|
symbol?: string | undefined;
|
|
2564
2590
|
color?: string | undefined;
|
|
2565
2591
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2592
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2566
2593
|
}>, z.ZodObject<z.objectUtil.extendShape<{
|
|
2567
2594
|
color: z.ZodOptional<z.ZodString>;
|
|
2568
2595
|
strokeOpacity: z.ZodOptional<z.ZodNumber>;
|
|
@@ -2734,6 +2761,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2734
2761
|
symbol?: string | undefined;
|
|
2735
2762
|
color?: string | undefined;
|
|
2736
2763
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2764
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2737
2765
|
} | {
|
|
2738
2766
|
tool: "line";
|
|
2739
2767
|
color?: string | undefined;
|
|
@@ -2794,6 +2822,7 @@ declare const SetToolSettingsMessage: z.ZodObject<{
|
|
|
2794
2822
|
symbol?: string | undefined;
|
|
2795
2823
|
color?: string | undefined;
|
|
2796
2824
|
frame?: "frame-circle" | "frame-square" | null | undefined;
|
|
2825
|
+
afterCreation?: "enter name" | "add another" | "select" | undefined;
|
|
2797
2826
|
} | {
|
|
2798
2827
|
tool: "line";
|
|
2799
2828
|
color?: string | undefined;
|
package/handler.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,s)=>{for(var E in s)Z(r,E,{get:s[E],enumerable:!0})},st=(r,s,E,F)=>{if(s&&typeof s=="object"||typeof s=="function")for(let L of nt(s))!at.call(r,L)&&L!==E&&Z(r,L,{get:()=>s[L],enumerable:!(F=rt(s,L))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var er={};it(er,{createMessageHandler:()=>Ko});module.exports=lt(er);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,s){return f.z.strictObject({type:f.z.literal(r),params:s})}function C(r,s){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:s})}function l(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:I}),de=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),pt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(pt.shape.coordinates)}),ye=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),mt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:mt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),J=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),S={type:!0,coordinates:!0},x={id:!0},ee=he.partial().required(S).omit(x),j=K.partial().required(S).omit(x),te=_.partial().required(S).omit(x),oe=fe.partial().required(S).required({radius:!0}).omit(x),re=Q.partial().required(S).omit(x),ne=$.partial().required(S).omit(x),ae=J.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),ie=X.partial().required(S).required({text:!0}).omit(x).omit({coordinates:!0,name:!0}),dt=Y.partial().required(S).required({imageUrl:!0}).omit(x),Me=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,dt,ae,ie]);var ir=K.omit({coordinates:!0}),sr=_.omit({coordinates:!0});var lr=Q.omit({coordinates:!0}),pr=$.omit({coordinates:!0}),mr=J.omit({coordinates:!0}),cr=X.omit({coordinates:!0}),gr=Y.omit({coordinates:!0}),dr=gt.omit({coordinates:!0}),M={type:!0,id:!0},yt=he.partial().required(M),ut=K.partial().required(M),ht=_.partial().required(M),ft=fe.partial().required(M),St=Q.partial().required(M),xt=$.partial().required(M),Mt=J.partial().required(M).omit({coordinates:!0,name:!0}),bt=X.partial().required(M).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(M),be=e.z.discriminatedUnion("type",[yt,ut,ht,ft,St,xt,Mt,bt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",y.z.string()),It=t("getElementGeometry",y.z.string()),Gt=t("getElements",Le.optional()),Et=t("getElementGroup",y.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=C("onElementChange",y.z.object({id:y.z.string()})),Ft=l("onElementCreate"),kt=l("onElementCreateEnd"),wt=C("onElementDelete",y.z.object({id:y.z.string()})),vt=C("onElementGroupChange",y.z.object({id:y.z.string()})),Vt=t("createElement",Me),Ot=t("updateElement",be),Ut=t("deleteElement",y.z.string()),Ie={methods:[Ct,It,Gt,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,wt,vt]};var Rt=l("onPointerClick"),Nt=l("onPointerMove"),Ge={methods:null,listeners:[Rt,Nt]};var p=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),qt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),br=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),At=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,qt,Ee]),se=n.z.union([At,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,de,o.z.array(I)]),Pe=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Gr=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Wt=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Zt,Wt,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Er=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:Dt});var i=require("zod");var Pr=i.z.enum(["processing","completed","failed","incomplete"]),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),Ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),Oe=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ue=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Kt=t("getLayer",p.z.string()),_t=t("getLayers",ve.optional()),Qt=t("setLayerVisibility",z),$t=C("onLayerChange",p.z.object({id:p.z.string()})),Jt=t("setLayerStyle",p.z.object({id:p.z.string(),style:p.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",p.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=C("onLayerGroupChange",p.z.object({id:p.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=C("onLegendItemChange",k),so=t("setLegendItemVisibility",p.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",p.z.string()),po=t("setLayerFilters",p.z.object({layerId:p.z.string(),filters:P,note:p.z.string().optional()})),mo=t("getRenderedFeatures",Ue.optional()),co=t("getCategoryData",Fe),go=t("getHistogramData",ke),yo=t("getAggregates",we),Re={methods:[Kt,_t,Qt,Jt,Xt,Yt,eo,to,oo,no,ao,so,lo,po,mo,co,go,yo],listeners:[$t,ro,io]};var Ne=require("zod");var uo=t("getMapDetails",Ne.z.undefined()),je={methods:[uo],listeners:[]};var v=require("zod");var b=require("zod"),qe=b.z.object({id:b.z.string().or(b.z.number()),layerId:b.z.string(),showPopup:b.z.boolean().optional(),fitViewport:b.z.boolean().or(b.z.object({maxZoom:b.z.number()})).optional()});var ho=t("getSelection",v.z.undefined()),fo=l("onSelectionChange"),So=t("selectFeature",qe),xo=t("clearSelection",v.z.object({features:v.z.boolean().optional(),elements:v.z.boolean().optional()}).optional()),Ae={methods:[ho,So,xo],listeners:[fo]};var We=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=m.z.enum([...He,"link"]),De=m.z.enum(He),Mo=ee.pick({color:!0,symbol:!0,frame:!0}).required(),bo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Lo=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Co=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Io=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Go=re.pick({color:!0,opacity:!0,size:!0}).required(),Eo=ne.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),To=ae.pick({color:!0,align:!0,style:!0}).required(),zo=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[Mo.partial().extend({tool:m.z.literal("pin")}),bo.partial().extend({tool:m.z.literal("line")}),Lo.partial().extend({tool:m.z.literal("route")}),Co.partial().extend({tool:m.z.literal("polygon")}),Io.partial().extend({tool:m.z.literal("circle")}),Go.partial().extend({tool:m.z.literal("marker")}),Eo.partial().extend({tool:m.z.literal("highlighter")}),To.partial().extend({tool:m.z.literal("text")}),zo.partial().extend({tool:m.z.literal("note")})]);var Po=t("setTool",Be.nullable()),Fo=t("getTool",We.z.undefined()),ko=l("onToolChange"),wo=t("setToolSettings",Ze),vo=t("getToolSettings",De),Vo=l("onToolSettingsChange"),Ke={methods:[Po,Fo,wo,vo],listeners:[ko,Vo]};var A=require("zod");var c=require("zod"),_e=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Qe=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Oo=t("updateUiControls",_e),Uo=t("setOnMapInteractionsUi",Qe),Ro=t("showLayerDataTable",A.z.object({layerId:A.z.string(),sorting:ue.optional()}).optional()),No=t("hideLayerDataTable",A.z.undefined()),$e={methods:[Oo,Uo,Ro,No],listeners:null};var pe=require("zod");var V=require("zod");var H=V.z.object({center:R,zoom:ye}),Je=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var jo=t("getViewport",pe.z.undefined()),qo=t("setViewport",Je),Ao=t("getViewportConstraints",pe.z.undefined()),Ho=t("setViewportConstraints",Xe),Bo=t("fitViewportToBounds",Ye),Do=l("onViewportMove"),Zo=l("onViewportMoveEnd"),Wo=l("onMapIdle"),et={methods:[qo,jo,Ao,Ho,Bo],listeners:[Do,Zo,Wo]};var me=[$e,et,Re,Ie,Ae,Ge,Ke,je];function Ko(r,s,E){let F=new Map;async function L(h){if(!Yo.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ce;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let w="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=s.listeners[d.event.eventName](w);F.set(d.event.id,B)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let w=s.methods[d.type],B=await w(d.params);h.ports[0]?.postMessage(B)}catch(w){h.ports[0]?.postMessage({__error__:_o(w)})}}return r.addEventListener("message",L),()=>{r.removeEventListener("message",L)}}function _o(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:me.map(r=>r.methods??[]).flat(),listeners:me.map(r=>r.listeners??[]).flat()},Qo=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),$o=g.z.strictObject({type:g.z.literal("felt.addListener"),event:Qo}),Jo=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Xo=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[Xo,$o,Jo,...tt.methods]),Yo=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
|
1
|
+
"use strict";var Z=Object.defineProperty;var rt=Object.getOwnPropertyDescriptor;var nt=Object.getOwnPropertyNames;var at=Object.prototype.hasOwnProperty;var it=(r,l)=>{for(var E in l)Z(r,E,{get:l[E],enumerable:!0})},st=(r,l,E,F)=>{if(l&&typeof l=="object"||typeof l=="function")for(let C of nt(l))!at.call(r,C)&&C!==E&&Z(r,C,{get:()=>l[C],enumerable:!(F=rt(l,C))||F.enumerable});return r};var lt=r=>st(Z({},"__esModule",{value:!0}),r);var tr={};it(tr,{createMessageHandler:()=>_o});module.exports=lt(tr);var g=require("zod");var y=require("zod");var f=require("zod");function t(r,l){return f.z.strictObject({type:f.z.literal(r),params:l})}function S(r,l){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string(),options:l})}function p(r){return f.z.strictObject({eventName:f.z.literal(r),id:f.z.string()})}var a=require("zod"),O=a.z.number(),U=a.z.number(),R=a.z.object({latitude:U,longitude:O}),I=a.z.tuple([O,U]),ge=a.z.object({type:a.z.literal("Point"),coordinates:I}),de=a.z.object({type:a.z.literal("Polygon"),coordinates:a.z.array(a.z.array(I))}),pt=a.z.object({type:a.z.literal("LineString"),coordinates:a.z.array(I)}),G=a.z.object({type:a.z.literal("MultiLineString"),coordinates:a.z.array(pt.shape.coordinates)}),ye=a.z.number().min(1).max(23),T=a.z.tuple([O,U,O,U]),z=a.z.object({show:a.z.array(a.z.string()).optional(),hide:a.z.array(a.z.string()).optional()}),mt=a.z.enum(["asc","desc"]),ue=a.z.object({attribute:a.z.string(),direction:mt});var e=require("zod");var u=e.z.object({id:e.z.string(),groupId:e.z.string().nullable(),color:e.z.string(),name:e.z.union([e.z.string(),e.z.null()]),description:e.z.union([e.z.string(),e.z.null()]),attributes:e.z.record(e.z.string(),e.z.unknown())}),N=e.z.object({imageUrl:e.z.string().nullable()}),W=e.z.object({strokeOpacity:e.z.number(),strokeWidth:e.z.number(),strokeStyle:e.z.enum(["solid","dashed","dotted"])}),ct=e.z.enum(["meter","kilometer","foot","mile"]),he=u.extend(N.shape).extend({type:e.z.literal("Place"),coordinates:ge.shape.coordinates,symbol:e.z.string(),frame:e.z.enum(["frame-circle","frame-square"]).nullable(),hideLabel:e.z.boolean()}),K=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Path"),coordinates:G.shape.coordinates,distanceMarker:e.z.boolean(),endCaps:e.z.boolean(),routingMode:e.z.enum(["driving","cycling","walking","flying"]).nullable()}),_=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Polygon"),coordinates:G.shape.coordinates,fillOpacity:e.z.number().min(0).max(1),areaMarker:e.z.boolean()}),fe=u.extend(N.shape).extend(W.shape).extend({type:e.z.literal("Circle"),coordinates:I,radius:e.z.number(),radiusDisplayAngle:e.z.number(),radiusDisplayUnit:ct.nullable(),fillOpacity:e.z.number().min(0).max(1),radiusMarker:e.z.boolean()}),Q=u.extend({type:e.z.literal("Marker"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1),size:e.z.number().min(0).max(100),zoom:e.z.number().min(0).max(23)}),$=u.extend({type:e.z.literal("Highlighter"),coordinates:G.shape.coordinates,opacity:e.z.number().min(0).max(1)}),Se=e.z.object({position:I,rotation:e.z.number(),scale:e.z.number(),zoom:e.z.number().min(0).max(23),coordinates:G.shape.coordinates}),xe=e.z.object({text:e.z.string(),align:e.z.enum(["left","center","right"]),style:e.z.enum(["italic","light","regular","caps"]),name:e.z.string()}),J=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Text")}),X=u.extend(Se.shape).extend(xe.shape).extend({type:e.z.literal("Note"),widthScale:e.z.number().min(0)}),Y=u.extend({type:e.z.literal("Image"),coordinates:G.shape.coordinates,imageUrl:e.z.string(),opacity:e.z.number().min(0).max(1)}).omit({color:!0}),gt=u.extend({type:e.z.literal("Link"),coordinates:G.shape.coordinates,url:e.z.string()}),x={type:!0,coordinates:!0},M={id:!0},ee=he.partial().required(x).omit(M),j=K.partial().required(x).omit(M),te=_.partial().required(x).omit(M),oe=fe.partial().required(x).required({radius:!0}).omit(M),re=Q.partial().required(x).omit(M),ne=$.partial().required(x).omit(M),ae=J.partial().required(x).required({text:!0}).omit(M).omit({coordinates:!0,name:!0}),ie=X.partial().required(x).required({text:!0}).omit(M).omit({coordinates:!0,name:!0}),dt=Y.partial().required(x).required({imageUrl:!0}).omit(M),Me=e.z.discriminatedUnion("type",[ee,j,te,oe,re,ne,dt,ae,ie]);var sr=K.omit({coordinates:!0}),lr=_.omit({coordinates:!0});var pr=Q.omit({coordinates:!0}),mr=$.omit({coordinates:!0}),cr=J.omit({coordinates:!0}),gr=X.omit({coordinates:!0}),dr=Y.omit({coordinates:!0}),yr=gt.omit({coordinates:!0}),b={type:!0,id:!0},yt=he.partial().required(b),ut=K.partial().required(b),ht=_.partial().required(b),ft=fe.partial().required(b),St=Q.partial().required(b),xt=$.partial().required(b),Mt=J.partial().required(b).omit({coordinates:!0,name:!0}),bt=X.partial().required(b).omit({coordinates:!0,name:!0}),Lt=Y.partial().required(b),be=e.z.discriminatedUnion("type",[yt,ut,ht,ft,St,xt,Mt,bt,Lt]),Le=e.z.object({ids:e.z.array(e.z.string()).optional()}),Ce=e.z.object({ids:e.z.array(e.z.string()).optional()});var Ct=t("getElement",y.z.string()),It=t("getElementGeometry",y.z.string()),Gt=t("getElements",Le.optional()),Et=t("getElementGroup",y.z.string()),Tt=t("getElementGroups",Ce.optional()),zt=t("setElementGroupVisibility",z),Pt=S("onElementChange",y.z.object({id:y.z.string()})),Ft=p("onElementCreate"),kt=p("onElementCreateEnd"),wt=S("onElementDelete",y.z.object({id:y.z.string()})),vt=S("onElementGroupChange",y.z.object({id:y.z.string()})),Vt=t("createElement",Me),Ot=t("updateElement",be),Ut=t("deleteElement",y.z.string()),Ie={methods:[Ct,It,Gt,Et,Tt,zt,Vt,Ot,Ut],listeners:[Pt,Ft,kt,wt,vt]};var Rt=p("onPointerClick"),Nt=p("onPointerMove"),Ge={methods:null,listeners:[Rt,Nt]};var s=require("zod");var n=require("zod"),jt=n.z.enum(["in","ni"]),qt=n.z.enum(["lt","gt","le","ge","eq","ne","cn","nc","is","isnt"]),Lr=n.z.enum(["and","or"]),Ee=n.z.union([n.z.number(),n.z.string(),n.z.boolean(),n.z.null()]),Te=n.z.string().or(n.z.null()),At=n.z.tuple([Te,jt,n.z.array(Ee).or(n.z.null())]),Ht=n.z.tuple([Te,qt,Ee]),se=n.z.union([At,Ht]),le=n.z.tuple([n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()])),n.z.enum(["and","or"]),n.z.lazy(()=>n.z.union([le,se,n.z.null(),n.z.boolean()]))]),P=n.z.union([le,se,n.z.null(),n.z.boolean()]);var o=require("zod");var ze=o.z.enum(["avg","max","min","sum","median"]),Bt=o.z.object({method:ze,attribute:o.z.string()}),Dt=o.z.object({methods:o.z.array(o.z.union([ze,o.z.literal("count")])),attribute:o.z.string().optional()}),q=o.z.union([T,de,o.z.array(I)]),Pe=o.z.object({boundary:q.optional(),filters:P.optional(),aggregation:Bt.optional()}),Fe=o.z.object({layerId:o.z.string(),attribute:o.z.string(),limit:o.z.number().optional(),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Er=o.z.object({key:o.z.union([o.z.number(),o.z.string(),o.z.boolean()]),value:o.z.number().nullable()}),Zt=o.z.object({type:o.z.literal("equal-intervals"),count:o.z.number()}),Wt=o.z.object({type:o.z.literal("time-interval"),interval:o.z.enum(["hour","day","week","month","year"])}),ke=o.z.object({layerId:o.z.string(),attribute:o.z.string(),steps:o.z.union([Zt,Wt,o.z.array(o.z.number())]),boundary:q.optional(),filters:P.optional(),values:Pe.optional()}),Tr=o.z.object({min:o.z.number(),max:o.z.number(),value:o.z.number()}),we=o.z.object({layerId:o.z.string(),boundary:q.optional(),filters:P.optional(),aggregation:Dt});var i=require("zod");var Fr=i.z.enum(["processing","completed","failed","incomplete"]),ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),Ve=i.z.object({ids:i.z.array(i.z.string()).optional()}),k=i.z.object({id:i.z.string(),layerId:i.z.string()}),Oe=i.z.object({ids:k.array().optional(),layerIds:i.z.string().array().optional()}),Ue=i.z.object({layerIds:i.z.array(i.z.string()).optional(),areaQuery:i.z.union([i.z.object({coordinates:R}),i.z.object({boundary:T})]).optional()});var Kt=t("getLayer",s.z.string()),_t=t("getLayers",ve.optional()),Qt=t("setLayerVisibility",z),$t=S("onLayerChange",s.z.object({id:s.z.string()})),Jt=t("setLayerStyle",s.z.object({id:s.z.string(),style:s.z.object({}).passthrough()})),Xt=t("setLayerLegendVisibility",z),Yt=t("getLayerGroup",s.z.string()),eo=t("getLayerGroups",Ve.optional()),to=t("setLayerGroupVisibility",z),oo=t("setLayerGroupLegendVisibility",z),ro=S("onLayerGroupChange",s.z.object({id:s.z.string()})),no=t("getLegendItem",k),ao=t("getLegendItems",Oe.optional()),io=S("onLegendItemChange",k),so=t("setLegendItemVisibility",s.z.object({show:k.array().optional(),hide:k.array().optional()})),lo=t("getLayerFilters",s.z.string()),po=t("setLayerFilters",s.z.object({layerId:s.z.string(),filters:P,note:s.z.string().optional()})),mo=S("onLayerFiltersChange",s.z.object({layerId:s.z.string()})),co=t("getRenderedFeatures",Ue.optional()),go=t("getCategoryData",Fe),yo=t("getHistogramData",ke),uo=t("getAggregates",we),Re={methods:[Kt,_t,Qt,Jt,Xt,Yt,eo,to,oo,no,ao,so,lo,po,co,go,yo,uo],listeners:[$t,ro,io,mo]};var Ne=require("zod");var ho=t("getMapDetails",Ne.z.undefined()),je={methods:[ho],listeners:[]};var v=require("zod");var L=require("zod"),qe=L.z.object({id:L.z.string().or(L.z.number()),layerId:L.z.string(),showPopup:L.z.boolean().optional(),fitViewport:L.z.boolean().or(L.z.object({maxZoom:L.z.number()})).optional()});var fo=t("getSelection",v.z.undefined()),So=p("onSelectionChange"),xo=t("selectFeature",qe),Mo=t("clearSelection",v.z.object({features:v.z.boolean().optional(),elements:v.z.boolean().optional()}).optional()),Ae={methods:[fo,xo,Mo],listeners:[So]};var We=require("zod");var m=require("zod");var He=["pin","line","route","polygon","circle","marker","highlighter","text","note"],Be=m.z.enum([...He,"link"]),De=m.z.enum(He),bo=ee.pick({color:!0,symbol:!0,frame:!0}).extend({afterCreation:m.z.enum(["enter name","add another","select"])}).required(),Lo=j.pick({color:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0}).required(),Co=j.pick({color:!0,routingMode:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,distanceMarker:!0,endCaps:!0}).required(),Io=te.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,areaMarker:!0}).required(),Go=oe.pick({color:!0,fillOpacity:!0,strokeOpacity:!0,strokeWidth:!0,strokeStyle:!0,radiusMarker:!0}).required(),Eo=re.pick({color:!0,opacity:!0,size:!0}).required(),To=ne.pick({color:!0,opacity:!0}).extend({size:m.z.number().min(0).max(200)}).required(),zo=ae.pick({color:!0,align:!0,style:!0}).required(),Po=ie.pick({color:!0,align:!0,style:!0}).required(),Ze=m.z.discriminatedUnion("tool",[bo.partial().extend({tool:m.z.literal("pin")}),Lo.partial().extend({tool:m.z.literal("line")}),Co.partial().extend({tool:m.z.literal("route")}),Io.partial().extend({tool:m.z.literal("polygon")}),Go.partial().extend({tool:m.z.literal("circle")}),Eo.partial().extend({tool:m.z.literal("marker")}),To.partial().extend({tool:m.z.literal("highlighter")}),zo.partial().extend({tool:m.z.literal("text")}),Po.partial().extend({tool:m.z.literal("note")})]);var Fo=t("setTool",Be.nullable()),ko=t("getTool",We.z.undefined()),wo=p("onToolChange"),vo=t("setToolSettings",Ze),Vo=t("getToolSettings",De),Oo=p("onToolSettingsChange"),Ke={methods:[Fo,ko,vo,Vo],listeners:[wo,Oo]};var A=require("zod");var c=require("zod"),_e=c.z.object({showLegend:c.z.boolean().optional(),cooperativeGestures:c.z.boolean().optional(),fullScreenButton:c.z.boolean().optional(),geolocation:c.z.boolean().optional(),zoomControls:c.z.boolean().optional(),scaleBar:c.z.boolean().optional()}),Qe=c.z.object({featureSelectPanel:c.z.boolean().optional(),featureHoverPanel:c.z.boolean().optional(),elementSelectPanel:c.z.boolean().optional(),linkClickOpen:c.z.boolean().optional(),imageLightboxOpen:c.z.boolean().optional()});var Uo=t("updateUiControls",_e),Ro=t("setOnMapInteractionsUi",Qe),No=t("showLayerDataTable",A.z.object({layerId:A.z.string(),sorting:ue.optional()}).optional()),jo=t("hideLayerDataTable",A.z.undefined()),$e={methods:[Uo,Ro,No,jo],listeners:null};var pe=require("zod");var V=require("zod");var H=V.z.object({center:R,zoom:ye}),Je=V.z.object({center:H.shape.center.optional(),zoom:H.shape.zoom.optional()}),Xe=V.z.object({minZoom:H.shape.zoom.nullish(),maxZoom:H.shape.zoom.nullish(),bounds:T.nullish()}).nullable(),Ye=V.z.object({bounds:T});var qo=t("getViewport",pe.z.undefined()),Ao=t("setViewport",Je),Ho=t("getViewportConstraints",pe.z.undefined()),Bo=t("setViewportConstraints",Xe),Do=t("fitViewportToBounds",Ye),Zo=p("onViewportMove"),Wo=p("onViewportMoveEnd"),Ko=p("onMapIdle"),et={methods:[Ao,qo,Ho,Bo,Do],listeners:[Zo,Wo,Ko]};var me=[$e,et,Re,Ie,Ae,Ge,Ke,je];function _o(r,l,E){let F=new Map;async function C(h){if(!er.safeParse(h.data).success){E?.onUnknownMessage?.(h.data);return}let ce=ot.safeParse(h.data);if(!ce.success){E?.onInvalidMessage?.(h.data);return}let{data:d}=ce;if(d.type==="felt.ready")h.ports[0]?.postMessage(!0);else if(d.type==="felt.addListener"){if(d.event.eventName==="")throw new Error("felt.addListener eventName cannot be empty");let w="options"in d.event?{options:"options"in d.event?d.event.options:void 0,handler:D=>{h.ports[0]?.postMessage(D)}}:{handler:D=>{h.ports[0]?.postMessage(D)}},B=l.listeners[d.event.eventName](w);F.set(d.event.id,B)}else if(d.type==="felt.removeListener")F.get(d.id)?.(),F.delete(d.id);else try{let w=l.methods[d.type],B=await w(d.params);h.ports[0]?.postMessage(B)}catch(w){h.ports[0]?.postMessage({__error__:Qo(w)})}}return r.addEventListener("message",C),()=>{r.removeEventListener("message",C)}}function Qo(r){return r instanceof Error?r.message:typeof r=="object"&&r!==null&&"message"in r?String(r.message):typeof r=="string"?r:"Unknown error"}var tt={methods:me.map(r=>r.methods??[]).flat(),listeners:me.map(r=>r.listeners??[]).flat()},$o=g.z.discriminatedUnion("eventName",[g.z.strictObject({eventName:g.z.literal("")}),...tt.listeners]),Jo=g.z.strictObject({type:g.z.literal("felt.addListener"),event:$o}),Xo=g.z.strictObject({type:g.z.literal("felt.removeListener"),id:g.z.string()}),Yo=g.z.strictObject({type:g.z.literal("felt.ready")}),ot=g.z.discriminatedUnion("type",[Yo,Jo,Xo,...tt.methods]),er=g.z.object({type:g.z.enum(ot.options.map(r=>r.shape.type.value))});0&&(module.exports={createMessageHandler});
|
package/package.json
CHANGED
|
@@ -2855,17 +2855,30 @@ declare const PinToolSettingsSchema: z.ZodObject<{
|
|
|
2855
2855
|
symbol: z.ZodString;
|
|
2856
2856
|
color: z.ZodString;
|
|
2857
2857
|
frame: z.ZodNullable<z.ZodEnum<["frame-circle", "frame-square"]>>;
|
|
2858
|
+
afterCreation: z.ZodEnum<["enter name", "add another", "select"]>;
|
|
2858
2859
|
}, "strip", z.ZodTypeAny, {
|
|
2859
2860
|
symbol: string;
|
|
2860
2861
|
color: string;
|
|
2861
2862
|
frame: "frame-circle" | "frame-square" | null;
|
|
2863
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2862
2864
|
}, {
|
|
2863
2865
|
symbol: string;
|
|
2864
2866
|
color: string;
|
|
2865
2867
|
frame: "frame-circle" | "frame-square" | null;
|
|
2868
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2866
2869
|
}>;
|
|
2867
2870
|
interface PinToolSettings extends zInfer<typeof PinToolSettingsSchema> {
|
|
2868
2871
|
symbol: PlaceSymbol;
|
|
2872
|
+
/**
|
|
2873
|
+
* What to do after creating the Place element.
|
|
2874
|
+
*
|
|
2875
|
+
* - `"enter name"`: Enter a name for the Place, focusing the name input.
|
|
2876
|
+
* - `"add another"`: Add another Place, leaving the tool still selected.
|
|
2877
|
+
* - `"none"`: Puts the tool down and selects the new Place element.
|
|
2878
|
+
*
|
|
2879
|
+
* @defaultValue `"enter name"`
|
|
2880
|
+
*/
|
|
2881
|
+
afterCreation: "enter name" | "add another" | "select";
|
|
2869
2882
|
}
|
|
2870
2883
|
declare const LineToolSettingsSchema: z.ZodObject<{
|
|
2871
2884
|
color: z.ZodString;
|