@mapbox/mapbox-gl-style-spec 14.27.0 → 14.28.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 +100 -152
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +37 -48
- package/dist/index.es.js +100 -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/types/resolved_image.ts +5 -1
- package/package.json +1 -1
- package/reference/v8.json +44 -5
- package/types.ts +5 -45
- package/util/color.ts +12 -15
- package/util/geometry_util.ts +30 -30
- package/util/interpolate.ts +1 -1
- 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,
|
|
@@ -13196,7 +13236,9 @@
|
|
|
13196
13236
|
return new ImageVariant(this.secondaryId, this.secondaryOptions);
|
|
13197
13237
|
}
|
|
13198
13238
|
static from(image) {
|
|
13199
|
-
|
|
13239
|
+
if (typeof image !== "string") return image;
|
|
13240
|
+
const resolved = ResolvedImage.build({ name: image });
|
|
13241
|
+
return resolved;
|
|
13200
13242
|
}
|
|
13201
13243
|
static build(primaryId, secondaryId, primaryOptions, secondaryOptions) {
|
|
13202
13244
|
if (!primaryId || typeof primaryId === "object" && !("name" in primaryId)) return null;
|
|
@@ -15540,9 +15582,7 @@
|
|
|
15540
15582
|
}
|
|
15541
15583
|
static parse(args, context) {
|
|
15542
15584
|
let type = context.expectedType;
|
|
15543
|
-
|
|
15544
|
-
type = ValueType;
|
|
15545
|
-
}
|
|
15585
|
+
type ?? (type = ValueType);
|
|
15546
15586
|
if (args.length < 2 || args.length > 3) {
|
|
15547
15587
|
return context.error(`Invalid number of arguments for 'config' expression.`);
|
|
15548
15588
|
}
|
|
@@ -16499,112 +16539,6 @@
|
|
|
16499
16539
|
}
|
|
16500
16540
|
}
|
|
16501
16541
|
|
|
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
16542
|
class Match {
|
|
16609
16543
|
constructor(inputType, outputType, input, cases, outputs, otherwise) {
|
|
16610
16544
|
this.inputType = inputType;
|
|
@@ -16827,38 +16761,6 @@
|
|
|
16827
16761
|
}
|
|
16828
16762
|
}
|
|
16829
16763
|
|
|
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
16764
|
function isComparableType(op, type) {
|
|
16863
16765
|
if (op === "==" || op === "!=") {
|
|
16864
16766
|
return type.kind === "boolean" || type.kind === "string" || type.kind === "number" || type.kind === "null" || type.kind === "value";
|
|
@@ -17166,8 +17068,6 @@
|
|
|
17166
17068
|
"collator": CollatorExpression,
|
|
17167
17069
|
"format": FormatExpression,
|
|
17168
17070
|
"image": ImageExpression,
|
|
17169
|
-
"in": In,
|
|
17170
|
-
"index-of": IndexOf,
|
|
17171
17071
|
"interpolate": Interpolate,
|
|
17172
17072
|
"interpolate-hcl": Interpolate,
|
|
17173
17073
|
"interpolate-lab": Interpolate,
|
|
@@ -17188,8 +17088,7 @@
|
|
|
17188
17088
|
"var": Var,
|
|
17189
17089
|
"within": Within,
|
|
17190
17090
|
"distance": Distance,
|
|
17191
|
-
"config": Config
|
|
17192
|
-
"split": Split
|
|
17091
|
+
"config": Config
|
|
17193
17092
|
};
|
|
17194
17093
|
function rgba(ctx, [r, g, b, a]) {
|
|
17195
17094
|
r = r.evaluate(ctx);
|
|
@@ -17234,6 +17133,14 @@
|
|
|
17234
17133
|
function varargs(type) {
|
|
17235
17134
|
return { type };
|
|
17236
17135
|
}
|
|
17136
|
+
function assertNeedleHaystack(needle, haystack) {
|
|
17137
|
+
if (!isValidNativeType(needle, ["boolean", "string", "number", "null"])) {
|
|
17138
|
+
throw new RuntimeError(`Expected first argument to be of type boolean, string, number or null, but found ${toString$1(typeOf(needle))} instead.`);
|
|
17139
|
+
}
|
|
17140
|
+
if (!isValidNativeType(haystack, ["string", "array"])) {
|
|
17141
|
+
throw new RuntimeError(`Expected second argument to be of type array or string, but found ${toString$1(typeOf(haystack))} instead.`);
|
|
17142
|
+
}
|
|
17143
|
+
}
|
|
17237
17144
|
function hashString(str) {
|
|
17238
17145
|
let hash = 0;
|
|
17239
17146
|
if (str.length === 0) {
|
|
@@ -17783,6 +17690,47 @@
|
|
|
17783
17690
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
17784
17691
|
(ctx, args) => args.map((arg) => toString(arg.evaluate(ctx))).join("")
|
|
17785
17692
|
],
|
|
17693
|
+
"split": [
|
|
17694
|
+
array$1(StringType),
|
|
17695
|
+
[StringType, StringType],
|
|
17696
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-return
|
|
17697
|
+
(ctx, [str, delimiter]) => str.evaluate(ctx).split(delimiter.evaluate(ctx))
|
|
17698
|
+
],
|
|
17699
|
+
"in": [
|
|
17700
|
+
BooleanType,
|
|
17701
|
+
[ValueType, ValueType],
|
|
17702
|
+
(ctx, [needleExpr, haystackExpr]) => {
|
|
17703
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17704
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17705
|
+
if (haystack == null) return false;
|
|
17706
|
+
assertNeedleHaystack(needle, haystack);
|
|
17707
|
+
return haystack.includes(needle);
|
|
17708
|
+
}
|
|
17709
|
+
],
|
|
17710
|
+
"index-of": {
|
|
17711
|
+
type: NumberType,
|
|
17712
|
+
overloads: [
|
|
17713
|
+
[
|
|
17714
|
+
[ValueType, ValueType],
|
|
17715
|
+
(ctx, [needleExpr, haystackExpr]) => {
|
|
17716
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17717
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17718
|
+
assertNeedleHaystack(needle, haystack);
|
|
17719
|
+
return haystack.indexOf(needle);
|
|
17720
|
+
}
|
|
17721
|
+
],
|
|
17722
|
+
[
|
|
17723
|
+
[ValueType, ValueType, NumberType],
|
|
17724
|
+
(ctx, [needleExpr, haystackExpr, fromIndexExpr]) => {
|
|
17725
|
+
const needle = needleExpr.evaluate(ctx);
|
|
17726
|
+
const haystack = haystackExpr.evaluate(ctx);
|
|
17727
|
+
const fromIndex = fromIndexExpr.evaluate(ctx);
|
|
17728
|
+
assertNeedleHaystack(needle, haystack);
|
|
17729
|
+
return haystack.indexOf(needle, fromIndex);
|
|
17730
|
+
}
|
|
17731
|
+
]
|
|
17732
|
+
]
|
|
17733
|
+
},
|
|
17786
17734
|
"resolved-locale": [
|
|
17787
17735
|
StringType,
|
|
17788
17736
|
[CollatorType],
|
|
@@ -19523,7 +19471,7 @@ ${JSON.stringify(filterExp, null, 2)}
|
|
|
19523
19471
|
this.error = error;
|
|
19524
19472
|
this.message = error.message;
|
|
19525
19473
|
const match = error.message.match(LINE_NUMBER_RE);
|
|
19526
|
-
this.line = match ? parseInt(match[1], 10) : 0;
|
|
19474
|
+
this.line = match && match[1] ? parseInt(match[1], 10) : 0;
|
|
19527
19475
|
}
|
|
19528
19476
|
}
|
|
19529
19477
|
|