@mapwhit/tilerenderer 0.50.0 → 0.51.0

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 (142) hide show
  1. package/build/min/package.json +1 -1
  2. package/build/min/src/shaders/.dir +0 -0
  3. package/build/min/src/shaders/_prelude.fragment.glsl.js +14 -0
  4. package/build/min/src/shaders/_prelude.vertex.glsl.js +14 -0
  5. package/build/min/src/shaders/background.fragment.glsl.js +5 -0
  6. package/build/min/src/shaders/background.vertex.glsl.js +1 -0
  7. package/build/min/src/shaders/background_pattern.fragment.glsl.js +5 -0
  8. package/build/min/src/shaders/background_pattern.vertex.glsl.js +1 -0
  9. package/build/min/src/shaders/circle.fragment.glsl.js +20 -0
  10. package/build/min/src/shaders/circle.vertex.glsl.js +17 -0
  11. package/build/min/src/shaders/clipping_mask.fragment.glsl.js +1 -0
  12. package/build/min/src/shaders/clipping_mask.vertex.glsl.js +1 -0
  13. package/build/min/src/shaders/collision_box.fragment.glsl.js +1 -0
  14. package/build/min/src/shaders/collision_box.vertex.glsl.js +1 -0
  15. package/build/min/src/shaders/collision_circle.fragment.glsl.js +1 -0
  16. package/build/min/src/shaders/collision_circle.vertex.glsl.js +1 -0
  17. package/build/min/src/shaders/debug.fragment.glsl.js +1 -0
  18. package/build/min/src/shaders/debug.vertex.glsl.js +1 -0
  19. package/build/min/src/shaders/fill.fragment.glsl.js +10 -0
  20. package/build/min/src/shaders/fill.vertex.glsl.js +7 -0
  21. package/build/min/src/shaders/fill_extrusion.fragment.glsl.js +5 -0
  22. package/build/min/src/shaders/fill_extrusion.vertex.glsl.js +9 -0
  23. package/build/min/src/shaders/fill_extrusion_pattern.fragment.glsl.js +15 -0
  24. package/build/min/src/shaders/fill_extrusion_pattern.vertex.glsl.js +11 -0
  25. package/build/min/src/shaders/fill_outline.fragment.glsl.js +10 -0
  26. package/build/min/src/shaders/fill_outline.vertex.glsl.js +7 -0
  27. package/build/min/src/shaders/fill_outline_pattern.fragment.glsl.js +13 -0
  28. package/build/min/src/shaders/fill_outline_pattern.vertex.glsl.js +9 -0
  29. package/build/min/src/shaders/fill_pattern.fragment.glsl.js +13 -0
  30. package/build/min/src/shaders/fill_pattern.vertex.glsl.js +9 -0
  31. package/build/min/src/shaders/heatmap.fragment.glsl.js +10 -0
  32. package/build/min/src/shaders/heatmap.vertex.glsl.js +8 -0
  33. package/build/min/src/shaders/heatmap_texture.fragment.glsl.js +5 -0
  34. package/build/min/src/shaders/heatmap_texture.vertex.glsl.js +1 -0
  35. package/build/min/src/shaders/hillshade.fragment.glsl.js +7 -0
  36. package/build/min/src/shaders/hillshade.vertex.glsl.js +1 -0
  37. package/build/min/src/shaders/hillshade_prepare.fragment.glsl.js +8 -0
  38. package/build/min/src/shaders/hillshade_prepare.vertex.glsl.js +1 -0
  39. package/build/min/src/shaders/line.fragment.glsl.js +12 -0
  40. package/build/min/src/shaders/line.vertex.glsl.js +17 -0
  41. package/build/min/src/shaders/line_gradient.fragment.glsl.js +10 -0
  42. package/build/min/src/shaders/line_gradient.vertex.glsl.js +16 -0
  43. package/build/min/src/shaders/line_pattern.fragment.glsl.js +15 -0
  44. package/build/min/src/shaders/line_pattern.vertex.glsl.js +20 -0
  45. package/build/min/src/shaders/line_sdf.fragment.glsl.js +17 -0
  46. package/build/min/src/shaders/line_sdf.vertex.glsl.js +20 -0
  47. package/build/min/src/shaders/raster.fragment.glsl.js +5 -0
  48. package/build/min/src/shaders/raster.vertex.glsl.js +1 -0
  49. package/build/min/src/shaders/symbol_icon.fragment.glsl.js +9 -0
  50. package/build/min/src/shaders/symbol_icon.vertex.glsl.js +5 -0
  51. package/build/min/src/shaders/symbol_sdf.fragment.glsl.js +19 -0
  52. package/build/min/src/shaders/symbol_sdf.vertex.glsl.js +13 -0
  53. package/package.json +7 -7
  54. package/src/data/bucket/fill_bucket.js +1 -1
  55. package/src/data/bucket/fill_extrusion_bucket.js +2 -2
  56. package/src/data/bucket/line_bucket.js +1 -1
  57. package/src/data/bucket/symbol_bucket.js +2 -2
  58. package/src/data/feature_index.js +1 -1
  59. package/src/data/program_configuration.js +1 -1
  60. package/src/gl/color_mode.js +1 -1
  61. package/src/gl/value.js +1 -1
  62. package/src/render/draw_debug.js +1 -1
  63. package/src/render/draw_fill.js +1 -1
  64. package/src/render/draw_heatmap.js +1 -1
  65. package/src/render/glyph_manager.js +6 -130
  66. package/src/render/painter.js +1 -1
  67. package/src/render/uniform_binding.js +1 -1
  68. package/src/shaders/index.js +50 -50
  69. package/src/source/geojson_worker_source.js +4 -4
  70. package/src/source/geojson_wrapper.js +34 -26
  71. package/src/source/resources/glyphs.js +73 -0
  72. package/src/source/resources/images.js +68 -0
  73. package/src/source/resources/index.js +22 -0
  74. package/src/source/vector_tile_worker_source.js +5 -5
  75. package/src/source/worker.js +6 -5
  76. package/src/source/worker_tile.js +4 -4
  77. package/src/style/properties.js +1 -2
  78. package/src/style/style.js +3 -3
  79. package/src/style/style_layer/symbol_style_layer.js +1 -1
  80. package/src/style/style_layer.js +1 -1
  81. package/src/style-spec/feature_filter/index.js +43 -34
  82. package/src/style-spec/group_by_layout.js +10 -32
  83. package/src/symbol/mergelines.js +0 -2
  84. package/src/symbol/symbol_layout.js +0 -1
  85. package/src/symbol/symbol_size.js +1 -1
  86. package/src/symbol/transform_text.js +0 -1
  87. package/src/ui/map.js +11 -39
  88. package/src/util/browser.js +3 -18
  89. package/src/util/classify_rings.js +1 -1
  90. package/src/util/dom.js +0 -88
  91. package/src/util/find_pole_of_inaccessibility.js +2 -2
  92. package/src/util/web_worker_transfer.js +4 -4
  93. package/src/style/load_glyph_range.js +0 -17
  94. package/src/style-spec/expression/compound_expression.js +0 -132
  95. package/src/style-spec/expression/definitions/assertion.js +0 -116
  96. package/src/style-spec/expression/definitions/at.js +0 -57
  97. package/src/style-spec/expression/definitions/case.js +0 -73
  98. package/src/style-spec/expression/definitions/coalesce.js +0 -66
  99. package/src/style-spec/expression/definitions/coercion.js +0 -120
  100. package/src/style-spec/expression/definitions/collator.js +0 -80
  101. package/src/style-spec/expression/definitions/comparison.js +0 -193
  102. package/src/style-spec/expression/definitions/format.js +0 -97
  103. package/src/style-spec/expression/definitions/index.js +0 -339
  104. package/src/style-spec/expression/definitions/interpolate.js +0 -245
  105. package/src/style-spec/expression/definitions/length.js +0 -54
  106. package/src/style-spec/expression/definitions/let.js +0 -60
  107. package/src/style-spec/expression/definitions/literal.js +0 -69
  108. package/src/style-spec/expression/definitions/match.js +0 -142
  109. package/src/style-spec/expression/definitions/step.js +0 -116
  110. package/src/style-spec/expression/definitions/var.js +0 -38
  111. package/src/style-spec/expression/evaluation_context.js +0 -38
  112. package/src/style-spec/expression/index.js +0 -330
  113. package/src/style-spec/expression/is_constant.js +0 -63
  114. package/src/style-spec/expression/parsing_context.js +0 -221
  115. package/src/style-spec/expression/parsing_error.js +0 -9
  116. package/src/style-spec/expression/runtime_error.js +0 -12
  117. package/src/style-spec/expression/scope.js +0 -34
  118. package/src/style-spec/expression/stops.js +0 -37
  119. package/src/style-spec/expression/types/collator.js +0 -24
  120. package/src/style-spec/expression/types/formatted.js +0 -39
  121. package/src/style-spec/expression/types.js +0 -88
  122. package/src/style-spec/expression/values.js +0 -149
  123. package/src/style-spec/function/convert.js +0 -240
  124. package/src/style-spec/function/index.js +0 -303
  125. package/src/style-spec/util/color.js +0 -73
  126. package/src/style-spec/util/color_spaces.js +0 -128
  127. package/src/style-spec/util/get_type.js +0 -18
  128. package/src/style-spec/util/interpolate.js +0 -21
  129. package/src/style-spec/util/properties.js +0 -17
  130. package/src/style-spec/util/result.js +0 -19
  131. package/src/ui/anchor.js +0 -24
  132. package/src/ui/bind_handlers.js +0 -199
  133. package/src/ui/events.js +0 -210
  134. package/src/ui/handler/box_zoom.js +0 -151
  135. package/src/ui/handler/dblclick_zoom.js +0 -91
  136. package/src/ui/handler/drag_pan.js +0 -285
  137. package/src/ui/handler/drag_rotate.js +0 -290
  138. package/src/ui/handler/frame.js +0 -28
  139. package/src/ui/handler/inertia.js +0 -45
  140. package/src/ui/handler/keyboard.js +0 -148
  141. package/src/ui/handler/scroll_zoom.js +0 -284
  142. package/src/ui/handler/touch_zoom_rotate.js +0 -263
@@ -1,69 +0,0 @@
1
- const assert = require('assert');
2
- const { isValue, typeOf, Color } = require('../values');
3
- const { Formatted } = require('../types/formatted');
4
-
5
- class Literal {
6
- constructor(type, value) {
7
- this.type = type;
8
- this.value = value;
9
- }
10
-
11
- static parse(args, context) {
12
- if (args.length !== 2)
13
- return context.error(`'literal' expression requires exactly one argument, but found ${args.length - 1} instead.`);
14
-
15
- if (!isValue(args[1])) return context.error('invalid value');
16
-
17
- const value = args[1];
18
- let type = typeOf(value);
19
-
20
- // special case: infer the item type if possible for zero-length arrays
21
- const expected = context.expectedType;
22
- if (
23
- type.kind === 'array' &&
24
- type.N === 0 &&
25
- expected &&
26
- expected.kind === 'array' &&
27
- (typeof expected.N !== 'number' || expected.N === 0)
28
- ) {
29
- type = expected;
30
- }
31
-
32
- return new Literal(type, value);
33
- }
34
-
35
- evaluate() {
36
- return this.value;
37
- }
38
-
39
- eachChild() {}
40
-
41
- possibleOutputs() {
42
- return [this.value];
43
- }
44
-
45
- serialize() {
46
- if (this.type.kind === 'array' || this.type.kind === 'object') {
47
- return ['literal', this.value];
48
- }
49
- if (this.value instanceof Color) {
50
- // Constant-folding can generate Literal expressions that you
51
- // couldn't actually generate with a "literal" expression,
52
- // so we have to implement an equivalent serialization here
53
- return ['rgba'].concat(this.value.toArray());
54
- }
55
- if (this.value instanceof Formatted) {
56
- // Same as Color
57
- return this.value.serialize();
58
- }
59
- assert(
60
- this.value === null ||
61
- typeof this.value === 'string' ||
62
- typeof this.value === 'number' ||
63
- typeof this.value === 'boolean'
64
- );
65
- return this.value;
66
- }
67
- }
68
-
69
- module.exports = Literal;
@@ -1,142 +0,0 @@
1
- const assert = require('assert');
2
-
3
- const { typeOf } = require('../values');
4
- const { ValueType } = require('../types');
5
-
6
- // Map input label values to output expression index
7
-
8
- class Match {
9
- constructor(inputType, outputType, input, cases, outputs, otherwise) {
10
- this.inputType = inputType;
11
- this.type = outputType;
12
- this.input = input;
13
- this.cases = cases;
14
- this.outputs = outputs;
15
- this.otherwise = otherwise;
16
- }
17
-
18
- static parse(args, context) {
19
- if (args.length < 5) return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);
20
- if (args.length % 2 !== 1) return context.error('Expected an even number of arguments.');
21
-
22
- let inputType;
23
- let outputType;
24
- if (context.expectedType && context.expectedType.kind !== 'value') {
25
- outputType = context.expectedType;
26
- }
27
- const cases = {};
28
- const outputs = [];
29
- for (let i = 2; i < args.length - 1; i += 2) {
30
- let labels = args[i];
31
- const value = args[i + 1];
32
-
33
- if (!Array.isArray(labels)) {
34
- labels = [labels];
35
- }
36
-
37
- const labelContext = context.concat(i);
38
- if (labels.length === 0) {
39
- return labelContext.error('Expected at least one branch label.');
40
- }
41
-
42
- for (const label of labels) {
43
- if (typeof label !== 'number' && typeof label !== 'string') {
44
- return labelContext.error('Branch labels must be numbers or strings.');
45
- }
46
- if (typeof label === 'number' && Math.abs(label) > Number.MAX_SAFE_INTEGER) {
47
- return labelContext.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);
48
- }
49
- if (typeof label === 'number' && Math.floor(label) !== label) {
50
- return labelContext.error('Numeric branch labels must be integer values.');
51
- }
52
- if (!inputType) {
53
- inputType = typeOf(label);
54
- } else if (labelContext.checkSubtype(inputType, typeOf(label))) {
55
- return null;
56
- }
57
-
58
- if (typeof cases[String(label)] !== 'undefined') {
59
- return labelContext.error('Branch labels must be unique.');
60
- }
61
-
62
- cases[String(label)] = outputs.length;
63
- }
64
-
65
- const result = context.parse(value, i, outputType);
66
- if (!result) return null;
67
- outputType = outputType || result.type;
68
- outputs.push(result);
69
- }
70
-
71
- const input = context.parse(args[1], 1, ValueType);
72
- if (!input) return null;
73
-
74
- const otherwise = context.parse(args[args.length - 1], args.length - 1, outputType);
75
- if (!otherwise) return null;
76
-
77
- assert(inputType && outputType);
78
-
79
- if (input.type.kind !== 'value' && context.concat(1).checkSubtype(inputType, input.type)) {
80
- return null;
81
- }
82
-
83
- return new Match(inputType, outputType, input, cases, outputs, otherwise);
84
- }
85
-
86
- evaluate(ctx) {
87
- const input = this.input.evaluate(ctx);
88
- const output = (typeOf(input) === this.inputType && this.outputs[this.cases[input]]) || this.otherwise;
89
- return output.evaluate(ctx);
90
- }
91
-
92
- eachChild(fn) {
93
- fn(this.input);
94
- this.outputs.forEach(fn);
95
- fn(this.otherwise);
96
- }
97
-
98
- possibleOutputs() {
99
- return [].concat(...this.outputs.map(out => out.possibleOutputs())).concat(this.otherwise.possibleOutputs());
100
- }
101
-
102
- serialize() {
103
- const serialized = ['match', this.input.serialize()];
104
-
105
- // Sort so serialization has an arbitrary defined order, even though
106
- // branch order doesn't affect evaluation
107
- const sortedLabels = Object.keys(this.cases).sort();
108
-
109
- // Group branches by unique match expression to support condensed
110
- // serializations of the form [case1, case2, ...] -> matchExpression
111
- const groupedByOutput = [];
112
- const outputLookup = {}; // lookup index into groupedByOutput for a given output expression
113
- for (const label of sortedLabels) {
114
- const outputIndex = outputLookup[this.cases[label]];
115
- if (outputIndex === undefined) {
116
- // First time seeing this output, add it to the end of the grouped list
117
- outputLookup[this.cases[label]] = groupedByOutput.length;
118
- groupedByOutput.push([this.cases[label], [label]]);
119
- } else {
120
- // We've seen this expression before, add the label to that output's group
121
- groupedByOutput[outputIndex][1].push(label);
122
- }
123
- }
124
-
125
- const coerceLabel = label => (this.inputType.kind === 'number' ? Number(label) : label);
126
-
127
- for (const [outputIndex, labels] of groupedByOutput) {
128
- if (labels.length === 1) {
129
- // Only a single label matches this output expression
130
- serialized.push(coerceLabel(labels[0]));
131
- } else {
132
- // Array of literal labels pointing to this output expression
133
- serialized.push(labels.map(coerceLabel));
134
- }
135
- serialized.push(this.outputs[outputIndex].serialize());
136
- }
137
- serialized.push(this.otherwise.serialize());
138
- return serialized;
139
- }
140
- }
141
-
142
- module.exports = Match;
@@ -1,116 +0,0 @@
1
- const { NumberType } = require('../types');
2
-
3
- const { findStopLessThanOrEqualTo } = require('../stops');
4
-
5
- class Step {
6
- constructor(type, input, stops) {
7
- this.type = type;
8
- this.input = input;
9
-
10
- this.labels = [];
11
- this.outputs = [];
12
- for (const [label, expression] of stops) {
13
- this.labels.push(label);
14
- this.outputs.push(expression);
15
- }
16
- }
17
-
18
- static parse(args, context) {
19
- let [, input, ...rest] = args;
20
-
21
- if (args.length - 1 < 4) {
22
- return context.error(`Expected at least 4 arguments, but found only ${args.length - 1}.`);
23
- }
24
-
25
- if ((args.length - 1) % 2 !== 0) {
26
- return context.error('Expected an even number of arguments.');
27
- }
28
-
29
- input = context.parse(input, 1, NumberType);
30
- if (!input) return null;
31
-
32
- const stops = [];
33
-
34
- let outputType = null;
35
- if (context.expectedType && context.expectedType.kind !== 'value') {
36
- outputType = context.expectedType;
37
- }
38
-
39
- rest.unshift(Number.NEGATIVE_INFINITY);
40
-
41
- for (let i = 0; i < rest.length; i += 2) {
42
- const label = rest[i];
43
- const value = rest[i + 1];
44
-
45
- const labelKey = i + 1;
46
- const valueKey = i + 2;
47
-
48
- if (typeof label !== 'number') {
49
- return context.error(
50
- 'Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',
51
- labelKey
52
- );
53
- }
54
-
55
- if (stops.length && stops[stops.length - 1][0] >= label) {
56
- return context.error(
57
- 'Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',
58
- labelKey
59
- );
60
- }
61
-
62
- const parsed = context.parse(value, valueKey, outputType);
63
- if (!parsed) return null;
64
- outputType = outputType || parsed.type;
65
- stops.push([label, parsed]);
66
- }
67
-
68
- return new Step(outputType, input, stops);
69
- }
70
-
71
- evaluate(ctx) {
72
- const labels = this.labels;
73
- const outputs = this.outputs;
74
-
75
- if (labels.length === 1) {
76
- return outputs[0].evaluate(ctx);
77
- }
78
-
79
- const value = this.input.evaluate(ctx);
80
- if (value <= labels[0]) {
81
- return outputs[0].evaluate(ctx);
82
- }
83
-
84
- const stopCount = labels.length;
85
- if (value >= labels[stopCount - 1]) {
86
- return outputs[stopCount - 1].evaluate(ctx);
87
- }
88
-
89
- const index = findStopLessThanOrEqualTo(labels, value);
90
- return outputs[index].evaluate(ctx);
91
- }
92
-
93
- eachChild(fn) {
94
- fn(this.input);
95
- for (const expression of this.outputs) {
96
- fn(expression);
97
- }
98
- }
99
-
100
- possibleOutputs() {
101
- return [].concat(...this.outputs.map(output => output.possibleOutputs()));
102
- }
103
-
104
- serialize() {
105
- const serialized = ['step', this.input.serialize()];
106
- for (let i = 0; i < this.labels.length; i++) {
107
- if (i > 0) {
108
- serialized.push(this.labels[i]);
109
- }
110
- serialized.push(this.outputs[i].serialize());
111
- }
112
- return serialized;
113
- }
114
- }
115
-
116
- module.exports = Step;
@@ -1,38 +0,0 @@
1
- class Var {
2
- constructor(name, boundExpression) {
3
- this.type = boundExpression.type;
4
- this.name = name;
5
- this.boundExpression = boundExpression;
6
- }
7
-
8
- static parse(args, context) {
9
- if (args.length !== 2 || typeof args[1] !== 'string')
10
- return context.error(`'var' expression requires exactly one string literal argument.`);
11
-
12
- const name = args[1];
13
- if (!context.scope.has(name)) {
14
- return context.error(
15
- `Unknown variable "${name}". Make sure "${name}" has been bound in an enclosing "let" expression before using it.`,
16
- 1
17
- );
18
- }
19
-
20
- return new Var(name, context.scope.get(name));
21
- }
22
-
23
- evaluate(ctx) {
24
- return this.boundExpression.evaluate(ctx);
25
- }
26
-
27
- eachChild() {}
28
-
29
- possibleOutputs() {
30
- return [undefined];
31
- }
32
-
33
- serialize() {
34
- return ['var', this.name];
35
- }
36
- }
37
-
38
- module.exports = Var;
@@ -1,38 +0,0 @@
1
- const { Color } = require('./values');
2
-
3
- const geometryTypes = ['Unknown', 'Point', 'LineString', 'Polygon'];
4
-
5
- class EvaluationContext {
6
- constructor() {
7
- this.globals = null;
8
- this.feature = null;
9
- this.featureState = null;
10
- this._parseColorCache = {};
11
- }
12
-
13
- id() {
14
- return this.feature && 'id' in this.feature ? this.feature.id : null;
15
- }
16
-
17
- geometryType() {
18
- return this.feature
19
- ? typeof this.feature.type === 'number'
20
- ? geometryTypes[this.feature.type]
21
- : this.feature.type
22
- : null;
23
- }
24
-
25
- properties() {
26
- return this.feature?.properties || {};
27
- }
28
-
29
- parseColor(input) {
30
- let cached = this._parseColorCache[input];
31
- if (!cached) {
32
- cached = this._parseColorCache[input] = Color.parse(input);
33
- }
34
- return cached;
35
- }
36
- }
37
-
38
- module.exports = EvaluationContext;