@classic-homes/maps-core 0.2.7 → 0.2.9

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.
@@ -0,0 +1,50 @@
1
+ export { ar as ClusterCircleStyleOptions, al as ClusterExpandOptions, am as ClusterExpansionResult, ak as ClusterFeatureProperties, au as ClusterLayerStyles, aq as ClusterMapBoundsExpander, ap as ClusterMapExpander, ao as ClusterMapReader, as as ClusterTextStyleOptions, an as ClusterableGeoJSONSource, C as ColorExpression, Z as CoordinateValidationResult, aJ as DEFAULT_SIMPLIFICATION_THRESHOLDS, aR as DynamicLODOptions, aS as DynamicLODState, E as ExtrusionHeightOptions, aL as FeatureGroup, b2 as FilterExpression, b3 as FilterOperator, b4 as FilterValue, aM as GenerateLODOptions, aW as GeoJSONFingerprint, aK as GroupFeaturesOptions, K as KEYBOARD_CONTROLS, aN as LODData, aQ as LODDataWithSimplification, a7 as LoadGeoJSONOptions, a8 as LoadGeoJSONResult, L as LotFillStyleOptions, z as LotOutlineStyleOptions, b8 as MARKER_PROTECTION_CLASS, N as NumberExpression, b0 as PaintProps, b1 as PaintPropsDiff, aP as SimplificationStats, aO as SimplificationThreshold, at as UnclusteredPointStyleOptions, a9 as ValidationResult, b6 as applyMarkerChildProtection, b5 as applyMarkerProtection, ay as boundsToPolygon, _ as calculateBounds, a4 as calculateCentroid, aA as calculateZoomThresholds, X as clampLatitude, a0 as combineBounds, a5 as countFeaturesByType, p as createCategoricalColorExpression, j as createCircleStyle, ai as createClusterCirclePaint, ah as createClusterStyles, aj as createClusterTextLayout, q as createContinuousColorExpression, aH as createDynamicLODManager, w as createExtrusionHeightExpression, k as createExtrusionStyle, h as createFillStyle, aT as createGeoJSONFingerprint, l as createHeatmapStyle, m as createHoverExpression, o as createInteractiveExpression, y as createInteractiveStatusColorExpression, i as createLineStyle, u as createLotFillStyle, v as createLotOutlineStyle, n as createSelectionExpression, x as createStatusColorExpression, r as createZoomExpression, B as decimalToDMS, aX as deepEqual, V as ensureValidCoordinates, ae as expandCluster, ag as expandClusterToBounds, $ as extendBounds, a6 as filterByGeometryType, a_ as filterEqual, aU as fingerprintEqual, F as formatArea, I as formatBearing, G as formatBounds, A as formatCoordinates, D as formatDistance, Q as formatFeatureProperties, R as formatLabel, J as formatPitch, P as formatPropertyValue, M as formatScale, H as formatZoom, ax as generateBoundingPolygon, aw as generateConvexHull, b as generateFeatureCollectionDescription, d as generateFeatureTable, g as generateKeyboardControlsDescription, az as generateLODData, aF as generateLODDataWithSimplification, a as generateMapDescription, e as generateMarkerList, c as generateMarkersDescription, f as generateMoveAnnouncement, aV as geoJSONEqual, aZ as getChangedPaintProps, af as getClusterBounds, ac as getClusterChildren, ab as getClusterExpansionZoom, ad as getClusterLeaves, s as getHighlightStyle, t as getSelectionStyle, aI as getSimplificationToleranceForZoom, aG as getSimplifiedFeaturesForZoom, av as groupFeaturesByProperty, aa as isClusterFeature, a1 as isValidBounds, T as isValidLatitude, S as isValidLongitude, a2 as loadGeoJSON, W as normalizeLongitude, aY as paintPropsEqual, b7 as removeMarkerProtection, a$ as serializeFilter, aC as simplifyFeature, aD as simplifyFeatureCollection, aE as simplifyFeatureCollectionWithStats, aB as simplifyPolygon, Y as validateBoundsArray, U as validateCoordinates, a3 as validateGeoJSON, O as zoomToScale } from '../marker-zuhH2WoS.cjs';
2
+ export { n as BuildRTreeIndexOptions, B as BuildSpatialIndexOptions, I as IdleViewportManagerOptions, r as IdleViewportResult, P as PanVelocity, p as PredictiveViewportResult, Q as QuerySpatialIndexOptions, k as QueryStats, m as RTreeIndex, R as RTreeItem, o as RTreeQueryStats, S as SpatialIndex, V as ViewportManagedDataOptions, l as ViewportManagedResult, e as buildRTreeIndex, b as buildSpatialIndex, j as createIdleViewportManager, i as createPredictiveViewportManager, h as createRTreeViewportManager, d as createViewportManager, c as createViewportQuery, q as queryByBounds, a as queryByBoundsWithStats, f as queryRTreeByBounds, g as queryRTreeByBoundsWithStats } from '../spatial-CU60awl8.cjs';
3
+ import '../data-k7o-Rne0.cjs';
4
+ import '../generator-CGfqiHvG.cjs';
5
+ import 'rbush';
6
+
7
+ /**
8
+ * Shared popup utilities for React and Svelte map components
9
+ */
10
+ interface PaddingSides {
11
+ top: number;
12
+ right: number;
13
+ bottom: number;
14
+ left: number;
15
+ }
16
+ /**
17
+ * Helper to normalize padding value into individual sides
18
+ */
19
+ declare function normalizePadding(padding: number | PaddingSides): PaddingSides;
20
+ /**
21
+ * Check if user prefers reduced motion
22
+ */
23
+ declare function prefersReducedMotion(): boolean;
24
+ /**
25
+ * Generic popup interface for the panToFitPopup function.
26
+ * This interface is compatible with maplibregl.Popup.
27
+ */
28
+ interface PopupLike {
29
+ getElement(): HTMLElement | null;
30
+ }
31
+ /**
32
+ * Generic map interface for the panToFitPopup function.
33
+ * This interface is compatible with maplibregl.Map.
34
+ */
35
+ interface MapLike {
36
+ getContainer(): HTMLElement;
37
+ panBy(offset: [number, number], options?: {
38
+ animate?: boolean;
39
+ }): void;
40
+ }
41
+ /**
42
+ * Pan the map to ensure the popup is fully visible within the viewport.
43
+ *
44
+ * @param map - The map instance (maplibregl.Map compatible)
45
+ * @param popup - The popup instance (maplibregl.Popup compatible)
46
+ * @param padding - Padding around the popup to ensure visibility
47
+ */
48
+ declare function panToFitPopup(map: MapLike, popup: PopupLike, padding: PaddingSides): void;
49
+
50
+ export { type MapLike, type PaddingSides, type PopupLike, normalizePadding, panToFitPopup, prefersReducedMotion };
@@ -0,0 +1,50 @@
1
+ export { ar as ClusterCircleStyleOptions, al as ClusterExpandOptions, am as ClusterExpansionResult, ak as ClusterFeatureProperties, au as ClusterLayerStyles, aq as ClusterMapBoundsExpander, ap as ClusterMapExpander, ao as ClusterMapReader, as as ClusterTextStyleOptions, an as ClusterableGeoJSONSource, C as ColorExpression, Z as CoordinateValidationResult, aJ as DEFAULT_SIMPLIFICATION_THRESHOLDS, aR as DynamicLODOptions, aS as DynamicLODState, E as ExtrusionHeightOptions, aL as FeatureGroup, b2 as FilterExpression, b3 as FilterOperator, b4 as FilterValue, aM as GenerateLODOptions, aW as GeoJSONFingerprint, aK as GroupFeaturesOptions, K as KEYBOARD_CONTROLS, aN as LODData, aQ as LODDataWithSimplification, a7 as LoadGeoJSONOptions, a8 as LoadGeoJSONResult, L as LotFillStyleOptions, z as LotOutlineStyleOptions, b8 as MARKER_PROTECTION_CLASS, N as NumberExpression, b0 as PaintProps, b1 as PaintPropsDiff, aP as SimplificationStats, aO as SimplificationThreshold, at as UnclusteredPointStyleOptions, a9 as ValidationResult, b6 as applyMarkerChildProtection, b5 as applyMarkerProtection, ay as boundsToPolygon, _ as calculateBounds, a4 as calculateCentroid, aA as calculateZoomThresholds, X as clampLatitude, a0 as combineBounds, a5 as countFeaturesByType, p as createCategoricalColorExpression, j as createCircleStyle, ai as createClusterCirclePaint, ah as createClusterStyles, aj as createClusterTextLayout, q as createContinuousColorExpression, aH as createDynamicLODManager, w as createExtrusionHeightExpression, k as createExtrusionStyle, h as createFillStyle, aT as createGeoJSONFingerprint, l as createHeatmapStyle, m as createHoverExpression, o as createInteractiveExpression, y as createInteractiveStatusColorExpression, i as createLineStyle, u as createLotFillStyle, v as createLotOutlineStyle, n as createSelectionExpression, x as createStatusColorExpression, r as createZoomExpression, B as decimalToDMS, aX as deepEqual, V as ensureValidCoordinates, ae as expandCluster, ag as expandClusterToBounds, $ as extendBounds, a6 as filterByGeometryType, a_ as filterEqual, aU as fingerprintEqual, F as formatArea, I as formatBearing, G as formatBounds, A as formatCoordinates, D as formatDistance, Q as formatFeatureProperties, R as formatLabel, J as formatPitch, P as formatPropertyValue, M as formatScale, H as formatZoom, ax as generateBoundingPolygon, aw as generateConvexHull, b as generateFeatureCollectionDescription, d as generateFeatureTable, g as generateKeyboardControlsDescription, az as generateLODData, aF as generateLODDataWithSimplification, a as generateMapDescription, e as generateMarkerList, c as generateMarkersDescription, f as generateMoveAnnouncement, aV as geoJSONEqual, aZ as getChangedPaintProps, af as getClusterBounds, ac as getClusterChildren, ab as getClusterExpansionZoom, ad as getClusterLeaves, s as getHighlightStyle, t as getSelectionStyle, aI as getSimplificationToleranceForZoom, aG as getSimplifiedFeaturesForZoom, av as groupFeaturesByProperty, aa as isClusterFeature, a1 as isValidBounds, T as isValidLatitude, S as isValidLongitude, a2 as loadGeoJSON, W as normalizeLongitude, aY as paintPropsEqual, b7 as removeMarkerProtection, a$ as serializeFilter, aC as simplifyFeature, aD as simplifyFeatureCollection, aE as simplifyFeatureCollectionWithStats, aB as simplifyPolygon, Y as validateBoundsArray, U as validateCoordinates, a3 as validateGeoJSON, O as zoomToScale } from '../marker-BjzgxVwm.js';
2
+ export { n as BuildRTreeIndexOptions, B as BuildSpatialIndexOptions, I as IdleViewportManagerOptions, r as IdleViewportResult, P as PanVelocity, p as PredictiveViewportResult, Q as QuerySpatialIndexOptions, k as QueryStats, m as RTreeIndex, R as RTreeItem, o as RTreeQueryStats, S as SpatialIndex, V as ViewportManagedDataOptions, l as ViewportManagedResult, e as buildRTreeIndex, b as buildSpatialIndex, j as createIdleViewportManager, i as createPredictiveViewportManager, h as createRTreeViewportManager, d as createViewportManager, c as createViewportQuery, q as queryByBounds, a as queryByBoundsWithStats, f as queryRTreeByBounds, g as queryRTreeByBoundsWithStats } from '../spatial-Bo8nM3fC.js';
3
+ import '../data-k7o-Rne0.js';
4
+ import '../generator-CGfqiHvG.js';
5
+ import 'rbush';
6
+
7
+ /**
8
+ * Shared popup utilities for React and Svelte map components
9
+ */
10
+ interface PaddingSides {
11
+ top: number;
12
+ right: number;
13
+ bottom: number;
14
+ left: number;
15
+ }
16
+ /**
17
+ * Helper to normalize padding value into individual sides
18
+ */
19
+ declare function normalizePadding(padding: number | PaddingSides): PaddingSides;
20
+ /**
21
+ * Check if user prefers reduced motion
22
+ */
23
+ declare function prefersReducedMotion(): boolean;
24
+ /**
25
+ * Generic popup interface for the panToFitPopup function.
26
+ * This interface is compatible with maplibregl.Popup.
27
+ */
28
+ interface PopupLike {
29
+ getElement(): HTMLElement | null;
30
+ }
31
+ /**
32
+ * Generic map interface for the panToFitPopup function.
33
+ * This interface is compatible with maplibregl.Map.
34
+ */
35
+ interface MapLike {
36
+ getContainer(): HTMLElement;
37
+ panBy(offset: [number, number], options?: {
38
+ animate?: boolean;
39
+ }): void;
40
+ }
41
+ /**
42
+ * Pan the map to ensure the popup is fully visible within the viewport.
43
+ *
44
+ * @param map - The map instance (maplibregl.Map compatible)
45
+ * @param popup - The popup instance (maplibregl.Popup compatible)
46
+ * @param padding - Padding around the popup to ensure visibility
47
+ */
48
+ declare function panToFitPopup(map: MapLike, popup: PopupLike, padding: PaddingSides): void;
49
+
50
+ export { type MapLike, type PaddingSides, type PopupLike, normalizePadding, panToFitPopup, prefersReducedMotion };
@@ -0,0 +1,2 @@
1
+ export { DEFAULT_SIMPLIFICATION_THRESHOLDS, KEYBOARD_CONTROLS, MARKER_PROTECTION_CLASS, applyMarkerChildProtection, applyMarkerProtection, boundsToPolygon, buildRTreeIndex, buildSpatialIndex, calculateBounds, calculateCentroid, calculateZoomThresholds, clampLatitude, combineBounds, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createClusterCirclePaint, createClusterStyles, createClusterTextLayout, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createIdleViewportManager, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createPredictiveViewportManager, createRTreeViewportManager, createSelectionExpression, createStatusColorExpression, createViewportManager, createViewportQuery, createZoomExpression, decimalToDMS, deepEqual, ensureValidCoordinates, expandCluster, expandClusterToBounds, extendBounds, filterByGeometryType, filterEqual, fingerprintEqual, formatArea, formatBearing, formatBounds, formatCoordinates, formatDistance, formatFeatureProperties, formatLabel, formatPitch, formatPropertyValue, formatScale, formatZoom, generateBoundingPolygon, generateConvexHull, generateFeatureCollectionDescription, generateFeatureTable, generateKeyboardControlsDescription, generateLODData, generateLODDataWithSimplification, generateMapDescription, generateMarkerList, generateMarkersDescription, generateMoveAnnouncement, geoJSONEqual, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, groupFeaturesByProperty, isClusterFeature, isValidBounds, isValidLatitude, isValidLongitude, loadGeoJSON, normalizeLongitude, normalizePadding, paintPropsEqual, panToFitPopup, prefersReducedMotion, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, serializeFilter, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, validateBoundsArray, validateCoordinates, validateGeoJSON, zoomToScale } from '../chunk-EXGGK4H7.js';
2
+ import '../chunk-ZGUACUEF.js';
@@ -1,5 +1,5 @@
1
- import { G as GeoJSONFeatureCollection, B as BoundsArray } from '../data-DDS6ok7I.cjs';
2
- import { Q as QueryStats, P as PanVelocity, R as RTreeQueryStats } from '../spatial-J48Btm8f.cjs';
1
+ import { G as GeoJSONFeatureCollection, B as BoundsArray } from '../data-k7o-Rne0.cjs';
2
+ import { k as QueryStats, P as PanVelocity, o as RTreeQueryStats } from '../spatial-CU60awl8.cjs';
3
3
  import 'rbush';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { G as GeoJSONFeatureCollection, B as BoundsArray } from '../data-DDS6ok7I.js';
2
- import { Q as QueryStats, P as PanVelocity, R as RTreeQueryStats } from '../spatial-VV-zd88V.js';
1
+ import { G as GeoJSONFeatureCollection, B as BoundsArray } from '../data-k7o-Rne0.js';
2
+ import { k as QueryStats, P as PanVelocity, o as RTreeQueryStats } from '../spatial-Bo8nM3fC.js';
3
3
  import 'rbush';
4
4
 
5
5
  /**
@@ -775,6 +775,10 @@ function normalizeBoundsInternal(bounds) {
775
775
  }
776
776
 
777
777
  // src/workers/spatial.worker.ts
778
+ var MAX_VIEWPORT_SAMPLES = 5;
779
+ var WEIGHT_DECAY_FACTOR = 0.7;
780
+ var VELOCITY_MAGNITUDE_THRESHOLD = 1e-5;
781
+ var MAX_SAMPLE_TIME_DELTA_SEC = 1;
778
782
  var state = {
779
783
  initialized: false,
780
784
  indexType: "rtree",
@@ -805,12 +809,12 @@ function calculatePanVelocity(samples) {
805
809
  const current = samples[i];
806
810
  const previous = samples[i - 1];
807
811
  const dt = (current.timestamp - previous.timestamp) / 1e3;
808
- if (dt > 0 && dt < 1) {
812
+ if (dt > 0 && dt < MAX_SAMPLE_TIME_DELTA_SEC) {
809
813
  totalLngDelta += (current.center[0] - previous.center[0]) * weight;
810
814
  totalLatDelta += (current.center[1] - previous.center[1]) * weight;
811
815
  totalTime += dt * weight;
812
816
  }
813
- weight *= 0.7;
817
+ weight *= WEIGHT_DECAY_FACTOR;
814
818
  }
815
819
  if (totalTime === 0) {
816
820
  return { lngPerSec: 0, latPerSec: 0, magnitude: 0 };
@@ -826,7 +830,7 @@ function applyPredictiveBuffer(bounds, velocity, baseBuffer, multiplier) {
826
830
  let bufferMaxLng = baseBuffer;
827
831
  let bufferMinLat = baseBuffer;
828
832
  let bufferMaxLat = baseBuffer;
829
- if (velocity.magnitude > 1e-5) {
833
+ if (velocity.magnitude > VELOCITY_MAGNITUDE_THRESHOLD) {
830
834
  const extraBuffer = baseBuffer * (multiplier - 1);
831
835
  if (velocity.lngPerSec > 0) {
832
836
  bufferMaxLng += extraBuffer * Math.min(1, velocity.lngPerSec / velocity.magnitude);
@@ -976,8 +980,8 @@ function handlePredictiveQuery(requestId, bounds, timestamp, options = {}) {
976
980
  (bounds[0][1] + bounds[1][1]) / 2
977
981
  ];
978
982
  state.predictive.viewportSamples.push({ center, timestamp });
979
- while (state.predictive.viewportSamples.length > 5) {
980
- state.predictive.viewportSamples.shift();
983
+ if (state.predictive.viewportSamples.length > MAX_VIEWPORT_SAMPLES) {
984
+ state.predictive.viewportSamples = state.predictive.viewportSamples.slice(-MAX_VIEWPORT_SAMPLES);
981
985
  }
982
986
  state.predictive.velocity = calculatePanVelocity(state.predictive.viewportSamples);
983
987
  if (state.predictive.lastData && !shouldUpdatePredictive(bounds, state.predictive.lastBounds, minMovement)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@classic-homes/maps-core",
3
- "version": "0.2.7",
3
+ "version": "0.2.9",
4
4
  "description": "Core utilities and theme for Classic Theme maps",
5
5
  "keywords": [
6
6
  "maps",
@@ -34,6 +34,11 @@
34
34
  "import": "./dist/types/index.js",
35
35
  "require": "./dist/types/index.cjs"
36
36
  },
37
+ "./utils": {
38
+ "types": "./dist/utils/index.d.ts",
39
+ "import": "./dist/utils/index.js",
40
+ "require": "./dist/utils/index.cjs"
41
+ },
37
42
  "./workers": {
38
43
  "types": "./dist/workers/index.d.ts",
39
44
  "import": "./dist/workers/index.js",
@@ -54,6 +59,9 @@
54
59
  "./styles/basemap-switcher.css": "./src/styles/basemap-switcher.css",
55
60
  "./styles/layer-manager.css": "./src/styles/layer-manager.css"
56
61
  },
62
+ "sideEffects": [
63
+ "*.css"
64
+ ],
57
65
  "files": [
58
66
  "dist",
59
67
  "src/styles"