@local-logic/maps 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-CQ-JcUiN.js → index-BOJCRr60.js} +2 -2
- package/dist/{index-CHAIEOV7.js → index-BUZonjTY.js} +1 -1
- package/dist/{index-Dsui7RRW.js → index-BabQioiH.js} +1 -1
- package/dist/{index-DbGw-3H2.js → index-CTWLtI5f.js} +1 -1
- package/dist/{index-zSTRJ71g.js → index-CWXZA3V3.js} +2 -2
- package/dist/{index-E5WaU61r.js → index-Ci9PQ3VM.js} +2 -2
- package/dist/{index-H-u2bXnc.js → index-D37STE_k.js} +4 -4
- package/dist/{index-CyFPuX3E.js → index-D8-yY6UK.js} +1 -1
- package/dist/{index-tFIqhoKk.js → index-DHOxmHER.js} +2 -2
- package/dist/{index-Id4hTpek.js → index-DKy2opdk.js} +1 -1
- package/dist/{index-DL98jat0.js → index-Dy0j33aN.js} +2 -2
- package/dist/{index-CscTuMMv.js → index-k9UFzKZZ.js} +1 -1
- package/dist/{index-BnFfeG7K.js → index-vIYPnHrB.js} +2 -2
- package/dist/{index-BDKwzoXR.js → index-xDS1OfMB.js} +1 -1
- package/dist/index.es.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/src/components/Map/Root/Layers/utils.d.ts.map +1 -1
- package/dist/{styles-D8bDP2Op.js → styles-B3ZaR0wz.js} +1 -1
- package/dist/utils-IAXGPK5I.js +33 -0
- package/package.json +1 -1
- package/dist/utils-CNmTUsO1.js +0 -30
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as f, jsx as r } from "react/jsx-runtime";
|
|
2
2
|
import { useMap as k, AdvancedMarker as u } from "@vis.gl/react-google-maps";
|
|
3
|
-
import { u as M, M as g } from "./index-
|
|
4
|
-
import { C, c as v, M as I } from "./index-
|
|
3
|
+
import { u as M, M as g } from "./index-D37STE_k.js";
|
|
4
|
+
import { C, c as v, M as I } from "./index-BUZonjTY.js";
|
|
5
5
|
function x({
|
|
6
6
|
clusters: a,
|
|
7
7
|
colors: o,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as r, jsxs as l, Fragment as d } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo as f } from "react";
|
|
3
|
-
import { u as h, M as n } from "./index-
|
|
3
|
+
import { u as h, M as n } from "./index-D37STE_k.js";
|
|
4
4
|
import { MapPinIcon as g } from "@phosphor-icons/react";
|
|
5
5
|
const a = `
|
|
6
6
|
group/marker cursor-pointer rounded-full
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as P, jsxs as x, Fragment as A } from "react/jsx-runtime";
|
|
2
2
|
import { useState as v, useEffect as L, useRef as C, useCallback as E } from "react";
|
|
3
3
|
import { APIProvider as O, Map as z, ControlPosition as g, useMap as G } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { u as B, D as h, W as f, a as Z, m as I } from "./index-
|
|
4
|
+
import { u as B, D as h, W as f, a as Z, m as I } from "./index-D37STE_k.js";
|
|
5
5
|
import { t as R } from "./index-DscDx7HE.js";
|
|
6
6
|
const F = {
|
|
7
7
|
"top-left": g.LEFT_TOP,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as v, jsx as g } from "react/jsx-runtime";
|
|
2
2
|
import { useState as T, useRef as E, useCallback as x, useEffect as b } from "react";
|
|
3
3
|
import { M as L, N as A, u as G } from "./logo-control-CHapR1Dt.js";
|
|
4
|
-
import { u as M, D as m, a as F, m as S } from "./index-
|
|
4
|
+
import { u as M, D as m, a as F, m as S } from "./index-D37STE_k.js";
|
|
5
5
|
import { t as h } from "./index-DscDx7HE.js";
|
|
6
6
|
const z = {
|
|
7
7
|
en: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useEffect as M } from "react";
|
|
3
3
|
import { u as z, P as D } from "./scale-control-Dsir9fWY.js";
|
|
4
|
-
import { u as H, P as T } from "./index-
|
|
5
|
-
import { c as j, m as A } from "./styles-
|
|
4
|
+
import { u as H, P as T } from "./index-D37STE_k.js";
|
|
5
|
+
import { c as j, m as A } from "./styles-B3ZaR0wz.js";
|
|
6
6
|
function Z({
|
|
7
7
|
latitude: h,
|
|
8
8
|
longitude: l,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import { useRef as d, useEffect as M } from "react";
|
|
3
3
|
import { u as D, P as H } from "./logo-control-CHapR1Dt.js";
|
|
4
|
-
import { u as j, P as T } from "./index-
|
|
5
|
-
import { c as x, m as A } from "./styles-
|
|
4
|
+
import { u as j, P as T } from "./index-D37STE_k.js";
|
|
5
|
+
import { c as x, m as A } from "./styles-B3ZaR0wz.js";
|
|
6
6
|
function Z({
|
|
7
7
|
latitude: l,
|
|
8
8
|
longitude: h,
|
|
@@ -15,7 +15,7 @@ const et = at.createContext({}), R = () => ct(et), C = {
|
|
|
15
15
|
bottom: 10,
|
|
16
16
|
left: 10,
|
|
17
17
|
right: 10
|
|
18
|
-
}, J = 10, pt = 22, Jt = 10, ht = 30, lt = 60, Wt = 15, ft = [-180, -85.0511, 180, 85.0511], dt = "w-full h-full relative overflow-hidden", mt = w(() => import("./index-
|
|
18
|
+
}, J = 10, pt = 22, Jt = 10, ht = 30, lt = 60, Wt = 15, ft = [-180, -85.0511, 180, 85.0511], dt = "w-full h-full relative overflow-hidden", mt = w(() => import("./index-CTWLtI5f.js")), gt = w(() => import("./index-BabQioiH.js")), yt = w(() => import("./index-xDS1OfMB.js")), wt = w(() => import("./index-qqbvBkdn.js")), Mt = ({ children: r }) => {
|
|
19
19
|
const {
|
|
20
20
|
mapProvider: t,
|
|
21
21
|
center: e,
|
|
@@ -569,7 +569,7 @@ var Lt = function(t) {
|
|
|
569
569
|
supercluster: c.current
|
|
570
570
|
};
|
|
571
571
|
};
|
|
572
|
-
const Rt = w(() => import("./index-
|
|
572
|
+
const Rt = w(() => import("./index-Dy0j33aN.js")), It = w(() => import("./index-BOJCRr60.js")), Ut = w(() => import("./index-vIYPnHrB.js"));
|
|
573
573
|
function Dt({ isLoading: r, markers: t, onClick: e, ...n }) {
|
|
574
574
|
const { mapProvider: o, activeMarker: i, zoom: a, setMarkerPoints: c, setClusterPoints: s } = R();
|
|
575
575
|
H(() => {
|
|
@@ -650,7 +650,7 @@ function Dt({ isLoading: r, markers: t, onClick: e, ...n }) {
|
|
|
650
650
|
}
|
|
651
651
|
) : null;
|
|
652
652
|
}
|
|
653
|
-
const Zt = w(() => import("./index-
|
|
653
|
+
const Zt = w(() => import("./index-Ci9PQ3VM.js")), Bt = w(() => import("./index-DHOxmHER.js")), Ft = w(() => import("./index-CWXZA3V3.js"));
|
|
654
654
|
function Nt({ children: r, anchor: t = "bottom", ...e }) {
|
|
655
655
|
const { mapProvider: n } = R(), o = S(() => {
|
|
656
656
|
switch (n?.name) {
|
|
@@ -666,7 +666,7 @@ function Nt({ children: r, anchor: t = "bottom", ...e }) {
|
|
|
666
666
|
}, [n]);
|
|
667
667
|
return o ? /* @__PURE__ */ O(o, { ...e, anchor: t, children: r }) : null;
|
|
668
668
|
}
|
|
669
|
-
const zt = w(() => import("./index-
|
|
669
|
+
const zt = w(() => import("./index-DKy2opdk.js")), jt = w(() => import("./index-k9UFzKZZ.js")), Gt = w(() => import("./index-D8-yY6UK.js"));
|
|
670
670
|
function $t(r) {
|
|
671
671
|
const { mapProvider: t } = R(), e = S(() => {
|
|
672
672
|
switch (t?.name) {
|
|
@@ -2,7 +2,7 @@ import { jsx as c, Fragment as b } from "react/jsx-runtime";
|
|
|
2
2
|
import * as $ from "react";
|
|
3
3
|
import { useContext as S, useRef as k, useState as C, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
4
|
import { b as x, d as u } from "./scale-control-Dsir9fWY.js";
|
|
5
|
-
import { g as I } from "./utils-
|
|
5
|
+
import { g as I } from "./utils-IAXGPK5I.js";
|
|
6
6
|
function s(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as E } from "react/jsx-runtime";
|
|
2
2
|
import { useState as L, useRef as M, useCallback as N, useEffect as f, useMemo as W } from "react";
|
|
3
3
|
import { useMap as _, InfoWindow as x } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { u as z, P as y } from "./index-
|
|
5
|
-
import { c as H, m as j } from "./styles-
|
|
4
|
+
import { u as z, P as y } from "./index-D37STE_k.js";
|
|
5
|
+
import { c as H, m as j } from "./styles-B3ZaR0wz.js";
|
|
6
6
|
function Z({
|
|
7
7
|
latitude: g,
|
|
8
8
|
longitude: m,
|
|
@@ -2,7 +2,7 @@ import { jsx as f, Fragment as x } from "react/jsx-runtime";
|
|
|
2
2
|
import * as $ from "react";
|
|
3
3
|
import { useContext as S, useRef as k, useState as b, useMemo as g, useEffect as w, cloneElement as j } from "react";
|
|
4
4
|
import { b as C, d as u } from "./logo-control-CHapR1Dt.js";
|
|
5
|
-
import { g as I } from "./utils-
|
|
5
|
+
import { g as I } from "./utils-IAXGPK5I.js";
|
|
6
6
|
function s(t, e) {
|
|
7
7
|
if (!t)
|
|
8
8
|
throw new Error(e);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as k } from "./logo-control-CHapR1Dt.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as v } from "./index-
|
|
4
|
+
import { u, M } from "./index-D37STE_k.js";
|
|
5
|
+
import { C as g, c as C, M as v } from "./index-BUZonjTY.js";
|
|
6
6
|
function x({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: o,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as P, Fragment as u } from "react/jsx-runtime";
|
|
2
2
|
import { useState as s, useContext as M, useEffect as g } from "react";
|
|
3
3
|
import { GoogleMapsContext as L } from "@vis.gl/react-google-maps";
|
|
4
|
-
import { a as k } from "./utils-
|
|
4
|
+
import { a as k } from "./utils-IAXGPK5I.js";
|
|
5
5
|
function f(o, e, r) {
|
|
6
6
|
switch (o) {
|
|
7
7
|
case "fill":
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as f, jsx as i } from "react/jsx-runtime";
|
|
2
2
|
import { a as k } from "./scale-control-Dsir9fWY.js";
|
|
3
3
|
import "react";
|
|
4
|
-
import { u, M } from "./index-
|
|
5
|
-
import { C as g, c as C, M as b } from "./index-
|
|
4
|
+
import { u, M } from "./index-D37STE_k.js";
|
|
5
|
+
import { C as g, c as C, M as b } from "./index-BUZonjTY.js";
|
|
6
6
|
function _({
|
|
7
7
|
clusters: n,
|
|
8
8
|
colors: r,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as v, jsx as C } from "react/jsx-runtime";
|
|
2
2
|
import { useState as x, useRef as Z, useCallback as h, useEffect as d } from "react";
|
|
3
3
|
import { M as B, N as L, u as T } from "./scale-control-Dsir9fWY.js";
|
|
4
|
-
import { u as M, D as p, a as z, m as A } from "./index-
|
|
4
|
+
import { u as M, D as p, a as z, m as A } from "./index-D37STE_k.js";
|
|
5
5
|
import { t as E } from "./index-DscDx7HE.js";
|
|
6
6
|
const P = {
|
|
7
7
|
en: {
|
package/dist/index.es.js
CHANGED
package/dist/index.umd.js
CHANGED
|
@@ -35,4 +35,4 @@
|
|
|
35
35
|
`;function tt({isActive:e=!1,colors:t,icon:o}){const{zoom:n,mapProvider:r}=O(),i=c.useMemo(()=>r.name==="google"?n-1<ve+1:n<ve,[n,r]);return h.jsxs("div",{className:ai,style:{"--background":t?.background,"--fill":t?.fill},children:[h.jsx("div",{className:ge,"data-is-zoomed-out":i,"data-is-active":e,children:h.jsx(Ae,{icon:o})}),!i&&h.jsxs(h.Fragment,{children:[h.jsx("div",{className:`${ge} ${so}`}),h.jsx("div",{className:`${ge} ${so}`})]})]})}function li({clusters:e,colors:t,clusterIcon:o,onClick:n,doesSuperclusterContainActiveMarker:r}){const{activeMarker:i,zoom:s}=O(),l=a=>u=>{u.originalEvent.stopPropagation(),!a.properties.disableClick&&n?.(a)};return e?.map((a,u)=>{const f=a.geometry.coordinates[0],d=a.geometry.coordinates[1];return h.jsxs(zt,{anchor:"bottom",longitude:f,latitude:d,onClick:l(a),children:[a.properties.cluster&&a.properties.cluster_id&&h.jsx(tt,{colors:t,icon:o,isActive:r(a.properties.cluster_id)}),!a.properties.cluster&&h.jsx("div",{className:ge,style:a.properties.defaultColor?{}:{"--background":t?.background,"--fill":t?.fill},"data-is-cluster":!!a.properties.cluster,"data-is-zoomed-out":s<ve,"data-is-active":i?.id===a.properties.id,children:h.jsx(Ae,{icon:a.properties.icon})})]},`map-marker-${f}-${d}-${u}`)})}const ci=Object.freeze(Object.defineProperty({__proto__:null,default:li},Symbol.toStringTag,{value:"Module"}));function ui({clusters:e,colors:t,clusterIcon:o,onClick:n,doesSuperclusterContainActiveMarker:r}){U.useMap();const{activeMarker:i,zoom:s}=O(),l=a=>()=>{a.properties.disableClick||n?.(a)};return e?.map((a,u)=>{const f=a.geometry.coordinates[0],d=a.geometry.coordinates[1];return h.jsxs(U.AdvancedMarker,{position:{lat:d,lng:f},onClick:l(a),children:[a.properties.cluster&&h.jsx(tt,{colors:t,icon:o,isActive:r(a.properties.cluster_id)}),!a.properties.cluster&&h.jsx("div",{className:ge,style:a.properties.defaultColor?{}:{"--background":t?.background,"--fill":t?.fill},"data-is-cluster":!!a.properties.cluster,"data-is-zoomed-out":s-1<ve+1,"data-is-active":i?.id===a.properties.id,children:h.jsx(Ae,{icon:a.properties.icon})})]},`map-marker-${f}-${d}-${u}`)})}const di=Object.freeze(Object.defineProperty({__proto__:null,default:ui},Symbol.toStringTag,{value:"Module"}));function fi({clusters:e,colors:t,clusterIcon:o,onClick:n,doesSuperclusterContainActiveMarker:r}){const{activeMarker:i,zoom:s}=O(),l=a=>u=>{u.originalEvent.stopPropagation(),!a.properties.disableClick&&n?.(a)};return e?.map((a,u)=>{const f=a.geometry.coordinates[0],d=a.geometry.coordinates[1];return h.jsxs(Gt,{anchor:"bottom",longitude:f,latitude:d,onClick:l(a),children:[a.properties.cluster&&h.jsx(tt,{colors:t,icon:o,isActive:r(a.properties.cluster_id)}),!a.properties.cluster&&h.jsx("div",{className:ge,style:a.properties.defaultColor?{}:{"--background":t?.background,"--fill":t?.fill},"data-is-cluster":!!a.properties.cluster,"data-is-zoomed-out":s<ve,"data-is-active":i?.id===a.properties.id,children:h.jsx(Ae,{icon:a.properties.icon})})]},`map-marker-${f}-${d}-${u}`)})}const mi=Object.freeze(Object.defineProperty({__proto__:null,default:fi},Symbol.toStringTag,{value:"Module"}));function ot(e,t,o,n,r,i){const s={left:r.left||be.left,right:r.right||be.right,top:r.top||be.top,bottom:r.bottom||be.bottom},l=n.top||0,a=n.left||0,u={top:e.top-l,bottom:e.bottom-l,left:e.left-a,right:e.right-a,width:e.width,height:e.height},f={top:u.top>=s.top,left:u.left>=s.left,bottom:u.bottom<=n.height-s.bottom,right:u.right<=n.width-s.right};if(!!Object.values(f).includes(!1)){let m=0,p=0;f.top?f.bottom||(m=n.height-s.bottom-u.bottom):m=s.top-u.top,f.left?f.right||(p=n.width-s.right-u.right):p=s.left-u.left,i({longitude:t.longitude-p/n.width*(o.right-o.left),latitude:t.latitude+m/n.height*(o.top-o.bottom)})}}const nt=`
|
|
36
36
|
bg-base-white border border-primary-100 w-auto overflow-hidden
|
|
37
37
|
rounded-lg shadow-sm
|
|
38
|
-
`;function pi({latitude:e,longitude:t,anchor:o,offset:n=[0,-35],onClose:r,children:i}){const s=c.useRef(null),{current:l}=wt(),{activeMarker:a,clusterPoints:u,mapPadding:f}=O(),d=c.useRef(u),m=c.useRef(a);return c.useEffect(()=>{const p=d.current!==u,y=m.current===a;p&&y&&typeof a<"u"&&r?.(),d.current=u,m.current=a},[u,a,r]),c.useEffect(()=>{const p=s?.current;let y={width:0,height:0};const x=()=>{if(!l||!p||typeof a>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getCanvas(),P=p.getElement()?.getBoundingClientRect();if(!C||!P)return;const A=Math.abs(P.width-y.width),_=Math.abs(P.height-y.height);if(y.width!==0&&A<le&&_<le)return;y={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat,longitude:M.lng},G={left:C.getWest(),right:C.getEast(),top:C.getNorth(),bottom:C.getSouth()},V={left:f.left||0,right:f.right||0,top:f.top||0,bottom:f.bottom||0};ot(P,R,G,X,V,q=>{l.easeTo({center:[q.longitude,q.latitude],duration:500})})};let g;const b=new ResizeObserver(()=>{g&&clearTimeout(g),g=window.setTimeout(()=>{x()},100)}),L=p?.getElement();return L&&b.observe(L),()=>{g&&clearTimeout(g),b.disconnect()}},[l,s,a,f.top,f.bottom,f.left,f.right]),typeof e>"u"||typeof t>"u"?null:h.jsx(fn,{ref:s,className:"maplibre-popup",focusAfterOpen:!0,latitude:e,longitude:t,anchor:o,offset:n,onClose:r,closeButton:!1,children:h.jsx("div",{className:nt,children:i})})}const gi=Object.freeze(Object.defineProperty({__proto__:null,default:pi},Symbol.toStringTag,{value:"Module"}));function hi({latitude:e,longitude:t,offset:o=[0,-25],onClose:n,children:r}){const[i,s]=c.useState(null),l=U.useMap(),{mapPadding:a,activeMarker:u,clusterPoints:f}=O(),d=c.useRef(f),m=c.useRef(u),p=c.useCallback(x=>{s(x)},[]);c.useEffect(()=>{const x=d.current!==f,g=m.current===u;x&&g&&typeof u<"u"&&n?.(),d.current=f,m.current=u},[f,u,n]),c.useEffect(()=>{let x={width:0,height:0};const g=()=>{if(!l||!i||typeof u>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getDiv(),P=i?.getBoundingClientRect();if(!C||!M||!P)return;const A=Math.abs(P.width-x.width),_=Math.abs(P.height-x.height);if(x.width!==0&&A<le&&_<le)return;x={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat(),longitude:M.lng()},G={left:C.getSouthWest().lng(),right:C.getNorthEast().lng(),top:C.getNorthEast().lat(),bottom:C.getSouthWest().lat()};ot(P,R,G,X,a,V=>{l.panTo(new google.maps.LatLng(V.latitude,V.longitude))})};let b;const L=new ResizeObserver(()=>{b&&clearTimeout(b),b=window.setTimeout(()=>{g()},100)});return i&&L.observe(i),()=>{b&&clearTimeout(b),L.disconnect()}},[l,i,u,a.top,a.bottom,a.left,a.right]),c.useEffect(()=>{if(!l)return;const x=l.addListener("click",()=>{n?.()});return()=>{x.remove()}},[l]);const y=c.useMemo(()=>Array.isArray(o)?[o[0],o[1]]:[o,o],[o]);return typeof e>"u"||typeof t>"u"?null:h.jsx(U.InfoWindow,{shouldFocus:!0,disableAutoPan:!0,position:{lat:e,lng:t},pixelOffset:y,children:h.jsx("div",{ref:p,className:nt,children:r})})}const yi=Object.freeze(Object.defineProperty({__proto__:null,default:hi},Symbol.toStringTag,{value:"Module"}));function bi({latitude:e,longitude:t,anchor:o,offset:n=[0,-35],onClose:r,children:i}){const s=c.useRef(null),{current:l}=$t(),{activeMarker:a,clusterPoints:u,mapPadding:f}=O(),d=c.useRef(u),m=c.useRef(a);return c.useEffect(()=>{const p=d.current!==u,y=m.current===a;p&&y&&typeof a<"u"&&r?.(),d.current=u,m.current=a},[u,a,r]),c.useEffect(()=>{const p=s?.current;let y={width:0,height:0};const x=()=>{if(!l||!p||typeof a>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getCanvas(),P=p.getElement()?.getBoundingClientRect();if(!C||!P)return;const A=Math.abs(P.width-y.width),_=Math.abs(P.height-y.height);if(y.width!==0&&A<le&&_<le)return;y={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat,longitude:M.lng},G={left:C.getWest(),right:C.getEast(),top:C.getNorth(),bottom:C.getSouth()},V={left:f.left||0,right:f.right||0,top:f.top||0,bottom:f.bottom||0};ot(P,R,G,X,V,q=>{l.easeTo({center:[q.longitude,q.latitude],duration:500})})};let g;const b=new ResizeObserver(()=>{g&&clearTimeout(g),g=window.setTimeout(()=>{x()},100)}),L=p?.getElement();return L&&b.observe(L),()=>{g&&clearTimeout(g),b.disconnect()}},[l,s,a,f.top,f.bottom,f.left,f.right]),typeof e>"u"||typeof t>"u"?null:h.jsx(nr,{ref:s,className:"mapbox-popup",focusAfterOpen:!0,latitude:e,longitude:t,anchor:o,offset:n,onClose:r,closeButton:!1,children:h.jsx("div",{className:nt,children:i})})}const vi=Object.freeze(Object.defineProperty({__proto__:null,default:bi},Symbol.toStringTag,{value:"Module"}));function ao(e=[],t="MultiPolygon"){const o=
|
|
38
|
+
`;function pi({latitude:e,longitude:t,anchor:o,offset:n=[0,-35],onClose:r,children:i}){const s=c.useRef(null),{current:l}=wt(),{activeMarker:a,clusterPoints:u,mapPadding:f}=O(),d=c.useRef(u),m=c.useRef(a);return c.useEffect(()=>{const p=d.current!==u,y=m.current===a;p&&y&&typeof a<"u"&&r?.(),d.current=u,m.current=a},[u,a,r]),c.useEffect(()=>{const p=s?.current;let y={width:0,height:0};const x=()=>{if(!l||!p||typeof a>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getCanvas(),P=p.getElement()?.getBoundingClientRect();if(!C||!P)return;const A=Math.abs(P.width-y.width),_=Math.abs(P.height-y.height);if(y.width!==0&&A<le&&_<le)return;y={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat,longitude:M.lng},G={left:C.getWest(),right:C.getEast(),top:C.getNorth(),bottom:C.getSouth()},V={left:f.left||0,right:f.right||0,top:f.top||0,bottom:f.bottom||0};ot(P,R,G,X,V,q=>{l.easeTo({center:[q.longitude,q.latitude],duration:500})})};let g;const b=new ResizeObserver(()=>{g&&clearTimeout(g),g=window.setTimeout(()=>{x()},100)}),L=p?.getElement();return L&&b.observe(L),()=>{g&&clearTimeout(g),b.disconnect()}},[l,s,a,f.top,f.bottom,f.left,f.right]),typeof e>"u"||typeof t>"u"?null:h.jsx(fn,{ref:s,className:"maplibre-popup",focusAfterOpen:!0,latitude:e,longitude:t,anchor:o,offset:n,onClose:r,closeButton:!1,children:h.jsx("div",{className:nt,children:i})})}const gi=Object.freeze(Object.defineProperty({__proto__:null,default:pi},Symbol.toStringTag,{value:"Module"}));function hi({latitude:e,longitude:t,offset:o=[0,-25],onClose:n,children:r}){const[i,s]=c.useState(null),l=U.useMap(),{mapPadding:a,activeMarker:u,clusterPoints:f}=O(),d=c.useRef(f),m=c.useRef(u),p=c.useCallback(x=>{s(x)},[]);c.useEffect(()=>{const x=d.current!==f,g=m.current===u;x&&g&&typeof u<"u"&&n?.(),d.current=f,m.current=u},[f,u,n]),c.useEffect(()=>{let x={width:0,height:0};const g=()=>{if(!l||!i||typeof u>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getDiv(),P=i?.getBoundingClientRect();if(!C||!M||!P)return;const A=Math.abs(P.width-x.width),_=Math.abs(P.height-x.height);if(x.width!==0&&A<le&&_<le)return;x={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat(),longitude:M.lng()},G={left:C.getSouthWest().lng(),right:C.getNorthEast().lng(),top:C.getNorthEast().lat(),bottom:C.getSouthWest().lat()};ot(P,R,G,X,a,V=>{l.panTo(new google.maps.LatLng(V.latitude,V.longitude))})};let b;const L=new ResizeObserver(()=>{b&&clearTimeout(b),b=window.setTimeout(()=>{g()},100)});return i&&L.observe(i),()=>{b&&clearTimeout(b),L.disconnect()}},[l,i,u,a.top,a.bottom,a.left,a.right]),c.useEffect(()=>{if(!l)return;const x=l.addListener("click",()=>{n?.()});return()=>{x.remove()}},[l]);const y=c.useMemo(()=>Array.isArray(o)?[o[0],o[1]]:[o,o],[o]);return typeof e>"u"||typeof t>"u"?null:h.jsx(U.InfoWindow,{shouldFocus:!0,disableAutoPan:!0,position:{lat:e,lng:t},pixelOffset:y,children:h.jsx("div",{ref:p,className:nt,children:r})})}const yi=Object.freeze(Object.defineProperty({__proto__:null,default:hi},Symbol.toStringTag,{value:"Module"}));function bi({latitude:e,longitude:t,anchor:o,offset:n=[0,-35],onClose:r,children:i}){const s=c.useRef(null),{current:l}=$t(),{activeMarker:a,clusterPoints:u,mapPadding:f}=O(),d=c.useRef(u),m=c.useRef(a);return c.useEffect(()=>{const p=d.current!==u,y=m.current===a;p&&y&&typeof a<"u"&&r?.(),d.current=u,m.current=a},[u,a,r]),c.useEffect(()=>{const p=s?.current;let y={width:0,height:0};const x=()=>{if(!l||!p||typeof a>"u")return;const C=l.getBounds(),M=l.getCenter(),k=l.getCanvas(),P=p.getElement()?.getBoundingClientRect();if(!C||!P)return;const A=Math.abs(P.width-y.width),_=Math.abs(P.height-y.height);if(y.width!==0&&A<le&&_<le)return;y={width:P.width,height:P.height};const $=k.getBoundingClientRect(),X={width:k.clientWidth,height:k.clientHeight,top:$.top,left:$.left},R={latitude:M.lat,longitude:M.lng},G={left:C.getWest(),right:C.getEast(),top:C.getNorth(),bottom:C.getSouth()},V={left:f.left||0,right:f.right||0,top:f.top||0,bottom:f.bottom||0};ot(P,R,G,X,V,q=>{l.easeTo({center:[q.longitude,q.latitude],duration:500})})};let g;const b=new ResizeObserver(()=>{g&&clearTimeout(g),g=window.setTimeout(()=>{x()},100)}),L=p?.getElement();return L&&b.observe(L),()=>{g&&clearTimeout(g),b.disconnect()}},[l,s,a,f.top,f.bottom,f.left,f.right]),typeof e>"u"||typeof t>"u"?null:h.jsx(nr,{ref:s,className:"mapbox-popup",focusAfterOpen:!0,latitude:e,longitude:t,anchor:o,offset:n,onClose:r,closeButton:!1,children:h.jsx("div",{className:nt,children:i})})}const vi=Object.freeze(Object.defineProperty({__proto__:null,default:bi},Symbol.toStringTag,{value:"Module"}));function ao(e=[],t="MultiPolygon"){const o=s=>Object.values(s).map(l=>Array.isArray(l[0])?o(l):[l[1],l[0]]),n=o(e);let r;if(t==="MultiPolygon"){const s=n[0]?.[0],l=n[0]?.[1];r=[[s||[],...l||[]]]}else r=n;return{type:"FeatureCollection",features:[{type:"Feature",geometry:{type:t,coordinates:r}}]}}function wi(e=[],t="MultiPolygon"){const o=r=>Object.values(r).map(i=>Array.isArray(i[0])?o(i):{lat:i[0],lng:i[1]}),n=o(e);if(t==="MultiPolygon"){const r=n,i=r[0]?.[0],s=r[0]?.[1];return[i||[],...s||[]]}return n}function lo(e,t,o){switch(e){case"fill":return{"fill-color":t,"fill-opacity":.25};case"line":return{"line-color":t,"line-width":o==="LineString"?6:2};default:return{}}}function xi({sources:e}){const t=c.useMemo(()=>!Array.isArray(e)||e.length===0?[]:e.map(o=>({...o,geoJson:o.geometry?ao(o.geometry,o.type):null})),[e]);return t?.length===0?null:h.jsx(h.Fragment,{children:t?.map(o=>h.jsx("div",{children:o.geoJson&&h.jsx(Mn,{id:o.key,type:"geojson",data:o.geoJson,children:o.layer&&(Array.isArray(o.layer)?o.layer.map((n,r)=>h.jsx(Tt,{id:`${o.key}-${r}`,type:n.type,paint:lo(n.type,n.color,o.type)},`${o.key}-${r}`)):h.jsx(Tt,{id:o.key,type:o.layer.type,paint:lo(o.layer.type,o.layer.color,o.type)}))},o.key)},o.key))})}const Ci=Object.freeze(Object.defineProperty({__proto__:null,default:xi},Symbol.toStringTag,{value:"Module"}));function co(e,t,o){switch(e){case"fill":return{fillColor:t,fillOpacity:.25};case"line":return{strokeColor:t,strokeWeight:o==="LineString"?6:2};default:return{}}}function _i({sources:e}){const[t,o]=c.useState(null),[n,r]=c.useState([]),i=c.useContext(U.GoogleMapsContext);return c.useEffect(()=>{i&&o(i.map)},[i]),c.useEffect(()=>{if(n.forEach(l=>{l?.setMap(null)}),!t||typeof e>"u"||e.length===0)return;const s=e.map(l=>{const a={type:l.type||"MultiPolygon",clickable:!1};if(Array.isArray(l.layer))l.layer.forEach(d=>{const m=co(d.type,d.color,l.type);Object.assign(a,m)});else{const d=co(l.layer.type,l.layer.color,l.type);Object.assign(a,d)}let u;const f=wi(l.geometry,a.type);return l.type==="LineString"?u=new google.maps.Polyline({strokeWeight:6,path:f,...a}):u=new google.maps.Polygon({strokeWeight:0,fillOpacity:0,paths:f,...a}),u.setMap(t),u});return r(s),s.forEach(l=>{l.setMap(t)}),()=>{s.forEach(l=>{l?.setMap(null)})}},[t,e]),h.jsx(h.Fragment,{})}const Mi=Object.freeze(Object.defineProperty({__proto__:null,default:_i},Symbol.toStringTag,{value:"Module"}));function uo(e,t,o){switch(e){case"fill":return{"fill-color":t,"fill-opacity":.25};case"line":return{"line-color":t,"line-width":o==="LineString"?6:2};default:return{}}}function ki({sources:e}){const t=c.useMemo(()=>!Array.isArray(e)||e.length===0?[]:e.map(o=>({...o,geoJson:o.geometry?ao(o.geometry,o.type):null})),[e]);return t?.length===0?null:h.jsx(h.Fragment,{children:t?.map(o=>h.jsx("div",{children:o.geoJson&&h.jsx(mr,{id:o.key,type:"geojson",data:o.geoJson,children:o.layer&&(Array.isArray(o.layer)?o.layer.map((n,r)=>h.jsx(Ht,{id:`${o.key}-${r}`,type:n.type,paint:uo(n.type,n.color,o.type)},`${o.key}-${r}`)):h.jsx(Ht,{id:o.key,type:o.layer.type,paint:uo(o.layer.type,o.layer.color,o.type)}))},o.key)},o.key))})}const Si=Object.freeze(Object.defineProperty({__proto__:null,default:ki},Symbol.toStringTag,{value:"Module"}));D.LocalLogicMap=Xo,Object.defineProperty(D,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Map/Root/Layers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EACV,YAAY,EAIZ,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,0CAA0C,CACxD,QAAQ,GAAE,YAAiB,EAC3B,IAAI,GAAE,cAAc,GAAG,YAA6B,qFA6CrD;AAED,wBAAgB,sCAAsC,CACpD,QAAQ,GAAE,YAAiB,EAC3B,IAAI,GAAE,cAAc,GAAG,YAA6B,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/components/Map/Root/Layers/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE3E,OAAO,KAAK,EACV,YAAY,EAIZ,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAEjB,wBAAgB,0CAA0C,CACxD,QAAQ,GAAE,YAAiB,EAC3B,IAAI,GAAE,cAAc,GAAG,YAA6B,qFA6CrD;AAED,wBAAgB,sCAAsC,CACpD,QAAQ,GAAE,YAAiB,EAC3B,IAAI,GAAE,cAAc,GAAG,YAA6B,iDA6BrD"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
function u(a = [], l = "MultiPolygon") {
|
|
2
|
+
const n = (s) => Object.values(s).map((r) => Array.isArray(r[0]) ? n(r) : [r[1], r[0]]), o = n(a);
|
|
3
|
+
let t;
|
|
4
|
+
if (l === "MultiPolygon") {
|
|
5
|
+
const s = o[0]?.[0], r = o[0]?.[1];
|
|
6
|
+
t = [[s || [], ...r || []]];
|
|
7
|
+
} else
|
|
8
|
+
t = o;
|
|
9
|
+
return {
|
|
10
|
+
type: "FeatureCollection",
|
|
11
|
+
features: [
|
|
12
|
+
{
|
|
13
|
+
type: "Feature",
|
|
14
|
+
geometry: {
|
|
15
|
+
type: l,
|
|
16
|
+
coordinates: t
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function g(a = [], l = "MultiPolygon") {
|
|
23
|
+
const n = (t) => Object.values(t).map((e) => Array.isArray(e[0]) ? n(e) : { lat: e[0], lng: e[1] }), o = n(a);
|
|
24
|
+
if (l === "MultiPolygon") {
|
|
25
|
+
const t = o, e = t[0]?.[0], s = t[0]?.[1];
|
|
26
|
+
return [e || [], ...s || []];
|
|
27
|
+
}
|
|
28
|
+
return o;
|
|
29
|
+
}
|
|
30
|
+
export {
|
|
31
|
+
g as a,
|
|
32
|
+
u as g
|
|
33
|
+
};
|
package/package.json
CHANGED
package/dist/utils-CNmTUsO1.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
function g(a = [], n = "MultiPolygon") {
|
|
2
|
-
const o = (e) => Object.values(e).map((s) => Array.isArray(s[0]) ? o(s) : [s[1], s[0]]), r = o(a);
|
|
3
|
-
let t;
|
|
4
|
-
const l = r[0]?.[0];
|
|
5
|
-
if (n === "MultiPolygon") {
|
|
6
|
-
const e = r[0]?.[1];
|
|
7
|
-
t = [[l || [], ...e || []]];
|
|
8
|
-
} else
|
|
9
|
-
t = l || [];
|
|
10
|
-
return {
|
|
11
|
-
type: "FeatureCollection",
|
|
12
|
-
features: [
|
|
13
|
-
{
|
|
14
|
-
type: "Feature",
|
|
15
|
-
geometry: {
|
|
16
|
-
type: n,
|
|
17
|
-
coordinates: t
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
]
|
|
21
|
-
};
|
|
22
|
-
}
|
|
23
|
-
function i(a = [], n = "MultiPolygon") {
|
|
24
|
-
const o = (u) => Object.values(u).map((e) => Array.isArray(e[0]) ? o(e) : { lat: e[0], lng: e[1] }), r = o(a), t = r[0]?.[0], l = r[0]?.[1];
|
|
25
|
-
return n === "MultiPolygon" ? [t || [], ...l || []] : t || [];
|
|
26
|
-
}
|
|
27
|
-
export {
|
|
28
|
-
i as a,
|
|
29
|
-
g
|
|
30
|
-
};
|