react-three-map 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -0
- package/{build/cjs/index.js.js → dist/cjs/main.js.js} +1 -1
- package/dist/es/main.js.mjs +5 -0
- package/dist/es/main.js.mjs.map +1 -0
- package/{build/es/index.js10.mjs → dist/es/main.js10.mjs} +4 -4
- package/dist/es/main.js10.mjs.map +1 -0
- package/{build/es/index.js11.mjs → dist/es/main.js11.mjs} +3 -3
- package/dist/es/main.js11.mjs.map +1 -0
- package/{build/es/index.js12.mjs → dist/es/main.js12.mjs} +3 -3
- package/dist/es/main.js12.mjs.map +1 -0
- package/{build/es/index.js13.mjs → dist/es/main.js13.mjs} +3 -3
- package/dist/es/main.js13.mjs.map +1 -0
- package/{build/es/index.js14.mjs → dist/es/main.js14.mjs} +3 -3
- package/dist/es/main.js14.mjs.map +1 -0
- package/{build/es/index.js15.mjs → dist/es/main.js15.mjs} +3 -3
- package/dist/es/main.js15.mjs.map +1 -0
- package/{build/es/index.js16.mjs → dist/es/main.js16.mjs} +2 -2
- package/dist/es/main.js16.mjs.map +1 -0
- package/{build/es/index.js17.mjs → dist/es/main.js17.mjs} +1 -1
- package/dist/es/main.js17.mjs.map +1 -0
- package/{build/es/index.js18.mjs → dist/es/main.js18.mjs} +1 -1
- package/dist/es/main.js18.mjs.map +1 -0
- package/{build/es/index.js19.mjs → dist/es/main.js19.mjs} +4 -4
- package/dist/es/main.js19.mjs.map +1 -0
- package/{build/es/index.js2.mjs → dist/es/main.js2.mjs} +6 -6
- package/dist/es/main.js2.mjs.map +1 -0
- package/{build/es/index.js20.mjs → dist/es/main.js20.mjs} +1 -1
- package/dist/es/main.js20.mjs.map +1 -0
- package/{build/es/index.js21.mjs → dist/es/main.js21.mjs} +1 -1
- package/dist/es/main.js21.mjs.map +1 -0
- package/{build/es/index.js22.mjs → dist/es/main.js22.mjs} +1 -1
- package/dist/es/main.js22.mjs.map +1 -0
- package/{build/es/index.js23.mjs → dist/es/main.js23.mjs} +1 -1
- package/dist/es/main.js23.mjs.map +1 -0
- package/{build/es/index.js24.mjs → dist/es/main.js24.mjs} +1 -1
- package/dist/es/main.js24.mjs.map +1 -0
- package/{build/es/index.js25.mjs → dist/es/main.js25.mjs} +2 -2
- package/dist/es/main.js25.mjs.map +1 -0
- package/{build/es/index.js26.mjs → dist/es/main.js26.mjs} +1 -1
- package/dist/es/main.js26.mjs.map +1 -0
- package/{build/es/index.js27.mjs → dist/es/main.js27.mjs} +1 -1
- package/dist/es/main.js27.mjs.map +1 -0
- package/{build/es/index.js28.mjs → dist/es/main.js28.mjs} +1 -1
- package/dist/es/main.js28.mjs.map +1 -0
- package/dist/es/main.js3.mjs +21 -0
- package/dist/es/main.js3.mjs.map +1 -0
- package/{build/es/index.js4.mjs → dist/es/main.js4.mjs} +1 -1
- package/dist/es/main.js4.mjs.map +1 -0
- package/{build/es/index.js5.mjs → dist/es/main.js5.mjs} +3 -3
- package/dist/es/main.js5.mjs.map +1 -0
- package/{build/es/index.js6.mjs → dist/es/main.js6.mjs} +4 -4
- package/dist/es/main.js6.mjs.map +1 -0
- package/{build/es/index.js7.mjs → dist/es/main.js7.mjs} +4 -4
- package/dist/es/main.js7.mjs.map +1 -0
- package/{build/es/index.js8.mjs → dist/es/main.js8.mjs} +6 -6
- package/dist/es/main.js8.mjs.map +1 -0
- package/{build/es/index.js9.mjs → dist/es/main.js9.mjs} +4 -4
- package/dist/es/main.js9.mjs.map +1 -0
- package/package.json +8 -7
- package/src/canvas/use-render.ts +1 -1
- package/src/stories/canvas.stories.tsx +1 -1
- package/src/stories/my-scene.tsx +6 -9
- package/src/stories/no-map.stories.tsx +2 -2
- package/build/es/index.js.mjs +0 -5
- package/build/es/index.js.mjs.map +0 -1
- package/build/es/index.js10.mjs.map +0 -1
- package/build/es/index.js11.mjs.map +0 -1
- package/build/es/index.js12.mjs.map +0 -1
- package/build/es/index.js13.mjs.map +0 -1
- package/build/es/index.js14.mjs.map +0 -1
- package/build/es/index.js15.mjs.map +0 -1
- package/build/es/index.js16.mjs.map +0 -1
- package/build/es/index.js17.mjs.map +0 -1
- package/build/es/index.js18.mjs.map +0 -1
- package/build/es/index.js19.mjs.map +0 -1
- package/build/es/index.js2.mjs.map +0 -1
- package/build/es/index.js20.mjs.map +0 -1
- package/build/es/index.js21.mjs.map +0 -1
- package/build/es/index.js22.mjs.map +0 -1
- package/build/es/index.js23.mjs.map +0 -1
- package/build/es/index.js24.mjs.map +0 -1
- package/build/es/index.js25.mjs.map +0 -1
- package/build/es/index.js26.mjs.map +0 -1
- package/build/es/index.js27.mjs.map +0 -1
- package/build/es/index.js28.mjs.map +0 -1
- package/build/es/index.js3.mjs +0 -21
- package/build/es/index.js3.mjs.map +0 -1
- package/build/es/index.js4.mjs.map +0 -1
- package/build/es/index.js5.mjs.map +0 -1
- package/build/es/index.js6.mjs.map +0 -1
- package/build/es/index.js7.mjs.map +0 -1
- package/build/es/index.js8.mjs.map +0 -1
- package/build/es/index.js9.mjs.map +0 -1
- package/build/vite.svg +0 -1
- /package/{build → dist}/cjs/vite.svg +0 -0
- /package/{build → dist}/es/vite.svg +0 -0
- /package/src/{index.ts → main.ts} +0 -0
package/README.md
CHANGED
|
@@ -7,6 +7,10 @@ React Three Map seamlessly integrates three.js with MapLibre and Mapbox using Re
|
|
|
7
7
|
|
|
8
8
|
This package offers a Three layer that allows you to use `@react-three/fiber` within `react-map-gl` and is compatible with both Mapbox and Maplibre.
|
|
9
9
|
|
|
10
|
+
## Examples
|
|
11
|
+
|
|
12
|
+
Check out our [stories](https://rodrigohamuy.github.io/react-three-map) to see it in action.
|
|
13
|
+
|
|
10
14
|
## Installation
|
|
11
15
|
|
|
12
16
|
You can install React Three Map via npm:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var K=Object.create;var j=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var te=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of J(t))!ee.call(e,r)&&r!==o&&j(e,r,{get:()=>t[r],enumerable:!(n=Y(t,r))||n.enumerable});return e};var ne=(e,t,o)=>(o=e!=null?K(X(e)):{},te(t||!e||!e.__esModule?j(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),A=require("@react-three/fiber"),l=require("react"),V=require("react-dom"),w=require("three"),oe=require("maplibre-gl");function G(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const M=G(l),re=G(w),$=M.createContext(null);function ie(){var e;const t=(e=l.useContext($))===null||e===void 0?void 0:e.maps,o=l.useContext(x);return l.useMemo(()=>({...t,current:o==null?void 0:o.map}),[t,o])}function ae(e){const t=e.clone();return t.pixelsToGLUnits=e.pixelsToGLUnits,t}function N(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function P(e,t){const o=t.viewState||t;let n=!1;if("longitude"in o&&"latitude"in o){const r=e.center;e.center=new r.constructor(o.longitude,o.latitude),n=n||r!==e.center}if("zoom"in o){const r=e.zoom;e.zoom=o.zoom,n=n||r!==e.zoom}if("bearing"in o){const r=e.bearing;e.bearing=o.bearing,n=n||r!==e.bearing}if("pitch"in o){const r=e.pitch;e.pitch=o.pitch,n=n||r!==e.pitch}return o.padding&&!e.isPaddingEqual(o.padding)&&(n=!0,e.padding=o.padding),n}const se=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function F(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const a of se)a in i&&(r[a]=i[a])}return r||n});return{...e,layers:o}}function ce(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function y(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!y(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!y(e[r],t[r]))return!1;return!0}return!1}const I={version:8,sources:{},layers:[]},D={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},T={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},U={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},le=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],ue=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class L{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=r=>{const i=this.props[U[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[D[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._onCameraEvent=r=>{if(!this._internalUpdate){const i=this.props[T[r.type]];i&&i(r)}r.type in this._deferredEvents&&(this._deferredEvents[r.type]=!1)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o);n&&this._createShadowTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,o),this._updateStyleComponents(t,o),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=L.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o;const a=r._resizeObserver;a&&(a.disconnect(),a.observe(o)),n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:s}=t;return s&&(s.bounds?r.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):n._updateViewState(s,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=I}=o,r={...o,...o.initialViewState,accessToken:o.mapboxAccessToken||fe()||null,container:t,style:F(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const f=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=f,o.gl)}const a=new this._MapClass(r);i.padding&&a.setPadding(i.padding),o.cursor&&(a.getCanvas().style.cursor=o.cursor),this._createShadowTransform(a);const s=a._render;a._render=f=>{this._inRender=!0,s.call(a,f),this._inRender=!1};const u=a._renderTaskQueue.run;a._renderTaskQueue.run=f=>{u.call(a._renderTaskQueue,f),this._onBeforeRepaint()},a.on("render",()=>this._onAfterRepaint());const c=a.fire;a.fire=this._fireEvent.bind(this,c),a.on("resize",()=>{this._renderTransform.resize(a.transform.width,a.transform.height)}),a.on("styledata",()=>this._updateStyleComponents(this.props,{})),a.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const f in D)a.on(f,this._onPointerEvent);for(const f in T)a.on(f,this._onCameraEvent);for(const f in U)a.on(f,this._onEvent);this._map=a}recycle(){const o=this.map.getContainer().querySelector("[mapboxgl-children]");o==null||o.remove(),L.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const o=ae(t.transform);t.painter.transform=o,this._renderTransform=o}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t,o){if(this._internalUpdate)return!1;const n=this._map,r=this._renderTransform,{zoom:i,pitch:a,bearing:s}=r,u=n.isMoving();u&&(r.cameraElevationReference="sea");const c=P(r,{...N(n.transform),...t});if(u&&(r.cameraElevationReference="ground"),c&&o){const f=this._deferredEvents;f.move=!0,f.zoom||(f.zoom=i!==r.zoom),f.rotate||(f.rotate=s!==r.bearing),f.pitch||(f.pitch=a!==r.pitch)}return u||P(n.transform,t),c}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of le)if(i in t&&!y(t[i],o[i])){r=!0;const a=n[`set${i[0].toUpperCase()}${i.slice(1)}`];a==null||a(t[i])}return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor),t.mapStyle!==o.mapStyle){const{mapStyle:n=I,styleDiffing:r=!0}=t,i={diff:r};return"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(F(n),i),!0}return!1}_updateStyleComponents(t,o){const n=this._map;let r=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!y(t.light,o.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!y(t.fog,o.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!y(t.terrain,o.terrain)&&(!t.terrain||n.getSource(t.terrain.source))&&(r=!0,n.setTerrain(t.terrain))),r}_updateHandlers(t,o){var n,r;const i=this._map;let a=!1;for(const s of ue){const u=(n=t[s])!==null&&n!==void 0?n:!0,c=(r=o[s])!==null&&r!==void 0?r:!0;y(u,c)||(a=!0,u?i[s].enable(u):i[s].disable())}return a}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const i=t.type,a=((o=this._hoveredFeatures)===null||o===void 0?void 0:o.length)>0,s=this._queryRenderedFeatures(t.point),u=s.length>0;!u&&a&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,u&&!a&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=i}else this._hoveredFeatures=null}_fireEvent(t,o,n){const r=this._map,i=r.transform,a=typeof o=="string"?o:o.type;return a==="move"&&this._updateViewState(this.props,!1),a in T&&(typeof o=="object"&&(o.viewState=N(i)),this._map.isMoving())?(r.transform=this._renderTransform,t.call(r,o,n),r.transform=i,r):(t.call(r,o,n),r)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const n in this._deferredEvents)this._deferredEvents[n]&&t.fire(n);this._internalUpdate=!1;const o=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=o}}}L.savedMaps=[];function fe(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const de=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function me(e){if(!e)return null;const t=e.map,o={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:n=>{const r=t.transform;t.transform=e.transform;const i=t.project(n);return t.transform=r,i},unproject:n=>{const r=t.transform;t.transform=e.transform;const i=t.unproject(n);return t.transform=r,i},queryTerrainElevation:(n,r)=>{const i=t.transform;t.transform=e.transform;const a=t.queryTerrainElevation(n,r);return t.transform=i,a}};for(const n of he(t))!(n in o)&&!de.includes(n)&&(o[n]=t[n].bind(t));return o}function he(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const ge=typeof document<"u"?l.useLayoutEffect:l.useEffect,ve=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function ye(e,t){for(const n of ve)n in t&&(e[n]=t[n]);const{RTLTextPlugin:o="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(o,n=>{n&&console.error(n)},!1)}const x=M.createContext(null);function pe(e,t,o){const n=l.useContext($),[r,i]=l.useState(null),a=l.useRef(),{current:s}=l.useRef({mapLib:null,map:null});l.useEffect(()=>{const f=e.mapLib;let d=!0,g;return Promise.resolve(f||o).then(p=>{if(!d)return;if(!p)throw new Error("Invalid mapLib");const h="Map"in p?p:p.default;if(!h.Map)throw new Error("Invalid mapLib");if(ye(h,e),!h.supported||h.supported(e))e.reuseMaps&&(g=L.reuse(e,a.current)),g||(g=new L(h.Map,e,a.current)),s.map=me(g),s.mapLib=h,i(g),n==null||n.onMapMount(s.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(p=>{const{onError:h}=e;h?h({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{d=!1,g&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?g.recycle():g.destroy())}},[]),ge(()=>{r&&r.setProps(e)}),l.useImperativeHandle(t,()=>s.map,[r]);const u=l.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return M.createElement("div",{id:e.id,ref:a,style:u},r&&M.createElement(x.Provider,{value:s},M.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const _e=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function b(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!_e.test(n)?o[n]=`${r}px`:o[n]=r}}function Ee(e,t){const{map:o,mapLib:n}=l.useContext(x),r=l.useRef({props:e});r.current.props=e;const i=l.useMemo(()=>{let O=!1;M.Children.forEach(e.children,_=>{_&&(O=!0)});const Q={...e,element:O?document.createElement("div"):null},C=new n.Marker(Q);return C.setLngLat([e.longitude,e.latitude]),C.getElement().addEventListener("click",_=>{var v,m;(m=(v=r.current.props).onClick)===null||m===void 0||m.call(v,{type:"click",target:C,originalEvent:_})}),C.on("dragstart",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDragStart)===null||m===void 0||m.call(v,E)}),C.on("drag",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDrag)===null||m===void 0||m.call(v,E)}),C.on("dragend",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDragEnd)===null||m===void 0||m.call(v,E)}),C},[]);l.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:a,latitude:s,offset:u,style:c,draggable:f=!1,popup:d=null,rotation:g=0,rotationAlignment:p="auto",pitchAlignment:h="auto"}=e;return l.useEffect(()=>{b(i.getElement(),c)},[c]),l.useImperativeHandle(t,()=>i,[]),(i.getLngLat().lng!==a||i.getLngLat().lat!==s)&&i.setLngLat([a,s]),u&&!ce(i.getOffset(),u)&&i.setOffset(u),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==g&&i.setRotation(g),i.getRotationAlignment()!==p&&i.setRotationAlignment(p),i.getPitchAlignment()!==h&&i.setPitchAlignment(h),i.getPopup()!==d&&i.setPopup(d),V.createPortal(e.children,i.getElement())}l.memo(l.forwardRef(Ee));function H(e){return new Set(e?e.trim().split(/\s+/):[])}function Ce(e,t){const{map:o,mapLib:n}=l.useContext(x),r=l.useMemo(()=>document.createElement("div"),[]),i=l.useRef({props:e});i.current.props=e;const a=l.useMemo(()=>{const s={...e},u=new n.Popup(s);return u.setLngLat([e.longitude,e.latitude]),u.once("open",c=>{var f,d;(d=(f=i.current.props).onOpen)===null||d===void 0||d.call(f,c)}),u},[]);if(l.useEffect(()=>{const s=u=>{var c,f;(f=(c=i.current.props).onClose)===null||f===void 0||f.call(c,u)};return a.on("close",s),a.setDOMContent(r).addTo(o.getMap()),()=>{a.off("close",s),a.isOpen()&&a.remove()}},[]),l.useEffect(()=>{b(a.getElement(),e.style)},[e.style]),l.useImperativeHandle(t,()=>a,[]),a.isOpen()&&((a.getLngLat().lng!==e.longitude||a.getLngLat().lat!==e.latitude)&&a.setLngLat([e.longitude,e.latitude]),e.offset&&!y(a.options.offset,e.offset)&&a.setOffset(e.offset),(a.options.anchor!==e.anchor||a.options.maxWidth!==e.maxWidth)&&(a.options.anchor=e.anchor,a.setMaxWidth(e.maxWidth)),a.options.className!==e.className)){const s=H(a.options.className),u=H(e.className);for(const c of s)u.has(c)||a.removeClassName(c);for(const c of u)s.has(c)||a.addClassName(c);a.options.className=e.className}return V.createPortal(e.children,r)}l.memo(l.forwardRef(Ce));function S(e,t,o,n){const r=l.useContext(x),i=l.useMemo(()=>e(r),[]);return l.useEffect(()=>{const a=n||o||t,s=typeof t=="function"&&typeof o=="function"?t:null,u=typeof o=="function"?o:typeof t=="function"?t:null,{map:c}=r;return c.hasControl(i)||(c.addControl(i,a==null?void 0:a.position),s&&s(r)),()=>{u&&u(r),c.hasControl(i)&&c.removeControl(i)}},[]),i}function Me(e){const t=S(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return l.useEffect(()=>{b(t._container,e.style)},[e.style]),null}l.memo(Me);function be(e){const t=S(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return l.useEffect(()=>{b(t._controlContainer,e.style)},[e.style]),null}l.memo(be);function Le(e,t){const o=l.useRef({props:e}),n=S(({mapLib:r})=>{const i=new r.GeolocateControl(e),a=i._setupUI;return i._setupUI=s=>{i._container.hasChildNodes()||a(s)},i.on("geolocate",s=>{var u,c;(c=(u=o.current.props).onGeolocate)===null||c===void 0||c.call(u,s)}),i.on("error",s=>{var u,c;(c=(u=o.current.props).onError)===null||c===void 0||c.call(u,s)}),i.on("outofmaxbounds",s=>{var u,c;(c=(u=o.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(u,s)}),i.on("trackuserlocationstart",s=>{var u,c;(c=(u=o.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(u,s)}),i.on("trackuserlocationend",s=>{var u,c;(c=(u=o.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(u,s)}),i},{position:e.position});return o.current.props=e,l.useImperativeHandle(t,()=>n,[]),l.useEffect(()=>{b(n._container,e.style)},[e.style]),null}l.memo(l.forwardRef(Le));function we(e){const t=S(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return l.useEffect(()=>{b(t._container,e.style)},[e.style]),null}l.memo(we);function xe(e){const t=S(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=l.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),l.useEffect(()=>{b(t._container,r)},[r]),null}l.memo(xe);function q(e,t){if(!e)throw new Error(t)}function Se(e,t,o,n){if(q(o.id===n.id,"layer id changed"),q(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:a,minzoom:s,maxzoom:u,beforeId:c}=o;if(c!==n.beforeId&&e.moveLayer(t,c),r!==n.layout){const f=n.layout||{};for(const d in r)y(r[d],f[d])||e.setLayoutProperty(t,d,r[d]);for(const d in f)r.hasOwnProperty(d)||e.setLayoutProperty(t,d,void 0)}if(i!==n.paint){const f=n.paint||{};for(const d in i)y(i[d],f[d])||e.setPaintProperty(t,d,i[d]);for(const d in f)i.hasOwnProperty(d)||e.setPaintProperty(t,d,void 0)}y(a,n.filter)||e.setFilter(t,a),(s!==n.minzoom||u!==n.maxzoom)&&e.setLayerZoomRange(t,s,u)}function Re(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let Te=0;function ze(e){const t=l.useContext(x).map.getMap(),o=l.useRef(e),[,n]=l.useState(0),r=l.useMemo(()=>e.id||`jsx-layer-${Te++}`,[]);if(l.useEffect(()=>{if(t){const a=()=>n(s=>s+1);return t.on("styledata",a),a(),()=>{t.off("styledata",a),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{Se(t,r,e,o.current)}catch(a){console.warn(a)}else Re(t,r,e);return o.current=e,null}function ke(){return ie()}const Ae=import("maplibre-gl");M.forwardRef(function(t,o){return pe(t,o,Ae)});const W=new w.Quaternion,Oe=new w.Euler,Z=new w.Vector3,B=new w.Vector3;function je({longitude:e,latitude:t,altitude:o}){const n=oe.MercatorCoordinate.fromLngLat([e,t],o),r=n.meterInMercatorCoordinateUnits();return Z.set(n.x,n.y,n.z||0),B.set(r,-r,r),W.setFromEuler(Oe.set(-Math.PI*.5,0,0)),new w.Matrix4().compose(Z,W,B)}const z={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Ne(){return e=>{const{handlePointer:t}=A.createEvents(e);return{priority:1,enabled:!0,compute(o,n){n.size.width=n.gl.domElement.width,n.size.height=n.gl.domElement.height,n.pointer.x=o.offsetX/(n.size.width/window.devicePixelRatio)*2-1,n.pointer.y=1-o.offsetY/(n.size.height/window.devicePixelRatio)*2,n.raycaster.camera=n.camera,n.raycaster.ray.origin.setScalar(0).applyMatrix4(n.camera.projectionMatrixInverse),n.raycaster.ray.direction.set(n.pointer.x,n.pointer.y,1).applyMatrix4(n.camera.projectionMatrixInverse).sub(n.raycaster.ray.origin).normalize()},connected:void 0,handlers:Object.keys(z).reduce((o,n)=>({...o,[n]:t(n)}),{}),update:()=>{var r;const{events:o,internal:n}=e.getState();(r=n.lastEvent)!=null&&r.current&&o.handlers&&o.handlers.onPointerMove(n.lastEvent.current)},connect:o=>{var i;const{set:n,events:r}=e.getState();(i=r.disconnect)==null||i.call(r),n(a=>({events:{...a.events,connected:o}})),Object.entries(r.handlers??[]).forEach(([a,s])=>{const[u,c]=z[a];o.addEventListener(u,s,{passive:c})})},disconnect:()=>{const{set:o,events:n}=e.getState();n.connected&&(Object.entries(n.handlers??[]).forEach(([r,i])=>{if(n&&n.connected instanceof HTMLElement){const[a]=z[r];n.connected.removeEventListener(a,i)}}),o(r=>({events:{...r.events,connected:void 0}})))}}}}const k=e=>{const t=l.useRef(e);return t.current=e,l.useCallback((...o)=>t.current(...o),[])};function Pe(e,t){const[o,n]=l.useState(!1),r=k((a,s)=>{const u=a.getCanvas(),c=A.createRoot(u);c.configure({frameloop:"never",dpr:window.devicePixelRatio,shadows:!0,events:Ne(),...t,gl:{context:s,depth:!0,autoClear:!1,antialias:!0,...t==null?void 0:t.gl},onCreated:f=>{e.current={state:f,map:a,root:c},f.gl.forceContextLoss=()=>{}},camera:{matrixAutoUpdate:!1},size:{width:u.clientWidth,height:u.clientHeight,top:0,left:0,...t==null?void 0:t.size}}),e.current={map:a,root:c},setTimeout(()=>n(!0))}),i=k(()=>{setTimeout(()=>{e.current&&e.current.root.unmount()})});return{onAdd:r,onRemove:i,mounted:o}}function Fe(e,t){const o=ke();return k((r,i)=>{var c;if(!o.current||!((c=t.current)!=null&&c.state))return;const a=t.current.state.camera,s=t.current.state.gl,u=t.current.state.advance;a.projectionMatrix.fromArray(i).multiply(e),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),s.resetState(),u(Date.now(),!0),o.current.triggerRepaint()})}A.extend(re);const Ie=l.memo(({longitude:e,latitude:t,altitude:o=0,children:n,...r})=>{const i=l.useId(),a=l.useRef(),s=l.useMemo(()=>je({latitude:t,longitude:e,altitude:o}),[t,e,o]),{onAdd:u,onRemove:c,mounted:f}=Pe(a,r),d=Fe(s,a);return l.useEffect(()=>{f&&a.current&&a.current.root.render(R.jsx(R.Fragment,{children:n}))},[a,f,n]),R.jsx(ze,{id:i,type:"custom",renderingMode:"3d",onAdd:u,onRemove:c,render:d})});exports.Canvas=Ie;
|
|
1
|
+
"use strict";var K=Object.create;var j=Object.defineProperty;var Y=Object.getOwnPropertyDescriptor;var J=Object.getOwnPropertyNames;var X=Object.getPrototypeOf,ee=Object.prototype.hasOwnProperty;var te=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of J(t))!ee.call(e,r)&&r!==o&&j(e,r,{get:()=>t[r],enumerable:!(n=Y(t,r))||n.enumerable});return e};var ne=(e,t,o)=>(o=e!=null?K(X(e)):{},te(t||!e||!e.__esModule?j(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const R=require("react/jsx-runtime"),A=require("@react-three/fiber"),l=require("react"),V=require("react-dom"),w=require("three"),oe=require("maplibre-gl");function G(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const o in e)if(o!=="default"){const n=Object.getOwnPropertyDescriptor(e,o);Object.defineProperty(t,o,n.get?n:{enumerable:!0,get:()=>e[o]})}}return t.default=e,Object.freeze(t)}const M=G(l),re=G(w),$=M.createContext(null);function ie(){var e;const t=(e=l.useContext($))===null||e===void 0?void 0:e.maps,o=l.useContext(x);return l.useMemo(()=>({...t,current:o==null?void 0:o.map}),[t,o])}function ae(e){const t=e.clone();return t.pixelsToGLUnits=e.pixelsToGLUnits,t}function N(e){return{longitude:e.center.lng,latitude:e.center.lat,zoom:e.zoom,pitch:e.pitch,bearing:e.bearing,padding:e.padding}}function P(e,t){const o=t.viewState||t;let n=!1;if("longitude"in o&&"latitude"in o){const r=e.center;e.center=new r.constructor(o.longitude,o.latitude),n=n||r!==e.center}if("zoom"in o){const r=e.zoom;e.zoom=o.zoom,n=n||r!==e.zoom}if("bearing"in o){const r=e.bearing;e.bearing=o.bearing,n=n||r!==e.bearing}if("pitch"in o){const r=e.pitch;e.pitch=o.pitch,n=n||r!==e.pitch}return o.padding&&!e.isPaddingEqual(o.padding)&&(n=!0,e.padding=o.padding),n}const se=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function F(e){if(!e)return null;if(typeof e=="string"||("toJS"in e&&(e=e.toJS()),!e.layers))return e;const t={};for(const n of e.layers)t[n.id]=n;const o=e.layers.map(n=>{let r=null;"interactive"in n&&(r=Object.assign({},n),delete r.interactive);const i=t[n.ref];if(i){r=r||Object.assign({},n),delete r.ref;for(const a of se)a in i&&(r[a]=i[a])}return r||n});return{...e,layers:o}}function ce(e,t){const o=Array.isArray(e)?e[0]:e?e.x:0,n=Array.isArray(e)?e[1]:e?e.y:0,r=Array.isArray(t)?t[0]:t?t.x:0,i=Array.isArray(t)?t[1]:t?t.y:0;return o===r&&n===i}function y(e,t){if(e===t)return!0;if(!e||!t)return!1;if(Array.isArray(e)){if(!Array.isArray(t)||e.length!==t.length)return!1;for(let o=0;o<e.length;o++)if(!y(e[o],t[o]))return!1;return!0}else if(Array.isArray(t))return!1;if(typeof e=="object"&&typeof t=="object"){const o=Object.keys(e),n=Object.keys(t);if(o.length!==n.length)return!1;for(const r of o)if(!t.hasOwnProperty(r)||!y(e[r],t[r]))return!1;return!0}return!1}const I={version:8,sources:{},layers:[]},D={mousedown:"onMouseDown",mouseup:"onMouseUp",mouseover:"onMouseOver",mousemove:"onMouseMove",click:"onClick",dblclick:"onDblClick",mouseenter:"onMouseEnter",mouseleave:"onMouseLeave",mouseout:"onMouseOut",contextmenu:"onContextMenu",touchstart:"onTouchStart",touchend:"onTouchEnd",touchmove:"onTouchMove",touchcancel:"onTouchCancel"},T={movestart:"onMoveStart",move:"onMove",moveend:"onMoveEnd",dragstart:"onDragStart",drag:"onDrag",dragend:"onDragEnd",zoomstart:"onZoomStart",zoom:"onZoom",zoomend:"onZoomEnd",rotatestart:"onRotateStart",rotate:"onRotate",rotateend:"onRotateEnd",pitchstart:"onPitchStart",pitch:"onPitch",pitchend:"onPitchEnd"},U={wheel:"onWheel",boxzoomstart:"onBoxZoomStart",boxzoomend:"onBoxZoomEnd",boxzoomcancel:"onBoxZoomCancel",resize:"onResize",load:"onLoad",render:"onRender",idle:"onIdle",remove:"onRemove",data:"onData",styledata:"onStyleData",sourcedata:"onSourceData",error:"onError"},le=["minZoom","maxZoom","minPitch","maxPitch","maxBounds","projection","renderWorldCopies"],ue=["scrollZoom","boxZoom","dragRotate","dragPan","keyboard","doubleClickZoom","touchZoomRotate","touchPitch"];class L{constructor(t,o,n){this._map=null,this._internalUpdate=!1,this._inRender=!1,this._hoveredFeatures=null,this._deferredEvents={move:!1,zoom:!1,pitch:!1,rotate:!1},this._onEvent=r=>{const i=this.props[U[r.type]];i?i(r):r.type==="error"&&console.error(r.error)},this._onPointerEvent=r=>{(r.type==="mousemove"||r.type==="mouseout")&&this._updateHover(r);const i=this.props[D[r.type]];i&&(this.props.interactiveLayerIds&&r.type!=="mouseover"&&r.type!=="mouseout"&&(r.features=this._hoveredFeatures||this._queryRenderedFeatures(r.point)),i(r),delete r.features)},this._onCameraEvent=r=>{if(!this._internalUpdate){const i=this.props[T[r.type]];i&&i(r)}r.type in this._deferredEvents&&(this._deferredEvents[r.type]=!1)},this._MapClass=t,this.props=o,this._initialize(n)}get map(){return this._map}get transform(){return this._renderTransform}setProps(t){const o=this.props;this.props=t;const n=this._updateSettings(t,o);n&&this._createShadowTransform(this._map);const r=this._updateSize(t),i=this._updateViewState(t,!0);this._updateStyle(t,o),this._updateStyleComponents(t,o),this._updateHandlers(t,o),(n||r||i&&!this._map.isMoving())&&this.redraw()}static reuse(t,o){const n=L.savedMaps.pop();if(!n)return null;const r=n.map,i=r.getContainer();for(o.className=i.className;i.childNodes.length>0;)o.appendChild(i.childNodes[0]);r._container=o;const a=r._resizeObserver;a&&(a.disconnect(),a.observe(o)),n.setProps({...t,styleDiffing:!1}),r.resize();const{initialViewState:s}=t;return s&&(s.bounds?r.fitBounds(s.bounds,{...s.fitBoundsOptions,duration:0}):n._updateViewState(s,!1)),r.isStyleLoaded()?r.fire("load"):r.once("styledata",()=>r.fire("load")),r._update(),n}_initialize(t){const{props:o}=this,{mapStyle:n=I}=o,r={...o,...o.initialViewState,accessToken:o.mapboxAccessToken||fe()||null,container:t,style:F(n)},i=r.initialViewState||r.viewState||r;if(Object.assign(r,{center:[i.longitude||0,i.latitude||0],zoom:i.zoom||0,pitch:i.pitch||0,bearing:i.bearing||0}),o.gl){const f=HTMLCanvasElement.prototype.getContext;HTMLCanvasElement.prototype.getContext=()=>(HTMLCanvasElement.prototype.getContext=f,o.gl)}const a=new this._MapClass(r);i.padding&&a.setPadding(i.padding),o.cursor&&(a.getCanvas().style.cursor=o.cursor),this._createShadowTransform(a);const s=a._render;a._render=f=>{this._inRender=!0,s.call(a,f),this._inRender=!1};const u=a._renderTaskQueue.run;a._renderTaskQueue.run=f=>{u.call(a._renderTaskQueue,f),this._onBeforeRepaint()},a.on("render",()=>this._onAfterRepaint());const c=a.fire;a.fire=this._fireEvent.bind(this,c),a.on("resize",()=>{this._renderTransform.resize(a.transform.width,a.transform.height)}),a.on("styledata",()=>this._updateStyleComponents(this.props,{})),a.on("sourcedata",()=>this._updateStyleComponents(this.props,{}));for(const f in D)a.on(f,this._onPointerEvent);for(const f in T)a.on(f,this._onCameraEvent);for(const f in U)a.on(f,this._onEvent);this._map=a}recycle(){const o=this.map.getContainer().querySelector("[mapboxgl-children]");o==null||o.remove(),L.savedMaps.push(this)}destroy(){this._map.remove()}redraw(){const t=this._map;!this._inRender&&t.style&&(t._frame&&(t._frame.cancel(),t._frame=null),t._render())}_createShadowTransform(t){const o=ae(t.transform);t.painter.transform=o,this._renderTransform=o}_updateSize(t){const{viewState:o}=t;if(o){const n=this._map;if(o.width!==n.transform.width||o.height!==n.transform.height)return n.resize(),!0}return!1}_updateViewState(t,o){if(this._internalUpdate)return!1;const n=this._map,r=this._renderTransform,{zoom:i,pitch:a,bearing:s}=r,u=n.isMoving();u&&(r.cameraElevationReference="sea");const c=P(r,{...N(n.transform),...t});if(u&&(r.cameraElevationReference="ground"),c&&o){const f=this._deferredEvents;f.move=!0,f.zoom||(f.zoom=i!==r.zoom),f.rotate||(f.rotate=s!==r.bearing),f.pitch||(f.pitch=a!==r.pitch)}return u||P(n.transform,t),c}_updateSettings(t,o){const n=this._map;let r=!1;for(const i of le)if(i in t&&!y(t[i],o[i])){r=!0;const a=n[`set${i[0].toUpperCase()}${i.slice(1)}`];a==null||a(t[i])}return r}_updateStyle(t,o){if(t.cursor!==o.cursor&&(this._map.getCanvas().style.cursor=t.cursor),t.mapStyle!==o.mapStyle){const{mapStyle:n=I,styleDiffing:r=!0}=t,i={diff:r};return"localIdeographFontFamily"in t&&(i.localIdeographFontFamily=t.localIdeographFontFamily),this._map.setStyle(F(n),i),!0}return!1}_updateStyleComponents(t,o){const n=this._map;let r=!1;return n.isStyleLoaded()&&("light"in t&&n.setLight&&!y(t.light,o.light)&&(r=!0,n.setLight(t.light)),"fog"in t&&n.setFog&&!y(t.fog,o.fog)&&(r=!0,n.setFog(t.fog)),"terrain"in t&&n.setTerrain&&!y(t.terrain,o.terrain)&&(!t.terrain||n.getSource(t.terrain.source))&&(r=!0,n.setTerrain(t.terrain))),r}_updateHandlers(t,o){var n,r;const i=this._map;let a=!1;for(const s of ue){const u=(n=t[s])!==null&&n!==void 0?n:!0,c=(r=o[s])!==null&&r!==void 0?r:!0;y(u,c)||(a=!0,u?i[s].enable(u):i[s].disable())}return a}_queryRenderedFeatures(t){const o=this._map,{interactiveLayerIds:n=[]}=this.props;try{return o.queryRenderedFeatures(t,{layers:n.filter(o.getLayer.bind(o))})}catch{return[]}}_updateHover(t){var o;const{props:n}=this;if(n.interactiveLayerIds&&(n.onMouseMove||n.onMouseEnter||n.onMouseLeave)){const i=t.type,a=((o=this._hoveredFeatures)===null||o===void 0?void 0:o.length)>0,s=this._queryRenderedFeatures(t.point),u=s.length>0;!u&&a&&(t.type="mouseleave",this._onPointerEvent(t)),this._hoveredFeatures=s,u&&!a&&(t.type="mouseenter",this._onPointerEvent(t)),t.type=i}else this._hoveredFeatures=null}_fireEvent(t,o,n){const r=this._map,i=r.transform,a=typeof o=="string"?o:o.type;return a==="move"&&this._updateViewState(this.props,!1),a in T&&(typeof o=="object"&&(o.viewState=N(i)),this._map.isMoving())?(r.transform=this._renderTransform,t.call(r,o,n),r.transform=i,r):(t.call(r,o,n),r)}_onBeforeRepaint(){const t=this._map;this._internalUpdate=!0;for(const n in this._deferredEvents)this._deferredEvents[n]&&t.fire(n);this._internalUpdate=!1;const o=this._map.transform;this._map.transform=this._renderTransform,this._onAfterRepaint=()=>{this._map.transform=o}}}L.savedMaps=[];function fe(){let e=null;if(typeof location<"u"){const t=/access_token=([^&\/]*)/.exec(location.search);e=t&&t[1]}try{e=e||process.env.MapboxAccessToken}catch{}try{e=e||process.env.REACT_APP_MAPBOX_ACCESS_TOKEN}catch{}return e}const de=["setMaxBounds","setMinZoom","setMaxZoom","setMinPitch","setMaxPitch","setRenderWorldCopies","setProjection","setStyle","addSource","removeSource","addLayer","removeLayer","setLayerZoomRange","setFilter","setPaintProperty","setLayoutProperty","setLight","setTerrain","setFog","remove"];function me(e){if(!e)return null;const t=e.map,o={getMap:()=>t,getCenter:()=>e.transform.center,getZoom:()=>e.transform.zoom,getBearing:()=>e.transform.bearing,getPitch:()=>e.transform.pitch,getPadding:()=>e.transform.padding,getBounds:()=>e.transform.getBounds(),project:n=>{const r=t.transform;t.transform=e.transform;const i=t.project(n);return t.transform=r,i},unproject:n=>{const r=t.transform;t.transform=e.transform;const i=t.unproject(n);return t.transform=r,i},queryTerrainElevation:(n,r)=>{const i=t.transform;t.transform=e.transform;const a=t.queryTerrainElevation(n,r);return t.transform=i,a}};for(const n of he(t))!(n in o)&&!de.includes(n)&&(o[n]=t[n].bind(t));return o}function he(e){const t=new Set;let o=e;for(;o;){for(const n of Object.getOwnPropertyNames(o))n[0]!=="_"&&typeof e[n]=="function"&&n!=="fire"&&n!=="setEventedParent"&&t.add(n);o=Object.getPrototypeOf(o)}return Array.from(t)}const ge=typeof document<"u"?l.useLayoutEffect:l.useEffect,ve=["baseApiUrl","maxParallelImageRequests","workerClass","workerCount","workerUrl"];function ye(e,t){for(const n of ve)n in t&&(e[n]=t[n]);const{RTLTextPlugin:o="https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js"}=t;o&&e.getRTLTextPluginStatus&&e.getRTLTextPluginStatus()==="unavailable"&&e.setRTLTextPlugin(o,n=>{n&&console.error(n)},!1)}const x=M.createContext(null);function pe(e,t,o){const n=l.useContext($),[r,i]=l.useState(null),a=l.useRef(),{current:s}=l.useRef({mapLib:null,map:null});l.useEffect(()=>{const f=e.mapLib;let d=!0,g;return Promise.resolve(f||o).then(p=>{if(!d)return;if(!p)throw new Error("Invalid mapLib");const h="Map"in p?p:p.default;if(!h.Map)throw new Error("Invalid mapLib");if(ye(h,e),!h.supported||h.supported(e))e.reuseMaps&&(g=L.reuse(e,a.current)),g||(g=new L(h.Map,e,a.current)),s.map=me(g),s.mapLib=h,i(g),n==null||n.onMapMount(s.map,e.id);else throw new Error("Map is not supported by this browser")}).catch(p=>{const{onError:h}=e;h?h({type:"error",target:null,originalEvent:null,error:p}):console.error(p)}),()=>{d=!1,g&&(n==null||n.onMapUnmount(e.id),e.reuseMaps?g.recycle():g.destroy())}},[]),ge(()=>{r&&r.setProps(e)}),l.useImperativeHandle(t,()=>s.map,[r]);const u=l.useMemo(()=>({position:"relative",width:"100%",height:"100%",...e.style}),[e.style]),c={height:"100%"};return M.createElement("div",{id:e.id,ref:a,style:u},r&&M.createElement(x.Provider,{value:s},M.createElement("div",{"mapboxgl-children":"",style:c},e.children)))}const _e=/box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;function b(e,t){if(!e||!t)return;const o=e.style;for(const n in t){const r=t[n];Number.isFinite(r)&&!_e.test(n)?o[n]=`${r}px`:o[n]=r}}function Ee(e,t){const{map:o,mapLib:n}=l.useContext(x),r=l.useRef({props:e});r.current.props=e;const i=l.useMemo(()=>{let O=!1;M.Children.forEach(e.children,_=>{_&&(O=!0)});const Q={...e,element:O?document.createElement("div"):null},C=new n.Marker(Q);return C.setLngLat([e.longitude,e.latitude]),C.getElement().addEventListener("click",_=>{var v,m;(m=(v=r.current.props).onClick)===null||m===void 0||m.call(v,{type:"click",target:C,originalEvent:_})}),C.on("dragstart",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDragStart)===null||m===void 0||m.call(v,E)}),C.on("drag",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDrag)===null||m===void 0||m.call(v,E)}),C.on("dragend",_=>{var v,m;const E=_;E.lngLat=i.getLngLat(),(m=(v=r.current.props).onDragEnd)===null||m===void 0||m.call(v,E)}),C},[]);l.useEffect(()=>(i.addTo(o.getMap()),()=>{i.remove()}),[]);const{longitude:a,latitude:s,offset:u,style:c,draggable:f=!1,popup:d=null,rotation:g=0,rotationAlignment:p="auto",pitchAlignment:h="auto"}=e;return l.useEffect(()=>{b(i.getElement(),c)},[c]),l.useImperativeHandle(t,()=>i,[]),(i.getLngLat().lng!==a||i.getLngLat().lat!==s)&&i.setLngLat([a,s]),u&&!ce(i.getOffset(),u)&&i.setOffset(u),i.isDraggable()!==f&&i.setDraggable(f),i.getRotation()!==g&&i.setRotation(g),i.getRotationAlignment()!==p&&i.setRotationAlignment(p),i.getPitchAlignment()!==h&&i.setPitchAlignment(h),i.getPopup()!==d&&i.setPopup(d),V.createPortal(e.children,i.getElement())}l.memo(l.forwardRef(Ee));function H(e){return new Set(e?e.trim().split(/\s+/):[])}function Ce(e,t){const{map:o,mapLib:n}=l.useContext(x),r=l.useMemo(()=>document.createElement("div"),[]),i=l.useRef({props:e});i.current.props=e;const a=l.useMemo(()=>{const s={...e},u=new n.Popup(s);return u.setLngLat([e.longitude,e.latitude]),u.once("open",c=>{var f,d;(d=(f=i.current.props).onOpen)===null||d===void 0||d.call(f,c)}),u},[]);if(l.useEffect(()=>{const s=u=>{var c,f;(f=(c=i.current.props).onClose)===null||f===void 0||f.call(c,u)};return a.on("close",s),a.setDOMContent(r).addTo(o.getMap()),()=>{a.off("close",s),a.isOpen()&&a.remove()}},[]),l.useEffect(()=>{b(a.getElement(),e.style)},[e.style]),l.useImperativeHandle(t,()=>a,[]),a.isOpen()&&((a.getLngLat().lng!==e.longitude||a.getLngLat().lat!==e.latitude)&&a.setLngLat([e.longitude,e.latitude]),e.offset&&!y(a.options.offset,e.offset)&&a.setOffset(e.offset),(a.options.anchor!==e.anchor||a.options.maxWidth!==e.maxWidth)&&(a.options.anchor=e.anchor,a.setMaxWidth(e.maxWidth)),a.options.className!==e.className)){const s=H(a.options.className),u=H(e.className);for(const c of s)u.has(c)||a.removeClassName(c);for(const c of u)s.has(c)||a.addClassName(c);a.options.className=e.className}return V.createPortal(e.children,r)}l.memo(l.forwardRef(Ce));function S(e,t,o,n){const r=l.useContext(x),i=l.useMemo(()=>e(r),[]);return l.useEffect(()=>{const a=n||o||t,s=typeof t=="function"&&typeof o=="function"?t:null,u=typeof o=="function"?o:typeof t=="function"?t:null,{map:c}=r;return c.hasControl(i)||(c.addControl(i,a==null?void 0:a.position),s&&s(r)),()=>{u&&u(r),c.hasControl(i)&&c.removeControl(i)}},[]),i}function Me(e){const t=S(({mapLib:o})=>new o.AttributionControl(e),{position:e.position});return l.useEffect(()=>{b(t._container,e.style)},[e.style]),null}l.memo(Me);function be(e){const t=S(({mapLib:o})=>new o.FullscreenControl({container:e.containerId&&document.getElementById(e.containerId)}),{position:e.position});return l.useEffect(()=>{b(t._controlContainer,e.style)},[e.style]),null}l.memo(be);function Le(e,t){const o=l.useRef({props:e}),n=S(({mapLib:r})=>{const i=new r.GeolocateControl(e),a=i._setupUI;return i._setupUI=s=>{i._container.hasChildNodes()||a(s)},i.on("geolocate",s=>{var u,c;(c=(u=o.current.props).onGeolocate)===null||c===void 0||c.call(u,s)}),i.on("error",s=>{var u,c;(c=(u=o.current.props).onError)===null||c===void 0||c.call(u,s)}),i.on("outofmaxbounds",s=>{var u,c;(c=(u=o.current.props).onOutOfMaxBounds)===null||c===void 0||c.call(u,s)}),i.on("trackuserlocationstart",s=>{var u,c;(c=(u=o.current.props).onTrackUserLocationStart)===null||c===void 0||c.call(u,s)}),i.on("trackuserlocationend",s=>{var u,c;(c=(u=o.current.props).onTrackUserLocationEnd)===null||c===void 0||c.call(u,s)}),i},{position:e.position});return o.current.props=e,l.useImperativeHandle(t,()=>n,[]),l.useEffect(()=>{b(n._container,e.style)},[e.style]),null}l.memo(l.forwardRef(Le));function we(e){const t=S(({mapLib:o})=>new o.NavigationControl(e),{position:e.position});return l.useEffect(()=>{b(t._container,e.style)},[e.style]),null}l.memo(we);function xe(e){const t=S(({mapLib:i})=>new i.ScaleControl(e),{position:e.position}),o=l.useRef(e),n=o.current;o.current=e;const{style:r}=e;return e.maxWidth!==void 0&&e.maxWidth!==n.maxWidth&&(t.options.maxWidth=e.maxWidth),e.unit!==void 0&&e.unit!==n.unit&&t.setUnit(e.unit),l.useEffect(()=>{b(t._container,r)},[r]),null}l.memo(xe);function q(e,t){if(!e)throw new Error(t)}function Se(e,t,o,n){if(q(o.id===n.id,"layer id changed"),q(o.type===n.type,"layer type changed"),o.type==="custom"||n.type==="custom")return;const{layout:r={},paint:i={},filter:a,minzoom:s,maxzoom:u,beforeId:c}=o;if(c!==n.beforeId&&e.moveLayer(t,c),r!==n.layout){const f=n.layout||{};for(const d in r)y(r[d],f[d])||e.setLayoutProperty(t,d,r[d]);for(const d in f)r.hasOwnProperty(d)||e.setLayoutProperty(t,d,void 0)}if(i!==n.paint){const f=n.paint||{};for(const d in i)y(i[d],f[d])||e.setPaintProperty(t,d,i[d]);for(const d in f)i.hasOwnProperty(d)||e.setPaintProperty(t,d,void 0)}y(a,n.filter)||e.setFilter(t,a),(s!==n.minzoom||u!==n.maxzoom)&&e.setLayerZoomRange(t,s,u)}function Re(e,t,o){if(e.style&&e.style._loaded&&(!("source"in o)||e.getSource(o.source))){const n={...o,id:t};delete n.beforeId,e.addLayer(n,o.beforeId)}}let Te=0;function ze(e){const t=l.useContext(x).map.getMap(),o=l.useRef(e),[,n]=l.useState(0),r=l.useMemo(()=>e.id||`jsx-layer-${Te++}`,[]);if(l.useEffect(()=>{if(t){const a=()=>n(s=>s+1);return t.on("styledata",a),a(),()=>{t.off("styledata",a),t.style&&t.style._loaded&&t.getLayer(r)&&t.removeLayer(r)}}},[t]),t&&t.style&&t.getLayer(r))try{Se(t,r,e,o.current)}catch(a){console.warn(a)}else Re(t,r,e);return o.current=e,null}function ke(){return ie()}const Ae=import("maplibre-gl");M.forwardRef(function(t,o){return pe(t,o,Ae)});const W=new w.Quaternion,Oe=new w.Euler,Z=new w.Vector3,B=new w.Vector3;function je({longitude:e,latitude:t,altitude:o}){const n=oe.MercatorCoordinate.fromLngLat([e,t],o),r=n.meterInMercatorCoordinateUnits();return Z.set(n.x,n.y,n.z||0),B.set(r,-r,r),W.setFromEuler(Oe.set(-Math.PI*.5,0,0)),new w.Matrix4().compose(Z,W,B)}const z={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function Ne(){return e=>{const{handlePointer:t}=A.createEvents(e);return{priority:1,enabled:!0,compute(o,n){n.size.width=n.gl.domElement.width,n.size.height=n.gl.domElement.height,n.pointer.x=o.offsetX/(n.size.width/window.devicePixelRatio)*2-1,n.pointer.y=1-o.offsetY/(n.size.height/window.devicePixelRatio)*2,n.raycaster.camera=n.camera,n.raycaster.ray.origin.setScalar(0).applyMatrix4(n.camera.projectionMatrixInverse),n.raycaster.ray.direction.set(n.pointer.x,n.pointer.y,1).applyMatrix4(n.camera.projectionMatrixInverse).sub(n.raycaster.ray.origin).normalize()},connected:void 0,handlers:Object.keys(z).reduce((o,n)=>({...o,[n]:t(n)}),{}),update:()=>{var r;const{events:o,internal:n}=e.getState();(r=n.lastEvent)!=null&&r.current&&o.handlers&&o.handlers.onPointerMove(n.lastEvent.current)},connect:o=>{var i;const{set:n,events:r}=e.getState();(i=r.disconnect)==null||i.call(r),n(a=>({events:{...a.events,connected:o}})),Object.entries(r.handlers??[]).forEach(([a,s])=>{const[u,c]=z[a];o.addEventListener(u,s,{passive:c})})},disconnect:()=>{const{set:o,events:n}=e.getState();n.connected&&(Object.entries(n.handlers??[]).forEach(([r,i])=>{if(n&&n.connected instanceof HTMLElement){const[a]=z[r];n.connected.removeEventListener(a,i)}}),o(r=>({events:{...r.events,connected:void 0}})))}}}}const k=e=>{const t=l.useRef(e);return t.current=e,l.useCallback((...o)=>t.current(...o),[])};function Pe(e,t){const[o,n]=l.useState(!1),r=k((a,s)=>{const u=a.getCanvas(),c=A.createRoot(u);c.configure({frameloop:"never",dpr:window.devicePixelRatio,shadows:!0,events:Ne(),...t,gl:{context:s,depth:!0,autoClear:!1,antialias:!0,...t==null?void 0:t.gl},onCreated:f=>{e.current={state:f,map:a,root:c},f.gl.forceContextLoss=()=>{}},camera:{matrixAutoUpdate:!1},size:{width:u.clientWidth,height:u.clientHeight,top:0,left:0,...t==null?void 0:t.size}}),e.current={map:a,root:c},setTimeout(()=>n(!0))}),i=k(()=>{setTimeout(()=>{e.current&&e.current.root.unmount()})});return{onAdd:r,onRemove:i,mounted:o}}function Fe(e,t){const o=ke();return k((r,i)=>{var c;if(!o.current||!((c=t.current)!=null&&c.state))return;const a=t.current.state.camera,s=t.current.state.gl,u=t.current.state.advance;a.projectionMatrix.fromArray(i).multiply(e),a.projectionMatrixInverse.copy(a.projectionMatrix).invert(),s.resetState(),u(Date.now()*.001,!0),o.current.triggerRepaint()})}A.extend(re);const Ie=l.memo(({longitude:e,latitude:t,altitude:o=0,children:n,...r})=>{const i=l.useId(),a=l.useRef(),s=l.useMemo(()=>je({latitude:t,longitude:e,altitude:o}),[t,e,o]),{onAdd:u,onRemove:c,mounted:f}=Pe(a,r),d=Fe(s,a);return l.useEffect(()=>{f&&a.current&&a.current.root.render(R.jsx(R.Fragment,{children:n}))},[a,f,n]),R.jsx(ze,{id:i,type:"custom",renderingMode:"3d",onAdd:u,onRemove:c,render:d})});exports.Canvas=Ie;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createPortal as h } from "react-dom";
|
|
2
2
|
import { memo as L, forwardRef as v, useContext as C, useMemo as f, useRef as x, useEffect as m, useImperativeHandle as N } from "react";
|
|
3
|
-
import { applyReactStyle as M } from "./
|
|
4
|
-
import { MapContext as O } from "./
|
|
5
|
-
import { deepEqual as y } from "./
|
|
3
|
+
import { applyReactStyle as M } from "./main.js23.mjs";
|
|
4
|
+
import { MapContext as O } from "./main.js8.mjs";
|
|
5
|
+
import { deepEqual as y } from "./main.js24.mjs";
|
|
6
6
|
function r(t) {
|
|
7
7
|
return new Set(t ? t.trim().split(/\s+/) : []);
|
|
8
8
|
}
|
|
@@ -37,4 +37,4 @@ function E(t, u) {
|
|
|
37
37
|
return h(t.children, c);
|
|
38
38
|
}
|
|
39
39
|
L(v(E));
|
|
40
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=main.js10.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js10.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/popup.js"],"sourcesContent":["import { createPortal } from 'react-dom';\nimport { useImperativeHandle, useEffect, useMemo, useRef, useContext, forwardRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport { MapContext } from './map';\nimport { deepEqual } from '../utils/deep-equal';\n// Adapted from https://github.com/mapbox/mapbox-gl-js/blob/v1.13.0/src/ui/popup.js\nfunction getClassList(className) {\n return new Set(className ? className.trim().split(/\\s+/) : []);\n}\n/* eslint-disable complexity,max-statements */\nfunction Popup(props, ref) {\n const { map, mapLib } = useContext(MapContext);\n const container = useMemo(() => {\n return document.createElement('div');\n }, []);\n const thisRef = useRef({ props });\n thisRef.current.props = props;\n const popup = useMemo(() => {\n const options = { ...props };\n const pp = new mapLib.Popup(options);\n pp.setLngLat([props.longitude, props.latitude]);\n pp.once('open', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onOpen) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n return pp;\n }, []);\n useEffect(() => {\n const onClose = e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onClose) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n };\n popup.on('close', onClose);\n popup.setDOMContent(container).addTo(map.getMap());\n return () => {\n // https://github.com/visgl/react-map-gl/issues/1825\n // onClose should not be fired if the popup is removed by unmounting\n // When using React strict mode, the component is mounted twice.\n // Firing the onClose callback here would be a false signal to remove the component.\n popup.off('close', onClose);\n if (popup.isOpen()) {\n popup.remove();\n }\n };\n }, []);\n useEffect(() => {\n applyReactStyle(popup.getElement(), props.style);\n }, [props.style]);\n useImperativeHandle(ref, () => popup, []);\n if (popup.isOpen()) {\n if (popup.getLngLat().lng !== props.longitude || popup.getLngLat().lat !== props.latitude) {\n popup.setLngLat([props.longitude, props.latitude]);\n }\n if (props.offset && !deepEqual(popup.options.offset, props.offset)) {\n popup.setOffset(props.offset);\n }\n if (popup.options.anchor !== props.anchor || popup.options.maxWidth !== props.maxWidth) {\n popup.options.anchor = props.anchor;\n popup.setMaxWidth(props.maxWidth);\n }\n if (popup.options.className !== props.className) {\n const prevClassList = getClassList(popup.options.className);\n const nextClassList = getClassList(props.className);\n for (const c of prevClassList) {\n if (!nextClassList.has(c)) {\n popup.removeClassName(c);\n }\n }\n for (const c of nextClassList) {\n if (!prevClassList.has(c)) {\n popup.addClassName(c);\n }\n }\n popup.options.className = props.className;\n }\n }\n return createPortal(props.children, container);\n}\nexport default memo(forwardRef(Popup));\n//# sourceMappingURL=popup.js.map"],"names":["getClassList","className","Popup","props","ref","map","mapLib","useContext","MapContext","container","useMemo","thisRef","useRef","popup","options","pp","e","_a","_b","useEffect","onClose","applyReactStyle","useImperativeHandle","deepEqual","prevClassList","nextClassList","c","createPortal","memo","forwardRef"],"mappings":";;;;;AAMA,SAASA,EAAaC,GAAW;AAC7B,SAAO,IAAI,IAAIA,IAAYA,EAAU,KAAM,EAAC,MAAM,KAAK,IAAI,CAAA,CAAE;AACjE;AAEA,SAASC,EAAMC,GAAOC,GAAK;AACvB,QAAM,EAAE,KAAAC,GAAK,QAAAC,EAAQ,IAAGC,EAAWC,CAAU,GACvCC,IAAYC,EAAQ,MACf,SAAS,cAAc,KAAK,GACpC,CAAE,CAAA,GACCC,IAAUC,EAAO,EAAE,OAAAT,EAAO,CAAA;AAChC,EAAAQ,EAAQ,QAAQ,QAAQR;AACxB,QAAMU,IAAQH,EAAQ,MAAM;AACxB,UAAMI,IAAU,EAAE,GAAGX,KACfY,IAAK,IAAIT,EAAO,MAAMQ,CAAO;AACnC,WAAAC,EAAG,UAAU,CAACZ,EAAM,WAAWA,EAAM,QAAQ,CAAC,GAC9CY,EAAG,KAAK,QAAQ,CAAAC,MAAK;AACjB,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKN,EAAQ,QAAQ,OAAO,YAAY,QAAQO,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IACzG,CAAS,GACMD;AAAA,EACV,GAAE,CAAE,CAAA;AAuBL,MAtBAI,EAAU,MAAM;AACZ,UAAMC,IAAU,CAAAJ,MAAK;AACjB,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKN,EAAQ,QAAQ,OAAO,aAAa,QAAQO,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IAC1G;AACQ,WAAAH,EAAM,GAAG,SAASO,CAAO,GACzBP,EAAM,cAAcJ,CAAS,EAAE,MAAMJ,EAAI,OAAM,CAAE,GAC1C,MAAM;AAKT,MAAAQ,EAAM,IAAI,SAASO,CAAO,GACtBP,EAAM,YACNA,EAAM,OAAM;AAAA,IAE5B;AAAA,EACK,GAAE,CAAE,CAAA,GACLM,EAAU,MAAM;AACZ,IAAAE,EAAgBR,EAAM,WAAY,GAAEV,EAAM,KAAK;AAAA,EACvD,GAAO,CAACA,EAAM,KAAK,CAAC,GAChBmB,EAAoBlB,GAAK,MAAMS,GAAO,CAAE,CAAA,GACpCA,EAAM,cACFA,EAAM,YAAY,QAAQV,EAAM,aAAaU,EAAM,UAAW,EAAC,QAAQV,EAAM,aAC7EU,EAAM,UAAU,CAACV,EAAM,WAAWA,EAAM,QAAQ,CAAC,GAEjDA,EAAM,UAAU,CAACoB,EAAUV,EAAM,QAAQ,QAAQV,EAAM,MAAM,KAC7DU,EAAM,UAAUV,EAAM,MAAM,IAE5BU,EAAM,QAAQ,WAAWV,EAAM,UAAUU,EAAM,QAAQ,aAAaV,EAAM,cAC1EU,EAAM,QAAQ,SAASV,EAAM,QAC7BU,EAAM,YAAYV,EAAM,QAAQ,IAEhCU,EAAM,QAAQ,cAAcV,EAAM,YAAW;AAC7C,UAAMqB,IAAgBxB,EAAaa,EAAM,QAAQ,SAAS,GACpDY,IAAgBzB,EAAaG,EAAM,SAAS;AAClD,eAAWuB,KAAKF;AACZ,MAAKC,EAAc,IAAIC,CAAC,KACpBb,EAAM,gBAAgBa,CAAC;AAG/B,eAAWA,KAAKD;AACZ,MAAKD,EAAc,IAAIE,CAAC,KACpBb,EAAM,aAAaa,CAAC;AAG5B,IAAAb,EAAM,QAAQ,YAAYV,EAAM;AAAA;AAGxC,SAAOwB,EAAaxB,EAAM,UAAUM,CAAS;AACjD;AACemB,EAAKC,EAAW3B,CAAK,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as i, useEffect as r } from "react";
|
|
2
|
-
import { applyReactStyle as e } from "./
|
|
3
|
-
import l from "./
|
|
2
|
+
import { applyReactStyle as e } from "./main.js23.mjs";
|
|
3
|
+
import l from "./main.js25.mjs";
|
|
4
4
|
function m(t) {
|
|
5
5
|
const o = l(({ mapLib: n }) => new n.AttributionControl(t), {
|
|
6
6
|
position: t.position
|
|
@@ -10,4 +10,4 @@ function m(t) {
|
|
|
10
10
|
}, [t.style]), null;
|
|
11
11
|
}
|
|
12
12
|
i(m);
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=main.js11.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js11.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/attribution-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction AttributionControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.AttributionControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(AttributionControl);\n//# sourceMappingURL=attribution-control.js.map"],"names":["AttributionControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAmBC,GAAO;AAC/B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,mBAAmBH,CAAK,GAAG;AAAA,IAC1E,UAAUA,EAAM;AAAA,EACxB,CAAK;AACD,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,YAAYD,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAkB;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as o, useEffect as l } from "react";
|
|
2
|
-
import { applyReactStyle as r } from "./
|
|
3
|
-
import c from "./
|
|
2
|
+
import { applyReactStyle as r } from "./main.js23.mjs";
|
|
3
|
+
import c from "./main.js25.mjs";
|
|
4
4
|
function i(t) {
|
|
5
5
|
const n = c(({ mapLib: e }) => new e.FullscreenControl({
|
|
6
6
|
container: t.containerId && document.getElementById(t.containerId)
|
|
@@ -10,4 +10,4 @@ function i(t) {
|
|
|
10
10
|
}, [t.style]), null;
|
|
11
11
|
}
|
|
12
12
|
o(i);
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=main.js12.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js12.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/fullscreen-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction FullscreenControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.FullscreenControl({\n container: props.containerId && document.getElementById(props.containerId)\n }), { position: props.position });\n useEffect(() => {\n applyReactStyle(ctrl._controlContainer, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(FullscreenControl);\n//# sourceMappingURL=fullscreen-control.js.map"],"names":["FullscreenControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAkBC,GAAO;AAC9B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAM,MAAO,IAAIA,EAAO,kBAAkB;AAAA,IACjE,WAAWH,EAAM,eAAe,SAAS,eAAeA,EAAM,WAAW;AAAA,EAC5E,CAAA,GAAG,EAAE,UAAUA,EAAM,SAAU,CAAA;AAChC,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,mBAAmBD,EAAM,KAAK;AAAA,EAC3D,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAiB;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as s, forwardRef as d, useRef as v, useImperativeHandle as _, useEffect as f } from "react";
|
|
2
|
-
import { applyReactStyle as p } from "./
|
|
3
|
-
import m from "./
|
|
2
|
+
import { applyReactStyle as p } from "./main.js23.mjs";
|
|
3
|
+
import m from "./main.js25.mjs";
|
|
4
4
|
function b(e, c) {
|
|
5
5
|
const a = v({ props: e }), l = m(({ mapLib: i }) => {
|
|
6
6
|
const n = new i.GeolocateControl(e), u = n._setupUI;
|
|
@@ -28,4 +28,4 @@ function b(e, c) {
|
|
|
28
28
|
}, [e.style]), null;
|
|
29
29
|
}
|
|
30
30
|
s(d(b));
|
|
31
|
-
//# sourceMappingURL=
|
|
31
|
+
//# sourceMappingURL=main.js13.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js13.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/geolocate-control.js"],"sourcesContent":["import { useImperativeHandle, useRef, useEffect, forwardRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction GeolocateControl(props, ref) {\n const thisRef = useRef({ props });\n const ctrl = useControl(({ mapLib }) => {\n const gc = new mapLib.GeolocateControl(props);\n // Hack: fix GeolocateControl reuse\n // When using React strict mode, the component is mounted twice.\n // GeolocateControl's UI creation is asynchronous. Removing and adding it back causes the UI to be initialized twice.\n // @ts-expect-error private method\n const setupUI = gc._setupUI;\n // @ts-expect-error private method\n gc._setupUI = args => {\n if (!gc._container.hasChildNodes()) {\n setupUI(args);\n }\n };\n gc.on('geolocate', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onGeolocate) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('error', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onError) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('outofmaxbounds', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onOutOfMaxBounds) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('trackuserlocationstart', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onTrackUserLocationStart) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n gc.on('trackuserlocationend', e => {\n var _a, _b;\n (_b = (_a = thisRef.current.props).onTrackUserLocationEnd) === null || _b === void 0 ? void 0 : _b.call(_a, e);\n });\n return gc;\n }, { position: props.position });\n thisRef.current.props = props;\n useImperativeHandle(ref, () => ctrl, []);\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(forwardRef(GeolocateControl));\n//# sourceMappingURL=geolocate-control.js.map"],"names":["GeolocateControl","props","ref","thisRef","useRef","ctrl","useControl","mapLib","gc","setupUI","args","e","_a","_b","useImperativeHandle","useEffect","applyReactStyle","memo","forwardRef"],"mappings":";;;AAGA,SAASA,EAAiBC,GAAOC,GAAK;AAClC,QAAMC,IAAUC,EAAO,EAAE,OAAAH,EAAO,CAAA,GAC1BI,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAM,MAAO;AACpC,UAAMC,IAAK,IAAID,EAAO,iBAAiBN,CAAK,GAKtCQ,IAAUD,EAAG;AAEnB,WAAAA,EAAG,WAAW,CAAAE,MAAQ;AAClB,MAAKF,EAAG,WAAW,mBACfC,EAAQC,CAAI;AAAA,IAE5B,GACQF,EAAG,GAAG,aAAa,CAAAG,MAAK;AACpB,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKT,EAAQ,QAAQ,OAAO,iBAAiB,QAAQU,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IAC9G,CAAS,GACDH,EAAG,GAAG,SAAS,CAAAG,MAAK;AAChB,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKT,EAAQ,QAAQ,OAAO,aAAa,QAAQU,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IAC1G,CAAS,GACDH,EAAG,GAAG,kBAAkB,CAAAG,MAAK;AACzB,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKT,EAAQ,QAAQ,OAAO,sBAAsB,QAAQU,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IACnH,CAAS,GACDH,EAAG,GAAG,0BAA0B,CAAAG,MAAK;AACjC,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKT,EAAQ,QAAQ,OAAO,8BAA8B,QAAQU,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IAC3H,CAAS,GACDH,EAAG,GAAG,wBAAwB,CAAAG,MAAK;AAC/B,UAAIC,GAAIC;AACR,OAACA,KAAMD,IAAKT,EAAQ,QAAQ,OAAO,4BAA4B,QAAQU,MAAO,UAAkBA,EAAG,KAAKD,GAAID,CAAC;AAAA,IACzH,CAAS,GACMH;AAAA,EACV,GAAE,EAAE,UAAUP,EAAM,SAAU,CAAA;AAC/B,SAAAE,EAAQ,QAAQ,QAAQF,GACxBa,EAAoBZ,GAAK,MAAMG,GAAM,CAAE,CAAA,GACvCU,EAAU,MAAM;AACZ,IAAAC,EAAgBX,EAAK,YAAYJ,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACegB,EAAKC,EAAWlB,CAAgB,CAAC;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as i, useEffect as e } from "react";
|
|
2
|
-
import { applyReactStyle as l } from "./
|
|
3
|
-
import r from "./
|
|
2
|
+
import { applyReactStyle as l } from "./main.js23.mjs";
|
|
3
|
+
import r from "./main.js25.mjs";
|
|
4
4
|
function m(t) {
|
|
5
5
|
const o = r(({ mapLib: n }) => new n.NavigationControl(t), {
|
|
6
6
|
position: t.position
|
|
@@ -10,4 +10,4 @@ function m(t) {
|
|
|
10
10
|
}, [t.style]), null;
|
|
11
11
|
}
|
|
12
12
|
i(m);
|
|
13
|
-
//# sourceMappingURL=
|
|
13
|
+
//# sourceMappingURL=main.js14.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js14.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/navigation-control.js"],"sourcesContent":["import { useEffect, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction NavigationControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.NavigationControl(props), {\n position: props.position\n });\n useEffect(() => {\n applyReactStyle(ctrl._container, props.style);\n }, [props.style]);\n return null;\n}\nexport default memo(NavigationControl);\n//# sourceMappingURL=navigation-control.js.map"],"names":["NavigationControl","props","ctrl","useControl","mapLib","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAkBC,GAAO;AAC9B,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,kBAAkBH,CAAK,GAAG;AAAA,IACzE,UAAUA,EAAM;AAAA,EACxB,CAAK;AACD,SAAAI,EAAU,MAAM;AACZ,IAAAC,EAAgBJ,EAAK,YAAYD,EAAM,KAAK;AAAA,EACpD,GAAO,CAACA,EAAM,KAAK,CAAC,GACT;AACX;AACeM,EAAKP,CAAiB;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { memo as c, useRef as m, useEffect as f } from "react";
|
|
2
|
-
import { applyReactStyle as l } from "./
|
|
3
|
-
import a from "./
|
|
2
|
+
import { applyReactStyle as l } from "./main.js23.mjs";
|
|
3
|
+
import a from "./main.js25.mjs";
|
|
4
4
|
function r(t) {
|
|
5
5
|
const n = a(({ mapLib: u }) => new u.ScaleControl(t), {
|
|
6
6
|
position: t.position
|
|
@@ -12,4 +12,4 @@ function r(t) {
|
|
|
12
12
|
}, [o]), null;
|
|
13
13
|
}
|
|
14
14
|
c(r);
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=main.js15.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js15.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/scale-control.js"],"sourcesContent":["import { useEffect, useRef, memo } from 'react';\nimport { applyReactStyle } from '../utils/apply-react-style';\nimport useControl from './use-control';\nfunction ScaleControl(props) {\n const ctrl = useControl(({ mapLib }) => new mapLib.ScaleControl(props), {\n position: props.position\n });\n const propsRef = useRef(props);\n const prevProps = propsRef.current;\n propsRef.current = props;\n const { style } = props;\n if (props.maxWidth !== undefined && props.maxWidth !== prevProps.maxWidth) {\n ctrl.options.maxWidth = props.maxWidth;\n }\n if (props.unit !== undefined && props.unit !== prevProps.unit) {\n ctrl.setUnit(props.unit);\n }\n useEffect(() => {\n applyReactStyle(ctrl._container, style);\n }, [style]);\n return null;\n}\nexport default memo(ScaleControl);\n//# sourceMappingURL=scale-control.js.map"],"names":["ScaleControl","props","ctrl","useControl","mapLib","propsRef","useRef","prevProps","style","useEffect","applyReactStyle","memo"],"mappings":";;;AAGA,SAASA,EAAaC,GAAO;AACzB,QAAMC,IAAOC,EAAW,CAAC,EAAE,QAAAC,EAAQ,MAAK,IAAIA,EAAO,aAAaH,CAAK,GAAG;AAAA,IACpE,UAAUA,EAAM;AAAA,EACxB,CAAK,GACKI,IAAWC,EAAOL,CAAK,GACvBM,IAAYF,EAAS;AAC3B,EAAAA,EAAS,UAAUJ;AACnB,QAAM,EAAE,OAAAO,EAAO,IAAGP;AAClB,SAAIA,EAAM,aAAa,UAAaA,EAAM,aAAaM,EAAU,aAC7DL,EAAK,QAAQ,WAAWD,EAAM,WAE9BA,EAAM,SAAS,UAAaA,EAAM,SAASM,EAAU,QACrDL,EAAK,QAAQD,EAAM,IAAI,GAE3BQ,EAAU,MAAM;AACZ,IAAAC,EAAgBR,EAAK,YAAYM,CAAK;AAAA,EAC9C,GAAO,CAACA,CAAK,CAAC,GACH;AACX;AACeG,EAAKX,CAAY;","x_google_ignoreList":[0]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as e from "react";
|
|
2
2
|
import { useContext as n, useMemo as a } from "react";
|
|
3
|
-
import { MapContext as u } from "./
|
|
3
|
+
import { MapContext as u } from "./main.js8.mjs";
|
|
4
4
|
const p = e.createContext(null);
|
|
5
5
|
function c() {
|
|
6
6
|
var o;
|
|
@@ -11,4 +11,4 @@ export {
|
|
|
11
11
|
p as MountedMapsContext,
|
|
12
12
|
c as useMap
|
|
13
13
|
};
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=main.js16.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js16.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/use-map.js"],"sourcesContent":["import * as React from 'react';\nimport { useState, useCallback, useMemo, useContext } from 'react';\nimport { MapContext } from './map';\nexport const MountedMapsContext = React.createContext(null);\nexport const MapProvider = props => {\n const [maps, setMaps] = useState({});\n const onMapMount = useCallback((map, id = 'default') => {\n setMaps(currMaps => {\n if (id === 'current') {\n throw new Error(\"'current' cannot be used as map id\");\n }\n if (currMaps[id]) {\n throw new Error(`Multiple maps with the same id: ${id}`);\n }\n return { ...currMaps, [id]: map };\n });\n }, []);\n const onMapUnmount = useCallback((id = 'default') => {\n setMaps(currMaps => {\n if (currMaps[id]) {\n const nextMaps = { ...currMaps };\n delete nextMaps[id];\n return nextMaps;\n }\n return currMaps;\n });\n }, []);\n return (React.createElement(MountedMapsContext.Provider, { value: {\n maps,\n onMapMount,\n onMapUnmount\n } }, props.children));\n};\nexport function useMap() {\n var _a;\n const maps = (_a = useContext(MountedMapsContext)) === null || _a === void 0 ? void 0 : _a.maps;\n const currentMap = useContext(MapContext);\n const mapsWithCurrent = useMemo(() => {\n return { ...maps, current: currentMap === null || currentMap === void 0 ? void 0 : currentMap.map };\n }, [maps, currentMap]);\n return mapsWithCurrent;\n}\n//# sourceMappingURL=use-map.js.map"],"names":["MountedMapsContext","React","useMap","_a","maps","useContext","currentMap","MapContext","useMemo"],"mappings":";;;AAGY,MAACA,IAAqBC,EAAM,cAAc,IAAI;AA8BnD,SAASC,IAAS;AACrB,MAAIC;AACJ,QAAMC,KAAQD,IAAKE,EAAWL,CAAkB,OAAO,QAAQG,MAAO,SAAS,SAASA,EAAG,MACrFG,IAAaD,EAAWE,CAAU;AAIxC,SAHwBC,EAAQ,OACrB,EAAE,GAAGJ,GAAM,SAASE,KAAe,OAAgC,SAASA,EAAW,IAAG,IAClG,CAACF,GAAME,CAAU,CAAC;AAEzB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js17.mjs","sources":["../../src/canvas/create-events.ts"],"sourcesContent":["import { Events, RenderProps, RootState, createEvents as createFiberEvents } from \"@react-three/fiber\";\nimport { UseBoundStore } from \"zustand\";\n\ntype DomEvent = PointerEvent | MouseEvent | WheelEvent;\n\nconst DOM_EVENTS = {\n onClick: [\"click\", false],\n onContextMenu: [\"contextmenu\", false],\n onDoubleClick: [\"dblclick\", false],\n onWheel: [\"wheel\", true],\n onPointerDown: [\"pointerdown\", true],\n onPointerUp: [\"pointerup\", true],\n onPointerLeave: [\"pointerleave\", true],\n onPointerMove: [\"pointermove\", true],\n onPointerCancel: [\"pointercancel\", true],\n onLostPointerCapture: [\"lostpointercapture\", true],\n} as const;\n\n/** ThreeLayer event manager for MapLibre and Mapbox */\nexport function createEvents() : RenderProps<HTMLCanvasElement>[\"events\"] {\n return (store: UseBoundStore<RootState>) => {\n const { handlePointer } = createFiberEvents(store);\n return {\n priority: 1,\n enabled: true,\n compute(event: DomEvent, state: RootState) {\n state.size.width = state.gl.domElement.width;\n state.size.height = state.gl.domElement.height;\n state.pointer.x = (event.offsetX / (state.size.width / window.devicePixelRatio)) * 2 - 1;\n state.pointer.y = 1 - (event.offsetY / (state.size.height / window.devicePixelRatio)) * 2;\n state.raycaster.camera = state.camera;\n state.raycaster.ray.origin.setScalar(0).applyMatrix4(state.camera.projectionMatrixInverse);\n state.raycaster.ray.direction\n .set(state.pointer.x, state.pointer.y, 1)\n .applyMatrix4(state.camera.projectionMatrixInverse)\n .sub(state.raycaster.ray.origin)\n .normalize();\n },\n connected: undefined,\n handlers: Object.keys(DOM_EVENTS).reduce(\n (acc, key) => ({ ...acc, [key]: handlePointer(key) }),\n {}\n ) as unknown as Events,\n update: () => {\n const { events, internal } = store.getState();\n if (internal.lastEvent?.current && events.handlers) {\n events.handlers.onPointerMove(internal.lastEvent.current);\n }\n },\n connect: (target: HTMLElement) => {\n const { set, events } = store.getState();\n events.disconnect?.();\n set((state) => ({ events: { ...state.events, connected: target } }));\n Object.entries(events.handlers ?? []).forEach(([name, event]) => {\n const [eventName, passive] = DOM_EVENTS[name as keyof typeof DOM_EVENTS];\n target.addEventListener(eventName, event, { passive });\n });\n },\n disconnect: () => {\n const { set, events } = store.getState();\n if (events.connected) {\n Object.entries(events.handlers ?? []).forEach(([name, event]) => {\n if (events && events.connected instanceof HTMLElement) {\n const [eventName] = DOM_EVENTS[name as keyof typeof DOM_EVENTS];\n events.connected.removeEventListener(eventName, event);\n }\n });\n set((state) => ({ events: { ...state.events, connected: undefined } }));\n }\n },\n };\n };\n}\n"],"names":["DOM_EVENTS","createEvents","store","handlePointer","createFiberEvents","event","state","acc","key","events","internal","_a","target","set","name","eventName","passive"],"mappings":";AAKA,MAAMA,IAAa;AAAA,EACjB,SAAS,CAAC,SAAS,EAAK;AAAA,EACxB,eAAe,CAAC,eAAe,EAAK;AAAA,EACpC,eAAe,CAAC,YAAY,EAAK;AAAA,EACjC,SAAS,CAAC,SAAS,EAAI;AAAA,EACvB,eAAe,CAAC,eAAe,EAAI;AAAA,EACnC,aAAa,CAAC,aAAa,EAAI;AAAA,EAC/B,gBAAgB,CAAC,gBAAgB,EAAI;AAAA,EACrC,eAAe,CAAC,eAAe,EAAI;AAAA,EACnC,iBAAiB,CAAC,iBAAiB,EAAI;AAAA,EACvC,sBAAsB,CAAC,sBAAsB,EAAI;AACnD;AAGO,SAASC,IAA0D;AACxE,SAAO,CAACC,MAAoC;AAC1C,UAAM,EAAE,eAAAC,EAAA,IAAkBC,EAAkBF,CAAK;AAC1C,WAAA;AAAA,MACL,UAAU;AAAA,MACV,SAAS;AAAA,MACT,QAAQG,GAAiBC,GAAkB;AACzC,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AM;AAC/D,gBAAM,CAACU,GAAWC,CAAO,IAAIhB,EAAWc,CAA+B;AACvE,UAAAF,EAAO,iBAAiBG,GAAWV,GAAO,EAAE,SAAAW,EAAS,CAAA;AAAA,QAAA,CACtD;AAAA,MACH;AAAA,MACA,YAAY,MAAM;AAChB,cAAM,EAAE,KAAAH,GAAK,QAAAJ,EAAO,IAAIP,EAAM,SAAS;AACvC,QAAIO,EAAO,cACF,OAAA,QAAQA,EAAO,YAAY,CAAA,CAAE,EAAE,QAAQ,CAAC,CAACK,GAAMT,CAAK,MAAM;AAC3D,cAAAI,KAAUA,EAAO,qBAAqB,aAAa;AACrD,kBAAM,CAACM,CAAS,IAAIf,EAAWc,CAA+B;AACvD,YAAAL,EAAA,UAAU,oBAAoBM,GAAWV,CAAK;AAAA;AAAA,QACvD,CACD,GACGQ,EAAA,CAACP,OAAW,EAAE,QAAQ,EAAE,GAAGA,EAAM,QAAQ,WAAW,OAAU,EAAA,EAAI;AAAA,MAE1E;AAAA,IAAA;AAAA,EACF;AAEJ;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js18.mjs","sources":["../../src/canvas/use-function.ts"],"sourcesContent":["import { useCallback, useRef } from 'react';\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nexport const useFunction = <T extends (...args: any[]) => any>(callback: T): T => {\n const callbackRef = useRef(callback);\n callbackRef.current = callback;\n return useCallback((...args: any[]) => {\n return callbackRef.current(...args);\n }, []) as T;\n};\n"],"names":["useFunction","callback","callbackRef","useRef","useCallback","args"],"mappings":";AAGa,MAAAA,IAAc,CAAoCC,MAAmB;AAC1E,QAAAC,IAAcC,EAAOF,CAAQ;AACnC,SAAAC,EAAY,UAAUD,GACfG,EAAY,IAAIC,MACdH,EAAY,QAAQ,GAAGG,CAAI,GACjC,CAAE,CAAA;AACP;"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { cloneTransform as S, applyViewStateToTransform as f, transformToViewState as p } from "./
|
|
2
|
-
import { normalizeStyle as _ } from "./
|
|
3
|
-
import { deepEqual as h } from "./
|
|
1
|
+
import { cloneTransform as S, applyViewStateToTransform as f, transformToViewState as p } from "./main.js27.mjs";
|
|
2
|
+
import { normalizeStyle as _ } from "./main.js28.mjs";
|
|
3
|
+
import { deepEqual as h } from "./main.js24.mjs";
|
|
4
4
|
const v = { version: 8, sources: {}, layers: [] }, g = {
|
|
5
5
|
mousedown: "onMouseDown",
|
|
6
6
|
mouseup: "onMouseUp",
|
|
@@ -317,4 +317,4 @@ function C() {
|
|
|
317
317
|
export {
|
|
318
318
|
u as default
|
|
319
319
|
};
|
|
320
|
-
//# sourceMappingURL=
|
|
320
|
+
//# sourceMappingURL=main.js19.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js19.mjs","sources":["../../node_modules/react-map-gl/dist/esm/mapbox/mapbox.js"],"sourcesContent":["import { transformToViewState, applyViewStateToTransform, cloneTransform } from '../utils/transform';\nimport { normalizeStyle } from '../utils/style-utils';\nimport { deepEqual } from '../utils/deep-equal';\nconst DEFAULT_STYLE = { version: 8, sources: {}, layers: [] };\nconst pointerEvents = {\n mousedown: 'onMouseDown',\n mouseup: 'onMouseUp',\n mouseover: 'onMouseOver',\n mousemove: 'onMouseMove',\n click: 'onClick',\n dblclick: 'onDblClick',\n mouseenter: 'onMouseEnter',\n mouseleave: 'onMouseLeave',\n mouseout: 'onMouseOut',\n contextmenu: 'onContextMenu',\n touchstart: 'onTouchStart',\n touchend: 'onTouchEnd',\n touchmove: 'onTouchMove',\n touchcancel: 'onTouchCancel'\n};\nconst cameraEvents = {\n movestart: 'onMoveStart',\n move: 'onMove',\n moveend: 'onMoveEnd',\n dragstart: 'onDragStart',\n drag: 'onDrag',\n dragend: 'onDragEnd',\n zoomstart: 'onZoomStart',\n zoom: 'onZoom',\n zoomend: 'onZoomEnd',\n rotatestart: 'onRotateStart',\n rotate: 'onRotate',\n rotateend: 'onRotateEnd',\n pitchstart: 'onPitchStart',\n pitch: 'onPitch',\n pitchend: 'onPitchEnd'\n};\nconst otherEvents = {\n wheel: 'onWheel',\n boxzoomstart: 'onBoxZoomStart',\n boxzoomend: 'onBoxZoomEnd',\n boxzoomcancel: 'onBoxZoomCancel',\n resize: 'onResize',\n load: 'onLoad',\n render: 'onRender',\n idle: 'onIdle',\n remove: 'onRemove',\n data: 'onData',\n styledata: 'onStyleData',\n sourcedata: 'onSourceData',\n error: 'onError'\n};\nconst settingNames = [\n 'minZoom',\n 'maxZoom',\n 'minPitch',\n 'maxPitch',\n 'maxBounds',\n 'projection',\n 'renderWorldCopies'\n];\nconst handlerNames = [\n 'scrollZoom',\n 'boxZoom',\n 'dragRotate',\n 'dragPan',\n 'keyboard',\n 'doubleClickZoom',\n 'touchZoomRotate',\n 'touchPitch'\n];\n/**\n * A wrapper for mapbox-gl's Map class\n */\nexport default class Mapbox {\n constructor(MapClass, props, container) {\n // mapboxgl.Map instance\n this._map = null;\n // Internal states\n this._internalUpdate = false;\n this._inRender = false;\n this._hoveredFeatures = null;\n this._deferredEvents = {\n move: false,\n zoom: false,\n pitch: false,\n rotate: false\n };\n this._onEvent = (e) => {\n // @ts-ignore\n const cb = this.props[otherEvents[e.type]];\n if (cb) {\n cb(e);\n }\n else if (e.type === 'error') {\n console.error(e.error); // eslint-disable-line\n }\n };\n this._onPointerEvent = (e) => {\n if (e.type === 'mousemove' || e.type === 'mouseout') {\n this._updateHover(e);\n }\n // @ts-ignore\n const cb = this.props[pointerEvents[e.type]];\n if (cb) {\n if (this.props.interactiveLayerIds && e.type !== 'mouseover' && e.type !== 'mouseout') {\n e.features = this._hoveredFeatures || this._queryRenderedFeatures(e.point);\n }\n cb(e);\n delete e.features;\n }\n };\n this._onCameraEvent = (e) => {\n if (!this._internalUpdate) {\n // @ts-ignore\n const cb = this.props[cameraEvents[e.type]];\n if (cb) {\n cb(e);\n }\n }\n if (e.type in this._deferredEvents) {\n this._deferredEvents[e.type] = false;\n }\n };\n this._MapClass = MapClass;\n this.props = props;\n this._initialize(container);\n }\n get map() {\n return this._map;\n }\n get transform() {\n return this._renderTransform;\n }\n setProps(props) {\n const oldProps = this.props;\n this.props = props;\n const settingsChanged = this._updateSettings(props, oldProps);\n if (settingsChanged) {\n this._createShadowTransform(this._map);\n }\n const sizeChanged = this._updateSize(props);\n const viewStateChanged = this._updateViewState(props, true);\n this._updateStyle(props, oldProps);\n this._updateStyleComponents(props, oldProps);\n this._updateHandlers(props, oldProps);\n // If 1) view state has changed to match props and\n // 2) the props change is not triggered by map events,\n // it's driven by an external state change. Redraw immediately\n if (settingsChanged || sizeChanged || (viewStateChanged && !this._map.isMoving())) {\n this.redraw();\n }\n }\n static reuse(props, container) {\n const that = Mapbox.savedMaps.pop();\n if (!that) {\n return null;\n }\n const map = that.map;\n // When reusing the saved map, we need to reparent the map(canvas) and other child nodes\n // intoto the new container from the props.\n // Step 1: reparenting child nodes from old container to new container\n const oldContainer = map.getContainer();\n container.className = oldContainer.className;\n while (oldContainer.childNodes.length > 0) {\n container.appendChild(oldContainer.childNodes[0]);\n }\n // Step 2: replace the internal container with new container from the react component\n // @ts-ignore\n map._container = container;\n // With maplibre-gl as mapLib, map uses ResizeObserver to observe when its container resizes.\n // When reusing the saved map, we need to disconnect the observer and observe the new container.\n // Step 3: telling the ResizeObserver to disconnect and observe the new container\n // @ts-ignore\n const resizeObserver = map._resizeObserver;\n if (resizeObserver) {\n resizeObserver.disconnect();\n resizeObserver.observe(container);\n }\n // Step 4: apply new props\n that.setProps({ ...props, styleDiffing: false });\n map.resize();\n const { initialViewState } = props;\n if (initialViewState) {\n if (initialViewState.bounds) {\n map.fitBounds(initialViewState.bounds, { ...initialViewState.fitBoundsOptions, duration: 0 });\n }\n else {\n that._updateViewState(initialViewState, false);\n }\n }\n // Simulate load event\n if (map.isStyleLoaded()) {\n map.fire('load');\n }\n else {\n map.once('styledata', () => map.fire('load'));\n }\n // Force reload\n // @ts-ignore\n map._update();\n return that;\n }\n /* eslint-disable complexity,max-statements */\n _initialize(container) {\n const { props } = this;\n const { mapStyle = DEFAULT_STYLE } = props;\n const mapOptions = {\n ...props,\n ...props.initialViewState,\n accessToken: props.mapboxAccessToken || getAccessTokenFromEnv() || null,\n container,\n style: normalizeStyle(mapStyle)\n };\n const viewState = mapOptions.initialViewState || mapOptions.viewState || mapOptions;\n Object.assign(mapOptions, {\n center: [viewState.longitude || 0, viewState.latitude || 0],\n zoom: viewState.zoom || 0,\n pitch: viewState.pitch || 0,\n bearing: viewState.bearing || 0\n });\n if (props.gl) {\n // eslint-disable-next-line\n const getContext = HTMLCanvasElement.prototype.getContext;\n // Hijack canvas.getContext to return our own WebGLContext\n // This will be called inside the mapboxgl.Map constructor\n // @ts-expect-error\n HTMLCanvasElement.prototype.getContext = () => {\n // Unhijack immediately\n HTMLCanvasElement.prototype.getContext = getContext;\n return props.gl;\n };\n }\n const map = new this._MapClass(mapOptions);\n // Props that are not part of constructor options\n if (viewState.padding) {\n map.setPadding(viewState.padding);\n }\n if (props.cursor) {\n map.getCanvas().style.cursor = props.cursor;\n }\n this._createShadowTransform(map);\n // Hack\n // Insert code into map's render cycle\n const renderMap = map._render;\n map._render = (arg) => {\n this._inRender = true;\n renderMap.call(map, arg);\n this._inRender = false;\n };\n const runRenderTaskQueue = map._renderTaskQueue.run;\n map._renderTaskQueue.run = (arg) => {\n runRenderTaskQueue.call(map._renderTaskQueue, arg);\n this._onBeforeRepaint();\n };\n map.on('render', () => this._onAfterRepaint());\n // Insert code into map's event pipeline\n // eslint-disable-next-line @typescript-eslint/unbound-method\n const fireEvent = map.fire;\n map.fire = this._fireEvent.bind(this, fireEvent);\n // add listeners\n map.on('resize', () => {\n this._renderTransform.resize(map.transform.width, map.transform.height);\n });\n map.on('styledata', () => this._updateStyleComponents(this.props, {}));\n map.on('sourcedata', () => this._updateStyleComponents(this.props, {}));\n for (const eventName in pointerEvents) {\n map.on(eventName, this._onPointerEvent);\n }\n for (const eventName in cameraEvents) {\n map.on(eventName, this._onCameraEvent);\n }\n for (const eventName in otherEvents) {\n map.on(eventName, this._onEvent);\n }\n this._map = map;\n }\n /* eslint-enable complexity,max-statements */\n recycle() {\n // Clean up unnecessary elements before storing for reuse.\n const container = this.map.getContainer();\n const children = container.querySelector('[mapboxgl-children]');\n children === null || children === void 0 ? void 0 : children.remove();\n Mapbox.savedMaps.push(this);\n }\n destroy() {\n this._map.remove();\n }\n // Force redraw the map now. Typically resize() and jumpTo() is reflected in the next\n // render cycle, which is managed by Mapbox's animation loop.\n // This removes the synchronization issue caused by requestAnimationFrame.\n redraw() {\n const map = this._map;\n // map._render will throw error if style does not exist\n // https://github.com/mapbox/mapbox-gl-js/blob/fb9fc316da14e99ff4368f3e4faa3888fb43c513\n // /src/ui/map.js#L1834\n if (!this._inRender && map.style) {\n // cancel the scheduled update\n if (map._frame) {\n map._frame.cancel();\n map._frame = null;\n }\n // the order is important - render() may schedule another update\n map._render();\n }\n }\n _createShadowTransform(map) {\n const renderTransform = cloneTransform(map.transform);\n map.painter.transform = renderTransform;\n this._renderTransform = renderTransform;\n }\n /* Trigger map resize if size is controlled\n @param {object} nextProps\n @returns {bool} true if size has changed\n */\n _updateSize(nextProps) {\n // Check if size is controlled\n const { viewState } = nextProps;\n if (viewState) {\n const map = this._map;\n if (viewState.width !== map.transform.width || viewState.height !== map.transform.height) {\n map.resize();\n return true;\n }\n }\n return false;\n }\n // Adapted from map.jumpTo\n /* Update camera to match props\n @param {object} nextProps\n @param {bool} triggerEvents - should fire camera events\n @returns {bool} true if anything is changed\n */\n _updateViewState(nextProps, triggerEvents) {\n if (this._internalUpdate) {\n return false;\n }\n const map = this._map;\n const tr = this._renderTransform;\n // Take a snapshot of the transform before mutation\n const { zoom, pitch, bearing } = tr;\n const isMoving = map.isMoving();\n if (isMoving) {\n // All movement of the camera is done relative to the sea level\n tr.cameraElevationReference = 'sea';\n }\n const changed = applyViewStateToTransform(tr, {\n ...transformToViewState(map.transform),\n ...nextProps\n });\n if (isMoving) {\n // Reset camera reference\n tr.cameraElevationReference = 'ground';\n }\n if (changed && triggerEvents) {\n const deferredEvents = this._deferredEvents;\n // Delay DOM control updates to the next render cycle\n deferredEvents.move = true;\n deferredEvents.zoom || (deferredEvents.zoom = zoom !== tr.zoom);\n deferredEvents.rotate || (deferredEvents.rotate = bearing !== tr.bearing);\n deferredEvents.pitch || (deferredEvents.pitch = pitch !== tr.pitch);\n }\n // Avoid manipulating the real transform when interaction/animation is ongoing\n // as it would interfere with Mapbox's handlers\n if (!isMoving) {\n applyViewStateToTransform(map.transform, nextProps);\n }\n return changed;\n }\n /* Update camera constraints and projection settings to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateSettings(nextProps, currProps) {\n const map = this._map;\n let changed = false;\n for (const propName of settingNames) {\n if (propName in nextProps && !deepEqual(nextProps[propName], currProps[propName])) {\n changed = true;\n const setter = map[`set${propName[0].toUpperCase()}${propName.slice(1)}`];\n setter === null || setter === void 0 ? void 0 : setter(nextProps[propName]);\n }\n }\n return changed;\n }\n /* Update map style to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if style is changed\n */\n _updateStyle(nextProps, currProps) {\n if (nextProps.cursor !== currProps.cursor) {\n this._map.getCanvas().style.cursor = nextProps.cursor;\n }\n if (nextProps.mapStyle !== currProps.mapStyle) {\n const { mapStyle = DEFAULT_STYLE, styleDiffing = true } = nextProps;\n const options = {\n diff: styleDiffing\n };\n if ('localIdeographFontFamily' in nextProps) {\n // @ts-ignore Mapbox specific prop\n options.localIdeographFontFamily = nextProps.localIdeographFontFamily;\n }\n this._map.setStyle(normalizeStyle(mapStyle), options);\n return true;\n }\n return false;\n }\n /* Update fog, light and terrain to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateStyleComponents(nextProps, currProps) {\n const map = this._map;\n let changed = false;\n if (map.isStyleLoaded()) {\n if ('light' in nextProps && map.setLight && !deepEqual(nextProps.light, currProps.light)) {\n changed = true;\n map.setLight(nextProps.light);\n }\n if ('fog' in nextProps && map.setFog && !deepEqual(nextProps.fog, currProps.fog)) {\n changed = true;\n map.setFog(nextProps.fog);\n }\n if ('terrain' in nextProps &&\n map.setTerrain &&\n !deepEqual(nextProps.terrain, currProps.terrain)) {\n if (!nextProps.terrain || map.getSource(nextProps.terrain.source)) {\n changed = true;\n map.setTerrain(nextProps.terrain);\n }\n }\n }\n return changed;\n }\n /* Update interaction handlers to match props\n @param {object} nextProps\n @param {object} currProps\n @returns {bool} true if anything is changed\n */\n _updateHandlers(nextProps, currProps) {\n var _a, _b;\n const map = this._map;\n let changed = false;\n for (const propName of handlerNames) {\n const newValue = (_a = nextProps[propName]) !== null && _a !== void 0 ? _a : true;\n const oldValue = (_b = currProps[propName]) !== null && _b !== void 0 ? _b : true;\n if (!deepEqual(newValue, oldValue)) {\n changed = true;\n if (newValue) {\n map[propName].enable(newValue);\n }\n else {\n map[propName].disable();\n }\n }\n }\n return changed;\n }\n _queryRenderedFeatures(point) {\n const map = this._map;\n const { interactiveLayerIds = [] } = this.props;\n try {\n return map.queryRenderedFeatures(point, {\n layers: interactiveLayerIds.filter(map.getLayer.bind(map))\n });\n }\n catch (_a) {\n // May fail if style is not loaded\n return [];\n }\n }\n _updateHover(e) {\n var _a;\n const { props } = this;\n const shouldTrackHoveredFeatures = props.interactiveLayerIds && (props.onMouseMove || props.onMouseEnter || props.onMouseLeave);\n if (shouldTrackHoveredFeatures) {\n const eventType = e.type;\n const wasHovering = ((_a = this._hoveredFeatures) === null || _a === void 0 ? void 0 : _a.length) > 0;\n const features = this._queryRenderedFeatures(e.point);\n const isHovering = features.length > 0;\n if (!isHovering && wasHovering) {\n e.type = 'mouseleave';\n this._onPointerEvent(e);\n }\n this._hoveredFeatures = features;\n if (isHovering && !wasHovering) {\n e.type = 'mouseenter';\n this._onPointerEvent(e);\n }\n e.type = eventType;\n }\n else {\n this._hoveredFeatures = null;\n }\n }\n _fireEvent(baseFire, event, properties) {\n const map = this._map;\n const tr = map.transform;\n const eventType = typeof event === 'string' ? event : event.type;\n if (eventType === 'move') {\n this._updateViewState(this.props, false);\n }\n if (eventType in cameraEvents) {\n if (typeof event === 'object') {\n event.viewState = transformToViewState(tr);\n }\n if (this._map.isMoving()) {\n // Replace map.transform with ours during the callbacks\n map.transform = this._renderTransform;\n baseFire.call(map, event, properties);\n map.transform = tr;\n return map;\n }\n }\n baseFire.call(map, event, properties);\n return map;\n }\n // All camera manipulations are complete, ready to repaint\n _onBeforeRepaint() {\n const map = this._map;\n // If there are camera changes driven by props, invoke camera events so that DOM controls are synced\n this._internalUpdate = true;\n for (const eventType in this._deferredEvents) {\n if (this._deferredEvents[eventType]) {\n map.fire(eventType);\n }\n }\n this._internalUpdate = false;\n const tr = this._map.transform;\n // Make sure camera matches the current props\n this._map.transform = this._renderTransform;\n this._onAfterRepaint = () => {\n // Restores camera state before render/load events are fired\n this._map.transform = tr;\n };\n }\n}\nMapbox.savedMaps = [];\n/**\n * Access token can be provided via one of:\n * mapboxAccessToken prop\n * access_token query parameter\n * MapboxAccessToken environment variable\n * REACT_APP_MAPBOX_ACCESS_TOKEN environment variable\n * @returns access token\n */\nfunction getAccessTokenFromEnv() {\n let accessToken = null;\n /* global location, process */\n if (typeof location !== 'undefined') {\n const match = /access_token=([^&\\/]*)/.exec(location.search);\n accessToken = match && match[1];\n }\n // Note: This depends on bundler plugins (e.g. webpack) importing environment correctly\n try {\n accessToken = accessToken || process.env.MapboxAccessToken;\n }\n catch (_a) {\n // ignore\n }\n try {\n accessToken = accessToken || process.env.REACT_APP_MAPBOX_ACCESS_TOKEN;\n }\n catch (_b) {\n // ignore\n }\n return accessToken;\n}\n//# sourceMappingURL=mapbox.js.map"],"names":["DEFAULT_STYLE","pointerEvents","cameraEvents","otherEvents","settingNames","handlerNames","Mapbox","MapClass","props","container","e","cb","oldProps","settingsChanged","sizeChanged","viewStateChanged","that","map","oldContainer","resizeObserver","initialViewState","mapStyle","mapOptions","getAccessTokenFromEnv","normalizeStyle","viewState","getContext","renderMap","arg","runRenderTaskQueue","fireEvent","eventName","children","renderTransform","cloneTransform","nextProps","triggerEvents","tr","zoom","pitch","bearing","isMoving","changed","applyViewStateToTransform","transformToViewState","deferredEvents","currProps","propName","deepEqual","setter","styleDiffing","options","_a","_b","newValue","oldValue","point","interactiveLayerIds","eventType","wasHovering","features","isHovering","baseFire","event","properties","accessToken","match"],"mappings":";;;AAGA,MAAMA,IAAgB,EAAE,SAAS,GAAG,SAAS,IAAI,QAAQ,CAAA,KACnDC,IAAgB;AAAA,EAClB,WAAW;AAAA,EACX,SAAS;AAAA,EACT,WAAW;AAAA,EACX,WAAW;AAAA,EACX,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,UAAU;AAAA,EACV,WAAW;AAAA,EACX,aAAa;AACjB,GACMC,IAAe;AAAA,EACjB,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,WAAW;AAAA,EACX,MAAM;AAAA,EACN,SAAS;AAAA,EACT,aAAa;AAAA,EACb,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AACd,GACMC,IAAc;AAAA,EAChB,OAAO;AAAA,EACP,cAAc;AAAA,EACd,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AACX,GACMC,IAAe;AAAA,EACjB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ,GACMC,IAAe;AAAA,EACjB;AAAA,EACA;AAAA,EACA;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L,MAAc,UACd,KAAK,iBAAiB,KAAK,OAAO,EAAK,GAEvCA,KAAaxD,MACT,OAAO6D,KAAU,aACjBA,EAAM,YAAYnB,EAAqBP,CAAE,IAEzC,KAAK,KAAK,eAEVpB,EAAI,YAAY,KAAK,kBACrB6C,EAAS,KAAK7C,GAAK8C,GAAOC,CAAU,GACpC/C,EAAI,YAAYoB,GACTpB,MAGf6C,EAAS,KAAK7C,GAAK8C,GAAOC,CAAU,GAC7B/C;AAAA,EACV;AAAA;AAAA,EAED,mBAAmB;AACf,UAAMA,IAAM,KAAK;AAEjB,SAAK,kBAAkB;AACvB,eAAWyC,KAAa,KAAK;AACzB,MAAI,KAAK,gBAAgBA,CAAS,KAC9BzC,EAAI,KAAKyC,CAAS;AAG1B,SAAK,kBAAkB;AACvB,UAAMrB,IAAK,KAAK,KAAK;AAErB,SAAK,KAAK,YAAY,KAAK,kBAC3B,KAAK,kBAAkB,MAAM;AAEzB,WAAK,KAAK,YAAYA;AAAA,IAClC;AAAA,EACK;AACL;AACA/B,EAAO,YAAY,CAAA;AASnB,SAASiB,IAAwB;AAC7B,MAAI0C,IAAc;AAElB,MAAI,OAAO,WAAa,KAAa;AACjC,UAAMC,IAAQ,yBAAyB,KAAK,SAAS,MAAM;AAC3D,IAAAD,IAAcC,KAASA,EAAM,CAAC;AAAA;AAGlC,MAAI;AACA,IAAAD,IAAcA,KAAe,QAAQ,IAAI;AAAA,EAC5C,QACD;AAAA,EAEC;AACD,MAAI;AACA,IAAAA,IAAcA,KAAe,QAAQ,IAAI;AAAA,EAC5C,QACD;AAAA,EAEC;AACD,SAAOA;AACX;","x_google_ignoreList":[0]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as s, Fragment as a } from "react/jsx-runtime";
|
|
2
2
|
import { extend as x } from "@react-three/fiber";
|
|
3
3
|
import { memo as R, useId as E, useRef as M, useMemo as v, useEffect as y } from "react";
|
|
4
|
-
import "./
|
|
4
|
+
import "./main.js3.mjs";
|
|
5
5
|
import * as A from "three";
|
|
6
|
-
import { coordsToMatrix as T } from "./
|
|
7
|
-
import { useOnAdd as g } from "./
|
|
8
|
-
import { useRender as j } from "./
|
|
9
|
-
import C from "./
|
|
6
|
+
import { coordsToMatrix as T } from "./main.js4.mjs";
|
|
7
|
+
import { useOnAdd as g } from "./main.js5.mjs";
|
|
8
|
+
import { useRender as j } from "./main.js6.mjs";
|
|
9
|
+
import C from "./main.js7.mjs";
|
|
10
10
|
x(A);
|
|
11
11
|
const w = R(({
|
|
12
12
|
longitude: o,
|
|
@@ -37,4 +37,4 @@ const w = R(({
|
|
|
37
37
|
export {
|
|
38
38
|
w as Canvas
|
|
39
39
|
};
|
|
40
|
-
//# sourceMappingURL=
|
|
40
|
+
//# sourceMappingURL=main.js2.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js2.mjs","sources":["../../src/canvas/canvas.tsx"],"sourcesContent":["import { RenderProps, extend } from \"@react-three/fiber\";\nimport { PropsWithChildren, memo, useEffect, useId, useMemo, useRef } from \"react\";\nimport { Layer } from \"react-map-gl/maplibre\";\nimport * as THREE from \"three\";\nimport { coordsToMatrix } from \"./coords-to-matrix\";\nimport { StateRef } from \"./state-ref\";\nimport { useOnAdd } from \"./use-on-add\";\nimport { useRender } from \"./use-render\";\n\nextend(THREE);\n\nexport interface CanvasProps extends RenderProps<HTMLCanvasElement>, PropsWithChildren {\n longitude: number,\n latitude: number,\n altitude?: number\n}\n\n/** react`-three-fiber` canvas inside `MapLibre` */\nexport const Canvas = memo<CanvasProps>(({\n longitude, latitude, altitude = 0,\n children, ...renderProps\n})=>{\n const id = useId();\n \n const ref : StateRef = useRef();\n\n const m4 = useMemo(()=>coordsToMatrix({\n latitude, longitude, altitude\n }), [latitude, longitude, altitude])\n\n const {onAdd, onRemove, mounted} = useOnAdd(ref, renderProps);\n\n const render = useRender(m4, ref);\n\n useEffect(()=>{\n if(!mounted) return;\n if(!ref.current) return;\n ref.current.root.render(<>{children}</>);\n }, [ref, mounted, children])\n\n return <Layer\n id={id}\n type=\"custom\"\n renderingMode=\"3d\"\n onAdd={onAdd}\n onRemove={onRemove}\n render={render}\n />\n})"],"names":["extend","THREE","Canvas","memo","longitude","latitude","altitude","children","renderProps","id","useId","ref","useRef","m4","useMemo","coordsToMatrix","onAdd","onRemove","mounted","useOnAdd","render","useRender","useEffect","jsx","Fragment","Layer"],"mappings":";;;;;;;;;AASAA,EAAOC,CAAK;AASC,MAAAC,IAASC,EAAkB,CAAC;AAAA,EACvC,WAAAC;AAAA,EAAW,UAAAC;AAAA,EAAU,UAAAC,IAAW;AAAA,EAChC,UAAAC;AAAA,EAAU,GAAGC;AACf,MAAI;AACF,QAAMC,IAAKC,KAELC,IAAiBC,KAEjBC,IAAKC,EAAQ,MAAIC,EAAe;AAAA,IACpC,UAAAV;AAAA,IAAU,WAAAD;AAAA,IAAW,UAAAE;AAAA,EACtB,CAAA,GAAG,CAACD,GAAUD,GAAWE,CAAQ,CAAC,GAE7B,EAAC,OAAAU,GAAO,UAAAC,GAAU,SAAAC,EAAW,IAAAC,EAASR,GAAKH,CAAW,GAEtDY,IAASC,EAAUR,GAAIF,CAAG;AAEhC,SAAAW,EAAU,MAAI;AACZ,IAAIJ,KACAP,EAAI,WACRA,EAAI,QAAQ,KAAK,OAAO,gBAAAY,EAAAC,GAAA,EAAG,UAAAjB,EAAS,CAAA,CAAG;AAAA,EACtC,GAAA,CAACI,GAAKO,GAASX,CAAQ,CAAC,GAEpB,gBAAAgB;AAAA,IAACE;AAAA,IAAA;AAAA,MACN,IAAAhB;AAAA,MACA,MAAK;AAAA,MACL,eAAc;AAAA,MACd,OAAAO;AAAA,MACA,UAAAC;AAAA,MACA,QAAAG;AAAA,IAAA;AAAA,EAAA;AAEJ,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js20.mjs","sources":["../../node_modules/react-map-gl/dist/esm/mapbox/create-ref.js"],"sourcesContent":["/** These methods may break the react binding if called directly */\nconst skipMethods = [\n 'setMaxBounds',\n 'setMinZoom',\n 'setMaxZoom',\n 'setMinPitch',\n 'setMaxPitch',\n 'setRenderWorldCopies',\n 'setProjection',\n 'setStyle',\n 'addSource',\n 'removeSource',\n 'addLayer',\n 'removeLayer',\n 'setLayerZoomRange',\n 'setFilter',\n 'setPaintProperty',\n 'setLayoutProperty',\n 'setLight',\n 'setTerrain',\n 'setFog',\n 'remove'\n];\nexport default function createRef(mapInstance) {\n if (!mapInstance) {\n return null;\n }\n const map = mapInstance.map;\n const result = {\n getMap: () => map,\n // Overwrite getters to use our shadow transform\n getCenter: () => mapInstance.transform.center,\n getZoom: () => mapInstance.transform.zoom,\n getBearing: () => mapInstance.transform.bearing,\n getPitch: () => mapInstance.transform.pitch,\n getPadding: () => mapInstance.transform.padding,\n getBounds: () => mapInstance.transform.getBounds(),\n project: (lnglat) => {\n const tr = map.transform;\n map.transform = mapInstance.transform;\n const result = map.project(lnglat);\n map.transform = tr;\n return result;\n },\n unproject: (point) => {\n const tr = map.transform;\n map.transform = mapInstance.transform;\n const result = map.unproject(point);\n map.transform = tr;\n return result;\n },\n // options diverge between mapbox and maplibre\n queryTerrainElevation: (lnglat, options) => {\n const tr = map.transform;\n map.transform = mapInstance.transform;\n const result = map.queryTerrainElevation(lnglat, options);\n map.transform = tr;\n return result;\n }\n };\n for (const key of getMethodNames(map)) {\n // @ts-expect-error\n if (!(key in result) && !skipMethods.includes(key)) {\n result[key] = map[key].bind(map);\n }\n }\n return result;\n}\nfunction getMethodNames(obj) {\n const result = new Set();\n let proto = obj;\n while (proto) {\n for (const key of Object.getOwnPropertyNames(proto)) {\n if (key[0] !== '_' &&\n typeof obj[key] === 'function' &&\n key !== 'fire' &&\n key !== 'setEventedParent') {\n result.add(key);\n }\n }\n proto = Object.getPrototypeOf(proto);\n }\n return Array.from(result);\n}\n//# sourceMappingURL=create-ref.js.map"],"names":["skipMethods","createRef","mapInstance","map","result","lnglat","tr","point","options","key","getMeth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,EAAY,SAASS,CAAG,MAC7CL,EAAOK,CAAG,IAAIN,EAAIM,CAAG,EAAE,KAAKN,CAAG;AAGvC,SAAOC;AACX;AACA,SAASM,EAAeC,GAAK;AACzB,QAAMP,IAAS,oBAAI;AACnB,MAAIQ,IAAQD;AACZ,SAAOC,KAAO;AACV,eAAWH,KAAO,OAAO,oBAAoBG,CAAK;AAC9C,MAAIH,EAAI,CAAC,MAAM,OACX,OAAOE,EAAIF,CAAG,KAAM,cACpBA,MAAQ,UACRA,MAAQ,sBACRL,EAAO,IAAIK,CAAG;AAGtB,IAAAG,IAAQ,OAAO,eAAeA,CAAK;AAAA;AAEvC,SAAO,MAAM,KAAKR,CAAM;AAC5B;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js21.mjs","sources":["../../node_modules/react-map-gl/dist/esm/utils/use-isomorphic-layout-effect.js"],"sourcesContent":["// From https://github.com/streamich/react-use/blob/master/src/useIsomorphicLayoutEffect.ts\n// useLayoutEffect but does not trigger warning in server-side rendering\nimport { useEffect, useLayoutEffect } from 'react';\nconst useIsomorphicLayoutEffect = typeof document !== 'undefined' ? useLayoutEffect : useEffect;\nexport default useIsomorphicLayoutEffect;\n//# sourceMappingURL=use-isomorphic-layout-effect.js.map"],"names":["useIsomorphicLayoutEffect","useLayoutEffect","useEffect"],"mappings":";AAGK,MAACA,IAA4B,OAAO,WAAa,MAAcC,IAAkBC;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js22.mjs","sources":["../../node_modules/react-map-gl/dist/esm/utils/set-globals.js"],"sourcesContent":["const globalSettings = [\n 'baseApiUrl',\n 'maxParallelImageRequests',\n 'workerClass',\n 'workerCount',\n 'workerUrl'\n];\nexport default function setGlobals(mapLib, props) {\n for (const key of globalSettings) {\n if (key in props) {\n mapLib[key] = props[key];\n }\n }\n const { RTLTextPlugin = 'https://api.mapbox.com/mapbox-gl-js/plugins/mapbox-gl-rtl-text/v0.2.3/mapbox-gl-rtl-text.js' } = props;\n if (RTLTextPlugin &&\n mapLib.getRTLTextPluginStatus &&\n mapLib.getRTLTextPluginStatus() === 'unavailable') {\n mapLib.setRTLTextPlugin(RTLTextPlugin, (error) => {\n if (error) {\n // eslint-disable-next-line\n console.error(error);\n }\n }, false);\n }\n}\n//# sourceMappingURL=set-globals.js.map"],"names":["globalSettings","setGlobals","mapLib","props","key","RTLTextPlugin","error"],"mappings":"AAAA,MAAMA,IAAiB;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACJ;AACe,SAASC,EAAWC,GAAQC,GAAO;AAC9C,aAAWC,KAAOJ;AACd,IAAII,KAAOD,MACPD,EAAOE,CAAG,IAAID,EAAMC,CAAG;AAG/B,QAAM,EAAE,eAAAC,IAAgB,8FAA+F,IAAGF;AAC1H,EAAIE,KACAH,EAAO,0BACPA,EAAO,uBAAwB,MAAK,iBACpCA,EAAO,iBAAiBG,GAAe,CAACC,MAAU;AAC9C,IAAIA,KAEA,QAAQ,MAAMA,CAAK;AAAA,EAE1B,GAAE,EAAK;AAEhB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js23.mjs","sources":["../../node_modules/react-map-gl/dist/esm/utils/apply-react-style.js"],"sourcesContent":["// This is a simplified version of\n// https://github.com/facebook/react/blob/4131af3e4bf52f3a003537ec95a1655147c81270/src/renderers/dom/shared/CSSPropertyOperations.js#L62\nconst unitlessNumber = /box|flex|grid|column|lineHeight|fontWeight|opacity|order|tabSize|zIndex/;\nexport function applyReactStyle(element, styles) {\n if (!element || !styles) {\n return;\n }\n const style = element.style;\n for (const key in styles) {\n const value = styles[key];\n if (Number.isFinite(value) && !unitlessNumber.test(key)) {\n style[key] = `${value}px`;\n }\n else {\n style[key] = value;\n }\n }\n}\n//# sourceMappingURL=apply-react-style.js.map"],"names":["unitlessNumber","applyReactStyle","element","styles","style","key","value"],"mappings":"AAEA,MAAMA,IAAiB;AAChB,SAASC,EAAgBC,GAASC,GAAQ;AAC7C,MAAI,CAACD,KAAW,CAACC;AACb;AAEJ,QAAMC,IAAQF,EAAQ;AACtB,aAAWG,KAAOF,GAAQ;AACtB,UAAMG,IAAQH,EAAOE,CAAG;AACxB,IAAI,OAAO,SAASC,CAAK,KAAK,CAACN,EAAe,KAAKK,CAAG,IAClDD,EAAMC,CAAG,IAAI,GAAGC,QAGhBF,EAAMC,CAAG,IAAIC;AAAA;AAGzB;","x_google_ignoreList":[0]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js24.mjs","sources":["../../node_modules/react-map-gl/dist/esm/utils/deep-equal.js"],"sourcesContent":["/**\n * Compare two points\n * @param a\n * @param b\n * @returns true if the points are equal\n */\nexport function arePointsEqual(a, b) {\n const ax = Array.isArray(a) ? a[0] : a ? a.x : 0;\n const ay = Array.isArray(a) ? a[1] : a ? a.y : 0;\n const bx = Array.isArray(b) ? b[0] : b ? b.x : 0;\n const by = Array.isArray(b) ? b[1] : b ? b.y : 0;\n return ax === bx && ay === by;\n}\n/* eslint-disable complexity */\n/**\n * Compare any two objects\n * @param a\n * @param b\n * @returns true if the objects are deep equal\n */\nexport function deepEqual(a, b) {\n if (a === b) {\n return true;\n }\n if (!a || !b) {\n return false;\n }\n if (Array.isArray(a)) {\n if (!Array.isArray(b) || a.length !== b.length) {\n return false;\n }\n for (let i = 0; i < a.length; i++) {\n if (!deepEqual(a[i], b[i])) {\n return false;\n }\n }\n return true;\n }\n else if (Array.isArray(b)) {\n return false;\n }\n if (typeof a === 'object' && typeof b === 'object') {\n const aKeys = Object.keys(a);\n const bKeys = Object.keys(b);\n if (aKeys.length !== bKeys.length) {\n return false;\n }\n for (const key of aKeys) {\n if (!b.hasOwnProperty(key)) {\n return false;\n }\n if (!deepEqual(a[key], b[key])) {\n return false;\n }\n }\n return true;\n }\n return false;\n}\n//# sourceMappingURL=deep-equal.js.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5 @@
|
|
|
1
1
|
import { useContext as p, useMemo as r, useEffect as m } from "react";
|
|
2
|
-
import { MapContext as d } from "./
|
|
2
|
+
import { MapContext as d } from "./main.js8.mjs";
|
|
3
3
|
function x(c, o, n, l) {
|
|
4
4
|
const e = p(d), t = r(() => c(e), []);
|
|
5
5
|
return m(() => {
|
|
@@ -12,4 +12,4 @@ function x(c, o, n, l) {
|
|
|
12
12
|
export {
|
|
13
13
|
x as default
|
|
14
14
|
};
|
|
15
|
-
//# sourceMappingURL=
|
|
15
|
+
//# sourceMappingURL=main.js25.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.js25.mjs","sources":["../../node_modules/react-map-gl/dist/esm/components/use-control.js"],"sourcesContent":["import { useContext, useMemo, useEffect } from 'react';\nimport { MapContext } from './map';\nfunction useControl(onCreate, arg1, arg2, arg3) {\n const context = useContext(MapContext);\n const ctrl = useMemo(() => onCreate(context), []);\n useEffect(() => {\n const opts = (arg3 || arg2 || arg1);\n const onAdd = typeof arg1 === 'function' && typeof arg2 === 'function' ? arg1 : null;\n const onRemove = typeof arg2 === 'function' ? arg2 : typeof arg1 === 'function' ? arg1 : null;\n const { map } = context;\n if (!map.hasControl(ctrl)) {\n map.addControl(ctrl, opts === null || opts === void 0 ? void 0 : opts.position);\n if (onAdd) {\n onAdd(context);\n }\n }\n return () => {\n if (onRemove) {\n onRemove(context);\n }\n // Map might have been removed (parent effects are destroyed before child ones)\n if (map.hasControl(ctrl)) {\n map.removeControl(ctrl);\n }\n };\n }, []);\n return ctrl;\n}\nexport default useControl;\n//# sourceMappingURL=use-control.js.map"],"names":["useControl","onCreate","arg1","arg2","arg3","context","useContext","MapContext","ctrl","useMemo","useEffect","opts","onAdd","onRemove","map"],"mappings":";;AAEA,SAASA,EAAWC,GAAUC,GAAMC,GAAMC,GAAM;AAC5C,QAAMC,IAAUC,EAAWC,CAAU,GAC/BC,IAAOC,EAAQ,MAAMR,EAASI,CAAO,GAAG,CAAA,CAAE;AAChD,SAAAK,EAAU,MAAM;AACZ,UAAMC,IAAQP,KAAQD,KAAQD,GACxBU,IAAQ,OAAOV,KAAS,cAAc,OAAOC,KAAS,aAAaD,IAAO,MAC1EW,IAAW,OAAOV,KAAS,aAAaA,IAAO,OAAOD,KAAS,aAAaA,IAAO,MACnF,EAAE,KAAAY,EAAK,IAAGT;AAChB,WAAKS,EAAI,WAAWN,CAAI,MACpBM,EAAI,WAAWN,GAAMG,KAAS,OAA0B,SAASA,EAAK,QAAQ,GAC1EC,KACAA,EAAMP,CAAO,IAGd,MAAM;AACT,MAAIQ,KACAA,EAASR,CAAO,GAGhBS,EAAI,WAAWN,CAAI,KACnBM,EAAI,cAAcN,CAAI;AAAA,IAEtC;AAAA,EACK,GAAE,CAAE,CAAA,GACEA;AACX;","x_google_ignoreList":[0]}
|