@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/CHANGELOG.md +28 -8
- package/README.md +31 -10
- package/dist/atlas/browser.cjs +5 -21
- package/dist/atlas/browser.cjs.map +1 -1
- package/dist/atlas/browser.js +5 -21
- package/dist/atlas/browser.js.map +1 -1
- package/dist/index.cjs +78 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2473 -2329
- package/dist/index.d.ts +2473 -2329
- package/dist/index.js +72 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -465,7 +465,9 @@ var TilesEndpoint = class {
|
|
|
465
465
|
const params = new URLSearchParams();
|
|
466
466
|
if (opts.theme) params.set("theme", opts.theme);
|
|
467
467
|
if (opts.symbols) params.set("symbols", opts.symbols);
|
|
468
|
+
if (opts.look) params.set("look", opts.look);
|
|
468
469
|
if (opts.mode) params.set("mode", opts.mode);
|
|
470
|
+
if (opts.lock) params.set("lock", opts.lock);
|
|
469
471
|
if (opts.land) params.set("land", "1");
|
|
470
472
|
if (opts.relief) params.set("relief", "1");
|
|
471
473
|
if (opts.units === "imperial") params.set("units", "imperial");
|
|
@@ -31936,8 +31938,11 @@ function washTint(cls, id, tints) {
|
|
|
31936
31938
|
if (cls === "LAKARE" || id === "chrtland-water" || id === "paper-base-lakes") return tints.lake;
|
|
31937
31939
|
return null;
|
|
31938
31940
|
}
|
|
31941
|
+
function lookSprite(style, look) {
|
|
31942
|
+
return typeof style.sprite === "string" ? { sprite: style.sprite.replace(/-day$/, `-look_${look}`) } : {};
|
|
31943
|
+
}
|
|
31939
31944
|
function withLook(style, look, opts = {}) {
|
|
31940
|
-
if (look === "paper") return withClassic(style);
|
|
31945
|
+
if (look === "paper") return { ...withClassic(style), ...lookSprite(style, look) };
|
|
31941
31946
|
const tone = LOOK_TONES[look];
|
|
31942
31947
|
const ink = tone.ink;
|
|
31943
31948
|
const tints = look === "handcolored" && opts.tints !== false ? WASH_TINTS : null;
|
|
@@ -32037,10 +32042,7 @@ function withLook(style, look, opts = {}) {
|
|
|
32037
32042
|
});
|
|
32038
32043
|
return {
|
|
32039
32044
|
...style,
|
|
32040
|
-
|
|
32041
|
-
// both looks: the day sheet's magenta anchors and light flares read as a
|
|
32042
|
-
// modern chart under the wash.
|
|
32043
|
-
...typeof style.sprite === "string" ? { sprite: style.sprite.replace(/-day$/, "-eink_mono") } : {},
|
|
32045
|
+
...lookSprite(style, look),
|
|
32044
32046
|
sources: {
|
|
32045
32047
|
...style.sources,
|
|
32046
32048
|
[LOOK_WATERLINES_SOURCE]: { type: "geojson", data: { type: "FeatureCollection", features: [] } }
|
|
@@ -33645,8 +33647,8 @@ var SYMBOL_SET_LABELS = {
|
|
|
33645
33647
|
var SPRITE_SHEET_FAMILY = {
|
|
33646
33648
|
s52: "s52",
|
|
33647
33649
|
chrt: "chrt",
|
|
33648
|
-
int1: "
|
|
33649
|
-
uschart1: "
|
|
33650
|
+
int1: "int1",
|
|
33651
|
+
uschart1: "uschart1"
|
|
33650
33652
|
};
|
|
33651
33653
|
function applySymbolFamily(style, family, palette) {
|
|
33652
33654
|
switch (family) {
|
|
@@ -34869,7 +34871,7 @@ function applyCustomStyleSettings(style, config) {
|
|
|
34869
34871
|
}
|
|
34870
34872
|
function generateCustomStyle(config, opts = {}) {
|
|
34871
34873
|
const { theme, ...generatorOpts } = opts;
|
|
34872
|
-
const { palette, themeFellBack } = resolveCustomTheme(config, theme ?? null);
|
|
34874
|
+
const { palette, themeFellBack } = generatorOpts.look !== void 0 ? { palette: "DAY", themeFellBack: theme != null && theme !== "DAY" } : resolveCustomTheme(config, theme ?? null);
|
|
34873
34875
|
const style = generateStyle(palette, {
|
|
34874
34876
|
...generatorOpts,
|
|
34875
34877
|
safetyContour: config.sounding_settings.safetyContour,
|
|
@@ -35182,6 +35184,62 @@ function withChartReduction(layers, floor, options = {}) {
|
|
|
35182
35184
|
});
|
|
35183
35185
|
}
|
|
35184
35186
|
|
|
35187
|
+
// src/atlas/served-chart-lock.ts
|
|
35188
|
+
var ONLY_SUFFIX = ":only";
|
|
35189
|
+
var CHART_LOCK_PARAMS = CHART_LOCK_BANDS.flatMap(({ name }) => {
|
|
35190
|
+
const band = name.toLowerCase();
|
|
35191
|
+
return [band, `${band}${ONLY_SUFFIX}`];
|
|
35192
|
+
});
|
|
35193
|
+
function chartLockParam(lock) {
|
|
35194
|
+
const band = chartLockBandInfo(lock.band).name.toLowerCase();
|
|
35195
|
+
return lock.bandOnly ? `${band}${ONLY_SUFFIX}` : band;
|
|
35196
|
+
}
|
|
35197
|
+
function parseChartLock(raw) {
|
|
35198
|
+
const lower = raw.toLowerCase();
|
|
35199
|
+
const bandOnly = lower.endsWith(ONLY_SUFFIX);
|
|
35200
|
+
const name = bandOnly ? lower.slice(0, -ONLY_SUFFIX.length) : lower;
|
|
35201
|
+
const info = CHART_LOCK_BANDS.find((b) => b.name.toLowerCase() === name);
|
|
35202
|
+
return info ? { band: info.band, bandOnly } : null;
|
|
35203
|
+
}
|
|
35204
|
+
function chartLockGeneratorOptions(lock) {
|
|
35205
|
+
return lock?.bandOnly ? { chartMode: chartLockStyleMode(lock.band) } : {};
|
|
35206
|
+
}
|
|
35207
|
+
function servedChartLockMetadata(lock) {
|
|
35208
|
+
const info = chartLockBandInfo(lock.band);
|
|
35209
|
+
return {
|
|
35210
|
+
"chrt:lock": chartLockParam(lock),
|
|
35211
|
+
"chrt:lock-band": info.name,
|
|
35212
|
+
"chrt:lock-floor": info.floor,
|
|
35213
|
+
"chrt:lock-min-zoom": chartLockMinZoom(lock.band),
|
|
35214
|
+
"chrt:lock-band-only": lock.bandOnly
|
|
35215
|
+
};
|
|
35216
|
+
}
|
|
35217
|
+
function withServedChartLock(style, lock, chartSource) {
|
|
35218
|
+
const info = chartLockBandInfo(lock.band);
|
|
35219
|
+
const param = chartLockParam(lock);
|
|
35220
|
+
const layers = withChartReduction(style.layers, info.floor, {
|
|
35221
|
+
decideAt: chartLockDecisionZoom(lock.band, lock.bandOnly)
|
|
35222
|
+
});
|
|
35223
|
+
let sources = style.sources;
|
|
35224
|
+
const chart = style.sources[chartSource];
|
|
35225
|
+
if (lock.bandOnly && chart !== null && typeof chart === "object") {
|
|
35226
|
+
const current = chart.maxzoom;
|
|
35227
|
+
const maxzoom = chartLockSourceMaxzoom(lock.band, typeof current === "number" ? current : CHART_ARCHIVE_MAXZOOM);
|
|
35228
|
+
sources = { ...style.sources, [chartSource]: { ...chart, maxzoom } };
|
|
35229
|
+
}
|
|
35230
|
+
return {
|
|
35231
|
+
...style,
|
|
35232
|
+
name: `${style.name.replace(/ — chart:[A-Za-z]+$/, "")} \u2014 lock:${param}`,
|
|
35233
|
+
metadata: {
|
|
35234
|
+
...style.metadata,
|
|
35235
|
+
"chrt:render-mode": "continuous",
|
|
35236
|
+
...servedChartLockMetadata(lock)
|
|
35237
|
+
},
|
|
35238
|
+
sources,
|
|
35239
|
+
layers
|
|
35240
|
+
};
|
|
35241
|
+
}
|
|
35242
|
+
|
|
35185
35243
|
// src/pagination.ts
|
|
35186
35244
|
async function* paginate(fetchPage, getItems, getTotalCount, options) {
|
|
35187
35245
|
const pageSize = options?.pageSize ?? 100;
|
|
@@ -35631,6 +35689,7 @@ export {
|
|
|
35631
35689
|
CHART_BAND_CODES,
|
|
35632
35690
|
CHART_CASCADE_CODES,
|
|
35633
35691
|
CHART_LOCK_BANDS,
|
|
35692
|
+
CHART_LOCK_PARAMS,
|
|
35634
35693
|
CHART_LOOKS,
|
|
35635
35694
|
CHART_SECTIONS,
|
|
35636
35695
|
CHART_SOUNDINGS_RULE,
|
|
@@ -35826,7 +35885,9 @@ export {
|
|
|
35826
35885
|
chartLockBandInfo,
|
|
35827
35886
|
chartLockDecisionZoom,
|
|
35828
35887
|
chartLockFloor,
|
|
35888
|
+
chartLockGeneratorOptions,
|
|
35829
35889
|
chartLockMinZoom,
|
|
35890
|
+
chartLockParam,
|
|
35830
35891
|
chartLockSourceMaxzoom,
|
|
35831
35892
|
chartLockStyleMode,
|
|
35832
35893
|
chartSymbolSizingCensus,
|
|
@@ -35944,6 +36005,7 @@ export {
|
|
|
35944
36005
|
normalizeTheme,
|
|
35945
36006
|
opaqueSplitBaseOf,
|
|
35946
36007
|
paginate,
|
|
36008
|
+
parseChartLock,
|
|
35947
36009
|
parseChartLook,
|
|
35948
36010
|
parseListCodes,
|
|
35949
36011
|
parseSigseqTerms,
|
|
@@ -35973,6 +36035,7 @@ export {
|
|
|
35973
36035
|
seafloorLayers,
|
|
35974
36036
|
sectorLimitToArcBearing,
|
|
35975
36037
|
semiboldFontStack,
|
|
36038
|
+
servedChartLockMetadata,
|
|
35976
36039
|
snapChartSymbolScale,
|
|
35977
36040
|
soundingPadding,
|
|
35978
36041
|
soundingPaddingValue,
|
|
@@ -35988,6 +36051,7 @@ export {
|
|
|
35988
36051
|
withChartReduction,
|
|
35989
36052
|
withClassicMarks,
|
|
35990
36053
|
withLook,
|
|
36054
|
+
withServedChartLock,
|
|
35991
36055
|
withWaterLines,
|
|
35992
36056
|
withinBboxFilter,
|
|
35993
36057
|
worldMinusBboxPolygon
|