@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/dist/index.cjs CHANGED
@@ -57,6 +57,7 @@ __export(index_exports, {
57
57
  ChrtError: () => ChrtError,
58
58
  DEFAULT_CLICK_TOLERANCE: () => DEFAULT_CLICK_TOLERANCE,
59
59
  DEFAULT_CUSTOM_STYLE_CONFIG: () => DEFAULT_CUSTOM_STYLE_CONFIG,
60
+ DEFAULT_DEPTH_LABEL_SIZE: () => DEFAULT_DEPTH_LABEL_SIZE,
60
61
  DEFAULT_INSPECT_CLASS_RANK: () => DEFAULT_INSPECT_CLASS_RANK,
61
62
  DEFAULT_LABEL_SETTINGS: () => DEFAULT_LABEL_SETTINGS,
62
63
  DEFAULT_NAV_AID_SETTINGS: () => DEFAULT_NAV_AID_SETTINGS,
@@ -68,6 +69,8 @@ __export(index_exports, {
68
69
  DEFAULT_WATER_BODY_SETTINGS: () => DEFAULT_WATER_BODY_SETTINGS,
69
70
  DEPARE_FILL_BRANCH_TOKENS: () => DEPARE_FILL_BRANCH_TOKENS,
70
71
  DEPARE_FILL_FALLBACK_TOKEN: () => DEPARE_FILL_FALLBACK_TOKEN,
72
+ DEPTH_LABEL_CLASSES: () => DEPTH_LABEL_CLASSES,
73
+ DEPTH_LABEL_SIZES: () => DEPTH_LABEL_SIZES,
71
74
  DRAPEABLE_LAYER_TYPES: () => DRAPEABLE_LAYER_TYPES,
72
75
  INSPECT_CLASS_RANK: () => INSPECT_CLASS_RANK,
73
76
  INSPECT_RANK_DEVIATIONS: () => INSPECT_RANK_DEVIATIONS,
@@ -84,6 +87,7 @@ __export(index_exports, {
84
87
  LAND_ATTRIBUTION: () => LAND_ATTRIBUTION,
85
88
  LAND_BUILD_MAXZOOM: () => LAND_BUILD_MAXZOOM,
86
89
  LAND_REGION: () => LAND_REGION,
90
+ LARGE_SOUNDING_PADDING_PX: () => LARGE_SOUNDING_PADDING_PX,
87
91
  NAUTICAL_SYMBOLS: () => NAUTICAL_SYMBOLS,
88
92
  NAV_AID_LAYER_GROUPS: () => NAV_AID_LAYER_GROUPS,
89
93
  NAV_AID_QUERY_LAYERS: () => NAV_AID_QUERY_LAYERS,
@@ -138,6 +142,7 @@ __export(index_exports, {
138
142
  applyChrtSymbolSet: () => applyChrtSymbolSet,
139
143
  applyColorTheme: () => applyColorTheme,
140
144
  applyCustomStyleSettings: () => applyCustomStyleSettings,
145
+ applyDepthLabelSize: () => applyDepthLabelSize,
141
146
  applyRasterSymbolSet: () => applyRasterSymbolSet,
142
147
  applyS101SymbolSet: () => applyS101SymbolSet,
143
148
  atonIconExpression: () => atonIconExpression,
@@ -218,6 +223,7 @@ __export(index_exports, {
218
223
  isDepthAreaClassLayerId: () => isDepthAreaClassLayerId,
219
224
  isDrapeable: () => isDrapeable,
220
225
  isLabelLayerVisible: () => isLabelLayerVisible,
226
+ isMapLive: () => isMapLive,
221
227
  isNavAidLayer: () => isNavAidLayer,
222
228
  isNavAidLayerVisible: () => isNavAidLayerVisible,
223
229
  isSoundingLayerVisible: () => isSoundingLayerVisible,
@@ -235,6 +241,7 @@ __export(index_exports, {
235
241
  normalizeTheme: () => normalizeTheme,
236
242
  opaqueSplitBaseOf: () => opaqueSplitBaseOf,
237
243
  paginate: () => paginate,
244
+ parseDepthLabelSize: () => parseDepthLabelSize,
238
245
  parseListCodes: () => parseListCodes,
239
246
  parseSigseqTerms: () => parseSigseqTerms,
240
247
  parseSymbolFamily: () => parseSymbolFamily,
@@ -5299,6 +5306,11 @@ function capLuminance(hex, ceiling) {
5299
5306
  var NIGHT_INK = S52_NIGHT.CHBLK;
5300
5307
  var NIGHT_MUTED_INK = scaleLinearLight(S52_NIGHT.CHBLK, 0.43);
5301
5308
 
5309
+ // src/atlas/map-live.ts
5310
+ function isMapLive(map) {
5311
+ return map._removed !== true;
5312
+ }
5313
+
5302
5314
  // src/atlas/s52-linestyles-generated.ts
5303
5315
  var S52_LINESTYLES = {
5304
5316
  ACHARE51: {
@@ -27975,6 +27987,67 @@ function iconExpressionForFamily(objectClass, family) {
27975
27987
  }
27976
27988
  }
27977
27989
 
27990
+ // src/atlas/depth-label-size.ts
27991
+ var DEPTH_LABEL_SIZES = ["standard", "large"];
27992
+ var DEFAULT_DEPTH_LABEL_SIZE = "standard";
27993
+ function parseDepthLabelSize(raw) {
27994
+ if (!raw) return null;
27995
+ const lower = raw.toLowerCase();
27996
+ return DEPTH_LABEL_SIZES.find((s) => s === lower) ?? null;
27997
+ }
27998
+ var DEPTH_LABEL_CLASSES = /* @__PURE__ */ new Set([
27999
+ "SOUNDG",
28000
+ "DEPCNT",
28001
+ "UWTROC",
28002
+ "OBSTRN",
28003
+ "WRECKS"
28004
+ ]);
28005
+ var SEMIBOLD = ["Open Sans Semibold"];
28006
+ var HAZARD_DEPTH = {
28007
+ textSize: ["interpolate", ["linear"], ["zoom"], 12, 12, 16, 15],
28008
+ haloWidth: 1.4,
28009
+ font: SEMIBOLD
28010
+ };
28011
+ var LARGE = {
28012
+ // Standard: 7 / 8 / 10 / 12 at z8 / 11 / 14 / 16, halo 1.0, Semibold.
28013
+ SOUNDG: {
28014
+ textSize: ["interpolate", ["linear"], ["zoom"], 8, 10, 11, 11, 14, 14, 16, 17],
28015
+ haloWidth: 1.2,
28016
+ font: SEMIBOLD
28017
+ },
28018
+ // Standard: 8 / 10 at z10 / 14, halo 1.2, Regular.
28019
+ //
28020
+ // ⚠ ~1.2x, NOT 1.4x, AND SEMIBOLD CARRIES THE REST. A contour value rides
28021
+ // its line (`symbol-placement: line`) and needs a straight-enough run to fit;
28022
+ // it also shares rank 300 with the soundings, which place first. At 1.4x the
28023
+ // Boston harbour view kept 15 of Standard's 20 contour labels; at 1.2x, 18.
28024
+ DEPCNT: {
28025
+ textSize: ["interpolate", ["linear"], ["zoom"], 10, 10, 14, 12],
28026
+ haloWidth: 1.2,
28027
+ font: SEMIBOLD
28028
+ },
28029
+ UWTROC: HAZARD_DEPTH,
28030
+ OBSTRN: HAZARD_DEPTH,
28031
+ WRECKS: HAZARD_DEPTH
28032
+ };
28033
+ var LARGE_SOUNDING_PADDING_PX = 3.5;
28034
+ function applyDepthLabelSize(objectClass, layer, size) {
28035
+ if (size !== "large") return layer;
28036
+ const large = LARGE[objectClass];
28037
+ if (large === void 0) return layer;
28038
+ const layout = {
28039
+ ...layer.layout ?? {},
28040
+ "text-size": large.textSize,
28041
+ "text-font": [...large.font]
28042
+ };
28043
+ if (objectClass === "SOUNDG") layout["text-padding"] = LARGE_SOUNDING_PADDING_PX;
28044
+ return {
28045
+ ...layer,
28046
+ layout,
28047
+ paint: { ...layer.paint, "text-halo-width": large.haloWidth }
28048
+ };
28049
+ }
28050
+
27978
28051
  // src/atlas/base-bundle.ts
27979
28052
  var BASE_BUNDLE_ID = BASE_REGION;
27980
28053
  var BASE_BUNDLE_SCHEMA = "chrt.basemap-bundle/1";
@@ -29315,7 +29388,7 @@ function buildLabelLayer2(objectClass, ct, sourceId = DEFAULT_REGION, depthUnits
29315
29388
  if (getLabelBehavior(objectClass) === "orientation-cross-band") {
29316
29389
  layer.filter = LABEL_ANCHOR_FILTER;
29317
29390
  }
29318
- return layer;
29391
+ return applyDepthLabelSize(objectClass, layer, labelOpts.depthLabelSize);
29319
29392
  }
29320
29393
  function getGeomTypesForClass(objectClass, defaultType) {
29321
29394
  if (SYMBOL_MAP[objectClass] && defaultType === "symbol") {
@@ -29664,6 +29737,12 @@ var BASE_THEMES = {
29664
29737
  // CHRTland's own tan — one land colour
29665
29738
  inlandWater: "#B9CFDD",
29666
29739
  // muted, unmistakably not a charted blue
29740
+ // The uncharted hatch's stripe, held to 2.3:1 against `inlandWater` in
29741
+ // every palette (`inland-hatch-contrast.test.ts`) — the hatch says "we have
29742
+ // not charted this water", and stripes the eye cannot find say nothing.
29743
+ // DAY 3.08:1, darker than its ground. Also the colour the artwork file
29744
+ // itself is drawn in.
29745
+ inlandHatch: "#5B7383",
29667
29746
  // State furniture. These three were referenced by the layers but missing
29668
29747
  // from this table (and its type — the long-standing TS2339 trio), so the
29669
29748
  // lines shipped on MapLibre's DEFAULT black. Now deliberate: a hairline
@@ -29694,6 +29773,9 @@ var BASE_THEMES = {
29694
29773
  boundary: "#293135",
29695
29774
  jurisdiction: "#867D64",
29696
29775
  inlandWater: "#62717A",
29776
+ // Owner's choice, 2026-10-04: dark stripes, 2.37:1. The DAY stripe here
29777
+ // was 1.02:1 — invisible, so an uncharted lake read as plain water.
29778
+ inlandHatch: "#2E383F",
29697
29779
  // Label stays DARK here — the halo is still mid-toned, so 3:1 is reachable
29698
29780
  // downward and a bright label would be a new light source at dusk.
29699
29781
  stateLine: "#B5A987",
@@ -29727,6 +29809,10 @@ var BASE_THEMES = {
29727
29809
  boundary: "#131719",
29728
29810
  jurisdiction: "#353128",
29729
29811
  inlandWater: "#232A30",
29812
+ // The DAY stripe, lighter than this ground: 2.92:1, and L 0.16, under the
29813
+ // NIGHT muted-ink ceiling (`night-luminance.test.ts`). Red night draws the
29814
+ // NIGHT chart, so this is its stripe too.
29815
+ inlandHatch: "#5B7383",
29730
29816
  stateLine: "#484236",
29731
29817
  stateLabel: "#837963",
29732
29818
  stateHalo: "#353128",
@@ -30073,6 +30159,11 @@ function baseInlandWaterLayers(opts = {}) {
30073
30159
  ];
30074
30160
  }
30075
30161
 
30162
+ // src/atlas/tile-number.ts
30163
+ function tileNumber(property, fallback) {
30164
+ return ["to-number", ["coalesce", ["get", property], fallback], fallback];
30165
+ }
30166
+
30076
30167
  // src/atlas/land-layers.ts
30077
30168
  var LAND_SURFACE_MINZOOM = BAND_PRIORITY_RANGES["5"].minzoom;
30078
30169
  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-");
@@ -30139,7 +30230,7 @@ var LAND_THEMES = {
30139
30230
  exaggeration: 0.45
30140
30231
  }
30141
30232
  };
30142
- var FITS = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
30233
+ var FITS = ["<=", tileNumber("min_z", 0), ["zoom"]];
30143
30234
  var ANCHOR = ["coalesce", ["get", "anchor"], "top"];
30144
30235
  var anchorOffset = (em) => [
30145
30236
  "match",
@@ -30175,7 +30266,7 @@ function landLayers(opts = {}) {
30175
30266
  type: "fill",
30176
30267
  source: src,
30177
30268
  "source-layer": "land_cover",
30178
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
30269
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
30179
30270
  paint: {
30180
30271
  "fill-color": [
30181
30272
  "match",
@@ -30210,10 +30301,10 @@ function landLayers(opts = {}) {
30210
30301
  }
30211
30302
  const isIndexContour = [
30212
30303
  "any",
30213
- ["<=", ["coalesce", ["get", "index_z"], 99], ["zoom"]],
30214
- ["==", ["get", "is_index"], 1]
30304
+ ["<=", tileNumber("index_z", 99), ["zoom"]],
30305
+ ["==", tileNumber("is_index", 0), 1]
30215
30306
  ];
30216
- const contourVisible = ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]];
30307
+ const contourVisible = ["<=", tileNumber("min_z", 0), ["zoom"]];
30217
30308
  layers.push(L({
30218
30309
  id: "chrtland-contour-index",
30219
30310
  type: "line",
@@ -30243,7 +30334,7 @@ function landLayers(opts = {}) {
30243
30334
  type: "fill",
30244
30335
  source: src,
30245
30336
  "source-layer": "land_water",
30246
- filter: ["<=", ["coalesce", ["get", "min_z"], 0], ["zoom"]],
30337
+ filter: ["<=", tileNumber("min_z", 0), ["zoom"]],
30247
30338
  paint: { "fill-color": inlandWaterColor(palette) }
30248
30339
  }));
30249
30340
  const d = FADE_PX / 2 / FADE_BANDS;
@@ -30284,7 +30375,7 @@ function landLayers(opts = {}) {
30284
30375
  source: src,
30285
30376
  "source-layer": "land_town",
30286
30377
  minzoom: 6.5,
30287
- filter: [">=", ["coalesce", ["get", "prank"], 0], 10],
30378
+ filter: [">=", tileNumber("prank", 0), 10],
30288
30379
  layout: {
30289
30380
  "text-field": [
30290
30381
  "case",
@@ -30300,16 +30391,16 @@ function landLayers(opts = {}) {
30300
30391
  6.5,
30301
30392
  11.5,
30302
30393
  9,
30303
- ["+", 10, ["*", 0.4, ["coalesce", ["get", "prank"], 10]]],
30394
+ ["+", 10, ["*", 0.4, tileNumber("prank", 10)]],
30304
30395
  13,
30305
- ["+", 13, ["*", 0.5, ["coalesce", ["get", "prank"], 10]]]
30396
+ ["+", 13, ["*", 0.5, tileNumber("prank", 10)]]
30306
30397
  ],
30307
30398
  "text-letter-spacing": ["case", ["==", ["get", "upcase"], true], 0.14, 0.02],
30308
30399
  "text-offset": anchorOffset(0.75),
30309
30400
  "text-anchor": ANCHOR,
30310
30401
  "text-padding": 10,
30311
30402
  "text-allow-overlap": false,
30312
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30403
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30313
30404
  },
30314
30405
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.6 }
30315
30406
  }));
@@ -30322,7 +30413,7 @@ function landLayers(opts = {}) {
30322
30413
  filter: [
30323
30414
  "all",
30324
30415
  ["==", ["get", "enc_dup"], true],
30325
- ["<", ["coalesce", ["get", "prank"], 0], 10]
30416
+ ["<", tileNumber("prank", 0), 10]
30326
30417
  ],
30327
30418
  layout: {
30328
30419
  "text-field": ["get", "name"],
@@ -30334,7 +30425,7 @@ function landLayers(opts = {}) {
30334
30425
  "text-allow-overlap": false,
30335
30426
  // Within the tier, the bigger place wins the space: without this the
30336
30427
  // tie broke on data order and "West Gloucester" beat Gloucester.
30337
- "symbol-sort-key": ["*", -1, ["coalesce", ["get", "pop"], 0]]
30428
+ "symbol-sort-key": ["*", -1, tileNumber("pop", 0)]
30338
30429
  },
30339
30430
  paint: { "text-color": T.label, "text-halo-color": T.halo, "text-halo-width": 1.4 }
30340
30431
  }));
@@ -30347,7 +30438,7 @@ function landLayers(opts = {}) {
30347
30438
  filter: [
30348
30439
  "all",
30349
30440
  FITS,
30350
- ["<", ["coalesce", ["get", "prank"], 0], 10],
30441
+ ["<", tileNumber("prank", 0), 10],
30351
30442
  ["!=", ["get", "enc_dup"], true]
30352
30443
  ],
30353
30444
  layout: {
@@ -30374,7 +30465,7 @@ function landLayers(opts = {}) {
30374
30465
  source: src,
30375
30466
  "source-layer": "land_summit",
30376
30467
  minzoom: 11.5,
30377
- filter: ["all", FITS, [">=", ["get", "peak_m"], 40]],
30468
+ filter: ["all", FITS, [">=", tileNumber("peak_m", 0), 40]],
30378
30469
  layout: {
30379
30470
  "text-field": ["concat", ["get", "name"], "\n", ["to-string", ["get", "peak_m"]], " m"],
30380
30471
  "text-font": FONT,
@@ -30848,7 +30939,8 @@ function generateStyle(palette = "DAY", opts = {}) {
30848
30939
  label: buildLabelLayer2(objectClass, palette, sourceId, opts.depthUnits ?? "meters", {
30849
30940
  safetyContour: opts.safetyContour,
30850
30941
  twoShadeSoundings: opts.twoShadeSoundings,
30851
- soundingFontWeight: opts.soundingFontWeight
30942
+ soundingFontWeight: opts.soundingFontWeight,
30943
+ depthLabelSize: opts.depthLabelSize
30852
30944
  })
30853
30945
  });
30854
30946
  }
@@ -32195,6 +32287,7 @@ var Chrt = class {
32195
32287
  ChrtError,
32196
32288
  DEFAULT_CLICK_TOLERANCE,
32197
32289
  DEFAULT_CUSTOM_STYLE_CONFIG,
32290
+ DEFAULT_DEPTH_LABEL_SIZE,
32198
32291
  DEFAULT_INSPECT_CLASS_RANK,
32199
32292
  DEFAULT_LABEL_SETTINGS,
32200
32293
  DEFAULT_NAV_AID_SETTINGS,
@@ -32206,6 +32299,8 @@ var Chrt = class {
32206
32299
  DEFAULT_WATER_BODY_SETTINGS,
32207
32300
  DEPARE_FILL_BRANCH_TOKENS,
32208
32301
  DEPARE_FILL_FALLBACK_TOKEN,
32302
+ DEPTH_LABEL_CLASSES,
32303
+ DEPTH_LABEL_SIZES,
32209
32304
  DRAPEABLE_LAYER_TYPES,
32210
32305
  INSPECT_CLASS_RANK,
32211
32306
  INSPECT_RANK_DEVIATIONS,
@@ -32222,6 +32317,7 @@ var Chrt = class {
32222
32317
  LAND_ATTRIBUTION,
32223
32318
  LAND_BUILD_MAXZOOM,
32224
32319
  LAND_REGION,
32320
+ LARGE_SOUNDING_PADDING_PX,
32225
32321
  NAUTICAL_SYMBOLS,
32226
32322
  NAV_AID_LAYER_GROUPS,
32227
32323
  NAV_AID_QUERY_LAYERS,
@@ -32276,6 +32372,7 @@ var Chrt = class {
32276
32372
  applyChrtSymbolSet,
32277
32373
  applyColorTheme,
32278
32374
  applyCustomStyleSettings,
32375
+ applyDepthLabelSize,
32279
32376
  applyRasterSymbolSet,
32280
32377
  applyS101SymbolSet,
32281
32378
  atonIconExpression,
@@ -32356,6 +32453,7 @@ var Chrt = class {
32356
32453
  isDepthAreaClassLayerId,
32357
32454
  isDrapeable,
32358
32455
  isLabelLayerVisible,
32456
+ isMapLive,
32359
32457
  isNavAidLayer,
32360
32458
  isNavAidLayerVisible,
32361
32459
  isSoundingLayerVisible,
@@ -32373,6 +32471,7 @@ var Chrt = class {
32373
32471
  normalizeTheme,
32374
32472
  opaqueSplitBaseOf,
32375
32473
  paginate,
32474
+ parseDepthLabelSize,
32376
32475
  parseListCodes,
32377
32476
  parseSigseqTerms,
32378
32477
  parseSymbolFamily,