@maplibre-yaml/core 0.1.3-beta.1 → 0.1.3

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.
@@ -1,7 +1,7 @@
1
1
  export { MLMap, registerMLMap } from '../register.js';
2
2
  import 'maplibre-gl';
3
- import '../map-renderer-IvxniEQy.js';
4
- import '../page.schema-VBytF9l5.js';
3
+ import '../map-renderer-Br4guic2.js';
4
+ import '../page.schema-EBT_0Ojm.js';
5
5
  import 'zod';
6
6
 
7
7
  /**
@@ -4,6 +4,42 @@ import maplibregl2 from 'maplibre-gl';
4
4
 
5
5
  // @maplibre-yaml/core - Declarative web maps with YAML
6
6
 
7
+ var LongitudeSchema = z.number().min(-180, "Longitude must be >= -180").max(180, "Longitude must be <= 180").describe("Longitude in degrees (-180 to 180)");
8
+ var LatitudeSchema = z.number().min(-90, "Latitude must be >= -90").max(90, "Latitude must be <= 90").describe("Latitude in degrees (-90 to 90)");
9
+ var LngLatSchema = z.tuple([LongitudeSchema, LatitudeSchema]).describe("Geographic coordinates as [longitude, latitude]");
10
+ var LngLatBoundsSchema = z.tuple([
11
+ LongitudeSchema,
12
+ // west
13
+ LatitudeSchema,
14
+ // south
15
+ LongitudeSchema,
16
+ // east
17
+ LatitudeSchema
18
+ // north
19
+ ]).describe("Bounding box as [west, south, east, north]");
20
+ var ColorSchema = z.string().refine(
21
+ (val) => {
22
+ if (val.startsWith("#")) {
23
+ return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(val);
24
+ }
25
+ if (val.startsWith("rgb")) {
26
+ return /^rgba?\s*\([^)]+\)$/.test(val);
27
+ }
28
+ if (val.startsWith("hsl")) {
29
+ return /^hsla?\s*\([^)]+\)$/.test(val);
30
+ }
31
+ return true;
32
+ },
33
+ {
34
+ message: "Invalid color format. Use hex (#rgb, #rrggbb), rgb(), rgba(), hsl(), hsla(), or named colors."
35
+ }
36
+ ).describe("CSS color value");
37
+ var ExpressionSchema = z.array(z.any()).refine((val) => val.length > 0 && typeof val[0] === "string", {
38
+ message: 'Expression must be an array starting with a string operator (e.g., ["get", "property"])'
39
+ }).describe("MapLibre expression for data-driven styling");
40
+ var NumberOrExpressionSchema = z.union([z.number(), ExpressionSchema]).describe("Number value or MapLibre expression");
41
+ var ColorOrExpressionSchema = z.union([ColorSchema, ExpressionSchema]).describe("Color value or MapLibre expression");
42
+ var ZoomLevelSchema = z.number().min(0, "Zoom level must be >= 0").max(24, "Zoom level must be <= 24").describe("Map zoom level (0-24)");
7
43
  var ValidTagNames = [
8
44
  "h1",
9
45
  "h2",
@@ -54,42 +90,6 @@ var ContentBlockSchema = z.object({
54
90
  style: z.string().optional().describe("Inline CSS styles for the block container"),
55
91
  content: z.array(ContentItemSchema).describe("Array of content items to render")
56
92
  }).describe("Content block for rich text and media");
57
- var LongitudeSchema = z.number().min(-180, "Longitude must be >= -180").max(180, "Longitude must be <= 180").describe("Longitude in degrees (-180 to 180)");
58
- var LatitudeSchema = z.number().min(-90, "Latitude must be >= -90").max(90, "Latitude must be <= 90").describe("Latitude in degrees (-90 to 90)");
59
- var LngLatSchema = z.tuple([LongitudeSchema, LatitudeSchema]).describe("Geographic coordinates as [longitude, latitude]");
60
- var LngLatBoundsSchema = z.tuple([
61
- LongitudeSchema,
62
- // west
63
- LatitudeSchema,
64
- // south
65
- LongitudeSchema,
66
- // east
67
- LatitudeSchema
68
- // north
69
- ]).describe("Bounding box as [west, south, east, north]");
70
- var ColorSchema = z.string().refine(
71
- (val) => {
72
- if (val.startsWith("#")) {
73
- return /^#([0-9a-fA-F]{3}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/.test(val);
74
- }
75
- if (val.startsWith("rgb")) {
76
- return /^rgba?\s*\([^)]+\)$/.test(val);
77
- }
78
- if (val.startsWith("hsl")) {
79
- return /^hsla?\s*\([^)]+\)$/.test(val);
80
- }
81
- return true;
82
- },
83
- {
84
- message: "Invalid color format. Use hex (#rgb, #rrggbb), rgb(), rgba(), hsl(), hsla(), or named colors."
85
- }
86
- ).describe("CSS color value");
87
- var ExpressionSchema = z.array(z.any()).refine((val) => val.length > 0 && typeof val[0] === "string", {
88
- message: 'Expression must be an array starting with a string operator (e.g., ["get", "property"])'
89
- }).describe("MapLibre expression for data-driven styling");
90
- var NumberOrExpressionSchema = z.union([z.number(), ExpressionSchema]).describe("Number value or MapLibre expression");
91
- var ColorOrExpressionSchema = z.union([ColorSchema, ExpressionSchema]).describe("Color value or MapLibre expression");
92
- var ZoomLevelSchema = z.number().min(0, "Zoom level must be >= 0").max(24, "Zoom level must be <= 24").describe("Map zoom level (0-24)");
93
93
  var StreamConfigSchema = z.object({
94
94
  type: z.enum(["websocket", "sse"]).describe("Streaming connection type"),
95
95
  url: z.string().url().optional().describe("WebSocket or SSE endpoint URL"),
@@ -704,6 +704,10 @@ var GlobalConfigSchema = z.object({
704
704
  description: z.string().optional().describe("Application description"),
705
705
  defaultMapStyle: z.string().url().optional().describe("Default map style URL"),
706
706
  theme: z.enum(["light", "dark"]).default("light").describe("Default theme"),
707
+ defaultZoom: z.number().min(0).max(24).optional().describe("Default zoom level for all maps"),
708
+ defaultCenter: LngLatSchema.optional().describe(
709
+ "Default center [lng, lat] for all maps"
710
+ ),
707
711
  dataFetching: z.object({
708
712
  defaultStrategy: z.enum(["runtime", "build", "hybrid"]).default("runtime").describe("Default fetch strategy"),
709
713
  timeout: z.number().min(1e3).default(3e4).describe("Default timeout in milliseconds"),