react-listing-engine 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE +21 -0
  3. package/README.md +161 -0
  4. package/dist/chunk-2T5PE5MB.js +2 -0
  5. package/dist/chunk-2VUHLHHX.cjs +2 -0
  6. package/dist/chunk-35KYEBAC.js +2 -0
  7. package/dist/chunk-5FBI2WIM.js +2 -0
  8. package/dist/chunk-5O36WI7H.cjs +2 -0
  9. package/dist/chunk-6PZHSHU3.js +2 -0
  10. package/dist/chunk-CHNUE46K.cjs +2 -0
  11. package/dist/chunk-LCQZIWBO.cjs +2 -0
  12. package/dist/chunk-N3OZ2HK2.cjs +2 -0
  13. package/dist/chunk-PFPHWJAA.js +2 -0
  14. package/dist/components-provider-CF0Mo0B8.d.cts +120 -0
  15. package/dist/components-provider-CjMxkxrP.d.ts +120 -0
  16. package/dist/entity-adapter.interface-BDgbSxhq.d.cts +33 -0
  17. package/dist/entity-adapter.interface-BDgbSxhq.d.ts +33 -0
  18. package/dist/index.cjs +2 -0
  19. package/dist/index.d.cts +674 -0
  20. package/dist/index.d.ts +674 -0
  21. package/dist/index.js +2 -0
  22. package/dist/listing-app-De6OqpUC.d.ts +199 -0
  23. package/dist/listing-app-pKMQBuQI.d.cts +199 -0
  24. package/dist/listing-config-options.interface-ZJYY_ZvR.d.cts +12 -0
  25. package/dist/listing-config-options.interface-ZJYY_ZvR.d.ts +12 -0
  26. package/dist/map-provider.interface-BMnwW3ob.d.cts +37 -0
  27. package/dist/map-provider.interface-BxexMT3X.d.ts +37 -0
  28. package/dist/maps/google/index.cjs +2 -0
  29. package/dist/maps/google/index.d.cts +39 -0
  30. package/dist/maps/google/index.d.ts +39 -0
  31. package/dist/maps/google/index.js +2 -0
  32. package/dist/presets/rental/index.cjs +2 -0
  33. package/dist/presets/rental/index.d.cts +266 -0
  34. package/dist/presets/rental/index.d.ts +266 -0
  35. package/dist/presets/rental/index.js +2 -0
  36. package/dist/shadcn/index.cjs +2 -0
  37. package/dist/shadcn/index.d.cts +261 -0
  38. package/dist/shadcn/index.d.ts +261 -0
  39. package/dist/shadcn/index.js +2 -0
  40. package/dist/styled/index.cjs +2 -0
  41. package/dist/styled/index.d.cts +123 -0
  42. package/dist/styled/index.d.ts +123 -0
  43. package/dist/styled/index.js +2 -0
  44. package/dist/styles.css +972 -0
  45. package/dist/testing/index.cjs +2 -0
  46. package/dist/testing/index.d.cts +51 -0
  47. package/dist/testing/index.d.ts +51 -0
  48. package/dist/testing/index.js +2 -0
  49. package/dist/url-sync.controller-CsU_QxoS.d.cts +89 -0
  50. package/dist/url-sync.controller-DX67JivW.d.ts +89 -0
  51. package/package.json +143 -0
@@ -0,0 +1,33 @@
1
+ type EntityId = string | number;
2
+ interface Bounds {
3
+ west: number;
4
+ south: number;
5
+ east: number;
6
+ north: number;
7
+ }
8
+ interface LatLng {
9
+ lat: number;
10
+ lng: number;
11
+ }
12
+ interface PageRequest {
13
+ cursor?: string | null;
14
+ limit: number;
15
+ }
16
+ interface Page<T> {
17
+ items: T[];
18
+ nextCursor: string | null;
19
+ total?: number;
20
+ }
21
+ interface MapPoint<TEntity = unknown> {
22
+ id: EntityId;
23
+ position: LatLng;
24
+ entity: TEntity;
25
+ }
26
+ type QueryParams = Record<string, string | undefined>;
27
+ interface EntityAdapter<TEntity, TFilters> {
28
+ list(filters: TFilters, page: PageRequest): Promise<Page<TEntity>>;
29
+ getPoints(filters: TFilters, bounds: Bounds): Promise<MapPoint<TEntity>[]>;
30
+ getById?(id: EntityId): Promise<TEntity>;
31
+ }
32
+
33
+ export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, EntityAdapter as a, PageRequest as b };
@@ -0,0 +1,33 @@
1
+ type EntityId = string | number;
2
+ interface Bounds {
3
+ west: number;
4
+ south: number;
5
+ east: number;
6
+ north: number;
7
+ }
8
+ interface LatLng {
9
+ lat: number;
10
+ lng: number;
11
+ }
12
+ interface PageRequest {
13
+ cursor?: string | null;
14
+ limit: number;
15
+ }
16
+ interface Page<T> {
17
+ items: T[];
18
+ nextCursor: string | null;
19
+ total?: number;
20
+ }
21
+ interface MapPoint<TEntity = unknown> {
22
+ id: EntityId;
23
+ position: LatLng;
24
+ entity: TEntity;
25
+ }
26
+ type QueryParams = Record<string, string | undefined>;
27
+ interface EntityAdapter<TEntity, TFilters> {
28
+ list(filters: TFilters, page: PageRequest): Promise<Page<TEntity>>;
29
+ getPoints(filters: TFilters, bounds: Bounds): Promise<MapPoint<TEntity>[]>;
30
+ getById?(id: EntityId): Promise<TEntity>;
31
+ }
32
+
33
+ export type { Bounds as B, EntityId as E, LatLng as L, MapPoint as M, Page as P, QueryParams as Q, EntityAdapter as a, PageRequest as b };
package/dist/index.cjs ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } var _class;"use client";
2
+ var _chunkN3OZ2HK2cjs = require('./chunk-N3OZ2HK2.cjs');var _chunk5O36WI7Hcjs = require('./chunk-5O36WI7H.cjs');var _chunkCHNUE46Kcjs = require('./chunk-CHNUE46K.cjs');var _chunk2VUHLHHXcjs = require('./chunk-2VUHLHHX.cjs');var d=(o=>(o.Paged="paged",o.Infinite="infinite",o))(d||{});var f=(r=>(r.FiltersChanged="FiltersChanged",r.ResultsLoaded="ResultsLoaded",r.PointClicked="PointClicked",r.BoundsChanged="BoundsChanged",r.LayerToggled="LayerToggled",r))(f||{});var u= (_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);var _jsxruntime = require('react/jsx-runtime');function Z({children:e}){let{Toolbar:t}=_chunk5O36WI7Hcjs.q.call(void 0, );return _jsxruntime.jsx.call(void 0, t,{children:e})}var _react = require('react');function tt(){let e=_chunk5O36WI7Hcjs.s.call(void 0, ),t=_chunk5O36WI7Hcjs.t.call(void 0, ),o=_react.useCallback.call(void 0, a=>e.loadPoints(a),[e]),n=_react.useCallback.call(void 0, (a,r)=>e.selectPoint(a,r),[e]);return{bounds:t.bounds,points:t.points,loadPoints:o,selectPoint:n}}function it(e){let t=_chunk5O36WI7Hcjs.s.call(void 0, ),o=_chunk5O36WI7Hcjs.t.call(void 0, ),n=_react.useCallback.call(void 0, ()=>t.toggleLayer(e),[t,e]);return{visible:_nullishCoalesce(o.layers[e], () => (!0)),points:_nullishCoalesce(o.points[e], () => ([])),toggle:n}}exports.BrowserHistoryPort = _chunkCHNUE46Kcjs.a; exports.DatasetRegistry = _chunk5O36WI7Hcjs.c; exports.FilterRegistry = _chunk5O36WI7Hcjs.b; exports.ListingApp = _chunkN3OZ2HK2cjs.p; exports.ListingComponentsProvider = _chunk5O36WI7Hcjs.p; exports.ListingConfig = _chunk5O36WI7Hcjs.f; exports.ListingEngine = _chunk5O36WI7Hcjs.g; exports.ListingEngineContext = _chunk5O36WI7Hcjs.r; exports.ListingEventType = f; exports.ListingFilters = _chunk5O36WI7Hcjs.v; exports.ListingList = _chunk5O36WI7Hcjs.x; exports.ListingMap = _chunk5O36WI7Hcjs.y; exports.ListingPagination = _chunk5O36WI7Hcjs.z; exports.ListingProvider = _chunk5O36WI7Hcjs.B; exports.ListingResultHeader = _chunk5O36WI7Hcjs.A; exports.ListingStore = _chunk5O36WI7Hcjs.a; exports.ListingToolbar = Z; exports.MemoryHistoryPort = u; exports.PaginationMode = d; exports.TypedEmitter = _chunk5O36WI7Hcjs.d; exports.UrlSyncController = _chunk2VUHLHHXcjs.a; exports.composeListingProviders = _chunk5O36WI7Hcjs.h; exports.listingDefaultConfig = _chunk5O36WI7Hcjs.e; exports.useListing = _chunk5O36WI7Hcjs.s; exports.useListingComponents = _chunk5O36WI7Hcjs.q; exports.useListingEvent = _chunkN3OZ2HK2cjs.a; exports.useListingFilters = _chunk5O36WI7Hcjs.u; exports.useListingLayer = it; exports.useListingMap = tt; exports.useListingResults = _chunk5O36WI7Hcjs.w; exports.useListingState = _chunk5O36WI7Hcjs.t; exports.withConfig = _chunk5O36WI7Hcjs.i; exports.withDataset = _chunk5O36WI7Hcjs.k; exports.withFilters = _chunk5O36WI7Hcjs.l; exports.withInitialFilters = _chunk5O36WI7Hcjs.n; exports.withMap = _chunk5O36WI7Hcjs.j; exports.withPrimaryDataset = _chunk5O36WI7Hcjs.o; exports.withUrlSync = _chunk5O36WI7Hcjs.m;