maplibre-gl-components 0.20.6 → 0.22.0
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/README.md +47 -1
- package/dist/ControlGrid-BBOB4hcq.cjs +16851 -0
- package/dist/ControlGrid-CXnEfoxn.js +102866 -0
- package/dist/{DuckDBConverter-G6cWy2IS.js → DuckDBConverter-BmkTmy9v.js} +27 -27
- package/dist/{DuckDBConverter-4zGbThM1.cjs → DuckDBConverter-CY3p1iVn.cjs} +1 -1
- package/dist/{ShapefileConverter-BefhyBOj.js → ShapefileConverter-Bgv06LK7.js} +1 -1
- package/dist/{ShapefileConverter-Dk_BW4ca.cjs → ShapefileConverter-D3wQtYHO.cjs} +1 -1
- package/dist/{geotiff-BsSRJ-4E.js → geotiff-BFWKZ7Ej.js} +10 -11
- package/dist/{geotiff-GFm9cPD1.cjs → geotiff-DvXk5w3O.cjs} +2 -2
- package/dist/{globals-BKIWameS.js → globals-Da065JQj.js} +55 -33
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +138 -136
- package/dist/{lerc-IUhdhKhj.js → lerc-CwzT0cMz.js} +9 -10
- package/dist/{lerc-CPfGdIIh.cjs → lerc-cUMeQO-8.cjs} +1 -1
- package/dist/{maplibre-geoman.es-BC6M2gop.cjs → maplibre-geoman.es-DqoIAudd.cjs} +1 -1
- package/dist/maplibre-gl-components.css +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.mjs +10 -10
- package/dist/types/lib/core/BookmarkControl.d.ts +34 -1
- package/dist/types/lib/core/BookmarkControl.d.ts.map +1 -1
- package/dist/types/lib/core/types.d.ts +46 -1
- package/dist/types/lib/core/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/dist/ControlGrid-BmxIgQg5.js +0 -150653
- package/dist/ControlGrid-ChGLgBGL.cjs +0 -17280
package/dist/react.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./ControlGrid-ChGLgBGL.cjs");let r=require("react");function L({map:u,onStateChange:o,position:a="bottom-right",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Colorbar({position:a,...e});return l.current=c,o&&(c.on("update",s=>{o(s.state)}),c.on("show",s=>{o(s.state)}),c.on("hide",s=>{o(s.state)})),u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.colormap,e.colorbars,e.colorStops,e.vmin,e.vmax,e.label,e.units,e.visible,e.orientation,e.barThickness,e.barLength,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function M({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Legend({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("collapse",s),c.on("expand",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.items,e.legends,e.title,e.visible,e.collapsed,e.collapsible,e.width,e.maxHeight,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.swatchSize,e.minzoom,e.maxzoom]),null}function O({map:u,onStateChange:o,position:a="top-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.HtmlControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{l.current&&e.html!==void 0&&l.current.setHtml(e.html)},[e.html]),(0,r.useEffect)(()=>{if(l.current){const c={};e.htmls!==void 0&&(c.htmls=e.htmls),e.visible!==void 0&&(c.visible=e.visible),e.title!==void 0&&(c.title=e.title),e.collapsible!==void 0&&(c.collapsible=e.collapsible),e.collapsed!==void 0&&(c.collapsed=e.collapsed),e.backgroundColor!==void 0&&(c.backgroundColor=e.backgroundColor),e.padding!==void 0&&(c.padding=e.padding),e.borderRadius!==void 0&&(c.borderRadius=e.borderRadius),e.opacity!==void 0&&(c.opacity=e.opacity),e.maxWidth!==void 0&&(c.maxWidth=e.maxWidth),e.maxHeight!==void 0&&(c.maxHeight=e.maxHeight),e.fontSize!==void 0&&(c.fontSize=e.fontSize),e.fontColor!==void 0&&(c.fontColor=e.fontColor),e.minzoom!==void 0&&(c.minzoom=e.minzoom),e.maxzoom!==void 0&&(c.maxzoom=e.maxzoom),Object.keys(c).length>0&&l.current.update(c)}},[e.visible,e.htmls,e.title,e.collapsible,e.collapsed,e.backgroundColor,e.padding,e.borderRadius,e.opacity,e.maxWidth,e.maxHeight,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function S({map:u,onBasemapChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.BasemapControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("collapse",t),s.on("expand",t)}if(o){const t=d=>{d.basemap&&o(d.basemap)};s.on("basemapchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.basemaps,l.defaultBasemap,l.visible,l.collapsed,l.collapsible,l.displayMode,l.showSearch,l.filterGroups,l.excludeGroups,l.excludeBroken,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.maxWidth,l.maxHeight,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function j({map:u,onTerrainChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.TerrainControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t)}if(o){const t=d=>{o(d.state.enabled)};s.on("terrainchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.enabled,l.exaggeration,l.hillshade,l.hillshadeExaggeration,l.visible,l.backgroundColor,l.borderRadius,l.opacity,l.minzoom,l.maxzoom]),null}function A({map:u,onResultSelect:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.SearchControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t),s.on("search",t),s.on("clear",t)}return o&&s.on("resultselect",t=>{t.result&&o(t.result)}),u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,e,a,o]),(0,r.useEffect)(()=>{if(c.current){const s={};l.visible!==void 0&&(s.visible=l.visible),l.collapsed!==void 0&&(s.collapsed=l.collapsed),l.placeholder!==void 0&&(s.placeholder=l.placeholder),l.maxResults!==void 0&&(s.maxResults=l.maxResults),l.flyToZoom!==void 0&&(s.flyToZoom=l.flyToZoom),l.showMarker!==void 0&&(s.showMarker=l.showMarker),l.markerColor!==void 0&&(s.markerColor=l.markerColor),l.backgroundColor!==void 0&&(s.backgroundColor=l.backgroundColor),l.borderRadius!==void 0&&(s.borderRadius=l.borderRadius),l.opacity!==void 0&&(s.opacity=l.opacity),l.width!==void 0&&(s.width=l.width),l.fontSize!==void 0&&(s.fontSize=l.fontSize),l.fontColor!==void 0&&(s.fontColor=l.fontColor),l.minzoom!==void 0&&(s.minzoom=l.minzoom),l.maxzoom!==void 0&&(s.maxzoom=l.maxzoom),Object.keys(s).length>0&&c.current.update(s)}},[l.visible,l.collapsed,l.placeholder,l.maxResults,l.flyToZoom,l.showMarker,l.markerColor,l.backgroundColor,l.borderRadius,l.opacity,l.width,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function B({map:u,onDatasetLoad:o,onError:a,onStateChange:e,position:l="top-right",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.VectorDatasetControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d)}if(o){const d=i=>{i.dataset&&o(i.dataset)};t.on("load",d)}if(a){const d=i=>{i.error&&a(i.error,i.filename)};t.on("error",d)}return u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u]),(0,r.useEffect)(()=>{if(s.current){const t=Object.fromEntries(Object.entries(c).filter(([,d])=>d!==void 0));Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.showDropZone,c.fitBounds,c.fitBoundsPadding,c.backgroundColor,c.borderRadius,c.opacity,c.minzoom,c.maxzoom]),null}function D({map:u,onFeatureSelect:o,onInspect:a,onToggle:e,onStateChange:l,position:c="top-right",...s}){const t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const d=new C.InspectControl({position:c,...s});if(t.current=d,l){const i=n=>{l(n.state)};d.on("update",i),d.on("show",i),d.on("hide",i),d.on("enable",i),d.on("disable",i),d.on("clear",i)}return o&&d.on("featureselect",i=>{o(i.feature||null)}),a&&d.on("featureselect",i=>{i.features&&a(i.features)}),e&&(d.on("enable",()=>e(!0)),d.on("disable",()=>e(!1))),u.addControl(d,c),()=>{u.hasControl(d)&&u.removeControl(d),t.current=null}},[u,c,l,o,a,e]),(0,r.useEffect)(()=>{if(t.current){const d={};s.visible!==void 0&&(d.visible=s.visible),s.enabled!==void 0&&(d.enabled=s.enabled),s.maxFeatures!==void 0&&(d.maxFeatures=s.maxFeatures),s.showGeometryType!==void 0&&(d.showGeometryType=s.showGeometryType),s.showLayerName!==void 0&&(d.showLayerName=s.showLayerName),s.maxWidth!==void 0&&(d.maxWidth=s.maxWidth),s.maxHeight!==void 0&&(d.maxHeight=s.maxHeight),s.backgroundColor!==void 0&&(d.backgroundColor=s.backgroundColor),s.borderRadius!==void 0&&(d.borderRadius=s.borderRadius),s.opacity!==void 0&&(d.opacity=s.opacity),s.fontSize!==void 0&&(d.fontSize=s.fontSize),s.fontColor!==void 0&&(d.fontColor=s.fontColor),s.minzoom!==void 0&&(d.minzoom=s.minzoom),s.maxzoom!==void 0&&(d.maxzoom=s.maxzoom),Object.keys(d).length>0&&t.current.update(d)}},[s.visible,s.enabled,s.maxFeatures,s.showGeometryType,s.showLayerName,s.maxWidth,s.maxHeight,s.backgroundColor,s.borderRadius,s.opacity,s.fontSize,s.fontColor,s.minzoom,s.maxzoom]),null}function H({map:u,onBBoxDraw:o,onDrawingToggle:a,onStateChange:e,position:l="bottom-left",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.ViewStateControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d),t.on("expand",d),t.on("collapse",d),t.on("viewchange",d)}return o&&t.on("bboxdraw",d=>{d.bbox&&o(d.bbox)}),a&&(t.on("drawstart",()=>a(!0)),t.on("drawend",()=>a(!1))),u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u,l,e,o,a]),(0,r.useEffect)(()=>{if(s.current){const t={};c.visible!==void 0&&(t.visible=c.visible),c.collapsed!==void 0&&(t.collapsed=c.collapsed),c.precision!==void 0&&(t.precision=c.precision),c.panelWidth!==void 0&&(t.panelWidth=c.panelWidth),c.backgroundColor!==void 0&&(t.backgroundColor=c.backgroundColor),c.borderRadius!==void 0&&(t.borderRadius=c.borderRadius),c.opacity!==void 0&&(t.opacity=c.opacity),c.fontSize!==void 0&&(t.fontSize=c.fontSize),c.fontColor!==void 0&&(t.fontColor=c.fontColor),c.minzoom!==void 0&&(t.minzoom=c.minzoom),c.maxzoom!==void 0&&(t.maxzoom=c.maxzoom),Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.collapsed,c.precision,c.panelWidth,c.backgroundColor,c.borderRadius,c.opacity,c.fontSize,c.fontColor,c.minzoom,c.maxzoom]),null}function I({map:u,onStateChange:o,position:a="top-right",controls:e=[],...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.ControlGrid({position:a,...l,controls:[]});if(c.current=s,o){const t=d=>{o(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t)}return u.addControl(s,a),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,a,o]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t=s.getControls(),d=e;for(const i of d)t.includes(i)||s.addControl(i);for(const i of t)d.includes(i)||s.removeControl(i)},[e]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t={};l.visible!==void 0&&(t.visible=l.visible),l.collapsed!==void 0&&(t.collapsed=l.collapsed),l.title!==void 0&&(t.title=l.title),l.rows!==void 0&&(t.rows=l.rows),l.columns!==void 0&&(t.columns=l.columns),l.showRowColumnControls!==void 0&&(t.showRowColumnControls=l.showRowColumnControls),l.collapsible!==void 0&&(t.collapsible=l.collapsible),l.backgroundColor!==void 0&&(t.backgroundColor=l.backgroundColor),l.padding!==void 0&&(t.padding=l.padding),l.borderRadius!==void 0&&(t.borderRadius=l.borderRadius),l.opacity!==void 0&&(t.opacity=l.opacity),l.gap!==void 0&&(t.gap=l.gap),l.minzoom!==void 0&&(t.minzoom=l.minzoom),l.maxzoom!==void 0&&(t.maxzoom=l.maxzoom),Object.keys(t).length>0&&s.update(t)},[l.visible,l.collapsed,l.title,l.rows,l.columns,l.showRowColumnControls,l.collapsible,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.gap,l.minzoom,l.maxzoom]),null}function W({map:u,onLayerAdd:o,onLayerRemove:a,onLayerUpdate:e,onError:l,onStateChange:c,position:s="top-right",...t}){const d=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const i=new C.CogLayerControl({position:s,...t});if(d.current=i,c){const n=m=>{c(m.state)};i.on("update",n),i.on("show",n),i.on("hide",n),i.on("expand",n),i.on("collapse",n)}return o&&i.on("layeradd",n=>{n.url&&o(n.url)}),a&&i.on("layerremove",()=>{a()}),e&&i.on("layerupdate",n=>{n.url&&e(n.url)}),l&&i.on("error",n=>{n.error&&l(n.error)}),u.addControl(i,s),()=>{u.hasControl(i)&&u.removeControl(i),d.current=null}},[u]),(0,r.useEffect)(()=>{if(d.current){const i=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));Object.keys(i).length>0&&d.current.update(i)}},[t.visible,t.collapsed,t.backgroundColor,t.borderRadius,t.opacity,t.panelWidth,t.fontSize,t.fontColor,t.minzoom,t.maxzoom]),null}function _({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.MinimapControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),null}var h={visible:!0,vmin:0,vmax:1,colormap:"viridis"};function G(u){const[o,a]=(0,r.useState)({...h,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setVmin:(0,r.useCallback)(e=>{a(l=>({...l,vmin:e}))},[]),setVmax:(0,r.useCallback)(e=>{a(l=>({...l,vmax:e}))},[]),setRange:(0,r.useCallback)((e,l)=>{a(c=>({...c,vmin:e,vmax:l}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...h,...u})},[u])}}var k={visible:!0,collapsed:!1,items:[]};function U(u){const[o,a]=(0,r.useState)({...k,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setItems:(0,r.useCallback)(e=>{a(l=>({...l,items:[...e]}))},[]),addItem:(0,r.useCallback)(e=>{a(l=>({...l,items:[...l.items,e]}))},[]),removeItem:(0,r.useCallback)(e=>{a(l=>({...l,items:l.items.filter(c=>c.label!==e)}))},[]),updateItem:(0,r.useCallback)((e,l)=>{a(c=>({...c,items:c.items.map(s=>s.label===e?{...s,...l}:s)}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...k,...u})},[u])}}var v={visible:!0,collapsed:!1,html:""};function $(u){const[o,a]=(0,r.useState)({...v,...u}),e=(0,r.useCallback)(d=>{a(i=>({...i,visible:d}))},[]),l=(0,r.useCallback)(d=>{a(i=>({...i,html:d}))},[]),c=(0,r.useCallback)(()=>{a(d=>({...d,visible:!0}))},[]),s=(0,r.useCallback)(()=>{a(d=>({...d,visible:!1}))},[]),t=(0,r.useCallback)(()=>{a(d=>({...d,visible:!d.visible}))},[]);return{state:o,setState:a,setVisible:e,setHtml:l,setCollapsed:(0,r.useCallback)(d=>{a(i=>({...i,collapsed:d}))},[]),show:c,hide:s,expand:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!d.collapsed}))},[]),toggleVisibility:t,reset:(0,r.useCallback)(()=>{a({...v,...u})},[u])}}var g={visible:!0,collapsed:!0,selectedBasemap:null,searchText:"",loading:!1,error:null,belowLabels:!1};function N(u){const[o,a]=(0,r.useState)({...g,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setBasemap:(0,r.useCallback)(e=>{a(l=>({...l,selectedBasemap:e}))},[]),setSearch:(0,r.useCallback)(e=>{a(l=>({...l,searchText:e}))},[]),setLoading:(0,r.useCallback)(e=>{a(l=>({...l,loading:e}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),setBelowLabels:(0,r.useCallback)(e=>{a(l=>({...l,belowLabels:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),clearSearch:(0,r.useCallback)(()=>{a(e=>({...e,searchText:""}))},[]),reset:(0,r.useCallback)(()=>{a({...g,...u})},[u])}}var x={visible:!0,enabled:!1,exaggeration:1,hillshade:!0};function q(u){const[o,a]=(0,r.useState)({...x,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),setExaggeration:(0,r.useCallback)(e=>{const l=Math.max(.1,Math.min(10,e));a(c=>({...c,exaggeration:l}))},[]),setHillshade:(0,r.useCallback)(e=>{a(l=>({...l,hillshade:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),enableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!0}))},[]),disableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!1}))},[]),toggleHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!e.hillshade}))},[]),reset:(0,r.useCallback)(()=>{a({...x,...u})},[u])}}var R={visible:!0,collapsed:!0,query:"",results:[],loading:!1,selectedResult:null,error:null};function Z(u){const[o,a]=(0,r.useState)({...R,...u}),e=(0,r.useCallback)(b=>{a(f=>({...f,visible:b}))},[]),l=(0,r.useCallback)(b=>{a(f=>({...f,collapsed:b}))},[]),c=(0,r.useCallback)(b=>{a(f=>({...f,query:b}))},[]),s=(0,r.useCallback)(b=>{a(f=>({...f,results:b}))},[]),t=(0,r.useCallback)(b=>{a(f=>({...f,loading:b}))},[]),d=(0,r.useCallback)(b=>{a(f=>({...f,selectedResult:b}))},[]),i=(0,r.useCallback)(b=>{a(f=>({...f,error:b}))},[]),n=(0,r.useCallback)(()=>{a(b=>({...b,visible:!0}))},[]),m=(0,r.useCallback)(()=>{a(b=>({...b,visible:!1}))},[]),V=(0,r.useCallback)(()=>{a(b=>({...b,visible:!b.visible}))},[]);return{state:o,setState:a,setVisible:e,setCollapsed:l,setQuery:c,setResults:s,setLoading:t,selectResult:d,setError:i,show:n,hide:m,expand:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!0,results:[]}))},[]),toggle:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!b.collapsed,results:b.collapsed?b.results:[]}))},[]),toggleVisibility:V,clear:(0,r.useCallback)(()=>{a(b=>({...b,query:"",results:[],selectedResult:null,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...R,...u})},[u])}}var w={visible:!0,isDragging:!1,isLoading:!1,loadedDatasets:[],error:null};function P(u){const[o,a]=(0,r.useState)({...w,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),addDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:[...l.loadedDatasets,e],error:null}))},[]),removeDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:l.loadedDatasets.filter(c=>c.id!==e)}))},[]),clearAll:(0,r.useCallback)(()=>{a(e=>({...e,loadedDatasets:[]}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),clearError:(0,r.useCallback)(()=>{a(e=>({...e,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...w,...u})},[u])}}var y={visible:!0,enabled:!1,inspectedFeatures:[],selectedIndex:0,error:null};function Q(u){const[o,a]=(0,r.useState)({...y,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1,inspectedFeatures:[],selectedIndex:0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled,inspectedFeatures:e.enabled?[]:e.inspectedFeatures,selectedIndex:e.enabled?0:e.selectedIndex}))},[]),setInspectedFeatures:(0,r.useCallback)(e=>{a(l=>({...l,inspectedFeatures:e,selectedIndex:0}))},[]),selectFeature:(0,r.useCallback)(e=>{a(l=>({...l,selectedIndex:Math.max(0,Math.min(e,l.inspectedFeatures.length-1))}))},[]),nextFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:(e.selectedIndex+1)%e.inspectedFeatures.length})},[]),previousFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:e.selectedIndex===0?e.inspectedFeatures.length-1:e.selectedIndex-1})},[]),clear:(0,r.useCallback)(()=>{a(e=>({...e,inspectedFeatures:[],selectedIndex:0,error:null}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...y,...u})},[u]),currentFeature:o.inspectedFeatures[o.selectedIndex]||null,featureCount:o.inspectedFeatures.length}}var z={visible:!0,collapsed:!0,center:[0,0],bounds:[0,0,0,0],zoom:0,pitch:0,bearing:0,drawingBBox:!1,drawnBBox:null};function J(u){const[o,a]=(0,r.useState)({...z,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),setDrawingBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawingBBox:e}))},[]),setDrawnBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawnBBox:e}))},[]),clearBBox:(0,r.useCallback)(()=>{a(e=>({...e,drawnBBox:null,drawingBBox:!1}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...z,...u})},[u])}}var E={visible:!0,collapsed:!1,rows:2,columns:2};function K(u){const[o,a]=(0,r.useState)({...E,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setRows:(0,r.useCallback)(e=>{a(l=>({...l,rows:Math.max(1,Math.min(12,Math.round(e)))}))},[]),setColumns:(0,r.useCallback)(e=>{a(l=>({...l,columns:Math.max(1,Math.min(12,Math.round(e)))}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...E,...u})},[u])}}var T={visible:!0,collapsed:!0,url:"",bands:"1",colormap:"viridis",rescaleMin:0,rescaleMax:255,nodata:void 0,layerOpacity:1,pickable:!0,hasLayer:!1,layerCount:0,layers:[],loading:!1,error:null,status:null,layerName:""};function X(u){const[o,a]=(0,r.useState)({...T,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setUrl:(0,r.useCallback)(e=>{a(l=>({...l,url:e}))},[]),setBands:(0,r.useCallback)(e=>{a(l=>({...l,bands:e}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),setRescaleMin:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMin:e}))},[]),setRescaleMax:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMax:e}))},[]),setNodata:(0,r.useCallback)(e=>{a(l=>({...l,nodata:e}))},[]),setOpacity:(0,r.useCallback)(e=>{const l=Math.max(0,Math.min(1,e));a(c=>({...c,layerOpacity:l}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),togglePanel:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...T,...u})},[u])}}var F={visible:!0,collapsed:!1};function Y(u){const[o,a]=(0,r.useState)({...F,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...F,...u})},[u])}}exports.BasemapReact=S;exports.CogLayerReact=W;exports.ColorbarReact=L;exports.ControlGridReact=I;exports.HtmlControlReact=O;exports.InspectControlReact=D;exports.LegendReact=M;exports.MinimapControlReact=_;exports.SearchControlReact=A;exports.TerrainReact=j;exports.VectorDatasetReact=B;exports.ViewStateControlReact=H;exports.useBasemap=N;exports.useCogLayer=X;exports.useColorbar=G;exports.useControlGrid=K;exports.useHtmlControl=$;exports.useInspectControl=Q;exports.useLegend=U;exports.useMinimapControl=Y;exports.useSearchControl=Z;exports.useTerrain=q;exports.useVectorDataset=P;exports.useViewState=J;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const C=require("./ControlGrid-BBOB4hcq.cjs");let r=require("react");function L({map:u,onStateChange:o,position:a="bottom-right",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Colorbar({position:a,...e});return l.current=c,o&&(c.on("update",s=>{o(s.state)}),c.on("show",s=>{o(s.state)}),c.on("hide",s=>{o(s.state)})),u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.colormap,e.colorbars,e.colorStops,e.vmin,e.vmax,e.label,e.units,e.visible,e.orientation,e.barThickness,e.barLength,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function M({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.Legend({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("collapse",s),c.on("expand",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),(0,r.useEffect)(()=>{if(l.current){const c=Object.fromEntries(Object.entries(e).filter(([,s])=>s!==void 0));Object.keys(c).length>0&&l.current.update(c)}},[e.items,e.legends,e.title,e.visible,e.collapsed,e.collapsible,e.width,e.maxHeight,e.backgroundColor,e.opacity,e.fontSize,e.fontColor,e.swatchSize,e.minzoom,e.maxzoom]),null}function O({map:u,onStateChange:o,position:a="top-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.HtmlControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("update",s),c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u,a,o]),(0,r.useEffect)(()=>{l.current&&e.html!==void 0&&l.current.setHtml(e.html)},[e.html]),(0,r.useEffect)(()=>{if(l.current){const c={};e.htmls!==void 0&&(c.htmls=e.htmls),e.visible!==void 0&&(c.visible=e.visible),e.title!==void 0&&(c.title=e.title),e.collapsible!==void 0&&(c.collapsible=e.collapsible),e.collapsed!==void 0&&(c.collapsed=e.collapsed),e.backgroundColor!==void 0&&(c.backgroundColor=e.backgroundColor),e.padding!==void 0&&(c.padding=e.padding),e.borderRadius!==void 0&&(c.borderRadius=e.borderRadius),e.opacity!==void 0&&(c.opacity=e.opacity),e.maxWidth!==void 0&&(c.maxWidth=e.maxWidth),e.maxHeight!==void 0&&(c.maxHeight=e.maxHeight),e.fontSize!==void 0&&(c.fontSize=e.fontSize),e.fontColor!==void 0&&(c.fontColor=e.fontColor),e.minzoom!==void 0&&(c.minzoom=e.minzoom),e.maxzoom!==void 0&&(c.maxzoom=e.maxzoom),Object.keys(c).length>0&&l.current.update(c)}},[e.visible,e.htmls,e.title,e.collapsible,e.collapsed,e.backgroundColor,e.padding,e.borderRadius,e.opacity,e.maxWidth,e.maxHeight,e.fontSize,e.fontColor,e.minzoom,e.maxzoom]),null}function S({map:u,onBasemapChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.BasemapControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("collapse",t),s.on("expand",t)}if(o){const t=d=>{d.basemap&&o(d.basemap)};s.on("basemapchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.basemaps,l.defaultBasemap,l.visible,l.collapsed,l.collapsible,l.displayMode,l.showSearch,l.filterGroups,l.excludeGroups,l.excludeBroken,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.maxWidth,l.maxHeight,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function j({map:u,onTerrainChange:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.TerrainControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t)}if(o){const t=d=>{o(d.state.enabled)};s.on("terrainchange",t)}return u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u]),(0,r.useEffect)(()=>{if(c.current){const s=Object.fromEntries(Object.entries(l).filter(([,t])=>t!==void 0));Object.keys(s).length>0&&c.current.update(s)}},[l.enabled,l.exaggeration,l.hillshade,l.hillshadeExaggeration,l.visible,l.backgroundColor,l.borderRadius,l.opacity,l.minzoom,l.maxzoom]),null}function A({map:u,onResultSelect:o,onStateChange:a,position:e="top-right",...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.SearchControl({position:e,...l});if(c.current=s,a){const t=d=>{a(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t),s.on("search",t),s.on("clear",t)}return o&&s.on("resultselect",t=>{t.result&&o(t.result)}),u.addControl(s,e),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,e,a,o]),(0,r.useEffect)(()=>{if(c.current){const s={};l.visible!==void 0&&(s.visible=l.visible),l.collapsed!==void 0&&(s.collapsed=l.collapsed),l.placeholder!==void 0&&(s.placeholder=l.placeholder),l.maxResults!==void 0&&(s.maxResults=l.maxResults),l.flyToZoom!==void 0&&(s.flyToZoom=l.flyToZoom),l.showMarker!==void 0&&(s.showMarker=l.showMarker),l.markerColor!==void 0&&(s.markerColor=l.markerColor),l.backgroundColor!==void 0&&(s.backgroundColor=l.backgroundColor),l.borderRadius!==void 0&&(s.borderRadius=l.borderRadius),l.opacity!==void 0&&(s.opacity=l.opacity),l.width!==void 0&&(s.width=l.width),l.fontSize!==void 0&&(s.fontSize=l.fontSize),l.fontColor!==void 0&&(s.fontColor=l.fontColor),l.minzoom!==void 0&&(s.minzoom=l.minzoom),l.maxzoom!==void 0&&(s.maxzoom=l.maxzoom),Object.keys(s).length>0&&c.current.update(s)}},[l.visible,l.collapsed,l.placeholder,l.maxResults,l.flyToZoom,l.showMarker,l.markerColor,l.backgroundColor,l.borderRadius,l.opacity,l.width,l.fontSize,l.fontColor,l.minzoom,l.maxzoom]),null}function B({map:u,onDatasetLoad:o,onError:a,onStateChange:e,position:l="top-right",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.VectorDatasetControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d)}if(o){const d=i=>{i.dataset&&o(i.dataset)};t.on("load",d)}if(a){const d=i=>{i.error&&a(i.error,i.filename)};t.on("error",d)}return u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u]),(0,r.useEffect)(()=>{if(s.current){const t=Object.fromEntries(Object.entries(c).filter(([,d])=>d!==void 0));Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.showDropZone,c.fitBounds,c.fitBoundsPadding,c.backgroundColor,c.borderRadius,c.opacity,c.minzoom,c.maxzoom]),null}function D({map:u,onFeatureSelect:o,onInspect:a,onToggle:e,onStateChange:l,position:c="top-right",...s}){const t=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const d=new C.InspectControl({position:c,...s});if(t.current=d,l){const i=n=>{l(n.state)};d.on("update",i),d.on("show",i),d.on("hide",i),d.on("enable",i),d.on("disable",i),d.on("clear",i)}return o&&d.on("featureselect",i=>{o(i.feature||null)}),a&&d.on("featureselect",i=>{i.features&&a(i.features)}),e&&(d.on("enable",()=>e(!0)),d.on("disable",()=>e(!1))),u.addControl(d,c),()=>{u.hasControl(d)&&u.removeControl(d),t.current=null}},[u,c,l,o,a,e]),(0,r.useEffect)(()=>{if(t.current){const d={};s.visible!==void 0&&(d.visible=s.visible),s.enabled!==void 0&&(d.enabled=s.enabled),s.maxFeatures!==void 0&&(d.maxFeatures=s.maxFeatures),s.showGeometryType!==void 0&&(d.showGeometryType=s.showGeometryType),s.showLayerName!==void 0&&(d.showLayerName=s.showLayerName),s.maxWidth!==void 0&&(d.maxWidth=s.maxWidth),s.maxHeight!==void 0&&(d.maxHeight=s.maxHeight),s.backgroundColor!==void 0&&(d.backgroundColor=s.backgroundColor),s.borderRadius!==void 0&&(d.borderRadius=s.borderRadius),s.opacity!==void 0&&(d.opacity=s.opacity),s.fontSize!==void 0&&(d.fontSize=s.fontSize),s.fontColor!==void 0&&(d.fontColor=s.fontColor),s.minzoom!==void 0&&(d.minzoom=s.minzoom),s.maxzoom!==void 0&&(d.maxzoom=s.maxzoom),Object.keys(d).length>0&&t.current.update(d)}},[s.visible,s.enabled,s.maxFeatures,s.showGeometryType,s.showLayerName,s.maxWidth,s.maxHeight,s.backgroundColor,s.borderRadius,s.opacity,s.fontSize,s.fontColor,s.minzoom,s.maxzoom]),null}function H({map:u,onBBoxDraw:o,onDrawingToggle:a,onStateChange:e,position:l="bottom-left",...c}){const s=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const t=new C.ViewStateControl({position:l,...c});if(s.current=t,e){const d=i=>{e(i.state)};t.on("update",d),t.on("show",d),t.on("hide",d),t.on("expand",d),t.on("collapse",d),t.on("viewchange",d)}return o&&t.on("bboxdraw",d=>{d.bbox&&o(d.bbox)}),a&&(t.on("drawstart",()=>a(!0)),t.on("drawend",()=>a(!1))),u.addControl(t,l),()=>{u.hasControl(t)&&u.removeControl(t),s.current=null}},[u,l,e,o,a]),(0,r.useEffect)(()=>{if(s.current){const t={};c.visible!==void 0&&(t.visible=c.visible),c.collapsed!==void 0&&(t.collapsed=c.collapsed),c.precision!==void 0&&(t.precision=c.precision),c.panelWidth!==void 0&&(t.panelWidth=c.panelWidth),c.backgroundColor!==void 0&&(t.backgroundColor=c.backgroundColor),c.borderRadius!==void 0&&(t.borderRadius=c.borderRadius),c.opacity!==void 0&&(t.opacity=c.opacity),c.fontSize!==void 0&&(t.fontSize=c.fontSize),c.fontColor!==void 0&&(t.fontColor=c.fontColor),c.minzoom!==void 0&&(t.minzoom=c.minzoom),c.maxzoom!==void 0&&(t.maxzoom=c.maxzoom),Object.keys(t).length>0&&s.current.update(t)}},[c.visible,c.collapsed,c.precision,c.panelWidth,c.backgroundColor,c.borderRadius,c.opacity,c.fontSize,c.fontColor,c.minzoom,c.maxzoom]),null}function I({map:u,onStateChange:o,position:a="top-right",controls:e=[],...l}){const c=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const s=new C.ControlGrid({position:a,...l,controls:[]});if(c.current=s,o){const t=d=>{o(d.state)};s.on("update",t),s.on("show",t),s.on("hide",t),s.on("expand",t),s.on("collapse",t)}return u.addControl(s,a),()=>{u.hasControl(s)&&u.removeControl(s),c.current=null}},[u,a,o]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t=s.getControls(),d=e;for(const i of d)t.includes(i)||s.addControl(i);for(const i of t)d.includes(i)||s.removeControl(i)},[e]),(0,r.useEffect)(()=>{const s=c.current;if(!s)return;const t={};l.visible!==void 0&&(t.visible=l.visible),l.collapsed!==void 0&&(t.collapsed=l.collapsed),l.title!==void 0&&(t.title=l.title),l.rows!==void 0&&(t.rows=l.rows),l.columns!==void 0&&(t.columns=l.columns),l.showRowColumnControls!==void 0&&(t.showRowColumnControls=l.showRowColumnControls),l.collapsible!==void 0&&(t.collapsible=l.collapsible),l.backgroundColor!==void 0&&(t.backgroundColor=l.backgroundColor),l.padding!==void 0&&(t.padding=l.padding),l.borderRadius!==void 0&&(t.borderRadius=l.borderRadius),l.opacity!==void 0&&(t.opacity=l.opacity),l.gap!==void 0&&(t.gap=l.gap),l.minzoom!==void 0&&(t.minzoom=l.minzoom),l.maxzoom!==void 0&&(t.maxzoom=l.maxzoom),Object.keys(t).length>0&&s.update(t)},[l.visible,l.collapsed,l.title,l.rows,l.columns,l.showRowColumnControls,l.collapsible,l.backgroundColor,l.padding,l.borderRadius,l.opacity,l.gap,l.minzoom,l.maxzoom]),null}function W({map:u,onLayerAdd:o,onLayerRemove:a,onLayerUpdate:e,onError:l,onStateChange:c,position:s="top-right",...t}){const d=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const i=new C.CogLayerControl({position:s,...t});if(d.current=i,c){const n=m=>{c(m.state)};i.on("update",n),i.on("show",n),i.on("hide",n),i.on("expand",n),i.on("collapse",n)}return o&&i.on("layeradd",n=>{n.url&&o(n.url)}),a&&i.on("layerremove",()=>{a()}),e&&i.on("layerupdate",n=>{n.url&&e(n.url)}),l&&i.on("error",n=>{n.error&&l(n.error)}),u.addControl(i,s),()=>{u.hasControl(i)&&u.removeControl(i),d.current=null}},[u]),(0,r.useEffect)(()=>{if(d.current){const i=Object.fromEntries(Object.entries(t).filter(([,n])=>n!==void 0));Object.keys(i).length>0&&d.current.update(i)}},[t.visible,t.collapsed,t.backgroundColor,t.borderRadius,t.opacity,t.panelWidth,t.fontSize,t.fontColor,t.minzoom,t.maxzoom]),null}function _({map:u,onStateChange:o,position:a="bottom-left",...e}){const l=(0,r.useRef)(null);return(0,r.useEffect)(()=>{if(!u)return;const c=new C.MinimapControl({position:a,...e});if(l.current=c,o){const s=t=>{o(t.state)};c.on("show",s),c.on("hide",s),c.on("expand",s),c.on("collapse",s)}return u.addControl(c,a),()=>{u.hasControl(c)&&u.removeControl(c),l.current=null}},[u]),null}var h={visible:!0,vmin:0,vmax:1,colormap:"viridis"};function G(u){const[o,a]=(0,r.useState)({...h,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setVmin:(0,r.useCallback)(e=>{a(l=>({...l,vmin:e}))},[]),setVmax:(0,r.useCallback)(e=>{a(l=>({...l,vmax:e}))},[]),setRange:(0,r.useCallback)((e,l)=>{a(c=>({...c,vmin:e,vmax:l}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...h,...u})},[u])}}var k={visible:!0,collapsed:!1,items:[]};function U(u){const[o,a]=(0,r.useState)({...k,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setItems:(0,r.useCallback)(e=>{a(l=>({...l,items:[...e]}))},[]),addItem:(0,r.useCallback)(e=>{a(l=>({...l,items:[...l.items,e]}))},[]),removeItem:(0,r.useCallback)(e=>{a(l=>({...l,items:l.items.filter(c=>c.label!==e)}))},[]),updateItem:(0,r.useCallback)((e,l)=>{a(c=>({...c,items:c.items.map(s=>s.label===e?{...s,...l}:s)}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),reset:(0,r.useCallback)(()=>{a({...k,...u})},[u])}}var v={visible:!0,collapsed:!1,html:""};function $(u){const[o,a]=(0,r.useState)({...v,...u}),e=(0,r.useCallback)(d=>{a(i=>({...i,visible:d}))},[]),l=(0,r.useCallback)(d=>{a(i=>({...i,html:d}))},[]),c=(0,r.useCallback)(()=>{a(d=>({...d,visible:!0}))},[]),s=(0,r.useCallback)(()=>{a(d=>({...d,visible:!1}))},[]),t=(0,r.useCallback)(()=>{a(d=>({...d,visible:!d.visible}))},[]);return{state:o,setState:a,setVisible:e,setHtml:l,setCollapsed:(0,r.useCallback)(d=>{a(i=>({...i,collapsed:d}))},[]),show:c,hide:s,expand:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(d=>({...d,collapsed:!d.collapsed}))},[]),toggleVisibility:t,reset:(0,r.useCallback)(()=>{a({...v,...u})},[u])}}var g={visible:!0,collapsed:!0,selectedBasemap:null,searchText:"",loading:!1,error:null,belowLabels:!1};function N(u){const[o,a]=(0,r.useState)({...g,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setBasemap:(0,r.useCallback)(e=>{a(l=>({...l,selectedBasemap:e}))},[]),setSearch:(0,r.useCallback)(e=>{a(l=>({...l,searchText:e}))},[]),setLoading:(0,r.useCallback)(e=>{a(l=>({...l,loading:e}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),setBelowLabels:(0,r.useCallback)(e=>{a(l=>({...l,belowLabels:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),clearSearch:(0,r.useCallback)(()=>{a(e=>({...e,searchText:""}))},[]),reset:(0,r.useCallback)(()=>{a({...g,...u})},[u])}}var x={visible:!0,enabled:!1,exaggeration:1,hillshade:!0};function q(u){const[o,a]=(0,r.useState)({...x,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),setExaggeration:(0,r.useCallback)(e=>{const l=Math.max(.1,Math.min(10,e));a(c=>({...c,exaggeration:l}))},[]),setHillshade:(0,r.useCallback)(e=>{a(l=>({...l,hillshade:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),enableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!0}))},[]),disableHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!1}))},[]),toggleHillshade:(0,r.useCallback)(()=>{a(e=>({...e,hillshade:!e.hillshade}))},[]),reset:(0,r.useCallback)(()=>{a({...x,...u})},[u])}}var R={visible:!0,collapsed:!0,query:"",results:[],loading:!1,selectedResult:null,error:null};function Z(u){const[o,a]=(0,r.useState)({...R,...u}),e=(0,r.useCallback)(b=>{a(f=>({...f,visible:b}))},[]),l=(0,r.useCallback)(b=>{a(f=>({...f,collapsed:b}))},[]),c=(0,r.useCallback)(b=>{a(f=>({...f,query:b}))},[]),s=(0,r.useCallback)(b=>{a(f=>({...f,results:b}))},[]),t=(0,r.useCallback)(b=>{a(f=>({...f,loading:b}))},[]),d=(0,r.useCallback)(b=>{a(f=>({...f,selectedResult:b}))},[]),i=(0,r.useCallback)(b=>{a(f=>({...f,error:b}))},[]),n=(0,r.useCallback)(()=>{a(b=>({...b,visible:!0}))},[]),m=(0,r.useCallback)(()=>{a(b=>({...b,visible:!1}))},[]),V=(0,r.useCallback)(()=>{a(b=>({...b,visible:!b.visible}))},[]);return{state:o,setState:a,setVisible:e,setCollapsed:l,setQuery:c,setResults:s,setLoading:t,selectResult:d,setError:i,show:n,hide:m,expand:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!0,results:[]}))},[]),toggle:(0,r.useCallback)(()=>{a(b=>({...b,collapsed:!b.collapsed,results:b.collapsed?b.results:[]}))},[]),toggleVisibility:V,clear:(0,r.useCallback)(()=>{a(b=>({...b,query:"",results:[],selectedResult:null,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...R,...u})},[u])}}var w={visible:!0,isDragging:!1,isLoading:!1,loadedDatasets:[],error:null};function P(u){const[o,a]=(0,r.useState)({...w,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),addDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:[...l.loadedDatasets,e],error:null}))},[]),removeDataset:(0,r.useCallback)(e=>{a(l=>({...l,loadedDatasets:l.loadedDatasets.filter(c=>c.id!==e)}))},[]),clearAll:(0,r.useCallback)(()=>{a(e=>({...e,loadedDatasets:[]}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),clearError:(0,r.useCallback)(()=>{a(e=>({...e,error:null}))},[]),reset:(0,r.useCallback)(()=>{a({...w,...u})},[u])}}var y={visible:!0,enabled:!1,inspectedFeatures:[],selectedIndex:0,error:null};function Q(u){const[o,a]=(0,r.useState)({...y,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setEnabled:(0,r.useCallback)(e=>{a(l=>({...l,enabled:e}))},[]),enable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!0}))},[]),disable:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!1,inspectedFeatures:[],selectedIndex:0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,enabled:!e.enabled,inspectedFeatures:e.enabled?[]:e.inspectedFeatures,selectedIndex:e.enabled?0:e.selectedIndex}))},[]),setInspectedFeatures:(0,r.useCallback)(e=>{a(l=>({...l,inspectedFeatures:e,selectedIndex:0}))},[]),selectFeature:(0,r.useCallback)(e=>{a(l=>({...l,selectedIndex:Math.max(0,Math.min(e,l.inspectedFeatures.length-1))}))},[]),nextFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:(e.selectedIndex+1)%e.inspectedFeatures.length})},[]),previousFeature:(0,r.useCallback)(()=>{a(e=>e.inspectedFeatures.length<=1?e:{...e,selectedIndex:e.selectedIndex===0?e.inspectedFeatures.length-1:e.selectedIndex-1})},[]),clear:(0,r.useCallback)(()=>{a(e=>({...e,inspectedFeatures:[],selectedIndex:0,error:null}))},[]),setError:(0,r.useCallback)(e=>{a(l=>({...l,error:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...y,...u})},[u]),currentFeature:o.inspectedFeatures[o.selectedIndex]||null,featureCount:o.inspectedFeatures.length}}var z={visible:!0,collapsed:!0,center:[0,0],bounds:[0,0,0,0],zoom:0,pitch:0,bearing:0,drawingBBox:!1,drawnBBox:null};function J(u){const[o,a]=(0,r.useState)({...z,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),setDrawingBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawingBBox:e}))},[]),setDrawnBBox:(0,r.useCallback)(e=>{a(l=>({...l,drawnBBox:e}))},[]),clearBBox:(0,r.useCallback)(()=>{a(e=>({...e,drawnBBox:null,drawingBBox:!1}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...z,...u})},[u])}}var E={visible:!0,collapsed:!1,rows:2,columns:2};function K(u){const[o,a]=(0,r.useState)({...E,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setRows:(0,r.useCallback)(e=>{a(l=>({...l,rows:Math.max(1,Math.min(12,Math.round(e)))}))},[]),setColumns:(0,r.useCallback)(e=>{a(l=>({...l,columns:Math.max(1,Math.min(12,Math.round(e)))}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),reset:(0,r.useCallback)(()=>{a({...E,...u})},[u])}}var T={visible:!0,collapsed:!0,url:"",bands:"1",colormap:"viridis",rescaleMin:0,rescaleMax:255,nodata:void 0,layerOpacity:1,pickable:!0,hasLayer:!1,layerCount:0,layers:[],loading:!1,error:null,status:null,layerName:""};function X(u){const[o,a]=(0,r.useState)({...T,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),setUrl:(0,r.useCallback)(e=>{a(l=>({...l,url:e}))},[]),setBands:(0,r.useCallback)(e=>{a(l=>({...l,bands:e}))},[]),setColormap:(0,r.useCallback)(e=>{a(l=>({...l,colormap:e}))},[]),setRescaleMin:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMin:e}))},[]),setRescaleMax:(0,r.useCallback)(e=>{a(l=>({...l,rescaleMax:e}))},[]),setNodata:(0,r.useCallback)(e=>{a(l=>({...l,nodata:e}))},[]),setOpacity:(0,r.useCallback)(e=>{const l=Math.max(0,Math.min(1,e));a(c=>({...c,layerOpacity:l}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggleVisibility:(0,r.useCallback)(()=>{a(e=>({...e,visible:!e.visible}))},[]),togglePanel:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...T,...u})},[u])}}var F={visible:!0,collapsed:!1};function Y(u){const[o,a]=(0,r.useState)({...F,...u});return{state:o,setState:a,setVisible:(0,r.useCallback)(e=>{a(l=>({...l,visible:e}))},[]),setCollapsed:(0,r.useCallback)(e=>{a(l=>({...l,collapsed:e}))},[]),show:(0,r.useCallback)(()=>{a(e=>({...e,visible:!0}))},[]),hide:(0,r.useCallback)(()=>{a(e=>({...e,visible:!1}))},[]),expand:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!1}))},[]),collapse:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!0}))},[]),toggle:(0,r.useCallback)(()=>{a(e=>({...e,collapsed:!e.collapsed}))},[]),reset:(0,r.useCallback)(()=>{a({...F,...u})},[u])}}exports.BasemapReact=S;exports.CogLayerReact=W;exports.ColorbarReact=L;exports.ControlGridReact=I;exports.HtmlControlReact=O;exports.InspectControlReact=D;exports.LegendReact=M;exports.MinimapControlReact=_;exports.SearchControlReact=A;exports.TerrainReact=j;exports.VectorDatasetReact=B;exports.ViewStateControlReact=H;exports.useBasemap=N;exports.useCogLayer=X;exports.useColorbar=G;exports.useControlGrid=K;exports.useHtmlControl=$;exports.useInspectControl=Q;exports.useLegend=U;exports.useMinimapControl=Y;exports.useSearchControl=Z;exports.useTerrain=q;exports.useVectorDataset=P;exports.useViewState=J;
|
package/dist/react.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { A, M, N as j, ct as B, dt as D, j as H, k as I, lt as W, ot as U, st as _, t as $, ut as G } from "./ControlGrid-CXnEfoxn.js";
|
|
2
2
|
import { useCallback as d, useEffect as f, useRef as h, useState as v } from "react";
|
|
3
3
|
function Z({ map: s, onStateChange: u, position: r = "bottom-right", ...e }) {
|
|
4
4
|
const l = h(null);
|
|
5
5
|
return f(() => {
|
|
6
6
|
if (!s) return;
|
|
7
|
-
const t = new
|
|
7
|
+
const t = new D({
|
|
8
8
|
position: r,
|
|
9
9
|
...e
|
|
10
10
|
});
|
|
@@ -50,7 +50,7 @@ function q({ map: s, onStateChange: u, position: r = "bottom-left", ...e }) {
|
|
|
50
50
|
const l = h(null);
|
|
51
51
|
return f(() => {
|
|
52
52
|
if (!s) return;
|
|
53
|
-
const t = new
|
|
53
|
+
const t = new G({
|
|
54
54
|
position: r,
|
|
55
55
|
...e
|
|
56
56
|
});
|
|
@@ -90,7 +90,7 @@ function P({ map: s, onStateChange: u, position: r = "top-left", ...e }) {
|
|
|
90
90
|
const l = h(null);
|
|
91
91
|
return f(() => {
|
|
92
92
|
if (!s) return;
|
|
93
|
-
const t = new
|
|
93
|
+
const t = new W({
|
|
94
94
|
position: r,
|
|
95
95
|
...e
|
|
96
96
|
});
|
|
@@ -136,7 +136,7 @@ function Q({ map: s, onBasemapChange: u, onStateChange: r, position: e = "top-ri
|
|
|
136
136
|
const t = h(null);
|
|
137
137
|
return f(() => {
|
|
138
138
|
if (!s) return;
|
|
139
|
-
const a = new
|
|
139
|
+
const a = new B({
|
|
140
140
|
position: e,
|
|
141
141
|
...l
|
|
142
142
|
});
|
|
@@ -187,7 +187,7 @@ function J({ map: s, onTerrainChange: u, onStateChange: r, position: e = "top-ri
|
|
|
187
187
|
const t = h(null);
|
|
188
188
|
return f(() => {
|
|
189
189
|
if (!s) return;
|
|
190
|
-
const a = new
|
|
190
|
+
const a = new _({
|
|
191
191
|
position: e,
|
|
192
192
|
...l
|
|
193
193
|
});
|
|
@@ -228,7 +228,7 @@ function K({ map: s, onResultSelect: u, onStateChange: r, position: e = "top-rig
|
|
|
228
228
|
const t = h(null);
|
|
229
229
|
return f(() => {
|
|
230
230
|
if (!s) return;
|
|
231
|
-
const a = new
|
|
231
|
+
const a = new U({
|
|
232
232
|
position: e,
|
|
233
233
|
...l
|
|
234
234
|
});
|
|
@@ -371,7 +371,7 @@ function p({ map: s, onBBoxDraw: u, onDrawingToggle: r, onStateChange: e, positi
|
|
|
371
371
|
const a = h(null);
|
|
372
372
|
return f(() => {
|
|
373
373
|
if (!s) return;
|
|
374
|
-
const c = new
|
|
374
|
+
const c = new H({
|
|
375
375
|
position: l,
|
|
376
376
|
...t
|
|
377
377
|
});
|
|
@@ -465,7 +465,7 @@ function le({ map: s, onLayerAdd: u, onLayerRemove: r, onLayerUpdate: e, onError
|
|
|
465
465
|
const o = h(null);
|
|
466
466
|
return f(() => {
|
|
467
467
|
if (!s) return;
|
|
468
|
-
const i = new
|
|
468
|
+
const i = new A({
|
|
469
469
|
position: a,
|
|
470
470
|
...c
|
|
471
471
|
});
|
|
@@ -508,7 +508,7 @@ function re({ map: s, onStateChange: u, position: r = "bottom-left", ...e }) {
|
|
|
508
508
|
const l = h(null);
|
|
509
509
|
return f(() => {
|
|
510
510
|
if (!s) return;
|
|
511
|
-
const t = new
|
|
511
|
+
const t = new I({
|
|
512
512
|
position: r,
|
|
513
513
|
...e
|
|
514
514
|
});
|
|
@@ -26,6 +26,12 @@ export declare class BookmarkControl implements IControl {
|
|
|
26
26
|
private _map?;
|
|
27
27
|
private _handleZoom?;
|
|
28
28
|
private _zoomVisible;
|
|
29
|
+
/** Whether the next added bookmark should capture host state (467). */
|
|
30
|
+
private _captureEnabled;
|
|
31
|
+
/** IDs of bookmarks ticked for selective export (470). */
|
|
32
|
+
private _exportSelection;
|
|
33
|
+
/** ID of the bookmark currently being dragged for reordering (471). */
|
|
34
|
+
private _dragId;
|
|
29
35
|
private _listEl?;
|
|
30
36
|
private _nameInput?;
|
|
31
37
|
/**
|
|
@@ -88,6 +94,18 @@ export declare class BookmarkControl implements IControl {
|
|
|
88
94
|
* Update the bookmarks list display.
|
|
89
95
|
*/
|
|
90
96
|
private _updateList;
|
|
97
|
+
/**
|
|
98
|
+
* Wire drag-and-drop reordering for a single bookmark item.
|
|
99
|
+
*/
|
|
100
|
+
private _setupItemReorder;
|
|
101
|
+
/**
|
|
102
|
+
* Move the dragged bookmark so it sits at the target bookmark's position.
|
|
103
|
+
*/
|
|
104
|
+
private _reorderBookmark;
|
|
105
|
+
/**
|
|
106
|
+
* Reflect the current export selection on the Export button (title hint).
|
|
107
|
+
*/
|
|
108
|
+
private _updateExportButton;
|
|
91
109
|
/**
|
|
92
110
|
* Escape HTML for safe rendering.
|
|
93
111
|
*/
|
|
@@ -120,6 +138,11 @@ export declare class BookmarkControl implements IControl {
|
|
|
120
138
|
* Export bookmarks to a JSON file download.
|
|
121
139
|
*/
|
|
122
140
|
private _exportToFile;
|
|
141
|
+
/**
|
|
142
|
+
* The bookmarks an Export should write: the ticked subset when any are
|
|
143
|
+
* selected (and selection is enabled), otherwise all of them, in list order.
|
|
144
|
+
*/
|
|
145
|
+
private _bookmarksForExport;
|
|
123
146
|
/**
|
|
124
147
|
* Import bookmarks from a JSON file via file picker.
|
|
125
148
|
*/
|
|
@@ -173,8 +196,18 @@ export declare class BookmarkControl implements IControl {
|
|
|
173
196
|
*/
|
|
174
197
|
importBookmarks(bookmarks: MapBookmark[]): this;
|
|
175
198
|
/**
|
|
176
|
-
* Export bookmarks as JSON string.
|
|
199
|
+
* Export bookmarks as a JSON string. When export selection is enabled and a
|
|
200
|
+
* subset is ticked, only that subset is serialized; otherwise all bookmarks.
|
|
177
201
|
*/
|
|
178
202
|
exportBookmarks(): string;
|
|
203
|
+
/**
|
|
204
|
+
* Get the IDs currently ticked for selective export.
|
|
205
|
+
*/
|
|
206
|
+
getSelectedIds(): string[];
|
|
207
|
+
/**
|
|
208
|
+
* Replace the set of bookmark IDs ticked for selective export. IDs that do
|
|
209
|
+
* not match an existing bookmark are ignored.
|
|
210
|
+
*/
|
|
211
|
+
setSelectedIds(ids: string[]): this;
|
|
179
212
|
}
|
|
180
213
|
//# sourceMappingURL=BookmarkControl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BookmarkControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/BookmarkControl.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,QAAQ,EACR,GAAG,IAAI,WAAW,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACZ,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"BookmarkControl.d.ts","sourceRoot":"","sources":["../../../../src/lib/core/BookmarkControl.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAC9B,OAAO,gCAAgC,CAAC;AACxC,OAAO,KAAK,EACV,QAAQ,EACR,GAAG,IAAI,WAAW,EAClB,eAAe,EAChB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EACV,sBAAsB,EACtB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,WAAW,EACZ,MAAM,SAAS,CAAC;AAkGjB;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,eAAgB,YAAW,QAAQ;IAC9C,OAAO,CAAC,UAAU,CAAC,CAAc;IACjC,OAAO,CAAC,OAAO,CAAC,CAAoB;IACpC,OAAO,CAAC,MAAM,CAAC,CAAc;IAC7B,OAAO,CAAC,QAAQ,CAAmC;IACnD,OAAO,CAAC,MAAM,CAAuB;IACrC,OAAO,CAAC,cAAc,CACV;IACZ,OAAO,CAAC,IAAI,CAAC,CAAc;IAC3B,OAAO,CAAC,WAAW,CAAC,CAAa;IACjC,OAAO,CAAC,YAAY,CAAiB;IACrC,uEAAuE;IACvE,OAAO,CAAC,eAAe,CAAU;IACjC,0DAA0D;IAC1D,OAAO,CAAC,gBAAgB,CAA0B;IAClD,uEAAuE;IACvE,OAAO,CAAC,OAAO,CAAuB;IAGtC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,UAAU,CAAC,CAAmB;IAEtC;;OAEG;gBACS,OAAO,CAAC,EAAE,sBAAsB;IAgB5C;;OAEG;IACH,KAAK,CAAC,GAAG,EAAE,WAAW,GAAG,WAAW;IAYpC;;OAEG;IACH,QAAQ,IAAI,IAAI;IAUhB;;OAEG;IACH,kBAAkB,IAAI,eAAe;IAIrC;;OAEG;IACH,EAAE,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAQ7D;;OAEG;IACH,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,OAAO,EAAE,oBAAoB,GAAG,IAAI;IAK9D;;OAEG;IACH,OAAO,CAAC,KAAK;IAeb;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAoBxB;;OAEG;IACH,OAAO,CAAC,YAAY;IA2IpB;;OAEG;IACH,MAAM,IAAI,IAAI;IAOd;;OAEG;IACH,QAAQ,IAAI,IAAI;IAOhB;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;OAEG;IACH,OAAO,CAAC,UAAU;IAQlB;;OAEG;IACH,OAAO,CAAC,UAAU;IAMlB;;OAEG;IACH,OAAO,CAAC,WAAW;IAgGnB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IA+BzB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAexB;;OAEG;IACH,OAAO,CAAC,mBAAmB;IAU3B;;OAEG;IACH,OAAO,CAAC,WAAW;IAMnB;;OAEG;IACH,OAAO,CAAC,YAAY;IA+DpB;;OAEG;IACH,OAAO,CAAC,eAAe;IAkBvB;;OAEG;IACH,OAAO,CAAC,aAAa;IAuBrB;;OAEG;IACH,OAAO,CAAC,YAAY;IA2CpB;;OAEG;IACH,OAAO,CAAC,SAAS;IAUjB;;OAEG;IACH,OAAO,CAAC,aAAa;IAiBrB;;OAEG;IACH,OAAO,CAAC,aAAa;IAcrB;;;OAGG;IACH,OAAO,CAAC,mBAAmB;IAS3B;;OAEG;IACH,OAAO,CAAC,eAAe;IA6CvB;;OAEG;IACH,OAAO,CAAC,cAAc;IAatB;;OAEG;IACH,OAAO,CAAC,gBAAgB;IAcxB;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAuBzB;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,IAAI,IAAI,IAAI;IASZ;;OAEG;IACH,QAAQ,IAAI,oBAAoB;IAIhC;;OAEG;IACH,YAAY,IAAI,WAAW,EAAE;IAI7B;;OAEG;IACH,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAKhC;;OAEG;IACH,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKhC;;OAEG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAKtB;;OAEG;IACH,KAAK,IAAI,IAAI;IAKb;;OAEG;IACH,eAAe,CAAC,SAAS,EAAE,WAAW,EAAE,GAAG,IAAI;IAU/C;;;OAGG;IACH,eAAe,IAAI,MAAM;IAIzB;;OAEG;IACH,cAAc,IAAI,MAAM,EAAE;IAI1B;;;OAGG;IACH,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI;CAMpC"}
|
|
@@ -2710,6 +2710,13 @@ export interface MapBookmark {
|
|
|
2710
2710
|
createdAt: number;
|
|
2711
2711
|
/** Optional thumbnail data URL. */
|
|
2712
2712
|
thumbnail?: string;
|
|
2713
|
+
/**
|
|
2714
|
+
* Optional host-defined state captured alongside the view (e.g. which layers
|
|
2715
|
+
* were visible). Produced by {@link BookmarkControlOptions.captureState} and
|
|
2716
|
+
* passed back to {@link BookmarkControlOptions.restoreState} when the
|
|
2717
|
+
* bookmark is opened. The control treats it as opaque and only persists it.
|
|
2718
|
+
*/
|
|
2719
|
+
extra?: Record<string, unknown>;
|
|
2713
2720
|
}
|
|
2714
2721
|
/**
|
|
2715
2722
|
* Options for configuring the BookmarkControl.
|
|
@@ -2755,6 +2762,44 @@ export interface BookmarkControlOptions {
|
|
|
2755
2762
|
minzoom?: number;
|
|
2756
2763
|
/** Maximum zoom level at which the control is visible. */
|
|
2757
2764
|
maxzoom?: number;
|
|
2765
|
+
/**
|
|
2766
|
+
* Whether the panel can be resized by dragging its corner. Default: true.
|
|
2767
|
+
*/
|
|
2768
|
+
resizable?: boolean;
|
|
2769
|
+
/**
|
|
2770
|
+
* Whether bookmarks can be reordered by dragging their grip handle.
|
|
2771
|
+
* Default: true.
|
|
2772
|
+
*/
|
|
2773
|
+
reorderable?: boolean;
|
|
2774
|
+
/**
|
|
2775
|
+
* Whether each bookmark shows a checkbox so a subset can be selected for
|
|
2776
|
+
* export. When any are selected, Export only writes the selection; otherwise
|
|
2777
|
+
* it writes every bookmark. Default: false.
|
|
2778
|
+
*/
|
|
2779
|
+
selectable?: boolean;
|
|
2780
|
+
/**
|
|
2781
|
+
* Capture host-defined state to store on a new bookmark (e.g. the set of
|
|
2782
|
+
* visible layers). The returned value is persisted verbatim as the
|
|
2783
|
+
* bookmark's `extra` and handed back to {@link restoreState} on open. Return
|
|
2784
|
+
* `undefined` to store nothing.
|
|
2785
|
+
*/
|
|
2786
|
+
captureState?: () => Record<string, unknown> | undefined;
|
|
2787
|
+
/**
|
|
2788
|
+
* Restore host-defined state when a bookmark is opened. Receives the value
|
|
2789
|
+
* previously produced by {@link captureState} (or `undefined` if none).
|
|
2790
|
+
*/
|
|
2791
|
+
restoreState?: (extra: Record<string, unknown> | undefined) => void;
|
|
2792
|
+
/**
|
|
2793
|
+
* When set together with {@link captureState}, the add form shows a checkbox
|
|
2794
|
+
* with this label that controls whether state is captured for the next
|
|
2795
|
+
* bookmark. When omitted, {@link captureState} (if provided) always runs.
|
|
2796
|
+
*/
|
|
2797
|
+
captureStateLabel?: string;
|
|
2798
|
+
/**
|
|
2799
|
+
* Initial checked state of the {@link captureStateLabel} checkbox.
|
|
2800
|
+
* Default: true.
|
|
2801
|
+
*/
|
|
2802
|
+
captureStateDefault?: boolean;
|
|
2758
2803
|
}
|
|
2759
2804
|
/**
|
|
2760
2805
|
* Internal state of the BookmarkControl.
|
|
@@ -2772,7 +2817,7 @@ export interface BookmarkControlState {
|
|
|
2772
2817
|
/**
|
|
2773
2818
|
* BookmarkControl event types.
|
|
2774
2819
|
*/
|
|
2775
|
-
export type BookmarkEvent = ComponentEvent | "add" | "remove" | "select" | "rename" | "clear" | "import";
|
|
2820
|
+
export type BookmarkEvent = ComponentEvent | "add" | "remove" | "select" | "rename" | "clear" | "import" | "export" | "reorder";
|
|
2776
2821
|
/**
|
|
2777
2822
|
* BookmarkControl event handler function type.
|
|
2778
2823
|
*/
|