@classic-homes/maps-core 0.1.3 → 0.1.5

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 CHANGED
@@ -3190,14 +3190,705 @@ function applyMarkerChildProtection(element) {
3190
3190
  style.setProperty("animation", "none", "important");
3191
3191
  }
3192
3192
 
3193
+ // src/basemaps/registry.ts
3194
+ var OSM_STANDARD = {
3195
+ id: "osm-standard",
3196
+ name: "OpenStreetMap",
3197
+ provider: "osm",
3198
+ category: "streets",
3199
+ thumbnail: "https://tile.openstreetmap.org/3/4/2.png",
3200
+ style: "https://demotiles.maplibre.org/style.json",
3201
+ requiresApiKey: false,
3202
+ attribution: "\xA9 OpenStreetMap contributors"
3203
+ };
3204
+ var CLASSIC_LIGHT = {
3205
+ id: "classic-light",
3206
+ name: "Classic Light",
3207
+ provider: "classic-theme",
3208
+ category: "minimal",
3209
+ thumbnail: "https://tile.openstreetmap.org/3/4/2.png",
3210
+ style: lightBasicStyle,
3211
+ requiresApiKey: false
3212
+ };
3213
+ var CLASSIC_DARK = {
3214
+ id: "classic-dark",
3215
+ name: "Classic Dark",
3216
+ provider: "classic-theme",
3217
+ category: "dark",
3218
+ thumbnail: "https://tile.openstreetmap.org/3/4/3.png",
3219
+ style: darkBasicStyle,
3220
+ requiresApiKey: false
3221
+ };
3222
+ var MAPTILER_STREETS = {
3223
+ id: "maptiler-streets",
3224
+ name: "Streets",
3225
+ provider: "maptiler",
3226
+ category: "streets",
3227
+ thumbnail: "https://api.maptiler.com/maps/streets-v2/256/3/4/2.png",
3228
+ style: (apiKey) => `https://api.maptiler.com/maps/streets-v2/style.json?key=${apiKey}`,
3229
+ requiresApiKey: true
3230
+ };
3231
+ var MAPTILER_SATELLITE = {
3232
+ id: "maptiler-satellite",
3233
+ name: "Satellite",
3234
+ provider: "maptiler",
3235
+ category: "satellite",
3236
+ thumbnail: "https://api.maptiler.com/maps/satellite/256/3/4/2.png",
3237
+ style: (apiKey) => `https://api.maptiler.com/maps/satellite/style.json?key=${apiKey}`,
3238
+ requiresApiKey: true
3239
+ };
3240
+ var MAPTILER_OUTDOOR = {
3241
+ id: "maptiler-outdoor",
3242
+ name: "Outdoor",
3243
+ provider: "maptiler",
3244
+ category: "outdoor",
3245
+ thumbnail: "https://api.maptiler.com/maps/outdoor-v2/256/3/4/2.png",
3246
+ style: (apiKey) => `https://api.maptiler.com/maps/outdoor-v2/style.json?key=${apiKey}`,
3247
+ requiresApiKey: true
3248
+ };
3249
+ var MAPTILER_BASIC = {
3250
+ id: "maptiler-basic",
3251
+ name: "Basic",
3252
+ provider: "maptiler",
3253
+ category: "minimal",
3254
+ thumbnail: "https://api.maptiler.com/maps/basic-v2/256/3/4/2.png",
3255
+ style: (apiKey) => `https://api.maptiler.com/maps/basic-v2/style.json?key=${apiKey}`,
3256
+ requiresApiKey: true
3257
+ };
3258
+ var STADIA_ALIDADE_SMOOTH = {
3259
+ id: "stadia-alidade-smooth",
3260
+ name: "Alidade Smooth",
3261
+ provider: "stadia",
3262
+ category: "minimal",
3263
+ thumbnail: "https://tiles.stadiamaps.com/tiles/alidade_smooth/3/4/2.png",
3264
+ style: (apiKey) => `https://tiles.stadiamaps.com/styles/alidade_smooth.json?api_key=${apiKey}`,
3265
+ requiresApiKey: true
3266
+ };
3267
+ var STADIA_ALIDADE_DARK = {
3268
+ id: "stadia-alidade-dark",
3269
+ name: "Alidade Dark",
3270
+ provider: "stadia",
3271
+ category: "dark",
3272
+ thumbnail: "https://tiles.stadiamaps.com/tiles/alidade_smooth_dark/3/4/2.png",
3273
+ style: (apiKey) => `https://tiles.stadiamaps.com/styles/alidade_smooth_dark.json?api_key=${apiKey}`,
3274
+ requiresApiKey: true
3275
+ };
3276
+ var STADIA_STAMEN_TONER = {
3277
+ id: "stadia-stamen-toner",
3278
+ name: "Stamen Toner",
3279
+ provider: "stadia",
3280
+ category: "artistic",
3281
+ thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_toner/3/4/2.png",
3282
+ style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_toner.json?api_key=${apiKey}`,
3283
+ requiresApiKey: true
3284
+ };
3285
+ var STADIA_STAMEN_WATERCOLOR = {
3286
+ id: "stadia-stamen-watercolor",
3287
+ name: "Stamen Watercolor",
3288
+ provider: "stadia",
3289
+ category: "artistic",
3290
+ thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_watercolor/3/4/2.png",
3291
+ style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_watercolor.json?api_key=${apiKey}`,
3292
+ requiresApiKey: true
3293
+ };
3294
+ var STADIA_STAMEN_TERRAIN = {
3295
+ id: "stadia-stamen-terrain",
3296
+ name: "Stamen Terrain",
3297
+ provider: "stadia",
3298
+ category: "outdoor",
3299
+ thumbnail: "https://tiles.stadiamaps.com/tiles/stamen_terrain/3/4/2.png",
3300
+ style: (apiKey) => `https://tiles.stadiamaps.com/styles/stamen_terrain.json?api_key=${apiKey}`,
3301
+ requiresApiKey: true
3302
+ };
3303
+ var BUILTIN_BASEMAPS = [
3304
+ OSM_STANDARD,
3305
+ CLASSIC_LIGHT,
3306
+ CLASSIC_DARK,
3307
+ MAPTILER_STREETS,
3308
+ MAPTILER_SATELLITE,
3309
+ MAPTILER_OUTDOOR,
3310
+ MAPTILER_BASIC,
3311
+ STADIA_ALIDADE_SMOOTH,
3312
+ STADIA_ALIDADE_DARK,
3313
+ STADIA_STAMEN_TONER,
3314
+ STADIA_STAMEN_WATERCOLOR,
3315
+ STADIA_STAMEN_TERRAIN
3316
+ ];
3317
+ var FREE_BASEMAPS = BUILTIN_BASEMAPS.filter((b) => !b.requiresApiKey);
3318
+ function getApiKeyForProvider(basemap, apiKeys) {
3319
+ if (!apiKeys) return void 0;
3320
+ return apiKeys[basemap.provider];
3321
+ }
3322
+ function resolveBasemapStyle(basemap, apiKeys) {
3323
+ if (typeof basemap.style === "function") {
3324
+ const apiKey = getApiKeyForProvider(basemap, apiKeys);
3325
+ if (!apiKey) return null;
3326
+ return basemap.style(apiKey);
3327
+ }
3328
+ return basemap.style;
3329
+ }
3330
+ function getAvailableBasemaps(basemaps, apiKeys) {
3331
+ return basemaps.filter((basemap) => {
3332
+ if (!basemap.requiresApiKey) return true;
3333
+ return !!getApiKeyForProvider(basemap, apiKeys);
3334
+ });
3335
+ }
3336
+ function resolveBasemapThumbnail(basemap, apiKeys) {
3337
+ const { thumbnail, provider } = basemap;
3338
+ const apiKey = getApiKeyForProvider(basemap, apiKeys);
3339
+ if (!apiKey) return thumbnail;
3340
+ if (provider === "maptiler" && thumbnail.includes("api.maptiler.com")) {
3341
+ const separator = thumbnail.includes("?") ? "&" : "?";
3342
+ return `${thumbnail}${separator}key=${apiKey}`;
3343
+ }
3344
+ if (provider === "stadia" && thumbnail.includes("stadiamaps.com")) {
3345
+ const separator = thumbnail.includes("?") ? "&" : "?";
3346
+ return `${thumbnail}${separator}api_key=${apiKey}`;
3347
+ }
3348
+ return thumbnail;
3349
+ }
3350
+
3351
+ // src/layers/registry.ts
3352
+ var CATEGORY_META = {
3353
+ boundaries: {
3354
+ label: "Boundaries",
3355
+ icon: "square-dashed",
3356
+ order: 1
3357
+ },
3358
+ recreation: {
3359
+ label: "Recreation",
3360
+ icon: "trees",
3361
+ order: 2
3362
+ },
3363
+ transportation: {
3364
+ label: "Transportation",
3365
+ icon: "bus",
3366
+ order: 3
3367
+ },
3368
+ environmental: {
3369
+ label: "Environmental",
3370
+ icon: "droplets",
3371
+ order: 4
3372
+ },
3373
+ custom: {
3374
+ label: "Other",
3375
+ icon: "layers",
3376
+ order: 5
3377
+ }
3378
+ };
3379
+ var SCHOOL_DISTRICTS = {
3380
+ id: "school-districts",
3381
+ name: "School Districts",
3382
+ description: "Public school district boundaries",
3383
+ category: "boundaries",
3384
+ source: {
3385
+ type: "geojson-url",
3386
+ url: ""
3387
+ // Must be configured with actual data URL
3388
+ },
3389
+ style: {
3390
+ renderType: "fill",
3391
+ light: {
3392
+ "fill-color": "hsl(210, 80%, 60%)",
3393
+ "fill-opacity": 0.2,
3394
+ "fill-outline-color": "hsl(210, 80%, 40%)"
3395
+ },
3396
+ dark: {
3397
+ "fill-color": "hsl(210, 70%, 50%)",
3398
+ "fill-opacity": 0.25,
3399
+ "fill-outline-color": "hsl(210, 70%, 60%)"
3400
+ }
3401
+ },
3402
+ interactive: true,
3403
+ labelProperty: "name",
3404
+ tags: ["education", "schools", "districts"]
3405
+ };
3406
+ var CITY_LIMITS = {
3407
+ id: "city-limits",
3408
+ name: "City Limits",
3409
+ description: "Municipal boundaries",
3410
+ category: "boundaries",
3411
+ source: {
3412
+ type: "geojson-url",
3413
+ url: ""
3414
+ },
3415
+ style: {
3416
+ renderType: "line",
3417
+ light: {
3418
+ "line-color": "hsl(0, 0%, 40%)",
3419
+ "line-width": 2,
3420
+ "line-dasharray": [4, 2]
3421
+ },
3422
+ dark: {
3423
+ "line-color": "hsl(0, 0%, 70%)",
3424
+ "line-width": 2,
3425
+ "line-dasharray": [4, 2]
3426
+ }
3427
+ },
3428
+ interactive: true,
3429
+ labelProperty: "name",
3430
+ tags: ["municipal", "city", "limits"]
3431
+ };
3432
+ var ZONING_DISTRICTS = {
3433
+ id: "zoning-districts",
3434
+ name: "Zoning Districts",
3435
+ description: "Land use zoning designations",
3436
+ category: "boundaries",
3437
+ source: {
3438
+ type: "geojson-url",
3439
+ url: ""
3440
+ },
3441
+ style: {
3442
+ renderType: "fill",
3443
+ light: {
3444
+ "fill-color": [
3445
+ "match",
3446
+ ["get", "zone_type"],
3447
+ "residential",
3448
+ "hsl(120, 50%, 70%)",
3449
+ "commercial",
3450
+ "hsl(30, 80%, 70%)",
3451
+ "industrial",
3452
+ "hsl(0, 50%, 70%)",
3453
+ "mixed",
3454
+ "hsl(270, 50%, 70%)",
3455
+ "hsl(0, 0%, 70%)"
3456
+ ],
3457
+ "fill-opacity": 0.3
3458
+ },
3459
+ dark: {
3460
+ "fill-color": [
3461
+ "match",
3462
+ ["get", "zone_type"],
3463
+ "residential",
3464
+ "hsl(120, 40%, 50%)",
3465
+ "commercial",
3466
+ "hsl(30, 70%, 50%)",
3467
+ "industrial",
3468
+ "hsl(0, 40%, 50%)",
3469
+ "mixed",
3470
+ "hsl(270, 40%, 50%)",
3471
+ "hsl(0, 0%, 50%)"
3472
+ ],
3473
+ "fill-opacity": 0.35
3474
+ }
3475
+ },
3476
+ legend: {
3477
+ type: "categorical",
3478
+ items: [
3479
+ { label: "Residential", color: "hsl(120, 50%, 70%)" },
3480
+ { label: "Commercial", color: "hsl(30, 80%, 70%)" },
3481
+ { label: "Industrial", color: "hsl(0, 50%, 70%)" },
3482
+ { label: "Mixed Use", color: "hsl(270, 50%, 70%)" }
3483
+ ]
3484
+ },
3485
+ interactive: true,
3486
+ labelProperty: "zone_name",
3487
+ tags: ["zoning", "land-use", "planning"]
3488
+ };
3489
+ var PARKS = {
3490
+ id: "parks",
3491
+ name: "Parks",
3492
+ description: "Public parks and green spaces",
3493
+ category: "recreation",
3494
+ source: {
3495
+ type: "geojson-url",
3496
+ url: ""
3497
+ },
3498
+ style: {
3499
+ renderType: "fill",
3500
+ light: {
3501
+ "fill-color": "hsl(120, 60%, 50%)",
3502
+ "fill-opacity": 0.4,
3503
+ "fill-outline-color": "hsl(120, 60%, 30%)"
3504
+ },
3505
+ dark: {
3506
+ "fill-color": "hsl(120, 50%, 40%)",
3507
+ "fill-opacity": 0.5,
3508
+ "fill-outline-color": "hsl(120, 50%, 50%)"
3509
+ }
3510
+ },
3511
+ interactive: true,
3512
+ labelProperty: "name",
3513
+ tags: ["parks", "green-space", "recreation"]
3514
+ };
3515
+ var TRAILS = {
3516
+ id: "trails",
3517
+ name: "Trails",
3518
+ description: "Hiking, biking, and walking trails",
3519
+ category: "recreation",
3520
+ source: {
3521
+ type: "geojson-url",
3522
+ url: ""
3523
+ },
3524
+ style: {
3525
+ renderType: "line",
3526
+ light: {
3527
+ "line-color": "hsl(30, 70%, 45%)",
3528
+ "line-width": 2,
3529
+ "line-dasharray": [2, 1]
3530
+ },
3531
+ dark: {
3532
+ "line-color": "hsl(30, 60%, 55%)",
3533
+ "line-width": 2,
3534
+ "line-dasharray": [2, 1]
3535
+ }
3536
+ },
3537
+ interactive: true,
3538
+ labelProperty: "name",
3539
+ tags: ["trails", "hiking", "biking", "walking"]
3540
+ };
3541
+ var SPORTS_FACILITIES = {
3542
+ id: "sports-facilities",
3543
+ name: "Sports Facilities",
3544
+ description: "Sports fields, courts, and recreational facilities",
3545
+ category: "recreation",
3546
+ source: {
3547
+ type: "geojson-url",
3548
+ url: ""
3549
+ },
3550
+ style: {
3551
+ renderType: "circle",
3552
+ light: {
3553
+ "circle-color": "hsl(200, 70%, 50%)",
3554
+ "circle-radius": 6,
3555
+ "circle-stroke-width": 2,
3556
+ "circle-stroke-color": "hsl(200, 70%, 30%)"
3557
+ },
3558
+ dark: {
3559
+ "circle-color": "hsl(200, 60%, 55%)",
3560
+ "circle-radius": 6,
3561
+ "circle-stroke-width": 2,
3562
+ "circle-stroke-color": "hsl(200, 60%, 70%)"
3563
+ }
3564
+ },
3565
+ interactive: true,
3566
+ labelProperty: "name",
3567
+ tags: ["sports", "recreation", "facilities"]
3568
+ };
3569
+ var TRANSIT_ROUTES = {
3570
+ id: "transit-routes",
3571
+ name: "Transit Routes",
3572
+ description: "Public transportation routes",
3573
+ category: "transportation",
3574
+ source: {
3575
+ type: "geojson-url",
3576
+ url: ""
3577
+ },
3578
+ style: {
3579
+ renderType: "line",
3580
+ light: {
3581
+ "line-color": "hsl(270, 70%, 50%)",
3582
+ "line-width": 3
3583
+ },
3584
+ dark: {
3585
+ "line-color": "hsl(270, 60%, 60%)",
3586
+ "line-width": 3
3587
+ }
3588
+ },
3589
+ interactive: true,
3590
+ labelProperty: "route_name",
3591
+ tags: ["transit", "bus", "public-transportation"]
3592
+ };
3593
+ var BIKE_LANES = {
3594
+ id: "bike-lanes",
3595
+ name: "Bike Lanes",
3596
+ description: "Designated bicycle lanes and paths",
3597
+ category: "transportation",
3598
+ source: {
3599
+ type: "geojson-url",
3600
+ url: ""
3601
+ },
3602
+ style: {
3603
+ renderType: "line",
3604
+ light: {
3605
+ "line-color": "hsl(150, 70%, 45%)",
3606
+ "line-width": 2
3607
+ },
3608
+ dark: {
3609
+ "line-color": "hsl(150, 60%, 55%)",
3610
+ "line-width": 2
3611
+ }
3612
+ },
3613
+ interactive: true,
3614
+ labelProperty: "name",
3615
+ tags: ["bike", "bicycle", "cycling", "lanes"]
3616
+ };
3617
+ var FLOOD_ZONES = {
3618
+ id: "flood-zones",
3619
+ name: "Flood Zones",
3620
+ description: "FEMA flood hazard areas",
3621
+ category: "environmental",
3622
+ source: {
3623
+ type: "geojson-url",
3624
+ url: ""
3625
+ },
3626
+ style: {
3627
+ renderType: "fill",
3628
+ light: {
3629
+ "fill-color": [
3630
+ "match",
3631
+ ["get", "flood_zone"],
3632
+ "A",
3633
+ "hsl(200, 80%, 60%)",
3634
+ "AE",
3635
+ "hsl(200, 80%, 50%)",
3636
+ "AH",
3637
+ "hsl(200, 80%, 45%)",
3638
+ "X",
3639
+ "hsl(200, 40%, 70%)",
3640
+ "hsl(200, 60%, 60%)"
3641
+ ],
3642
+ "fill-opacity": 0.4
3643
+ },
3644
+ dark: {
3645
+ "fill-color": [
3646
+ "match",
3647
+ ["get", "flood_zone"],
3648
+ "A",
3649
+ "hsl(200, 70%, 50%)",
3650
+ "AE",
3651
+ "hsl(200, 70%, 40%)",
3652
+ "AH",
3653
+ "hsl(200, 70%, 35%)",
3654
+ "X",
3655
+ "hsl(200, 30%, 50%)",
3656
+ "hsl(200, 50%, 45%)"
3657
+ ],
3658
+ "fill-opacity": 0.45
3659
+ }
3660
+ },
3661
+ legend: {
3662
+ type: "categorical",
3663
+ items: [
3664
+ { label: "Zone A (High Risk)", color: "hsl(200, 80%, 60%)" },
3665
+ { label: "Zone AE (High Risk)", color: "hsl(200, 80%, 50%)" },
3666
+ { label: "Zone AH (High Risk)", color: "hsl(200, 80%, 45%)" },
3667
+ { label: "Zone X (Minimal Risk)", color: "hsl(200, 40%, 70%)" }
3668
+ ]
3669
+ },
3670
+ interactive: true,
3671
+ labelProperty: "flood_zone",
3672
+ tags: ["flood", "fema", "hazard", "environmental"]
3673
+ };
3674
+ var WATERSHEDS = {
3675
+ id: "watersheds",
3676
+ name: "Watersheds",
3677
+ description: "Hydrological watershed boundaries",
3678
+ category: "environmental",
3679
+ source: {
3680
+ type: "geojson-url",
3681
+ url: ""
3682
+ },
3683
+ style: {
3684
+ renderType: "line",
3685
+ light: {
3686
+ "line-color": "hsl(190, 70%, 45%)",
3687
+ "line-width": 2
3688
+ },
3689
+ dark: {
3690
+ "line-color": "hsl(190, 60%, 55%)",
3691
+ "line-width": 2
3692
+ }
3693
+ },
3694
+ interactive: true,
3695
+ labelProperty: "name",
3696
+ tags: ["watershed", "hydrology", "water", "environmental"]
3697
+ };
3698
+ var BUILTIN_OVERLAY_LAYERS = [
3699
+ // Boundaries
3700
+ SCHOOL_DISTRICTS,
3701
+ CITY_LIMITS,
3702
+ ZONING_DISTRICTS,
3703
+ // Recreation
3704
+ PARKS,
3705
+ TRAILS,
3706
+ SPORTS_FACILITIES,
3707
+ // Transportation
3708
+ TRANSIT_ROUTES,
3709
+ BIKE_LANES,
3710
+ // Environmental
3711
+ FLOOD_ZONES,
3712
+ WATERSHEDS
3713
+ ];
3714
+ function resolveLayerSourceUrl(layer, apiKeys) {
3715
+ const { source } = layer;
3716
+ if (source.type === "geojson-inline") {
3717
+ return null;
3718
+ }
3719
+ if (!source.url) {
3720
+ return null;
3721
+ }
3722
+ if (source.url.includes("{apiKey}") && apiKeys) {
3723
+ const apiKey = apiKeys[layer.id] ?? apiKeys["default"];
3724
+ if (apiKey) {
3725
+ return source.url.replace("{apiKey}", apiKey);
3726
+ }
3727
+ return null;
3728
+ }
3729
+ return source.url;
3730
+ }
3731
+ function getLayerStyleForTheme(layer, theme) {
3732
+ return theme === "dark" ? layer.style.dark : layer.style.light;
3733
+ }
3734
+ function searchLayers(layers, query) {
3735
+ if (!query.trim()) {
3736
+ return layers;
3737
+ }
3738
+ const lowerQuery = query.toLowerCase();
3739
+ return layers.filter((layer) => {
3740
+ const nameMatch = layer.name.toLowerCase().includes(lowerQuery);
3741
+ const descMatch = layer.description?.toLowerCase().includes(lowerQuery);
3742
+ const tagMatch = layer.tags?.some((tag) => tag.toLowerCase().includes(lowerQuery));
3743
+ return nameMatch || descMatch || tagMatch;
3744
+ });
3745
+ }
3746
+ function getLayersByCategory(layers, category) {
3747
+ return layers.filter((layer) => layer.category === category);
3748
+ }
3749
+ function groupLayersByCategory(layers) {
3750
+ const groups = {
3751
+ boundaries: [],
3752
+ recreation: [],
3753
+ transportation: [],
3754
+ environmental: [],
3755
+ custom: []
3756
+ };
3757
+ for (const layer of layers) {
3758
+ groups[layer.category].push(layer);
3759
+ }
3760
+ return groups;
3761
+ }
3762
+ function getLayerCategories(layers) {
3763
+ const categories = /* @__PURE__ */ new Set();
3764
+ for (const layer of layers) {
3765
+ categories.add(layer.category);
3766
+ }
3767
+ return Array.from(categories).sort((a, b) => CATEGORY_META[a].order - CATEGORY_META[b].order);
3768
+ }
3769
+
3770
+ // src/layers/state.ts
3771
+ function createInitialLayerStates(layers, initialActiveLayers) {
3772
+ const states = /* @__PURE__ */ new Map();
3773
+ const activeSet = new Set(initialActiveLayers ?? []);
3774
+ layers.forEach((layer, index) => {
3775
+ states.set(layer.id, {
3776
+ id: layer.id,
3777
+ visible: activeSet.has(layer.id),
3778
+ opacity: 1,
3779
+ loading: false,
3780
+ error: null,
3781
+ order: index
3782
+ });
3783
+ });
3784
+ return states;
3785
+ }
3786
+ function getVisibleLayerIds(states) {
3787
+ return Array.from(states.values()).filter((state) => state.visible).sort((a, b) => a.order - b.order).map((state) => state.id);
3788
+ }
3789
+ function updateLayerState(states, layerId, updates) {
3790
+ const newStates = new Map(states);
3791
+ const current = newStates.get(layerId);
3792
+ if (current) {
3793
+ newStates.set(layerId, { ...current, ...updates });
3794
+ }
3795
+ return newStates;
3796
+ }
3797
+ function toggleLayerVisibility(states, layerId) {
3798
+ const current = states.get(layerId);
3799
+ if (!current) return states;
3800
+ return updateLayerState(states, layerId, { visible: !current.visible });
3801
+ }
3802
+ function setLayerOpacity(states, layerId, opacity) {
3803
+ return updateLayerState(states, layerId, { opacity: Math.max(0, Math.min(1, opacity)) });
3804
+ }
3805
+ function reorderLayers(states, layerId, newIndex) {
3806
+ const sortedIds = Array.from(states.values()).sort((a, b) => a.order - b.order).map((s) => s.id);
3807
+ const currentIndex = sortedIds.indexOf(layerId);
3808
+ if (currentIndex === -1 || currentIndex === newIndex) {
3809
+ return states;
3810
+ }
3811
+ sortedIds.splice(currentIndex, 1);
3812
+ sortedIds.splice(newIndex, 0, layerId);
3813
+ const newStates = new Map(states);
3814
+ sortedIds.forEach((id, index) => {
3815
+ const current = newStates.get(id);
3816
+ if (current && current.order !== index) {
3817
+ newStates.set(id, { ...current, order: index });
3818
+ }
3819
+ });
3820
+ return newStates;
3821
+ }
3822
+ function setLayerLoading(states, layerId, loading) {
3823
+ return updateLayerState(states, layerId, {
3824
+ loading,
3825
+ error: loading ? null : states.get(layerId)?.error ?? null
3826
+ });
3827
+ }
3828
+ function setLayerError(states, layerId, error) {
3829
+ return updateLayerState(states, layerId, { error, loading: false });
3830
+ }
3831
+ function showAllLayers(states) {
3832
+ const newStates = /* @__PURE__ */ new Map();
3833
+ for (const [id, state] of states) {
3834
+ newStates.set(id, { ...state, visible: true });
3835
+ }
3836
+ return newStates;
3837
+ }
3838
+ function hideAllLayers(states) {
3839
+ const newStates = /* @__PURE__ */ new Map();
3840
+ for (const [id, state] of states) {
3841
+ newStates.set(id, { ...state, visible: false });
3842
+ }
3843
+ return newStates;
3844
+ }
3845
+ function getLayerStatesArray(states) {
3846
+ return Array.from(states.values()).sort((a, b) => a.order - b.order);
3847
+ }
3848
+ function isAnyLayerLoading(states) {
3849
+ for (const state of states.values()) {
3850
+ if (state.loading) return true;
3851
+ }
3852
+ return false;
3853
+ }
3854
+ function getLayersWithErrors(states) {
3855
+ return Array.from(states.values()).filter((state) => state.error !== null);
3856
+ }
3857
+
3193
3858
  exports.BASE_OFFSET = BASE_OFFSET;
3859
+ exports.BIKE_LANES = BIKE_LANES;
3860
+ exports.BUILTIN_BASEMAPS = BUILTIN_BASEMAPS;
3861
+ exports.BUILTIN_OVERLAY_LAYERS = BUILTIN_OVERLAY_LAYERS;
3862
+ exports.CATEGORY_META = CATEGORY_META;
3863
+ exports.CITY_LIMITS = CITY_LIMITS;
3864
+ exports.CLASSIC_DARK = CLASSIC_DARK;
3865
+ exports.CLASSIC_LIGHT = CLASSIC_LIGHT;
3194
3866
  exports.DEFAULT_SIMPLIFICATION_THRESHOLDS = DEFAULT_SIMPLIFICATION_THRESHOLDS;
3867
+ exports.FLOOD_ZONES = FLOOD_ZONES;
3868
+ exports.FREE_BASEMAPS = FREE_BASEMAPS;
3195
3869
  exports.KEYBOARD_CONTROLS = KEYBOARD_CONTROLS;
3870
+ exports.MAPTILER_BASIC = MAPTILER_BASIC;
3871
+ exports.MAPTILER_OUTDOOR = MAPTILER_OUTDOOR;
3872
+ exports.MAPTILER_SATELLITE = MAPTILER_SATELLITE;
3873
+ exports.MAPTILER_STREETS = MAPTILER_STREETS;
3196
3874
  exports.MARKER_PROTECTION_CLASS = MARKER_PROTECTION_CLASS;
3197
3875
  exports.OFFSET_CLASSES = OFFSET_CLASSES;
3876
+ exports.OSM_STANDARD = OSM_STANDARD;
3877
+ exports.PARKS = PARKS;
3198
3878
  exports.POSITION_CLASSES = POSITION_CLASSES;
3879
+ exports.SCHOOL_DISTRICTS = SCHOOL_DISTRICTS;
3880
+ exports.SPORTS_FACILITIES = SPORTS_FACILITIES;
3881
+ exports.STADIA_ALIDADE_DARK = STADIA_ALIDADE_DARK;
3882
+ exports.STADIA_ALIDADE_SMOOTH = STADIA_ALIDADE_SMOOTH;
3883
+ exports.STADIA_STAMEN_TERRAIN = STADIA_STAMEN_TERRAIN;
3884
+ exports.STADIA_STAMEN_TONER = STADIA_STAMEN_TONER;
3885
+ exports.STADIA_STAMEN_WATERCOLOR = STADIA_STAMEN_WATERCOLOR;
3199
3886
  exports.THEME_DARK = THEME_DARK;
3200
3887
  exports.THEME_LIGHT = THEME_LIGHT;
3888
+ exports.TRAILS = TRAILS;
3889
+ exports.TRANSIT_ROUTES = TRANSIT_ROUTES;
3890
+ exports.WATERSHEDS = WATERSHEDS;
3891
+ exports.ZONING_DISTRICTS = ZONING_DISTRICTS;
3201
3892
  exports.applyMarkerChildProtection = applyMarkerChildProtection;
3202
3893
  exports.applyMarkerProtection = applyMarkerProtection;
3203
3894
  exports.boundsToPolygon = boundsToPolygon;
@@ -3221,6 +3912,7 @@ exports.createGeoJSONFingerprint = createGeoJSONFingerprint;
3221
3912
  exports.createHeatmapStyle = createHeatmapStyle;
3222
3913
  exports.createHoverExpression = createHoverExpression;
3223
3914
  exports.createIdleViewportManager = createIdleViewportManager;
3915
+ exports.createInitialLayerStates = createInitialLayerStates;
3224
3916
  exports.createInteractiveExpression = createInteractiveExpression;
3225
3917
  exports.createInteractiveStatusColorExpression = createInteractiveStatusColorExpression;
3226
3918
  exports.createLineStyle = createLineStyle;
@@ -3274,6 +3966,7 @@ exports.generateMarkersDescription = generateMarkersDescription;
3274
3966
  exports.generateMoveAnnouncement = generateMoveAnnouncement;
3275
3967
  exports.generateVectorStyle = generateVectorStyle;
3276
3968
  exports.geoJSONEqual = geoJSONEqual;
3969
+ exports.getAvailableBasemaps = getAvailableBasemaps;
3277
3970
  exports.getBasicStyle = getBasicStyle;
3278
3971
  exports.getChangedPaintProps = getChangedPaintProps;
3279
3972
  exports.getClusterBounds = getClusterBounds;
@@ -3281,12 +3974,21 @@ exports.getClusterChildren = getClusterChildren;
3281
3974
  exports.getClusterExpansionZoom = getClusterExpansionZoom;
3282
3975
  exports.getClusterLeaves = getClusterLeaves;
3283
3976
  exports.getHighlightStyle = getHighlightStyle;
3977
+ exports.getLayerCategories = getLayerCategories;
3978
+ exports.getLayerStatesArray = getLayerStatesArray;
3979
+ exports.getLayerStyleForTheme = getLayerStyleForTheme;
3980
+ exports.getLayersByCategory = getLayersByCategory;
3981
+ exports.getLayersWithErrors = getLayersWithErrors;
3284
3982
  exports.getSelectionStyle = getSelectionStyle;
3285
3983
  exports.getSimplificationToleranceForZoom = getSimplificationToleranceForZoom;
3286
3984
  exports.getSimplifiedFeaturesForZoom = getSimplifiedFeaturesForZoom;
3287
3985
  exports.getTheme = getTheme;
3288
3986
  exports.getTypography = getTypography;
3987
+ exports.getVisibleLayerIds = getVisibleLayerIds;
3289
3988
  exports.groupFeaturesByProperty = groupFeaturesByProperty;
3989
+ exports.groupLayersByCategory = groupLayersByCategory;
3990
+ exports.hideAllLayers = hideAllLayers;
3991
+ exports.isAnyLayerLoading = isAnyLayerLoading;
3290
3992
  exports.isClusterFeature = isClusterFeature;
3291
3993
  exports.isValidBounds = isValidBounds;
3292
3994
  exports.lightBasicStyle = lightBasicStyle;
@@ -3298,10 +4000,21 @@ exports.queryByBoundsWithStats = queryByBoundsWithStats;
3298
4000
  exports.queryRTreeByBounds = queryRTreeByBounds;
3299
4001
  exports.queryRTreeByBoundsWithStats = queryRTreeByBoundsWithStats;
3300
4002
  exports.removeMarkerProtection = removeMarkerProtection;
4003
+ exports.reorderLayers = reorderLayers;
4004
+ exports.resolveBasemapStyle = resolveBasemapStyle;
4005
+ exports.resolveBasemapThumbnail = resolveBasemapThumbnail;
4006
+ exports.resolveLayerSourceUrl = resolveLayerSourceUrl;
4007
+ exports.searchLayers = searchLayers;
3301
4008
  exports.serializeFilter = serializeFilter;
4009
+ exports.setLayerError = setLayerError;
4010
+ exports.setLayerLoading = setLayerLoading;
4011
+ exports.setLayerOpacity = setLayerOpacity;
4012
+ exports.showAllLayers = showAllLayers;
3302
4013
  exports.simplifyFeature = simplifyFeature;
3303
4014
  exports.simplifyFeatureCollection = simplifyFeatureCollection;
3304
4015
  exports.simplifyFeatureCollectionWithStats = simplifyFeatureCollectionWithStats;
3305
4016
  exports.simplifyPolygon = simplifyPolygon;
4017
+ exports.toggleLayerVisibility = toggleLayerVisibility;
4018
+ exports.updateLayerState = updateLayerState;
3306
4019
  exports.validateGeoJSON = validateGeoJSON;
3307
4020
  exports.zoomToScale = zoomToScale;