@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.d.ts
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -9652,7 +9652,9 @@ var paint_raster = {
|
|
|
9652
9652
|
experimental: true,
|
|
9653
9653
|
"sdk-support": {
|
|
9654
9654
|
"basic functionality": {
|
|
9655
|
-
js: "3.29.0"
|
|
9655
|
+
js: "3.29.0",
|
|
9656
|
+
android: "11.30.0",
|
|
9657
|
+
ios: "11.30.0"
|
|
9656
9658
|
}
|
|
9657
9659
|
}
|
|
9658
9660
|
},
|
|
@@ -14576,14 +14578,31 @@ function calculateSignedArea(ring) {
|
|
|
14576
14578
|
}
|
|
14577
14579
|
return sum;
|
|
14578
14580
|
}
|
|
14581
|
+
function isCollinear(ring) {
|
|
14582
|
+
const len = ring.length;
|
|
14583
|
+
if (len < 3) return true;
|
|
14584
|
+
const p0 = ring[0];
|
|
14585
|
+
let dx = 0, dy = 0, i = 1;
|
|
14586
|
+
for (; i < len; i++) {
|
|
14587
|
+
dx = ring[i].x - p0.x;
|
|
14588
|
+
dy = ring[i].y - p0.y;
|
|
14589
|
+
if (dx !== 0 || dy !== 0) break;
|
|
14590
|
+
}
|
|
14591
|
+
if (i === len) return true;
|
|
14592
|
+
for (; i < len; i++) {
|
|
14593
|
+
const px = ring[i].x - p0.x;
|
|
14594
|
+
const py = ring[i].y - p0.y;
|
|
14595
|
+
if (dx * py - dy * px !== 0) return false;
|
|
14596
|
+
}
|
|
14597
|
+
return true;
|
|
14598
|
+
}
|
|
14579
14599
|
function classifyRings(rings, maxRings) {
|
|
14580
14600
|
const len = rings.length;
|
|
14581
|
-
if (len <= 1) return [rings];
|
|
14582
14601
|
const polygons = [];
|
|
14583
14602
|
let polygon, ccw;
|
|
14584
14603
|
for (let i = 0; i < len; i++) {
|
|
14585
14604
|
const area = calculateSignedArea(rings[i]);
|
|
14586
|
-
if (area === 0) continue;
|
|
14605
|
+
if (area === 0 && isCollinear(rings[i])) continue;
|
|
14587
14606
|
rings[i].area = Math.abs(area);
|
|
14588
14607
|
if (ccw === void 0) ccw = area < 0;
|
|
14589
14608
|
if (ccw === area < 0) {
|
|
@@ -20713,7 +20732,7 @@ function validateLights(options) {
|
|
|
20713
20732
|
const useThemeMatch = propertyKey.match(USE_THEME_KEY_RE);
|
|
20714
20733
|
if (useThemeMatch && lightPropertySpec[useThemeMatch[1]]) {
|
|
20715
20734
|
errors = errors.concat(validate({
|
|
20716
|
-
key:
|
|
20735
|
+
key: propertyKey,
|
|
20717
20736
|
value: properties[propertyKey],
|
|
20718
20737
|
valueSpec: { type: "string" },
|
|
20719
20738
|
style,
|
|
@@ -20721,8 +20740,8 @@ function validateLights(options) {
|
|
|
20721
20740
|
}));
|
|
20722
20741
|
} else if (transitionMatch && lightPropertySpec[transitionMatch[1]] && lightPropertySpec[transitionMatch[1]].transition) {
|
|
20723
20742
|
errors = errors.concat(validate({
|
|
20724
|
-
key:
|
|
20725
|
-
value:
|
|
20743
|
+
key: propertyKey,
|
|
20744
|
+
value: properties[propertyKey],
|
|
20726
20745
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
20727
20746
|
valueSpec: styleSpec.transition,
|
|
20728
20747
|
style,
|
|
@@ -21214,7 +21233,8 @@ const MAPBOX_GLYPH_URL_RE = /^mapbox:\/\/fonts\/([^/]*)\/{fontstack}\/{range}.pb
|
|
|
21214
21233
|
const MAPBOX_SPRITE_URL_RE = /^mapbox:\/\/sprites\/([^/]*)\/([^/]*)\/?([^/]*)?$/;
|
|
21215
21234
|
const VISIBILITY_RE = /^(public|private)$/;
|
|
21216
21235
|
const SUPPORTED_SPEC_VERSION = 8;
|
|
21217
|
-
const MAX_SOURCES_IN_STYLE =
|
|
21236
|
+
const MAX_SOURCES_IN_STYLE = 64;
|
|
21237
|
+
const MAX_TILESETS_IN_SOURCE = 15;
|
|
21218
21238
|
function isValid(value, regex) {
|
|
21219
21239
|
if (!value || !isString(value)) return true;
|
|
21220
21240
|
return !!value.match(regex);
|
|
@@ -21251,10 +21271,20 @@ function getSourceErrors(source, i) {
|
|
|
21251
21271
|
function getMaxSourcesErrors(sourcesCount) {
|
|
21252
21272
|
const errors = [];
|
|
21253
21273
|
if (sourcesCount > MAX_SOURCES_IN_STYLE) {
|
|
21254
|
-
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer
|
|
21274
|
+
errors.push(new ValidationError("sources", null, `Styles must contain ${MAX_SOURCES_IN_STYLE} or fewer tilesets`));
|
|
21255
21275
|
}
|
|
21256
21276
|
return errors;
|
|
21257
21277
|
}
|
|
21278
|
+
function getMaxTilesetsErrors(sources) {
|
|
21279
|
+
const errors = [];
|
|
21280
|
+
Object.keys(sources).forEach((s, i) => {
|
|
21281
|
+
const source = sources[s];
|
|
21282
|
+
if (getSourceCount(source) > MAX_TILESETS_IN_SOURCE) {
|
|
21283
|
+
errors.push(new ValidationError(`sources[${i}].url`, source.url, `Sources must contain ${MAX_TILESETS_IN_SOURCE} or fewer tilesets`));
|
|
21284
|
+
}
|
|
21285
|
+
});
|
|
21286
|
+
return errors;
|
|
21287
|
+
}
|
|
21258
21288
|
function getSourcesErrors(sources) {
|
|
21259
21289
|
const errors = [];
|
|
21260
21290
|
let sourcesCount = 0;
|
|
@@ -21335,6 +21365,7 @@ function validateMapboxApiSupported(style, styleSpec = v8) {
|
|
|
21335
21365
|
const sourcesErrors = getSourcesErrors(s.sources);
|
|
21336
21366
|
sourcesCount += sourcesErrors.sourcesCount;
|
|
21337
21367
|
errors = errors.concat(sourcesErrors.errors);
|
|
21368
|
+
errors = errors.concat(getMaxTilesetsErrors(s.sources));
|
|
21338
21369
|
}
|
|
21339
21370
|
if (s.imports) {
|
|
21340
21371
|
const importsErrors = getImportErrors(s.imports);
|