@mapbox/mapbox-gl-style-spec 14.29.0 → 14.30.0-rc.1
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 +39 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.es.js +39 -8
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
- package/reference/v8.json +3 -1
- package/util/geometry_util.ts +24 -3
- package/validate/validate_lights.ts +3 -3
- package/validate_mapbox_api_supported.ts +15 -2
package/dist/index.cjs
CHANGED
|
@@ -9658,7 +9658,9 @@
|
|
|
9658
9658
|
experimental: true,
|
|
9659
9659
|
"sdk-support": {
|
|
9660
9660
|
"basic functionality": {
|
|
9661
|
-
js: "3.29.0"
|
|
9661
|
+
js: "3.29.0",
|
|
9662
|
+
android: "11.30.0",
|
|
9663
|
+
ios: "11.30.0"
|
|
9662
9664
|
}
|
|
9663
9665
|
}
|
|
9664
9666
|
},
|
|
@@ -14582,14 +14584,31 @@
|
|
|
14582
14584
|
}
|
|
14583
14585
|
return sum;
|
|
14584
14586
|
}
|
|
14587
|
+
function isCollinear(ring) {
|
|
14588
|
+
const len = ring.length;
|
|
14589
|
+
if (len < 3) return true;
|
|
14590
|
+
const p0 = ring[0];
|
|
14591
|
+
let dx = 0, dy = 0, i = 1;
|
|
14592
|
+
for (; i < len; i++) {
|
|
14593
|
+
dx = ring[i].x - p0.x;
|
|
14594
|
+
dy = ring[i].y - p0.y;
|
|
14595
|
+
if (dx !== 0 || dy !== 0) break;
|
|
14596
|
+
}
|
|
14597
|
+
if (i === len) return true;
|
|
14598
|
+
for (; i < len; i++) {
|
|
14599
|
+
const px = ring[i].x - p0.x;
|
|
14600
|
+
const py = ring[i].y - p0.y;
|
|
14601
|
+
if (dx * py - dy * px !== 0) return false;
|
|
14602
|
+
}
|
|
14603
|
+
return true;
|
|
14604
|
+
}
|
|
14585
14605
|
function classifyRings(rings, maxRings) {
|
|
14586
14606
|
const len = rings.length;
|
|
14587
|
-
if (len <= 1) return [rings];
|
|
14588
14607
|
const polygons = [];
|
|
14589
14608
|
let polygon, ccw;
|
|
14590
14609
|
for (let i = 0; i < len; i++) {
|
|
14591
14610
|
const area = calculateSignedArea(rings[i]);
|
|
14592
|
-
if (area === 0) continue;
|
|
14611
|
+
if (area === 0 && isCollinear(rings[i])) continue;
|
|
14593
14612
|
rings[i].area = Math.abs(area);
|
|
14594
14613
|
if (ccw === void 0) ccw = area < 0;
|
|
14595
14614
|
if (ccw === area < 0) {
|
|
@@ -20719,7 +20738,7 @@ Use an identity property function instead: ${example}.`
|
|
|
20719
20738
|
const useThemeMatch = propertyKey.match(USE_THEME_KEY_RE);
|
|
20720
20739
|
if (useThemeMatch && lightPropertySpec[useThemeMatch[1]]) {
|
|
20721
20740
|
errors = errors.concat(validate({
|
|
20722
|
-
key:
|
|
20741
|
+
key: propertyKey,
|
|
20723
20742
|
value: properties[propertyKey],
|
|
20724
20743
|
valueSpec: { type: "string" },
|
|
20725
20744
|
style,
|
|
@@ -20727,8 +20746,8 @@ Use an identity property function instead: ${example}.`
|
|
|
20727
20746
|
}));
|
|
20728
20747
|
} else if (transitionMatch && lightPropertySpec[transitionMatch[1]] && lightPropertySpec[transitionMatch[1]].transition) {
|
|
20729
20748
|
errors = errors.concat(validate({
|
|
20730
|
-
key:
|
|
20731
|
-
value:
|
|
20749
|
+
key: propertyKey,
|
|
20750
|
+
value: properties[propertyKey],
|
|
20732
20751
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
20733
20752
|
valueSpec: styleSpec.transition,
|
|
20734
20753
|
style,
|
|
@@ -21220,7 +21239,8 @@ Use an identity property function instead: ${example}.`
|
|
|
21220
21239
|
const MAPBOX_SPRITE_URL_RE = /^mapbox:\/\/sprites\/([^/]*)\/([^/]*)\/?([^/]*)?$/;
|
|
21221
21240
|
const VISIBILITY_RE = /^(public|private)$/;
|
|
21222
21241
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
21223
|
-
const MAX_SOURCES_IN_STYLE =
|
|
21242
|
+
const MAX_SOURCES_IN_STYLE = 64;
|
|
21243
|
+
const MAX_TILESETS_IN_SOURCE = 15;
|
|
21224
21244
|
function isValid(value, regex) {
|
|
21225
21245
|
if (!value || !isString(value)) return true;
|
|
21226
21246
|
return !!value.match(regex);
|
|
@@ -21257,10 +21277,20 @@ Use an identity property function instead: ${example}.`
|
|
|
21257
21277
|
function getMaxSourcesErrors(sourcesCount) {
|
|
21258
21278
|
const errors = [];
|
|
21259
21279
|
if (sourcesCount > MAX_SOURCES_IN_STYLE) {
|
|
21260
|
-
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer
|
|
21280
|
+
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer tilesets`));
|
|
21261
21281
|
}
|
|
21262
21282
|
return errors;
|
|
21263
21283
|
}
|
|
21284
|
+
function getMaxTilesetsErrors(sources) {
|
|
21285
|
+
const errors = [];
|
|
21286
|
+
Object.keys(sources).forEach((s, i) => {
|
|
21287
|
+
const source = sources[s];
|
|
21288
|
+
if (getSourceCount(source) > MAX_TILESETS_IN_SOURCE) {
|
|
21289
|
+
errors.push(new ValidationError(`sources[${i}].url`, source.url, `Sources must contain ${MAX_TILESETS_IN_SOURCE} or fewer tilesets`));
|
|
21290
|
+
}
|
|
21291
|
+
});
|
|
21292
|
+
return errors;
|
|
21293
|
+
}
|
|
21264
21294
|
function getSourcesErrors(sources) {
|
|
21265
21295
|
const errors = [];
|
|
21266
21296
|
let sourcesCount = 0;
|
|
@@ -21341,6 +21371,7 @@ Use an identity property function instead: ${example}.`
|
|
|
21341
21371
|
const sourcesErrors = getSourcesErrors(s.sources);
|
|
21342
21372
|
sourcesCount += sourcesErrors.sourcesCount;
|
|
21343
21373
|
errors = errors.concat(sourcesErrors.errors);
|
|
21374
|
+
errors = errors.concat(getMaxTilesetsErrors(s.sources));
|
|
21344
21375
|
}
|
|
21345
21376
|
if (s.imports) {
|
|
21346
21377
|
const importsErrors = getImportErrors(s.imports);
|