@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.cjs
CHANGED
|
@@ -3348,11 +3348,523 @@ function resolveBasemapThumbnail(basemap, apiKeys) {
|
|
|
3348
3348
|
return thumbnail;
|
|
3349
3349
|
}
|
|
3350
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
|
+
|
|
3351
3858
|
exports.BASE_OFFSET = BASE_OFFSET;
|
|
3859
|
+
exports.BIKE_LANES = BIKE_LANES;
|
|
3352
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;
|
|
3353
3864
|
exports.CLASSIC_DARK = CLASSIC_DARK;
|
|
3354
3865
|
exports.CLASSIC_LIGHT = CLASSIC_LIGHT;
|
|
3355
3866
|
exports.DEFAULT_SIMPLIFICATION_THRESHOLDS = DEFAULT_SIMPLIFICATION_THRESHOLDS;
|
|
3867
|
+
exports.FLOOD_ZONES = FLOOD_ZONES;
|
|
3356
3868
|
exports.FREE_BASEMAPS = FREE_BASEMAPS;
|
|
3357
3869
|
exports.KEYBOARD_CONTROLS = KEYBOARD_CONTROLS;
|
|
3358
3870
|
exports.MAPTILER_BASIC = MAPTILER_BASIC;
|
|
@@ -3362,7 +3874,10 @@ exports.MAPTILER_STREETS = MAPTILER_STREETS;
|
|
|
3362
3874
|
exports.MARKER_PROTECTION_CLASS = MARKER_PROTECTION_CLASS;
|
|
3363
3875
|
exports.OFFSET_CLASSES = OFFSET_CLASSES;
|
|
3364
3876
|
exports.OSM_STANDARD = OSM_STANDARD;
|
|
3877
|
+
exports.PARKS = PARKS;
|
|
3365
3878
|
exports.POSITION_CLASSES = POSITION_CLASSES;
|
|
3879
|
+
exports.SCHOOL_DISTRICTS = SCHOOL_DISTRICTS;
|
|
3880
|
+
exports.SPORTS_FACILITIES = SPORTS_FACILITIES;
|
|
3366
3881
|
exports.STADIA_ALIDADE_DARK = STADIA_ALIDADE_DARK;
|
|
3367
3882
|
exports.STADIA_ALIDADE_SMOOTH = STADIA_ALIDADE_SMOOTH;
|
|
3368
3883
|
exports.STADIA_STAMEN_TERRAIN = STADIA_STAMEN_TERRAIN;
|
|
@@ -3370,6 +3885,10 @@ exports.STADIA_STAMEN_TONER = STADIA_STAMEN_TONER;
|
|
|
3370
3885
|
exports.STADIA_STAMEN_WATERCOLOR = STADIA_STAMEN_WATERCOLOR;
|
|
3371
3886
|
exports.THEME_DARK = THEME_DARK;
|
|
3372
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;
|
|
3373
3892
|
exports.applyMarkerChildProtection = applyMarkerChildProtection;
|
|
3374
3893
|
exports.applyMarkerProtection = applyMarkerProtection;
|
|
3375
3894
|
exports.boundsToPolygon = boundsToPolygon;
|
|
@@ -3393,6 +3912,7 @@ exports.createGeoJSONFingerprint = createGeoJSONFingerprint;
|
|
|
3393
3912
|
exports.createHeatmapStyle = createHeatmapStyle;
|
|
3394
3913
|
exports.createHoverExpression = createHoverExpression;
|
|
3395
3914
|
exports.createIdleViewportManager = createIdleViewportManager;
|
|
3915
|
+
exports.createInitialLayerStates = createInitialLayerStates;
|
|
3396
3916
|
exports.createInteractiveExpression = createInteractiveExpression;
|
|
3397
3917
|
exports.createInteractiveStatusColorExpression = createInteractiveStatusColorExpression;
|
|
3398
3918
|
exports.createLineStyle = createLineStyle;
|
|
@@ -3454,12 +3974,21 @@ exports.getClusterChildren = getClusterChildren;
|
|
|
3454
3974
|
exports.getClusterExpansionZoom = getClusterExpansionZoom;
|
|
3455
3975
|
exports.getClusterLeaves = getClusterLeaves;
|
|
3456
3976
|
exports.getHighlightStyle = getHighlightStyle;
|
|
3977
|
+
exports.getLayerCategories = getLayerCategories;
|
|
3978
|
+
exports.getLayerStatesArray = getLayerStatesArray;
|
|
3979
|
+
exports.getLayerStyleForTheme = getLayerStyleForTheme;
|
|
3980
|
+
exports.getLayersByCategory = getLayersByCategory;
|
|
3981
|
+
exports.getLayersWithErrors = getLayersWithErrors;
|
|
3457
3982
|
exports.getSelectionStyle = getSelectionStyle;
|
|
3458
3983
|
exports.getSimplificationToleranceForZoom = getSimplificationToleranceForZoom;
|
|
3459
3984
|
exports.getSimplifiedFeaturesForZoom = getSimplifiedFeaturesForZoom;
|
|
3460
3985
|
exports.getTheme = getTheme;
|
|
3461
3986
|
exports.getTypography = getTypography;
|
|
3987
|
+
exports.getVisibleLayerIds = getVisibleLayerIds;
|
|
3462
3988
|
exports.groupFeaturesByProperty = groupFeaturesByProperty;
|
|
3989
|
+
exports.groupLayersByCategory = groupLayersByCategory;
|
|
3990
|
+
exports.hideAllLayers = hideAllLayers;
|
|
3991
|
+
exports.isAnyLayerLoading = isAnyLayerLoading;
|
|
3463
3992
|
exports.isClusterFeature = isClusterFeature;
|
|
3464
3993
|
exports.isValidBounds = isValidBounds;
|
|
3465
3994
|
exports.lightBasicStyle = lightBasicStyle;
|
|
@@ -3471,12 +4000,21 @@ exports.queryByBoundsWithStats = queryByBoundsWithStats;
|
|
|
3471
4000
|
exports.queryRTreeByBounds = queryRTreeByBounds;
|
|
3472
4001
|
exports.queryRTreeByBoundsWithStats = queryRTreeByBoundsWithStats;
|
|
3473
4002
|
exports.removeMarkerProtection = removeMarkerProtection;
|
|
4003
|
+
exports.reorderLayers = reorderLayers;
|
|
3474
4004
|
exports.resolveBasemapStyle = resolveBasemapStyle;
|
|
3475
4005
|
exports.resolveBasemapThumbnail = resolveBasemapThumbnail;
|
|
4006
|
+
exports.resolveLayerSourceUrl = resolveLayerSourceUrl;
|
|
4007
|
+
exports.searchLayers = searchLayers;
|
|
3476
4008
|
exports.serializeFilter = serializeFilter;
|
|
4009
|
+
exports.setLayerError = setLayerError;
|
|
4010
|
+
exports.setLayerLoading = setLayerLoading;
|
|
4011
|
+
exports.setLayerOpacity = setLayerOpacity;
|
|
4012
|
+
exports.showAllLayers = showAllLayers;
|
|
3477
4013
|
exports.simplifyFeature = simplifyFeature;
|
|
3478
4014
|
exports.simplifyFeatureCollection = simplifyFeatureCollection;
|
|
3479
4015
|
exports.simplifyFeatureCollectionWithStats = simplifyFeatureCollectionWithStats;
|
|
3480
4016
|
exports.simplifyPolygon = simplifyPolygon;
|
|
4017
|
+
exports.toggleLayerVisibility = toggleLayerVisibility;
|
|
4018
|
+
exports.updateLayerState = updateLayerState;
|
|
3481
4019
|
exports.validateGeoJSON = validateGeoJSON;
|
|
3482
4020
|
exports.zoomToScale = zoomToScale;
|