@chrtco/sdk 0.10.43 → 0.10.44
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 +12 -0
- package/dist/atlas/browser.cjs +135 -36
- package/dist/atlas/browser.cjs.map +1 -1
- package/dist/atlas/browser.d.cts +26 -0
- package/dist/atlas/browser.d.ts +26 -0
- package/dist/atlas/browser.js +135 -36
- package/dist/atlas/browser.js.map +1 -1
- package/dist/index.cjs +87 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +27 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +79 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -66,6 +66,8 @@ __export(index_exports, {
|
|
|
66
66
|
DEFAULT_TILE_BASE_URL: () => DEFAULT_TILE_BASE_URL,
|
|
67
67
|
DEFAULT_TILE_REGION: () => DEFAULT_TILE_REGION,
|
|
68
68
|
DEFAULT_WATER_BODY_SETTINGS: () => DEFAULT_WATER_BODY_SETTINGS,
|
|
69
|
+
DEPARE_FILL_BRANCH_TOKENS: () => DEPARE_FILL_BRANCH_TOKENS,
|
|
70
|
+
DEPARE_FILL_FALLBACK_TOKEN: () => DEPARE_FILL_FALLBACK_TOKEN,
|
|
69
71
|
DRAPEABLE_LAYER_TYPES: () => DRAPEABLE_LAYER_TYPES,
|
|
70
72
|
INSPECT_CLASS_RANK: () => INSPECT_CLASS_RANK,
|
|
71
73
|
INSPECT_RANK_DEVIATIONS: () => INSPECT_RANK_DEVIATIONS,
|
|
@@ -89,6 +91,7 @@ __export(index_exports, {
|
|
|
89
91
|
NIGHT_MUTED_INK: () => NIGHT_MUTED_INK,
|
|
90
92
|
NON_SOLAS_DISCLAIMER: () => NON_SOLAS_DISCLAIMER,
|
|
91
93
|
NON_SOLAS_DISCLAIMER_SHORT: () => NON_SOLAS_DISCLAIMER_SHORT,
|
|
94
|
+
OPAQUE_SPLIT_OF: () => OPAQUE_SPLIT_OF,
|
|
92
95
|
OfflineError: () => OfflineError,
|
|
93
96
|
OfflineStyleError: () => OfflineStyleError,
|
|
94
97
|
PLACENAME_LAND_CLASSES: () => PLACENAME_LAND_CLASSES,
|
|
@@ -175,6 +178,8 @@ __export(index_exports, {
|
|
|
175
178
|
decodeNavAidProps: () => decodeNavAidProps,
|
|
176
179
|
depareColor: () => depareColor,
|
|
177
180
|
depareFillExpression: () => depareFillExpression,
|
|
181
|
+
depthAreaClassLayerId: () => depthAreaClassLayerId,
|
|
182
|
+
depthAreaSplitIds: () => depthAreaSplitIds,
|
|
178
183
|
deriveMarinerName: () => deriveMarinerName,
|
|
179
184
|
drapeHalves: () => drapeHalves,
|
|
180
185
|
drapedFirst: () => drapedFirst,
|
|
@@ -210,6 +215,7 @@ __export(index_exports, {
|
|
|
210
215
|
hazardColor: () => hazardColor,
|
|
211
216
|
hazardFillExpression: () => hazardFillExpression,
|
|
212
217
|
iconExpressionForFamily: () => iconExpressionForFamily,
|
|
218
|
+
isDepthAreaClassLayerId: () => isDepthAreaClassLayerId,
|
|
213
219
|
isDrapeable: () => isDrapeable,
|
|
214
220
|
isLabelLayerVisible: () => isLabelLayerVisible,
|
|
215
221
|
isNavAidLayer: () => isNavAidLayer,
|
|
@@ -227,6 +233,7 @@ __export(index_exports, {
|
|
|
227
233
|
lightsIconExpression: () => lightsIconExpression,
|
|
228
234
|
normalizeStyleMode: () => normalizeStyleMode,
|
|
229
235
|
normalizeTheme: () => normalizeTheme,
|
|
236
|
+
opaqueSplitBaseOf: () => opaqueSplitBaseOf,
|
|
230
237
|
paginate: () => paginate,
|
|
231
238
|
parseListCodes: () => parseListCodes,
|
|
232
239
|
parseSigseqTerms: () => parseSigseqTerms,
|
|
@@ -252,6 +259,7 @@ __export(index_exports, {
|
|
|
252
259
|
scaleSizeValue: () => scaleSizeValue,
|
|
253
260
|
scaminToMinZoom: () => scaminToMinZoom,
|
|
254
261
|
sectorLimitToArcBearing: () => sectorLimitToArcBearing,
|
|
262
|
+
splitOpaqueDepthAreas: () => splitOpaqueDepthAreas,
|
|
255
263
|
styleModeBand: () => styleModeBand,
|
|
256
264
|
terrainStackCount: () => terrainStackCount,
|
|
257
265
|
themeChrtGlyph: () => themeChrtGlyph,
|
|
@@ -5974,8 +5982,11 @@ function depareColor(props, ct = "DAY", safetyContourM = DEFAULT_SAFETY_CONTOUR_
|
|
|
5974
5982
|
if (drval1 < DEPARE_DEEP_CUT_M) return resolveColor("DEPMD", ct);
|
|
5975
5983
|
return resolveColor("DEPDW", ct);
|
|
5976
5984
|
}
|
|
5985
|
+
var DEPARE_FILL_BRANCH_TOKENS = ["DEPIT", "DEPVS", "DEPMS", "DEPMD"];
|
|
5986
|
+
var DEPARE_FILL_FALLBACK_TOKEN = "DEPDW";
|
|
5977
5987
|
function depareFillExpression(ct = "DAY", safetyContourM = DEFAULT_SAFETY_CONTOUR_M) {
|
|
5978
5988
|
const safety = effectiveSafetyContour(safetyContourM);
|
|
5989
|
+
const [it, vs, ms, md] = DEPARE_FILL_BRANCH_TOKENS;
|
|
5979
5990
|
return [
|
|
5980
5991
|
"case",
|
|
5981
5992
|
[
|
|
@@ -5983,14 +5994,14 @@ function depareFillExpression(ct = "DAY", safetyContourM = DEFAULT_SAFETY_CONTOU
|
|
|
5983
5994
|
["<", ["coalesce", ["get", "DRVAL1"], ["get", "drval1"], -1], 0],
|
|
5984
5995
|
["<=", ["coalesce", ["get", "DRVAL2"], ["get", "drval2"], 0], 0]
|
|
5985
5996
|
],
|
|
5986
|
-
resolveColor(
|
|
5997
|
+
resolveColor(it, ct),
|
|
5987
5998
|
["<", ["coalesce", ["get", "DRVAL1"], ["get", "drval1"], -1], DEPARE_SHALLOW_CUT_M],
|
|
5988
|
-
resolveColor(
|
|
5999
|
+
resolveColor(vs, ct),
|
|
5989
6000
|
["<", ["coalesce", ["get", "DRVAL1"], ["get", "drval1"], -1], safety],
|
|
5990
|
-
resolveColor(
|
|
6001
|
+
resolveColor(ms, ct),
|
|
5991
6002
|
["<", ["coalesce", ["get", "DRVAL1"], ["get", "drval1"], -1], DEPARE_DEEP_CUT_M],
|
|
5992
|
-
resolveColor(
|
|
5993
|
-
resolveColor(
|
|
6003
|
+
resolveColor(md, ct),
|
|
6004
|
+
resolveColor(DEPARE_FILL_FALLBACK_TOKEN, ct)
|
|
5994
6005
|
];
|
|
5995
6006
|
}
|
|
5996
6007
|
function listAttrString(attr) {
|
|
@@ -31661,6 +31672,69 @@ function generateCustomStyle(config, opts = {}) {
|
|
|
31661
31672
|
return { style, palette, themeFellBack };
|
|
31662
31673
|
}
|
|
31663
31674
|
|
|
31675
|
+
// src/atlas/depth-area-opaque.ts
|
|
31676
|
+
var OPAQUE_SPLIT_OF = "chrt:opaqueSplitOf";
|
|
31677
|
+
function depthAreaClassLayerId(baseId, token) {
|
|
31678
|
+
return `chrt-${token.toLowerCase()}-of-${baseId.replace(/-band(\d)/g, "-b$1")}`;
|
|
31679
|
+
}
|
|
31680
|
+
function depthAreaSplitIds(baseId) {
|
|
31681
|
+
return [...DEPARE_FILL_BRANCH_TOKENS].reverse().map((token) => depthAreaClassLayerId(baseId, token));
|
|
31682
|
+
}
|
|
31683
|
+
var CLASS_LAYER_ID = new RegExp(
|
|
31684
|
+
`^chrt-(?:${DEPARE_FILL_BRANCH_TOKENS.map((t) => t.toLowerCase()).join("|")})-of-`
|
|
31685
|
+
);
|
|
31686
|
+
function isDepthAreaClassLayerId(id) {
|
|
31687
|
+
return CLASS_LAYER_ID.test(id);
|
|
31688
|
+
}
|
|
31689
|
+
function opaqueSplitBaseOf(layer) {
|
|
31690
|
+
const meta = layer.metadata;
|
|
31691
|
+
const base = meta?.[OPAQUE_SPLIT_OF];
|
|
31692
|
+
return typeof base === "string" ? base : null;
|
|
31693
|
+
}
|
|
31694
|
+
function exclusiveBranches(expression) {
|
|
31695
|
+
if (!Array.isArray(expression) || expression[0] !== "case") return null;
|
|
31696
|
+
if ((expression.length - 2) / 2 !== DEPARE_FILL_BRANCH_TOKENS.length) return null;
|
|
31697
|
+
const branches = [];
|
|
31698
|
+
const earlier = [];
|
|
31699
|
+
for (let i = 1; i < expression.length - 1; i += 2) {
|
|
31700
|
+
const colour = expression[i + 1];
|
|
31701
|
+
if (typeof colour !== "string") return null;
|
|
31702
|
+
branches.push({ when: [...earlier.map((c) => ["!", c]), expression[i]], colour });
|
|
31703
|
+
earlier.push(expression[i]);
|
|
31704
|
+
}
|
|
31705
|
+
const fallback = expression[expression.length - 1];
|
|
31706
|
+
if (typeof fallback !== "string") return null;
|
|
31707
|
+
return { branches, fallback };
|
|
31708
|
+
}
|
|
31709
|
+
function andFilter(base, terms) {
|
|
31710
|
+
if (Array.isArray(base) && base[0] === "all") return ["all", ...base.slice(1), ...terms];
|
|
31711
|
+
if (base === void 0) return ["all", ...terms];
|
|
31712
|
+
return ["all", base, ...terms];
|
|
31713
|
+
}
|
|
31714
|
+
function splitOpaqueDepthAreas(layers) {
|
|
31715
|
+
const out = [];
|
|
31716
|
+
for (const raw of layers) {
|
|
31717
|
+
const layer = raw;
|
|
31718
|
+
const paint = layer.paint ?? {};
|
|
31719
|
+
const split = layer.type === "fill" && layer.metadata?.["s52:objectClass"] === "DEPARE" && paint["fill-pattern"] === void 0 && (paint["fill-opacity"] === void 0 || paint["fill-opacity"] === 1) ? exclusiveBranches(paint["fill-color"]) : null;
|
|
31720
|
+
if (split === null) {
|
|
31721
|
+
out.push(raw);
|
|
31722
|
+
continue;
|
|
31723
|
+
}
|
|
31724
|
+
out.push({ ...layer, paint: { ...paint, "fill-color": split.fallback } });
|
|
31725
|
+
for (let k = split.branches.length - 1; k >= 0; k -= 1) {
|
|
31726
|
+
out.push({
|
|
31727
|
+
...layer,
|
|
31728
|
+
id: depthAreaClassLayerId(layer.id, DEPARE_FILL_BRANCH_TOKENS[k]),
|
|
31729
|
+
filter: andFilter(layer.filter, split.branches[k].when),
|
|
31730
|
+
paint: { ...paint, "fill-color": split.branches[k].colour },
|
|
31731
|
+
metadata: { ...layer.metadata ?? {}, [OPAQUE_SPLIT_OF]: layer.id }
|
|
31732
|
+
});
|
|
31733
|
+
}
|
|
31734
|
+
}
|
|
31735
|
+
return out;
|
|
31736
|
+
}
|
|
31737
|
+
|
|
31664
31738
|
// src/pagination.ts
|
|
31665
31739
|
async function* paginate(fetchPage, getItems, getTotalCount, options) {
|
|
31666
31740
|
const pageSize = options?.pageSize ?? 100;
|
|
@@ -32130,6 +32204,8 @@ var Chrt = class {
|
|
|
32130
32204
|
DEFAULT_TILE_BASE_URL,
|
|
32131
32205
|
DEFAULT_TILE_REGION,
|
|
32132
32206
|
DEFAULT_WATER_BODY_SETTINGS,
|
|
32207
|
+
DEPARE_FILL_BRANCH_TOKENS,
|
|
32208
|
+
DEPARE_FILL_FALLBACK_TOKEN,
|
|
32133
32209
|
DRAPEABLE_LAYER_TYPES,
|
|
32134
32210
|
INSPECT_CLASS_RANK,
|
|
32135
32211
|
INSPECT_RANK_DEVIATIONS,
|
|
@@ -32153,6 +32229,7 @@ var Chrt = class {
|
|
|
32153
32229
|
NIGHT_MUTED_INK,
|
|
32154
32230
|
NON_SOLAS_DISCLAIMER,
|
|
32155
32231
|
NON_SOLAS_DISCLAIMER_SHORT,
|
|
32232
|
+
OPAQUE_SPLIT_OF,
|
|
32156
32233
|
OfflineError,
|
|
32157
32234
|
OfflineStyleError,
|
|
32158
32235
|
PLACENAME_LAND_CLASSES,
|
|
@@ -32239,6 +32316,8 @@ var Chrt = class {
|
|
|
32239
32316
|
decodeNavAidProps,
|
|
32240
32317
|
depareColor,
|
|
32241
32318
|
depareFillExpression,
|
|
32319
|
+
depthAreaClassLayerId,
|
|
32320
|
+
depthAreaSplitIds,
|
|
32242
32321
|
deriveMarinerName,
|
|
32243
32322
|
drapeHalves,
|
|
32244
32323
|
drapedFirst,
|
|
@@ -32274,6 +32353,7 @@ var Chrt = class {
|
|
|
32274
32353
|
hazardColor,
|
|
32275
32354
|
hazardFillExpression,
|
|
32276
32355
|
iconExpressionForFamily,
|
|
32356
|
+
isDepthAreaClassLayerId,
|
|
32277
32357
|
isDrapeable,
|
|
32278
32358
|
isLabelLayerVisible,
|
|
32279
32359
|
isNavAidLayer,
|
|
@@ -32291,6 +32371,7 @@ var Chrt = class {
|
|
|
32291
32371
|
lightsIconExpression,
|
|
32292
32372
|
normalizeStyleMode,
|
|
32293
32373
|
normalizeTheme,
|
|
32374
|
+
opaqueSplitBaseOf,
|
|
32294
32375
|
paginate,
|
|
32295
32376
|
parseListCodes,
|
|
32296
32377
|
parseSigseqTerms,
|
|
@@ -32316,6 +32397,7 @@ var Chrt = class {
|
|
|
32316
32397
|
scaleSizeValue,
|
|
32317
32398
|
scaminToMinZoom,
|
|
32318
32399
|
sectorLimitToArcBearing,
|
|
32400
|
+
splitOpaqueDepthAreas,
|
|
32319
32401
|
styleModeBand,
|
|
32320
32402
|
terrainStackCount,
|
|
32321
32403
|
themeChrtGlyph,
|