@chrtco/sdk 0.5.0 → 0.6.0

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.d.ts CHANGED
@@ -1,4 +1,8 @@
1
1
  import { F as FileSystemAdapter } from './fs-adapter-D5iwdb1Q.js';
2
+ import { C as ColorTableName } from './s52-colors-CdVzqt2K.js';
3
+ export { S as S52_COLORS, a as S52_DAY, b as S52_DUSK, c as S52_NIGHT, g as getColorTable, r as resolveColor } from './s52-colors-CdVzqt2K.js';
4
+ import maplibregl from 'maplibre-gl';
5
+ import { ExpressionSpecification } from '@maplibre/maplibre-gl-style-spec';
2
6
 
3
7
  /**
4
8
  * Pure helper: take an online MapLibre style and rewrite the named region's
@@ -632,6 +636,568 @@ declare class OfflineError extends Error {
632
636
  constructor(code: OfflineErrorCode, message: string, status?: number, detail?: Record<string, unknown>);
633
637
  }
634
638
 
639
+ /** S-52 display categories – controls default visibility */
640
+ type DisplayCategory = "BASE" | "STANDARD" | "OTHER" | "MARINERS" | "META";
641
+ /** Mapbox GL layer type we'll use for this entry */
642
+ type GeomType = "fill" | "line" | "circle" | "symbol";
643
+ /** Nautical groupings (loosely follows Chart No. 1 sections) */
644
+ type NauticalCategory = "Depths" | "Land" | "Navigation Aids" | "Hazards" | "Regulated Areas" | "Infrastructure" | "Meta";
645
+ /** Paint properties – a subset we actually use */
646
+ interface AtlasStyle {
647
+ type: GeomType;
648
+ paint: Record<string, unknown>;
649
+ layout?: Record<string, unknown>;
650
+ /** Nautical symbol ID for symbol-type layers */
651
+ iconImage?: string;
652
+ }
653
+ /** One row in the S-52 lookup table */
654
+ interface LookupEntry {
655
+ /** S-57 object class acronym */
656
+ objectClass: string;
657
+ /** Human-readable name */
658
+ name: string;
659
+ /** Chart No. 1 section */
660
+ category: NauticalCategory;
661
+ /** S-52 display category */
662
+ displayCategory: DisplayCategory;
663
+ /** Default style using S-52 color tokens (resolved later) */
664
+ style: AtlasStyle;
665
+ /** Whether conditional symbology may override the style */
666
+ hasConditional?: boolean;
667
+ /** Attributes that affect styling */
668
+ conditionalAttributes?: string[];
669
+ /** INT1 / Chart No. 1 reference (e.g. "Q130.1") */
670
+ int1Ref?: string;
671
+ /** S-52 viewing group number */
672
+ viewingGroup?: number;
673
+ /** Minimum compilation scale for display (SCAMIN) */
674
+ scamin?: number;
675
+ }
676
+ /** Resolved style ready for Mapbox GL (tokens → hex) */
677
+ interface ResolvedStyle {
678
+ type: GeomType;
679
+ paint: Record<string, unknown>;
680
+ layout?: Record<string, unknown>;
681
+ minzoom?: number;
682
+ maxzoom?: number;
683
+ }
684
+
685
+ /**
686
+ * S-52 lookup table covering all S-57 object classes found in NOAA ENCs.
687
+ * Colours reference S-52 tokens (resolved at render time).
688
+ * INT1 references per NOAA Chart No. 1 (Ed 13).
689
+ */
690
+ declare const S52_LOOKUP: Record<string, LookupEntry>;
691
+
692
+ /**
693
+ * S-52 draw order: layers listed bottom → top.
694
+ * Layers not in this list are inserted before point features.
695
+ */
696
+ declare const S52_DRAW_ORDER: string[];
697
+ /** Get numeric draw priority for a layer (lower = drawn first / below) */
698
+ declare function getDrawPriority(layerName: string): number;
699
+
700
+ /** S-52 display modes */
701
+ type DisplayMode = "BASE" | "STANDARD" | "ALL";
702
+ /** Check if a layer's display category is visible in the given mode */
703
+ declare function isVisibleInMode(displayCategory: DisplayCategory, mode: DisplayMode): boolean;
704
+ /**
705
+ * Convert S-52 SCAMIN (scale minimum) to Mapbox GL minzoom.
706
+ */
707
+ declare function scaminToMinZoom(scamin?: number): number | undefined;
708
+ declare function getCollisionSettings(viewingGroup?: number): {
709
+ iconAllowOverlap: boolean;
710
+ iconOptional: boolean;
711
+ symbolSortKey?: number;
712
+ };
713
+ /**
714
+ * Get the resolved Mapbox GL style for a given S-57 layer.
715
+ */
716
+ declare function resolveStyle(layerName: string, geomKind?: GeomType, ct?: ColorTableName): ResolvedStyle;
717
+ declare function getLookupEntry(layerName: string): LookupEntry;
718
+
719
+ /**
720
+ * S-52 Conditional Symbology Procedures.
721
+ * Each function takes feature properties and returns paint overrides (hex colours).
722
+ * All expression builders accept an optional colorTable parameter.
723
+ */
724
+ declare function depareColor(props: Record<string, unknown>, ct?: ColorTableName): string;
725
+ declare function depareFillExpression(ct?: ColorTableName): unknown[];
726
+ declare function lightColor(props: Record<string, unknown>, ct?: ColorTableName): string;
727
+ declare function lightFillExpression(ct?: ColorTableName): unknown[];
728
+ declare function lateralColor(props: Record<string, unknown>, ct?: ColorTableName): string;
729
+ declare function lateralFillExpression(ct?: ColorTableName): unknown[];
730
+ declare function hazardColor(props: Record<string, unknown>, ct?: ColorTableName): string;
731
+ declare function hazardFillExpression(ct?: ColorTableName): unknown[];
732
+ declare function daymarkColor(props: Record<string, unknown>, ct?: ColorTableName): string;
733
+
734
+ /**
735
+ * Label configurations for S-57 layers.
736
+ * Defines which layers get text labels and how to extract label text.
737
+ */
738
+
739
+ interface LabelLayerConfig {
740
+ /** Mapbox source layer type */
741
+ type: "symbol";
742
+ /** Text field expression or string */
743
+ textField: ExpressionSpecification | string;
744
+ /** Text size in pixels */
745
+ textSize: number | ExpressionSpecification;
746
+ /** Text color */
747
+ textColor: string;
748
+ /** Halo color for contrast */
749
+ textHaloColor: string;
750
+ /** Halo width */
751
+ textHaloWidth: number;
752
+ /** Text offset [x, y] in ems */
753
+ textOffset: [number, number];
754
+ /** Font stack */
755
+ textFont?: string[];
756
+ /** Additional layout properties */
757
+ layout?: Record<string, unknown>;
758
+ /** Minimum zoom level for this label */
759
+ minzoom?: number;
760
+ }
761
+ /** Get label config for a given S-57 layer, or null if no labels */
762
+ declare function getLabelConfig(layerName: string): LabelLayerConfig | null;
763
+ /**
764
+ * Build a Mapbox symbol layer spec from a label config.
765
+ */
766
+ declare function buildLabelLayer(layerId: string, sourceId: string, config: LabelLayerConfig, visible: boolean, overrides?: {
767
+ textScale?: number;
768
+ minzoom?: number | null;
769
+ allowOverlap?: boolean;
770
+ }): maplibregl.LayerSpecification;
771
+ /**
772
+ * Pre-process SOUNDG GeoJSON to extract Z coordinates as `depth` properties.
773
+ * Soundings are MultiPoint with Z values in geometry.coordinates[][2].
774
+ * This explodes MultiPoints into individual Points with a `depth` property.
775
+ */
776
+ declare function preprocessSoundings(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
777
+ /**
778
+ * Pre-process LIGHTS GeoJSON to derive compact light characteristic labels.
779
+ * Adds `_lightLabel` property (e.g., "Fl R 4s").
780
+ */
781
+ declare function preprocessLights(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
782
+ /** List of layers that have labels */
783
+ declare const LABELED_LAYERS: Set<string>;
784
+ /**
785
+ * Pre-process buoy/beacon GeoJSON to derive concise mariner-style labels.
786
+ * Adds `_navAidLabel` property (e.g., 'R "8"', 'G "5"').
787
+ */
788
+ declare function preprocessNavAids(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
789
+ /** Check if a layer name needs nav aid preprocessing */
790
+ declare function isNavAidLayer(layerName: string): boolean;
791
+ /**
792
+ * Pre-process water body polygon GeoJSON into centroid points for label placement.
793
+ * Computes a simple average-coordinate centroid for each polygon feature that has OBJNAM.
794
+ */
795
+ declare function preprocessWaterBodies(fc: GeoJSON.FeatureCollection): GeoJSON.FeatureCollection;
796
+
797
+ /**
798
+ * Spatial grid-based feature decimation for performance at low zoom levels.
799
+ * Thins dense GeoJSON feature sets by keeping only one representative
800
+ * feature per grid cell per layer.
801
+ */
802
+ interface DecimationOptions {
803
+ /** Grid resolution (cells per axis). Default 80. */
804
+ gridSize?: number;
805
+ /** Zoom level below which decimation kicks in. Default 12. */
806
+ zoomThreshold?: number;
807
+ }
808
+ /**
809
+ * Zoom-adaptive grid resolution for decimation.
810
+ */
811
+ declare function getGridSizeForZoom(zoom: number): number;
812
+ /**
813
+ * Decimate a GeoJSON FeatureCollection using spatial grid thinning.
814
+ * Only runs when zoom < zoomThreshold. Returns the original FC otherwise.
815
+ *
816
+ * @param fc - Input FeatureCollection
817
+ * @param layerName - S-57 layer name (affects priority logic)
818
+ * @param currentZoom - Current map zoom level
819
+ * @param bounds - Current viewport bounds
820
+ * @param opts - Decimation options
821
+ */
822
+ declare function decimateFeatures(fc: GeoJSON.FeatureCollection, layerName: string, currentZoom: number, bounds: {
823
+ west: number;
824
+ south: number;
825
+ east: number;
826
+ north: number;
827
+ }, opts?: DecimationOptions): GeoJSON.FeatureCollection;
828
+ /**
829
+ * Get the max number of cells to load based on zoom level.
830
+ */
831
+ declare function getMaxCellsForZoom(zoom: number): number;
832
+
833
+ /**
834
+ * IHO S-52 / NOAA Chart No. 1 / INT1 nautical symbol SVGs.
835
+ *
836
+ * Complete symbology suite following:
837
+ * - IHO S-52 Presentation Library (Ed 4.0)
838
+ * - IALA Maritime Buoyage System R1001 (Region B for US waters)
839
+ * - NOAA Chart No. 1 (Ed 13) / INT1
840
+ *
841
+ * Buoy shape terminology (US / Chart No. 1):
842
+ * - CAN (Q20): Flat-top cylindrical buoy — Port mark in IALA-B (red)
843
+ * - NUN (Q21): Conical/pointed-top buoy — Starboard mark in IALA-B (green)
844
+ * - PILLAR: Tall narrow buoy — used for cardinal, isolated danger, etc.
845
+ * - SPAR: Tall thin pole buoy
846
+ * - SPHERICAL: Round buoy — safe water marks
847
+ * - BARREL: Barrel/tun shaped buoy
848
+ * - SUPER: Large navigation buoy / LANBY
849
+ *
850
+ * Cardinal mark topmark orientations (IALA):
851
+ * - North: both cones point UP ▲▲
852
+ * - South: both cones point DOWN ▼▼
853
+ * - East: cones base-to-base (diamond) ◆
854
+ * - West: cones point-to-point (hourglass) ⊗
855
+ *
856
+ * Each symbol is a compact SVG at 32×32 for Mapbox GL `map.addImage()`.
857
+ */
858
+ /** Color used in the SVG with its S-52 token name, hex, and usage */
859
+ interface SymbolColor {
860
+ token: string;
861
+ hex: string;
862
+ usage: string;
863
+ }
864
+ /** Line style used in the SVG */
865
+ interface SymbolLineStyle {
866
+ element: string;
867
+ width: number;
868
+ pattern?: string;
869
+ color: string;
870
+ }
871
+ /** Fill element used in the SVG */
872
+ interface SymbolFillElement {
873
+ element: string;
874
+ color: string;
875
+ opacity?: number;
876
+ }
877
+ interface NauticalSymbol {
878
+ id: string;
879
+ label: string;
880
+ /** INT1 / Chart No. 1 reference */
881
+ int1Ref: string;
882
+ /** Chart No. 1 section letter */
883
+ section: string;
884
+ getSvg: () => string;
885
+ /** Generate SVG with theme-specific colors (for bridge icons etc.) */
886
+ getThemedSvg?: (chblk: string, movable: string) => string;
887
+ /** What this symbol represents on a chart */
888
+ description?: string;
889
+ /** S-52 Presentation Library symbol name */
890
+ s52PlRef?: string;
891
+ /** Grouping key for family clustering */
892
+ group?: string;
893
+ /** IDs of related variant symbols */
894
+ variants?: string[];
895
+ /** S-57 attribute that selects this variant */
896
+ attributeKey?: string;
897
+ /** Value of that attribute for this variant */
898
+ attributeValue?: number;
899
+ /** Example label strings seen on charts */
900
+ labelExamples?: string[];
901
+ /** What the color represents */
902
+ colorMeaning?: string;
903
+ /** Colors used in the SVG */
904
+ colors?: SymbolColor[];
905
+ /** Line/stroke styles used in the SVG */
906
+ lineStyles?: SymbolLineStyle[];
907
+ /** Fill regions in the SVG */
908
+ fillElements?: SymbolFillElement[];
909
+ /** Expanded navigational usage context (2-4 sentences) */
910
+ usageContext?: string;
911
+ /** Render size for documentation */
912
+ renderSize?: string;
913
+ }
914
+ /** A logical grouping of related symbols */
915
+ interface SymbolGroup {
916
+ id: string;
917
+ label: string;
918
+ section: string;
919
+ description: string;
920
+ symbolIds: string[];
921
+ }
922
+ /** Chart No. 1 section metadata */
923
+ interface ChartSection {
924
+ id: string;
925
+ label: string;
926
+ description: string;
927
+ }
928
+ declare const NAUTICAL_SYMBOLS: NauticalSymbol[];
929
+ /** S-57 object class → default symbol ID mapping.
930
+ * Values are S-52 PL symbol names (matching SVG filenames in s52/point/).
931
+ * Conditional expressions in getIconExpression() override these for classes
932
+ * with attribute-dependent variants.
933
+ */
934
+ declare const SYMBOL_MAP: Record<string, string>;
935
+ /** Get the Mapbox icon-image expression for data-driven symbol selection.
936
+ * Returns S-52 PL symbol names that correspond to SVG files in s52/point/.
937
+ */
938
+ declare function getIconExpression(layerName: string): string | unknown[];
939
+ /**
940
+ * Browser-only image loaders (`loadSymbolImages`, `loadThemedBridgeImages`)
941
+ * live in `./symbols-browser.ts` (sub-export `@chrtco/sdk/atlas/browser`) —
942
+ * they require a DOM (use `new Image()` + `map.addImage()`).
943
+ */
944
+ /** Get inline SVG string for a symbol by ID (for the Atlas legend) */
945
+ declare function getSymbolSvgString(symbolId: string): string | null;
946
+ declare const CHART_SECTIONS: ChartSection[];
947
+ declare const SYMBOL_GROUPS: SymbolGroup[];
948
+ /** Generate a single SVG sprite sheet containing all symbols as <symbol> elements */
949
+ declare function generateSpriteSheet(): string;
950
+ /** Generate a JSON manifest mapping symbol IDs to metadata */
951
+ declare function generateSpriteManifest(): Record<string, {
952
+ label: string;
953
+ int1Ref: string;
954
+ section: string;
955
+ group?: string;
956
+ s52PlRef?: string;
957
+ description?: string;
958
+ attributeKey?: string;
959
+ attributeValue?: number;
960
+ }>;
961
+
962
+ /**
963
+ * IHO S-101 ENC Product Specification — Feature Catalogue
964
+ *
965
+ * S-101 replaces S-57 as the data model for Electronic Navigational Charts.
966
+ * This catalogue maps S-101 feature classes to:
967
+ * - S-57 equivalents (where they exist)
968
+ * - Chart No. 1 sections (same organizational structure)
969
+ * - Portrayal catalogue references (S-100 Portrayal Model)
970
+ *
971
+ * Key S-101 changes from S-57:
972
+ * - CamelCase feature class names (DepthArea vs DEPARE)
973
+ * - Complex/structured attributes (nested objects vs flat)
974
+ * - New feature types for AIS, quality, under-keel clearance
975
+ * - Removed/merged features for simplification
976
+ *
977
+ * Reference: IHO S-101 Product Specification (Ed 1.1.0)
978
+ * IHO S-100 Universal Hydrographic Data Model
979
+ */
980
+ interface S101Feature {
981
+ /** S-101 camelCase feature class name */
982
+ featureClass: string;
983
+ /** Human-readable name */
984
+ name: string;
985
+ /** S-57 6-char equivalent acronym, if any */
986
+ s57Equivalent?: string;
987
+ /** Chart No. 1 section letter */
988
+ section: string;
989
+ /** Group key for clustering */
990
+ group: string;
991
+ /** Feature category */
992
+ category: "geo" | "meta" | "info";
993
+ /** Description of the feature */
994
+ description: string;
995
+ /** S-100 Portrayal Catalogue reference */
996
+ portrayalRef?: string;
997
+ /** True if this feature has no S-57 equivalent */
998
+ isNewInS101: boolean;
999
+ /** Key attributes specific to this feature */
1000
+ attributes?: string[];
1001
+ }
1002
+ declare const S101_FEATURES: S101Feature[];
1003
+ declare const S101_CHART_SECTIONS: {
1004
+ id: string;
1005
+ label: string;
1006
+ description: string;
1007
+ }[];
1008
+ declare const S101_SYMBOL_GROUPS: {
1009
+ id: string;
1010
+ label: string;
1011
+ section: string;
1012
+ description: string;
1013
+ }[];
1014
+
1015
+ /**
1016
+ * S-101 Portrayal Catalogue — New Symbol SVGs
1017
+ *
1018
+ * These symbols represent features introduced in S-101 that have no
1019
+ * direct S-57/S-52 equivalent. The existing S-52 symbols are reused
1020
+ * where S-101 retains visual continuity with the S-57 portrayal.
1021
+ *
1022
+ * Reference: IHO S-101 Portrayal Catalogue (Ed 1.1.0)
1023
+ */
1024
+
1025
+ declare const S101_NEW_SYMBOLS: NauticalSymbol[];
1026
+
1027
+ /**
1028
+ * S-52 SVG Loader — pure (DOM-free) string operations over the inlined S-52
1029
+ * SVG catalogue in `s52-svgs-generated.ts`. SVG files use S-52 color token
1030
+ * names (e.g., CHBLK, LITRD) as fill/stroke values; `applyColorTheme` swaps
1031
+ * those tokens for hex from the active palette.
1032
+ *
1033
+ * Browser-only image loaders live in `./s52-svg-loader-browser.ts` (sub-export
1034
+ * `@chrtco/sdk/atlas/browser`) — they use `new Image()` and require a DOM.
1035
+ */
1036
+
1037
+ /**
1038
+ * Get raw SVG string for an S-52 symbol by name (e.g., "BOYCAN01").
1039
+ * Returns null if the symbol is not found.
1040
+ */
1041
+ declare function getS52SvgString(symbolName: string): string | null;
1042
+ /**
1043
+ * Get an S-52 SVG string with color tokens resolved to hex values
1044
+ * from the specified color table.
1045
+ */
1046
+ declare function getThemedS52Svg(symbolName: string, colorTable?: ColorTableName): string | null;
1047
+ /**
1048
+ * Replace S-52 color token names in an SVG string with hex colors
1049
+ * from the active color table.
1050
+ *
1051
+ * Matches tokens in fill="TOKEN" and stroke="TOKEN" attribute values.
1052
+ */
1053
+ declare function applyColorTheme(svgString: string, colorTable?: ColorTableName): string;
1054
+ /** Get a list of all available S-52 point symbol names. */
1055
+ declare function getAvailablePointSymbols(): string[];
1056
+ /** Get a list of all available S-52 pattern names. */
1057
+ declare function getAvailablePatterns(): string[];
1058
+ /** Get a list of all available S-52 line symbol names. */
1059
+ declare function getAvailableLineSymbols(): string[];
1060
+ /** Stats for debugging */
1061
+ declare function getS52SymbolStats(): {
1062
+ pointCount: number;
1063
+ patternCount: number;
1064
+ lineCount: number;
1065
+ totalCount: number;
1066
+ };
1067
+
1068
+ /**
1069
+ * Zoom range of CHRT tile builds — kept in lockstep with the baremetal
1070
+ * tippecanoe invocation (tools/chrt-baremetal/server/src/tilebuild/per-layer-zoom.ts).
1071
+ *
1072
+ * Per-S-57-class minzoom/maxzoom narrowing is handled inside the MVT at
1073
+ * tile-build time via per-feature `tippecanoe.minzoom/maxzoom`; these two
1074
+ * constants are the outer envelope the MapLibre source declares, so the
1075
+ * client doesn't request tiles outside what the pmtiles can actually serve.
1076
+ */
1077
+ declare const BUILD_MINZOOM = 3;
1078
+ declare const BUILD_MAXZOOM = 14;
1079
+
1080
+ /**
1081
+ * Post-consolidation (2026-04): one consolidated PMTiles per region, all
1082
+ * S-57 classes as distinct MVT layers inside. The MapLibre style emits one
1083
+ * vector source (id = region) and N paint layers that reference it via
1084
+ * `source-layer` = S-57 class name.
1085
+ *
1086
+ * `buildSources()` returns either the legacy Mapbox MTS shape (preserved for
1087
+ * demos / external style export — see generateStyle comments) or the PMTiles
1088
+ * shape pointing at a single tile URL per region.
1089
+ */
1090
+ /** Vector source emitted for the legacy Mapbox MTS path. */
1091
+ interface MapboxVectorSource {
1092
+ type: "vector";
1093
+ url: string;
1094
+ }
1095
+ /**
1096
+ * Vector source emitted for the tiles.chrt.co PMTiles path. Uses an explicit
1097
+ * `tiles` array (not a TileJSON `url`) because the tile-worker serves raw MVT
1098
+ * bytes without a TileJSON descriptor.
1099
+ */
1100
+ interface PmtilesVectorSource {
1101
+ type: "vector";
1102
+ tiles: string[];
1103
+ minzoom: number;
1104
+ maxzoom: number;
1105
+ }
1106
+ type VectorSourceSpec = MapboxVectorSource | PmtilesVectorSource;
1107
+ type SourceMode = "mapbox" | "pmtiles";
1108
+ /**
1109
+ * Default tile-worker origin for PMTiles mode. Callers should pass
1110
+ * `tileBaseUrl` explicitly via `BuildSourcesOptions` to override (e.g. the
1111
+ * React app reads `import.meta.env.VITE_TILE_WORKER_BASE`; the offline-worker
1112
+ * reads `env.TILE_BASE_URL`). This constant is the prod fallback only.
1113
+ */
1114
+ declare const DEFAULT_TILE_BASE_URL = "https://tiles.chrt.co";
1115
+ /** Canonical source id used in `generateStyle()` — matches the region name
1116
+ * of the one consolidated PMTiles served by the tile-worker for this region. */
1117
+ declare const DEFAULT_REGION = "NOAA_ENC";
1118
+ interface BuildSourcesOptions {
1119
+ /** Which tile path to emit. Default: "pmtiles" (the supported path post-Mapbox). */
1120
+ mode?: SourceMode;
1121
+ /** Chart region. Default: "NOAA_ENC". */
1122
+ region?: string;
1123
+ /**
1124
+ * Reserved for future cache-busting on KV-pointer flips. Currently unused;
1125
+ * build pinning rides in the JWT, not the URL.
1126
+ */
1127
+ buildTag?: string;
1128
+ /** Override tile-worker origin (e.g. staging). Default: DEFAULT_TILE_BASE_URL. */
1129
+ tileBaseUrl?: string;
1130
+ }
1131
+ /**
1132
+ * Build the "sources" block for a CHRT style.
1133
+ *
1134
+ * - `mode: "mapbox"`: one mapbox:// url (kept for external style export only).
1135
+ * - `mode: "pmtiles"` (default): one vector tile endpoint for the region,
1136
+ * routed by the Worker to the one consolidated PMTiles:
1137
+ * `${tileBaseUrl}/v1/tiles/{region}/{z}/{x}/{y}.mvt`
1138
+ */
1139
+ declare function buildSources(opts?: BuildSourcesOptions): Record<string, VectorSourceSpec>;
1140
+
1141
+ /**
1142
+ * Builds Mapbox GL Style layer specs from S-52 lookup entries.
1143
+ * Wraps the existing atlas resolveStyle() and adds source/source-layer/filter.
1144
+ */
1145
+
1146
+ interface StyleLayer {
1147
+ id: string;
1148
+ type: string;
1149
+ source: string;
1150
+ "source-layer": string;
1151
+ filter?: unknown[];
1152
+ paint: Record<string, unknown>;
1153
+ layout?: Record<string, unknown>;
1154
+ minzoom?: number;
1155
+ maxzoom?: number;
1156
+ metadata?: Record<string, unknown>;
1157
+ }
1158
+ /**
1159
+ * Build all Mapbox GL layers for a given S-57 object class.
1160
+ * Returns multiple layers (fill, outline, symbol, label, etc.).
1161
+ *
1162
+ * Post-consolidation: all S-57 classes live as MVT layers inside one
1163
+ * consolidated PMTiles per region; `source` is always the region name.
1164
+ */
1165
+ declare function buildLayersForClass(objectClass: string, ct: ColorTableName, sourceId?: string): StyleLayer[];
1166
+ /**
1167
+ * Get the full ordered list of object classes for style generation.
1168
+ * Uses S52_DRAW_ORDER as base, then adds any missing classes from the
1169
+ * S-52 lookup table so a newly-ingested class automatically gets styled
1170
+ * without touching this file.
1171
+ */
1172
+ declare function getOrderedClasses(): string[];
1173
+
1174
+ /**
1175
+ * Generates a complete Mapbox GL Style Specification v8 JSON
1176
+ * from the S-52 atlas definitions.
1177
+ */
1178
+
1179
+ interface MapboxStyle {
1180
+ version: 8;
1181
+ name: string;
1182
+ metadata: Record<string, unknown>;
1183
+ sources: Record<string, unknown>;
1184
+ sprite?: string;
1185
+ glyphs: string;
1186
+ layers: StyleLayer[];
1187
+ }
1188
+ declare function generateStyle(palette?: ColorTableName, opts?: BuildSourcesOptions): MapboxStyle;
1189
+ declare function generateStyleJSON(palette?: ColorTableName, opts?: BuildSourcesOptions): string;
1190
+ /** Get summary stats about the generated style */
1191
+ declare function getStyleStats(style: MapboxStyle): {
1192
+ totalLayers: number;
1193
+ fillLayers: number;
1194
+ lineLayers: number;
1195
+ symbolLayers: number;
1196
+ circleLayers: number;
1197
+ sources: number;
1198
+ objectClasses: Set<string>;
1199
+ };
1200
+
635
1201
  declare class Chrt {
636
1202
  /** Tile endpoints — styleUrl, tileUrl, groups */
637
1203
  readonly tiles: TilesEndpoint;
@@ -690,4 +1256,4 @@ declare class Chrt {
690
1256
  transformRequest(): (url: string) => TransformRequest | undefined;
691
1257
  }
692
1258
 
693
- export { type BuildOfflineStyleOptions, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, Chrt, type ChrtConfig, ChrtError, type CoverageOptions, type CoverageResponse, type CoverageSource, type FeatureCollection, type FeaturesOptions, FileSystemAdapter, type GeoJsonFeature, type GeoJsonGeometry, type MapLibreStyle, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type QueryOptions, type RouteFeatureQueryOptions, type RouteFeatureQueryResponse, type RouteQueryOptions, type RouteQueryResponse, type TileGroup, type TileGroupsResponse, type TransformRequest, type WebhookEvent, type WebhookEventType, type WebhookPayload, buildOfflineStyle, paginate, parseWebhook };
1259
+ export { type AtlasStyle, BUILD_MAXZOOM, BUILD_MINZOOM, type BuildOfflineStyleOptions, type BuildSourcesOptions, CHART_SECTIONS, type CellDeletedEvent, type CellDetail, type CellEventData, type CellNewEvent, type CellUpdatedData, type CellUpdatedEvent, type CellsOptions, type CellsResponse, type ChartSection, Chrt, type ChrtConfig, ChrtError, ColorTableName, type CoverageOptions, type CoverageResponse, type CoverageSource, DEFAULT_REGION, DEFAULT_TILE_BASE_URL, type DisplayCategory, type DisplayMode, type FeatureCollection, type FeaturesOptions, FileSystemAdapter, type GeoJsonFeature, type GeoJsonGeometry, type GeomType, LABELED_LAYERS, type LabelLayerConfig, type LookupEntry, type MapLibreStyle, type MapboxStyle, type MapboxVectorSource, NAUTICAL_SYMBOLS, type NauticalCategory, type NauticalSymbol, type OfflineBundleResponse, type OfflineDownloadOptions, type OfflineDownloadProgress, type OfflineDownloadResult, OfflineError, type OfflineErrorCode, type OfflineFetchStyleOptions, type OfflineHeartbeatOptions, type OfflineRegionSummary, type OfflineRemoveOptions, OfflineStyleError, type OfflineStylePlatform, type OfflineStyleResponse, type PmtilesVectorSource, type QueryOptions, type ResolvedStyle, type RouteFeatureQueryOptions, type RouteFeatureQueryResponse, type RouteQueryOptions, type RouteQueryResponse, type S101Feature, S101_CHART_SECTIONS, S101_FEATURES, S101_NEW_SYMBOLS, S101_SYMBOL_GROUPS, S52_DRAW_ORDER, S52_LOOKUP, SYMBOL_GROUPS, SYMBOL_MAP, type SourceMode, type StyleLayer, type SymbolGroup, type TileGroup, type TileGroupsResponse, type TransformRequest, type VectorSourceSpec, type WebhookEvent, type WebhookEventType, type WebhookPayload, applyColorTheme, buildLabelLayer, buildLayersForClass, buildOfflineStyle, buildSources, daymarkColor, decimateFeatures, depareColor, depareFillExpression, generateSpriteManifest, generateSpriteSheet, generateStyle, generateStyleJSON, getAvailableLineSymbols, getAvailablePatterns, getAvailablePointSymbols, getCollisionSettings, getDrawPriority, getGridSizeForZoom, getIconExpression, getLabelConfig, getLookupEntry, getMaxCellsForZoom, getOrderedClasses, getS52SvgString, getS52SymbolStats, getStyleStats, getSymbolSvgString, getThemedS52Svg, hazardColor, hazardFillExpression, isNavAidLayer, isVisibleInMode, lateralColor, lateralFillExpression, lightColor, lightFillExpression, paginate, parseWebhook, preprocessLights, preprocessNavAids, preprocessSoundings, preprocessWaterBodies, resolveStyle, scaminToMinZoom };