resolveMapConfig
Call Signature
Section titled “Call Signature”resolveMapConfig(
mapConfig,globalConfig):objectOutputType
Defined in: packages/core/src/utils/config-resolver.ts:81
Resolves a map configuration by applying global defaults.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
mapConfig | Partial<MapConfig> | The map-specific configuration (may have optional fields) |
globalConfig | { dataFetching?: { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }; defaultCenter?: [number, number]; defaultMapStyle?: string; defaultZoom?: number; description?: string; theme: "light" | "dark"; title?: string; } | Global configuration with defaults |
globalConfig.dataFetching? | { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; } | - |
globalConfig.dataFetching.defaultStrategy | "runtime" | "build" | "hybrid" | - |
globalConfig.dataFetching.retryAttempts | number | - |
globalConfig.dataFetching.timeout | number | - |
globalConfig.defaultCenter? | [number, number] | - |
globalConfig.defaultMapStyle? | string | - |
globalConfig.defaultZoom? | number | - |
globalConfig.description? | string | - |
globalConfig.theme | "light" | "dark" | - |
globalConfig.title? | string | - |
Returns
Section titled “Returns”objectOutputType
Resolved map configuration with all required fields
Throws
Section titled “Throws”If required fields are missing after resolution
Remarks
Section titled “Remarks”Resolution order (highest to lowest priority):
- Values explicitly set in mapConfig
- Values from globalConfig defaults
- Error (no silent fallbacks for center, zoom, or mapStyle)
Inherited Properties:
mapStyle←globalConfig.defaultMapStylecenter←globalConfig.defaultCenterzoom←globalConfig.defaultZoom
Examples
Section titled “Examples”Basic Resolution
const resolved = resolveMapConfig( { center: [0, 0], zoom: 5 }, { defaultMapStyle: 'https://example.com/style.json' });// resolved.mapStyle === 'https://example.com/style.json'Inherit zoom/center from global
const resolved = resolveMapConfig( { mapStyle: 'https://example.com/style.json' }, { defaultCenter: [-74.006, 40.7128], defaultZoom: 10 });// resolved.center === [-74.006, 40.7128]// resolved.zoom === 10Call Signature
Section titled “Call Signature”resolveMapConfig(
mapConfig,globalConfig?):objectOutputType
Defined in: packages/core/src/utils/config-resolver.ts:86
Resolves a map configuration by applying global defaults.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
mapConfig | Partial<objectOutputType<{ antialias: ZodOptional<ZodBoolean>; attributionControl: ZodOptional<ZodBoolean>; bearing: ZodDefault<ZodNumber>; bounds: ZodOptional<ZodUnion<[ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>, ZodArray<ZodNumber, "many">]>>; boxZoom: ZodOptional<ZodBoolean>; center: ZodTuple<[ZodNumber, ZodNumber], null>; crossSourceCollisions: ZodOptional<ZodBoolean>; doubleClickZoom: ZodOptional<ZodBoolean>; dragPan: ZodOptional<ZodBoolean>; dragRotate: ZodOptional<ZodBoolean>; fadeDuration: ZodOptional<ZodNumber>; failIfMajorPerformanceCaveat: ZodOptional<ZodBoolean>; fitTo: ZodOptional<ZodObject<{ maxZoom: ZodOptional<ZodNumber>; padding: ZodOptional<ZodNumber>; source: ZodString; }, "strip", ZodTypeAny, { maxZoom?: number; padding?: number; source: string; }, { maxZoom?: number; padding?: number; source: string; }>>; hash: ZodOptional<ZodBoolean>; interactive: ZodDefault<ZodBoolean>; keyboard: ZodOptional<ZodBoolean>; locale: ZodOptional<ZodRecord<ZodString, ZodString>>; localIdeographFontFamily: ZodOptional<ZodString>; logoPosition: ZodOptional<ZodEnum<["top-left", "top-right", "bottom-left", "bottom-right"]>>; mapStyle: ZodOptional<ZodUnion<[ZodString, ZodAny]>>; maxBounds: ZodOptional<ZodTuple<[ZodNumber, ZodNumber, ZodNumber, ZodNumber], null>>; maxPitch: ZodOptional<ZodNumber>; maxTileCacheSize: ZodOptional<ZodNumber>; maxZoom: ZodOptional<ZodNumber>; minPitch: ZodOptional<ZodNumber>; minZoom: ZodOptional<ZodNumber>; pitch: ZodDefault<ZodNumber>; preserveDrawingBuffer: ZodOptional<ZodBoolean>; refreshExpiredTiles: ZodOptional<ZodBoolean>; renderWorldCopies: ZodOptional<ZodBoolean>; scrollZoom: ZodOptional<ZodBoolean>; touchPitch: ZodOptional<ZodBoolean>; touchZoomRotate: ZodOptional<ZodBoolean>; trackResize: ZodOptional<ZodBoolean>; zoom: ZodNumber; }, ZodTypeAny, "passthrough">> & object | The map-specific configuration (may have optional fields) |
globalConfig? | { dataFetching?: { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; }; defaultCenter?: [number, number]; defaultMapStyle?: string; defaultZoom?: number; description?: string; theme: "light" | "dark"; title?: string; } | Global configuration with defaults |
globalConfig.dataFetching? | { defaultStrategy: "runtime" | "build" | "hybrid"; retryAttempts: number; timeout: number; } | - |
globalConfig.dataFetching.defaultStrategy? | "runtime" | "build" | "hybrid" | - |
globalConfig.dataFetching.retryAttempts? | number | - |
globalConfig.dataFetching.timeout? | number | - |
globalConfig.defaultCenter? | [number, number] | - |
globalConfig.defaultMapStyle? | string | - |
globalConfig.defaultZoom? | number | - |
globalConfig.description? | string | - |
globalConfig.theme? | "light" | "dark" | - |
globalConfig.title? | string | - |
Returns
Section titled “Returns”objectOutputType
Resolved map configuration with all required fields
Throws
Section titled “Throws”If required fields are missing after resolution
Remarks
Section titled “Remarks”Resolution order (highest to lowest priority):
- Values explicitly set in mapConfig
- Values from globalConfig defaults
- Error (no silent fallbacks for center, zoom, or mapStyle)
Inherited Properties:
mapStyle←globalConfig.defaultMapStylecenter←globalConfig.defaultCenterzoom←globalConfig.defaultZoom
Examples
Section titled “Examples”Basic Resolution
const resolved = resolveMapConfig( { center: [0, 0], zoom: 5 }, { defaultMapStyle: 'https://example.com/style.json' });// resolved.mapStyle === 'https://example.com/style.json'Inherit zoom/center from global
const resolved = resolveMapConfig( { mapStyle: 'https://example.com/style.json' }, { defaultCenter: [-74.006, 40.7128], defaultZoom: 10 });// resolved.center === [-74.006, 40.7128]// resolved.zoom === 10