@chrtco/sdk 0.10.44 → 0.10.46
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/CHANGELOG.md +13 -0
- package/dist/atlas/browser.cjs +139 -10
- package/dist/atlas/browser.cjs.map +1 -1
- package/dist/atlas/browser.d.cts +7 -2
- package/dist/atlas/browser.d.ts +7 -2
- package/dist/atlas/browser.js +139 -10
- package/dist/atlas/browser.js.map +1 -1
- package/dist/index.cjs +115 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +155 -1
- package/dist/index.d.ts +155 -1
- package/dist/index.js +108 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5027,6 +5027,11 @@ function capLuminance(hex, ceiling) {
|
|
|
5027
5027
|
var NIGHT_INK = S52_NIGHT.CHBLK;
|
|
5028
5028
|
var NIGHT_MUTED_INK = scaleLinearLight(S52_NIGHT.CHBLK, 0.43);
|
|
5029
5029
|
|
|
5030
|
+
// src/atlas/map-live.ts
|
|
5031
|
+
function isMapLive(map) {
|
|
5032
|
+
return map._removed !== true;
|
|
5033
|
+
}
|
|
5034
|
+
|
|
5030
5035
|
// src/atlas/s52-linestyles-generated.ts
|
|
5031
5036
|
var S52_LINESTYLES = {
|
|
5032
5037
|
ACHARE51: {
|
|
@@ -27703,6 +27708,67 @@ function iconExpressionForFamily(objectClass, family) {
|
|
|
27703
27708
|
}
|
|
27704
27709
|
}
|
|
27705
27710
|
|
|
27711
|
+
// src/atlas/depth-label-size.ts
|
|
27712
|
+
var DEPTH_LABEL_SIZES = ["standard", "large"];
|
|
27713
|
+
var DEFAULT_DEPTH_LABEL_SIZE = "standard";
|
|
27714
|
+
function parseDepthLabelSize(raw) {
|
|
27715
|
+
if (!raw) return null;
|
|
27716
|
+
const lower = raw.toLowerCase();
|
|
27717
|
+
return DEPTH_LABEL_SIZES.find((s) => s === lower) ?? null;
|
|
27718
|
+
}
|
|
27719
|
+
var DEPTH_LABEL_CLASSES = /* @__PURE__ */ new Set([
|
|
27720
|
+
"SOUNDG",
|
|
27721
|
+
"DEPCNT",
|
|
27722
|
+
"UWTROC",
|
|
27723
|
+
"OBSTRN",
|
|
27724
|
+
"WRECKS"
|
|
27725
|
+
]);
|
|
27726
|
+
var SEMIBOLD = ["Open Sans Semibold"];
|
|
27727
|
+
var HAZARD_DEPTH = {
|
|
27728
|
+
textSize: ["interpolate", ["linear"], ["zoom"], 12, 12, 16, 15],
|
|
27729
|
+
haloWidth: 1.4,
|
|
27730
|
+
font: SEMIBOLD
|
|
27731
|
+
};
|
|
27732
|
+
var LARGE = {
|
|
27733
|
+
// Standard: 7 / 8 / 10 / 12 at z8 / 11 / 14 / 16, halo 1.0, Semibold.
|
|
27734
|
+
SOUNDG: {
|
|
27735
|
+
textSize: ["interpolate", ["linear"], ["zoom"], 8, 10, 11, 11, 14, 14, 16, 17],
|
|
27736
|
+
haloWidth: 1.2,
|
|
27737
|
+
font: SEMIBOLD
|
|
27738
|
+
},
|
|
27739
|
+
// Standard: 8 / 10 at z10 / 14, halo 1.2, Regular.
|
|
27740
|
+
//
|
|
27741
|
+
// ⚠ ~1.2x, NOT 1.4x, AND SEMIBOLD CARRIES THE REST. A contour value rides
|
|
27742
|
+
// its line (`symbol-placement: line`) and needs a straight-enough run to fit;
|
|
27743
|
+
// it also shares rank 300 with the soundings, which place first. At 1.4x the
|
|
27744
|
+
// Boston harbour view kept 15 of Standard's 20 contour labels; at 1.2x, 18.
|
|
27745
|
+
DEPCNT: {
|
|
27746
|
+
textSize: ["interpolate", ["linear"], ["zoom"], 10, 10, 14, 12],
|
|
27747
|
+
haloWidth: 1.2,
|
|
27748
|
+
font: SEMIBOLD
|
|
27749
|
+
},
|
|
27750
|
+
UWTROC: HAZARD_DEPTH,
|
|
27751
|
+
OBSTRN: HAZARD_DEPTH,
|
|
27752
|
+
WRECKS: HAZARD_DEPTH
|
|
27753
|
+
};
|
|
27754
|
+
var LARGE_SOUNDING_PADDING_PX = 3.5;
|
|
27755
|
+
function applyDepthLabelSize(objectClass, layer, size) {
|
|
27756
|
+
if (size !== "large") return layer;
|
|
27757
|
+
const large = LARGE[objectClass];
|
|
27758
|
+
if (large === void 0) return layer;
|
|
27759
|
+
const layout = {
|
|
27760
|
+
...layer.layout ?? {},
|
|
27761
|
+
"text-size": large.textSize,
|
|
27762
|
+
"text-font": [...large.font]
|
|
27763
|
+
};
|
|
27764
|
+
if (objectClass === "SOUNDG") layout["text-padding"] = LARGE_SOUNDING_PADDING_PX;
|
|
27765
|
+
return {
|
|
27766
|
+
...layer,
|
|
27767
|
+
layout,
|
|
27768
|
+
paint: { ...layer.paint, "text-halo-width": large.haloWidth }
|
|
27769
|
+
};
|
|
27770
|
+
}
|
|
27771
|
+
|
|
27706
27772
|
// src/atlas/base-bundle.ts
|
|
27707
27773
|
var BASE_BUNDLE_ID = BASE_REGION;
|
|
27708
27774
|
var BASE_BUNDLE_SCHEMA = "chrt.basemap-bundle/1";
|
|
@@ -29043,7 +29109,7 @@ function buildLabelLayer2(objectClass, ct, sourceId = DEFAULT_REGION, depthUnits
|
|
|
29043
29109
|
if (getLabelBehavior(objectClass) === "orientation-cross-band") {
|
|
29044
29110
|
layer.filter = LABEL_ANCHOR_FILTER;
|
|
29045
29111
|
}
|
|
29046
|
-
return layer;
|
|
29112
|
+
return applyDepthLabelSize(objectClass, layer, labelOpts.depthLabelSize);
|
|
29047
29113
|
}
|
|
29048
29114
|
function getGeomTypesForClass(objectClass, defaultType) {
|
|
29049
29115
|
if (SYMBOL_MAP[objectClass] && defaultType === "symbol") {
|
|
@@ -29392,6 +29458,12 @@ var BASE_THEMES = {
|
|
|
29392
29458
|
// CHRTland's own tan — one land colour
|
|
29393
29459
|
inlandWater: "#B9CFDD",
|
|
29394
29460
|
// muted, unmistakably not a charted blue
|
|
29461
|
+
// The uncharted hatch's stripe, held to 2.3:1 against `inlandWater` in
|
|
29462
|
+
// every palette (`inland-hatch-contrast.test.ts`) — the hatch says "we have
|
|
29463
|
+
// not charted this water", and stripes the eye cannot find say nothing.
|
|
29464
|
+
// DAY 3.08:1, darker than its ground. Also the colour the artwork file
|
|
29465
|
+
// itself is drawn in.
|
|
29466
|
+
inlandHatch: "#5B7383",
|
|
29395
29467
|
// State furniture. These three were referenced by the layers but missing
|
|
29396
29468
|
// from this table (and its type — the long-standing TS2339 trio), so the
|
|
29397
29469
|
// lines shipped on MapLibre's DEFAULT black. Now deliberate: a hairline
|
|
@@ -29422,6 +29494,9 @@ var BASE_THEMES = {
|
|
|
29422
29494
|
boundary: "#293135",
|
|
29423
29495
|
jurisdiction: "#867D64",
|
|
29424
29496
|
inlandWater: "#62717A",
|
|
29497
|
+
// Owner's choice, 2026-10-04: dark stripes, 2.37:1. The DAY stripe here
|
|
29498
|
+
// was 1.02:1 — invisible, so an uncharted lake read as plain water.
|
|
29499
|
+
inlandHatch: "#2E383F",
|
|
29425
29500
|
// Label stays DARK here — the halo is still mid-toned, so 3:1 is reachable
|
|
29426
29501
|
// downward and a bright label would be a new light source at dusk.
|
|
29427
29502
|
stateLine: "#B5A987",
|
|
@@ -29455,6 +29530,10 @@ var BASE_THEMES = {
|
|
|
29455
29530
|
boundary: "#131719",
|
|
29456
29531
|
jurisdiction: "#353128",
|
|
29457
29532
|
inlandWater: "#232A30",
|
|
29533
|
+
// The DAY stripe, lighter than this ground: 2.92:1, and L 0.16, under the
|
|
29534
|
+
// NIGHT muted-ink ceiling (`night-luminance.test.ts`). Red night draws the
|
|
29535
|
+
// NIGHT chart, so this is its stripe too.
|
|
29536
|
+
inlandHatch: "#5B7383",
|
|
29458
29537
|
stateLine: "#484236",
|
|
29459
29538
|
stateLabel: "#837963",
|
|
29460
29539
|
stateHalo: "#353128",
|
|
@@ -29801,6 +29880,11 @@ function baseInlandWaterLayers(opts = {}) {
|
|
|
29801
29880
|
];
|
|
29802
29881
|
}
|
|
29803
29882
|
|
|
29883
|
+
// src/atlas/tile-number.ts
|
|
29884
|
+
function tileNumber(property, fallback) {
|
|
29885
|
+
return ["to-number", ["coalesce", ["get", property], fallback], fallback];
|
|
29886
|
+
}
|
|
29887
|
+
|
|
29804
29888
|
// src/atlas/land-layers.ts
|
|
29805
29889
|
var LAND_SURFACE_MINZOOM = BAND_PRIORITY_RANGES["5"].minzoom;
|
|
29806
29890
|
var LAND_SURFACE_LAYERS = (id) => id === "chrtland-base" || id === "chrtland-cover" || id.startsWith("chrtland-contour") || id === "chrtland-hillshade" || id === "chrtland-water" || id.startsWith("chrtland-fade-");
|
|
@@ -29867,7 +29951,7 @@ var LAND_THEMES = {
|
|
|
29867
29951
|
exaggeration: 0.45
|
|
29868
29952
|
}
|
|
29869
29953
|
};
|
|
29870
|
-
var FITS = ["<=",
|
|
29954
|
+
var FITS = ["<=", tileNumber("min_z", 0), ["zoom"]];
|
|
29871
29955
|
var ANCHOR = ["coalesce", ["get", "anchor"], "top"];
|
|
29872
29956
|
var anchorOffset = (em) => [
|
|
29873
29957
|
"match",
|
|
@@ -29903,7 +29987,7 @@ function landLayers(opts = {}) {
|
|
|
29903
29987
|
type: "fill",
|
|
29904
29988
|
source: src,
|
|
29905
29989
|
"source-layer": "land_cover",
|
|
29906
|
-
filter: ["<=",
|
|
29990
|
+
filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
|
|
29907
29991
|
paint: {
|
|
29908
29992
|
"fill-color": [
|
|
29909
29993
|
"match",
|
|
@@ -29938,10 +30022,10 @@ function landLayers(opts = {}) {
|
|
|
29938
30022
|
}
|
|
29939
30023
|
const isIndexContour = [
|
|
29940
30024
|
"any",
|
|
29941
|
-
["<=",
|
|
29942
|
-
["==",
|
|
30025
|
+
["<=", tileNumber("index_z", 99), ["zoom"]],
|
|
30026
|
+
["==", tileNumber("is_index", 0), 1]
|
|
29943
30027
|
];
|
|
29944
|
-
const contourVisible = ["<=",
|
|
30028
|
+
const contourVisible = ["<=", tileNumber("min_z", 0), ["zoom"]];
|
|
29945
30029
|
layers.push(L({
|
|
29946
30030
|
id: "chrtland-contour-index",
|
|
29947
30031
|
type: "line",
|
|
@@ -29971,7 +30055,7 @@ function landLayers(opts = {}) {
|
|
|
29971
30055
|
type: "fill",
|
|
29972
30056
|
source: src,
|
|
29973
30057
|
"source-layer": "land_water",
|
|
29974
|
-
filter: ["<=",
|
|
30058
|
+
filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
|
|
29975
30059
|
paint: { "fill-color": inlandWaterColor(palette) }
|
|
29976
30060
|
}));
|
|
29977
30061
|
const d = FADE_PX / 2 / FADE_BANDS;
|
|
@@ -30012,7 +30096,7 @@ function landLayers(opts = {}) {
|
|
|
30012
30096
|
source: src,
|
|
30013
30097
|
"source-layer": "land_town",
|
|
30014
30098
|
minzoom: 6.5,
|
|
30015
|
-
filter: [">=",
|
|
30099
|
+
filter: [">=", tileNumber("prank", 0), 10],
|
|
30016
30100
|
layout: {
|
|
30017
30101
|
"text-field": [
|
|
30018
30102
|
"case",
|
|
@@ -30028,16 +30112,16 @@ function landLayers(opts = {}) {
|
|
|
30028
30112
|
6.5,
|
|
30029
30113
|
11.5,
|
|
30030
30114
|
9,
|
|
30031
|
-
["+", 10, ["*", 0.4,
|
|
30115
|
+
["+", 10, ["*", 0.4, tileNumber("prank", 10)]],
|
|
30032
30116
|
13,
|
|
30033
|
-
["+", 13, ["*", 0.5,
|
|
30117
|
+
["+", 13, ["*", 0.5, tileNumber("prank", 10)]]
|
|
30034
30118
|
],
|
|
30035
30119
|
"text-letter-spacing": ["case", ["==", ["get", "upcase"], true], 0.14, 0.02],
|
|
30036
30120
|
"text-offset": anchorOffset(0.75),
|
|
30037
30121
|
"text-anchor": ANCHOR,
|
|
30038
30122
|
"text-padding": 10,
|
|
30039
30123
|
"text-allow-overlap": false,
|
|
30040
|
-
"symbol-sort-key": ["*", -1,
|
|
30124
|
+
"symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
|
|
30041
30125
|
},
|
|
30042
30126
|
paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.6 }
|
|
30043
30127
|
}));
|
|
@@ -30050,7 +30134,7 @@ function landLayers(opts = {}) {
|
|
|
30050
30134
|
filter: [
|
|
30051
30135
|
"all",
|
|
30052
30136
|
["==", ["get", "enc_dup"], true],
|
|
30053
|
-
["<",
|
|
30137
|
+
["<", tileNumber("prank", 0), 10]
|
|
30054
30138
|
],
|
|
30055
30139
|
layout: {
|
|
30056
30140
|
"text-field": ["get", "name"],
|
|
@@ -30062,7 +30146,7 @@ function landLayers(opts = {}) {
|
|
|
30062
30146
|
"text-allow-overlap": false,
|
|
30063
30147
|
// Within the tier, the bigger place wins the space: without this the
|
|
30064
30148
|
// tie broke on data order and "West Gloucester" beat Gloucester.
|
|
30065
|
-
"symbol-sort-key": ["*", -1,
|
|
30149
|
+
"symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
|
|
30066
30150
|
},
|
|
30067
30151
|
paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.4 }
|
|
30068
30152
|
}));
|
|
@@ -30075,7 +30159,7 @@ function landLayers(opts = {}) {
|
|
|
30075
30159
|
filter: [
|
|
30076
30160
|
"all",
|
|
30077
30161
|
FITS,
|
|
30078
|
-
["<",
|
|
30162
|
+
["<", tileNumber("prank", 0), 10],
|
|
30079
30163
|
["!=", ["get", "enc_dup"], true]
|
|
30080
30164
|
],
|
|
30081
30165
|
layout: {
|
|
@@ -30102,7 +30186,7 @@ function landLayers(opts = {}) {
|
|
|
30102
30186
|
source: src,
|
|
30103
30187
|
"source-layer": "land_summit",
|
|
30104
30188
|
minzoom: 11.5,
|
|
30105
|
-
filter: ["all", FITS, [">=",
|
|
30189
|
+
filter: ["all", FITS, [">=", tileNumber("peak_m", 0), 40]],
|
|
30106
30190
|
layout: {
|
|
30107
30191
|
"text-field": ["concat", ["get", "name"], "\n", ["to-string", ["get", "peak_m"]], " m"],
|
|
30108
30192
|
"text-font": FONT,
|
|
@@ -30576,7 +30660,8 @@ function generateStyle(palette = "DAY", opts = {}) {
|
|
|
30576
30660
|
label: buildLabelLayer2(objectClass, palette, sourceId, opts.depthUnits ?? "meters", {
|
|
30577
30661
|
safetyContour: opts.safetyContour,
|
|
30578
30662
|
twoShadeSoundings: opts.twoShadeSoundings,
|
|
30579
|
-
soundingFontWeight: opts.soundingFontWeight
|
|
30663
|
+
soundingFontWeight: opts.soundingFontWeight,
|
|
30664
|
+
depthLabelSize: opts.depthLabelSize
|
|
30580
30665
|
})
|
|
30581
30666
|
});
|
|
30582
30667
|
}
|
|
@@ -31922,6 +32007,7 @@ export {
|
|
|
31922
32007
|
ChrtError,
|
|
31923
32008
|
DEFAULT_CLICK_TOLERANCE,
|
|
31924
32009
|
DEFAULT_CUSTOM_STYLE_CONFIG,
|
|
32010
|
+
DEFAULT_DEPTH_LABEL_SIZE,
|
|
31925
32011
|
DEFAULT_INSPECT_CLASS_RANK,
|
|
31926
32012
|
DEFAULT_LABEL_SETTINGS,
|
|
31927
32013
|
DEFAULT_NAV_AID_SETTINGS,
|
|
@@ -31933,6 +32019,8 @@ export {
|
|
|
31933
32019
|
DEFAULT_WATER_BODY_SETTINGS,
|
|
31934
32020
|
DEPARE_FILL_BRANCH_TOKENS,
|
|
31935
32021
|
DEPARE_FILL_FALLBACK_TOKEN,
|
|
32022
|
+
DEPTH_LABEL_CLASSES,
|
|
32023
|
+
DEPTH_LABEL_SIZES,
|
|
31936
32024
|
DRAPEABLE_LAYER_TYPES,
|
|
31937
32025
|
INSPECT_CLASS_RANK,
|
|
31938
32026
|
INSPECT_RANK_DEVIATIONS,
|
|
@@ -31949,6 +32037,7 @@ export {
|
|
|
31949
32037
|
LAND_ATTRIBUTION,
|
|
31950
32038
|
LAND_BUILD_MAXZOOM,
|
|
31951
32039
|
LAND_REGION,
|
|
32040
|
+
LARGE_SOUNDING_PADDING_PX,
|
|
31952
32041
|
NAUTICAL_SYMBOLS,
|
|
31953
32042
|
NAV_AID_LAYER_GROUPS,
|
|
31954
32043
|
NAV_AID_QUERY_LAYERS,
|
|
@@ -32003,6 +32092,7 @@ export {
|
|
|
32003
32092
|
applyChrtSymbolSet,
|
|
32004
32093
|
applyColorTheme,
|
|
32005
32094
|
applyCustomStyleSettings,
|
|
32095
|
+
applyDepthLabelSize,
|
|
32006
32096
|
applyRasterSymbolSet,
|
|
32007
32097
|
applyS101SymbolSet,
|
|
32008
32098
|
atonIconExpression,
|
|
@@ -32083,6 +32173,7 @@ export {
|
|
|
32083
32173
|
isDepthAreaClassLayerId,
|
|
32084
32174
|
isDrapeable,
|
|
32085
32175
|
isLabelLayerVisible,
|
|
32176
|
+
isMapLive,
|
|
32086
32177
|
isNavAidLayer,
|
|
32087
32178
|
isNavAidLayerVisible,
|
|
32088
32179
|
isSoundingLayerVisible,
|
|
@@ -32100,6 +32191,7 @@ export {
|
|
|
32100
32191
|
normalizeTheme,
|
|
32101
32192
|
opaqueSplitBaseOf,
|
|
32102
32193
|
paginate,
|
|
32194
|
+
parseDepthLabelSize,
|
|
32103
32195
|
parseListCodes,
|
|
32104
32196
|
parseSigseqTerms,
|
|
32105
32197
|
parseSymbolFamily,
|