@mapbox/mapbox-gl-style-spec 14.27.0 → 14.28.0-alpha.fa7f708fbcc
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 +115 -152
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +56 -48
- package/dist/index.es.js +115 -152
- package/dist/index.es.js.map +1 -1
- package/error/parsing_error.ts +1 -1
- package/expression/definitions/config.ts +1 -3
- package/expression/definitions/index.ts +56 -7
- package/expression/index.ts +3 -3
- package/expression/types/resolved_image.ts +5 -1
- package/package.json +1 -1
- package/read_style.ts +2 -2
- package/reference/v8.json +59 -5
- package/types.ts +10 -46
- package/util/color.ts +12 -15
- package/util/geometry_util.ts +30 -30
- package/util/interpolate.ts +1 -1
- package/validate_mapbox_api_supported.ts +1 -2
- package/expression/definitions/in.ts +0 -86
- package/expression/definitions/index_of.ts +0 -104
- package/expression/definitions/split.ts +0 -56
package/dist/index.cjs
CHANGED
|
@@ -1681,8 +1681,7 @@
|
|
|
1681
1681
|
"supported-layer-types": [
|
|
1682
1682
|
"symbol"
|
|
1683
1683
|
],
|
|
1684
|
-
|
|
1685
|
-
doc: "Conditional styling applied to symbol layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Works with appearances' are supported."
|
|
1684
|
+
doc: "Conditional styling applied to symbol layer features based on dynamic conditions. If multiple conditions are true, only the first matching appearance will be applied. Only properties marked with 'Works with appearances' are supported. Known issue: at the moment having both `appearances` and `text-variable-anchor` in the same layer doesn't work correctly."
|
|
1686
1685
|
}
|
|
1687
1686
|
};
|
|
1688
1687
|
var appearance = {
|
|
@@ -3919,7 +3918,7 @@
|
|
|
3919
3918
|
]
|
|
3920
3919
|
}
|
|
3921
3920
|
],
|
|
3922
|
-
doc: "To increase the chance of placing high-priority labels on the map, you can provide an array of `text-anchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the `text-radial-offset` or the two-dimensional `text-offset`.",
|
|
3921
|
+
doc: "To increase the chance of placing high-priority labels on the map, you can provide an array of `text-anchor` locations: the renderer will attempt to place the label at each location, in order, before moving onto the next label. Use `text-justify: auto` to choose justification based on anchor position. To apply an offset, use the `text-radial-offset` or the two-dimensional `text-offset`. Known issue: at the moment having both `appearances` and `text-variable-anchor` in the same layer doesn't work correctly.",
|
|
3923
3922
|
"sdk-support": {
|
|
3924
3923
|
"basic functionality": {
|
|
3925
3924
|
js: "0.54.0",
|
|
@@ -8094,7 +8093,6 @@
|
|
|
8094
8093
|
},
|
|
8095
8094
|
"line-border-width": {
|
|
8096
8095
|
type: "number",
|
|
8097
|
-
"private": true,
|
|
8098
8096
|
doc: "The width of the line border. A value of zero means no border.",
|
|
8099
8097
|
"default": 0,
|
|
8100
8098
|
minimum: 0,
|
|
@@ -8123,7 +8121,6 @@
|
|
|
8123
8121
|
},
|
|
8124
8122
|
"line-border-color": {
|
|
8125
8123
|
type: "color",
|
|
8126
|
-
"private": true,
|
|
8127
8124
|
doc: "The color of the line border. If line-border-width is greater than zero and the alpha value of this color is 0 (default), the color for the border will be selected automatically based on the line color.",
|
|
8128
8125
|
"default": "rgba(0, 0, 0, 0)",
|
|
8129
8126
|
"use-theme": true,
|
|
@@ -8150,6 +8147,49 @@
|
|
|
8150
8147
|
},
|
|
8151
8148
|
"property-type": "data-driven"
|
|
8152
8149
|
},
|
|
8150
|
+
"line-border-gradient": {
|
|
8151
|
+
type: "color",
|
|
8152
|
+
experimental: true,
|
|
8153
|
+
doc: "A gradient used to color the border of a line feature at various distances along its length. Defined using a `step` or `interpolate` expression which outputs a color for each corresponding `line-progress` input value. `line-progress` is a percentage of the line feature's total length as measured on the webmercator projected coordinate plane (a `number` between `0` and `1`). Takes precedence over `line-border-color`. Has no effect unless `line-border-width` is greater than zero. Can only be used with GeoJSON sources that specify `\"lineMetrics\": true`.",
|
|
8154
|
+
example: [
|
|
8155
|
+
"step",
|
|
8156
|
+
[
|
|
8157
|
+
"line-progress"
|
|
8158
|
+
],
|
|
8159
|
+
"blue",
|
|
8160
|
+
0.5,
|
|
8161
|
+
"gray"
|
|
8162
|
+
],
|
|
8163
|
+
"use-theme": true,
|
|
8164
|
+
transition: false,
|
|
8165
|
+
requires: [
|
|
8166
|
+
{
|
|
8167
|
+
"!": "line-pattern"
|
|
8168
|
+
},
|
|
8169
|
+
{
|
|
8170
|
+
source: "geojson",
|
|
8171
|
+
has: {
|
|
8172
|
+
lineMetrics: true
|
|
8173
|
+
}
|
|
8174
|
+
}
|
|
8175
|
+
],
|
|
8176
|
+
"sdk-support": {
|
|
8177
|
+
"basic functionality": {
|
|
8178
|
+
js: "3.28.0",
|
|
8179
|
+
android: "11.28.0",
|
|
8180
|
+
ios: "11.28.0"
|
|
8181
|
+
},
|
|
8182
|
+
"data-driven styling": {
|
|
8183
|
+
}
|
|
8184
|
+
},
|
|
8185
|
+
expression: {
|
|
8186
|
+
interpolated: true,
|
|
8187
|
+
parameters: [
|
|
8188
|
+
"line-progress"
|
|
8189
|
+
]
|
|
8190
|
+
},
|
|
8191
|
+
"property-type": "color-ramp"
|
|
8192
|
+
},
|
|
8153
8193
|
"line-occlusion-opacity": {
|
|
8154
8194
|
type: "number",
|
|
8155
8195
|
"default": 0,
|
|
@@ -9806,6 +9846,21 @@
|
|
|
9806
9846
|
interpolated: false
|
|
9807
9847
|
},
|
|
9808
9848
|
"property-type": "data-constant"
|
|
9849
|
+
},
|
|
9850
|
+
"raster-allow-draping": {
|
|
9851
|
+
type: "boolean",
|
|
9852
|
+
"default": true,
|
|
9853
|
+
experimental: true,
|
|
9854
|
+
doc: "Whether the raster layer is allowed to drape over terrain and globe. When disabled, the layer is rendered after all draped layers, which can change its position in the layer order. Disabling draping has a performance cost, since the terrain/globe geometry must be rendered again for each such layer.",
|
|
9855
|
+
transition: false,
|
|
9856
|
+
"property-type": "data-constant",
|
|
9857
|
+
"sdk-support": {
|
|
9858
|
+
"basic functionality": {
|
|
9859
|
+
js: "3.28.0",
|
|
9860
|
+
android: "11.28.0",
|
|
9861
|
+
ios: "11.28.0"
|
|
9862
|
+
}
|
|
9863
|
+
}
|
|
9809
9864
|
}
|
|
9810
9865
|
};
|
|
9811
9866
|
var paint_hillshade = {
|
|
@@ -13196,7 +13251,9 @@
|
|
|
13196
13251
|
return new ImageVariant(this.secondaryId, this.secondaryOptions);
|
|
13197
13252
|
}
|
|
13198
13253
|
static from(image) {
|
|
13199
|
-
|
|
13254
|
+
if (typeof image !== "string") return image;
|
|
13255
|
+
const resolved = ResolvedImage.build({ name: image });
|
|
13256
|
+
return resolved;
|
|
13200
13257
|
}
|
|
13201
13258
|
static build(primaryId, secondaryId, primaryOptions, secondaryOptions) {
|
|
13202
13259
|
if (!primaryId || typeof primaryId === "object" && !("name" in primaryId)) return null;
|
|
@@ -15540,9 +15597,7 @@
|
|
|
15540
15597
|
}
|
|
15541
15598
|
static parse(args, context) {
|
|
15542
15599
|
let type = context.expectedType;
|
|
15543
|
-
|
|
15544
|
-
type = ValueType;
|
|
15545
|
-
}
|
|
15600
|
+
type ?? (type = ValueType);
|
|
15546
15601
|
if (args.length < 2 || args.length > 3) {
|
|
15547
15602
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
15548
15603
|
}
|
|
@@ -16499,112 +16554,6 @@
|
|
|
16499
16554
|
}
|
|
16500
16555
|
}
|
|
16501
16556
|
|
|
16502
|
-
class In {
|
|
16503
|
-
constructor(needle, haystack) {
|
|
16504
|
-
this.type = BooleanType;
|
|
16505
|
-
this.needle = needle;
|
|
16506
|
-
this.haystack = haystack;
|
|
16507
|
-
}
|
|
16508
|
-
static parse(args, context) {
|
|
16509
|
-
if (args.length !== 3) {
|
|
16510
|
-
context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);
|
|
16511
|
-
return null;
|
|
16512
|
-
}
|
|
16513
|
-
const needle = context.parse(args[1], 1, ValueType);
|
|
16514
|
-
const haystack = context.parse(args[2], 2, ValueType);
|
|
16515
|
-
if (!needle || !haystack) return null;
|
|
16516
|
-
if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {
|
|
16517
|
-
context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(needle.type)} instead`);
|
|
16518
|
-
return null;
|
|
16519
|
-
}
|
|
16520
|
-
return new In(needle, haystack);
|
|
16521
|
-
}
|
|
16522
|
-
evaluate(ctx) {
|
|
16523
|
-
const needle = this.needle.evaluate(ctx);
|
|
16524
|
-
const haystack = this.haystack.evaluate(ctx);
|
|
16525
|
-
if (haystack == null) return false;
|
|
16526
|
-
if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
|
|
16527
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
|
|
16528
|
-
}
|
|
16529
|
-
if (!isValidNativeType(haystack, ["string", "array"])) {
|
|
16530
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
|
|
16531
|
-
}
|
|
16532
|
-
return haystack.includes(needle);
|
|
16533
|
-
}
|
|
16534
|
-
eachChild(fn) {
|
|
16535
|
-
fn(this.needle);
|
|
16536
|
-
fn(this.haystack);
|
|
16537
|
-
}
|
|
16538
|
-
outputDefined() {
|
|
16539
|
-
return true;
|
|
16540
|
-
}
|
|
16541
|
-
serialize() {
|
|
16542
|
-
return ["in", this.needle.serialize(), this.haystack.serialize()];
|
|
16543
|
-
}
|
|
16544
|
-
}
|
|
16545
|
-
|
|
16546
|
-
class IndexOf {
|
|
16547
|
-
constructor(needle, haystack, fromIndex) {
|
|
16548
|
-
this.type = NumberType;
|
|
16549
|
-
this.needle = needle;
|
|
16550
|
-
this.haystack = haystack;
|
|
16551
|
-
this.fromIndex = fromIndex;
|
|
16552
|
-
}
|
|
16553
|
-
static parse(args, context) {
|
|
16554
|
-
if (args.length <= 2 || args.length >= 5) {
|
|
16555
|
-
context.error(`Expected 3 or 4 arguments, but found ${args.length - 1} instead.`);
|
|
16556
|
-
return null;
|
|
16557
|
-
}
|
|
16558
|
-
const needle = context.parse(args[1], 1, ValueType);
|
|
16559
|
-
const haystack = context.parse(args[2], 2, ValueType);
|
|
16560
|
-
if (!needle || !haystack) return null;
|
|
16561
|
-
if (!isValidType(needle.type, [BooleanType, StringType, NumberType, NullType, ValueType])) {
|
|
16562
|
-
context.error(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(needle.type)} instead`);
|
|
16563
|
-
return null;
|
|
16564
|
-
}
|
|
16565
|
-
if (args.length === 4) {
|
|
16566
|
-
const fromIndex = context.parse(args[3], 3, NumberType);
|
|
16567
|
-
if (!fromIndex) return null;
|
|
16568
|
-
return new IndexOf(needle, haystack, fromIndex);
|
|
16569
|
-
} else {
|
|
16570
|
-
return new IndexOf(needle, haystack);
|
|
16571
|
-
}
|
|
16572
|
-
}
|
|
16573
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16574
|
-
evaluate(ctx) {
|
|
16575
|
-
const needle = this.needle.evaluate(ctx);
|
|
16576
|
-
const haystack = this.haystack.evaluate(ctx);
|
|
16577
|
-
if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
|
|
16578
|
-
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
|
|
16579
|
-
}
|
|
16580
|
-
if (!isValidNativeType(haystack, ["string", "array"])) {
|
|
16581
|
-
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
|
|
16582
|
-
}
|
|
16583
|
-
if (this.fromIndex) {
|
|
16584
|
-
const fromIndex = this.fromIndex.evaluate(ctx);
|
|
16585
|
-
return haystack.indexOf(needle, fromIndex);
|
|
16586
|
-
}
|
|
16587
|
-
return haystack.indexOf(needle);
|
|
16588
|
-
}
|
|
16589
|
-
eachChild(fn) {
|
|
16590
|
-
fn(this.needle);
|
|
16591
|
-
fn(this.haystack);
|
|
16592
|
-
if (this.fromIndex) {
|
|
16593
|
-
fn(this.fromIndex);
|
|
16594
|
-
}
|
|
16595
|
-
}
|
|
16596
|
-
outputDefined() {
|
|
16597
|
-
return false;
|
|
16598
|
-
}
|
|
16599
|
-
serialize() {
|
|
16600
|
-
if (this.fromIndex != null && this.fromIndex !== void 0) {
|
|
16601
|
-
const fromIndex = this.fromIndex.serialize();
|
|
16602
|
-
return ["index-of", this.needle.serialize(), this.haystack.serialize(), fromIndex];
|
|
16603
|
-
}
|
|
16604
|
-
return ["index-of", this.needle.serialize(), this.haystack.serialize()];
|
|
16605
|
-
}
|
|
16606
|
-
}
|
|
16607
|
-
|
|
16608
16557
|
class Match {
|
|
16609
16558
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
16610
16559
|
this.inputType = inputType;
|
|
@@ -16827,38 +16776,6 @@
|
|
|
16827
16776
|
}
|
|
16828
16777
|
}
|
|
16829
16778
|
|
|
16830
|
-
class Split {
|
|
16831
|
-
constructor(str, delimiter) {
|
|
16832
|
-
this.type = array$1(StringType);
|
|
16833
|
-
this.str = str;
|
|
16834
|
-
this.delimiter = delimiter;
|
|
16835
|
-
}
|
|
16836
|
-
static parse(args, context) {
|
|
16837
|
-
if (args.length !== 3) {
|
|
16838
|
-
return context.error(`Expected 2 arguments, but found ${args.length - 1} instead.`);
|
|
16839
|
-
}
|
|
16840
|
-
const str = context.parse(args[1], 1, StringType);
|
|
16841
|
-
const delimiter = context.parse(args[2], 2, StringType);
|
|
16842
|
-
if (!str || !delimiter) return;
|
|
16843
|
-
return new Split(str, delimiter);
|
|
16844
|
-
}
|
|
16845
|
-
evaluate(ctx) {
|
|
16846
|
-
const str = this.str.evaluate(ctx);
|
|
16847
|
-
const delimiter = this.delimiter.evaluate(ctx);
|
|
16848
|
-
return str.split(delimiter);
|
|
16849
|
-
}
|
|
16850
|
-
eachChild(fn) {
|
|
16851
|
-
fn(this.str);
|
|
16852
|
-
fn(this.delimiter);
|
|
16853
|
-
}
|
|
16854
|
-
outputDefined() {
|
|
16855
|
-
return false;
|
|
16856
|
-
}
|
|
16857
|
-
serialize() {
|
|
16858
|
-
return ["split", this.str.serialize(), this.delimiter.serialize()];
|
|
16859
|
-
}
|
|
16860
|
-
}
|
|
16861
|
-
|
|
16862
16779
|
function isComparableType(op, type) {
|
|
16863
16780
|
if (op === "==" || op === "!=") {
|
|
16864
16781
|
return type.kind === "boolean" || type.kind === "string" || type.kind === "number" || type.kind === "null" || type.kind === "value";
|
|
@@ -17166,8 +17083,6 @@
|
|
|
17166
17083
|
"collator": CollatorExpression,
|
|
17167
17084
|
"format": FormatExpression,
|
|
17168
17085
|
"image": ImageExpression,
|
|
17169
|
-
"in": In,
|
|
17170
|
-
"index-of": IndexOf,
|
|
17171
17086
|
"interpolate": Interpolate,
|
|
17172
17087
|
"interpolate-hcl": Interpolate,
|
|
17173
17088
|
"interpolate-lab": Interpolate,
|
|
@@ -17188,8 +17103,7 @@
|
|
|
17188
17103
|
"var": Var,
|
|
17189
17104
|
"within": Within,
|
|
17190
17105
|
"distance": Distance,
|
|
17191
|
-
"config": Config
|
|
17192
|
-
"split": Split
|
|
17106
|
+
"config": Config
|
|
17193
17107
|
};
|
|
17194
17108
|
function rgba(ctx, [r, g, b, a]) {
|
|
17195
17109
|
r = r.evaluate(ctx);
|
|
@@ -17234,6 +17148,14 @@
|
|
|
17234
17148
|
function varargs(type) {
|
|
17235
17149
|
return { type };
|
|
17236
17150
|
}
|
|
17151
|
+
function assertNeedleHaystack(needle, haystack) {
|
|
17152
|
+
if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
|
|
17153
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
|
|
17154
|
+
}
|
|
17155
|
+
if (!isValidNativeType(haystack, ["string", "array"])) {
|
|
17156
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
|
|
17157
|
+
}
|
|
17158
|
+
}
|
|
17237
17159
|
function hashString(str) {
|
|
17238
17160
|
let hash = 0;
|
|
17239
17161
|
if (str.length === 0) {
|
|
@@ -17783,6 +17705,47 @@
|
|
|
17783
17705
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
17784
17706
|
(ctx, args) => args.map((arg) => toString(arg.evaluate(ctx))).join("")
|
|
17785
17707
|
],
|
|
17708
|
+
"split": [
|
|
17709
|
+
array$1(StringType),
|
|
17710
|
+
[StringType, StringType],
|
|
17711
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
17712
|
+
(ctx, [str, delimiter]) => str.evaluate(ctx).split(delimiter.evaluate(ctx))
|
|
17713
|
+
],
|
|
17714
|
+
"in": [
|
|
17715
|
+
BooleanType,
|
|
17716
|
+
[ValueType, ValueType],
|
|
17717
|
+
(ctx, [needleExpr, haystackExpr]) => {
|
|
17718
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17719
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17720
|
+
if (haystack == null) return false;
|
|
17721
|
+
assertNeedleHaystack(needle, haystack);
|
|
17722
|
+
return haystack.includes(needle);
|
|
17723
|
+
}
|
|
17724
|
+
],
|
|
17725
|
+
"index-of": {
|
|
17726
|
+
type: NumberType,
|
|
17727
|
+
overloads: [
|
|
17728
|
+
[
|
|
17729
|
+
[ValueType, ValueType],
|
|
17730
|
+
(ctx, [needleExpr, haystackExpr]) => {
|
|
17731
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17732
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17733
|
+
assertNeedleHaystack(needle, haystack);
|
|
17734
|
+
return haystack.indexOf(needle);
|
|
17735
|
+
}
|
|
17736
|
+
],
|
|
17737
|
+
[
|
|
17738
|
+
[ValueType, ValueType, NumberType],
|
|
17739
|
+
(ctx, [needleExpr, haystackExpr, fromIndexExpr]) => {
|
|
17740
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17741
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17742
|
+
const fromIndex = fromIndexExpr.evaluate(ctx);
|
|
17743
|
+
assertNeedleHaystack(needle, haystack);
|
|
17744
|
+
return haystack.indexOf(needle, fromIndex);
|
|
17745
|
+
}
|
|
17746
|
+
]
|
|
17747
|
+
]
|
|
17748
|
+
},
|
|
17786
17749
|
"resolved-locale": [
|
|
17787
17750
|
StringType,
|
|
17788
17751
|
[CollatorType],
|
|
@@ -19523,7 +19486,7 @@ ${JSON.stringify(filterExp, null, 2)}
|
|
|
19523
19486
|
this.error = error;
|
|
19524
19487
|
this.message = error.message;
|
|
19525
19488
|
const match = error.message.match(LINE_NUMBER_RE);
|
|
19526
|
-
this.line = match ? parseInt(match[1], 10) : 0;
|
|
19489
|
+
this.line = match && match[1] ? parseInt(match[1], 10) : 0;
|
|
19527
19490
|
}
|
|
19528
19491
|
}
|
|
19529
19492
|
|