@classic-homes/maps-core 0.1.4 → 0.2.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/dist/index.cjs +538 -0
- package/dist/index.d.cts +293 -1
- package/dist/index.d.ts +293 -1
- package/dist/index.js +508 -1
- package/package.json +9 -2
- package/src/styles/bundled.css +820 -0
- package/src/styles/css.d.ts +66 -0
- package/src/styles/index.css +41 -0
- package/src/styles/layer-manager.css +228 -0
- package/src/styles/maplibre-fixes.css +145 -0
- package/src/styles/utilities.css +703 -0
package/dist/index.js
CHANGED
|
@@ -2812,4 +2812,511 @@ function resolveBasemapThumbnail(basemap, apiKeys) {
|
|
|
2812
2812
|
return thumbnail;
|
|
2813
2813
|
}
|
|
2814
2814
|
|
|
2815
|
-
|
|
2815
|
+
// src/layers/registry.ts
|
|
2816
|
+
var CATEGORY_META = {
|
|
2817
|
+
boundaries: {
|
|
2818
|
+
label: "Boundaries",
|
|
2819
|
+
icon: "square-dashed",
|
|
2820
|
+
order: 1
|
|
2821
|
+
},
|
|
2822
|
+
recreation: {
|
|
2823
|
+
label: "Recreation",
|
|
2824
|
+
icon: "trees",
|
|
2825
|
+
order: 2
|
|
2826
|
+
},
|
|
2827
|
+
transportation: {
|
|
2828
|
+
label: "Transportation",
|
|
2829
|
+
icon: "bus",
|
|
2830
|
+
order: 3
|
|
2831
|
+
},
|
|
2832
|
+
environmental: {
|
|
2833
|
+
label: "Environmental",
|
|
2834
|
+
icon: "droplets",
|
|
2835
|
+
order: 4
|
|
2836
|
+
},
|
|
2837
|
+
custom: {
|
|
2838
|
+
label: "Other",
|
|
2839
|
+
icon: "layers",
|
|
2840
|
+
order: 5
|
|
2841
|
+
}
|
|
2842
|
+
};
|
|
2843
|
+
var SCHOOL_DISTRICTS = {
|
|
2844
|
+
id: "school-districts",
|
|
2845
|
+
name: "School Districts",
|
|
2846
|
+
description: "Public school district boundaries",
|
|
2847
|
+
category: "boundaries",
|
|
2848
|
+
source: {
|
|
2849
|
+
type: "geojson-url",
|
|
2850
|
+
url: ""
|
|
2851
|
+
// Must be configured with actual data URL
|
|
2852
|
+
},
|
|
2853
|
+
style: {
|
|
2854
|
+
renderType: "fill",
|
|
2855
|
+
light: {
|
|
2856
|
+
"fill-color": "hsl(210, 80%, 60%)",
|
|
2857
|
+
"fill-opacity": 0.2,
|
|
2858
|
+
"fill-outline-color": "hsl(210, 80%, 40%)"
|
|
2859
|
+
},
|
|
2860
|
+
dark: {
|
|
2861
|
+
"fill-color": "hsl(210, 70%, 50%)",
|
|
2862
|
+
"fill-opacity": 0.25,
|
|
2863
|
+
"fill-outline-color": "hsl(210, 70%, 60%)"
|
|
2864
|
+
}
|
|
2865
|
+
},
|
|
2866
|
+
interactive: true,
|
|
2867
|
+
labelProperty: "name",
|
|
2868
|
+
tags: ["education", "schools", "districts"]
|
|
2869
|
+
};
|
|
2870
|
+
var CITY_LIMITS = {
|
|
2871
|
+
id: "city-limits",
|
|
2872
|
+
name: "City Limits",
|
|
2873
|
+
description: "Municipal boundaries",
|
|
2874
|
+
category: "boundaries",
|
|
2875
|
+
source: {
|
|
2876
|
+
type: "geojson-url",
|
|
2877
|
+
url: ""
|
|
2878
|
+
},
|
|
2879
|
+
style: {
|
|
2880
|
+
renderType: "line",
|
|
2881
|
+
light: {
|
|
2882
|
+
"line-color": "hsl(0, 0%, 40%)",
|
|
2883
|
+
"line-width": 2,
|
|
2884
|
+
"line-dasharray": [4, 2]
|
|
2885
|
+
},
|
|
2886
|
+
dark: {
|
|
2887
|
+
"line-color": "hsl(0, 0%, 70%)",
|
|
2888
|
+
"line-width": 2,
|
|
2889
|
+
"line-dasharray": [4, 2]
|
|
2890
|
+
}
|
|
2891
|
+
},
|
|
2892
|
+
interactive: true,
|
|
2893
|
+
labelProperty: "name",
|
|
2894
|
+
tags: ["municipal", "city", "limits"]
|
|
2895
|
+
};
|
|
2896
|
+
var ZONING_DISTRICTS = {
|
|
2897
|
+
id: "zoning-districts",
|
|
2898
|
+
name: "Zoning Districts",
|
|
2899
|
+
description: "Land use zoning designations",
|
|
2900
|
+
category: "boundaries",
|
|
2901
|
+
source: {
|
|
2902
|
+
type: "geojson-url",
|
|
2903
|
+
url: ""
|
|
2904
|
+
},
|
|
2905
|
+
style: {
|
|
2906
|
+
renderType: "fill",
|
|
2907
|
+
light: {
|
|
2908
|
+
"fill-color": [
|
|
2909
|
+
"match",
|
|
2910
|
+
["get", "zone_type"],
|
|
2911
|
+
"residential",
|
|
2912
|
+
"hsl(120, 50%, 70%)",
|
|
2913
|
+
"commercial",
|
|
2914
|
+
"hsl(30, 80%, 70%)",
|
|
2915
|
+
"industrial",
|
|
2916
|
+
"hsl(0, 50%, 70%)",
|
|
2917
|
+
"mixed",
|
|
2918
|
+
"hsl(270, 50%, 70%)",
|
|
2919
|
+
"hsl(0, 0%, 70%)"
|
|
2920
|
+
],
|
|
2921
|
+
"fill-opacity": 0.3
|
|
2922
|
+
},
|
|
2923
|
+
dark: {
|
|
2924
|
+
"fill-color": [
|
|
2925
|
+
"match",
|
|
2926
|
+
["get", "zone_type"],
|
|
2927
|
+
"residential",
|
|
2928
|
+
"hsl(120, 40%, 50%)",
|
|
2929
|
+
"commercial",
|
|
2930
|
+
"hsl(30, 70%, 50%)",
|
|
2931
|
+
"industrial",
|
|
2932
|
+
"hsl(0, 40%, 50%)",
|
|
2933
|
+
"mixed",
|
|
2934
|
+
"hsl(270, 40%, 50%)",
|
|
2935
|
+
"hsl(0, 0%, 50%)"
|
|
2936
|
+
],
|
|
2937
|
+
"fill-opacity": 0.35
|
|
2938
|
+
}
|
|
2939
|
+
},
|
|
2940
|
+
legend: {
|
|
2941
|
+
type: "categorical",
|
|
2942
|
+
items: [
|
|
2943
|
+
{ label: "Residential", color: "hsl(120, 50%, 70%)" },
|
|
2944
|
+
{ label: "Commercial", color: "hsl(30, 80%, 70%)" },
|
|
2945
|
+
{ label: "Industrial", color: "hsl(0, 50%, 70%)" },
|
|
2946
|
+
{ label: "Mixed Use", color: "hsl(270, 50%, 70%)" }
|
|
2947
|
+
]
|
|
2948
|
+
},
|
|
2949
|
+
interactive: true,
|
|
2950
|
+
labelProperty: "zone_name",
|
|
2951
|
+
tags: ["zoning", "land-use", "planning"]
|
|
2952
|
+
};
|
|
2953
|
+
var PARKS = {
|
|
2954
|
+
id: "parks",
|
|
2955
|
+
name: "Parks",
|
|
2956
|
+
description: "Public parks and green spaces",
|
|
2957
|
+
category: "recreation",
|
|
2958
|
+
source: {
|
|
2959
|
+
type: "geojson-url",
|
|
2960
|
+
url: ""
|
|
2961
|
+
},
|
|
2962
|
+
style: {
|
|
2963
|
+
renderType: "fill",
|
|
2964
|
+
light: {
|
|
2965
|
+
"fill-color": "hsl(120, 60%, 50%)",
|
|
2966
|
+
"fill-opacity": 0.4,
|
|
2967
|
+
"fill-outline-color": "hsl(120, 60%, 30%)"
|
|
2968
|
+
},
|
|
2969
|
+
dark: {
|
|
2970
|
+
"fill-color": "hsl(120, 50%, 40%)",
|
|
2971
|
+
"fill-opacity": 0.5,
|
|
2972
|
+
"fill-outline-color": "hsl(120, 50%, 50%)"
|
|
2973
|
+
}
|
|
2974
|
+
},
|
|
2975
|
+
interactive: true,
|
|
2976
|
+
labelProperty: "name",
|
|
2977
|
+
tags: ["parks", "green-space", "recreation"]
|
|
2978
|
+
};
|
|
2979
|
+
var TRAILS = {
|
|
2980
|
+
id: "trails",
|
|
2981
|
+
name: "Trails",
|
|
2982
|
+
description: "Hiking, biking, and walking trails",
|
|
2983
|
+
category: "recreation",
|
|
2984
|
+
source: {
|
|
2985
|
+
type: "geojson-url",
|
|
2986
|
+
url: ""
|
|
2987
|
+
},
|
|
2988
|
+
style: {
|
|
2989
|
+
renderType: "line",
|
|
2990
|
+
light: {
|
|
2991
|
+
"line-color": "hsl(30, 70%, 45%)",
|
|
2992
|
+
"line-width": 2,
|
|
2993
|
+
"line-dasharray": [2, 1]
|
|
2994
|
+
},
|
|
2995
|
+
dark: {
|
|
2996
|
+
"line-color": "hsl(30, 60%, 55%)",
|
|
2997
|
+
"line-width": 2,
|
|
2998
|
+
"line-dasharray": [2, 1]
|
|
2999
|
+
}
|
|
3000
|
+
},
|
|
3001
|
+
interactive: true,
|
|
3002
|
+
labelProperty: "name",
|
|
3003
|
+
tags: ["trails", "hiking", "biking", "walking"]
|
|
3004
|
+
};
|
|
3005
|
+
var SPORTS_FACILITIES = {
|
|
3006
|
+
id: "sports-facilities",
|
|
3007
|
+
name: "Sports Facilities",
|
|
3008
|
+
description: "Sports fields, courts, and recreational facilities",
|
|
3009
|
+
category: "recreation",
|
|
3010
|
+
source: {
|
|
3011
|
+
type: "geojson-url",
|
|
3012
|
+
url: ""
|
|
3013
|
+
},
|
|
3014
|
+
style: {
|
|
3015
|
+
renderType: "circle",
|
|
3016
|
+
light: {
|
|
3017
|
+
"circle-color": "hsl(200, 70%, 50%)",
|
|
3018
|
+
"circle-radius": 6,
|
|
3019
|
+
"circle-stroke-width": 2,
|
|
3020
|
+
"circle-stroke-color": "hsl(200, 70%, 30%)"
|
|
3021
|
+
},
|
|
3022
|
+
dark: {
|
|
3023
|
+
"circle-color": "hsl(200, 60%, 55%)",
|
|
3024
|
+
"circle-radius": 6,
|
|
3025
|
+
"circle-stroke-width": 2,
|
|
3026
|
+
"circle-stroke-color": "hsl(200, 60%, 70%)"
|
|
3027
|
+
}
|
|
3028
|
+
},
|
|
3029
|
+
interactive: true,
|
|
3030
|
+
labelProperty: "name",
|
|
3031
|
+
tags: ["sports", "recreation", "facilities"]
|
|
3032
|
+
};
|
|
3033
|
+
var TRANSIT_ROUTES = {
|
|
3034
|
+
id: "transit-routes",
|
|
3035
|
+
name: "Transit Routes",
|
|
3036
|
+
description: "Public transportation routes",
|
|
3037
|
+
category: "transportation",
|
|
3038
|
+
source: {
|
|
3039
|
+
type: "geojson-url",
|
|
3040
|
+
url: ""
|
|
3041
|
+
},
|
|
3042
|
+
style: {
|
|
3043
|
+
renderType: "line",
|
|
3044
|
+
light: {
|
|
3045
|
+
"line-color": "hsl(270, 70%, 50%)",
|
|
3046
|
+
"line-width": 3
|
|
3047
|
+
},
|
|
3048
|
+
dark: {
|
|
3049
|
+
"line-color": "hsl(270, 60%, 60%)",
|
|
3050
|
+
"line-width": 3
|
|
3051
|
+
}
|
|
3052
|
+
},
|
|
3053
|
+
interactive: true,
|
|
3054
|
+
labelProperty: "route_name",
|
|
3055
|
+
tags: ["transit", "bus", "public-transportation"]
|
|
3056
|
+
};
|
|
3057
|
+
var BIKE_LANES = {
|
|
3058
|
+
id: "bike-lanes",
|
|
3059
|
+
name: "Bike Lanes",
|
|
3060
|
+
description: "Designated bicycle lanes and paths",
|
|
3061
|
+
category: "transportation",
|
|
3062
|
+
source: {
|
|
3063
|
+
type: "geojson-url",
|
|
3064
|
+
url: ""
|
|
3065
|
+
},
|
|
3066
|
+
style: {
|
|
3067
|
+
renderType: "line",
|
|
3068
|
+
light: {
|
|
3069
|
+
"line-color": "hsl(150, 70%, 45%)",
|
|
3070
|
+
"line-width": 2
|
|
3071
|
+
},
|
|
3072
|
+
dark: {
|
|
3073
|
+
"line-color": "hsl(150, 60%, 55%)",
|
|
3074
|
+
"line-width": 2
|
|
3075
|
+
}
|
|
3076
|
+
},
|
|
3077
|
+
interactive: true,
|
|
3078
|
+
labelProperty: "name",
|
|
3079
|
+
tags: ["bike", "bicycle", "cycling", "lanes"]
|
|
3080
|
+
};
|
|
3081
|
+
var FLOOD_ZONES = {
|
|
3082
|
+
id: "flood-zones",
|
|
3083
|
+
name: "Flood Zones",
|
|
3084
|
+
description: "FEMA flood hazard areas",
|
|
3085
|
+
category: "environmental",
|
|
3086
|
+
source: {
|
|
3087
|
+
type: "geojson-url",
|
|
3088
|
+
url: ""
|
|
3089
|
+
},
|
|
3090
|
+
style: {
|
|
3091
|
+
renderType: "fill",
|
|
3092
|
+
light: {
|
|
3093
|
+
"fill-color": [
|
|
3094
|
+
"match",
|
|
3095
|
+
["get", "flood_zone"],
|
|
3096
|
+
"A",
|
|
3097
|
+
"hsl(200, 80%, 60%)",
|
|
3098
|
+
"AE",
|
|
3099
|
+
"hsl(200, 80%, 50%)",
|
|
3100
|
+
"AH",
|
|
3101
|
+
"hsl(200, 80%, 45%)",
|
|
3102
|
+
"X",
|
|
3103
|
+
"hsl(200, 40%, 70%)",
|
|
3104
|
+
"hsl(200, 60%, 60%)"
|
|
3105
|
+
],
|
|
3106
|
+
"fill-opacity": 0.4
|
|
3107
|
+
},
|
|
3108
|
+
dark: {
|
|
3109
|
+
"fill-color": [
|
|
3110
|
+
"match",
|
|
3111
|
+
["get", "flood_zone"],
|
|
3112
|
+
"A",
|
|
3113
|
+
"hsl(200, 70%, 50%)",
|
|
3114
|
+
"AE",
|
|
3115
|
+
"hsl(200, 70%, 40%)",
|
|
3116
|
+
"AH",
|
|
3117
|
+
"hsl(200, 70%, 35%)",
|
|
3118
|
+
"X",
|
|
3119
|
+
"hsl(200, 30%, 50%)",
|
|
3120
|
+
"hsl(200, 50%, 45%)"
|
|
3121
|
+
],
|
|
3122
|
+
"fill-opacity": 0.45
|
|
3123
|
+
}
|
|
3124
|
+
},
|
|
3125
|
+
legend: {
|
|
3126
|
+
type: "categorical",
|
|
3127
|
+
items: [
|
|
3128
|
+
{ label: "Zone A (High Risk)", color: "hsl(200, 80%, 60%)" },
|
|
3129
|
+
{ label: "Zone AE (High Risk)", color: "hsl(200, 80%, 50%)" },
|
|
3130
|
+
{ label: "Zone AH (High Risk)", color: "hsl(200, 80%, 45%)" },
|
|
3131
|
+
{ label: "Zone X (Minimal Risk)", color: "hsl(200, 40%, 70%)" }
|
|
3132
|
+
]
|
|
3133
|
+
},
|
|
3134
|
+
interactive: true,
|
|
3135
|
+
labelProperty: "flood_zone",
|
|
3136
|
+
tags: ["flood", "fema", "hazard", "environmental"]
|
|
3137
|
+
};
|
|
3138
|
+
var WATERSHEDS = {
|
|
3139
|
+
id: "watersheds",
|
|
3140
|
+
name: "Watersheds",
|
|
3141
|
+
description: "Hydrological watershed boundaries",
|
|
3142
|
+
category: "environmental",
|
|
3143
|
+
source: {
|
|
3144
|
+
type: "geojson-url",
|
|
3145
|
+
url: ""
|
|
3146
|
+
},
|
|
3147
|
+
style: {
|
|
3148
|
+
renderType: "line",
|
|
3149
|
+
light: {
|
|
3150
|
+
"line-color": "hsl(190, 70%, 45%)",
|
|
3151
|
+
"line-width": 2
|
|
3152
|
+
},
|
|
3153
|
+
dark: {
|
|
3154
|
+
"line-color": "hsl(190, 60%, 55%)",
|
|
3155
|
+
"line-width": 2
|
|
3156
|
+
}
|
|
3157
|
+
},
|
|
3158
|
+
interactive: true,
|
|
3159
|
+
labelProperty: "name",
|
|
3160
|
+
tags: ["watershed", "hydrology", "water", "environmental"]
|
|
3161
|
+
};
|
|
3162
|
+
var BUILTIN_OVERLAY_LAYERS = [
|
|
3163
|
+
// Boundaries
|
|
3164
|
+
SCHOOL_DISTRICTS,
|
|
3165
|
+
CITY_LIMITS,
|
|
3166
|
+
ZONING_DISTRICTS,
|
|
3167
|
+
// Recreation
|
|
3168
|
+
PARKS,
|
|
3169
|
+
TRAILS,
|
|
3170
|
+
SPORTS_FACILITIES,
|
|
3171
|
+
// Transportation
|
|
3172
|
+
TRANSIT_ROUTES,
|
|
3173
|
+
BIKE_LANES,
|
|
3174
|
+
// Environmental
|
|
3175
|
+
FLOOD_ZONES,
|
|
3176
|
+
WATERSHEDS
|
|
3177
|
+
];
|
|
3178
|
+
function resolveLayerSourceUrl(layer, apiKeys) {
|
|
3179
|
+
const { source } = layer;
|
|
3180
|
+
if (source.type === "geojson-inline") {
|
|
3181
|
+
return null;
|
|
3182
|
+
}
|
|
3183
|
+
if (!source.url) {
|
|
3184
|
+
return null;
|
|
3185
|
+
}
|
|
3186
|
+
if (source.url.includes("{apiKey}") && apiKeys) {
|
|
3187
|
+
const apiKey = apiKeys[layer.id] ?? apiKeys["default"];
|
|
3188
|
+
if (apiKey) {
|
|
3189
|
+
return source.url.replace("{apiKey}", apiKey);
|
|
3190
|
+
}
|
|
3191
|
+
return null;
|
|
3192
|
+
}
|
|
3193
|
+
return source.url;
|
|
3194
|
+
}
|
|
3195
|
+
function getLayerStyleForTheme(layer, theme) {
|
|
3196
|
+
return theme === "dark" ? layer.style.dark : layer.style.light;
|
|
3197
|
+
}
|
|
3198
|
+
function searchLayers(layers, query) {
|
|
3199
|
+
if (!query.trim()) {
|
|
3200
|
+
return layers;
|
|
3201
|
+
}
|
|
3202
|
+
const lowerQuery = query.toLowerCase();
|
|
3203
|
+
return layers.filter((layer) => {
|
|
3204
|
+
const nameMatch = layer.name.toLowerCase().includes(lowerQuery);
|
|
3205
|
+
const descMatch = layer.description?.toLowerCase().includes(lowerQuery);
|
|
3206
|
+
const tagMatch = layer.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery));
|
|
3207
|
+
return nameMatch || descMatch || tagMatch;
|
|
3208
|
+
});
|
|
3209
|
+
}
|
|
3210
|
+
function getLayersByCategory(layers, category) {
|
|
3211
|
+
return layers.filter((layer) => layer.category === category);
|
|
3212
|
+
}
|
|
3213
|
+
function groupLayersByCategory(layers) {
|
|
3214
|
+
const groups = {
|
|
3215
|
+
boundaries: [],
|
|
3216
|
+
recreation: [],
|
|
3217
|
+
transportation: [],
|
|
3218
|
+
environmental: [],
|
|
3219
|
+
custom: []
|
|
3220
|
+
};
|
|
3221
|
+
for (const layer of layers) {
|
|
3222
|
+
groups[layer.category].push(layer);
|
|
3223
|
+
}
|
|
3224
|
+
return groups;
|
|
3225
|
+
}
|
|
3226
|
+
function getLayerCategories(layers) {
|
|
3227
|
+
const categories = /* @__PURE__ */ new Set();
|
|
3228
|
+
for (const layer of layers) {
|
|
3229
|
+
categories.add(layer.category);
|
|
3230
|
+
}
|
|
3231
|
+
return Array.from(categories).sort((a, b) => CATEGORY_META[a].order - CATEGORY_META[b].order);
|
|
3232
|
+
}
|
|
3233
|
+
|
|
3234
|
+
// src/layers/state.ts
|
|
3235
|
+
function createInitialLayerStates(layers, initialActiveLayers) {
|
|
3236
|
+
const states = /* @__PURE__ */ new Map();
|
|
3237
|
+
const activeSet = new Set(initialActiveLayers ?? []);
|
|
3238
|
+
layers.forEach((layer, index) => {
|
|
3239
|
+
states.set(layer.id, {
|
|
3240
|
+
id: layer.id,
|
|
3241
|
+
visible: activeSet.has(layer.id),
|
|
3242
|
+
opacity: 1,
|
|
3243
|
+
loading: false,
|
|
3244
|
+
error: null,
|
|
3245
|
+
order: index
|
|
3246
|
+
});
|
|
3247
|
+
});
|
|
3248
|
+
return states;
|
|
3249
|
+
}
|
|
3250
|
+
function getVisibleLayerIds(states) {
|
|
3251
|
+
return Array.from(states.values()).filter((state) => state.visible).sort((a, b) => a.order - b.order).map((state) => state.id);
|
|
3252
|
+
}
|
|
3253
|
+
function updateLayerState(states, layerId, updates) {
|
|
3254
|
+
const newStates = new Map(states);
|
|
3255
|
+
const current = newStates.get(layerId);
|
|
3256
|
+
if (current) {
|
|
3257
|
+
newStates.set(layerId, { ...current, ...updates });
|
|
3258
|
+
}
|
|
3259
|
+
return newStates;
|
|
3260
|
+
}
|
|
3261
|
+
function toggleLayerVisibility(states, layerId) {
|
|
3262
|
+
const current = states.get(layerId);
|
|
3263
|
+
if (!current) return states;
|
|
3264
|
+
return updateLayerState(states, layerId, { visible: !current.visible });
|
|
3265
|
+
}
|
|
3266
|
+
function setLayerOpacity(states, layerId, opacity) {
|
|
3267
|
+
return updateLayerState(states, layerId, { opacity: Math.max(0, Math.min(1, opacity)) });
|
|
3268
|
+
}
|
|
3269
|
+
function reorderLayers(states, layerId, newIndex) {
|
|
3270
|
+
const sortedIds = Array.from(states.values()).sort((a, b) => a.order - b.order).map((s) => s.id);
|
|
3271
|
+
const currentIndex = sortedIds.indexOf(layerId);
|
|
3272
|
+
if (currentIndex === -1 || currentIndex === newIndex) {
|
|
3273
|
+
return states;
|
|
3274
|
+
}
|
|
3275
|
+
sortedIds.splice(currentIndex, 1);
|
|
3276
|
+
sortedIds.splice(newIndex, 0, layerId);
|
|
3277
|
+
const newStates = new Map(states);
|
|
3278
|
+
sortedIds.forEach((id, index) => {
|
|
3279
|
+
const current = newStates.get(id);
|
|
3280
|
+
if (current && current.order !== index) {
|
|
3281
|
+
newStates.set(id, { ...current, order: index });
|
|
3282
|
+
}
|
|
3283
|
+
});
|
|
3284
|
+
return newStates;
|
|
3285
|
+
}
|
|
3286
|
+
function setLayerLoading(states, layerId, loading) {
|
|
3287
|
+
return updateLayerState(states, layerId, {
|
|
3288
|
+
loading,
|
|
3289
|
+
error: loading ? null : states.get(layerId)?.error ?? null
|
|
3290
|
+
});
|
|
3291
|
+
}
|
|
3292
|
+
function setLayerError(states, layerId, error) {
|
|
3293
|
+
return updateLayerState(states, layerId, { error, loading: false });
|
|
3294
|
+
}
|
|
3295
|
+
function showAllLayers(states) {
|
|
3296
|
+
const newStates = /* @__PURE__ */ new Map();
|
|
3297
|
+
for (const [id, state] of states) {
|
|
3298
|
+
newStates.set(id, { ...state, visible: true });
|
|
3299
|
+
}
|
|
3300
|
+
return newStates;
|
|
3301
|
+
}
|
|
3302
|
+
function hideAllLayers(states) {
|
|
3303
|
+
const newStates = /* @__PURE__ */ new Map();
|
|
3304
|
+
for (const [id, state] of states) {
|
|
3305
|
+
newStates.set(id, { ...state, visible: false });
|
|
3306
|
+
}
|
|
3307
|
+
return newStates;
|
|
3308
|
+
}
|
|
3309
|
+
function getLayerStatesArray(states) {
|
|
3310
|
+
return Array.from(states.values()).sort((a, b) => a.order - b.order);
|
|
3311
|
+
}
|
|
3312
|
+
function isAnyLayerLoading(states) {
|
|
3313
|
+
for (const state of states.values()) {
|
|
3314
|
+
if (state.loading) return true;
|
|
3315
|
+
}
|
|
3316
|
+
return false;
|
|
3317
|
+
}
|
|
3318
|
+
function getLayersWithErrors(states) {
|
|
3319
|
+
return Array.from(states.values()).filter((state) => state.error !== null);
|
|
3320
|
+
}
|
|
3321
|
+
|
|
3322
|
+
export { BASE_OFFSET, BIKE_LANES, BUILTIN_BASEMAPS, BUILTIN_OVERLAY_LAYERS, CATEGORY_META, CITY_LIMITS, CLASSIC_DARK, CLASSIC_LIGHT, DEFAULT_SIMPLIFICATION_THRESHOLDS, FLOOD_ZONES, FREE_BASEMAPS, KEYBOARD_CONTROLS, MAPTILER_BASIC, MAPTILER_OUTDOOR, MAPTILER_SATELLITE, MAPTILER_STREETS, MARKER_PROTECTION_CLASS, OFFSET_CLASSES, OSM_STANDARD, PARKS, POSITION_CLASSES, SCHOOL_DISTRICTS, SPORTS_FACILITIES, STADIA_ALIDADE_DARK, STADIA_ALIDADE_SMOOTH, STADIA_STAMEN_TERRAIN, STADIA_STAMEN_TONER, STADIA_STAMEN_WATERCOLOR, TRAILS, TRANSIT_ROUTES, WATERSHEDS, ZONING_DISTRICTS, applyMarkerChildProtection, applyMarkerProtection, boundsToPolygon, buildRTreeIndex, buildSpatialIndex, calculateBounds, calculateCentroid, calculateZoomThresholds, combineBounds, computePositionClasses, computeVerticalOffsetStyle, countFeaturesByType, createCategoricalColorExpression, createCircleStyle, createContinuousColorExpression, createDynamicLODManager, createExtrusionHeightExpression, createExtrusionStyle, createFillStyle, createGeoJSONFingerprint, createHeatmapStyle, createHoverExpression, createIdleViewportManager, createInitialLayerStates, createInteractiveExpression, createInteractiveStatusColorExpression, createLineStyle, createLotFillStyle, createLotOutlineStyle, createPredictiveViewportManager, createRTreeViewportManager, createSelectionExpression, createStatusColorExpression, createViewportManager, createViewportQuery, createZoomExpression, decimalToDMS, deepEqual, 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, getAvailableBasemaps, getChangedPaintProps, getClusterBounds, getClusterChildren, getClusterExpansionZoom, getClusterLeaves, getHighlightStyle, getLayerCategories, getLayerStatesArray, getLayerStyleForTheme, getLayersByCategory, getLayersWithErrors, getSelectionStyle, getSimplificationToleranceForZoom, getSimplifiedFeaturesForZoom, getVisibleLayerIds, groupFeaturesByProperty, groupLayersByCategory, hideAllLayers, isAnyLayerLoading, isClusterFeature, isValidBounds, loadGeoJSON, paintPropsEqual, queryByBounds, queryByBoundsWithStats, queryRTreeByBounds, queryRTreeByBoundsWithStats, removeMarkerProtection, reorderLayers, resolveBasemapStyle, resolveBasemapThumbnail, resolveLayerSourceUrl, searchLayers, serializeFilter, setLayerError, setLayerLoading, setLayerOpacity, showAllLayers, simplifyFeature, simplifyFeatureCollection, simplifyFeatureCollectionWithStats, simplifyPolygon, toggleLayerVisibility, updateLayerState, validateGeoJSON, zoomToScale };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classic-homes/maps-core",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Core utilities and theme for Classic Theme maps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"maps",
|
|
@@ -42,10 +42,17 @@
|
|
|
42
42
|
"./workers/spatial.worker": {
|
|
43
43
|
"import": "./dist/workers/spatial.worker.js"
|
|
44
44
|
},
|
|
45
|
+
"./styles": "./src/styles/index.css",
|
|
46
|
+
"./styles/index.css": "./src/styles/index.css",
|
|
47
|
+
"./styles/bundled.css": "./src/styles/bundled.css",
|
|
48
|
+
"./styles/utilities.css": "./src/styles/utilities.css",
|
|
49
|
+
"./styles/maplibre-fixes.css": "./src/styles/maplibre-fixes.css",
|
|
50
|
+
"./styles/css.d.ts": "./src/styles/css.d.ts",
|
|
45
51
|
"./styles/controls.css": "./src/styles/controls.css",
|
|
46
52
|
"./styles/popup.css": "./src/styles/popup.css",
|
|
47
53
|
"./styles/marker.css": "./src/styles/marker.css",
|
|
48
|
-
"./styles/basemap-switcher.css": "./src/styles/basemap-switcher.css"
|
|
54
|
+
"./styles/basemap-switcher.css": "./src/styles/basemap-switcher.css",
|
|
55
|
+
"./styles/layer-manager.css": "./src/styles/layer-manager.css"
|
|
49
56
|
},
|
|
50
57
|
"files": [
|
|
51
58
|
"dist",
|