@chrtco/sdk 0.10.56 → 0.10.57

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
@@ -46,6 +46,7 @@ __export(index_exports, {
46
46
  CHART_BAND_CODES: () => CHART_BAND_CODES,
47
47
  CHART_CASCADE_CODES: () => CHART_CASCADE_CODES,
48
48
  CHART_LOCK_BANDS: () => CHART_LOCK_BANDS,
49
+ CHART_LOCK_PARAMS: () => CHART_LOCK_PARAMS,
49
50
  CHART_LOOKS: () => CHART_LOOKS,
50
51
  CHART_SECTIONS: () => CHART_SECTIONS,
51
52
  CHART_SOUNDINGS_RULE: () => CHART_SOUNDINGS_RULE,
@@ -241,7 +242,9 @@ __export(index_exports, {
241
242
  chartLockBandInfo: () => chartLockBandInfo,
242
243
  chartLockDecisionZoom: () => chartLockDecisionZoom,
243
244
  chartLockFloor: () => chartLockFloor,
245
+ chartLockGeneratorOptions: () => chartLockGeneratorOptions,
244
246
  chartLockMinZoom: () => chartLockMinZoom,
247
+ chartLockParam: () => chartLockParam,
245
248
  chartLockSourceMaxzoom: () => chartLockSourceMaxzoom,
246
249
  chartLockStyleMode: () => chartLockStyleMode,
247
250
  chartSymbolSizingCensus: () => chartSymbolSizingCensus,
@@ -359,6 +362,7 @@ __export(index_exports, {
359
362
  normalizeTheme: () => normalizeTheme,
360
363
  opaqueSplitBaseOf: () => opaqueSplitBaseOf,
361
364
  paginate: () => paginate,
365
+ parseChartLock: () => parseChartLock,
362
366
  parseChartLook: () => parseChartLook,
363
367
  parseListCodes: () => parseListCodes,
364
368
  parseSigseqTerms: () => parseSigseqTerms,
@@ -388,6 +392,7 @@ __export(index_exports, {
388
392
  seafloorLayers: () => seafloorLayers,
389
393
  sectorLimitToArcBearing: () => sectorLimitToArcBearing,
390
394
  semiboldFontStack: () => semiboldFontStack,
395
+ servedChartLockMetadata: () => servedChartLockMetadata,
391
396
  snapChartSymbolScale: () => snapChartSymbolScale,
392
397
  soundingPadding: () => soundingPadding,
393
398
  soundingPaddingValue: () => soundingPaddingValue,
@@ -403,6 +408,7 @@ __export(index_exports, {
403
408
  withChartReduction: () => withChartReduction,
404
409
  withClassicMarks: () => withClassicMarks,
405
410
  withLook: () => withLook,
411
+ withServedChartLock: () => withServedChartLock,
406
412
  withWaterLines: () => withWaterLines,
407
413
  withinBboxFilter: () => withinBboxFilter,
408
414
  worldMinusBboxPolygon: () => worldMinusBboxPolygon
@@ -876,7 +882,9 @@ var TilesEndpoint = class {
876
882
  const params = new URLSearchParams();
877
883
  if (opts.theme) params.set("theme", opts.theme);
878
884
  if (opts.symbols) params.set("symbols", opts.symbols);
885
+ if (opts.look) params.set("look", opts.look);
879
886
  if (opts.mode) params.set("mode", opts.mode);
887
+ if (opts.lock) params.set("lock", opts.lock);
880
888
  if (opts.land) params.set("land", "1");
881
889
  if (opts.relief) params.set("relief", "1");
882
890
  if (opts.units === "imperial") params.set("units", "imperial");
@@ -32347,8 +32355,11 @@ function washTint(cls, id, tints) {
32347
32355
  if (cls === "LAKARE" || id === "chrtland-water" || id === "paper-base-lakes") return tints.lake;
32348
32356
  return null;
32349
32357
  }
32358
+ function lookSprite(style, look) {
32359
+ return typeof style.sprite === "string" ? { sprite: style.sprite.replace(/-day$/, `-look_${look}`) } : {};
32360
+ }
32350
32361
  function withLook(style, look, opts = {}) {
32351
- if (look === "paper") return withClassic(style);
32362
+ if (look === "paper") return { ...withClassic(style), ...lookSprite(style, look) };
32352
32363
  const tone = LOOK_TONES[look];
32353
32364
  const ink = tone.ink;
32354
32365
  const tints = look === "handcolored" && opts.tints !== false ? WASH_TINTS : null;
@@ -32448,10 +32459,7 @@ function withLook(style, look, opts = {}) {
32448
32459
  });
32449
32460
  return {
32450
32461
  ...style,
32451
- // The black & white sheet's symbols, the same INT-1 shapes in black, on
32452
- // both looks: the day sheet's magenta anchors and light flares read as a
32453
- // modern chart under the wash.
32454
- ...typeof style.sprite === "string" ? { sprite: style.sprite.replace(/-day$/, "-eink_mono") } : {},
32462
+ ...lookSprite(style, look),
32455
32463
  sources: {
32456
32464
  ...style.sources,
32457
32465
  [LOOK_WATERLINES_SOURCE]: { type: "geojson", data: { type: "FeatureCollection", features: [] } }
@@ -34056,8 +34064,8 @@ var SYMBOL_SET_LABELS = {
34056
34064
  var SPRITE_SHEET_FAMILY = {
34057
34065
  s52: "s52",
34058
34066
  chrt: "chrt",
34059
- int1: "raster",
34060
- uschart1: "raster"
34067
+ int1: "int1",
34068
+ uschart1: "uschart1"
34061
34069
  };
34062
34070
  function applySymbolFamily(style, family, palette) {
34063
34071
  switch (family) {
@@ -35280,7 +35288,7 @@ function applyCustomStyleSettings(style, config) {
35280
35288
  }
35281
35289
  function generateCustomStyle(config, opts = {}) {
35282
35290
  const { theme, ...generatorOpts } = opts;
35283
- const { palette, themeFellBack } = resolveCustomTheme(config, theme ?? null);
35291
+ const { palette, themeFellBack } = generatorOpts.look !== void 0 ? { palette: "DAY", themeFellBack: theme != null && theme !== "DAY" } : resolveCustomTheme(config, theme ?? null);
35284
35292
  const style = generateStyle(palette, {
35285
35293
  ...generatorOpts,
35286
35294
  safetyContour: config.sounding_settings.safetyContour,
@@ -35593,6 +35601,62 @@ function withChartReduction(layers, floor, options = {}) {
35593
35601
  });
35594
35602
  }
35595
35603
 
35604
+ // src/atlas/served-chart-lock.ts
35605
+ var ONLY_SUFFIX = ":only";
35606
+ var CHART_LOCK_PARAMS = CHART_LOCK_BANDS.flatMap(({ name }) => {
35607
+ const band = name.toLowerCase();
35608
+ return [band, `${band}${ONLY_SUFFIX}`];
35609
+ });
35610
+ function chartLockParam(lock) {
35611
+ const band = chartLockBandInfo(lock.band).name.toLowerCase();
35612
+ return lock.bandOnly ? `${band}${ONLY_SUFFIX}` : band;
35613
+ }
35614
+ function parseChartLock(raw) {
35615
+ const lower = raw.toLowerCase();
35616
+ const bandOnly = lower.endsWith(ONLY_SUFFIX);
35617
+ const name = bandOnly ? lower.slice(0, -ONLY_SUFFIX.length) : lower;
35618
+ const info = CHART_LOCK_BANDS.find((b) => b.name.toLowerCase() === name);
35619
+ return info ? { band: info.band, bandOnly } : null;
35620
+ }
35621
+ function chartLockGeneratorOptions(lock) {
35622
+ return lock?.bandOnly ? { chartMode: chartLockStyleMode(lock.band) } : {};
35623
+ }
35624
+ function servedChartLockMetadata(lock) {
35625
+ const info = chartLockBandInfo(lock.band);
35626
+ return {
35627
+ "chrt:lock": chartLockParam(lock),
35628
+ "chrt:lock-band": info.name,
35629
+ "chrt:lock-floor": info.floor,
35630
+ "chrt:lock-min-zoom": chartLockMinZoom(lock.band),
35631
+ "chrt:lock-band-only": lock.bandOnly
35632
+ };
35633
+ }
35634
+ function withServedChartLock(style, lock, chartSource) {
35635
+ const info = chartLockBandInfo(lock.band);
35636
+ const param = chartLockParam(lock);
35637
+ const layers = withChartReduction(style.layers, info.floor, {
35638
+ decideAt: chartLockDecisionZoom(lock.band, lock.bandOnly)
35639
+ });
35640
+ let sources = style.sources;
35641
+ const chart = style.sources[chartSource];
35642
+ if (lock.bandOnly && chart !== null && typeof chart === "object") {
35643
+ const current = chart.maxzoom;
35644
+ const maxzoom = chartLockSourceMaxzoom(lock.band, typeof current === "number" ? current : CHART_ARCHIVE_MAXZOOM);
35645
+ sources = { ...style.sources, [chartSource]: { ...chart, maxzoom } };
35646
+ }
35647
+ return {
35648
+ ...style,
35649
+ name: `${style.name.replace(/ — chart:[A-Za-z]+$/, "")} \u2014 lock:${param}`,
35650
+ metadata: {
35651
+ ...style.metadata,
35652
+ "chrt:render-mode": "continuous",
35653
+ ...servedChartLockMetadata(lock)
35654
+ },
35655
+ sources,
35656
+ layers
35657
+ };
35658
+ }
35659
+
35596
35660
  // src/pagination.ts
35597
35661
  async function* paginate(fetchPage, getItems, getTotalCount, options) {
35598
35662
  const pageSize = options?.pageSize ?? 100;
@@ -36043,6 +36107,7 @@ var Chrt = class {
36043
36107
  CHART_BAND_CODES,
36044
36108
  CHART_CASCADE_CODES,
36045
36109
  CHART_LOCK_BANDS,
36110
+ CHART_LOCK_PARAMS,
36046
36111
  CHART_LOOKS,
36047
36112
  CHART_SECTIONS,
36048
36113
  CHART_SOUNDINGS_RULE,
@@ -36238,7 +36303,9 @@ var Chrt = class {
36238
36303
  chartLockBandInfo,
36239
36304
  chartLockDecisionZoom,
36240
36305
  chartLockFloor,
36306
+ chartLockGeneratorOptions,
36241
36307
  chartLockMinZoom,
36308
+ chartLockParam,
36242
36309
  chartLockSourceMaxzoom,
36243
36310
  chartLockStyleMode,
36244
36311
  chartSymbolSizingCensus,
@@ -36356,6 +36423,7 @@ var Chrt = class {
36356
36423
  normalizeTheme,
36357
36424
  opaqueSplitBaseOf,
36358
36425
  paginate,
36426
+ parseChartLock,
36359
36427
  parseChartLook,
36360
36428
  parseListCodes,
36361
36429
  parseSigseqTerms,
@@ -36385,6 +36453,7 @@ var Chrt = class {
36385
36453
  seafloorLayers,
36386
36454
  sectorLimitToArcBearing,
36387
36455
  semiboldFontStack,
36456
+ servedChartLockMetadata,
36388
36457
  snapChartSymbolScale,
36389
36458
  soundingPadding,
36390
36459
  soundingPaddingValue,
@@ -36400,6 +36469,7 @@ var Chrt = class {
36400
36469
  withChartReduction,
36401
36470
  withClassicMarks,
36402
36471
  withLook,
36472
+ withServedChartLock,
36403
36473
  withWaterLines,
36404
36474
  withinBboxFilter,
36405
36475
  worldMinusBboxPolygon