ol 9.2.4-dev.1716422072954 → 9.2.4-dev.1716536869196

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.js CHANGED
@@ -256,7 +256,16 @@ function compileAccessorExpression(expression, context) {
256
256
  const name = /** @type {string} */ (nameExpression.value);
257
257
  switch (expression.operator) {
258
258
  case Ops.Get: {
259
- return (context) => context.properties[name];
259
+ return (context) => {
260
+ const args = expression.args;
261
+ let value = context.properties[name];
262
+ for (let i = 1, ii = args.length; i < ii; ++i) {
263
+ const keyExpression = /** @type {LiteralExpression} */ (args[i]);
264
+ const key = /** @type {string|number} */ (keyExpression.value);
265
+ value = value[key];
266
+ }
267
+ return value;
268
+ };
260
269
  }
261
270
  case Ops.Var: {
262
271
  return (context) => context.variables[name];
@@ -135,9 +135,9 @@ export type ArgValidator = (arg0: Array<EncodedExpression>, arg1: ParsingContext
135
135
  * of bands, depending on the underlying data source and
136
136
  * {@link import ("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
137
137
  * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).
138
- * * `['get', 'attributeName', typeHint]` fetches a feature property value, similar to `feature.get('attributeName')`
139
- * A type hint can optionally be specified, in case the resulting expression contains a type ambiguity which
140
- * will make it invalid. Type hints can be one of: 'string', 'color', 'number', 'boolean', 'number[]'
138
+ * * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.
139
+ * * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a
140
+ * feature property. The result is `undefined` when there is nothing at the specified key or index.
141
141
  * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'
142
142
  * `Multi*` values are returned as their singular equivalent
143
143
  * `Circle` geometries are returned as 'Polygon'
@@ -1 +1 @@
1
- {"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AAsJA;;;;G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AAU,IAMvB;IAHC,aAAgB;IAChB,iBAAwB;IACxB,mBAAgB;CAEnB;AA+FD;;GAEG;AACH;QAFiB,MAAM,GAAE,MAAM;EAgD7B;yBA7IW,iBAAiB,GAAC,cAAc;;;;;eAK/B,IAAI,MAAM,CAAC;;;;gBACX,IAAI,MAAM,CAAC;;;;eACX,OAAO;;;;kBACP,OAAO;;;;WACP,OAAO,kBAAkB,EAAE,SAAS,GAAC,OAAO,mBAAmB,EAAE,UAAU;;gCAiB5E,YAAY,QAAM;;;;;;;kCAoXT,MAAM,iBAAiB,CAAC,QAAE,cAAc,QAAE,MAAM,UAAU,CAAC,QAAE,MAAM,YAAG,MAAM,UAAU,CAAC,GAAC,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8BApfrG,UAAQ,GAAC,OAAO,aAAa,EAAE,KAAK,GAAC,MAAM,GAAC,MAAM,GAAC,OAAO;2BA0E1D,OAAO,GAAC,MAAM,GAAC,MAAM,GAAC,MAAM,MAAM,CAAC;;;;yCA4KnB,cAAc,QAAE,MAAM,KAAE,UAAU"}
@@ -25,9 +25,9 @@ import {isStringColor} from '../color.js';
25
25
  * of bands, depending on the underlying data source and
26
26
  * {@link import("../source/GeoTIFF.js").Options configuration}. `xOffset` and `yOffset` are optional
27
27
  * and allow specifying pixel offsets for x and y. This is used for sampling data from neighboring pixels (WebGL only).
28
- * * `['get', 'attributeName', typeHint]` fetches a feature property value, similar to `feature.get('attributeName')`
29
- * A type hint can optionally be specified, in case the resulting expression contains a type ambiguity which
30
- * will make it invalid. Type hints can be one of: 'string', 'color', 'number', 'boolean', 'number[]'
28
+ * * `['get', attributeName]` fetches a feature property value, similar to `feature.get('attributeName')`.
29
+ * * `['get', attributeName, keyOrArrayIndex, ...]` (Canvas only) Access nested properties and array items of a
30
+ * feature property. The result is `undefined` when there is nothing at the specified key or index.
31
31
  * * `['geometry-type']` returns a feature's geometry type as string, either: 'LineString', 'Point' or 'Polygon'
32
32
  * `Multi*` values are returned as their singular equivalent
33
33
  * `Circle` geometries are returned as 'Polygon'
@@ -250,27 +250,6 @@ export function newParsingContext() {
250
250
  };
251
251
  }
252
252
 
253
- /**
254
- * @param {string} typeHint Type hint
255
- * @return {number} Resulting value type (will be a single type)
256
- */
257
- function getTypeFromHint(typeHint) {
258
- switch (typeHint) {
259
- case 'string':
260
- return StringType;
261
- case 'color':
262
- return ColorType;
263
- case 'number':
264
- return NumberType;
265
- case 'boolean':
266
- return BooleanType;
267
- case 'number[]':
268
- return NumberArrayType;
269
- default:
270
- throw new Error(`Unrecognized type hint: ${typeHint}`);
271
- }
272
- }
273
-
274
253
  /**
275
254
  * @typedef {LiteralValue|Array} EncodedExpression
276
255
  */
@@ -398,20 +377,7 @@ export const Ops = {
398
377
  * @type {Object<string, Parser>}
399
378
  */
400
379
  const parsers = {
401
- [Ops.Get]: createParser(
402
- ([_, typeHint]) => {
403
- if (typeHint !== undefined) {
404
- return getTypeFromHint(
405
- /** @type {string} */ (
406
- /** @type {LiteralExpression} */ (typeHint).value
407
- ),
408
- );
409
- }
410
- return AnyType;
411
- },
412
- withArgsCount(1, 2),
413
- withGetArgs,
414
- ),
380
+ [Ops.Get]: createParser(AnyType, withArgsCount(1, Infinity), withGetArgs),
415
381
  [Ops.Var]: createParser(
416
382
  ([firstArg]) => firstArg.type,
417
383
  withArgsCount(1, 1),
@@ -668,19 +634,29 @@ const parsers = {
668
634
  * @type ArgValidator
669
635
  */
670
636
  function withGetArgs(encoded, context) {
671
- const arg = parse(encoded[1], context);
672
- if (!(arg instanceof LiteralExpression)) {
673
- throw new Error('Expected a literal argument for get operation');
674
- }
675
- if (typeof arg.value !== 'string') {
676
- throw new Error('Expected a string argument for get operation');
677
- }
678
- context.properties.add(arg.value);
679
- if (encoded.length === 3) {
680
- const hint = parse(encoded[2], context);
681
- return [arg, hint];
637
+ const args = [];
638
+ for (let i = 1, ii = encoded.length; i < ii; ++i) {
639
+ const arg = parse(encoded[i], context);
640
+ args.push(arg);
641
+ if (!(arg instanceof LiteralExpression)) {
642
+ throw new Error('Expected a literal argument for get operation');
643
+ }
644
+ if (i > 1) {
645
+ if (typeof arg.value !== 'string' && typeof arg.value !== 'number') {
646
+ throw new Error(
647
+ 'Expected key or array index of a get operation to be a string or number',
648
+ );
649
+ }
650
+ continue;
651
+ }
652
+ if (typeof arg.value !== 'string') {
653
+ throw new Error(
654
+ 'Expected the attribute name of a get operation to be a string',
655
+ );
656
+ }
657
+ context.properties.add(String(arg.value));
682
658
  }
683
- return [arg];
659
+ return args;
684
660
  }
685
661
 
686
662
  /**
@@ -72,7 +72,7 @@ export type SnapOnSignature<Return> = import("../Observable").OnSignature<import
72
72
  * as it is added before.
73
73
  *
74
74
  * The snap interaction modifies map browser event `coordinate` and `pixel`
75
- * properties to force the snap to occur to any interaction that them.
75
+ * properties to force the snap to occur to any interaction that uses them.
76
76
  *
77
77
  * Example:
78
78
  *
@@ -92,7 +92,7 @@ const tempSegment = [];
92
92
  * as it is added before.
93
93
  *
94
94
  * The snap interaction modifies map browser event `coordinate` and `pixel`
95
- * properties to force the snap to occur to any interaction that them.
95
+ * properties to force the snap to occur to any interaction that uses them.
96
96
  *
97
97
  * Example:
98
98
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ol",
3
- "version": "9.2.4-dev.1716422072954",
3
+ "version": "9.2.4-dev.1716536869196",
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.2.4-dev.1716422072954';
36
+ export const VERSION = '9.2.4-dev.1716536869196';