@classic-homes/maps-core 0.5.0 → 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/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-EXGGK4H7.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-EXGGK4H7.js';
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
- const hex = backgroundColor.replace("#", "");
1160
- const rgb = hex.match(/.{2}/g).map((c) => {
1161
- const val = parseInt(c, 16) / 255;
1162
- return val <= 0.03928 ? val / 12.92 : Math.pow((val + 0.055) / 1.055, 2.4);
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;