@maptiler/geocoding-control 0.0.61 → 0.0.73
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/lib/leafletMapController.d.ts → leaflet-controller.d.ts} +0 -0
- package/leaflet-controller.js +15021 -0
- package/leaflet-controller.umd.js +25 -0
- package/{dist/lib/LeafletGeocodingControl.d.ts → leaflet.d.ts} +0 -0
- package/{dist/leaflet.js → leaflet.js} +1085 -1083
- package/{dist/leaflet.umd.js → leaflet.umd.js} +4 -4
- package/{dist/lib/MaplibreglGeocodingControl.d.ts → maplibre.d.ts} +0 -0
- package/{dist/lib/maplibreglMapController.d.ts → maplibregl-controller.d.ts} +1 -1
- package/maplibregl-controller.js +15041 -0
- package/maplibregl-controller.umd.js +25 -0
- package/{dist/maplibregl.js → maplibregl.js} +1144 -1142
- package/{dist/maplibregl.umd.js → maplibregl.umd.js} +4 -4
- package/{dist/lib/mask.d.ts → mask.d.ts} +2 -1
- package/package.json +50 -18
- package/react.d.ts +26 -0
- package/react.js +1327 -0
- package/react.umd.js +1 -0
- package/src/AppLeaflet.svelte +55 -0
- package/src/AppMaplibregl.svelte +45 -0
- package/src/lib/GeocodingControl.svelte +32 -28
- package/src/lib/ReactGeocodingControl.ts +158 -0
- package/src/lib/leafletMapController.ts +5 -6
- package/src/lib/maplibreglMapController.ts +4 -3
- package/src/lib/mask.ts +2 -1
- package/src/lib/types.ts +3 -1
- package/src/main-copy.ts +59 -0
- package/src/main.ts +65 -0
- package/src/vite-env.d.ts +2 -0
- package/style.css +1 -0
- package/{dist/lib/types.d.ts → types.d.ts} +2 -1
- package/LICENSE +0 -29
- package/README.md +0 -194
- package/dist/index.d.ts +0 -0
- package/dist/main.d.ts +0 -3
- package/dist/style.css +0 -1
package/react.umd.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(ne,K){typeof exports=="object"&&typeof module<"u"?K(exports,require("react")):typeof define=="function"&&define.amd?define(["exports","react"],K):(ne=typeof globalThis<"u"?globalThis:ne||self,K(ne.MaptilerGeocoder={},ne.React))})(this,function(ne,K){"use strict";function b(){}function st(t,e){for(const n in e)t[n]=e[n];return t}function Ve(t){return t()}function qe(){return Object.create(null)}function Y(t){t.forEach(Ve)}function He(t){return typeof t=="function"}function ue(t,e){return t!=t?e==e:t!==e||t&&typeof t=="object"||typeof t=="function"}function ut(t){return Object.keys(t).length===0}function ft(t,e,n,l){if(t){const o=Ke(t,e,n,l);return t[0](o)}}function Ke(t,e,n,l){return t[1]&&l?st(n.ctx.slice(),t[1](l(e))):n.ctx}function at(t,e,n,l){if(t[2]&&l){const o=t[2](l(n));if(e.dirty===void 0)return o;if(typeof o=="object"){const u=[],i=Math.max(e.dirty.length,o.length);for(let m=0;m<i;m+=1)u[m]=e.dirty[m]|o[m];return u}return e.dirty|o}return e.dirty}function dt(t,e,n,l,o,u){if(o){const i=Ke(e,n,l,u);t.p(i,o)}}function ht(t){if(t.ctx.length>32){const e=[],n=t.ctx.length/32;for(let l=0;l<n;l++)e[l]=-1;return e}return-1}function Qe(t){return t??""}function _(t,e){t.appendChild(e)}function F(t,e,n){t.insertBefore(e,n||null)}function x(t){t.parentNode&&t.parentNode.removeChild(t)}function mt(t,e){for(let n=0;n<t.length;n+=1)t[n]&&t[n].d(e)}function B(t){return document.createElement(t)}function $(t){return document.createElementNS("http://www.w3.org/2000/svg",t)}function le(t){return document.createTextNode(t)}function U(){return le(" ")}function V(t,e,n,l){return t.addEventListener(e,n,l),()=>t.removeEventListener(e,n,l)}function _t(t){return function(e){return e.preventDefault(),t.call(this,e)}}function c(t,e,n){n==null?t.removeAttribute(e):t.getAttribute(e)!==n&&t.setAttribute(e,n)}function gt(t){return Array.from(t.childNodes)}function be(t,e){e=""+e,t.wholeText!==e&&(t.data=e)}function Ue(t,e){t.value=e??""}function Q(t,e,n){t.classList[n?"add":"remove"](e)}function yt(t,e,{bubbles:n=!1,cancelable:l=!1}={}){const o=document.createEvent("CustomEvent");return o.initCustomEvent(t,n,l,e),o}let we;function ke(t){we=t}function We(){if(!we)throw new Error("Function called outside component initialization");return we}function bt(t){We().$$.on_destroy.push(t)}function wt(){const t=We();return(e,n,{cancelable:l=!1}={})=>{const o=t.$$.callbacks[e];if(o){const u=yt(e,n,{cancelable:l});return o.slice().forEach(i=>{i.call(t,u)}),!u.defaultPrevented}return!0}}const fe=[],Ae=[],Me=[],Ze=[],kt=Promise.resolve();let Ne=!1;function vt(){Ne||(Ne=!0,kt.then(Je))}function je(t){Me.push(t)}const Pe=new Set;let ae=0;function Je(){if(ae!==0)return;const t=we;do{try{for(;ae<fe.length;){const e=fe[ae];ae++,ke(e),pt(e.$$)}}catch(e){throw fe.length=0,ae=0,e}for(ke(null),fe.length=0,ae=0;Ae.length;)Ae.pop()();for(let e=0;e<Me.length;e+=1){const n=Me[e];Pe.has(n)||(Pe.add(n),n())}Me.length=0}while(fe.length);for(;Ze.length;)Ze.pop()();Ne=!1,Pe.clear(),ke(t)}function pt(t){if(t.fragment!==null){t.update(),Y(t.before_update);const e=t.dirty;t.dirty=[-1],t.fragment&&t.fragment.p(t.ctx,e),t.after_update.forEach(je)}}const Te=new Set;let re;function Re(){re={r:0,c:[],p:re}}function Ce(){re.r||Y(re.c),re=re.p}function S(t,e){t&&t.i&&(Te.delete(t),t.i(e))}function O(t,e,n,l){if(t&&t.o){if(Te.has(t))return;Te.add(t),re.c.push(()=>{Te.delete(t),l&&(n&&t.d(1),l())}),t.o(e)}else l&&l()}function ve(t){t&&t.c()}function de(t,e,n,l){const{fragment:o,after_update:u}=t.$$;o&&o.m(e,n),l||je(()=>{const i=t.$$.on_mount.map(Ve).filter(He);t.$$.on_destroy?t.$$.on_destroy.push(...i):Y(i),t.$$.on_mount=[]}),u.forEach(je)}function he(t,e){const n=t.$$;n.fragment!==null&&(Y(n.on_destroy),n.fragment&&n.fragment.d(e),n.on_destroy=n.fragment=null,n.ctx=[])}function zt(t,e){t.$$.dirty[0]===-1&&(fe.push(t),vt(),t.$$.dirty.fill(0)),t.$$.dirty[e/31|0]|=1<<e%31}function me(t,e,n,l,o,u,i,m=[-1]){const f=we;ke(t);const a=t.$$={fragment:null,ctx:[],props:u,update:b,not_equal:o,bound:qe(),on_mount:[],on_destroy:[],on_disconnect:[],before_update:[],after_update:[],context:new Map(e.context||(f?f.$$.context:[])),callbacks:qe(),dirty:m,skip_bound:!1,root:e.target||f.$$.root};i&&i(a.root);let h=!1;if(a.ctx=n?n(t,e.props||{},(v,I,...j)=>{const D=j.length?j[0]:I;return a.ctx&&o(a.ctx[v],a.ctx[v]=D)&&(!a.skip_bound&&a.bound[v]&&a.bound[v](D),h&&zt(t,v)),I}):[],a.update(),h=!0,Y(a.before_update),a.fragment=l?l(a.ctx):!1,e.target){if(e.hydrate){const v=gt(e.target);a.fragment&&a.fragment.l(v),v.forEach(x)}else a.fragment&&a.fragment.c();e.intro&&S(t.$$.fragment),de(t,e.target,e.anchor,e.customElement),Je()}ke(f)}class _e{$destroy(){he(this,1),this.$destroy=b}$on(e,n){if(!He(n))return b;const l=this.$$.callbacks[e]||(this.$$.callbacks[e]=[]);return l.push(n),()=>{const o=l.indexOf(n);o!==-1&&l.splice(o,1)}}$set(e){this.$$set&&!ut(e)&&(this.$$.skip_bound=!0,this.$$set(e),this.$$.skip_bound=!1)}}const un="";function Mt(t){let e,n;return{c(){e=$("svg"),n=$("path"),c(n,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),c(e,"viewBox","0 0 60.006 21.412"),c(e,"width","14"),c(e,"height","20"),c(e,"class","svelte-en2qvf")},m(l,o){F(l,e,o),_(e,n)},p:b,i:b,o:b,d(l){l&&x(e)}}}class Tt extends _e{constructor(e){super(),me(this,e,null,Mt,ue,{})}}const fn="";function Rt(t){let e,n;return{c(){e=$("svg"),n=$("path"),c(n,"d","M3.8 2.5c-.6 0-1.3.7-1.3 1.3 0 .3.2.7.5.8L7.2 9 3 13.2c-.3.3-.5.7-.5 1 0 .6.7 1.3 1.3 1.3.3 0 .7-.2 1-.5L9 10.8l4.2 4.2c.2.3.7.3 1 .3.6 0 1.3-.7 1.3-1.3 0-.3-.2-.7-.3-1l-4.4-4L15 4.6c.3-.2.5-.5.5-.8 0-.7-.7-1.3-1.3-1.3-.3 0-.7.2-1 .3L9 7.1 4.8 2.8c-.3-.1-.7-.3-1-.3z"),c(e,"viewBox","0 0 18 18"),c(e,"width","16"),c(e,"height","16"),c(e,"class","svelte-en2qvf")},m(l,o){F(l,e,o),_(e,n)},p:b,i:b,o:b,d(l){l&&x(e)}}}class Ct extends _e{constructor(e){super(),me(this,e,null,Rt,ue,{})}}const an="";function Et(t){let e;return{c(){e=B("div"),e.innerHTML='<svg viewBox="0 0 18 18" width="24" height="24" class="svelte-7cmwmc"><path fill="#333" d="M4.4 4.4l.8.8c2.1-2.1 5.5-2.1 7.6 0l.8-.8c-2.5-2.5-6.7-2.5-9.2 0z"></path><path opacity=".1" d="M12.8 12.9c-2.1 2.1-5.5 2.1-7.6 0-2.1-2.1-2.1-5.5 0-7.7l-.8-.8c-2.5 2.5-2.5 6.7 0 9.2s6.6 2.5 9.2 0 2.5-6.6 0-9.2l-.8.8c2.2 2.1 2.2 5.6 0 7.7z"></path></svg>',c(e,"class","svelte-7cmwmc")},m(n,l){F(n,e,l)},p:b,i:b,o:b,d(n){n&&x(e)}}}class Bt extends _e{constructor(e){super(),me(this,e,null,Et,ue,{})}}const dn="";function St(t){let e,n,l;return{c(){e=$("svg"),n=$("path"),c(n,"stroke-width","4"),c(n,"fill-rule","evenodd"),c(n,"clip-rule","evenodd"),c(n,"d","M 5,33.103579 C 5,17.607779 18.457,5 35,5 C 51.543,5 65,17.607779 65,33.103579 C 65,56.388679 40.4668,76.048179 36.6112,79.137779 C 36.3714,79.329879 36.2116,79.457979 36.1427,79.518879 C 35.8203,79.800879 35.4102,79.942779 35,79.942779 C 34.5899,79.942779 34.1797,79.800879 33.8575,79.518879 C 33.7886,79.457979 33.6289,79.330079 33.3893,79.138079 C 29.5346,76.049279 5,56.389379 5,33.103579 Z M 35.0001,49.386379 C 43.1917,49.386379 49.8323,42.646079 49.8323,34.331379 C 49.8323,26.016779 43.1917,19.276479 35.0001,19.276479 C 26.8085,19.276479 20.1679,26.016779 20.1679,34.331379 C 20.1679,42.646079 26.8085,49.386379 35.0001,49.386379 Z"),c(n,"class","svelte-1k1cmht"),c(e,"width",l=t[0]!=="list"?void 0:"20"),c(e,"viewBox","0 0 70 85"),c(e,"fill","none"),c(e,"class","svelte-1k1cmht"),Q(e,"in-map",t[0]!=="list"),Q(e,"list-icon",t[0]==="list")},m(o,u){F(o,e,u),_(e,n)},p(o,[u]){u&1&&l!==(l=o[0]!=="list"?void 0:"20")&&c(e,"width",l),u&1&&Q(e,"in-map",o[0]!=="list"),u&1&&Q(e,"list-icon",o[0]==="list")},i:b,o:b,d(o){o&&x(e)}}}function Lt(t,e,n){let{displayIn:l}=e;return t.$$set=o=>{"displayIn"in o&&n(0,l=o.displayIn)},[l]}class It extends _e{constructor(e){super(),me(this,e,Lt,St,ue,{displayIn:0})}}const hn="";function At(t){let e,n;return{c(){e=$("svg"),n=$("path"),c(n,"d","M7.4 2.5c-2.7 0-4.9 2.2-4.9 4.9s2.2 4.9 4.9 4.9c1 0 1.8-.2 2.5-.8l3.7 3.7c.2.2.4.3.8.3.7 0 1.1-.4 1.1-1.1 0-.3-.1-.5-.3-.8L11.4 10c.4-.8.8-1.6.8-2.5.1-2.8-2.1-5-4.8-5zm0 1.6c1.8 0 3.2 1.4 3.2 3.2s-1.4 3.2-3.2 3.2-3.3-1.3-3.3-3.1 1.4-3.3 3.3-3.3z"),c(e,"viewBox","0 0 18 18"),c(e,"xml:space","preserve"),c(e,"width","20"),c(e,"class","svelte-en2qvf")},m(l,o){F(l,e,o),_(e,n)},p:b,i:b,o:b,d(l){l&&x(e)}}}class Nt extends _e{constructor(e){super(),me(this,e,null,At,ue,{})}}const mn="";function Xe(t,e,n){const l=t.slice();return l[68]=e[n],l[70]=n,l}function Ye(t){let e,n;return e=new Bt({}),{c(){ve(e.$$.fragment)},m(l,o){de(e,l,o),n=!0},i(l){n||(S(e.$$.fragment,l),n=!0)},o(l){O(e.$$.fragment,l),n=!1},d(l){he(e,l)}}}function $e(t){let e,n,l,o,u;return n=new Tt({}),{c(){e=B("button"),ve(n.$$.fragment),c(e,"type","button"),c(e,"title",t[9]),c(e,"class","svelte-z0d4ta"),Q(e,"active",t[0])},m(i,m){F(i,e,m),de(n,e,null),l=!0,o||(u=V(e,"click",t[55]),o=!0)},p(i,m){(!l||m[0]&512)&&c(e,"title",i[9]),(!l||m[0]&1)&&Q(e,"active",i[0])},i(i){l||(S(n.$$.fragment,i),l=!0)},o(i){O(n.$$.fragment,i),l=!1},d(i){i&&x(e),he(n),o=!1,u()}}}function jt(t){let e,n,l,o,u=t[12],i=[];for(let f=0;f<u.length;f+=1)i[f]=tt(Xe(t,u,f));const m=f=>O(i[f],1,1,()=>{i[f]=null});return{c(){e=B("ul");for(let f=0;f<i.length;f+=1)i[f].c();c(e,"class","svelte-z0d4ta")},m(f,a){F(f,e,a);for(let h=0;h<i.length;h+=1)i[h].m(e,null);n=!0,l||(o=[V(e,"mouseleave",t[58]),V(e,"blur",t[59])],l=!0)},p(f,a){if(a[0]&2110464){u=f[12];let h;for(h=0;h<u.length;h+=1){const v=Xe(f,u,h);i[h]?(i[h].p(v,a),S(i[h],1)):(i[h]=tt(v),i[h].c(),S(i[h],1),i[h].m(e,null))}for(Re(),h=u.length;h<i.length;h+=1)m(h);Ce()}},i(f){if(!n){for(let a=0;a<u.length;a+=1)S(i[a]);n=!0}},o(f){i=i.filter(Boolean);for(let a=0;a<i.length;a+=1)O(i[a]);n=!1},d(f){f&&x(e),mt(i,f),l=!1,Y(o)}}}function Pt(t){let e,n;return{c(){e=B("div"),n=le(t[7]),c(e,"class","no-results svelte-z0d4ta")},m(l,o){F(l,e,o),_(e,n)},p(l,o){o[0]&128&&be(n,l[7])},i:b,o:b,d(l){l&&x(e)}}}function Gt(t){let e="",n;return{c(){n=le(e)},m(l,o){F(l,n,o)},p:b,i:b,o:b,d(l){l&&x(n)}}}function xt(t){let e,n;return{c(){e=B("div"),n=le(t[6]),c(e,"class","error svelte-z0d4ta")},m(l,o){F(l,e,o),_(e,n)},p(l,o){o[0]&64&&be(n,l[6])},i:b,o:b,d(l){l&&x(e)}}}function et(t){var o,u;let e,n=(((u=(o=t[68].properties)==null?void 0:o.place_type_name)==null?void 0:u[0])??t[68].place_type[0])+"",l;return{c(){e=B("span"),l=le(n),c(e,"class","svelte-z0d4ta")},m(i,m){F(i,e,m),_(e,l)},p(i,m){var f,a;m[0]&4096&&n!==(n=(((a=(f=i[68].properties)==null?void 0:f.place_type_name)==null?void 0:a[0])??i[68].place_type[0])+"")&&be(l,n)},d(i){i&&x(e)}}}function tt(t){let e,n,l,o,u,i,m=t[68].place_name.replace(/,.*/,"")+"",f,a,h,v,I,j=t[68].place_name.replace(/[^,]*,?\s*/,"")+"",D,p,k,L,R,q;n=new It({props:{displayIn:"list"}});let z=t[10]&&et(t);function d(){return t[56](t[70])}function w(){return t[57](t[68])}return{c(){e=B("li"),ve(n.$$.fragment),l=U(),o=B("span"),u=B("span"),i=B("span"),f=le(m),a=U(),z&&z.c(),h=U(),v=B("span"),I=B("span"),D=le(j),p=U(),c(i,"class","svelte-z0d4ta"),c(u,"class","svelte-z0d4ta"),c(o,"class","svelte-z0d4ta"),c(I,"class","svelte-z0d4ta"),c(v,"class","svelte-z0d4ta"),c(e,"tabindex","0"),c(e,"data-selected",k=t[13]===t[70]),c(e,"class","svelte-z0d4ta"),Q(e,"selected",t[13]===t[70])},m(N,M){F(N,e,M),de(n,e,null),_(e,l),_(e,o),_(o,u),_(u,i),_(i,f),_(u,a),z&&z.m(u,null),_(e,h),_(e,v),_(v,I),_(I,D),_(e,p),L=!0,R||(q=[V(e,"mouseenter",d),V(e,"focus",w)],R=!0)},p(N,M){t=N,(!L||M[0]&4096)&&m!==(m=t[68].place_name.replace(/,.*/,"")+"")&&be(f,m),t[10]?z?z.p(t,M):(z=et(t),z.c(),z.m(u,null)):z&&(z.d(1),z=null),(!L||M[0]&4096)&&j!==(j=t[68].place_name.replace(/[^,]*,?\s*/,"")+"")&&be(D,j),(!L||M[0]&8192&&k!==(k=t[13]===t[70]))&&c(e,"data-selected",k),(!L||M[0]&8192)&&Q(e,"selected",t[13]===t[70])},i(N){L||(S(n.$$.fragment,N),L=!0)},o(N){O(n.$$.fragment,N),L=!1},d(N){N&&x(e),he(n),z&&z.d(),R=!1,Y(q)}}}function Ot(t){let e,n,l,o,u,i,m,f,a,h,v,I,j,D,p,k,L,R,q,z;o=new Nt({}),h=new Ct({});let d=t[17]&&Ye(),w=t[5]===!0&&$e(t);const N=t[47].default,M=ft(N,t,t[46],null),J=[xt,Gt,Pt,jt],A=[];function pe(s,T){var X,ie;return s[16]?0:s[14]?((X=s[12])==null?void 0:X.length)===0?2:s[14]&&((ie=s[12])!=null&&ie.length)?3:-1:1}return~(p=pe(t))&&(k=A[p]=J[p](t)),{c(){e=B("form"),n=B("div"),l=B("button"),ve(o.$$.fragment),u=U(),i=B("input"),m=U(),f=B("div"),a=B("button"),ve(h.$$.fragment),v=U(),d&&d.c(),I=U(),w&&w.c(),j=U(),M&&M.c(),D=U(),k&&k.c(),c(l,"type","button"),c(l,"class","svelte-z0d4ta"),c(i,"placeholder",t[8]),c(i,"aria-label",t[8]),c(i,"class","svelte-z0d4ta"),c(a,"type","button"),c(a,"title",t[3]),c(a,"class","svelte-z0d4ta"),Q(a,"displayable",t[1]!==""),c(f,"class","clear-button-container svelte-z0d4ta"),c(n,"class","input-group svelte-z0d4ta"),c(e,"tabindex","0"),c(e,"class",L=Qe(t[2])+" svelte-z0d4ta"),Q(e,"can-collapse",t[4]&&t[1]==="")},m(s,T){F(s,e,T),_(e,n),_(n,l),de(o,l,null),_(n,u),_(n,i),t[49](i),Ue(i,t[1]),_(n,m),_(n,f),_(f,a),de(h,a,null),_(f,v),d&&d.m(f,null),_(n,I),w&&w.m(n,null),_(n,j),M&&M.m(n,null),_(e,D),~p&&A[p].m(e,null),R=!0,q||(z=[V(l,"click",t[48]),V(i,"input",t[50]),V(i,"focus",t[51]),V(i,"blur",t[52]),V(i,"keydown",t[19]),V(i,"input",t[53]),V(a,"click",t[54]),V(e,"submit",_t(t[18]))],q=!0)},p(s,T){(!R||T[0]&256)&&c(i,"placeholder",s[8]),(!R||T[0]&256)&&c(i,"aria-label",s[8]),T[0]&2&&i.value!==s[1]&&Ue(i,s[1]),(!R||T[0]&8)&&c(a,"title",s[3]),(!R||T[0]&2)&&Q(a,"displayable",s[1]!==""),s[17]?d?T[0]&131072&&S(d,1):(d=Ye(),d.c(),S(d,1),d.m(f,null)):d&&(Re(),O(d,1,1,()=>{d=null}),Ce()),s[5]===!0?w?(w.p(s,T),T[0]&32&&S(w,1)):(w=$e(s),w.c(),S(w,1),w.m(n,j)):w&&(Re(),O(w,1,1,()=>{w=null}),Ce()),M&&M.p&&(!R||T[1]&32768)&&dt(M,N,s,s[46],R?at(N,s[46],T,null):ht(s[46]),null);let X=p;p=pe(s),p===X?~p&&A[p].p(s,T):(k&&(Re(),O(A[X],1,1,()=>{A[X]=null}),Ce()),~p?(k=A[p],k?k.p(s,T):(k=A[p]=J[p](s),k.c()),S(k,1),k.m(e,null)):k=null),(!R||T[0]&4&&L!==(L=Qe(s[2])+" svelte-z0d4ta"))&&c(e,"class",L),(!R||T[0]&22)&&Q(e,"can-collapse",s[4]&&s[1]==="")},i(s){R||(S(o.$$.fragment,s),S(h.$$.fragment,s),S(d),S(w),S(M,s),S(k),R=!0)},o(s){O(o.$$.fragment,s),O(h.$$.fragment,s),O(d),O(w),O(M,s),O(k),R=!1},d(s){s&&x(e),he(o),t[49](null),he(h),d&&d.d(),w&&w.d(),M&&M.d(s),~p&&A[p].d(),q=!1,Y(z)}}}function Dt(t,e,n){const l=e[1],o=e[0],u=l-o;return t===l&&n?t:((t-o)%u+u)%u+o}function Ft(t,e,n){let l,{$$slots:o={},$$scope:u}=e,{class:i=void 0}=e,{apiKey:m}=e,{bbox:f=void 0}=e,{clearButtonTitle:a="clear"}=e,{clearOnBlur:h=!1}=e,{collapsed:v=!1}=e,{country:I=void 0}=e,{debounceSearch:j=200}=e,{enableReverse:D=!1}=e,{errorMessage:p="Searching failed"}=e,{filter:k=()=>!0}=e,{flyTo:L=!0}=e,{fuzzyMatch:R=!0}=e,{language:q=void 0}=e,{limit:z=void 0}=e,{mapController:d=void 0}=e,{minLength:w=2}=e,{noResultsMessage:N="No results found"}=e,{placeholder:M="Search"}=e,{proximity:J=void 0}=e,{reverseActive:A=D==="always"}=e,{reverseButtonTitle:pe="toggle reverse geocoding"}=e,{searchValue:s=""}=e,{showFullGeometry:T=!0}=e,{showPlaceType:X=!1}=e,{showResultsWhileTyping:ie=!0}=e,{trackProximity:Ee=!0}=e,{types:Be=void 0}=e,{zoom:Se=16}=e;function Kt(){W.focus()}function Qt(){W.blur()}function rt(r,E=!0){n(1,s=r),E?(n(13,C=-1),ot()):(xe(),setTimeout(()=>{W.focus(),W.select()}))}let ge=!1,g,P,y,it="",W,C=-1,ee,Le=[],oe,ye,Ie;const te=wt();bt(()=>{d&&(d.setEventHandler(void 0),d.indicateReverse(!1),d.setSelectedMarker(-1),d.setMarkers(void 0,void 0))});function ot(r){if(ye&&(clearTimeout(ye),ye=void 0),C>-1&&g)n(44,y=g[C]),n(1,s=y.place_name.replace(/,.*/,"")),n(16,ee=void 0),n(43,P=void 0),n(13,C=-1);else if(s){const E=r||!ct();Ge(s,{exact:!0}).then(()=>{n(43,P=g),n(44,y=void 0),E&&Ut()}).catch(Z=>n(16,ee=Z))}}function ct(){return/^-?\d+(\.\d+)?,-?\d+(\.\d+)?$/.test(s)}async function Ge(r,{byId:E=!1,exact:Z=!1}={}){n(16,ee=void 0);const ze=ct(),H=new URLSearchParams;q!=null&&H.set("language",Array.isArray(q)?q.join(","):q),Be&&H.set("types",Be.join(",")),ze||(f&&H.set("bbox",f.map(se=>se.toFixed(6)).join(",")),I&&H.set("country",Array.isArray(I)?I.join(","):I)),E||(J&&H.set("proximity",J.map(se=>se.toFixed(6)).join(",")),(Z||!ie)&&H.set("autocomplete","false"),H.set("fuzzyMatch",String(R))),z!==void 0&&H.set("limit",String(z)),H.set("key",m);const ce="https://api.maptiler.com/geocoding/"+encodeURIComponent(r)+".json?"+H.toString();if(ce===it){E?(n(12,g=void 0),n(44,y=Le[0])):n(12,g=Le);return}it=ce,oe==null||oe.abort();const G=new AbortController;n(17,oe=G);let De;try{De=await fetch(ce,{signal:G.signal}).finally(()=>{G===oe&&n(17,oe=void 0)})}catch(se){if(se&&typeof se=="object"&&se.name==="AbortError")return;throw new Error}if(!De.ok)throw new Error;const Fe=await De.json();te("response",{url:ce,featureCollection:Fe}),E?(n(12,g=void 0),n(44,y=Fe.features[0]),Le=[y]):(n(12,g=Fe.features.filter(k)),Le=g,ze&&W.focus())}function Ut(){var Z,ze,H,ce;if(!(P!=null&&P.length)||!L)return;const r=[180,90,-180,-90],E=!P.some(G=>!G.matching_text);for(const G of P)(E||!G.matching_text)&&(r[0]=Math.min(r[0],((Z=G.bbox)==null?void 0:Z[0])??G.center[0]),r[1]=Math.min(r[1],((ze=G.bbox)==null?void 0:ze[1])??G.center[1]),r[2]=Math.max(r[2],((H=G.bbox)==null?void 0:H[2])??G.center[0]),r[3]=Math.max(r[3],((ce=G.bbox)==null?void 0:ce[3])??G.center[1]));d&&P.length>0&&(y&&r[0]===r[2]&&r[1]===r[3]?d.flyTo(y.center,Se):d.fitBounds(r,50))}function Wt(r){n(0,A=D==="always"),rt(Dt(r[0],[-180,180],!0).toFixed(6)+","+r[1].toFixed(6))}function Zt(r){if(!g)return;let E=r.key==="ArrowDown"?1:r.key==="ArrowUp"?-1:0;E?(C===-1&&E===-1&&n(13,C=g.length),n(13,C+=E),C>=g.length&&n(13,C=-1),r.preventDefault()):["ArrowLeft","ArrowRight","Home","End"].includes(r.key)&&n(13,C=-1)}function xe(r=!0){if(ie&&s.length>w){ye&&clearTimeout(ye);const E=s;ye=window.setTimeout(()=>{Ge(E).catch(Z=>n(16,ee=Z))},r?j:0)}else n(12,g=void 0),n(16,ee=void 0)}function Oe(r){n(44,y=r),n(1,s=r.place_name),n(13,C=-1)}const Jt=()=>W.focus();function Xt(r){Ae[r?"unshift":"push"](()=>{W=r,n(15,W)})}function Yt(){s=this.value,n(1,s),n(11,ge),n(25,h)}const $t=()=>n(11,ge=!0),en=()=>n(11,ge=!1),tn=()=>xe(),nn=()=>{n(1,s=""),W.focus()},ln=()=>n(0,A=!A),rn=r=>n(13,C=r),on=r=>Oe(r),cn=()=>n(13,C=-1),sn=()=>{};return t.$$set=r=>{"class"in r&&n(2,i=r.class),"apiKey"in r&&n(23,m=r.apiKey),"bbox"in r&&n(24,f=r.bbox),"clearButtonTitle"in r&&n(3,a=r.clearButtonTitle),"clearOnBlur"in r&&n(25,h=r.clearOnBlur),"collapsed"in r&&n(4,v=r.collapsed),"country"in r&&n(26,I=r.country),"debounceSearch"in r&&n(27,j=r.debounceSearch),"enableReverse"in r&&n(5,D=r.enableReverse),"errorMessage"in r&&n(6,p=r.errorMessage),"filter"in r&&n(28,k=r.filter),"flyTo"in r&&n(29,L=r.flyTo),"fuzzyMatch"in r&&n(30,R=r.fuzzyMatch),"language"in r&&n(31,q=r.language),"limit"in r&&n(32,z=r.limit),"mapController"in r&&n(33,d=r.mapController),"minLength"in r&&n(34,w=r.minLength),"noResultsMessage"in r&&n(7,N=r.noResultsMessage),"placeholder"in r&&n(8,M=r.placeholder),"proximity"in r&&n(22,J=r.proximity),"reverseActive"in r&&n(0,A=r.reverseActive),"reverseButtonTitle"in r&&n(9,pe=r.reverseButtonTitle),"searchValue"in r&&n(1,s=r.searchValue),"showFullGeometry"in r&&n(35,T=r.showFullGeometry),"showPlaceType"in r&&n(10,X=r.showPlaceType),"showResultsWhileTyping"in r&&n(36,ie=r.showResultsWhileTyping),"trackProximity"in r&&n(37,Ee=r.trackProximity),"types"in r&&n(38,Be=r.types),"zoom"in r&&n(39,Se=r.zoom),"$$scope"in r&&n(46,u=r.$$scope)},t.$$.update=()=>{if(t.$$.dirty[1]&64&&(Ee||n(22,J=void 0)),t.$$.dirty[0]&33556480&&setTimeout(()=>{n(14,Ie=ge),h&&!ge&&n(1,s="")}),t.$$.dirty[0]&4098&&(s||(n(44,y=void 0),n(12,g=void 0),n(16,ee=void 0),n(43,P=g))),t.$$.dirty[1]&8208&&T&&y&&!y.address&&y.geometry.type==="Point"&&Ge(y.id,{byId:!0}).catch(r=>n(16,ee=r)),t.$$.dirty[0]&536870912|t.$$.dirty[1]&8452&&d&&y&&L&&(!y.bbox||y.bbox[0]===y.bbox[2]&&y.bbox[1]===y.bbox[3]?d.flyTo(y.center,Se):d.fitBounds(y.bbox,50),n(12,g=void 0),n(43,P=void 0),n(13,C=-1)),t.$$.dirty[0]&4096|t.$$.dirty[1]&4096&&P!==g&&n(43,P=void 0),t.$$.dirty[1]&12292&&d&&d.setMarkers(P,y),t.$$.dirty[0]&2&&n(13,C=-1),t.$$.dirty[0]&20481|t.$$.dirty[1]&68&&d&&d.setEventHandler(r=>{switch(r.type){case"mapClick":A&&Wt(r.coordinates);break;case"proximityChange":n(22,J=Ee?r.proximity:void 0);break;case"markerClick":{const E=g==null?void 0:g.find(Z=>Z.id===r.id);E&&Oe(E)}break;case"markerMouseEnter":n(13,C=Ie?(g==null?void 0:g.findIndex(E=>E.id===r.id))??-1:-1);break;case"markerMouseLeave":n(13,C=-1);break}}),t.$$.dirty[0]&8192|t.$$.dirty[1]&4&&(d==null||d.setSelectedMarker(C)),t.$$.dirty[0]&12288&&n(45,l=g==null?void 0:g[C]),t.$$.dirty[0]&2|t.$$.dirty[1]&4){const r=/^(-?\d+(?:\.\d*)?),(-?\d+(?:\.\d*)?)$/.exec(s);d==null||d.setReverseMarker(r?[Number(r[1]),Number(r[2])]:void 0)}t.$$.dirty[1]&16384&&te("select",l),t.$$.dirty[1]&8192&&te("pick",y),t.$$.dirty[0]&20480&&te("optionsVisibilityChange",Ie&&!!g),t.$$.dirty[0]&4096&&te("featuresListed",g),t.$$.dirty[1]&4096&&te("featuresMarked",P),t.$$.dirty[0]&1&&te("reverseToggle",A),t.$$.dirty[0]&2&&te("queryChange",s),t.$$.dirty[0]&1|t.$$.dirty[1]&4&&d&&d.indicateReverse(A)},[A,s,i,a,v,D,p,N,M,pe,X,ge,g,C,Ie,W,ee,oe,ot,Zt,xe,Oe,J,m,f,h,I,j,k,L,R,q,z,d,w,T,ie,Ee,Be,Se,Kt,Qt,rt,P,y,l,u,o,Jt,Xt,Yt,$t,en,tn,nn,ln,rn,on,cn,sn]}class Vt extends _e{constructor(e){super(),me(this,e,Ft,Ot,ue,{class:2,apiKey:23,bbox:24,clearButtonTitle:3,clearOnBlur:25,collapsed:4,country:26,debounceSearch:27,enableReverse:5,errorMessage:6,filter:28,flyTo:29,fuzzyMatch:30,language:31,limit:32,mapController:33,minLength:34,noResultsMessage:7,placeholder:8,proximity:22,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:35,showPlaceType:10,showResultsWhileTyping:36,trackProximity:37,types:38,zoom:39,focus:40,blur:41,setQuery:42},null,[-1,-1,-1])}get focus(){return this.$$.ctx[40]}get blur(){return this.$$.ctx[41]}get setQuery(){return this.$$.ctx[42]}}const nt=["featuresListed","featuresMarked","optionsVisibilityChange","pick","querychange","response","reversetoggle","select"],qt=["apiKey","bbox","clearButtonTitle","clearOnBlur","collapsed","country","debounceSearch","enableReverse","errorMessage","filter","fuzzyMatch","language","limit","minLength","noResultsMessage","placeholder","proximity","reverseButtonTitle","showFullGeometry","showPlaceType","showResultsWhileTyping","trackProximity","types","zoom","mapController"];function lt(t){return"on"+t[0].toUpperCase()+t.slice(1)}const Ht=K.forwardRef(function(e,n){const l=K.useRef(),o=K.useRef(),u={...e};for(const i of nt)delete u[lt(i)];K.useEffect(()=>{if(!l.current)throw new Error;const i=new Vt({target:l.current,props:u});return o.current=i,()=>i.$destroy()},[]);for(const i of qt)K.useEffect(()=>{o.current&&e[i]!==void 0&&o.current.$set({[i]:e[i]})},[e[i]]);for(const i of nt){const m=e[lt(i)];K.useEffect(()=>{var f;(f=o.current)==null||f.$on(i,m?a=>{m(a.detail)}:void 0)},[m])}return K.useImperativeHandle(n,()=>({setQuery:(i,m=!0)=>{var f;return(f=o.current)==null?void 0:f.setQuery(i,m)},focus:()=>{var i;return(i=o.current)==null?void 0:i.focus()},blur:()=>{var i;return(i=o.current)==null?void 0:i.blur()}})),K.createElement("div",{ref:l})});ne.GeocodingControl=Ht,Object.defineProperty(ne,Symbol.toStringTag,{value:"Module"})});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import "leaflet/dist/leaflet.css";
|
|
3
|
+
|
|
4
|
+
import { onMount } from "svelte";
|
|
5
|
+
import { GeocodingControl } from "./lib/LeafletGeocodingControl";
|
|
6
|
+
import * as L from "leaflet";
|
|
7
|
+
|
|
8
|
+
let containerElement: HTMLElement;
|
|
9
|
+
|
|
10
|
+
const apiKey = import.meta.env.VITE_API_KEY;
|
|
11
|
+
|
|
12
|
+
if (!apiKey) {
|
|
13
|
+
const errMsg = "missing VITE_API_KEY environment variable";
|
|
14
|
+
|
|
15
|
+
window.alert(errMsg);
|
|
16
|
+
|
|
17
|
+
throw new Error(errMsg);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
onMount(() => {
|
|
21
|
+
const map = L.map(containerElement).setView([51.505, -0.09], 13);
|
|
22
|
+
|
|
23
|
+
const scale = devicePixelRatio > 1.5 ? "@2x" : "";
|
|
24
|
+
|
|
25
|
+
L.tileLayer(
|
|
26
|
+
`https://api.maptiler.com/maps/streets/{z}/{x}/{y}${scale}.png?key=` +
|
|
27
|
+
apiKey,
|
|
28
|
+
{
|
|
29
|
+
tileSize: 512,
|
|
30
|
+
zoomOffset: -1,
|
|
31
|
+
minZoom: 1,
|
|
32
|
+
attribution:
|
|
33
|
+
'<a href="https://www.maptiler.com/copyright/" target="_blank">© MapTiler</a>, ' +
|
|
34
|
+
'<a href="https://www.openstreetmap.org/copyright" target="_blank">© OpenStreetMap contributors</a>',
|
|
35
|
+
crossOrigin: true,
|
|
36
|
+
}
|
|
37
|
+
).addTo(map);
|
|
38
|
+
|
|
39
|
+
new GeocodingControl({
|
|
40
|
+
apiKey,
|
|
41
|
+
enableReverse: "always",
|
|
42
|
+
showPlaceType: true,
|
|
43
|
+
// collapsed: true,
|
|
44
|
+
}).addTo(map);
|
|
45
|
+
});
|
|
46
|
+
</script>
|
|
47
|
+
|
|
48
|
+
<main id="main" bind:this={containerElement} />
|
|
49
|
+
|
|
50
|
+
<style>
|
|
51
|
+
#main {
|
|
52
|
+
position: absolute;
|
|
53
|
+
inset: 0;
|
|
54
|
+
}
|
|
55
|
+
</style>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import "maplibre-gl/dist/maplibre-gl.css";
|
|
3
|
+
|
|
4
|
+
import { Map } from "maplibre-gl";
|
|
5
|
+
import { onMount } from "svelte";
|
|
6
|
+
import { GeocodingControl } from "./lib/MaplibreglGeocodingControl";
|
|
7
|
+
import maplibregl from "maplibre-gl";
|
|
8
|
+
|
|
9
|
+
let containerElement: HTMLElement;
|
|
10
|
+
|
|
11
|
+
const apiKey = import.meta.env.VITE_API_KEY;
|
|
12
|
+
|
|
13
|
+
if (!apiKey) {
|
|
14
|
+
const errMsg = "missing VITE_API_KEY environment variable";
|
|
15
|
+
|
|
16
|
+
window.alert(errMsg);
|
|
17
|
+
|
|
18
|
+
throw new Error(errMsg);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
onMount(() => {
|
|
22
|
+
const map = new Map({
|
|
23
|
+
style: "https://api.maptiler.com/maps/streets/style.json?key=" + apiKey,
|
|
24
|
+
container: containerElement,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
map.addControl(
|
|
28
|
+
new GeocodingControl({
|
|
29
|
+
apiKey,
|
|
30
|
+
maplibregl,
|
|
31
|
+
enableReverse: "always",
|
|
32
|
+
showPlaceType: true,
|
|
33
|
+
})
|
|
34
|
+
);
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
37
|
+
|
|
38
|
+
<main id="main" bind:this={containerElement} />
|
|
39
|
+
|
|
40
|
+
<style>
|
|
41
|
+
#main {
|
|
42
|
+
position: absolute;
|
|
43
|
+
inset: 0;
|
|
44
|
+
}
|
|
45
|
+
</style>
|
|
@@ -17,62 +17,62 @@
|
|
|
17
17
|
|
|
18
18
|
export { className as class };
|
|
19
19
|
|
|
20
|
-
export let mapController: MapController | undefined = undefined;
|
|
21
|
-
|
|
22
20
|
export let apiKey: string;
|
|
23
21
|
|
|
24
|
-
export let
|
|
25
|
-
|
|
26
|
-
export let placeholder = "Search";
|
|
27
|
-
|
|
28
|
-
export let errorMessage = "Searching failed";
|
|
22
|
+
export let bbox: [number, number, number, number] | undefined = undefined;
|
|
29
23
|
|
|
30
|
-
export let
|
|
24
|
+
export let clearButtonTitle = "clear";
|
|
31
25
|
|
|
32
|
-
export let
|
|
26
|
+
export let clearOnBlur = false;
|
|
33
27
|
|
|
34
|
-
export let
|
|
28
|
+
export let collapsed = false;
|
|
35
29
|
|
|
36
|
-
export let
|
|
30
|
+
export let country: string | string[] | undefined = undefined;
|
|
37
31
|
|
|
38
|
-
export let
|
|
32
|
+
export let debounceSearch = 200;
|
|
39
33
|
|
|
40
|
-
export let
|
|
34
|
+
export let enableReverse: boolean | "always" = false;
|
|
41
35
|
|
|
42
|
-
export let
|
|
36
|
+
export let errorMessage = "Searching failed";
|
|
43
37
|
|
|
44
|
-
export let
|
|
38
|
+
export let filter: (feature: Feature) => boolean = () => true;
|
|
45
39
|
|
|
46
40
|
export let flyTo = true;
|
|
47
41
|
|
|
48
|
-
export let
|
|
42
|
+
export let fuzzyMatch = true;
|
|
49
43
|
|
|
50
|
-
export let
|
|
44
|
+
export let language: string | string[] | undefined = undefined;
|
|
51
45
|
|
|
52
|
-
export let
|
|
46
|
+
export let limit: number | undefined = undefined;
|
|
53
47
|
|
|
54
|
-
export let
|
|
48
|
+
export let mapController: MapController | undefined = undefined;
|
|
55
49
|
|
|
56
|
-
export let
|
|
50
|
+
export let minLength = 2;
|
|
57
51
|
|
|
58
|
-
export let
|
|
52
|
+
export let noResultsMessage = "No results found";
|
|
59
53
|
|
|
60
|
-
export let
|
|
54
|
+
export let placeholder = "Search";
|
|
55
|
+
|
|
56
|
+
export let proximity: Proximity = undefined;
|
|
61
57
|
|
|
62
58
|
export let reverseActive = enableReverse === "always";
|
|
63
59
|
|
|
64
|
-
export let
|
|
60
|
+
export let reverseButtonTitle = "toggle reverse geocoding";
|
|
61
|
+
|
|
62
|
+
export let searchValue = "";
|
|
65
63
|
|
|
66
64
|
export let showFullGeometry = true;
|
|
67
65
|
|
|
68
|
-
export let
|
|
66
|
+
export let showPlaceType = false;
|
|
69
67
|
|
|
70
|
-
export let
|
|
68
|
+
export let showResultsWhileTyping = true;
|
|
71
69
|
|
|
72
|
-
export let
|
|
70
|
+
export let trackProximity = true;
|
|
73
71
|
|
|
74
72
|
export let types: string[] | undefined = undefined;
|
|
75
73
|
|
|
74
|
+
export let zoom = 16;
|
|
75
|
+
|
|
76
76
|
export function focus() {
|
|
77
77
|
input.focus();
|
|
78
78
|
}
|
|
@@ -584,14 +584,17 @@
|
|
|
584
584
|
{:else if listFeatures?.length === 0}
|
|
585
585
|
<div class="no-results">{noResultsMessage}</div>
|
|
586
586
|
{:else if focusedDelayed && listFeatures?.length}
|
|
587
|
-
<ul
|
|
587
|
+
<ul
|
|
588
|
+
on:mouseleave={() => (selectedItemIndex = -1)}
|
|
589
|
+
on:blur={() => undefined}
|
|
590
|
+
>
|
|
588
591
|
{#each listFeatures as feature, i}
|
|
589
592
|
<!-- svelte-ignore a11y-no-noninteractive-tabindex -->
|
|
590
593
|
<li
|
|
591
594
|
tabindex="0"
|
|
592
595
|
data-selected={selectedItemIndex === i}
|
|
593
596
|
class:selected={selectedItemIndex === i}
|
|
594
|
-
on:
|
|
597
|
+
on:mouseenter={() => (selectedItemIndex = i)}
|
|
595
598
|
on:focus={() => pick(feature)}
|
|
596
599
|
>
|
|
597
600
|
<MarkerIcon displayIn="list" />
|
|
@@ -693,6 +696,7 @@
|
|
|
693
696
|
}
|
|
694
697
|
|
|
695
698
|
li {
|
|
699
|
+
text-align: left;
|
|
696
700
|
cursor: default;
|
|
697
701
|
display: grid;
|
|
698
702
|
grid-template-columns: auto 1fr;
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import GeocodingControl from "./GeocodingControl.svelte";
|
|
2
|
+
import {
|
|
3
|
+
createElement,
|
|
4
|
+
forwardRef,
|
|
5
|
+
useEffect,
|
|
6
|
+
useImperativeHandle,
|
|
7
|
+
useRef,
|
|
8
|
+
type Ref,
|
|
9
|
+
} from "react";
|
|
10
|
+
import type { ControlOptions, Feature, MapController } from "./types";
|
|
11
|
+
|
|
12
|
+
// TODO this would be nice to be derived from `Parameters<GeocodingControl["$on"]>[0]` but it just doesn't work
|
|
13
|
+
type CallbackProperties = {
|
|
14
|
+
onSelect?: (feature: Feature | undefined) => void;
|
|
15
|
+
onPick?: (feature: Feature | undefined) => void;
|
|
16
|
+
onOptionsVisibilityChange?: (visible: boolean) => void;
|
|
17
|
+
onFeaturesListed?: (visible: Feature[] | undefined) => void;
|
|
18
|
+
onFeaturesMarked?: (visible: Feature[] | undefined) => void;
|
|
19
|
+
onResponse?: (onResponse: { url: string; response: Response }) => void;
|
|
20
|
+
onReversetoggle?: (reverse: boolean) => void;
|
|
21
|
+
onQuerychange?: (query: string) => void;
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
type EventName<T extends keyof CallbackProperties> = T extends `on${infer U}`
|
|
25
|
+
? Uncapitalize<U>
|
|
26
|
+
: never;
|
|
27
|
+
|
|
28
|
+
type EventNames = EventName<keyof CallbackProperties>;
|
|
29
|
+
|
|
30
|
+
const eventNames = [
|
|
31
|
+
"featuresListed",
|
|
32
|
+
"featuresMarked",
|
|
33
|
+
"optionsVisibilityChange",
|
|
34
|
+
"pick",
|
|
35
|
+
"querychange",
|
|
36
|
+
"response",
|
|
37
|
+
"reversetoggle",
|
|
38
|
+
"select",
|
|
39
|
+
] as const satisfies readonly EventNames[];
|
|
40
|
+
|
|
41
|
+
type MapControllerProp = {
|
|
42
|
+
mapController?: MapController;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const propertyNames = [
|
|
46
|
+
"apiKey",
|
|
47
|
+
"bbox",
|
|
48
|
+
"clearButtonTitle",
|
|
49
|
+
"clearOnBlur",
|
|
50
|
+
"collapsed",
|
|
51
|
+
"country",
|
|
52
|
+
"debounceSearch",
|
|
53
|
+
"enableReverse",
|
|
54
|
+
"errorMessage",
|
|
55
|
+
"filter",
|
|
56
|
+
"fuzzyMatch",
|
|
57
|
+
"language",
|
|
58
|
+
"limit",
|
|
59
|
+
"minLength",
|
|
60
|
+
"noResultsMessage",
|
|
61
|
+
"placeholder",
|
|
62
|
+
"proximity",
|
|
63
|
+
"reverseButtonTitle",
|
|
64
|
+
"showFullGeometry",
|
|
65
|
+
"showPlaceType",
|
|
66
|
+
"showResultsWhileTyping",
|
|
67
|
+
"trackProximity",
|
|
68
|
+
"types",
|
|
69
|
+
"zoom",
|
|
70
|
+
"mapController",
|
|
71
|
+
] as const satisfies readonly (keyof (ControlOptions & MapControllerProp))[];
|
|
72
|
+
|
|
73
|
+
type EventHandlerFnName<T extends EventNames> = `on${Capitalize<T>}`;
|
|
74
|
+
|
|
75
|
+
function getEventFnName<T extends EventNames>(name: T): EventHandlerFnName<T> {
|
|
76
|
+
return ("on" +
|
|
77
|
+
name[0].toUpperCase() +
|
|
78
|
+
name.slice(1)) as EventHandlerFnName<T>;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export type Props = ControlOptions & CallbackProperties & MapControllerProp;
|
|
82
|
+
|
|
83
|
+
// // not used because it does not integrate well with Svelte
|
|
84
|
+
// type MethodNames = "blur" | "focus" | "setQuery";
|
|
85
|
+
//
|
|
86
|
+
// export type Methods = { [T in MethodNames]: GeocodingControl[T] };
|
|
87
|
+
|
|
88
|
+
export type Methods = {
|
|
89
|
+
blur: () => void;
|
|
90
|
+
focus: () => void;
|
|
91
|
+
setQuery: (value: string, submit?: boolean) => void;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
const ReactGeocodingControl = forwardRef(function ReactGeocodingControl(
|
|
95
|
+
props: Props,
|
|
96
|
+
ref: Ref<Methods>
|
|
97
|
+
) {
|
|
98
|
+
const divRef = useRef<HTMLDivElement>();
|
|
99
|
+
|
|
100
|
+
const controlRef = useRef<GeocodingControl>();
|
|
101
|
+
|
|
102
|
+
const options = { ...props };
|
|
103
|
+
|
|
104
|
+
for (const eventName of eventNames) {
|
|
105
|
+
delete options[getEventFnName(eventName)];
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
useEffect(() => {
|
|
109
|
+
if (!divRef.current) {
|
|
110
|
+
throw new Error();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const control = new GeocodingControl({
|
|
114
|
+
target: divRef.current,
|
|
115
|
+
props: options,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
controlRef.current = control;
|
|
119
|
+
|
|
120
|
+
return () => control.$destroy();
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
// watch change on every option
|
|
124
|
+
for (const propName of propertyNames) {
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (controlRef.current && props[propName] !== undefined) {
|
|
127
|
+
controlRef.current.$set({ [propName]: props[propName] });
|
|
128
|
+
}
|
|
129
|
+
}, [props[propName]]);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
// attach event handlers
|
|
133
|
+
for (const eventName of eventNames) {
|
|
134
|
+
const eventHandlerFn = props[getEventFnName(eventName)];
|
|
135
|
+
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
controlRef.current?.$on(
|
|
138
|
+
eventName,
|
|
139
|
+
!eventHandlerFn
|
|
140
|
+
? undefined
|
|
141
|
+
: (e) => {
|
|
142
|
+
(eventHandlerFn as any)(e.detail);
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}, [eventHandlerFn]);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
useImperativeHandle(ref, () => ({
|
|
149
|
+
setQuery: (value: string, submit = true) =>
|
|
150
|
+
controlRef.current?.setQuery(value, submit),
|
|
151
|
+
focus: () => controlRef.current?.focus(),
|
|
152
|
+
blur: () => controlRef.current?.blur(),
|
|
153
|
+
}));
|
|
154
|
+
|
|
155
|
+
return createElement("div", { ref: divRef });
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
export { ReactGeocodingControl as GeocodingControl };
|
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
} from "@turf/helpers";
|
|
10
10
|
import union from "@turf/union";
|
|
11
11
|
import { setMask } from "./mask";
|
|
12
|
+
import type { GeoJSON } from "geojson";
|
|
12
13
|
|
|
13
14
|
export function createLeafletMapController(
|
|
14
15
|
map: L.Map,
|
|
@@ -163,7 +164,7 @@ export function createLeafletMapController(
|
|
|
163
164
|
return;
|
|
164
165
|
}
|
|
165
166
|
|
|
166
|
-
function setData(data?: GeoJSON
|
|
167
|
+
function setData(data?: GeoJSON) {
|
|
167
168
|
resultLayer.clearLayers();
|
|
168
169
|
|
|
169
170
|
if (data) {
|
|
@@ -260,11 +261,9 @@ export function createLeafletMapController(
|
|
|
260
261
|
? new L.Marker(pos, showResultMarkers)
|
|
261
262
|
: createMarker(pos, true);
|
|
262
263
|
|
|
263
|
-
marker
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
direction: "top",
|
|
267
|
-
});
|
|
264
|
+
marker.addTo(map).bindTooltip(feature.place_name.replace(/,.*/, ""), {
|
|
265
|
+
direction: "top",
|
|
266
|
+
});
|
|
268
267
|
|
|
269
268
|
const element = marker.getElement();
|
|
270
269
|
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
LineLayerSpecification,
|
|
12
12
|
} from "maplibre-gl";
|
|
13
13
|
import MarkerIcon from "./MarkerIcon.svelte";
|
|
14
|
-
import type { Feature, MapController, MapEvent, Proximity } from "./types";
|
|
14
|
+
import type { Feature, MapController, MapEvent, Proximity } from "./types.js";
|
|
15
15
|
import union from "@turf/union";
|
|
16
16
|
import type {
|
|
17
17
|
Polygon,
|
|
@@ -20,8 +20,9 @@ import type {
|
|
|
20
20
|
MultiLineString,
|
|
21
21
|
} from "@turf/helpers";
|
|
22
22
|
import { setMask } from "./mask";
|
|
23
|
+
import type { FeatureCollection, GeoJSON } from "geojson";
|
|
23
24
|
|
|
24
|
-
let emptyGeojson:
|
|
25
|
+
let emptyGeojson: FeatureCollection = {
|
|
25
26
|
type: "FeatureCollection",
|
|
26
27
|
features: [],
|
|
27
28
|
};
|
|
@@ -218,7 +219,7 @@ export function createMaplibreglMapController(
|
|
|
218
219
|
return;
|
|
219
220
|
}
|
|
220
221
|
|
|
221
|
-
function setData(data: GeoJSON
|
|
222
|
+
function setData(data: GeoJSON) {
|
|
222
223
|
(map.getSource("full-geom") as GeoJSONSource)?.setData(data);
|
|
223
224
|
}
|
|
224
225
|
|
package/src/lib/mask.ts
CHANGED
|
@@ -6,6 +6,7 @@ import type {
|
|
|
6
6
|
} from "@turf/helpers";
|
|
7
7
|
import difference from "@turf/difference";
|
|
8
8
|
import buffer from "@turf/buffer";
|
|
9
|
+
import type { GeoJSON } from "geojson";
|
|
9
10
|
|
|
10
11
|
// see https://maplibre.org/maplibre-gl-js-docs/example/line-across-180th-meridian/
|
|
11
12
|
function fixRing(ring: Position[]) {
|
|
@@ -24,7 +25,7 @@ function fixRing(ring: Position[]) {
|
|
|
24
25
|
|
|
25
26
|
export function setMask(
|
|
26
27
|
picked: TurfFeature<Polygon | MultiPolygon>,
|
|
27
|
-
setData: (data: GeoJSON
|
|
28
|
+
setData: (data: GeoJSON) => void
|
|
28
29
|
) {
|
|
29
30
|
const diff = difference(
|
|
30
31
|
{
|
package/src/lib/types.ts
CHANGED
package/src/main-copy.ts
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// import App from "./AppMaplibregl.svelte";
|
|
2
|
+
|
|
3
|
+
import { createElement, useEffect, useRef, useState } from "react";
|
|
4
|
+
import { createRoot } from "react-dom/client";
|
|
5
|
+
import {
|
|
6
|
+
ReactGeocodingControl,
|
|
7
|
+
type Methods,
|
|
8
|
+
} from "./lib/ReactGeocodingControl";
|
|
9
|
+
|
|
10
|
+
const appElement = document.getElementById("app");
|
|
11
|
+
|
|
12
|
+
if (!appElement) {
|
|
13
|
+
throw new Error("element with id 'app' not found");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
// const app = new App({
|
|
17
|
+
// target: appElement,
|
|
18
|
+
// });
|
|
19
|
+
|
|
20
|
+
// export default app;
|
|
21
|
+
|
|
22
|
+
const apiKey = import.meta.env.VITE_API_KEY;
|
|
23
|
+
|
|
24
|
+
if (!apiKey) {
|
|
25
|
+
const errMsg = "missing VITE_API_KEY environment variable";
|
|
26
|
+
|
|
27
|
+
window.alert(errMsg);
|
|
28
|
+
|
|
29
|
+
throw new Error(errMsg);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const root = createRoot(appElement);
|
|
33
|
+
|
|
34
|
+
function App() {
|
|
35
|
+
const ref = useRef<Methods>(null);
|
|
36
|
+
|
|
37
|
+
const [collapsed, setCollapsed] = useState(false);
|
|
38
|
+
|
|
39
|
+
useEffect(() => {
|
|
40
|
+
setTimeout(() => {
|
|
41
|
+
ref.current?.focus();
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
setTimeout(() => {
|
|
45
|
+
setCollapsed(true);
|
|
46
|
+
}, 5000);
|
|
47
|
+
}, []);
|
|
48
|
+
|
|
49
|
+
return createElement(ReactGeocodingControl, {
|
|
50
|
+
ref,
|
|
51
|
+
apiKey,
|
|
52
|
+
collapsed,
|
|
53
|
+
onSelect: (f) => {
|
|
54
|
+
console.log("select", f);
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
root.render(createElement(App));
|
package/src/main.ts
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import App from "./AppMaplibregl.svelte";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createElement,
|
|
5
|
+
useEffect,
|
|
6
|
+
useLayoutEffect,
|
|
7
|
+
useRef,
|
|
8
|
+
useState,
|
|
9
|
+
} from "react";
|
|
10
|
+
import { createRoot } from "react-dom/client";
|
|
11
|
+
import {
|
|
12
|
+
ReactGeocodingControl,
|
|
13
|
+
type Methods,
|
|
14
|
+
} from "./lib/ReactGeocodingControl";
|
|
15
|
+
|
|
16
|
+
const appElement = document.getElementById("app");
|
|
17
|
+
|
|
18
|
+
if (!appElement) {
|
|
19
|
+
throw new Error("element with id 'app' not found");
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const app = new App({
|
|
23
|
+
target: appElement,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
export default app;
|
|
27
|
+
|
|
28
|
+
// const apiKey = import.meta.env.VITE_API_KEY;
|
|
29
|
+
|
|
30
|
+
// if (!apiKey) {
|
|
31
|
+
// const errMsg = "missing VITE_API_KEY environment variable";
|
|
32
|
+
|
|
33
|
+
// window.alert(errMsg);
|
|
34
|
+
|
|
35
|
+
// throw new Error(errMsg);
|
|
36
|
+
// }
|
|
37
|
+
|
|
38
|
+
// const root = createRoot(appElement);
|
|
39
|
+
|
|
40
|
+
// function App() {
|
|
41
|
+
// const ref = useRef<Methods>(null);
|
|
42
|
+
|
|
43
|
+
// const [collapsed, setCollapsed] = useState(false);
|
|
44
|
+
|
|
45
|
+
// useEffect(() => {
|
|
46
|
+
// setTimeout(() => {
|
|
47
|
+
// ref.current?.focus();
|
|
48
|
+
// });
|
|
49
|
+
|
|
50
|
+
// setTimeout(() => {
|
|
51
|
+
// setCollapsed(true);
|
|
52
|
+
// }, 5000);
|
|
53
|
+
// }, []);
|
|
54
|
+
|
|
55
|
+
// return createElement(ReactGeocodingControl, {
|
|
56
|
+
// ref,
|
|
57
|
+
// apiKey,
|
|
58
|
+
// collapsed,
|
|
59
|
+
// onSelect: (f) => {
|
|
60
|
+
// console.log("select", f);
|
|
61
|
+
// },
|
|
62
|
+
// });
|
|
63
|
+
// }
|
|
64
|
+
|
|
65
|
+
// root.render(createElement(App));
|
package/style.css
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
div.svelte-7cmwmc{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);pointer-events:none;display:flex;align-items:center}svg.svelte-7cmwmc{animation:svelte-7cmwmc-rotate .8s infinite cubic-bezier(.45,.05,.55,.95)}@keyframes svelte-7cmwmc-rotate{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(360deg);transform:rotate(360deg)}}svg.svelte-1k1cmht.svelte-1k1cmht{display:block;fill:#6b7c93;stroke:#6b7c93}.list-icon.svelte-1k1cmht.svelte-1k1cmht{grid-row:1/3;align-self:center;margin:8px}.in-map.svelte-1k1cmht.svelte-1k1cmht{height:30px}.maplibregl-canvas-container .marker-selected{z-index:1}.maplibregl-canvas-container svg.svelte-1k1cmht path.svelte-1k1cmht,.leaflet-map-pane svg.svelte-1k1cmht path.svelte-1k1cmht{fill:#3170fe;stroke:#3170fe}.marker-selected svg.svelte-1k1cmht path.svelte-1k1cmht{fill:#98b7ff;stroke:#3170fe}.marker-reverse svg.svelte-1k1cmht path.svelte-1k1cmht{fill:silver;stroke:gray}.marker-interactive{cursor:pointer!important}.marker-fuzzy svg.svelte-1k1cmht path.svelte-1k1cmht{fill:silver;stroke:gray}.marker-fuzzy.marker-selected svg.svelte-1k1cmht path.svelte-1k1cmht{fill:#ddd;stroke:silver}.maptiler-gc-popup>.maplibregl-popup-content{padding:2px 8px}svg.svelte-en2qvf{display:block;fill:var(--color-icon-button)}form.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,form.svelte-z0d4ta .svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,form.svelte-z0d4ta .svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:after,form.svelte-z0d4ta .svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:before{box-sizing:border-box}form.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{font-family:Ubuntu,Open Sans,Helvetica Neue,Arial,Helvetica,sans-serif;position:relative;background-color:#fff;width:100%;z-index:10;border-radius:4px;transition:max-width .25s;box-shadow:0 2px 8px #33335926;--color-text:#333359;--color-icon-button:#333359}form.can-collapse.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{max-width:35px}form.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,form.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:focus-within,form.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:hover{max-width:240px}input.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{font:inherit;font-size:14px;width:100%;border:0;background-color:transparent;margin:0;height:36px;color:#000000bf;white-space:nowrap;overflow:hidden;padding:0}input.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:focus{color:#000000bf;outline:0;outline:none;box-shadow:none}ul.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,div.error.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,div.no-results.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{background-color:#fff;border-radius:4px;left:0;list-style:none;margin:0;padding:0;position:absolute;width:100%;top:calc(100% + 6px);font-size:14px;box-shadow:0 2px 8px #33335926;line-height:16px;overflow:hidden}.maplibregl-ctrl-bottom-left ul.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,.maplibregl-ctrl-bottom-right ul.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{top:auto;bottom:100%}li.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{text-align:left;cursor:default;display:grid;grid-template-columns:auto 1fr;color:var(--color-text);padding:4px 0}li.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:first-child{padding-top:8px}li.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:last-child{padding-bottom:8px}li.svelte-z0d4ta>span.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{overflow:hidden;padding-right:8px}li.svelte-z0d4ta>span.svelte-z0d4ta>span.svelte-z0d4ta.svelte-z0d4ta{white-space:nowrap;display:block;min-width:fit-content}li.selected.svelte-z0d4ta>span.svelte-z0d4ta>span.svelte-z0d4ta.svelte-z0d4ta{animation:svelte-z0d4ta-backAndForth 5s linear infinite}li.svelte-z0d4ta>span.svelte-z0d4ta:nth-of-type(1)>span.svelte-z0d4ta>span.svelte-z0d4ta:nth-of-type(1){font-weight:700}li.svelte-z0d4ta>span.svelte-z0d4ta:nth-of-type(1)>span.svelte-z0d4ta>span.svelte-z0d4ta:nth-of-type(2){color:#aeb6c7;font-size:12px;padding-left:4px}li.selected.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{background-color:#f3f3f3}button.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:hover{background-color:transparent}button.svelte-z0d4ta:hover svg,button.active.svelte-z0d4ta svg{fill:#6b7c92}button.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{padding:0;margin:0;border:0;background-color:transparent}.input-group.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{display:flex;align-items:stretch;gap:7px;padding-inline:8px;outline:#c1cfe4 solid 2px;border-radius:4px;overflow:hidden}.input-group.svelte-z0d4ta:hover .displayable.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{visibility:visible}.input-group.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:focus-within{outline:#3170fe solid 2px}div.error.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta,div.no-results.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{font:inherit;font-size:14px;padding:6px 10px}div.error.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{color:#e25041}div.no-results.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{color:var(--color-text)}.clear-button-container.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{position:relative;display:flex;align-items:stretch}.clear-button-container.svelte-z0d4ta button.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta{visibility:hidden}@keyframes svelte-z0d4ta-backAndForth{0%{transform:translate(0)}10%{transform:translate(0)}45%{transform:translate(calc(-100% + 196px))}55%{transform:translate(calc(-100% + 196px))}90%{transform:translate(0)}to{transform:translate(0)}}form.can-collapse.svelte-z0d4ta button.svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:not(:nth-of-type(1)){opacity:0;transition:opacity .25s}form.can-collapse.svelte-z0d4ta:focus-within .svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:not(:nth-of-type(1)),form.can-collapse.svelte-z0d4ta:hover .svelte-z0d4ta.svelte-z0d4ta.svelte-z0d4ta:not(:nth-of-type(1)){opacity:1}
|