ol 9.0.1-dev.1708958348077 → 9.0.1-dev.1709106981367

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/expr/cpu.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cpu.d.ts","sourceRoot":"","sources":["cpu.js"],"names":[],"mappings":"AAoBA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,wCAFY,iBAAiB,CAU5B;AAED;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,yCALW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,MAAM,WACN,OAAO,iBAAiB,EAAE,cAAc,GACvC,mBAAmB,CAY9B;;;;;;;;;;;;;gBAtEa,MAAM;;;;eACN,MAAM,GAAC,MAAM,GAAC,IAAI;;;;kBAClB,MAAM;;yCAiBE,iBAAiB,KAAE,OAAO,iBAAiB,EAAE,YAAY;sCAIzD,iBAAiB,KAAE,OAAO;qCAI1B,iBAAiB,KAAE,MAAM;qCAIzB,iBAAiB,KAAE,MAAM;wCAIzB,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC;0CAIzC,iBAAiB,KAAE,MAAM,MAAM,CAAC;yCAIhC,iBAAiB,KAAE,MAAM,MAAM,CAAC;mCAIhC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,CAAC;uCAIlC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC"}
1
+ {"version":3,"file":"cpu.d.ts","sourceRoot":"","sources":["cpu.js"],"names":[],"mappings":"AAqBA;;;;;;GAMG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,wCAFY,iBAAiB,CAU5B;AAED;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;GAEG;AAEH;;;;;GAKG;AACH,yCALW,OAAO,iBAAiB,EAAE,iBAAiB,QAC3C,MAAM,WACN,OAAO,iBAAiB,EAAE,cAAc,GACvC,mBAAmB,CAY9B;;;;;;;;;;;;;gBAtEa,MAAM;;;;eACN,MAAM,GAAC,MAAM,GAAC,IAAI;;;;kBAClB,MAAM;;yCAiBE,iBAAiB,KAAE,OAAO,iBAAiB,EAAE,YAAY;sCAIzD,iBAAiB,KAAE,OAAO;qCAI1B,iBAAiB,KAAE,MAAM;qCAIzB,iBAAiB,KAAE,MAAM;wCAIzB,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC;0CAIzC,iBAAiB,KAAE,MAAM,MAAM,CAAC;yCAIhC,iBAAiB,KAAE,MAAM,MAAM,CAAC;mCAIhC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,CAAC;uCAIlC,iBAAiB,KAAE,CAAC,MAAM,MAAM,CAAC,GAAC,MAAM,CAAC"}
package/expr/cpu.js CHANGED
@@ -15,6 +15,7 @@ import {
15
15
  lchaToRgba,
16
16
  normalize,
17
17
  rgbaToLcha,
18
+ toString,
18
19
  withAlpha,
19
20
  } from '../color.js';
20
21
 
@@ -147,6 +148,8 @@ function compileExpression(expression, context) {
147
148
  }
148
149
  case Ops.Any:
149
150
  case Ops.All:
151
+ case Ops.Between:
152
+ case Ops.In:
150
153
  case Ops.Not: {
151
154
  return compileLogicalExpression(expression, context);
152
155
  }
@@ -184,14 +187,15 @@ function compileExpression(expression, context) {
184
187
  case Ops.Interpolate: {
185
188
  return compileInterpolateExpression(expression, context);
186
189
  }
190
+ case Ops.ToString: {
191
+ return compileConvertExpression(expression, context);
192
+ }
187
193
  default: {
188
194
  throw new Error(`Unsupported operator ${operator}`);
189
195
  }
190
196
  // TODO: unimplemented
191
197
  // Ops.Zoom
192
198
  // Ops.Time
193
- // Ops.Between
194
- // Ops.In
195
199
  // Ops.Array
196
200
  // Ops.Color
197
201
  // Ops.Band
@@ -331,6 +335,25 @@ function compileLogicalExpression(expression, context) {
331
335
  return true;
332
336
  };
333
337
  }
338
+ case Ops.Between: {
339
+ return (context) => {
340
+ const value = args[0](context);
341
+ const min = args[1](context);
342
+ const max = args[2](context);
343
+ return value >= min && value <= max;
344
+ };
345
+ }
346
+ case Ops.In: {
347
+ return (context) => {
348
+ const value = args[0](context);
349
+ for (let i = 1; i < length; ++i) {
350
+ if (value === args[i](context)) {
351
+ return true;
352
+ }
353
+ }
354
+ return false;
355
+ };
356
+ }
334
357
  case Ops.Not: {
335
358
  return (context) => !args[0](context);
336
359
  }
@@ -529,6 +552,35 @@ function compileInterpolateExpression(expression, context) {
529
552
  };
530
553
  }
531
554
 
555
+ /**
556
+ * @param {import('./expression.js').CallExpression} expression The call expression.
557
+ * @param {import('./expression.js').ParsingContext} context The parsing context.
558
+ * @return {ExpressionEvaluator} The evaluator function.
559
+ */
560
+ function compileConvertExpression(expression, context) {
561
+ const op = expression.operator;
562
+ const length = expression.args.length;
563
+
564
+ const args = new Array(length);
565
+ for (let i = 0; i < length; ++i) {
566
+ args[i] = compileExpression(expression.args[i], context);
567
+ }
568
+ switch (op) {
569
+ case Ops.ToString: {
570
+ return (context) => {
571
+ const value = args[0](context);
572
+ if (expression.args[0].type === ColorType) {
573
+ return toString(value);
574
+ }
575
+ return value.toString();
576
+ };
577
+ }
578
+ default: {
579
+ throw new Error(`Unsupported convert operator ${op}`);
580
+ }
581
+ }
582
+ }
583
+
532
584
  /**
533
585
  * @param {number} base The base.
534
586
  * @param {number} value The value.
@@ -193,9 +193,9 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: ParsingContext
193
193
  * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
194
194
  * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
195
195
  * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
196
- * (inclusively), or `false` otherwise (WebGL only).
196
+ * (inclusively), or `false` otherwise.
197
197
  * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
198
- * `false` otherwise (WebGL only).
198
+ * `false` otherwise.
199
199
  * This operator has the following limitations:
200
200
  * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)
201
201
  * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an
@@ -213,6 +213,9 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: ParsingContext
213
213
  * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),
214
214
  * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b
215
215
  * in the 0-255 range and a in the 0-1 range) (WebGL only).
216
+ * * `['to-string', value]` converts the input value to a string. If the input is a boolean, the result is "true" or "false".
217
+ * If the input is a number, it is converted to a string as specified by the "NumberToString" algorithm of the ECMAScript
218
+ * Language Specification. If the input is a color, it is converted to a string of the form "rgba(r,g,b,a)". (Canvas only)
216
219
  *
217
220
  * Values can either be literals or another operator, as they will be evaluated recursively.
218
221
  * Literal values can be of the following types:
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AA0IA;;;;GAIG;AACH,+BAHW,MAAM,GACL,MAAM,CAgBjB;AAED;;;;GAIG;AACH,oCAJW,MAAM,YACN,MAAM,GACL,OAAO,CAIlB;AAED;;;;GAIG;AACH,sCAJW,MAAM,aACN,MAAM,GACL,OAAO,CAIlB;AAED;;;;GAIG;AACH,6BAJW,MAAM,YACN,MAAM,GACL,OAAO,CAIlB;AA8BD;;GAEG;AAEH;;;;;;;GAOG;AAEH;;GAEG;AACH,qCAFY,cAAc,CAUzB;AAuBD;;GAEG;AAEH;;;;;GAKG;AACH,+BALW,iBAAiB,WACjB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AC,QAAE,MAAM,YAAG,MAAM,UAAU,CAAC,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BA7gBrG,UAAQ,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;2BAwE1D,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,MAAM,CAAC;;;;yCA4LnB,cAAc,QAAE,MAAM,KAAE,UAAU"}
@@ -84,9 +84,9 @@ import {isStringColor} from '../color.js';
84
84
  * * `['all', value1, value2, ...]` returns `true` if all the inputs are `true`, `false` otherwise.
85
85
  * * `['any', value1, value2, ...]` returns `true` if any of the inputs are `true`, `false` otherwise.
86
86
  * * `['between', value1, value2, value3]` returns `true` if `value1` is contained between `value2` and `value3`
87
- * (inclusively), or `false` otherwise (WebGL only).
87
+ * (inclusively), or `false` otherwise.
88
88
  * * `['in', needle, haystack]` returns `true` if `needle` is found in `haystack`, and
89
- * `false` otherwise (WebGL only).
89
+ * `false` otherwise.
90
90
  * This operator has the following limitations:
91
91
  * * `haystack` has to be an array of numbers or strings (searching for a substring in a string is not supported yet)
92
92
  * * Only literal arrays are supported as `haystack` for now; this means that `haystack` cannot be the result of an
@@ -104,6 +104,9 @@ import {isStringColor} from '../color.js';
104
104
  * (e.g. `'#86A136'`), colors using the rgba[a] functional notation (e.g. `'rgb(134, 161, 54)'` or `'rgba(134, 161, 54, 1)'`),
105
105
  * named colors (e.g. `'red'`), or array literals with 3 ([r, g, b]) or 4 ([r, g, b, a]) values (with r, g, and b
106
106
  * in the 0-255 range and a in the 0-1 range) (WebGL only).
107
+ * * `['to-string', value]` converts the input value to a string. If the input is a boolean, the result is "true" or "false".
108
+ * If the input is a number, it is converted to a string as specified by the "NumberToString" algorithm of the ECMAScript
109
+ * Language Specification. If the input is a color, it is converted to a string of the form "rgba(r,g,b,a)". (Canvas only)
107
110
  *
108
111
  * Values can either be literals or another operator, as they will be evaluated recursively.
109
112
  * Literal values can be of the following types:
@@ -369,6 +372,7 @@ export const Ops = {
369
372
  Id: 'id',
370
373
  Band: 'band',
371
374
  Palette: 'palette',
375
+ ToString: 'to-string',
372
376
  };
373
377
 
374
378
  /**
@@ -629,6 +633,11 @@ const parsers = {
629
633
  parseArgsOfType(NumberType),
630
634
  ),
631
635
  [Ops.Palette]: createParser(ColorType, withArgsCount(2, 2), parsePaletteArgs),
636
+ [Ops.ToString]: createParser(
637
+ StringType,
638
+ withArgsCount(1, 1),
639
+ parseArgsOfType(BooleanType | NumberType | StringType | ColorType),
640
+ ),
632
641
  };
633
642
 
634
643
  /**
package/expr/gpu.js CHANGED
@@ -440,6 +440,7 @@ ${ifBlocks}
440
440
  // Ops.String
441
441
  // Ops.Coalesce
442
442
  // Ops.Concat
443
+ // Ops.ToString
443
444
  };
444
445
 
445
446
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "9.0.1-dev.1708958348077",
3
+ "version": "9.0.1-dev.1709106981367",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
package/util.js CHANGED
@@ -33,4 +33,4 @@ export function getUid(obj) {
33
33
  * OpenLayers version.
34
34
  * @type {string}
35
35
  */
36
- export const VERSION = '9.0.1-dev.1708958348077';
36
+ export const VERSION = '9.0.1-dev.1709106981367';