@maplibre-yaml/core 0.1.3-beta.1 → 0.2.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/README.md +44 -0
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +65 -48
- package/dist/components/index.js.map +1 -1
- package/dist/index.d.ts +172 -5
- package/dist/index.js +89 -11
- package/dist/index.js.map +1 -1
- package/dist/{map-renderer-IvxniEQy.d.ts → map-renderer-8-c51Ww7.d.ts} +3 -2
- package/dist/{page.schema-VBytF9l5.d.ts → page.schema-Cad2FFqh.d.ts} +1643 -1
- package/dist/register.browser.js +67 -50
- package/dist/register.browser.js.map +1 -1
- package/dist/register.d.ts +2 -2
- package/dist/register.js +65 -48
- package/dist/register.js.map +1 -1
- package/dist/schemas/index.d.ts +2 -1638
- package/dist/schemas/index.js +6 -0
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { ColorOrExpressionSchema, ColorSchema, ContentBlockSchema, ContentElementSchema, ContentItemSchema, ExpressionSchema,
|
|
2
|
-
import { L as LayerSchema, P as PopupContentSchema, C as ControlsConfigSchema } from './page.schema-
|
|
3
|
-
export {
|
|
4
|
-
export { L as LegendBuilder, M as MapRenderer, c as MapRendererEvents, b as MapRendererOptions, P as ParseError, a as ParseResult, Y as YAMLParser, p as parseYAMLConfig, s as safeParseYAMLConfig } from './map-renderer-
|
|
1
|
+
export { ColorOrExpressionSchema, ColorSchema, ContentBlockSchema, ContentElementSchema, ContentItemSchema, ExpressionSchema, LatitudeSchema, LngLatBoundsSchema, LngLatSchema, LongitudeSchema, NumberOrExpressionSchema, ValidTagNames, ZoomLevelSchema } from './schemas/index.js';
|
|
2
|
+
import { L as LayerSchema, P as PopupContentSchema, C as ControlsConfigSchema, d as MapConfig, G as GlobalConfig, e as MapBlock } from './page.schema-Cad2FFqh.js';
|
|
3
|
+
export { t as BackgroundLayerSchema, B as BaseLayerPropertiesSchema, _ as Block, W as BlockSchema, N as Chapter, O as ChapterAction, E as ChapterActionSchema, Q as ChapterLayers, J as ChapterLayersSchema, K as ChapterSchema, n as CircleLayerSchema, y as ControlPosition, w as ControlPositionSchema, z as ControlsConfig, r as FillExtrusionLayerSchema, F as FillLayerSchema, h as GeoJSONSourceSchema, Y as GlobalConfigSchema, H as HeatmapLayerSchema, s as HillshadeLayerSchema, I as ImageSourceSchema, l as InteractiveConfigSchema, v as LayerOrReferenceSchema, u as LayerReferenceSchema, c as LayerSourceSchema, A as LegendConfig, a as LegendConfigSchema, m as LegendItemSchema, o as LineLayerSchema, g as LoadingConfigSchema, M as MapBlockSchema, b as MapConfigSchema, D as MapFullPageBlock, x as MapFullPageBlockSchema, Z as MixedBlock, U as MixedBlockSchema, $ as Page, X as PageSchema, k as PopupContentItemSchema, q as RasterLayerSchema, i as RasterSourceSchema, a0 as RootConfig, R as RootSchema, T as ScrollytellingBlock, S as ScrollytellingBlockSchema, f as StreamConfigSchema, p as SymbolLayerSchema, V as VectorSourceSchema, j as VideoSourceSchema } from './page.schema-Cad2FFqh.js';
|
|
4
|
+
export { L as LegendBuilder, M as MapRenderer, c as MapRendererEvents, b as MapRendererOptions, P as ParseError, a as ParseResult, Y as YAMLParser, p as parseYAMLConfig, s as safeParseYAMLConfig } from './map-renderer-8-c51Ww7.js';
|
|
5
5
|
import { Map, LngLat } from 'maplibre-gl';
|
|
6
6
|
import { z } from 'zod';
|
|
7
7
|
import { FeatureCollection } from 'geojson';
|
|
@@ -2405,4 +2405,171 @@ declare const loadingStyles = "\n/* Loading Overlay */\n.mly-loading-overlay {\n
|
|
|
2405
2405
|
*/
|
|
2406
2406
|
declare function injectLoadingStyles(): void;
|
|
2407
2407
|
|
|
2408
|
-
|
|
2408
|
+
/**
|
|
2409
|
+
* @file Configuration resolution utilities for maplibre-yaml
|
|
2410
|
+
* @module @maplibre-yaml/core/utils/config-resolver
|
|
2411
|
+
*
|
|
2412
|
+
* @description
|
|
2413
|
+
* Utilities for resolving map configurations with global config inheritance.
|
|
2414
|
+
* Enables maps to inherit default values from global configuration while
|
|
2415
|
+
* allowing per-map overrides.
|
|
2416
|
+
*
|
|
2417
|
+
* @example
|
|
2418
|
+
* ```typescript
|
|
2419
|
+
* import { resolveMapConfig, resolveMapBlock } from '@maplibre-yaml/core/utils';
|
|
2420
|
+
*
|
|
2421
|
+
* const globalConfig = {
|
|
2422
|
+
* defaultMapStyle: 'https://demotiles.maplibre.org/style.json',
|
|
2423
|
+
* theme: 'dark'
|
|
2424
|
+
* };
|
|
2425
|
+
*
|
|
2426
|
+
* const mapConfig = {
|
|
2427
|
+
* center: [-74.006, 40.7128],
|
|
2428
|
+
* zoom: 12
|
|
2429
|
+
* // mapStyle will be inherited from globalConfig.defaultMapStyle
|
|
2430
|
+
* };
|
|
2431
|
+
*
|
|
2432
|
+
* const resolved = resolveMapConfig(mapConfig, globalConfig);
|
|
2433
|
+
* // resolved.mapStyle === 'https://demotiles.maplibre.org/style.json'
|
|
2434
|
+
* ```
|
|
2435
|
+
*/
|
|
2436
|
+
|
|
2437
|
+
/**
|
|
2438
|
+
* Error thrown when map configuration is invalid after resolution.
|
|
2439
|
+
*/
|
|
2440
|
+
declare class ConfigResolutionError extends Error {
|
|
2441
|
+
readonly missingFields: string[];
|
|
2442
|
+
constructor(message: string, missingFields: string[]);
|
|
2443
|
+
}
|
|
2444
|
+
/**
|
|
2445
|
+
* Resolves a map configuration by applying global defaults.
|
|
2446
|
+
*
|
|
2447
|
+
* @param mapConfig - The map-specific configuration (may have optional fields)
|
|
2448
|
+
* @param globalConfig - Global configuration with defaults
|
|
2449
|
+
* @returns Resolved map configuration with all required fields
|
|
2450
|
+
* @throws {ConfigResolutionError} If required fields are missing after resolution
|
|
2451
|
+
*
|
|
2452
|
+
* @remarks
|
|
2453
|
+
* Resolution order (highest to lowest priority):
|
|
2454
|
+
* 1. Values explicitly set in mapConfig
|
|
2455
|
+
* 2. Values from globalConfig defaults
|
|
2456
|
+
* 3. Error (no silent fallbacks for center, zoom, or mapStyle)
|
|
2457
|
+
*
|
|
2458
|
+
* **Inherited Properties:**
|
|
2459
|
+
* - `mapStyle` ← `globalConfig.defaultMapStyle`
|
|
2460
|
+
* - `center` ← `globalConfig.defaultCenter`
|
|
2461
|
+
* - `zoom` ← `globalConfig.defaultZoom`
|
|
2462
|
+
*
|
|
2463
|
+
* @example Basic Resolution
|
|
2464
|
+
* ```typescript
|
|
2465
|
+
* const resolved = resolveMapConfig(
|
|
2466
|
+
* { center: [0, 0], zoom: 5 },
|
|
2467
|
+
* { defaultMapStyle: 'https://example.com/style.json' }
|
|
2468
|
+
* );
|
|
2469
|
+
* // resolved.mapStyle === 'https://example.com/style.json'
|
|
2470
|
+
* ```
|
|
2471
|
+
*
|
|
2472
|
+
* @example Inherit zoom/center from global
|
|
2473
|
+
* ```typescript
|
|
2474
|
+
* const resolved = resolveMapConfig(
|
|
2475
|
+
* { mapStyle: 'https://example.com/style.json' },
|
|
2476
|
+
* { defaultCenter: [-74.006, 40.7128], defaultZoom: 10 }
|
|
2477
|
+
* );
|
|
2478
|
+
* // resolved.center === [-74.006, 40.7128]
|
|
2479
|
+
* // resolved.zoom === 10
|
|
2480
|
+
* ```
|
|
2481
|
+
*/
|
|
2482
|
+
declare function resolveMapConfig(mapConfig: Partial<MapConfig>, globalConfig: GlobalConfig): MapConfig;
|
|
2483
|
+
declare function resolveMapConfig(mapConfig: Partial<MapConfig> & {
|
|
2484
|
+
center: [number, number];
|
|
2485
|
+
zoom: number;
|
|
2486
|
+
}, globalConfig?: GlobalConfig): MapConfig;
|
|
2487
|
+
/**
|
|
2488
|
+
* Resolves a complete MapBlock by applying global defaults to its config.
|
|
2489
|
+
*
|
|
2490
|
+
* @param mapBlock - The map block with potentially incomplete config
|
|
2491
|
+
* @param globalConfig - Global configuration with defaults
|
|
2492
|
+
* @returns Resolved map block with complete configuration
|
|
2493
|
+
* @throws {ConfigResolutionError} If required fields are missing after resolution
|
|
2494
|
+
*
|
|
2495
|
+
* @remarks
|
|
2496
|
+
* This function resolves the `config` property of a MapBlock while preserving
|
|
2497
|
+
* all other block properties (layers, controls, legend, etc.).
|
|
2498
|
+
*
|
|
2499
|
+
* @example
|
|
2500
|
+
* ```typescript
|
|
2501
|
+
* const mapBlock = {
|
|
2502
|
+
* type: 'map',
|
|
2503
|
+
* id: 'my-map',
|
|
2504
|
+
* config: { center: [0, 0], zoom: 5 },
|
|
2505
|
+
* layers: [...]
|
|
2506
|
+
* };
|
|
2507
|
+
*
|
|
2508
|
+
* const resolved = resolveMapBlock(mapBlock, {
|
|
2509
|
+
* defaultMapStyle: 'https://example.com/style.json'
|
|
2510
|
+
* });
|
|
2511
|
+
* // resolved.config.mapStyle === 'https://example.com/style.json'
|
|
2512
|
+
* ```
|
|
2513
|
+
*/
|
|
2514
|
+
declare function resolveMapBlock(mapBlock: MapBlock, globalConfig?: GlobalConfig): MapBlock;
|
|
2515
|
+
/**
|
|
2516
|
+
* Checks if a map configuration has all required fields.
|
|
2517
|
+
*
|
|
2518
|
+
* @param mapConfig - Map configuration to validate
|
|
2519
|
+
* @returns True if all required fields are present
|
|
2520
|
+
*
|
|
2521
|
+
* @remarks
|
|
2522
|
+
* Use this to check if a config needs resolution before rendering.
|
|
2523
|
+
*
|
|
2524
|
+
* @example
|
|
2525
|
+
* ```typescript
|
|
2526
|
+
* if (!isMapConfigComplete(config)) {
|
|
2527
|
+
* config = resolveMapConfig(config, globalConfig);
|
|
2528
|
+
* }
|
|
2529
|
+
* ```
|
|
2530
|
+
*/
|
|
2531
|
+
declare function isMapConfigComplete(mapConfig: Partial<MapConfig>): mapConfig is MapConfig;
|
|
2532
|
+
/**
|
|
2533
|
+
* Creates a map configuration with sensible defaults for simple use cases.
|
|
2534
|
+
*
|
|
2535
|
+
* @param options - Minimal configuration options
|
|
2536
|
+
* @param globalConfig - Optional global configuration for defaults
|
|
2537
|
+
* @returns Complete map configuration
|
|
2538
|
+
*
|
|
2539
|
+
* @remarks
|
|
2540
|
+
* This is a convenience function for creating simple map configurations
|
|
2541
|
+
* without needing to specify every field. Useful for collection items and
|
|
2542
|
+
* content-focused applications.
|
|
2543
|
+
*
|
|
2544
|
+
* **Default Values:**
|
|
2545
|
+
* - `zoom`: 12
|
|
2546
|
+
* - `pitch`: 0
|
|
2547
|
+
* - `bearing`: 0
|
|
2548
|
+
* - `interactive`: true
|
|
2549
|
+
*
|
|
2550
|
+
* @example Simple Location Map
|
|
2551
|
+
* ```typescript
|
|
2552
|
+
* const config = createSimpleMapConfig({
|
|
2553
|
+
* center: [-74.006, 40.7128],
|
|
2554
|
+
* mapStyle: 'https://example.com/style.json'
|
|
2555
|
+
* });
|
|
2556
|
+
* ```
|
|
2557
|
+
*
|
|
2558
|
+
* @example With Global Style
|
|
2559
|
+
* ```typescript
|
|
2560
|
+
* const config = createSimpleMapConfig(
|
|
2561
|
+
* { center: [-74.006, 40.7128] },
|
|
2562
|
+
* { defaultMapStyle: 'https://example.com/style.json' }
|
|
2563
|
+
* );
|
|
2564
|
+
* ```
|
|
2565
|
+
*/
|
|
2566
|
+
declare function createSimpleMapConfig(options: {
|
|
2567
|
+
center: [number, number];
|
|
2568
|
+
zoom?: number;
|
|
2569
|
+
mapStyle?: string;
|
|
2570
|
+
pitch?: number;
|
|
2571
|
+
bearing?: number;
|
|
2572
|
+
interactive?: boolean;
|
|
2573
|
+
}, globalConfig?: GlobalConfig): MapConfig;
|
|
2574
|
+
|
|
2575
|
+
export { BaseConnection, type CacheConfig, type CacheEntry, type CacheStats, ConfigResolutionError, type ConnectionConfig, type ConnectionEvents, type ConnectionState, ControlsConfigSchema, ControlsManager, DataFetcher, DataMerger, EventEmitter, type EventHandler, type EventHandlerCallbacks, type FetchOptions, type FetchResult, type FetcherConfig, GlobalConfig, LayerManager, type LayerManagerCallbacks, LayerSchema, type LoadingConfig, type LoadingEvents, LoadingManager, type LoadingState, MapBlock, MapConfig, MaxRetriesExceededError, MemoryCache, type MergeOptions, type MergeResult, type MergeStrategy, type PollingConfig, PollingManager, type PollingState, PopupBuilder, PopupContentSchema, type RetryCallbacks, type RetryConfig, RetryManager, type SSEConfig, SSEConnection, type StreamConfig, StreamManager, type StreamState, type WebSocketConfig, WebSocketConnection, createSimpleMapConfig, injectLoadingStyles, isMapConfigComplete, loadingStyles, resolveMapBlock, resolveMapConfig };
|
package/dist/index.js
CHANGED
|
@@ -585,6 +585,7 @@ var MapBlockSchema = z.object({
|
|
|
585
585
|
className: z.string().optional().describe("CSS class name for container"),
|
|
586
586
|
style: z.string().optional().describe("Inline CSS styles for container"),
|
|
587
587
|
config: MapConfigSchema.describe("Map configuration"),
|
|
588
|
+
sources: z.record(z.string(), LayerSourceSchema).optional().describe("Map sources"),
|
|
588
589
|
layers: z.array(LayerOrReferenceSchema).default([]).describe("Map layers"),
|
|
589
590
|
controls: ControlsConfigSchema.optional().describe("Map controls"),
|
|
590
591
|
legend: LegendConfigSchema.optional().describe("Legend configuration")
|
|
@@ -595,6 +596,7 @@ var MapFullPageBlockSchema = z.object({
|
|
|
595
596
|
className: z.string().optional().describe("CSS class name for container"),
|
|
596
597
|
style: z.string().optional().describe("Inline CSS styles for container"),
|
|
597
598
|
config: MapConfigSchema.describe("Map configuration"),
|
|
599
|
+
sources: z.record(z.string(), LayerSourceSchema).optional().describe("Map sources"),
|
|
598
600
|
layers: z.array(LayerOrReferenceSchema).default([]).describe("Map layers"),
|
|
599
601
|
controls: ControlsConfigSchema.optional().describe("Map controls"),
|
|
600
602
|
legend: LegendConfigSchema.optional().describe("Legend configuration")
|
|
@@ -698,6 +700,10 @@ var GlobalConfigSchema = z.object({
|
|
|
698
700
|
description: z.string().optional().describe("Application description"),
|
|
699
701
|
defaultMapStyle: z.string().url().optional().describe("Default map style URL"),
|
|
700
702
|
theme: z.enum(["light", "dark"]).default("light").describe("Default theme"),
|
|
703
|
+
defaultZoom: z.number().min(0).max(24).optional().describe("Default zoom level for all maps"),
|
|
704
|
+
defaultCenter: LngLatSchema.optional().describe(
|
|
705
|
+
"Default center [lng, lat] for all maps"
|
|
706
|
+
),
|
|
701
707
|
dataFetching: z.object({
|
|
702
708
|
defaultStrategy: z.enum(["runtime", "build", "hybrid"]).default("runtime").describe("Default fetch strategy"),
|
|
703
709
|
timeout: z.number().min(1e3).default(3e4).describe("Default timeout in milliseconds"),
|
|
@@ -3556,9 +3562,16 @@ var LayerManager = class {
|
|
|
3556
3562
|
this.abortControllers = /* @__PURE__ */ new Map();
|
|
3557
3563
|
}
|
|
3558
3564
|
async addLayer(layer) {
|
|
3559
|
-
const
|
|
3565
|
+
const isSourceRef = typeof layer.source === "string";
|
|
3566
|
+
const sourceId = isSourceRef ? layer.source : `${layer.id}-source`;
|
|
3560
3567
|
this.layerToSource.set(layer.id, sourceId);
|
|
3561
|
-
|
|
3568
|
+
if (!isSourceRef) {
|
|
3569
|
+
await this.addSource(sourceId, layer);
|
|
3570
|
+
} else if (!this.map.getSource(sourceId)) {
|
|
3571
|
+
throw new Error(
|
|
3572
|
+
`Source '${sourceId}' referenced by layer '${layer.id}' not found. Ensure it is defined in the block-level 'sources' map.`
|
|
3573
|
+
);
|
|
3574
|
+
}
|
|
3562
3575
|
const layerSpec = {
|
|
3563
3576
|
id: layer.id,
|
|
3564
3577
|
type: layer.type,
|
|
@@ -3586,12 +3599,6 @@ var LayerManager = class {
|
|
|
3586
3599
|
}
|
|
3587
3600
|
}
|
|
3588
3601
|
async addSource(sourceId, layer) {
|
|
3589
|
-
if (typeof layer.source === "string") {
|
|
3590
|
-
if (!this.map.getSource(layer.source)) {
|
|
3591
|
-
throw new Error(`Source reference '${layer.source}' not found`);
|
|
3592
|
-
}
|
|
3593
|
-
return;
|
|
3594
|
-
}
|
|
3595
3602
|
const source = layer.source;
|
|
3596
3603
|
if (source.type === "geojson") {
|
|
3597
3604
|
const geojsonSource = source;
|
|
@@ -3811,7 +3818,10 @@ var LayerManager = class {
|
|
|
3811
3818
|
}
|
|
3812
3819
|
if (this.map.getLayer(layerId)) this.map.removeLayer(layerId);
|
|
3813
3820
|
const sourceId = this.layerToSource.get(layerId) || `${layerId}-source`;
|
|
3814
|
-
|
|
3821
|
+
const isInlineSource = sourceId === `${layerId}-source`;
|
|
3822
|
+
if (isInlineSource && this.map.getSource(sourceId)) {
|
|
3823
|
+
this.map.removeSource(sourceId);
|
|
3824
|
+
}
|
|
3815
3825
|
this.sourceData.delete(sourceId);
|
|
3816
3826
|
this.layerToSource.delete(layerId);
|
|
3817
3827
|
}
|
|
@@ -4173,7 +4183,7 @@ var MapRenderer = class {
|
|
|
4173
4183
|
controlsManager;
|
|
4174
4184
|
eventListeners;
|
|
4175
4185
|
isLoaded;
|
|
4176
|
-
constructor(container, config, layers = [], options = {}) {
|
|
4186
|
+
constructor(container, config, layers = [], options = {}, sources) {
|
|
4177
4187
|
this.eventListeners = /* @__PURE__ */ new Map();
|
|
4178
4188
|
this.isLoaded = false;
|
|
4179
4189
|
this.map = new maplibregl2.Map({
|
|
@@ -4201,6 +4211,13 @@ var MapRenderer = class {
|
|
|
4201
4211
|
this.controlsManager = new ControlsManager(this.map);
|
|
4202
4212
|
this.map.on("load", () => {
|
|
4203
4213
|
this.isLoaded = true;
|
|
4214
|
+
if (sources) {
|
|
4215
|
+
for (const [id, sourceSpec] of Object.entries(sources)) {
|
|
4216
|
+
if (!this.map.getSource(id)) {
|
|
4217
|
+
this.map.addSource(id, sourceSpec);
|
|
4218
|
+
}
|
|
4219
|
+
}
|
|
4220
|
+
}
|
|
4204
4221
|
Promise.all(layers.map((layer) => this.addLayer(layer))).then(() => {
|
|
4205
4222
|
this.emit("load", void 0);
|
|
4206
4223
|
options.onLoad?.();
|
|
@@ -4497,6 +4514,67 @@ function injectLoadingStyles() {
|
|
|
4497
4514
|
document.head.appendChild(style);
|
|
4498
4515
|
}
|
|
4499
4516
|
|
|
4500
|
-
|
|
4517
|
+
// src/utils/config-resolver.ts
|
|
4518
|
+
var ConfigResolutionError = class extends Error {
|
|
4519
|
+
constructor(message, missingFields) {
|
|
4520
|
+
super(message);
|
|
4521
|
+
this.missingFields = missingFields;
|
|
4522
|
+
this.name = "ConfigResolutionError";
|
|
4523
|
+
}
|
|
4524
|
+
};
|
|
4525
|
+
function resolveMapConfig(mapConfig, globalConfig) {
|
|
4526
|
+
const center = mapConfig.center ?? globalConfig?.defaultCenter;
|
|
4527
|
+
const zoom = mapConfig.zoom ?? globalConfig?.defaultZoom;
|
|
4528
|
+
const resolved = {
|
|
4529
|
+
...mapConfig,
|
|
4530
|
+
center,
|
|
4531
|
+
zoom,
|
|
4532
|
+
mapStyle: mapConfig.mapStyle ?? globalConfig?.defaultMapStyle,
|
|
4533
|
+
interactive: mapConfig.interactive ?? true,
|
|
4534
|
+
pitch: mapConfig.pitch ?? 0,
|
|
4535
|
+
bearing: mapConfig.bearing ?? 0
|
|
4536
|
+
};
|
|
4537
|
+
const missingFields = [];
|
|
4538
|
+
if (!resolved.mapStyle) {
|
|
4539
|
+
missingFields.push("mapStyle");
|
|
4540
|
+
}
|
|
4541
|
+
if (resolved.center === void 0) {
|
|
4542
|
+
missingFields.push("center");
|
|
4543
|
+
}
|
|
4544
|
+
if (resolved.zoom === void 0) {
|
|
4545
|
+
missingFields.push("zoom");
|
|
4546
|
+
}
|
|
4547
|
+
if (missingFields.length > 0) {
|
|
4548
|
+
throw new ConfigResolutionError(
|
|
4549
|
+
`Map configuration is missing required fields: ${missingFields.join(
|
|
4550
|
+
", "
|
|
4551
|
+
)}. Either provide these fields in the map config or set defaults in global config (e.g., config.defaultMapStyle, config.defaultCenter, config.defaultZoom).`,
|
|
4552
|
+
missingFields
|
|
4553
|
+
);
|
|
4554
|
+
}
|
|
4555
|
+
return resolved;
|
|
4556
|
+
}
|
|
4557
|
+
function resolveMapBlock(mapBlock, globalConfig) {
|
|
4558
|
+
return {
|
|
4559
|
+
...mapBlock,
|
|
4560
|
+
config: resolveMapConfig(mapBlock.config, globalConfig)
|
|
4561
|
+
};
|
|
4562
|
+
}
|
|
4563
|
+
function isMapConfigComplete(mapConfig) {
|
|
4564
|
+
return mapConfig.center !== void 0 && mapConfig.zoom !== void 0 && mapConfig.mapStyle !== void 0;
|
|
4565
|
+
}
|
|
4566
|
+
function createSimpleMapConfig(options, globalConfig) {
|
|
4567
|
+
const config = {
|
|
4568
|
+
center: options.center,
|
|
4569
|
+
zoom: options.zoom ?? 12,
|
|
4570
|
+
mapStyle: options.mapStyle,
|
|
4571
|
+
pitch: options.pitch ?? 0,
|
|
4572
|
+
bearing: options.bearing ?? 0,
|
|
4573
|
+
interactive: options.interactive ?? true
|
|
4574
|
+
};
|
|
4575
|
+
return resolveMapConfig(config, globalConfig);
|
|
4576
|
+
}
|
|
4577
|
+
|
|
4578
|
+
export { BackgroundLayerSchema, BaseConnection, BaseLayerPropertiesSchema, BlockSchema, ChapterActionSchema, ChapterLayersSchema, ChapterSchema, CircleLayerSchema, ColorOrExpressionSchema, ColorSchema, ConfigResolutionError, ContentBlockSchema, ContentElementSchema, ContentItemSchema, ControlPositionSchema, ControlsConfigSchema, ControlsManager, DataFetcher, DataMerger, EventEmitter, EventHandler, ExpressionSchema, FillExtrusionLayerSchema, FillLayerSchema, GeoJSONSourceSchema, GlobalConfigSchema, HeatmapLayerSchema, HillshadeLayerSchema, ImageSourceSchema, InteractiveConfigSchema, LatitudeSchema, LayerManager, LayerOrReferenceSchema, LayerReferenceSchema, LayerSchema, LayerSourceSchema, LegendBuilder, LegendConfigSchema, LegendItemSchema, LineLayerSchema, LngLatBoundsSchema, LngLatSchema, LoadingConfigSchema, LoadingManager, LongitudeSchema, MapBlockSchema, MapConfigSchema, MapFullPageBlockSchema, MapRenderer, MaxRetriesExceededError, MemoryCache, MixedBlockSchema, NumberOrExpressionSchema, PageSchema, PollingManager, PopupBuilder, PopupContentItemSchema, PopupContentSchema, RasterLayerSchema, RasterSourceSchema, RetryManager, RootSchema, SSEConnection, ScrollytellingBlockSchema, StreamConfigSchema, StreamManager, SymbolLayerSchema, ValidTagNames, VectorSourceSchema, VideoSourceSchema, WebSocketConnection, YAMLParser, ZoomLevelSchema, createSimpleMapConfig, injectLoadingStyles, isMapConfigComplete, loadingStyles, parseYAMLConfig, resolveMapBlock, resolveMapConfig, safeParseYAMLConfig };
|
|
4501
4579
|
//# sourceMappingURL=index.js.map
|
|
4502
4580
|
//# sourceMappingURL=index.js.map
|