@tileflow/core 0.1.0-alpha.5 → 0.1.0-alpha.6
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.js +40 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -461,8 +461,7 @@ function normalizeColorAliases(colors) {
|
|
|
461
461
|
...colors,
|
|
462
462
|
background: colors.background ?? colors.canvas,
|
|
463
463
|
park: colors.park ?? colors.greenspace ?? colors.nature,
|
|
464
|
-
greenspace: colors.greenspace ?? colors.park ?? colors.nature
|
|
465
|
-
roadMajor: colors.roadMajor ?? colors.accent
|
|
464
|
+
greenspace: colors.greenspace ?? colors.park ?? colors.nature
|
|
466
465
|
};
|
|
467
466
|
}
|
|
468
467
|
function resolveBaseColors(overrides, defaults) {
|
|
@@ -3973,7 +3972,7 @@ function shouldThemeWaterLabels(theme) {
|
|
|
3973
3972
|
}
|
|
3974
3973
|
function osmBrightRoadLineColor(id, colors, theme) {
|
|
3975
3974
|
if (hasModuleColorGroup(theme, "roads")) {
|
|
3976
|
-
return osmBrightModuleRoadLineColor(id, colors);
|
|
3975
|
+
return osmBrightModuleRoadLineColor(id, colors, theme);
|
|
3977
3976
|
}
|
|
3978
3977
|
if (isNonRoadThemeTarget(id)) {
|
|
3979
3978
|
return void 0;
|
|
@@ -3989,42 +3988,49 @@ function osmBrightRoadLineColor(id, colors, theme) {
|
|
|
3989
3988
|
}
|
|
3990
3989
|
return void 0;
|
|
3991
3990
|
}
|
|
3992
|
-
function osmBrightModuleRoadLineColor(id, colors) {
|
|
3991
|
+
function osmBrightModuleRoadLineColor(id, colors, theme) {
|
|
3992
|
+
const roadColor = (key) => hasNestedModuleColor(theme, "roads", key) ? colors.roads[key] : void 0;
|
|
3993
3993
|
if (isRoadCasing(id)) {
|
|
3994
|
-
return
|
|
3994
|
+
return roadColor("casing");
|
|
3995
3995
|
}
|
|
3996
3996
|
if (id.includes("ferry")) {
|
|
3997
|
-
return
|
|
3997
|
+
return roadColor("ferry");
|
|
3998
3998
|
}
|
|
3999
3999
|
if (id.includes("rail")) {
|
|
4000
|
-
return
|
|
4000
|
+
return roadColor("rail");
|
|
4001
4001
|
}
|
|
4002
4002
|
if (id.includes("path") || id.includes("track") || id.includes("steps")) {
|
|
4003
|
-
return
|
|
4003
|
+
return roadColor("path");
|
|
4004
4004
|
}
|
|
4005
4005
|
if (id.includes("bridge")) {
|
|
4006
|
-
|
|
4006
|
+
const bridge = roadColor("bridge");
|
|
4007
|
+
if (bridge) {
|
|
4008
|
+
return bridge;
|
|
4009
|
+
}
|
|
4007
4010
|
}
|
|
4008
4011
|
if (id.includes("tunnel")) {
|
|
4009
|
-
|
|
4012
|
+
const tunnel = roadColor("tunnel");
|
|
4013
|
+
if (tunnel) {
|
|
4014
|
+
return tunnel;
|
|
4015
|
+
}
|
|
4010
4016
|
}
|
|
4011
4017
|
if (id.includes("motorway")) {
|
|
4012
|
-
return
|
|
4018
|
+
return roadColor("motorway");
|
|
4013
4019
|
}
|
|
4014
4020
|
if (id.includes("trunk")) {
|
|
4015
|
-
return
|
|
4021
|
+
return roadColor("trunk") ?? roadColor("primary");
|
|
4016
4022
|
}
|
|
4017
4023
|
if (id.includes("primary")) {
|
|
4018
|
-
return
|
|
4024
|
+
return roadColor("primary");
|
|
4019
4025
|
}
|
|
4020
4026
|
if (id.includes("secondary") || id.includes("tertiary")) {
|
|
4021
|
-
return
|
|
4027
|
+
return roadColor("secondary");
|
|
4022
4028
|
}
|
|
4023
4029
|
if (id.includes("link")) {
|
|
4024
|
-
return
|
|
4030
|
+
return roadColor("primary");
|
|
4025
4031
|
}
|
|
4026
4032
|
if (id.includes("minor") || id.includes("service")) {
|
|
4027
|
-
return
|
|
4033
|
+
return roadColor("minor");
|
|
4028
4034
|
}
|
|
4029
4035
|
return void 0;
|
|
4030
4036
|
}
|
|
@@ -4355,7 +4361,24 @@ function resolveSourceLayers(mapLayers, tilesetLayers) {
|
|
|
4355
4361
|
}
|
|
4356
4362
|
function shouldUseOsmBrightTemplate(config, basemap, theme) {
|
|
4357
4363
|
const templateTheme = theme.custom || theme.name === "light" || theme.name === "dark";
|
|
4358
|
-
return basemap.type === "osm" && templateTheme && !config.colors && !config.typography && !config.density && !config.roads && !config.labels && !config.poi && !config.buildings && !config.modules?.some((moduleConfig) => moduleConfig.type !== "styleOverride") && !basemap.sourceLayers && !config.tiles?.sourceLayers;
|
|
4364
|
+
return basemap.type === "osm" && templateTheme && !hasEffectiveColorOverrides(config.colors) && !config.typography && !config.density && !config.roads && !config.labels && !config.poi && !config.buildings && !config.modules?.some((moduleConfig) => moduleConfig.type !== "styleOverride") && !basemap.sourceLayers && !config.tiles?.sourceLayers;
|
|
4365
|
+
}
|
|
4366
|
+
function hasEffectiveColorOverrides(colors) {
|
|
4367
|
+
if (!colors) {
|
|
4368
|
+
return false;
|
|
4369
|
+
}
|
|
4370
|
+
return Object.entries(colors).some(([key, value]) => {
|
|
4371
|
+
if (key === "accent" || value === void 0) {
|
|
4372
|
+
return false;
|
|
4373
|
+
}
|
|
4374
|
+
if (isRecord4(value)) {
|
|
4375
|
+
return Object.values(value).some((nestedValue) => typeof nestedValue === "string");
|
|
4376
|
+
}
|
|
4377
|
+
return typeof value === "string";
|
|
4378
|
+
});
|
|
4379
|
+
}
|
|
4380
|
+
function isRecord4(value) {
|
|
4381
|
+
return Boolean(value && typeof value === "object" && !Array.isArray(value));
|
|
4359
4382
|
}
|
|
4360
4383
|
function normalizeBaseUrl(value) {
|
|
4361
4384
|
return normalizeUrl(value ?? defaultTileBaseUrl);
|