ol 9.2.4 → 9.2.5-dev.1716833846254

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;;;;GAIG;AACH,+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;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",
3
+ "version": "9.2.5-dev.1716833846254",
4
4
  "description": "OpenLayers mapping library",
5
5
  "keywords": [
6
6
  "map",
@@ -67,6 +67,10 @@ export type Options = {
67
67
  * ```
68
68
  */
69
69
  tileLoadFunction?: import("../Tile.js").LoadFunction | undefined;
70
+ /**
71
+ * An array of values specifying additional options to apply.
72
+ */
73
+ apiOptions?: string[] | undefined;
70
74
  /**
71
75
  * Wrap the world horizontally.
72
76
  */
@@ -119,6 +123,10 @@ export type SessionTokenRequest = {
119
123
  * The styles.
120
124
  */
121
125
  styles?: any[] | undefined;
126
+ /**
127
+ * An array of values specifying additional options to apply.
128
+ */
129
+ apiOptions?: string[] | undefined;
122
130
  };
123
131
  export type SessionTokenResponse = {
124
132
  /**
@@ -166,6 +174,7 @@ export type SessionTokenResponse = {
166
174
  * imageTile.getImage().src = src;
167
175
  * };
168
176
  * ```
177
+ * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.
169
178
  * @property {boolean} [wrapX=true] Wrap the world horizontally.
170
179
  * @property {number} [transition] Duration of the opacity transition for rendering.
171
180
  * To disable the opacity transition, pass `transition: 0`.
@@ -184,6 +193,7 @@ export type SessionTokenResponse = {
184
193
  * @property {Array<string>} [layerTypes] The layer types.
185
194
  * @property {boolean} [overlay] The overlay.
186
195
  * @property {Array<Object>} [styles] The styles.
196
+ * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.
187
197
  */
188
198
  /**
189
199
  * @typedef {Object} SessionTokenResponse
@@ -1 +1 @@
1
- {"version":3,"file":"Google.d.ts","sourceRoot":"","sources":["Google.js"],"names":[],"mappings":";;;;;SAiBc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAgCN,MAAM;;;;cACN,MAAM;;;;YACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAWN,MAAM;;;;YACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM;;AAnDpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AAEH;;;;;;;;;;;GAWG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA2FjB;IArEC;;;OAGG;IACH,gBAA0B;IAE1B;;OAEG;IACH,QAFU,KAAK,GAAC,IAAI,CAEF;IA6BlB;;;OAGG;IACH,6BAA+C;IAE/C;;;OAGG;IACH,2BAAuB;IAEvB;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,qCAAiC;IAEjC;;;OAGG;IACH,gCAA4B;IAK9B;;;;;;;;;;;OAWG;IACH,YAXY,KAAK,GAAC,IAAI,CAarB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,WAAW,GACV,QAAQ,QAAQ,CAAC,CAI5B;IAED;;;OAGG;IACH,uBAyDC;IAED;;;;OAIG;IACH,2BAmCC;CAMF;sBA/SqB,gBAAgB"}
1
+ {"version":3,"file":"Google.d.ts","sourceRoot":"","sources":["Google.js"],"names":[],"mappings":";;;;;SAiBc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAiCN,MAAM;;;;cACN,MAAM;;;;YACN,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;aAYN,MAAM;;;;YACN,MAAM;;;;eACN,MAAM;;;;gBACN,MAAM;;;;iBACN,MAAM;;AArDpB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH;;;;;;;;;;;;GAYG;AAEH;;;;;;;GAOG;AAEH;;;;;;;GAOG;AACH;IACE;;OAEG;IACH,qBAFW,OAAO,EA8FjB;IAxEC;;;OAGG;IACH,gBAA0B;IAE1B;;OAEG;IACH,QAFU,KAAK,GAAC,IAAI,CAEF;IAgClB;;;OAGG;IACH,6BAA+C;IAE/C;;;OAGG;IACH,2BAAuB;IAEvB;;;OAGG;IACH,0BAAsB;IAEtB;;;OAGG;IACH,qCAAiC;IAEjC;;;OAGG;IACH,gCAA4B;IAK9B;;;;;;;;;;;OAWG;IACH,YAXY,KAAK,GAAC,IAAI,CAarB;IAED;;;;;OAKG;IACH,uBAJW,MAAM,UACN,WAAW,GACV,QAAQ,QAAQ,CAAC,CAI5B;IAED;;;OAGG;IACH,uBAyDC;IAED;;;;OAIG;IACH,2BAmCC;CAMF;sBApTqB,gBAAgB"}
package/source/Google.js CHANGED
@@ -37,6 +37,7 @@ const maxZoom = 22;
37
37
  * imageTile.getImage().src = src;
38
38
  * };
39
39
  * ```
40
+ * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.
40
41
  * @property {boolean} [wrapX=true] Wrap the world horizontally.
41
42
  * @property {number} [transition] Duration of the opacity transition for rendering.
42
43
  * To disable the opacity transition, pass `transition: 0`.
@@ -56,6 +57,7 @@ const maxZoom = 22;
56
57
  * @property {Array<string>} [layerTypes] The layer types.
57
58
  * @property {boolean} [overlay] The overlay.
58
59
  * @property {Array<Object>} [styles] The styles.
60
+ * @property {Array<string>} [apiOptions] An array of values specifying additional options to apply.
59
61
  */
60
62
 
61
63
  /**
@@ -136,6 +138,9 @@ class Google extends TileImage {
136
138
  if (options.overlay === true) {
137
139
  sessionTokenRequest.overlay = true;
138
140
  }
141
+ if (options.apiOptions) {
142
+ sessionTokenRequest.apiOptions = options.apiOptions;
143
+ }
139
144
 
140
145
  /**
141
146
  * @type {SessionTokenRequest}
package/util.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,CAEe"}
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["util.js"],"names":[],"mappings":"AAAA;;GAEG;AAEH;;GAEG;AACH,4BAFY,KAAK,CAIhB;AASD;;;;;;;;GAQG;AACH,kCAHY,MAAM,CAKjB;AAED;;;GAGG;AACH,sBAFU,MAAM,CAEiC"}
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';
36
+ export const VERSION = '9.2.5-dev.1716833846254';