@classic-homes/maps-core 0.4.1 → 0.5.2
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/{chunk-EXGGK4H7.js → chunk-ASIFMIU7.js} +300 -289
- package/dist/index.cjs +600 -592
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +8 -11
- package/dist/route/index.cjs +15 -5
- package/dist/route/index.d.cts +10 -6
- package/dist/route/index.d.ts +10 -6
- package/dist/route/index.js +15 -5
- package/dist/utils/index.cjs +300 -289
- package/dist/utils/index.js +1 -1
- package/dist/workers/index.cjs +29 -6
- package/dist/workers/index.d.cts +6 -0
- package/dist/workers/index.d.ts +6 -0
- package/dist/workers/index.js +29 -6
- package/dist/workers/spatial.worker.js +13 -10
- package/package.json +3 -2
package/dist/index.d.cts
CHANGED
|
@@ -679,6 +679,10 @@ declare const lotSizeColors: {
|
|
|
679
679
|
type LotSize = keyof typeof lotSizeColors;
|
|
680
680
|
/**
|
|
681
681
|
* Get contrast text color for WCAG accessibility
|
|
682
|
+
*
|
|
683
|
+
* Uses the shared luminance threshold from `@classic-homes/theme-tokens`,
|
|
684
|
+
* returning a softened (87%) black on light backgrounds. Non-hex input
|
|
685
|
+
* falls back to white rather than throwing.
|
|
682
686
|
*/
|
|
683
687
|
declare function getContrastTextColor(backgroundColor: string): string;
|
|
684
688
|
declare function getAvailabilityColor(availability: string): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -679,6 +679,10 @@ declare const lotSizeColors: {
|
|
|
679
679
|
type LotSize = keyof typeof lotSizeColors;
|
|
680
680
|
/**
|
|
681
681
|
* Get contrast text color for WCAG accessibility
|
|
682
|
+
*
|
|
683
|
+
* Uses the shared luminance threshold from `@classic-homes/theme-tokens`,
|
|
684
|
+
* returning a softened (87%) black on light backgrounds. Non-hex input
|
|
685
|
+
* falls back to white rather than throwing.
|
|
682
686
|
*/
|
|
683
687
|
declare function getContrastTextColor(backgroundColor: string): string;
|
|
684
688
|
declare function getAvailabilityColor(availability: string): string;
|
package/dist/index.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { lightBasicStyle, darkBasicStyle } from './chunk-6WMCIBJJ.js';
|
|
2
2
|
export { darkBasicStyle, generateBasicStyle, generateVectorStyle, getBasicStyle, lightBasicStyle } from './chunk-6WMCIBJJ.js';
|
|
3
|
-
import { createCategoricalColorExpression } from './chunk-
|
|
4
|
-
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, paintPropsEqual, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, serializeFilter, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, validateBoundsArray, validateCoordinates, validateGeoJSON, zoomToScale } from './chunk-
|
|
3
|
+
import { createCategoricalColorExpression } from './chunk-ASIFMIU7.js';
|
|
4
|
+
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, paintPropsEqual, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, serializeFilter, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, validateBoundsArray, validateCoordinates, validateGeoJSON, zoomToScale } from './chunk-ASIFMIU7.js';
|
|
5
5
|
export { THEME_DARK, THEME_LIGHT, darkTheme, generateDarkColors, generateDarkDataColors, generateDarkTheme, generateLightColors, generateLightDataColors, generateLightTheme, getTheme, getTypography, lightTheme } from './chunk-ZGUACUEF.js';
|
|
6
|
+
import { getContrastTextColor as getContrastTextColor$1 } from '@classic-homes/theme-tokens/contrast';
|
|
6
7
|
import { colors } from '@classic-homes/theme-tokens';
|
|
7
8
|
|
|
8
9
|
// src/basemaps/registry.ts
|
|
@@ -1115,8 +1116,6 @@ var PositioningCoordinator = class {
|
|
|
1115
1116
|
function createPositioningCoordinator() {
|
|
1116
1117
|
return new PositioningCoordinator();
|
|
1117
1118
|
}
|
|
1118
|
-
|
|
1119
|
-
// src/colors/realEstate.ts
|
|
1120
1119
|
var lotAvailabilityColors = {
|
|
1121
1120
|
Available: "#4caf50",
|
|
1122
1121
|
// Green - ready for sale
|
|
@@ -1156,13 +1155,11 @@ var lotSizeColors = {
|
|
|
1156
1155
|
// Gray
|
|
1157
1156
|
};
|
|
1158
1157
|
function getContrastTextColor(backgroundColor) {
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
return
|
|
1163
|
-
}
|
|
1164
|
-
const luminance = 0.2126 * rgb[0] + 0.7152 * rgb[1] + 0.0722 * rgb[2];
|
|
1165
|
-
return luminance > 0.179 ? "rgba(0, 0, 0, 0.87)" : "#ffffff";
|
|
1158
|
+
try {
|
|
1159
|
+
return getContrastTextColor$1(backgroundColor) === "#000000" ? "rgba(0, 0, 0, 0.87)" : "#ffffff";
|
|
1160
|
+
} catch {
|
|
1161
|
+
return "#ffffff";
|
|
1162
|
+
}
|
|
1166
1163
|
}
|
|
1167
1164
|
function getAvailabilityColor(availability) {
|
|
1168
1165
|
return lotAvailabilityColors[availability] ?? lotAvailabilityColors.Unknown;
|
package/dist/route/index.cjs
CHANGED
|
@@ -179,15 +179,25 @@ function googleDirectionsUrl(stops, origin, travelmode) {
|
|
|
179
179
|
if (travelmode) url += `&travelmode=${encodeURIComponent(travelmode)}`;
|
|
180
180
|
return url;
|
|
181
181
|
}
|
|
182
|
+
var APPLE_MODES = { d: "driving", w: "walking", r: "transit" };
|
|
182
183
|
function appleDirectionsUrl(stops, origin, dirflg = "d") {
|
|
183
184
|
const encoded = usableTargets(stops);
|
|
184
185
|
if (encoded.length === 0) return "";
|
|
185
186
|
const encodedOrigin = origin ? encodeTarget(origin) : null;
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
187
|
+
if (encoded.length === 1) {
|
|
188
|
+
let url = `${APPLE_BASE}?`;
|
|
189
|
+
if (encodedOrigin) url += `saddr=${encodedOrigin}&`;
|
|
190
|
+
url += `daddr=${encoded[0]}&dirflg=${encodeURIComponent(dirflg)}`;
|
|
191
|
+
return url;
|
|
192
|
+
}
|
|
193
|
+
const destination = encoded[encoded.length - 1];
|
|
194
|
+
const waypoints = encoded.slice(0, -1);
|
|
195
|
+
const mode = APPLE_MODES[dirflg] ?? APPLE_MODES.d;
|
|
196
|
+
const params = [];
|
|
197
|
+
if (encodedOrigin) params.push(`source=${encodedOrigin}`);
|
|
198
|
+
for (const waypoint of waypoints) params.push(`waypoint=${waypoint}`);
|
|
199
|
+
params.push(`destination=${destination}`, `mode=${mode}`);
|
|
200
|
+
return `${APPLE_BASE}directions?${params.join("&")}`;
|
|
191
201
|
}
|
|
192
202
|
function googleSearchUrl(query) {
|
|
193
203
|
return `${GOOGLE_SEARCH_BASE}&query=${encodeURIComponent(query)}`;
|
package/dist/route/index.d.cts
CHANGED
|
@@ -112,13 +112,17 @@ declare const GOOGLE_MAX_LEG_STOPS: number;
|
|
|
112
112
|
*/
|
|
113
113
|
declare function googleDirectionsUrl(stops: DirectionsTarget[], origin?: DirectionsTarget | null, travelmode?: TravelMode): string;
|
|
114
114
|
/**
|
|
115
|
-
* An Apple Maps URL.
|
|
115
|
+
* An Apple Maps directions URL.
|
|
116
116
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
117
|
+
* With one stop this returns the legacy `saddr`/`daddr` form, exactly
|
|
118
|
+
* `https://maps.apple.com/?daddr=<lat>,<lng>&dirflg=d` with no origin - the
|
|
119
|
+
* form consumer apps already link to, and one every iOS version opens.
|
|
120
|
+
*
|
|
121
|
+
* With several stops it returns Apple's unified Maps URL (iOS 18.4, macOS 15.4
|
|
122
|
+
* and later): `/directions` with the last stop as `destination` and the rest as
|
|
123
|
+
* repeated `waypoint` parameters, in order. Apple documents no waypoint limit.
|
|
124
|
+
* Older OS versions predate the unified scheme, so what they do with a
|
|
125
|
+
* multi-stop link is not guaranteed. Returns '' when no target is usable.
|
|
122
126
|
*/
|
|
123
127
|
declare function appleDirectionsUrl(stops: DirectionsTarget[], origin?: DirectionsTarget | null, dirflg?: 'd' | 'w' | 'r'): string;
|
|
124
128
|
/** A Google Maps search URL - the fallback for a stop with no coordinate */
|
package/dist/route/index.d.ts
CHANGED
|
@@ -112,13 +112,17 @@ declare const GOOGLE_MAX_LEG_STOPS: number;
|
|
|
112
112
|
*/
|
|
113
113
|
declare function googleDirectionsUrl(stops: DirectionsTarget[], origin?: DirectionsTarget | null, travelmode?: TravelMode): string;
|
|
114
114
|
/**
|
|
115
|
-
* An Apple Maps URL.
|
|
115
|
+
* An Apple Maps directions URL.
|
|
116
116
|
*
|
|
117
|
-
*
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
*
|
|
121
|
-
*
|
|
117
|
+
* With one stop this returns the legacy `saddr`/`daddr` form, exactly
|
|
118
|
+
* `https://maps.apple.com/?daddr=<lat>,<lng>&dirflg=d` with no origin - the
|
|
119
|
+
* form consumer apps already link to, and one every iOS version opens.
|
|
120
|
+
*
|
|
121
|
+
* With several stops it returns Apple's unified Maps URL (iOS 18.4, macOS 15.4
|
|
122
|
+
* and later): `/directions` with the last stop as `destination` and the rest as
|
|
123
|
+
* repeated `waypoint` parameters, in order. Apple documents no waypoint limit.
|
|
124
|
+
* Older OS versions predate the unified scheme, so what they do with a
|
|
125
|
+
* multi-stop link is not guaranteed. Returns '' when no target is usable.
|
|
122
126
|
*/
|
|
123
127
|
declare function appleDirectionsUrl(stops: DirectionsTarget[], origin?: DirectionsTarget | null, dirflg?: 'd' | 'w' | 'r'): string;
|
|
124
128
|
/** A Google Maps search URL - the fallback for a stop with no coordinate */
|
package/dist/route/index.js
CHANGED
|
@@ -164,15 +164,25 @@ function googleDirectionsUrl(stops, origin, travelmode) {
|
|
|
164
164
|
if (travelmode) url += `&travelmode=${encodeURIComponent(travelmode)}`;
|
|
165
165
|
return url;
|
|
166
166
|
}
|
|
167
|
+
var APPLE_MODES = { d: "driving", w: "walking", r: "transit" };
|
|
167
168
|
function appleDirectionsUrl(stops, origin, dirflg = "d") {
|
|
168
169
|
const encoded = usableTargets(stops);
|
|
169
170
|
if (encoded.length === 0) return "";
|
|
170
171
|
const encodedOrigin = origin ? encodeTarget(origin) : null;
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
172
|
+
if (encoded.length === 1) {
|
|
173
|
+
let url = `${APPLE_BASE}?`;
|
|
174
|
+
if (encodedOrigin) url += `saddr=${encodedOrigin}&`;
|
|
175
|
+
url += `daddr=${encoded[0]}&dirflg=${encodeURIComponent(dirflg)}`;
|
|
176
|
+
return url;
|
|
177
|
+
}
|
|
178
|
+
const destination = encoded[encoded.length - 1];
|
|
179
|
+
const waypoints = encoded.slice(0, -1);
|
|
180
|
+
const mode = APPLE_MODES[dirflg] ?? APPLE_MODES.d;
|
|
181
|
+
const params = [];
|
|
182
|
+
if (encodedOrigin) params.push(`source=${encodedOrigin}`);
|
|
183
|
+
for (const waypoint of waypoints) params.push(`waypoint=${waypoint}`);
|
|
184
|
+
params.push(`destination=${destination}`, `mode=${mode}`);
|
|
185
|
+
return `${APPLE_BASE}directions?${params.join("&")}`;
|
|
176
186
|
}
|
|
177
187
|
function googleSearchUrl(query) {
|
|
178
188
|
return `${GOOGLE_SEARCH_BASE}&query=${encodeURIComponent(query)}`;
|