@mapbox/mapbox-gl-style-spec 14.15.0-beta.2 → 14.16.0-beta.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.
Files changed (76) hide show
  1. package/deref.ts +3 -0
  2. package/diff.ts +63 -0
  3. package/dist/index.cjs +741 -54
  4. package/dist/index.cjs.map +1 -1
  5. package/dist/index.d.ts +205 -40
  6. package/dist/index.es.js +741 -54
  7. package/dist/index.es.js.map +1 -1
  8. package/expression/compound_expression.ts +4 -0
  9. package/expression/definitions/assertion.ts +7 -0
  10. package/expression/definitions/case.ts +2 -1
  11. package/expression/definitions/coalesce.ts +4 -0
  12. package/expression/definitions/coercion.ts +12 -0
  13. package/expression/definitions/collator.ts +8 -5
  14. package/expression/definitions/comparison.ts +12 -5
  15. package/expression/definitions/config.ts +12 -0
  16. package/expression/definitions/distance.ts +13 -2
  17. package/expression/definitions/format.ts +10 -0
  18. package/expression/definitions/image.ts +3 -0
  19. package/expression/definitions/in.ts +5 -0
  20. package/expression/definitions/index.ts +62 -10
  21. package/expression/definitions/index_of.ts +6 -0
  22. package/expression/definitions/interpolate.ts +5 -1
  23. package/expression/definitions/length.ts +2 -0
  24. package/expression/definitions/let.ts +1 -0
  25. package/expression/definitions/match.ts +5 -0
  26. package/expression/definitions/number_format.ts +7 -0
  27. package/expression/definitions/slice.ts +4 -0
  28. package/expression/definitions/within.ts +1 -0
  29. package/expression/index.ts +28 -19
  30. package/expression/parsing_context.ts +2 -0
  31. package/expression/types/image_variant.ts +3 -0
  32. package/expression/types.ts +1 -2
  33. package/expression/values.ts +1 -0
  34. package/feature_filter/convert.ts +9 -1
  35. package/feature_filter/index.ts +41 -1
  36. package/format.ts +5 -0
  37. package/function/convert.ts +5 -0
  38. package/function/index.ts +79 -25
  39. package/group_by_layout.ts +4 -5
  40. package/migrate/v8.ts +42 -3
  41. package/migrate/v9.ts +5 -0
  42. package/migrate.ts +1 -0
  43. package/package.json +1 -1
  44. package/read_style.ts +2 -0
  45. package/reference/v8.json +463 -18
  46. package/rollup.config.js +1 -0
  47. package/style-spec.ts +187 -74
  48. package/test.js +4 -0
  49. package/types.ts +74 -5
  50. package/util/geometry_util.ts +4 -0
  51. package/validate/validate.ts +3 -8
  52. package/validate/validate_appearance.ts +101 -0
  53. package/validate/validate_array.ts +6 -4
  54. package/validate/validate_enum.ts +2 -7
  55. package/validate/validate_expression.ts +48 -3
  56. package/validate/validate_filter.ts +5 -3
  57. package/validate/validate_fog.ts +6 -0
  58. package/validate/validate_function.ts +2 -0
  59. package/validate/validate_iconset.ts +1 -0
  60. package/validate/validate_import.ts +2 -2
  61. package/validate/validate_layer.ts +37 -4
  62. package/validate/validate_light.ts +6 -0
  63. package/validate/validate_lights.ts +9 -0
  64. package/validate/validate_model.ts +1 -2
  65. package/validate/validate_number.ts +4 -4
  66. package/validate/validate_object.ts +7 -0
  67. package/validate/validate_projection.ts +2 -0
  68. package/validate/validate_property.ts +15 -4
  69. package/validate/validate_rain.ts +5 -0
  70. package/validate/validate_snow.ts +5 -0
  71. package/validate/validate_source.ts +13 -3
  72. package/validate/validate_style.ts +1 -0
  73. package/validate/validate_terrain.ts +6 -0
  74. package/validate_mapbox_api_supported.ts +1 -0
  75. package/visit.ts +2 -0
  76. package/util/extend.ts +0 -9
@@ -16,6 +16,7 @@ export default function validateSnow(options: SnowValidatorOptions): ValidationE
16
16
  const snow = options.value;
17
17
  const style = options.style;
18
18
  const styleSpec = options.styleSpec;
19
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
19
20
  const snowSpec = styleSpec.snow;
20
21
 
21
22
  if (snow === undefined) {
@@ -30,18 +31,22 @@ export default function validateSnow(options: SnowValidatorOptions): ValidationE
30
31
  for (const key in snow) {
31
32
  const transitionMatch = key.match(/^(.*)-transition$/);
32
33
 
34
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
33
35
  if (transitionMatch && snowSpec[transitionMatch[1]] && snowSpec[transitionMatch[1]].transition) {
34
36
  errors = errors.concat(validate({
35
37
  key,
36
38
  value: snow[key],
39
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
37
40
  valueSpec: styleSpec.transition,
38
41
  style,
39
42
  styleSpec
40
43
  }));
44
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
41
45
  } else if (snowSpec[key]) {
42
46
  errors = errors.concat(validate({
43
47
  key,
44
48
  value: snow[key],
49
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
45
50
  valueSpec: snowSpec[key],
46
51
  style,
47
52
  styleSpec
@@ -53,6 +53,7 @@ export default function validateSource(options: SourceValidatorOptions): Validat
53
53
  errors = errors.concat(validateObject({
54
54
  key,
55
55
  value,
56
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
56
57
  valueSpec: styleSpec[`source_${type.replace('-', '_')}`],
57
58
  style: options.style,
58
59
  styleSpec,
@@ -63,6 +64,7 @@ export default function validateSource(options: SourceValidatorOptions): Validat
63
64
  errors = validateObject({
64
65
  key,
65
66
  value,
67
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
66
68
  valueSpec: styleSpec.source_geojson,
67
69
  style,
68
70
  styleSpec,
@@ -80,7 +82,9 @@ export default function validateSource(options: SourceValidatorOptions): Validat
80
82
  return [new ValidationError(`${key}.clusterProperties.${prop}`, propValue, 'array expected')];
81
83
  }
82
84
 
85
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
83
86
  const [operator, mapExpr] = propValue;
87
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
84
88
  const reduceExpr = typeof operator === 'string' ? [operator, ['accumulated'], ['get', prop]] : operator;
85
89
 
86
90
  errors.push(...validateExpression({
@@ -102,6 +106,7 @@ export default function validateSource(options: SourceValidatorOptions): Validat
102
106
  return validateObject({
103
107
  key,
104
108
  value,
109
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
105
110
  valueSpec: styleSpec.source_video,
106
111
  style,
107
112
  styleSpec
@@ -111,6 +116,7 @@ export default function validateSource(options: SourceValidatorOptions): Validat
111
116
  return validateObject({
112
117
  key,
113
118
  value,
119
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
114
120
  valueSpec: styleSpec.source_image,
115
121
  style,
116
122
  styleSpec
@@ -123,17 +129,19 @@ export default function validateSource(options: SourceValidatorOptions): Validat
123
129
  return validateEnum({
124
130
  key: `${key}.type`,
125
131
  value: (value as {type: unknown}).type,
126
- valueSpec: {values: getSourceTypeValues(styleSpec)},
127
- style,
128
- styleSpec
132
+ valueSpec: {values: getSourceTypeValues(styleSpec)}
129
133
  });
130
134
  }
131
135
  }
132
136
 
133
137
  function getSourceTypeValues(styleSpec: StyleReference): string[] {
138
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access
134
139
  return styleSpec.source.reduce((memo: string[], source: string) => {
140
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
135
141
  const sourceType = styleSpec[source];
142
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
136
143
  if (sourceType.type.type === 'enum') {
144
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-member-access
137
145
  memo = memo.concat(Object.keys(sourceType.type.values));
138
146
  }
139
147
  return memo;
@@ -161,7 +169,9 @@ function validatePromoteId({key, value}: PromoteIdValidatorOptions) {
161
169
  }
162
170
 
163
171
  // @ts-expect-error - TS2339: Property 'expression' does not exist on type 'ParsingError[] | StyleExpression'.
172
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
164
173
  const parsed = expression.value.expression;
174
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
165
175
  const onlyFeatureDependent = isConstant.isGlobalPropertyConstant(parsed, ['zoom', 'heatmap-density', 'line-progress', 'raster-value', 'sky-radial-progress', 'accumulated', 'is-supported-script', 'pitch', 'distance-from-center', 'measure-light', 'raster-particle-speed']);
166
176
  if (!onlyFeatureDependent) {
167
177
  errors.push(new ValidationError(`${key}`, null, 'promoteId expression should be only feature dependent'));
@@ -13,6 +13,7 @@ export default function validateStyle(style: unknown, styleSpec: StyleReference
13
13
  const errors = validateObject({
14
14
  key: options.key || '',
15
15
  value: style,
16
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
16
17
  valueSpec: Object.assign(
17
18
  styleSpec.$root,
18
19
  // Skip validation of the root properties that are not defined in the style spec (e.g. 'owner').
@@ -18,6 +18,7 @@ export default function validateTerrain(options: TerrainValidatorOptions): Valid
18
18
  const key = options.key;
19
19
  const style = options.style;
20
20
  const styleSpec = options.styleSpec;
21
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
21
22
  const terrainSpec = styleSpec.terrain;
22
23
 
23
24
  if (terrain == null) {
@@ -33,6 +34,7 @@ export default function validateTerrain(options: TerrainValidatorOptions): Valid
33
34
  const transitionMatch = key.match(/^(.*)-transition$/);
34
35
  const useThemeMatch = key.match(/^(.*)-use-theme$/);
35
36
 
37
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
36
38
  if (useThemeMatch && terrainSpec[useThemeMatch[1]]) {
37
39
  errors = errors.concat(validate({
38
40
  key,
@@ -41,18 +43,22 @@ export default function validateTerrain(options: TerrainValidatorOptions): Valid
41
43
  style,
42
44
  styleSpec
43
45
  }));
46
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
44
47
  } else if (transitionMatch && terrainSpec[transitionMatch[1]] && terrainSpec[transitionMatch[1]].transition) {
45
48
  errors = errors.concat(validate({
46
49
  key,
47
50
  value: terrain[key],
51
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
48
52
  valueSpec: styleSpec.transition,
49
53
  style,
50
54
  styleSpec
51
55
  }));
56
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
52
57
  } else if (terrainSpec[key]) {
53
58
  errors = errors.concat(validate({
54
59
  key,
55
60
  value: terrain[key],
61
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access
56
62
  valueSpec: terrainSpec[key],
57
63
  style,
58
64
  styleSpec
@@ -104,6 +104,7 @@ function getSourcesErrors(sources: SourcesSpecification): {
104
104
  errors.push(...sourceErrors);
105
105
  });
106
106
 
107
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
107
108
  return {errors, sourcesCount};
108
109
  }
109
110
 
package/visit.ts CHANGED
@@ -11,11 +11,13 @@ import type {
11
11
  function getPropertyReference(propertyName: string): StylePropertySpecification {
12
12
  for (let i = 0; i < Reference.layout.length; i++) {
13
13
  for (const key in Reference[Reference.layout[i]]) {
14
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
14
15
  if (key === propertyName) return Reference[Reference.layout[i]][key] as StylePropertySpecification;
15
16
  }
16
17
  }
17
18
  for (let i = 0; i < Reference.paint.length; i++) {
18
19
  for (const key in Reference[Reference.paint[i]]) {
20
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
19
21
  if (key === propertyName) return Reference[Reference.paint[i]][key] as StylePropertySpecification;
20
22
  }
21
23
  }
package/util/extend.ts DELETED
@@ -1,9 +0,0 @@
1
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2
- export default function (output: any, ...inputs: Array<any>): any {
3
- for (const input of inputs) {
4
- for (const k in input) {
5
- output[k] = input[k];
6
- }
7
- }
8
- return output;
9
- }