ol 9.0.1-dev.1708958312405 → 9.0.1-dev.1709105228771
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/dist/ol.js +2 -2
- package/dist/ol.js.map +1 -1
- package/expr/cpu.d.ts.map +1 -1
- package/expr/cpu.js +33 -0
- package/expr/expression.d.ts +3 -0
- package/expr/expression.d.ts.map +1 -1
- package/expr/expression.js +9 -0
- package/expr/gpu.js +1 -0
- package/package.json +1 -1
- package/util.js +1 -1
package/expr/cpu.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cpu.d.ts","sourceRoot":"","sources":["cpu.js"],"names":[],"mappings":"
|
|
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
|
|
|
@@ -184,6 +185,9 @@ function compileExpression(expression, context) {
|
|
|
184
185
|
case Ops.Interpolate: {
|
|
185
186
|
return compileInterpolateExpression(expression, context);
|
|
186
187
|
}
|
|
188
|
+
case Ops.ToString: {
|
|
189
|
+
return compileConvertExpression(expression, context);
|
|
190
|
+
}
|
|
187
191
|
default: {
|
|
188
192
|
throw new Error(`Unsupported operator ${operator}`);
|
|
189
193
|
}
|
|
@@ -529,6 +533,35 @@ function compileInterpolateExpression(expression, context) {
|
|
|
529
533
|
};
|
|
530
534
|
}
|
|
531
535
|
|
|
536
|
+
/**
|
|
537
|
+
* @param {import('./expression.js').CallExpression} expression The call expression.
|
|
538
|
+
* @param {import('./expression.js').ParsingContext} context The parsing context.
|
|
539
|
+
* @return {ExpressionEvaluator} The evaluator function.
|
|
540
|
+
*/
|
|
541
|
+
function compileConvertExpression(expression, context) {
|
|
542
|
+
const op = expression.operator;
|
|
543
|
+
const length = expression.args.length;
|
|
544
|
+
|
|
545
|
+
const args = new Array(length);
|
|
546
|
+
for (let i = 0; i < length; ++i) {
|
|
547
|
+
args[i] = compileExpression(expression.args[i], context);
|
|
548
|
+
}
|
|
549
|
+
switch (op) {
|
|
550
|
+
case Ops.ToString: {
|
|
551
|
+
return (context) => {
|
|
552
|
+
const value = args[0](context);
|
|
553
|
+
if (expression.args[0].type === ColorType) {
|
|
554
|
+
return toString(value);
|
|
555
|
+
}
|
|
556
|
+
return value.toString();
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
default: {
|
|
560
|
+
throw new Error(`Unsupported convert operator ${op}`);
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
|
|
532
565
|
/**
|
|
533
566
|
* @param {number} base The base.
|
|
534
567
|
* @param {number} value The value.
|
package/expr/expression.d.ts
CHANGED
|
@@ -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:
|
package/expr/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["expression.js"],"names":[],"mappings":"AA6IA;;;;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,cAA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4LnB,cAAc,QAAE,MAAM,KAAE,UAAU"}
|
package/expr/expression.js
CHANGED
|
@@ -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
package/package.json
CHANGED
package/util.js
CHANGED