@tileflow/core 0.1.0-alpha.30 → 0.1.0-alpha.32

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/build.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { T as TileflowCaptureScene } from './capture-scene-D6soWztE.js';
2
- import { T as TileflowRenderedIconIdentity, a as TileflowIconCompositionV1, R as ResolvedTileflowMap, b as TileflowDataRequirementsV1, c as TileflowSourceRequirementsV1, d as TileflowMap, e as TileflowStyleOptions, f as TileflowInspectedStyle, g as TileflowPreparedMapAssets } from './icon-composition-BiOTwrvD.js';
3
- export { h as TileflowDataCompatibilityIssue, i as TileflowDataFieldRequirement, j as TileflowDataFieldType, k as TileflowDataLayerRequirement, l as TileflowObservedDataContractV1, m as TileflowStyleInspection, n as TileflowStyleInspectionContribution, o as TileflowStyleInspectionLayer, p as TileflowStyleInspectionRenderOperation, q as collectMapLineage, r as inferTileflowDataRequirements, s as inferTileflowSourceRequirements, t as tileflowStyleInspectionSchemaVersion, v as validateTileflowDataCompatibility } from './icon-composition-BiOTwrvD.js';
4
- import { M as MapLibreStyle, T as TileflowRuntimeManifest } from './manifest-types-CTT2eLbp.js';
1
+ import { T as TileflowCaptureScene } from './capture-scene-BaAJjGq7.js';
2
+ import { T as TileflowRenderedIconIdentity, a as TileflowIconCompositionV1, R as ResolvedTileflowMap, b as TileflowDataRequirementsV1, c as TileflowSourceRequirementsV1, d as TileflowMap, e as TileflowStyleOptions, f as TileflowInspectedStyle, g as TileflowPreparedMapAssets } from './icon-composition-Befmn-zZ.js';
3
+ export { h as TileflowDataCompatibilityIssue, i as TileflowDataFieldRequirement, j as TileflowDataFieldType, k as TileflowDataLayerRequirement, l as TileflowObservedDataContractV1, m as TileflowStyleInspection, n as TileflowStyleInspectionContribution, o as TileflowStyleInspectionLayer, p as TileflowStyleInspectionRenderOperation, q as collectMapLineage, r as inferTileflowDataRequirements, s as inferTileflowSourceRequirements, t as tileflowStyleInspectionSchemaVersion, v as validateTileflowDataCompatibility } from './icon-composition-Befmn-zZ.js';
4
+ import { M as MapLibreStyle, T as TileflowRuntimeManifest } from './manifest-types-E7m23eXL.js';
5
5
  import { z } from 'zod';
6
6
 
7
7
  declare const tileflowMapRevisionSchemaVersion: 1;
@@ -146,8 +146,8 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
146
146
  teamSources: z.ZodRecord<z.ZodString, z.ZodObject<{
147
147
  tileset: z.ZodString;
148
148
  type: z.ZodEnum<{
149
- vector: "vector";
150
149
  raster: "raster";
150
+ vector: "vector";
151
151
  }>;
152
152
  }, z.core.$strict>>;
153
153
  view: z.ZodOptional<z.ZodObject<{
@@ -204,8 +204,8 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
204
204
  }>;
205
205
  id: z.ZodString;
206
206
  kind: z.ZodEnum<{
207
- pattern: "pattern";
208
207
  icon: "icon";
208
+ pattern: "pattern";
209
209
  }>;
210
210
  sha256: z.ZodString;
211
211
  }, z.core.$strict>, z.ZodObject<{
@@ -259,13 +259,6 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
259
259
  }, z.core.$strict>], "kind">>;
260
260
  winners: z.ZodArray<z.ZodObject<{
261
261
  id: z.ZodString;
262
- width: z.ZodNumber;
263
- height: z.ZodNumber;
264
- layout: z.ZodOptional<z.ZodObject<{
265
- stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
266
- stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
267
- content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
268
- }, z.core.$strict>>;
269
262
  appearance: z.ZodOptional<z.ZodObject<{
270
263
  representation: z.ZodLiteral<"sdf">;
271
264
  defaults: z.ZodObject<{
@@ -275,6 +268,13 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
275
268
  haloBlur: z.ZodNumber;
276
269
  }, z.core.$strict>;
277
270
  }, z.core.$strict>>;
271
+ layout: z.ZodOptional<z.ZodObject<{
272
+ stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
273
+ stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
274
+ content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
275
+ }, z.core.$strict>>;
276
+ width: z.ZodNumber;
277
+ height: z.ZodNumber;
278
278
  pixelSha256: z.ZodObject<{
279
279
  oneX: z.ZodString;
280
280
  twoX: z.ZodString;
@@ -316,40 +316,6 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
316
316
  styles: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
317
317
  }, z.core.$strict>;
318
318
  native: z.ZodObject<{
319
- buildRecord: z.ZodLazy<z.core.$ZodObject<{
320
- schemaVersion: z.ZodLiteral<2>;
321
- renderer: z.ZodLiteral<"native">;
322
- profile: z.ZodLiteral<"native-v1">;
323
- validation: z.ZodLiteral<"static-artifacts">;
324
- preparationVersion: z.ZodLiteral<"native-lowering-v1">;
325
- engines: z.ZodLazy<z.core.$ZodObject<{
326
- android: z.ZodLiteral<"13.2.0">;
327
- ios: z.ZodLiteral<"6.26.0">;
328
- }, z.core.$strict>>;
329
- buildManifestSha256: z.ZodString;
330
- transformations: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
331
- map: z.ZodString;
332
- theme: z.ZodString;
333
- inputStyleSha256: z.ZodString;
334
- loweredStyleSha256: z.ZodString;
335
- inputLayers: z.ZodNumber;
336
- outputLayers: z.ZodNumber;
337
- projection: z.ZodEnum<{
338
- none: "none";
339
- "mercator-to-implicit": "mercator-to-implicit";
340
- "globe-to-mercator": "globe-to-mercator";
341
- }>;
342
- layers: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
343
- inputLayer: z.ZodNumber;
344
- outputStart: z.ZodNumber;
345
- outputCount: z.ZodNumber;
346
- properties: z.ZodArray<z.ZodEnum<{
347
- "line-dasharray": "line-dasharray";
348
- "line-cap": "line-cap";
349
- }>>;
350
- }, z.core.$strict>>>;
351
- }, z.core.$strict>>>;
352
- }, z.core.$strict>>;
353
319
  buildManifest: z.ZodObject<{
354
320
  schemaVersion: z.ZodLiteral<1>;
355
321
  maps: z.ZodRecord<z.ZodString, z.ZodObject<{
@@ -396,8 +362,8 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
396
362
  }>;
397
363
  id: z.ZodString;
398
364
  kind: z.ZodEnum<{
399
- pattern: "pattern";
400
365
  icon: "icon";
366
+ pattern: "pattern";
401
367
  }>;
402
368
  sha256: z.ZodString;
403
369
  }, z.core.$strict>, z.ZodObject<{
@@ -451,13 +417,6 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
451
417
  }, z.core.$strict>], "kind">>;
452
418
  winners: z.ZodArray<z.ZodObject<{
453
419
  id: z.ZodString;
454
- width: z.ZodNumber;
455
- height: z.ZodNumber;
456
- layout: z.ZodOptional<z.ZodObject<{
457
- stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
458
- stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
459
- content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
460
- }, z.core.$strict>>;
461
420
  appearance: z.ZodOptional<z.ZodObject<{
462
421
  representation: z.ZodLiteral<"sdf">;
463
422
  defaults: z.ZodObject<{
@@ -467,6 +426,13 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
467
426
  haloBlur: z.ZodNumber;
468
427
  }, z.core.$strict>;
469
428
  }, z.core.$strict>>;
429
+ layout: z.ZodOptional<z.ZodObject<{
430
+ stretchX: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
431
+ stretchY: z.ZodOptional<z.ZodArray<z.ZodTuple<[z.ZodNumber, z.ZodNumber], null>>>;
432
+ content: z.ZodOptional<z.ZodTuple<[z.ZodNumber, z.ZodNumber, z.ZodNumber, z.ZodNumber], null>>;
433
+ }, z.core.$strict>>;
434
+ width: z.ZodNumber;
435
+ height: z.ZodNumber;
470
436
  pixelSha256: z.ZodObject<{
471
437
  oneX: z.ZodString;
472
438
  twoX: z.ZodString;
@@ -506,6 +472,47 @@ declare const tileflowRendererDeploymentArtifactSchema: z.ZodObject<{
506
472
  }, z.core.$strict>>;
507
473
  }, z.core.$strict>;
508
474
  styles: z.ZodRecord<z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>>;
475
+ buildRecord: z.ZodLazy<z.core.$ZodObject<{
476
+ schemaVersion: z.ZodLiteral<2>;
477
+ renderer: z.ZodLiteral<"native">;
478
+ profile: z.ZodLiteral<"native-v1">;
479
+ validation: z.ZodLiteral<"static-artifacts">;
480
+ preparationVersion: z.ZodLiteral<"native-lowering-v1">;
481
+ engines: z.ZodLazy<z.core.$ZodObject<{
482
+ android: z.ZodLiteral<"13.2.0">;
483
+ ios: z.ZodLiteral<"6.26.0">;
484
+ }, z.core.$strict>>;
485
+ buildManifestSha256: z.ZodString;
486
+ transformations: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
487
+ map: z.ZodString;
488
+ theme: z.ZodString;
489
+ inputStyleSha256: z.ZodString;
490
+ loweredStyleSha256: z.ZodString;
491
+ inputLayers: z.ZodNumber;
492
+ outputLayers: z.ZodNumber;
493
+ projection: z.ZodEnum<{
494
+ "globe-to-mercator": "globe-to-mercator";
495
+ "mercator-to-implicit": "mercator-to-implicit";
496
+ none: "none";
497
+ }>;
498
+ layers: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
499
+ inputLayer: z.ZodNumber;
500
+ outputStart: z.ZodNumber;
501
+ outputCount: z.ZodNumber;
502
+ properties: z.ZodArray<z.ZodEnum<{
503
+ "line-cap": "line-cap";
504
+ "line-dasharray": "line-dasharray";
505
+ }>>;
506
+ }, z.core.$strict>>>;
507
+ symbolOverlap: z.ZodArray<z.ZodLazy<z.core.$ZodObject<{
508
+ inputLayer: z.ZodNumber;
509
+ properties: z.ZodArray<z.ZodEnum<{
510
+ "icon-overlap": "icon-overlap";
511
+ "text-overlap": "text-overlap";
512
+ }>>;
513
+ }, z.core.$strict>>>;
514
+ }, z.core.$strict>>>;
515
+ }, z.core.$strict>>;
509
516
  }, z.core.$strict>;
510
517
  }, z.core.$strict>;
511
518
  }, z.core.$strict>;
package/dist/build.js CHANGED
@@ -72,6 +72,7 @@ var canonicalLayers = {
72
72
  boundary: "boundary",
73
73
  building: "building",
74
74
  businessCorridor: "business_corridor",
75
+ canopy: "canopy",
75
76
  globalLandcover: "globallandcover",
76
77
  houseNumber: "housenumber",
77
78
  landcover: "landcover",
@@ -93,8 +94,10 @@ var canonicalFields = {
93
94
  adminLevel: "admin_level",
94
95
  bicycle: "bicycle",
95
96
  brunnel: "brunnel",
96
- buildingKind: "building_kind",
97
97
  buildingTone: "building_tone",
98
+ canopyClearanceAtZoom15: "clearance_px_z15",
99
+ canopyCoverPercent: "cover_pct",
100
+ canopyRank: "rank",
98
101
  capital: "capital",
99
102
  circularClearanceExtraAtZoom15: "clearance_extra_px_z15",
100
103
  circularInnerRadiusMeters: "inner_radius_m",
@@ -105,9 +108,9 @@ var canonicalFields = {
105
108
  class: "class",
106
109
  crossing: "crossing",
107
110
  circumference: "circumference",
108
- classificationConfidence: "classification_confidence",
109
111
  confidence: "confidence",
110
112
  diameterCrown: "diameter_crown",
113
+ direction: "direction",
111
114
  disputed: "disputed",
112
115
  elevation: "ele",
113
116
  elevationFeet: "ele_ft",
@@ -115,7 +118,6 @@ var canonicalFields = {
115
118
  foot: "foot",
116
119
  height: "height",
117
120
  hide3d: "hide_3d",
118
- hasBusiness: "has_business",
119
121
  hasParts: "has_parts",
120
122
  horse: "horse",
121
123
  houseNumber: "housenumber",
@@ -150,7 +152,6 @@ var canonicalFields = {
150
152
  ref: "ref",
151
153
  refLength: "ref_length",
152
154
  renderHeight: "render_height",
153
- renderMinZoom: "render_min_zoom",
154
155
  renderMinHeight: "render_min_height",
155
156
  service: "service",
156
157
  species: "species",
@@ -173,6 +174,7 @@ function openMapTiles(options = {}) {
173
174
  delete fields.bathymetryMinDepth;
174
175
  delete fields.bathymetrySortKey;
175
176
  }
177
+ if (options.capabilities?.canopy === false) delete layers.canopy;
176
178
  if (options.capabilities?.globalLandcover === false) delete layers.globalLandcover;
177
179
  if (options.capabilities?.tree === false) delete layers.tree;
178
180
  return {
@@ -190,14 +192,6 @@ function tileflowWorldV1Schema(options = {}) {
190
192
  ...options,
191
193
  capabilities: { ...options.capabilities, bathymetry: true, globalLandcover: true },
192
194
  fields: {
193
- circularClearanceExtraAtZoom15: "clearance_extra_px_z15",
194
- circularInnerRadiusMeters: "inner_radius_m",
195
- circularKind: "circle_kind",
196
- circularOuterRadiusMeters: "outer_radius_m",
197
- circularRadiusAtZoom15: "radius_px_z15",
198
- circularRadiusMeters: "radius_m",
199
- direction: "direction",
200
- hasParts: "has_parts",
201
195
  shieldKind: "shield_kind",
202
196
  shieldLineLengthMeters: "shield_line_length_m",
203
197
  shieldNetwork: "shield_network",
@@ -291,6 +285,7 @@ function dataIdentity(kind, schema, version, url) {
291
285
  capabilities: {
292
286
  businessCorridor: Boolean(schema.layers.businessCorridor),
293
287
  bathymetry: Boolean(schema.layers.bathymetry),
288
+ canopy: Boolean(schema.layers.canopy),
294
289
  globalLandcover: Boolean(schema.layers.globalLandcover),
295
290
  tree: Boolean(schema.layers.tree)
296
291
  }
@@ -447,7 +442,7 @@ function validateOpenMapTilesSchema(schema) {
447
442
  `Tileflow requires OpenMapTiles contract version ${openMapTilesContractVersion}.`
448
443
  );
449
444
  }
450
- const parkLayer = schema.semantics?.parkLayer ?? "mixed";
445
+ const parkLayer = schema.semantics?.parkLayer;
451
446
  if (parkLayer !== "mixed" && parkLayer !== "protected-only") {
452
447
  throw new Error("Tileflow OpenMapTiles semantics.parkLayer is invalid.");
453
448
  }
@@ -1340,7 +1335,7 @@ function applyTextStyle(layer, style) {
1340
1335
  layout["text-variable-anchor"] = [...style.variableAnchors];
1341
1336
  }
1342
1337
  if (style.justify !== void 0) layout["text-justify"] = style.justify;
1343
- if (style.allowOverlap !== void 0) layout["text-allow-overlap"] = style.allowOverlap;
1338
+ setOverlap(layout, "text", style);
1344
1339
  if (style.ignorePlacement !== void 0) layout["text-ignore-placement"] = style.ignorePlacement;
1345
1340
  if (style.keepUpright !== void 0) layout["text-keep-upright"] = style.keepUpright;
1346
1341
  if (style.optional !== void 0) layout["text-optional"] = style.optional;
@@ -1410,7 +1405,7 @@ function applyIconStyle(layer, style) {
1410
1405
  if (style.rotationAlignment !== void 0) {
1411
1406
  layout["icon-rotation-alignment"] = style.rotationAlignment;
1412
1407
  }
1413
- if (style.allowOverlap !== void 0) layout["icon-allow-overlap"] = style.allowOverlap;
1408
+ setOverlap(layout, "icon", style);
1414
1409
  if (style.ignorePlacement !== void 0) layout["icon-ignore-placement"] = style.ignorePlacement;
1415
1410
  if (style.keepUpright !== void 0) layout["icon-keep-upright"] = style.keepUpright;
1416
1411
  if (style.optional !== void 0) layout["icon-optional"] = style.optional;
@@ -1528,6 +1523,18 @@ function withoutRange(value) {
1528
1523
  const { maxZoom: _maxZoom, minZoom: _minZoom, visible: _visible, ...rest } = value;
1529
1524
  return rest;
1530
1525
  }
1526
+ function setOverlap(layout, part, style) {
1527
+ if (style.overlap !== void 0) layout[`${part}-overlap`] = style.overlap;
1528
+ else if (style.allowOverlap !== void 0) layout[`${part}-allow-overlap`] = style.allowOverlap;
1529
+ if (layout[`${part}-overlap`] !== void 0) delete layout[`${part}-allow-overlap`];
1530
+ }
1531
+ function withoutGovernedAllowOverlap(layout) {
1532
+ const result = { ...layout };
1533
+ for (const part of ["icon", "text"]) {
1534
+ if (result[`${part}-overlap`] !== void 0) delete result[`${part}-allow-overlap`];
1535
+ }
1536
+ return result;
1537
+ }
1531
1538
  function setPaint(paint, property, value) {
1532
1539
  if (value !== void 0) paint[property] = toMapLibreStyleValue(value);
1533
1540
  }
@@ -2061,15 +2068,6 @@ function buildingColorExpression(context) {
2061
2068
  colors.destination,
2062
2069
  ["==", ["coalesce", ["get", fields.buildingTone], ""], "commercial"],
2063
2070
  colors.commercial,
2064
- // Defensive compatibility for immutable V8.9 archives. New candidates emit building_tone.
2065
- [
2066
- "any",
2067
- ["==", ["get", fields.hasBusiness], true],
2068
- ["==", ["get", fields.hasBusiness], 1],
2069
- ["==", ["get", fields.hasBusiness], "1"],
2070
- ["==", ["coalesce", ["get", fields.buildingKind], "generic"], "commercial"]
2071
- ],
2072
- colors.commercial,
2073
2071
  colors.generic
2074
2072
  ];
2075
2073
  }
@@ -4144,7 +4142,7 @@ function createPoiLayer(options) {
4144
4142
  ["==", ["get", options.categoryField], options.category],
4145
4143
  ["has", options.filterRankField],
4146
4144
  [">=", filterRank, 0],
4147
- ["<=", filterRank, options.density],
4145
+ ["<=", filterRank, poiRankThreshold(options.density)],
4148
4146
  ["has", options.sizeRankField],
4149
4147
  [">=", sizeRank, 0],
4150
4148
  ["<=", sizeRank, 16]
@@ -4152,6 +4150,9 @@ function createPoiLayer(options) {
4152
4150
  layout: { "symbol-sort-key": poiSortKey(options.filterRankField, options.sizeRankField) }
4153
4151
  };
4154
4152
  }
4153
+ function poiRankThreshold(density) {
4154
+ return ["+", ["step", ["zoom"], 0, 16, 1, 17, 2], density];
4155
+ }
4155
4156
  function numericPoiField(field2, fallback) {
4156
4157
  return ["to-number", ["get", field2], fallback];
4157
4158
  }
@@ -6344,9 +6345,7 @@ function compileSidewalks(request, context, contributions) {
6344
6345
  }
6345
6346
  function compileRoundabouts(request, context, contributions) {
6346
6347
  const { fields, layers } = context.data.schema;
6347
- if (!layers.circularFeature || !fields.circularKind || !fields.circularRadiusAtZoom15 || !fields.circularRadiusMeters || !fields.circularOuterRadiusMeters || !fields.circularInnerRadiusMeters) {
6348
- return;
6349
- }
6348
+ if (!layers.circularFeature) return;
6350
6349
  const circularFields = {
6351
6350
  circularInnerRadiusMeters: fields.circularInnerRadiusMeters,
6352
6351
  circularOuterRadiusMeters: fields.circularOuterRadiusMeters,
@@ -6420,7 +6419,7 @@ function compileRoundabouts(request, context, contributions) {
6420
6419
  }
6421
6420
  function compileCrossings(request, context, contributions) {
6422
6421
  const { fields, layers } = context.data.schema;
6423
- if (!request || !layers.streetFurniture || !fields.direction) return;
6422
+ if (!request || !layers.streetFurniture) return;
6424
6423
  const config = mergeTileflowDesign(
6425
6424
  {
6426
6425
  allowOverlap: true,
@@ -6486,7 +6485,7 @@ function circularRoadInnerRadius(fields, casing) {
6486
6485
  ["/", values.innerRadiusMeters, values.radiusMeters]
6487
6486
  ];
6488
6487
  const baseWidth = circularRoadBaseWidth(fields.class);
6489
- const fallbackWidth = level === 15 ? baseWidth : ["*", baseWidth, circularRoadLegacyScale(level)];
6488
+ const fallbackWidth = level === 15 ? baseWidth : ["*", baseWidth, circularRoadFallbackScale(level)];
6490
6489
  const fallbackInnerRadius = ["-", centerlineRadius, ["/", fallbackWidth, 2]];
6491
6490
  const innerRadius = ["case", values.hasPhysicalRadii, physicalInnerRadius, fallbackInnerRadius];
6492
6491
  stops.push(level, [
@@ -6508,7 +6507,7 @@ function circularRoadStrokeWidth(fields, casing) {
6508
6507
  centerlineRadius,
6509
6508
  ["/", ["-", values.outerRadiusMeters, values.innerRadiusMeters], values.radiusMeters]
6510
6509
  ];
6511
- const fallbackWidth = level === 15 ? baseWidth : ["*", baseWidth, circularRoadLegacyScale(level)];
6510
+ const fallbackWidth = level === 15 ? baseWidth : ["*", baseWidth, circularRoadFallbackScale(level)];
6512
6511
  stops.push(level, [
6513
6512
  "case",
6514
6513
  values.hasPhysicalRadii,
@@ -6557,7 +6556,7 @@ function circularRoadValues(fields) {
6557
6556
  radiusMeters
6558
6557
  };
6559
6558
  }
6560
- function circularRoadLegacyScale(level) {
6559
+ function circularRoadFallbackScale(level) {
6561
6560
  const interpolationBase = 1.35;
6562
6561
  const progress = (interpolationBase ** (level - 15) - 1) / (interpolationBase ** (22 - 15) - 1);
6563
6562
  return 1 + progress * 1.2;
@@ -7162,7 +7161,7 @@ function cloneJson16(value) {
7162
7161
 
7163
7162
  // src/modules/vegetation/compiler.ts
7164
7163
  function compileVegetation(request, context) {
7165
- const minZoom = request?.flat?.minZoom ?? request?.minZoom ?? 16;
7164
+ const minZoom = request?.flat?.minZoom ?? 16;
7166
7165
  const mode = request?.mode ?? "3d";
7167
7166
  const config = mergeTileflowDesign(
7168
7167
  {
@@ -7182,7 +7181,6 @@ function compileVegetation(request, context) {
7182
7181
  strokeOpacity: 0.55,
7183
7182
  strokeWidth: 0.8
7184
7183
  },
7185
- minZoom,
7186
7184
  mode,
7187
7185
  threeDimensional: {
7188
7186
  barkColor: context.colors.vegetation.tree.bark,
@@ -7953,6 +7951,9 @@ function compareCodeUnits3(left, right) {
7953
7951
  return left < right ? -1 : left > right ? 1 : 0;
7954
7952
  }
7955
7953
 
7954
+ // src/layer-domain.ts
7955
+ var tileflowLayerDomainMetadataKey = "tileflow:domain";
7956
+
7956
7957
  // src/cartography/domains.ts
7957
7958
  var tileflowLayerDomains = Object.freeze([
7958
7959
  ...tileflowSemanticModuleNames,
@@ -8326,6 +8327,11 @@ function featureState(name) {
8326
8327
  if (!key) throw new Error("expr.featureState requires a non-empty state key.");
8327
8328
  return make(["feature-state", key]);
8328
8329
  }
8330
+ function globalState(name) {
8331
+ const key = name.trim();
8332
+ if (!key) throw new Error("expr.globalState requires a non-empty state key.");
8333
+ return make(["global-state", key]);
8334
+ }
8329
8335
  function variable(name) {
8330
8336
  const key = name.trim();
8331
8337
  if (!key) throw new Error("expr.var requires a non-empty variable name.");
@@ -8568,6 +8574,12 @@ function visitExpression(value, path, variables, issues) {
8568
8574
  }
8569
8575
  return;
8570
8576
  }
8577
+ case "global-state": {
8578
+ if (exact(2) && !isNonEmptyString(value[1])) {
8579
+ addExpressionIssue(issues, [...path, 1], "Global-state keys must be non-empty strings.");
8580
+ }
8581
+ return;
8582
+ }
8571
8583
  case "var": {
8572
8584
  if (exact(2)) {
8573
8585
  if (!isNonEmptyString(value[1])) {
@@ -8834,6 +8846,7 @@ var expr = Object.freeze({
8834
8846
  has,
8835
8847
  id,
8836
8848
  featureState,
8849
+ globalState,
8837
8850
  interpolate: interpolate2,
8838
8851
  let: letValue,
8839
8852
  literal,
@@ -9928,10 +9941,10 @@ function applyRefinement(previous, refinement) {
9928
9941
  style: {
9929
9942
  ...previous.style,
9930
9943
  ...patch.style?.placement === void 0 ? {} : {
9931
- placement: {
9944
+ placement: withoutGovernedAllowOverlap({
9932
9945
  ...previous.style.placement ?? {},
9933
9946
  ...patch.style.placement
9934
- }
9947
+ })
9935
9948
  },
9936
9949
  ...patch.style?.appearance === void 0 ? {} : {
9937
9950
  appearance: {
@@ -10837,6 +10850,7 @@ var textStyleSchema = z5.object({
10837
10850
  offset: numberOffsetValueSchema.optional(),
10838
10851
  optional: z5.boolean().optional(),
10839
10852
  opacity: numberValueSchema.optional(),
10853
+ overlap: z5.enum(["always", "cooperative", "never"]).optional(),
10840
10854
  padding: numberValueSchema.optional(),
10841
10855
  pitchAlignment: z5.enum(["auto", "map", "viewport"]).optional(),
10842
10856
  radialOffset: numberValueSchema.optional(),
@@ -10882,6 +10896,7 @@ var iconStyleSchema = z5.object({
10882
10896
  opacity: numberValueSchema.optional(),
10883
10897
  keepUpright: z5.boolean().optional(),
10884
10898
  optional: z5.boolean().optional(),
10899
+ overlap: z5.enum(["always", "cooperative", "never"]).optional(),
10885
10900
  padding: numberValueSchema.optional(),
10886
10901
  pitchAlignment: z5.enum(["auto", "map", "viewport"]).optional(),
10887
10902
  rotate: numberValueSchema.optional(),
@@ -11454,7 +11469,6 @@ var modulesSchema = z5.object({
11454
11469
  type: z5.literal("vegetation"),
11455
11470
  enabled: z5.boolean().optional(),
11456
11471
  flat: circleStyleSchema.optional(),
11457
- minZoom: zoomNumberSchema.optional(),
11458
11472
  mode: z5.enum(["3d", "flat"]).optional(),
11459
11473
  renderStack: renderStackSchema.optional(),
11460
11474
  threeDimensional: z5.object({
@@ -11490,6 +11504,7 @@ var layerBindingsSchema = z5.object({
11490
11504
  building: z5.string().trim().min(1),
11491
11505
  bathymetry: z5.string().trim().min(1).optional(),
11492
11506
  businessCorridor: z5.string().trim().min(1).optional(),
11507
+ canopy: z5.string().trim().min(1).optional(),
11493
11508
  circularFeature: z5.string().trim().min(1).optional(),
11494
11509
  globalLandcover: z5.string().trim().min(1).optional(),
11495
11510
  houseNumber: z5.string().trim().min(1),
@@ -11517,34 +11532,34 @@ var fieldBindingsSchema = z5.object({
11517
11532
  bathymetryMinDepth: z5.string().trim().min(1).optional(),
11518
11533
  bathymetrySortKey: z5.string().trim().min(1).optional(),
11519
11534
  brunnel: z5.string().trim().min(1),
11520
- buildingKind: z5.string().trim().min(1),
11521
11535
  buildingTone: z5.string().trim().min(1),
11536
+ canopyClearanceAtZoom15: z5.string().trim().min(1),
11537
+ canopyCoverPercent: z5.string().trim().min(1),
11538
+ canopyRank: z5.string().trim().min(1),
11522
11539
  capital: z5.string().trim().min(1),
11523
- circularClearanceExtraAtZoom15: z5.string().trim().min(1).optional(),
11524
- circularKind: z5.string().trim().min(1).optional(),
11525
- circularRadiusAtZoom15: z5.string().trim().min(1).optional(),
11526
- circularRadiusMeters: z5.string().trim().min(1).optional(),
11527
- circularInnerRadiusMeters: z5.string().trim().min(1).optional(),
11528
- circularOuterRadiusMeters: z5.string().trim().min(1).optional(),
11540
+ circularClearanceExtraAtZoom15: z5.string().trim().min(1),
11541
+ circularKind: z5.string().trim().min(1),
11542
+ circularRadiusAtZoom15: z5.string().trim().min(1),
11543
+ circularRadiusMeters: z5.string().trim().min(1),
11544
+ circularInnerRadiusMeters: z5.string().trim().min(1),
11545
+ circularOuterRadiusMeters: z5.string().trim().min(1),
11529
11546
  class: z5.string().trim().min(1),
11530
11547
  crossing: z5.string().trim().min(1),
11531
- classificationConfidence: z5.string().trim().min(1),
11532
11548
  confidence: z5.string().trim().min(1),
11533
11549
  circumference: z5.string().trim().min(1),
11534
11550
  diameterCrown: z5.string().trim().min(1),
11535
11551
  disputed: z5.string().trim().min(1),
11536
- direction: z5.string().trim().min(1).optional(),
11552
+ direction: z5.string().trim().min(1),
11537
11553
  elevation: z5.string().trim().min(1),
11538
11554
  elevationFeet: z5.string().trim().min(1),
11539
11555
  expressway: z5.string().trim().min(1),
11540
11556
  foot: z5.string().trim().min(1),
11541
11557
  height: z5.string().trim().min(1),
11542
- hasBusiness: z5.string().trim().min(1),
11543
- hasParts: z5.string().trim().min(1).optional(),
11558
+ hasParts: z5.string().trim().min(1),
11544
11559
  hide3d: z5.string().trim().min(1),
11545
11560
  horse: z5.string().trim().min(1),
11546
11561
  houseNumber: z5.string().trim().min(1),
11547
- importanceTier: z5.string().trim().min(1).optional(),
11562
+ importanceTier: z5.string().trim().min(1),
11548
11563
  iata: z5.string().trim().min(1),
11549
11564
  icao: z5.string().trim().min(1),
11550
11565
  indoor: z5.string().trim().min(1),
@@ -11575,7 +11590,6 @@ var fieldBindingsSchema = z5.object({
11575
11590
  ref: z5.string().trim().min(1),
11576
11591
  refLength: z5.string().trim().min(1),
11577
11592
  renderHeight: z5.string().trim().min(1),
11578
- renderMinZoom: z5.string().trim().min(1),
11579
11593
  renderMinHeight: z5.string().trim().min(1),
11580
11594
  shieldKind: z5.string().trim().min(1).optional(),
11581
11595
  shieldLineLengthMeters: z5.string().trim().min(1).optional(),
@@ -11601,6 +11615,7 @@ var openMapTilesSchema = z5.object({
11601
11615
  capabilities: schema.layers === void 0 ? void 0 : {
11602
11616
  businessCorridor: schema.layers.businessCorridor !== void 0,
11603
11617
  bathymetry: schema.layers.bathymetry !== void 0,
11618
+ canopy: schema.layers.canopy !== void 0,
11604
11619
  globalLandcover: schema.layers.globalLandcover !== void 0,
11605
11620
  tree: schema.layers.tree !== void 0
11606
11621
  },
@@ -14091,8 +14106,11 @@ function finalizeTileflowLayers(input) {
14091
14106
  }
14092
14107
  const metadata = isRecord8(layer.metadata) ? { ...layer.metadata } : void 0;
14093
14108
  if (metadata) {
14109
+ const owner = metadata[tileflowCompilerMetadataKeys.owner];
14094
14110
  delete metadata[tileflowCompilerProvenanceMetadataKey];
14095
14111
  for (const key of Object.values(tileflowCompilerMetadataKeys)) delete metadata[key];
14112
+ if (tileflowLayerDomains.includes(owner))
14113
+ metadata[tileflowLayerDomainMetadataKey] = owner;
14096
14114
  }
14097
14115
  return {
14098
14116
  ...layer,
@@ -14679,6 +14697,15 @@ var tileflowCaptureSceneSchema = z8.object({
14679
14697
  viewport: tileflowCaptureViewportSchema,
14680
14698
  target: tileflowCaptureTargetSchema.optional()
14681
14699
  }).strict();
14700
+ function tileflowCaptureSceneFitIssue(scene) {
14701
+ if (scene.camera.type !== "bounds" || scene.camera.padding === void 0) return void 0;
14702
+ const room = Math.min(scene.viewport.width, scene.viewport.height);
14703
+ if (scene.camera.padding * 2 < room) return void 0;
14704
+ return {
14705
+ message: `Expected bounds padding less than half the viewport's shorter side (${room / 2} pixels)`,
14706
+ path: ["camera", "padding"]
14707
+ };
14708
+ }
14682
14709
  function isPortableApplicationPath(value) {
14683
14710
  if (value !== value.trim() || !value.startsWith("/") || value.startsWith("//") || value.includes("#") || value.includes("\\") || hasControlCharacter(value)) {
14684
14711
  return false;
@@ -15164,8 +15191,8 @@ function validateMapScenes(map, mapId) {
15164
15191
  );
15165
15192
  }
15166
15193
  const result = tileflowCaptureSceneSchema.safeParse({ ...input, map: mapId });
15167
- if (!result.success) {
15168
- const issue = result.error.issues[0];
15194
+ const issue = result.success ? tileflowCaptureSceneFitIssue(result.data) : result.error.issues[0];
15195
+ if (!result.success || issue) {
15169
15196
  throw new Error(
15170
15197
  `Invalid Tileflow map "${map.id}". scenes.${sceneName}${issue?.path.length ? `.${issue.path.join(".")}` : ""}: ${issue?.message ?? "Invalid scene"}`
15171
15198
  );
@@ -15881,6 +15908,13 @@ var layerTransformationSchema = strictNativeObject({
15881
15908
  "Expected unique, ordered properties"
15882
15909
  )
15883
15910
  });
15911
+ var symbolOverlapTransformationSchema = strictNativeObject({
15912
+ inputLayer: layerCountSchema,
15913
+ properties: z12.array(z12.enum(["icon-overlap", "text-overlap"])).min(1).max(2).refine(
15914
+ (properties2) => properties2.length === 1 || properties2[0] === "icon-overlap" && properties2[1] === "text-overlap",
15915
+ "Expected unique, ordered properties"
15916
+ )
15917
+ });
15884
15918
  var tileflowNativeStyleTransformationSchema = strictNativeObject({
15885
15919
  map: tileflowPortableIdSchema,
15886
15920
  theme: tileflowThemeNameSchema,
@@ -15889,7 +15923,8 @@ var tileflowNativeStyleTransformationSchema = strictNativeObject({
15889
15923
  inputLayers: layerCountSchema,
15890
15924
  outputLayers: layerCountSchema,
15891
15925
  projection: z12.enum(["none", "mercator-to-implicit", "globe-to-mercator"]),
15892
- layers: z12.array(layerTransformationSchema).max(tileflowNativeProfileLimits.maximumLayers)
15926
+ layers: z12.array(layerTransformationSchema).max(tileflowNativeProfileLimits.maximumLayers),
15927
+ symbolOverlap: z12.array(symbolOverlapTransformationSchema).max(tileflowNativeProfileLimits.maximumLayers)
15893
15928
  }).superRefine((style, context) => {
15894
15929
  let previous = -1;
15895
15930
  let added = 0;
@@ -15911,6 +15946,18 @@ var tileflowNativeStyleTransformationSchema = strictNativeObject({
15911
15946
  message: "Layer counts do not match transformation spans"
15912
15947
  });
15913
15948
  }
15949
+ const partitioned = new Set(style.layers.map(({ inputLayer }) => inputLayer));
15950
+ previous = -1;
15951
+ for (const [index, layer] of style.symbolOverlap.entries()) {
15952
+ if (layer.inputLayer <= previous || layer.inputLayer >= style.inputLayers || partitioned.has(layer.inputLayer)) {
15953
+ context.addIssue({
15954
+ code: "custom",
15955
+ path: ["symbolOverlap", index],
15956
+ message: "Invalid symbol overlap layer"
15957
+ });
15958
+ }
15959
+ previous = layer.inputLayer;
15960
+ }
15914
15961
  });
15915
15962
  var tileflowNativeBuildRecordSchema = strictNativeObject({
15916
15963
  schemaVersion: z12.literal(2),
@@ -116,6 +116,16 @@ declare const tileflowCaptureSceneSchema: z.ZodObject<{
116
116
  }>>;
117
117
  }, z.core.$strict>], "kind">>;
118
118
  }, z.core.$strict>;
119
+ /**
120
+ * Why a scene's bounds padding leaves no room for its bounds, or undefined when it fits: padding on
121
+ * both sides must be less than the viewport's shorter side. MapLibre GL JS 6.11.2+ leaves a globe
122
+ * camera where it was when it cannot fit, so the capture would show the wrong view. Checked where
123
+ * scenes are validated rather than in the schema, so the published reference keeps its shape.
124
+ */
125
+ declare function tileflowCaptureSceneFitIssue(scene: Pick<TileflowCaptureScene, 'camera' | 'viewport'>): {
126
+ message: string;
127
+ path: ['camera', 'padding'];
128
+ } | undefined;
119
129
  type TileflowCaptureCenterCamera = z.infer<typeof tileflowCaptureCenterCameraSchema>;
120
130
  type TileflowCaptureBoundsCamera = z.infer<typeof tileflowCaptureBoundsCameraSchema>;
121
131
  type TileflowCaptureCamera = z.infer<typeof tileflowCaptureCameraSchema>;
@@ -158,4 +168,4 @@ type NormalizedTileflowCaptureScene = {
158
168
  declare function normalizeTileflowCaptureScene(input: TileflowCaptureScene): NormalizedTileflowCaptureScene;
159
169
  declare function normalizeTileflowCaptureId(value: string | undefined): string | undefined;
160
170
 
161
- export { type NormalizedTileflowCaptureScene as N, type TileflowCaptureScene as T, type TileflowCaptureApplicationTarget as a, type TileflowCaptureBoundsCamera as b, type TileflowCaptureCamera as c, type TileflowCaptureCenterCamera as d, type TileflowCaptureMapTarget as e, type TileflowCaptureTarget as f, type TileflowCaptureViewport as g, normalizeTileflowCaptureScene as h, tileflowCaptureBoundsCameraSchema as i, tileflowCaptureCameraSchema as j, tileflowCaptureCenterCameraSchema as k, tileflowCaptureIdSchema as l, tileflowCaptureMapTargetSchema as m, normalizeTileflowCaptureId as n, tileflowCaptureSceneLimits as o, tileflowCaptureSceneNameSchema as p, tileflowCaptureSceneSchema as q, tileflowCaptureSceneSchemaVersion as r, tileflowCaptureTargetSchema as s, tileflowCaptureApplicationTargetSchema as t, tileflowCaptureViewportSchema as u };
171
+ export { type NormalizedTileflowCaptureScene as N, type TileflowCaptureScene as T, type TileflowCaptureApplicationTarget as a, type TileflowCaptureBoundsCamera as b, type TileflowCaptureCamera as c, type TileflowCaptureCenterCamera as d, type TileflowCaptureMapTarget as e, type TileflowCaptureTarget as f, type TileflowCaptureViewport as g, normalizeTileflowCaptureScene as h, tileflowCaptureBoundsCameraSchema as i, tileflowCaptureCameraSchema as j, tileflowCaptureCenterCameraSchema as k, tileflowCaptureIdSchema as l, tileflowCaptureMapTargetSchema as m, normalizeTileflowCaptureId as n, tileflowCaptureSceneLimits as o, tileflowCaptureSceneNameSchema as p, tileflowCaptureSceneSchema as q, tileflowCaptureSceneSchemaVersion as r, tileflowCaptureTargetSchema as s, tileflowCaptureApplicationTargetSchema as t, tileflowCaptureViewportSchema as u, tileflowCaptureSceneFitIssue as v };
package/dist/capture.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { N as NormalizedTileflowCaptureScene, a as TileflowCaptureApplicationTarget, b as TileflowCaptureBoundsCamera, c as TileflowCaptureCamera, d as TileflowCaptureCenterCamera, e as TileflowCaptureMapTarget, T as TileflowCaptureScene, f as TileflowCaptureTarget, g as TileflowCaptureViewport, n as normalizeTileflowCaptureId, h as normalizeTileflowCaptureScene, t as tileflowCaptureApplicationTargetSchema, i as tileflowCaptureBoundsCameraSchema, j as tileflowCaptureCameraSchema, k as tileflowCaptureCenterCameraSchema, l as tileflowCaptureIdSchema, m as tileflowCaptureMapTargetSchema, o as tileflowCaptureSceneLimits, p as tileflowCaptureSceneNameSchema, q as tileflowCaptureSceneSchema, r as tileflowCaptureSceneSchemaVersion, s as tileflowCaptureTargetSchema, u as tileflowCaptureViewportSchema } from './capture-scene-D6soWztE.js';
1
+ export { N as NormalizedTileflowCaptureScene, a as TileflowCaptureApplicationTarget, b as TileflowCaptureBoundsCamera, c as TileflowCaptureCamera, d as TileflowCaptureCenterCamera, e as TileflowCaptureMapTarget, T as TileflowCaptureScene, f as TileflowCaptureTarget, g as TileflowCaptureViewport, n as normalizeTileflowCaptureId, h as normalizeTileflowCaptureScene, t as tileflowCaptureApplicationTargetSchema, i as tileflowCaptureBoundsCameraSchema, j as tileflowCaptureCameraSchema, k as tileflowCaptureCenterCameraSchema, l as tileflowCaptureIdSchema, m as tileflowCaptureMapTargetSchema, v as tileflowCaptureSceneFitIssue, o as tileflowCaptureSceneLimits, p as tileflowCaptureSceneNameSchema, q as tileflowCaptureSceneSchema, r as tileflowCaptureSceneSchemaVersion, s as tileflowCaptureTargetSchema, u as tileflowCaptureViewportSchema } from './capture-scene-BaAJjGq7.js';
2
2
  import { z } from 'zod';
3
3
 
4
4
  /** Canonical, filesystem-safe identity shared by authored and emitted Tileflow resources. */