@mapbox/mapbox-gl-style-spec 14.29.0 → 14.30.0-alpha.742b92e7a62
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.cjs +104 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +74 -2
- package/dist/index.es.js +104 -10
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/reference/v8.json +62 -2
- package/types.ts +30 -1
- package/util/geometry_util.ts +24 -3
- package/validate/validate_layer.ts +1 -1
- package/validate/validate_lights.ts +3 -3
- package/validate_mapbox_api_supported.ts +15 -2
package/dist/index.cjs
CHANGED
|
@@ -1624,6 +1624,15 @@
|
|
|
1624
1624
|
}
|
|
1625
1625
|
}
|
|
1626
1626
|
},
|
|
1627
|
+
"placement-group": {
|
|
1628
|
+
doc: "Marks a placement priority group relative to other layers, going from lower to higher priority. Symbols from groups with higher priorities will be placed first",
|
|
1629
|
+
"sdk-support": {
|
|
1630
|
+
"basic functionality": {
|
|
1631
|
+
}
|
|
1632
|
+
},
|
|
1633
|
+
"private": true,
|
|
1634
|
+
experimental: true
|
|
1635
|
+
},
|
|
1627
1636
|
clip: {
|
|
1628
1637
|
doc: "Layer that removes 3D content from map.",
|
|
1629
1638
|
"sdk-support": {
|
|
@@ -1644,7 +1653,7 @@
|
|
|
1644
1653
|
},
|
|
1645
1654
|
source: {
|
|
1646
1655
|
type: "string",
|
|
1647
|
-
doc: "Name of a source description to be used for this layer. Required for all layer types except `background` and `
|
|
1656
|
+
doc: "Name of a source description to be used for this layer. Required for all layer types except `background`, `slot`, and `placement-group`."
|
|
1648
1657
|
},
|
|
1649
1658
|
"source-layer": {
|
|
1650
1659
|
type: "string",
|
|
@@ -9520,6 +9529,60 @@
|
|
|
9520
9529
|
]
|
|
9521
9530
|
},
|
|
9522
9531
|
"property-type": "data-driven"
|
|
9532
|
+
},
|
|
9533
|
+
"placement-priority": {
|
|
9534
|
+
type: "number",
|
|
9535
|
+
doc: "In-group placement priority. Higher values are placed first within the symbol's placement group.",
|
|
9536
|
+
"default": 0,
|
|
9537
|
+
minimum: 0,
|
|
9538
|
+
transition: false,
|
|
9539
|
+
appearance: true,
|
|
9540
|
+
expression: {
|
|
9541
|
+
interpolated: true,
|
|
9542
|
+
parameters: [
|
|
9543
|
+
"zoom",
|
|
9544
|
+
"pitch",
|
|
9545
|
+
"feature",
|
|
9546
|
+
"feature-state",
|
|
9547
|
+
"measure-light",
|
|
9548
|
+
"distance-from-center"
|
|
9549
|
+
]
|
|
9550
|
+
},
|
|
9551
|
+
"property-type": "data-driven",
|
|
9552
|
+
"sdk-support": {
|
|
9553
|
+
"basic functionality": {
|
|
9554
|
+
},
|
|
9555
|
+
"data-driven styling": {
|
|
9556
|
+
}
|
|
9557
|
+
},
|
|
9558
|
+
"private": true,
|
|
9559
|
+
experimental: true
|
|
9560
|
+
},
|
|
9561
|
+
"placement-group": {
|
|
9562
|
+
type: "string",
|
|
9563
|
+
doc: "Assigns this symbol layer to the specified placement-group layer, placing its symbols as if they were drawn within that group. When unset, the layer's symbols use an implicitly created placement group located at the same position as the symbol layer.",
|
|
9564
|
+
transition: false,
|
|
9565
|
+
appearance: true,
|
|
9566
|
+
expression: {
|
|
9567
|
+
interpolated: false,
|
|
9568
|
+
parameters: [
|
|
9569
|
+
"zoom",
|
|
9570
|
+
"pitch",
|
|
9571
|
+
"feature",
|
|
9572
|
+
"feature-state",
|
|
9573
|
+
"measure-light",
|
|
9574
|
+
"distance-from-center"
|
|
9575
|
+
]
|
|
9576
|
+
},
|
|
9577
|
+
"property-type": "data-driven",
|
|
9578
|
+
"sdk-support": {
|
|
9579
|
+
"basic functionality": {
|
|
9580
|
+
},
|
|
9581
|
+
"data-driven styling": {
|
|
9582
|
+
}
|
|
9583
|
+
},
|
|
9584
|
+
"private": true,
|
|
9585
|
+
experimental: true
|
|
9523
9586
|
}
|
|
9524
9587
|
};
|
|
9525
9588
|
var paint_raster = {
|
|
@@ -9658,7 +9721,9 @@
|
|
|
9658
9721
|
experimental: true,
|
|
9659
9722
|
"sdk-support": {
|
|
9660
9723
|
"basic functionality": {
|
|
9661
|
-
js: "3.29.0"
|
|
9724
|
+
js: "3.29.0",
|
|
9725
|
+
android: "11.30.0",
|
|
9726
|
+
ios: "11.30.0"
|
|
9662
9727
|
}
|
|
9663
9728
|
}
|
|
9664
9729
|
},
|
|
@@ -14582,14 +14647,31 @@
|
|
|
14582
14647
|
}
|
|
14583
14648
|
return sum;
|
|
14584
14649
|
}
|
|
14650
|
+
function isCollinear(ring) {
|
|
14651
|
+
const len = ring.length;
|
|
14652
|
+
if (len < 3) return true;
|
|
14653
|
+
const p0 = ring[0];
|
|
14654
|
+
let dx = 0, dy = 0, i = 1;
|
|
14655
|
+
for (; i < len; i++) {
|
|
14656
|
+
dx = ring[i].x - p0.x;
|
|
14657
|
+
dy = ring[i].y - p0.y;
|
|
14658
|
+
if (dx !== 0 || dy !== 0) break;
|
|
14659
|
+
}
|
|
14660
|
+
if (i === len) return true;
|
|
14661
|
+
for (; i < len; i++) {
|
|
14662
|
+
const px = ring[i].x - p0.x;
|
|
14663
|
+
const py = ring[i].y - p0.y;
|
|
14664
|
+
if (dx * py - dy * px !== 0) return false;
|
|
14665
|
+
}
|
|
14666
|
+
return true;
|
|
14667
|
+
}
|
|
14585
14668
|
function classifyRings(rings, maxRings) {
|
|
14586
14669
|
const len = rings.length;
|
|
14587
|
-
if (len <= 1) return [rings];
|
|
14588
14670
|
const polygons = [];
|
|
14589
14671
|
let polygon, ccw;
|
|
14590
14672
|
for (let i = 0; i < len; i++) {
|
|
14591
14673
|
const area = calculateSignedArea(rings[i]);
|
|
14592
|
-
if (area === 0) continue;
|
|
14674
|
+
if (area === 0 && isCollinear(rings[i])) continue;
|
|
14593
14675
|
rings[i].area = Math.abs(area);
|
|
14594
14676
|
if (ccw === void 0) ccw = area < 0;
|
|
14595
14677
|
if (ccw === area < 0) {
|
|
@@ -20335,7 +20417,7 @@ Use an identity property function instead: ${example}.`
|
|
|
20335
20417
|
} else {
|
|
20336
20418
|
type = unbundle(parent.type);
|
|
20337
20419
|
}
|
|
20338
|
-
} else if (!(type === "background" || type === "sky" || type === "slot")) {
|
|
20420
|
+
} else if (!(type === "background" || type === "sky" || type === "slot" || type === "placement-group")) {
|
|
20339
20421
|
if (!layer.source) {
|
|
20340
20422
|
errors.push(new ValidationError(key, layer, 'missing required property "source"'));
|
|
20341
20423
|
} else if (!isString(layer.source)) {
|
|
@@ -20719,7 +20801,7 @@ Use an identity property function instead: ${example}.`
|
|
|
20719
20801
|
const useThemeMatch = propertyKey.match(USE_THEME_KEY_RE);
|
|
20720
20802
|
if (useThemeMatch && lightPropertySpec[useThemeMatch[1]]) {
|
|
20721
20803
|
errors = errors.concat(validate({
|
|
20722
|
-
key:
|
|
20804
|
+
key: propertyKey,
|
|
20723
20805
|
value: properties[propertyKey],
|
|
20724
20806
|
valueSpec: { type: "string" },
|
|
20725
20807
|
style,
|
|
@@ -20727,8 +20809,8 @@ Use an identity property function instead: ${example}.`
|
|
|
20727
20809
|
}));
|
|
20728
20810
|
} else if (transitionMatch && lightPropertySpec[transitionMatch[1]] && lightPropertySpec[transitionMatch[1]].transition) {
|
|
20729
20811
|
errors = errors.concat(validate({
|
|
20730
|
-
key:
|
|
20731
|
-
value:
|
|
20812
|
+
key: propertyKey,
|
|
20813
|
+
value: properties[propertyKey],
|
|
20732
20814
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
20733
20815
|
valueSpec: styleSpec.transition,
|
|
20734
20816
|
style,
|
|
@@ -21220,7 +21302,8 @@ Use an identity property function instead: ${example}.`
|
|
|
21220
21302
|
const MAPBOX_SPRITE_URL_RE = /^mapbox:\/\/sprites\/([^/]*)\/([^/]*)\/?([^/]*)?$/;
|
|
21221
21303
|
const VISIBILITY_RE = /^(public|private)$/;
|
|
21222
21304
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
21223
|
-
const MAX_SOURCES_IN_STYLE =
|
|
21305
|
+
const MAX_SOURCES_IN_STYLE = 64;
|
|
21306
|
+
const MAX_TILESETS_IN_SOURCE = 15;
|
|
21224
21307
|
function isValid(value, regex) {
|
|
21225
21308
|
if (!value || !isString(value)) return true;
|
|
21226
21309
|
return !!value.match(regex);
|
|
@@ -21257,10 +21340,20 @@ Use an identity property function instead: ${example}.`
|
|
|
21257
21340
|
function getMaxSourcesErrors(sourcesCount) {
|
|
21258
21341
|
const errors = [];
|
|
21259
21342
|
if (sourcesCount > MAX_SOURCES_IN_STYLE) {
|
|
21260
|
-
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer
|
|
21343
|
+
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer tilesets`));
|
|
21261
21344
|
}
|
|
21262
21345
|
return errors;
|
|
21263
21346
|
}
|
|
21347
|
+
function getMaxTilesetsErrors(sources) {
|
|
21348
|
+
const errors = [];
|
|
21349
|
+
Object.keys(sources).forEach((s, i) => {
|
|
21350
|
+
const source = sources[s];
|
|
21351
|
+
if (getSourceCount(source) > MAX_TILESETS_IN_SOURCE) {
|
|
21352
|
+
errors.push(new ValidationError(`sources[${i}].url`, source.url, `Sources must contain ${MAX_TILESETS_IN_SOURCE} or fewer tilesets`));
|
|
21353
|
+
}
|
|
21354
|
+
});
|
|
21355
|
+
return errors;
|
|
21356
|
+
}
|
|
21264
21357
|
function getSourcesErrors(sources) {
|
|
21265
21358
|
const errors = [];
|
|
21266
21359
|
let sourcesCount = 0;
|
|
@@ -21341,6 +21434,7 @@ Use an identity property function instead: ${example}.`
|
|
|
21341
21434
|
const sourcesErrors = getSourcesErrors(s.sources);
|
|
21342
21435
|
sourcesCount += sourcesErrors.sourcesCount;
|
|
21343
21436
|
errors = errors.concat(sourcesErrors.errors);
|
|
21437
|
+
errors = errors.concat(getMaxTilesetsErrors(s.sources));
|
|
21344
21438
|
}
|
|
21345
21439
|
if (s.imports) {
|
|
21346
21440
|
const importsErrors = getImportErrors(s.imports);
|