react-listing-engine 0.7.0 → 0.7.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/CHANGELOG.md +6 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/maps/google/index.cjs +1 -1
- package/dist/maps/google/index.js +1 -1
- package/dist/styled/index.cjs +1 -1
- package/dist/styled/index.js +1 -1
- package/package.json +1 -1
- /package/dist/{chunk-3O6X563H.cjs → chunk-6HHIXJWE.cjs} +0 -0
- /package/dist/{chunk-SIMKBYC6.js → chunk-YGFE5EQQ.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# react-listing-engine
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Fix on-map marker/popup click handling: call `google.maps.OverlayView.preventMapHitsAndGesturesFrom()` on the marker and popup overlay containers. Previously a real pointer click on an HTML overlay marker also registered as a Google Maps _map click_, which fired the background-click dismissal and immediately deselected the just-clicked marker — so the on-map popup opened and instantly closed. This also stops dragging over a marker or popup from panning the map underneath.
|
|
8
|
+
|
|
3
9
|
## 0.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2;"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunk6HHIXJWEcjs = require('./chunk-6HHIXJWE.cjs');var P=(r=>(r.Paged="paged",r.Infinite="infinite",r))(P||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var d= (_class =class{__init() {this.listeners=new Set}constructor(t={}){;_class.prototype.__init.call(this);this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}}, _class);function b(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var h= (_class2 =class{__init2() {this.isSyncing=!1}__init3() {this.unsubscribeEngine=null}__init4() {this.unsubscribeHistory=null}constructor(t){;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=_nullishCoalesce(t.hydrateOnStart, () => (!0))}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){_optionalChain([this, 'access', _ => _.unsubscribeEngine, 'optionalCall', _2 => _2()]),this.unsubscribeEngine=null,_optionalChain([this, 'access', _3 => _3.unsubscribeHistory, 'optionalCall', _4 => _4()]),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);b(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}}, _class2);var m=class{constructor(t={}){this.mode=_nullishCoalesce(t.mode, () => ("replace"))}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,a]of Object.entries(t))a===void 0||a===""||r.set(c,a);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};var _jsxruntime = require('react/jsx-runtime');function rt({children:e}){let{Toolbar:t}=_chunk6HHIXJWEcjs.r.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function lt(){let e=_chunk6HHIXJWEcjs.t.call(void 0, ),t=_chunk6HHIXJWEcjs.u.call(void 0, ),r=_react.useCallback.call(void 0, l=>e.loadPoints(l),[e]),s=_react.useCallback.call(void 0, (l,f)=>e.selectPoint(l,f),[e]),o=_react.useCallback.call(void 0, l=>e.setHovered(e.primaryDatasetId,l),[e]),i=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _5 => _5.map, 'optionalAccess', _6 => _6.zoomIn, 'call', _7 => _7()]),[e]),c=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _8 => _8.map, 'optionalAccess', _9 => _9.zoomOut, 'call', _10 => _10()]),[e]),a=_react.useCallback.call(void 0, ()=>_optionalChain([e, 'access', _11 => _11.map, 'optionalAccess', _12 => _12.toggleFullscreen, 'call', _13 => _13()]),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:a}}function dt(e){let t=_chunk6HHIXJWEcjs.t.call(void 0, ),r=_chunk6HHIXJWEcjs.u.call(void 0, ),s=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(r.layers[e], () => (!0)),points:_nullishCoalesce(r.points[e], () => ([])),toggle:s}}exports.BrowserHistoryPort = m; exports.DatasetRegistry = _chunk6HHIXJWEcjs.c; exports.FallbackPopup = _chunk6HHIXJWEcjs.p; exports.FilterRegistry = _chunk6HHIXJWEcjs.b; exports.ListingApp = _chunk6HHIXJWEcjs.S; exports.ListingComponentsProvider = _chunk6HHIXJWEcjs.q; exports.ListingConfig = _chunk6HHIXJWEcjs.f; exports.ListingEngine = _chunk6HHIXJWEcjs.g; exports.ListingEngineContext = _chunk6HHIXJWEcjs.s; exports.ListingEventType = v; exports.ListingFilters = _chunk6HHIXJWEcjs.w; exports.ListingList = _chunk6HHIXJWEcjs.y; exports.ListingMap = _chunk6HHIXJWEcjs.z; exports.ListingPagination = _chunk6HHIXJWEcjs.A; exports.ListingProvider = _chunk6HHIXJWEcjs.D; exports.ListingResultHeader = _chunk6HHIXJWEcjs.B; exports.ListingStore = _chunk6HHIXJWEcjs.a; exports.ListingToolbar = rt; exports.MemoryHistoryPort = d; exports.PaginationMode = P; exports.TypedEmitter = _chunk6HHIXJWEcjs.d; exports.UrlSyncController = h; exports.composeListingProviders = _chunk6HHIXJWEcjs.h; exports.listingDefaultConfig = _chunk6HHIXJWEcjs.e; exports.useListing = _chunk6HHIXJWEcjs.t; exports.useListingComponents = _chunk6HHIXJWEcjs.r; exports.useListingEvent = _chunk6HHIXJWEcjs.C; exports.useListingFilters = _chunk6HHIXJWEcjs.v; exports.useListingLayer = dt; exports.useListingMap = lt; exports.useListingResults = _chunk6HHIXJWEcjs.x; exports.useListingState = _chunk6HHIXJWEcjs.u; exports.withConfig = _chunk6HHIXJWEcjs.i; exports.withDataset = _chunk6HHIXJWEcjs.k; exports.withFilters = _chunk6HHIXJWEcjs.l; exports.withInitialFilters = _chunk6HHIXJWEcjs.n; exports.withMap = _chunk6HHIXJWEcjs.j; exports.withPrimaryDataset = _chunk6HHIXJWEcjs.o; exports.withUrlSync = _chunk6HHIXJWEcjs.m;
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{A as N,B as V,C as W,D as X,S as g,a as S,b as Q,c as x,d as T,e as L,f as H,g as O,h as E,i as k,j as q,k as I,l as C,m as U,n as B,o as z,p as G,q as R,r as p,s as $,t as u,u as y,v as j,w as A,x as D,y as J,z as K}from"./chunk-
|
|
2
|
+
import{A as N,B as V,C as W,D as X,S as g,a as S,b as Q,c as x,d as T,e as L,f as H,g as O,h as E,i as k,j as q,k as I,l as C,m as U,n as B,o as z,p as G,q as R,r as p,s as $,t as u,u as y,v as j,w as A,x as D,y as J,z as K}from"./chunk-YGFE5EQQ.js";var P=(r=>(r.Paged="paged",r.Infinite="infinite",r))(P||{});var v=(i=>(i.FiltersChanged="FiltersChanged",i.ResultsLoaded="ResultsLoaded",i.PointClicked="PointClicked",i.BoundsChanged="BoundsChanged",i.LayerToggled="LayerToggled",i))(v||{});var d=class{query;listeners=new Set;constructor(t={}){this.query={...t}}getQuery(){return{...this.query}}setQuery(t){this.query={...t},this.notify()}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}notify(){for(let t of[...this.listeners])t()}};function b(e,t){let r=new Set([...Object.keys(e),...Object.keys(t)]);for(let s of r)if(e[s]!==t[s])return!1;return!0}var h=class{history;toQueryFn;toFiltersFn;hydrateOnStart;isSyncing=!1;unsubscribeEngine=null;unsubscribeHistory=null;constructor(t){this.history=t.history,this.toQueryFn=t.toQuery,this.toFiltersFn=t.toFilters,this.hydrateOnStart=t.hydrateOnStart??!0}start(t){this.stop(),this.unsubscribeEngine=t.subscribe(()=>{this.isSyncing||this.syncEngineToHistory(t)}),this.unsubscribeHistory=this.history.subscribe(()=>{this.isSyncing||this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}),this.hydrateOnStart&&this.withSyncGuard(()=>{this.applyFiltersSafely(t,this.toFiltersFn(this.history.getQuery()))})}stop(){this.unsubscribeEngine?.(),this.unsubscribeEngine=null,this.unsubscribeHistory?.(),this.unsubscribeHistory=null}syncEngineToHistory(t){let r=this.toQueryFn(t.state.filters);b(r,this.history.getQuery())||this.withSyncGuard(()=>this.history.setQuery(r))}applyFiltersSafely(t,r){Promise.resolve(t.applyFilters(r)).catch(()=>{})}withSyncGuard(t){this.isSyncing=!0;try{t()}finally{this.isSyncing=!1}}};var m=class{mode;constructor(t={}){this.mode=t.mode??"replace"}getQuery(){if(typeof window>"u")return{};let t=new URLSearchParams(window.location.search),r={};for(let[s,o]of t)o!==""&&(r[s]=o);return r}setQuery(t){if(typeof window>"u")return;let r=new URLSearchParams;for(let[c,a]of Object.entries(t))a===void 0||a===""||r.set(c,a);let s=r.toString(),o=s?`?${s}`:"";if(o===window.location.search)return;let i=`${window.location.pathname}${o}${window.location.hash}`;this.mode==="push"?window.history.pushState(window.history.state,"",i):window.history.replaceState(window.history.state,"",i)}subscribe(t){return typeof window>"u"?()=>{}:(window.addEventListener("popstate",t),()=>{window.removeEventListener("popstate",t)})}};import{jsx as F}from"react/jsx-runtime";function rt({children:e}){let{Toolbar:t}=p();return F(t,{children:e})}import{useCallback as n}from"react";function lt(){let e=u(),t=y(),r=n(l=>e.loadPoints(l),[e]),s=n((l,f)=>e.selectPoint(l,f),[e]),o=n(l=>e.setHovered(e.primaryDatasetId,l),[e]),i=n(()=>e.map?.zoomIn(),[e]),c=n(()=>e.map?.zoomOut(),[e]),a=n(()=>e.map?.toggleFullscreen(),[e]);return{bounds:t.bounds,points:t.points,hovered:t.hovered,loadPoints:r,selectPoint:s,setHovered:o,zoomIn:i,zoomOut:c,toggleFullscreen:a}}import{useCallback as w}from"react";function dt(e){let t=u(),r=y(),s=w(()=>t.toggleLayer(e),[t,e]);return{visible:r.layers[e]??!0,points:r.points[e]??[],toggle:s}}export{m as BrowserHistoryPort,x as DatasetRegistry,G as FallbackPopup,Q as FilterRegistry,g as ListingApp,R as ListingComponentsProvider,H as ListingConfig,O as ListingEngine,$ as ListingEngineContext,v as ListingEventType,A as ListingFilters,J as ListingList,K as ListingMap,N as ListingPagination,X as ListingProvider,V as ListingResultHeader,S as ListingStore,rt as ListingToolbar,d as MemoryHistoryPort,P as PaginationMode,T as TypedEmitter,h as UrlSyncController,E as composeListingProviders,L as listingDefaultConfig,u as useListing,p as useListingComponents,W as useListingEvent,j as useListingFilters,dt as useListingLayer,lt as useListingMap,D as useListingResults,y as useListingState,k as withConfig,I as withDataset,C as withFilters,B as withInitialFilters,q as withMap,z as withPrimaryDataset,U as withUrlSync};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
|
-
var _jsapiloader = require('@googlemaps/js-api-loader');var P="DEMO_MAP_ID";function
|
|
2
|
+
var _jsapiloader = require('@googlemaps/js-api-loader');var P="DEMO_MAP_ID";function u(r){return r.raw}function H(r,n){if(r.element)return r.element;if(r.iconUrl)return new n.PinElement({glyphSrc:r.iconUrl}).element}var L=12,R="#b3261e";function I(r){if(r.element)return r.element;if(r.iconUrl){let i=document.createElement("img");return i.src=r.iconUrl,i}let n=document.createElement("div");return n.style.width=`${L}px`,n.style.height=`${L}px`,n.style.borderRadius="50%",n.style.backgroundColor=R,n.style.border="2px solid #ffffff",n.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",n}var m;function x(){if(m)return m;class r extends google.maps.OverlayView{constructor(t,s,a,e){super();r.prototype.__init.call(this);;this.position=t;this.content=s;this.onClick=a;this.lifecycle=e}__init() {this.div=null}onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,_optionalChain([this, 'access', _2 => _2.getPanes, 'call', _3 => _3(), 'optionalAccess', _4 => _4.overlayMouseTarget, 'access', _5 => _5.appendChild, 'call', _6 => _6(t)]),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let s=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.div.style.left=`${s.x}px`,this.div.style.top=`${s.y}px`)}onRemove(){let t=this.div;_optionalChain([this, 'access', _7 => _7.div, 'optionalAccess', _8 => _8.remove, 'call', _9 => _9()]),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return m=r,m}var A=14,f;function T(){if(f)return f;class r extends google.maps.OverlayView{constructor(t,s){super();r.prototype.__init2.call(this);;this.container=t;this.position=s}__init2() {this.attached=!1}onAdd(){this.attached=!0,_optionalChain([this, 'access', _10 => _10.getPanes, 'call', _11 => _11(), 'optionalAccess', _12 => _12.floatPane, 'access', _13 => _13.appendChild, 'call', _14 => _14(this.container)]),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container)}draw(){let t=this.getProjection();if(!t)return;let s=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-A}px`)}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){this.position=t,this.attached&&this.draw()}}return f=r,f}function g(r){for(let n of r)typeof n.setMap=="function"?n.setMap(null):n.map=null}var G="#b3261e",S=40,_=64,F=14;function z(r,n){let i=n.count,t=Math.min(_,S+Math.round(Math.log10(i+1)*F)),s=document.createElement("div");return s.textContent=String(i),s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.width=`${t}px`,s.style.height=`${t}px`,s.style.borderRadius="50%",s.style.backgroundColor=G,s.style.border="2px solid #ffffff",s.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",s.style.color="#ffffff",s.style.fontFamily="inherit",s.style.fontWeight="700",s.style.fontSize=t>=52?"15px":"13px",new r.AdvancedMarkerElement({position:n.position,content:s})}var E=!1;async function U(r,n,i,t){let s;try{s=await Promise.resolve().then(() => _interopRequireWildcard(require("@googlemaps/markerclusterer")))}catch(e){E||(E=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',e));return}if(r.layers.get(n)!==i)return;let a=new s.MarkerClusterer({map:r.map,markers:i,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:e=>z(r.markerLib,e)}});r.clusterers.set(n,a)}function v(r,n){let i=r.clusterers.get(n);i&&(i.setMap(null),r.clusterers.delete(n))}var h=!1;function B(){h||(h=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function V(r,n){return n.markers.map(i=>{let t=new r.markerLib.AdvancedMarkerElement({map:r.map,position:i.position,content:H(i,r.markerLib),gmpClickable:!!n.onMarkerClick});if(n.onMarkerClick){let s=n.onMarkerClick;t.addListener("click",()=>s(i.id))}return t})}function O(r,n,i,t){r.classList.toggle("rle-marker--selected",n===i),r.classList.toggle("rle-marker--hovered",n===t&&n!==i)}function Z(r,n){let i=x();return n.markers.map(t=>{let s=n.onMarkerClick,a=s?()=>s(t.id):void 0,e=new i(t.position,I(t),a,{onContainerAdd:o=>{r.markerElements.set(t.id,o),O(o,t.id,r.selectedMarkerId,r.hoveredMarkerId)},onContainerRemove:o=>{r.markerElements.get(t.id)===o&&r.markerElements.delete(t.id)}});return e.setMap(r.map),e})}function C(r,n){let i=r.layerMarkerIds.get(n);if(i){for(let t of i)r.markerElements.delete(t);r.layerMarkerIds.delete(n)}}function D(r){let n=r.getSouthWest(),i=r.getNorthEast();return{west:n.lng(),south:n.lat(),east:i.lng(),north:i.lat()}}function $(r,n,i){if(typeof ResizeObserver>"u")return;let t=!1,s=()=>{let{width:e,height:o}=r.getBoundingClientRect();e===0||o===0||(google.maps.event.trigger(n,"resize"),t||(t=!0,n.setCenter(i)))},a=new ResizeObserver(s);return a.observe(r),typeof requestAnimationFrame<"u"?requestAnimationFrame(s):queueMicrotask(s),a}function q(r){if(!r.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let n=!1,i=()=>{n||(_jsapiloader.setOptions.call(void 0, {...r.loaderOptions,key:r.apiKey}),n=!0)},t,s=0;return{async mount(a,e){let o=++s;i();let l=await _jsapiloader.importLibrary.call(void 0, "maps"),d=await _jsapiloader.importLibrary.call(void 0, "marker"),c=_nullishCoalesce(e.center, () => ({lat:0,lng:0})),p=r.styles!=null,M=new l.Map(a,{...r.mapOptions,center:c,zoom:_nullishCoalesce(e.zoom, () => (10)),...p?{styles:r.styles}:{mapId:_nullishCoalesce(r.mapId, () => (P))}}),b=$(a,M,c),y={map:M,containerEl:a,fullscreenEl:_nullishCoalesce(e.fullscreenTarget, () => (a)),markerLib:d,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:b,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null};return o===s&&(t=y),{raw:y}},renderLayer(a,e){let o=u(a),l=o.layers.get(e.id);l&&(g(l),o.layers.delete(e.id),C(o,e.id)),v(o,e.id);let d=o.markerMode==="overlay"?Z(o,e):V(o,e);o.layers.set(e.id,d),o.markerMode==="overlay"&&o.layerMarkerIds.set(e.id,e.markers.map(p=>p.id)),e.clustering&&(o.markerMode==="overlay"?B():U(o,e.id,d,e.clustering));let c=!1;return()=>{c||(c=!0,o.layers.get(e.id)===d&&(g(d),o.layers.delete(e.id),v(o,e.id),C(o,e.id)))}},onBoundsChange(a,e){let o=u(a),l=o.map.addListener("idle",()=>{let c=o.map.getBounds();c&&e(D(c))});o.boundsListeners.add(l);let d=!1;return()=>{d||(d=!0,l.remove(),o.boundsListeners.delete(l))}},onMapClick(a){let e=t;if(!e)return()=>{};let o=e.map.addListener("click",()=>a());e.clickListeners.add(o);let l=!1;return()=>{l||(l=!0,o.remove(),e.clickListeners.delete(o))}},fitBounds(a,e){u(a).map.fitBounds(e)},destroy(a){let e=u(a);_optionalChain([e, 'access', _15 => _15.resizeObserver, 'optionalAccess', _16 => _16.disconnect, 'call', _17 => _17()]);for(let o of e.boundsListeners)o.remove();e.boundsListeners.clear();for(let o of e.clickListeners)o.remove();e.clickListeners.clear();for(let o of[...e.clusterers.keys()])v(e,o);for(let o of e.layers.values())g(o);e.layers.clear(),e.markerElements.clear(),e.layerMarkerIds.clear(),t===e&&(t=void 0)},updateMarkerStates(a,e){if(t){t.selectedMarkerId=a,t.hoveredMarkerId=e;for(let[o,l]of t.markerElements)O(l,o,a,e)}},mountOverlay(a){let e=document.createElement("div");if(e.style.position="absolute",e.style.transform="translate(-50%, -100%)",e.style.pointerEvents="auto",!t)return{container:e,setPosition:()=>{},unmount:()=>e.remove()};let o=T(),l=new o(e,a);return l.setMap(t.map),{container:e,setPosition:d=>l.updatePosition(d),unmount:()=>{l.setMap(null),e.remove()}}},zoomIn(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))+1)},zoomOut(){t&&t.map.setZoom((_nullishCoalesce(t.map.getZoom(), () => (0)))-1)},toggleFullscreen(){if(!t)return;let a=t.fullscreenEl,e=document.fullscreenElement;e!=null&&a.contains(e)?typeof document.exitFullscreen=="function"&&_optionalChain([document, 'access', _18 => _18.exitFullscreen, 'call', _19 => _19(), 'optionalAccess', _20 => _20.catch, 'call', _21 => _21(()=>{})]):typeof a.requestFullscreen=="function"&&_optionalChain([a, 'access', _22 => _22.requestFullscreen, 'call', _23 => _23(), 'optionalAccess', _24 => _24.catch, 'call', _25 => _25(()=>{})])}}}exports.googleProvider = q;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{importLibrary as k,setOptions as w}from"@googlemaps/js-api-loader";var P="DEMO_MAP_ID";function
|
|
2
|
+
import{importLibrary as k,setOptions as w}from"@googlemaps/js-api-loader";var P="DEMO_MAP_ID";function u(r){return r.raw}function H(r,n){if(r.element)return r.element;if(r.iconUrl)return new n.PinElement({glyphSrc:r.iconUrl}).element}var L=12,R="#b3261e";function I(r){if(r.element)return r.element;if(r.iconUrl){let i=document.createElement("img");return i.src=r.iconUrl,i}let n=document.createElement("div");return n.style.width=`${L}px`,n.style.height=`${L}px`,n.style.borderRadius="50%",n.style.backgroundColor=R,n.style.border="2px solid #ffffff",n.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",n}var m;function x(){if(m)return m;class r extends google.maps.OverlayView{constructor(t,s,a,e){super();this.position=t;this.content=s;this.onClick=a;this.lifecycle=e}position;content;onClick;lifecycle;div=null;onAdd(){let t=document.createElement("div");t.style.position="absolute",t.style.transform="translate(-50%, -50%)",this.onClick&&(t.style.cursor="pointer",t.addEventListener("click",this.onClick)),t.appendChild(this.content),this.div=t,this.getPanes()?.overlayMouseTarget.appendChild(t),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(t),this.lifecycle.onContainerAdd(t)}draw(){if(!this.div)return;let t=this.getProjection();if(!t)return;let s=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.div.style.left=`${s.x}px`,this.div.style.top=`${s.y}px`)}onRemove(){let t=this.div;this.div?.remove(),this.div=null,t&&this.lifecycle.onContainerRemove(t)}}return m=r,m}var A=14,f;function T(){if(f)return f;class r extends google.maps.OverlayView{constructor(t,s){super();this.container=t;this.position=s}container;position;attached=!1;onAdd(){this.attached=!0,this.getPanes()?.floatPane.appendChild(this.container),typeof google.maps.OverlayView.preventMapHitsAndGesturesFrom=="function"&&google.maps.OverlayView.preventMapHitsAndGesturesFrom(this.container)}draw(){let t=this.getProjection();if(!t)return;let s=t.fromLatLngToDivPixel(new google.maps.LatLng(this.position.lat,this.position.lng));s&&(this.container.style.left=`${s.x}px`,this.container.style.top=`${s.y-A}px`)}onRemove(){this.attached=!1,this.container.remove()}updatePosition(t){this.position=t,this.attached&&this.draw()}}return f=r,f}function g(r){for(let n of r)typeof n.setMap=="function"?n.setMap(null):n.map=null}var G="#b3261e",S=40,_=64,F=14;function z(r,n){let i=n.count,t=Math.min(_,S+Math.round(Math.log10(i+1)*F)),s=document.createElement("div");return s.textContent=String(i),s.style.display="flex",s.style.alignItems="center",s.style.justifyContent="center",s.style.width=`${t}px`,s.style.height=`${t}px`,s.style.borderRadius="50%",s.style.backgroundColor=G,s.style.border="2px solid #ffffff",s.style.boxShadow="0 1px 4px rgba(0, 0, 0, 0.4)",s.style.color="#ffffff",s.style.fontFamily="inherit",s.style.fontWeight="700",s.style.fontSize=t>=52?"15px":"13px",new r.AdvancedMarkerElement({position:n.position,content:s})}var E=!1;async function U(r,n,i,t){let s;try{s=await import("@googlemaps/markerclusterer")}catch(e){E||(E=!0,console.warn('[react-listing-engine] "@googlemaps/markerclusterer" is not installed -- rendering plain (unclustered) markers instead. Install "@googlemaps/markerclusterer" to enable clustering.',e));return}if(r.layers.get(n)!==i)return;let a=new s.MarkerClusterer({map:r.map,markers:i,algorithmOptions:{maxZoom:t.maxZoom},renderer:{render:e=>z(r.markerLib,e)}});r.clusterers.set(n,a)}function v(r,n){let i=r.clusterers.get(n);i&&(i.setMap(null),r.clusterers.delete(n))}var h=!1;function B(){h||(h=!0,console.warn('[react-listing-engine] Marker clustering is not supported in `styles` (OverlayView) mode -- "@googlemaps/markerclusterer" only manages Marker/AdvancedMarkerElement instances. Rendering plain, unclustered overlay markers instead. Use a `mapId` (advanced-marker mode) to enable clustering.'))}function V(r,n){return n.markers.map(i=>{let t=new r.markerLib.AdvancedMarkerElement({map:r.map,position:i.position,content:H(i,r.markerLib),gmpClickable:!!n.onMarkerClick});if(n.onMarkerClick){let s=n.onMarkerClick;t.addListener("click",()=>s(i.id))}return t})}function O(r,n,i,t){r.classList.toggle("rle-marker--selected",n===i),r.classList.toggle("rle-marker--hovered",n===t&&n!==i)}function Z(r,n){let i=x();return n.markers.map(t=>{let s=n.onMarkerClick,a=s?()=>s(t.id):void 0,e=new i(t.position,I(t),a,{onContainerAdd:o=>{r.markerElements.set(t.id,o),O(o,t.id,r.selectedMarkerId,r.hoveredMarkerId)},onContainerRemove:o=>{r.markerElements.get(t.id)===o&&r.markerElements.delete(t.id)}});return e.setMap(r.map),e})}function C(r,n){let i=r.layerMarkerIds.get(n);if(i){for(let t of i)r.markerElements.delete(t);r.layerMarkerIds.delete(n)}}function D(r){let n=r.getSouthWest(),i=r.getNorthEast();return{west:n.lng(),south:n.lat(),east:i.lng(),north:i.lat()}}function $(r,n,i){if(typeof ResizeObserver>"u")return;let t=!1,s=()=>{let{width:e,height:o}=r.getBoundingClientRect();e===0||o===0||(google.maps.event.trigger(n,"resize"),t||(t=!0,n.setCenter(i)))},a=new ResizeObserver(s);return a.observe(r),typeof requestAnimationFrame<"u"?requestAnimationFrame(s):queueMicrotask(s),a}function q(r){if(!r.apiKey)throw new Error("googleProvider: config.apiKey is required (no hardcoded fallback key is ever used).");let n=!1,i=()=>{n||(w({...r.loaderOptions,key:r.apiKey}),n=!0)},t,s=0;return{async mount(a,e){let o=++s;i();let l=await k("maps"),d=await k("marker"),c=e.center??{lat:0,lng:0},p=r.styles!=null,M=new l.Map(a,{...r.mapOptions,center:c,zoom:e.zoom??10,...p?{styles:r.styles}:{mapId:r.mapId??P}}),b=$(a,M,c),y={map:M,containerEl:a,fullscreenEl:e.fullscreenTarget??a,markerLib:d,markerMode:p?"overlay":"advanced",layers:new Map,clusterers:new Map,boundsListeners:new Set,clickListeners:new Set,resizeObserver:b,markerElements:new Map,layerMarkerIds:new Map,selectedMarkerId:null,hoveredMarkerId:null};return o===s&&(t=y),{raw:y}},renderLayer(a,e){let o=u(a),l=o.layers.get(e.id);l&&(g(l),o.layers.delete(e.id),C(o,e.id)),v(o,e.id);let d=o.markerMode==="overlay"?Z(o,e):V(o,e);o.layers.set(e.id,d),o.markerMode==="overlay"&&o.layerMarkerIds.set(e.id,e.markers.map(p=>p.id)),e.clustering&&(o.markerMode==="overlay"?B():U(o,e.id,d,e.clustering));let c=!1;return()=>{c||(c=!0,o.layers.get(e.id)===d&&(g(d),o.layers.delete(e.id),v(o,e.id),C(o,e.id)))}},onBoundsChange(a,e){let o=u(a),l=o.map.addListener("idle",()=>{let c=o.map.getBounds();c&&e(D(c))});o.boundsListeners.add(l);let d=!1;return()=>{d||(d=!0,l.remove(),o.boundsListeners.delete(l))}},onMapClick(a){let e=t;if(!e)return()=>{};let o=e.map.addListener("click",()=>a());e.clickListeners.add(o);let l=!1;return()=>{l||(l=!0,o.remove(),e.clickListeners.delete(o))}},fitBounds(a,e){u(a).map.fitBounds(e)},destroy(a){let e=u(a);e.resizeObserver?.disconnect();for(let o of e.boundsListeners)o.remove();e.boundsListeners.clear();for(let o of e.clickListeners)o.remove();e.clickListeners.clear();for(let o of[...e.clusterers.keys()])v(e,o);for(let o of e.layers.values())g(o);e.layers.clear(),e.markerElements.clear(),e.layerMarkerIds.clear(),t===e&&(t=void 0)},updateMarkerStates(a,e){if(t){t.selectedMarkerId=a,t.hoveredMarkerId=e;for(let[o,l]of t.markerElements)O(l,o,a,e)}},mountOverlay(a){let e=document.createElement("div");if(e.style.position="absolute",e.style.transform="translate(-50%, -100%)",e.style.pointerEvents="auto",!t)return{container:e,setPosition:()=>{},unmount:()=>e.remove()};let o=T(),l=new o(e,a);return l.setMap(t.map),{container:e,setPosition:d=>l.updatePosition(d),unmount:()=>{l.setMap(null),e.remove()}}},zoomIn(){t&&t.map.setZoom((t.map.getZoom()??0)+1)},zoomOut(){t&&t.map.setZoom((t.map.getZoom()??0)-1)},toggleFullscreen(){if(!t)return;let a=t.fullscreenEl,e=document.fullscreenElement;e!=null&&a.contains(e)?typeof document.exitFullscreen=="function"&&document.exitFullscreen()?.catch(()=>{}):typeof a.requestFullscreen=="function"&&a.requestFullscreen()?.catch(()=>{})}}}export{q as googleProvider};
|
package/dist/styled/index.cjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});"use client";
|
|
2
|
-
var
|
|
2
|
+
var _chunk6HHIXJWEcjs = require('../chunk-6HHIXJWE.cjs');var _jsxruntime = require('react/jsx-runtime');function L({children:o}){return _jsxruntime.jsx.call(void 0, _chunk6HHIXJWEcjs.q,{..._chunk6HHIXJWEcjs.O,children:o})}exports.BottomNav = _chunk6HHIXJWEcjs.P; exports.BottomSheet = _chunk6HHIXJWEcjs.Q; exports.ListingApp = _chunk6HHIXJWEcjs.S; exports.StyledCard = _chunk6HHIXJWEcjs.E; exports.StyledComponentsProviderWithDefaults = L; exports.StyledEmpty = _chunk6HHIXJWEcjs.F; exports.StyledFilterPanel = _chunk6HHIXJWEcjs.G; exports.StyledListingLayout = _chunk6HHIXJWEcjs.R; exports.StyledLoading = _chunk6HHIXJWEcjs.H; exports.StyledMarker = _chunk6HHIXJWEcjs.I; exports.StyledPopup = _chunk6HHIXJWEcjs.J; exports.StyledResultHeader = _chunk6HHIXJWEcjs.K; exports.StyledSearch = _chunk6HHIXJWEcjs.L; exports.StyledSidebar = _chunk6HHIXJWEcjs.M; exports.StyledToolbar = _chunk6HHIXJWEcjs.N; exports.styledDefaultComponents = _chunk6HHIXJWEcjs.O;
|
package/dist/styled/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{E as r,F as p,G as i,H as d,I as y,J as l,K as n,L as m,M as s,N as a,O as t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-
|
|
2
|
+
import{E as r,F as p,G as i,H as d,I as y,J as l,K as n,L as m,M as s,N as a,O as t,P as S,Q as f,R as P,S as u,q as e}from"../chunk-YGFE5EQQ.js";import{jsx as g}from"react/jsx-runtime";function L({children:o}){return g(e,{...t,children:o})}export{S as BottomNav,f as BottomSheet,u as ListingApp,r as StyledCard,L as StyledComponentsProviderWithDefaults,p as StyledEmpty,i as StyledFilterPanel,P as StyledListingLayout,d as StyledLoading,y as StyledMarker,l as StyledPopup,n as StyledResultHeader,m as StyledSearch,s as StyledSidebar,a as StyledToolbar,t as styledDefaultComponents};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-listing-engine",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "Headless, composable listing engine for React: filterable list + Google-Maps multi-layer map, with pluggable data adapters, a filter/dataset registry, injectable components, and a Tailwind-free styled adapter.",
|
|
6
6
|
"funding": [
|
|
File without changes
|
|
File without changes
|