@math.gl/sql 5.0.0-beta.11 → 5.0.0-beta.12
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/arrow/aggregates.js +1 -1
- package/dist/arrow/aggregates.js.map +1 -1
- package/dist/arrow/buffers.js.map +1 -1
- package/dist/arrow/cast.d.ts +1 -1
- package/dist/arrow/cast.js +1 -1
- package/dist/arrow/cast.js.map +1 -1
- package/dist/arrow/compiler.d.ts.map +1 -1
- package/dist/arrow/compiler.js +146 -29
- package/dist/arrow/compiler.js.map +1 -1
- package/dist/arrow/index.cjs +124 -23
- package/dist/arrow/index.cjs.map +1 -1
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/list-values.d.ts.map +1 -1
- package/dist/arrow/list-values.js +27 -6
- package/dist/arrow/list-values.js.map +1 -1
- package/dist/arrow/predicate.d.ts.map +1 -1
- package/dist/arrow/predicate.js.map +1 -1
- package/dist/arrow/query-arrow-sql.d.ts +2 -2
- package/dist/arrow/query-arrow-sql.d.ts.map +1 -1
- package/dist/arrow/query-arrow-sql.js +40 -8
- package/dist/arrow/query-arrow-sql.js.map +1 -1
- package/dist/arrow/query-arrow-table.d.ts +1 -1
- package/dist/arrow/query-arrow-table.d.ts.map +1 -1
- package/dist/arrow/query-arrow-table.js +1 -1
- package/dist/arrow/query-arrow-table.js.map +1 -1
- package/dist/arrow/query-worker.d.ts +1 -1
- package/dist/arrow/query-worker.d.ts.map +1 -1
- package/dist/arrow/query-worker.js +1 -1
- package/dist/arrow/query-worker.js.map +1 -1
- package/dist/arrow/registry.d.ts.map +1 -1
- package/dist/arrow/registry.js +1 -0
- package/dist/arrow/registry.js.map +1 -1
- package/dist/arrow/relational-query.js +2 -2
- package/dist/arrow/relational-query.js.map +1 -1
- package/dist/arrow/temporal-cast.js.map +1 -1
- package/dist/arrow/types.d.ts.map +1 -1
- package/dist/arrow/unnest-arrow-column.d.ts +22 -0
- package/dist/arrow/unnest-arrow-column.d.ts.map +1 -0
- package/dist/arrow/unnest-arrow-column.js +112 -0
- package/dist/arrow/unnest-arrow-column.js.map +1 -0
- package/dist/arrow/worker.cjs +130 -29
- package/dist/arrow/worker.cjs.map +1 -1
- package/dist/arrow/worker.d.ts +1 -1
- package/dist/arrow/worker.d.ts.map +1 -1
- package/dist/arrow/worker.js +1 -1
- package/dist/arrow/worker.js.map +1 -1
- package/dist/{color → color-functions}/index.cjs +2 -2
- package/dist/{color → color-functions}/index.cjs.map +1 -1
- package/dist/color-functions/index.d.ts.map +1 -0
- package/dist/color-functions/index.js.map +1 -0
- package/dist/expressions/ast.js +3 -1
- package/dist/expressions/ast.js.map +1 -1
- package/dist/expressions/expression-eval.d.ts +10 -1
- package/dist/expressions/expression-eval.d.ts.map +1 -1
- package/dist/expressions/expression-eval.js.map +1 -1
- package/dist/expressions/index.cjs +1 -1
- package/dist/expressions/index.cjs.map +1 -1
- package/dist/index.cjs +2792 -2363
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/{math → math-functions}/index.cjs +2 -2
- package/dist/{math → math-functions}/index.cjs.map +1 -1
- package/dist/math-functions/index.d.ts.map +1 -0
- package/dist/math-functions/index.js.map +1 -0
- package/dist/parser/bind-sql-predicate.d.ts.map +1 -0
- package/dist/parser/bind-sql-predicate.js.map +1 -0
- package/dist/{sql → parser}/index.cjs +348 -129
- package/dist/parser/index.cjs.map +6 -0
- package/dist/{sql → parser}/index.d.ts +2 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/{sql → parser}/index.js +1 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/parameter-snapshots.d.ts +21 -0
- package/dist/parser/parameter-snapshots.d.ts.map +1 -0
- package/dist/parser/parameter-snapshots.js +85 -0
- package/dist/parser/parameter-snapshots.js.map +1 -0
- package/dist/{sql → parser}/parse-sql-expression.d.ts +8 -2
- package/dist/parser/parse-sql-expression.d.ts.map +1 -0
- package/dist/{sql → parser}/parse-sql-expression.js +51 -5
- package/dist/parser/parse-sql-expression.js.map +1 -0
- package/dist/parser/parse-sql-predicate.d.ts.map +1 -0
- package/dist/parser/parse-sql-predicate.js.map +1 -0
- package/dist/{sql → parser}/parse-sql-query.d.ts +2 -1
- package/dist/parser/parse-sql-query.d.ts.map +1 -0
- package/dist/{sql → parser}/parse-sql-query.js +21 -6
- package/dist/parser/parse-sql-query.js.map +1 -0
- package/dist/{sql → parser}/parse-sql-select.d.ts +4 -2
- package/dist/parser/parse-sql-select.d.ts.map +1 -0
- package/dist/{sql → parser}/parse-sql-select.js +6 -3
- package/dist/parser/parse-sql-select.js.map +1 -0
- package/dist/{sql → parser}/parse-sql-statement.d.ts +9 -5
- package/dist/parser/parse-sql-statement.d.ts.map +1 -0
- package/dist/{sql → parser}/parse-sql-statement.js +39 -14
- package/dist/parser/parse-sql-statement.js.map +1 -0
- package/dist/parser/query-types.d.ts.map +1 -0
- package/dist/parser/query-types.js.map +1 -0
- package/dist/parser/sql-parameters.d.ts +29 -0
- package/dist/parser/sql-parameters.d.ts.map +1 -0
- package/dist/parser/sql-parameters.js +110 -0
- package/dist/parser/sql-parameters.js.map +1 -0
- package/dist/parser/sql-parse-error.d.ts.map +1 -0
- package/dist/parser/sql-parse-error.js.map +1 -0
- package/dist/parser/sql-predicate-schema.d.ts.map +1 -0
- package/dist/parser/sql-predicate-schema.js.map +1 -0
- package/dist/parser/sql-predicate-types.d.ts.map +1 -0
- package/dist/parser/sql-predicate-types.js.map +1 -0
- package/dist/parser/sql-predicate.d.ts.map +1 -0
- package/dist/parser/sql-predicate.js.map +1 -0
- package/dist/scales/arrow-domains.d.ts +8 -1
- package/dist/scales/arrow-domains.d.ts.map +1 -1
- package/dist/scales/arrow-domains.js +48 -6
- package/dist/scales/arrow-domains.js.map +1 -1
- package/dist/scales/arrow-scales.d.ts +28 -4
- package/dist/scales/arrow-scales.d.ts.map +1 -1
- package/dist/scales/arrow-scales.js +158 -12
- package/dist/scales/arrow-scales.js.map +1 -1
- package/dist/scales/compile-scale.d.ts +1 -6
- package/dist/scales/compile-scale.d.ts.map +1 -1
- package/dist/scales/compile-scale.js +1 -191
- package/dist/scales/compile-scale.js.map +1 -1
- package/dist/scales/conformance.cjs +180 -0
- package/dist/scales/conformance.cjs.map +6 -0
- package/dist/scales/conformance.d.ts +26 -0
- package/dist/scales/conformance.d.ts.map +1 -0
- package/dist/scales/conformance.js +164 -0
- package/dist/scales/conformance.js.map +1 -0
- package/dist/scales/hdr-colors.d.ts +1 -12
- package/dist/scales/hdr-colors.d.ts.map +1 -1
- package/dist/scales/hdr-colors.js +1 -111
- package/dist/scales/hdr-colors.js.map +1 -1
- package/dist/scales/index.cjs +3738 -618
- package/dist/scales/index.cjs.map +3 -3
- package/dist/scales/index.d.ts +2 -1
- package/dist/scales/index.d.ts.map +1 -1
- package/dist/scales/index.js +2 -1
- package/dist/scales/index.js.map +1 -1
- package/dist/scales/palettes.d.ts +1 -4
- package/dist/scales/palettes.d.ts.map +1 -1
- package/dist/scales/palettes.js +1 -81
- package/dist/scales/palettes.js.map +1 -1
- package/dist/scales/parse-sql-scale.d.ts +14 -1
- package/dist/scales/parse-sql-scale.d.ts.map +1 -1
- package/dist/scales/parse-sql-scale.js +110 -18
- package/dist/scales/parse-sql-scale.js.map +1 -1
- package/dist/scales/quantile-sketch.d.ts +1 -21
- package/dist/scales/quantile-sketch.d.ts.map +1 -1
- package/dist/scales/quantile-sketch.js +1 -104
- package/dist/scales/quantile-sketch.js.map +1 -1
- package/dist/scales/scale-types.d.ts +1 -91
- package/dist/scales/scale-types.d.ts.map +1 -1
- package/dist/scales/scale-types.js +1 -115
- package/dist/scales/scale-types.js.map +1 -1
- package/dist/scales/streaming-domains.d.ts.map +1 -1
- package/dist/scales/streaming-domains.js +8 -2
- package/dist/scales/streaming-domains.js.map +1 -1
- package/package.json +19 -19
- package/src/arrow/aggregates.ts +1 -1
- package/src/arrow/buffers.ts +1 -1
- package/src/arrow/cast.ts +3 -3
- package/src/arrow/compiler.ts +155 -36
- package/src/arrow/index.ts +1 -1
- package/src/arrow/list-values.ts +28 -7
- package/src/arrow/predicate.ts +1 -1
- package/src/arrow/query-arrow-sql.ts +38 -10
- package/src/arrow/query-arrow-table.ts +3 -3
- package/src/arrow/query-worker.ts +5 -1
- package/src/arrow/registry.ts +1 -0
- package/src/arrow/relational-query.ts +2 -2
- package/src/arrow/temporal-cast.ts +1 -1
- package/src/arrow/types.ts +1 -1
- package/src/arrow/unnest-arrow-column.ts +145 -0
- package/src/arrow/worker.ts +6 -2
- package/src/expressions/ast.ts +3 -1
- package/src/expressions/expression-eval.ts +10 -1
- package/src/index.ts +14 -0
- package/src/{math → math-functions}/index.ts +2 -2
- package/src/{sql → parser}/index.ts +15 -0
- package/src/parser/parameter-snapshots.ts +103 -0
- package/src/{sql → parser}/parse-sql-expression.ts +49 -6
- package/src/{sql → parser}/parse-sql-query.ts +24 -6
- package/src/{sql → parser}/parse-sql-select.ts +14 -8
- package/src/{sql → parser}/parse-sql-statement.ts +42 -24
- package/src/{sql → parser}/query-types.ts +1 -1
- package/src/parser/sql-parameters.ts +174 -0
- package/src/scales/arrow-domains.ts +66 -7
- package/src/scales/arrow-scales.ts +221 -14
- package/src/scales/compile-scale.ts +1 -213
- package/src/scales/conformance.ts +186 -0
- package/src/scales/hdr-colors.ts +1 -122
- package/src/scales/index.ts +3 -1
- package/src/scales/palettes.ts +1 -82
- package/src/scales/parse-sql-scale.ts +126 -21
- package/src/scales/quantile-sketch.ts +1 -102
- package/src/scales/scale-types.ts +1 -220
- package/src/scales/streaming-domains.ts +8 -2
- package/dist/color/index.d.ts.map +0 -1
- package/dist/color/index.js.map +0 -1
- package/dist/math/index.d.ts.map +0 -1
- package/dist/math/index.js.map +0 -1
- package/dist/scales/arrow-scales.cjs +0 -3837
- package/dist/scales/arrow-scales.cjs.map +0 -6
- package/dist/sql/bind-sql-predicate.d.ts.map +0 -1
- package/dist/sql/bind-sql-predicate.js.map +0 -1
- package/dist/sql/index.cjs.map +0 -6
- package/dist/sql/index.d.ts.map +0 -1
- package/dist/sql/index.js.map +0 -1
- package/dist/sql/parse-sql-expression.d.ts.map +0 -1
- package/dist/sql/parse-sql-expression.js.map +0 -1
- package/dist/sql/parse-sql-predicate.d.ts.map +0 -1
- package/dist/sql/parse-sql-predicate.js.map +0 -1
- package/dist/sql/parse-sql-query.d.ts.map +0 -1
- package/dist/sql/parse-sql-query.js.map +0 -1
- package/dist/sql/parse-sql-select.d.ts.map +0 -1
- package/dist/sql/parse-sql-select.js.map +0 -1
- package/dist/sql/parse-sql-statement.d.ts.map +0 -1
- package/dist/sql/parse-sql-statement.js.map +0 -1
- package/dist/sql/query-types.d.ts.map +0 -1
- package/dist/sql/query-types.js.map +0 -1
- package/dist/sql/sql-parse-error.d.ts.map +0 -1
- package/dist/sql/sql-parse-error.js.map +0 -1
- package/dist/sql/sql-predicate-schema.d.ts.map +0 -1
- package/dist/sql/sql-predicate-schema.js.map +0 -1
- package/dist/sql/sql-predicate-types.d.ts.map +0 -1
- package/dist/sql/sql-predicate-types.js.map +0 -1
- package/dist/sql/sql-predicate.d.ts.map +0 -1
- package/dist/sql/sql-predicate.js.map +0 -1
- package/src/expressions/vendor/jsep/README.md +0 -22
- /package/dist/{color → color-functions}/index.d.ts +0 -0
- /package/dist/{color → color-functions}/index.js +0 -0
- /package/dist/{math → math-functions}/index.d.ts +0 -0
- /package/dist/{math → math-functions}/index.js +0 -0
- /package/dist/{sql → parser}/bind-sql-predicate.d.ts +0 -0
- /package/dist/{sql → parser}/bind-sql-predicate.js +0 -0
- /package/dist/{sql → parser}/parse-sql-predicate.d.ts +0 -0
- /package/dist/{sql → parser}/parse-sql-predicate.js +0 -0
- /package/dist/{sql → parser}/query-types.d.ts +0 -0
- /package/dist/{sql → parser}/query-types.js +0 -0
- /package/dist/{sql → parser}/sql-parse-error.d.ts +0 -0
- /package/dist/{sql → parser}/sql-parse-error.js +0 -0
- /package/dist/{sql → parser}/sql-predicate-schema.d.ts +0 -0
- /package/dist/{sql → parser}/sql-predicate-schema.js +0 -0
- /package/dist/{sql → parser}/sql-predicate-types.d.ts +0 -0
- /package/dist/{sql → parser}/sql-predicate-types.js +0 -0
- /package/dist/{sql → parser}/sql-predicate.d.ts +0 -0
- /package/dist/{sql → parser}/sql-predicate.js +0 -0
- /package/src/{color → color-functions}/index.ts +0 -0
- /package/src/{sql → parser}/bind-sql-predicate.ts +0 -0
- /package/src/{sql → parser}/parse-sql-predicate.ts +0 -0
- /package/src/{sql → parser}/sql-parse-error.ts +0 -0
- /package/src/{sql → parser}/sql-predicate-schema.ts +0 -0
- /package/src/{sql → parser}/sql-predicate-types.ts +0 -0
- /package/src/{sql → parser}/sql-predicate.ts +0 -0
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
|
|
19
|
+
// dist/scales/conformance.js
|
|
20
|
+
var conformance_exports = {};
|
|
21
|
+
__export(conformance_exports, {
|
|
22
|
+
SCALE_CONFORMANCE_CASES: () => SCALE_CONFORMANCE_CASES
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(conformance_exports);
|
|
25
|
+
var SCALE_CONFORMANCE_CASES = [
|
|
26
|
+
{
|
|
27
|
+
id: "linear-extrapolation",
|
|
28
|
+
descriptor: { type: "linear", domain: [0, 10], range: { type: "numeric", values: [0, 100] } },
|
|
29
|
+
absoluteTolerance: 1e-5,
|
|
30
|
+
samples: [
|
|
31
|
+
{ input: null, expected: null },
|
|
32
|
+
{ input: -1, expected: -10 },
|
|
33
|
+
{ input: 0, expected: 0 },
|
|
34
|
+
{ input: 5, expected: 50 },
|
|
35
|
+
{ input: 11, expected: 110 }
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: "log-domain",
|
|
40
|
+
descriptor: { type: "log", domain: [1, 100], range: { type: "numeric", values: [0, 1] } },
|
|
41
|
+
absoluteTolerance: 1e-5,
|
|
42
|
+
samples: [
|
|
43
|
+
{ input: 0, expected: null },
|
|
44
|
+
{ input: 1, expected: 0 },
|
|
45
|
+
{ input: 10, expected: 0.5 },
|
|
46
|
+
{ input: 100, expected: 1 }
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: "linear-srgb-interpolation",
|
|
51
|
+
descriptor: {
|
|
52
|
+
type: "sequential",
|
|
53
|
+
domain: [0, 1],
|
|
54
|
+
interpolation: "linear-srgb",
|
|
55
|
+
range: {
|
|
56
|
+
type: "colors",
|
|
57
|
+
values: [
|
|
58
|
+
[0, 0, 0, 0],
|
|
59
|
+
[1, 1, 1, 1]
|
|
60
|
+
]
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
absoluteTolerance: 1e-5,
|
|
64
|
+
samples: [
|
|
65
|
+
{ input: -1, expected: [0, 0, 0, 0] },
|
|
66
|
+
{ input: 0.5, expected: [0.7353569830524495, 0.7353569830524495, 0.7353569830524495, 0.5] },
|
|
67
|
+
{ input: 2, expected: [1, 1, 1, 1] }
|
|
68
|
+
]
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: "null-under-over-colors",
|
|
72
|
+
descriptor: {
|
|
73
|
+
type: "sequential",
|
|
74
|
+
domain: [0, 1],
|
|
75
|
+
range: {
|
|
76
|
+
type: "colors",
|
|
77
|
+
values: [
|
|
78
|
+
[0, 0, 0, 1],
|
|
79
|
+
[1, 1, 1, 1]
|
|
80
|
+
]
|
|
81
|
+
},
|
|
82
|
+
nullColor: [0, 0, 0, 0],
|
|
83
|
+
underColor: [1, 0, 0, 1],
|
|
84
|
+
overColor: [0, 0, 1, 1]
|
|
85
|
+
},
|
|
86
|
+
absoluteTolerance: 1e-5,
|
|
87
|
+
samples: [
|
|
88
|
+
{ input: null, expected: [0, 0, 0, 0] },
|
|
89
|
+
{ input: -1, expected: [1, 0, 0, 1] },
|
|
90
|
+
{ input: 0, expected: [0, 0, 0, 1] },
|
|
91
|
+
{ input: 1, expected: [1, 1, 1, 1] },
|
|
92
|
+
{ input: 2, expected: [0, 0, 1, 1] }
|
|
93
|
+
]
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
id: "quantile-boundary-after-duplicate-removal",
|
|
97
|
+
descriptor: {
|
|
98
|
+
type: "quantile",
|
|
99
|
+
domain: [0, 10],
|
|
100
|
+
thresholds: [5],
|
|
101
|
+
range: {
|
|
102
|
+
type: "colors",
|
|
103
|
+
values: [
|
|
104
|
+
[0, 0, 0, 1],
|
|
105
|
+
[1, 1, 1, 1]
|
|
106
|
+
]
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
absoluteTolerance: 0,
|
|
110
|
+
samples: [
|
|
111
|
+
{ input: 4.999, expected: [0, 0, 0, 1] },
|
|
112
|
+
{ input: 5, expected: [1, 1, 1, 1] },
|
|
113
|
+
{ input: 10, expected: [1, 1, 1, 1] }
|
|
114
|
+
]
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
id: "linear-encoding-conversion",
|
|
118
|
+
descriptor: {
|
|
119
|
+
type: "sequential",
|
|
120
|
+
domain: [0, 1],
|
|
121
|
+
interpolation: "linear-srgb",
|
|
122
|
+
range: {
|
|
123
|
+
type: "colors",
|
|
124
|
+
values: [
|
|
125
|
+
[0, 0, 0, 1],
|
|
126
|
+
[1, 1, 1, 1]
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
encoding: { primaries: "srgb", transfer: "linear", format: "rgba32float" }
|
|
130
|
+
},
|
|
131
|
+
absoluteTolerance: 1e-5,
|
|
132
|
+
samples: [{ input: 0.5, expected: [0.5, 0.5, 0.5, 1] }]
|
|
133
|
+
},
|
|
134
|
+
{
|
|
135
|
+
id: "ordinal-unknown-category",
|
|
136
|
+
descriptor: {
|
|
137
|
+
type: "ordinal",
|
|
138
|
+
domain: ["first", "second"],
|
|
139
|
+
range: {
|
|
140
|
+
type: "colors",
|
|
141
|
+
values: [
|
|
142
|
+
[1, 0, 0, 1],
|
|
143
|
+
[0, 0, 1, 1]
|
|
144
|
+
]
|
|
145
|
+
}
|
|
146
|
+
},
|
|
147
|
+
absoluteTolerance: 0,
|
|
148
|
+
samples: [
|
|
149
|
+
{ input: "first", expected: [1, 0, 0, 1] },
|
|
150
|
+
{ input: "second", expected: [0, 0, 1, 1] },
|
|
151
|
+
{ input: "unknown", expected: null }
|
|
152
|
+
]
|
|
153
|
+
},
|
|
154
|
+
{
|
|
155
|
+
id: "hdr-linear-extended-channels",
|
|
156
|
+
descriptor: {
|
|
157
|
+
type: "sequential",
|
|
158
|
+
domain: [0, 1],
|
|
159
|
+
range: {
|
|
160
|
+
type: "colors",
|
|
161
|
+
values: [
|
|
162
|
+
[0, 0, 0, 0],
|
|
163
|
+
[4, 2, -0.5, 1]
|
|
164
|
+
]
|
|
165
|
+
},
|
|
166
|
+
encoding: {
|
|
167
|
+
primaries: "rec2020",
|
|
168
|
+
transfer: "linear",
|
|
169
|
+
format: "rgba32float",
|
|
170
|
+
referenceWhiteNits: 203
|
|
171
|
+
}
|
|
172
|
+
},
|
|
173
|
+
absoluteTolerance: 1e-5,
|
|
174
|
+
samples: [
|
|
175
|
+
{ input: 0.5, expected: [2, 1, -0.25, 0.5] },
|
|
176
|
+
{ input: 1, expected: [4, 2, -0.5, 1] }
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
];
|
|
180
|
+
//# sourceMappingURL=conformance.cjs.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/scales/conformance.ts"],
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;AA+BO,IAAM,0BAA2D;EACtE;IACE,IAAI;IACJ,YAAY,EAAC,MAAM,UAAU,QAAQ,CAAC,GAAG,EAAE,GAAG,OAAO,EAAC,MAAM,WAAW,QAAQ,CAAC,GAAG,GAAG,EAAC,EAAC;IACxF,mBAAmB;IACnB,SAAS;MACP,EAAC,OAAO,MAAM,UAAU,KAAI;MAC5B,EAAC,OAAO,IAAI,UAAU,IAAG;MACzB,EAAC,OAAO,GAAG,UAAU,EAAC;MACtB,EAAC,OAAO,GAAG,UAAU,GAAE;MACvB,EAAC,OAAO,IAAI,UAAU,IAAG;;;EAG7B;IACE,IAAI;IACJ,YAAY,EAAC,MAAM,OAAO,QAAQ,CAAC,GAAG,GAAG,GAAG,OAAO,EAAC,MAAM,WAAW,QAAQ,CAAC,GAAG,CAAC,EAAC,EAAC;IACpF,mBAAmB;IACnB,SAAS;MACP,EAAC,OAAO,GAAG,UAAU,KAAI;MACzB,EAAC,OAAO,GAAG,UAAU,EAAC;MACtB,EAAC,OAAO,IAAI,UAAU,IAAG;MACzB,EAAC,OAAO,KAAK,UAAU,EAAC;;;EAG5B;IACE,IAAI;IACJ,YAAY;MACV,MAAM;MACN,QAAQ,CAAC,GAAG,CAAC;MACb,eAAe;MACf,OAAO;QACL,MAAM;QACN,QAAQ;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AAC,OAAO,GAAG,UAAU,CAAC,GAAG,GAAG,MAAM,CAAC,EAAC;;;;",
|
|
5
|
+
"names": []
|
|
6
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ResolvedScaleDescriptor, ScaleColor, ScaleValue } from "./scale-types.js";
|
|
2
|
+
/** One backend-independent sampling expectation, before storage-format quantization. */
|
|
3
|
+
export type ScaleConformanceSample = Readonly<{
|
|
4
|
+
/** Input value; null represents an invalid source row. */
|
|
5
|
+
input: ScaleValue | null;
|
|
6
|
+
/** Expected numeric value, color channels, or invalid output. */
|
|
7
|
+
expected: number | ScaleColor | null;
|
|
8
|
+
}>;
|
|
9
|
+
/** Serializable fixture for CPU, worker, and GPU scale implementations. */
|
|
10
|
+
export type ScaleConformanceCase = Readonly<{
|
|
11
|
+
/** Stable descriptive case identifier. */
|
|
12
|
+
id: string;
|
|
13
|
+
/** Resolved domain, range, class breaks, and color interpretation. */
|
|
14
|
+
descriptor: ResolvedScaleDescriptor;
|
|
15
|
+
/** Maximum absolute error per numeric component, including alpha. */
|
|
16
|
+
absoluteTolerance: number;
|
|
17
|
+
/** Independently specified expected values, not generated by the sampler under test. */
|
|
18
|
+
samples: readonly ScaleConformanceSample[];
|
|
19
|
+
}>;
|
|
20
|
+
/**
|
|
21
|
+
* Small portable conformance corpus. Import this optional entry only in tests;
|
|
22
|
+
* the runtime scales entry does not import these fixtures. Storage packing and
|
|
23
|
+
* approximate domain resolution need separate backend-specific tests.
|
|
24
|
+
*/
|
|
25
|
+
export declare const SCALE_CONFORMANCE_CASES: readonly ScaleConformanceCase[];
|
|
26
|
+
//# sourceMappingURL=conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.d.ts","sourceRoot":"","sources":["../../src/scales/conformance.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,uBAAuB,EAAE,UAAU,EAAE,UAAU,EAAC,yBAAsB;AAEnF,wFAAwF;AACxF,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC;IAC5C,0DAA0D;IAC1D,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,iEAAiE;IACjE,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC;CACtC,CAAC,CAAC;AAEH,2EAA2E;AAC3E,MAAM,MAAM,oBAAoB,GAAG,QAAQ,CAAC;IAC1C,0CAA0C;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,sEAAsE;IACtE,UAAU,EAAE,uBAAuB,CAAC;IACpC,qEAAqE;IACrE,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wFAAwF;IACxF,OAAO,EAAE,SAAS,sBAAsB,EAAE,CAAC;CAC5C,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,uBAAuB,EAAE,SAAS,oBAAoB,EA0JlE,CAAC"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// math.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/**
|
|
5
|
+
* Small portable conformance corpus. Import this optional entry only in tests;
|
|
6
|
+
* the runtime scales entry does not import these fixtures. Storage packing and
|
|
7
|
+
* approximate domain resolution need separate backend-specific tests.
|
|
8
|
+
*/
|
|
9
|
+
export const SCALE_CONFORMANCE_CASES = [
|
|
10
|
+
{
|
|
11
|
+
id: 'linear-extrapolation',
|
|
12
|
+
descriptor: { type: 'linear', domain: [0, 10], range: { type: 'numeric', values: [0, 100] } },
|
|
13
|
+
absoluteTolerance: 0.00001,
|
|
14
|
+
samples: [
|
|
15
|
+
{ input: null, expected: null },
|
|
16
|
+
{ input: -1, expected: -10 },
|
|
17
|
+
{ input: 0, expected: 0 },
|
|
18
|
+
{ input: 5, expected: 50 },
|
|
19
|
+
{ input: 11, expected: 110 }
|
|
20
|
+
]
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
id: 'log-domain',
|
|
24
|
+
descriptor: { type: 'log', domain: [1, 100], range: { type: 'numeric', values: [0, 1] } },
|
|
25
|
+
absoluteTolerance: 0.00001,
|
|
26
|
+
samples: [
|
|
27
|
+
{ input: 0, expected: null },
|
|
28
|
+
{ input: 1, expected: 0 },
|
|
29
|
+
{ input: 10, expected: 0.5 },
|
|
30
|
+
{ input: 100, expected: 1 }
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
id: 'linear-srgb-interpolation',
|
|
35
|
+
descriptor: {
|
|
36
|
+
type: 'sequential',
|
|
37
|
+
domain: [0, 1],
|
|
38
|
+
interpolation: 'linear-srgb',
|
|
39
|
+
range: {
|
|
40
|
+
type: 'colors',
|
|
41
|
+
values: [
|
|
42
|
+
[0, 0, 0, 0],
|
|
43
|
+
[1, 1, 1, 1]
|
|
44
|
+
]
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
absoluteTolerance: 0.00001,
|
|
48
|
+
samples: [
|
|
49
|
+
{ input: -1, expected: [0, 0, 0, 0] },
|
|
50
|
+
{ input: 0.5, expected: [0.7353569830524495, 0.7353569830524495, 0.7353569830524495, 0.5] },
|
|
51
|
+
{ input: 2, expected: [1, 1, 1, 1] }
|
|
52
|
+
]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'null-under-over-colors',
|
|
56
|
+
descriptor: {
|
|
57
|
+
type: 'sequential',
|
|
58
|
+
domain: [0, 1],
|
|
59
|
+
range: {
|
|
60
|
+
type: 'colors',
|
|
61
|
+
values: [
|
|
62
|
+
[0, 0, 0, 1],
|
|
63
|
+
[1, 1, 1, 1]
|
|
64
|
+
]
|
|
65
|
+
},
|
|
66
|
+
nullColor: [0, 0, 0, 0],
|
|
67
|
+
underColor: [1, 0, 0, 1],
|
|
68
|
+
overColor: [0, 0, 1, 1]
|
|
69
|
+
},
|
|
70
|
+
absoluteTolerance: 0.00001,
|
|
71
|
+
samples: [
|
|
72
|
+
{ input: null, expected: [0, 0, 0, 0] },
|
|
73
|
+
{ input: -1, expected: [1, 0, 0, 1] },
|
|
74
|
+
{ input: 0, expected: [0, 0, 0, 1] },
|
|
75
|
+
{ input: 1, expected: [1, 1, 1, 1] },
|
|
76
|
+
{ input: 2, expected: [0, 0, 1, 1] }
|
|
77
|
+
]
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
id: 'quantile-boundary-after-duplicate-removal',
|
|
81
|
+
descriptor: {
|
|
82
|
+
type: 'quantile',
|
|
83
|
+
domain: [0, 10],
|
|
84
|
+
thresholds: [5],
|
|
85
|
+
range: {
|
|
86
|
+
type: 'colors',
|
|
87
|
+
values: [
|
|
88
|
+
[0, 0, 0, 1],
|
|
89
|
+
[1, 1, 1, 1]
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
},
|
|
93
|
+
absoluteTolerance: 0,
|
|
94
|
+
samples: [
|
|
95
|
+
{ input: 4.999, expected: [0, 0, 0, 1] },
|
|
96
|
+
{ input: 5, expected: [1, 1, 1, 1] },
|
|
97
|
+
{ input: 10, expected: [1, 1, 1, 1] }
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
id: 'linear-encoding-conversion',
|
|
102
|
+
descriptor: {
|
|
103
|
+
type: 'sequential',
|
|
104
|
+
domain: [0, 1],
|
|
105
|
+
interpolation: 'linear-srgb',
|
|
106
|
+
range: {
|
|
107
|
+
type: 'colors',
|
|
108
|
+
values: [
|
|
109
|
+
[0, 0, 0, 1],
|
|
110
|
+
[1, 1, 1, 1]
|
|
111
|
+
]
|
|
112
|
+
},
|
|
113
|
+
encoding: { primaries: 'srgb', transfer: 'linear', format: 'rgba32float' }
|
|
114
|
+
},
|
|
115
|
+
absoluteTolerance: 0.00001,
|
|
116
|
+
samples: [{ input: 0.5, expected: [0.5, 0.5, 0.5, 1] }]
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'ordinal-unknown-category',
|
|
120
|
+
descriptor: {
|
|
121
|
+
type: 'ordinal',
|
|
122
|
+
domain: ['first', 'second'],
|
|
123
|
+
range: {
|
|
124
|
+
type: 'colors',
|
|
125
|
+
values: [
|
|
126
|
+
[1, 0, 0, 1],
|
|
127
|
+
[0, 0, 1, 1]
|
|
128
|
+
]
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
absoluteTolerance: 0,
|
|
132
|
+
samples: [
|
|
133
|
+
{ input: 'first', expected: [1, 0, 0, 1] },
|
|
134
|
+
{ input: 'second', expected: [0, 0, 1, 1] },
|
|
135
|
+
{ input: 'unknown', expected: null }
|
|
136
|
+
]
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
id: 'hdr-linear-extended-channels',
|
|
140
|
+
descriptor: {
|
|
141
|
+
type: 'sequential',
|
|
142
|
+
domain: [0, 1],
|
|
143
|
+
range: {
|
|
144
|
+
type: 'colors',
|
|
145
|
+
values: [
|
|
146
|
+
[0, 0, 0, 0],
|
|
147
|
+
[4, 2, -0.5, 1]
|
|
148
|
+
]
|
|
149
|
+
},
|
|
150
|
+
encoding: {
|
|
151
|
+
primaries: 'rec2020',
|
|
152
|
+
transfer: 'linear',
|
|
153
|
+
format: 'rgba32float',
|
|
154
|
+
referenceWhiteNits: 203
|
|
155
|
+
}
|
|
156
|
+
},
|
|
157
|
+
absoluteTolerance: 0.00001,
|
|
158
|
+
samples: [
|
|
159
|
+
{ input: 0.5, expected: [2, 1, -0.25, 0.5] },
|
|
160
|
+
{ input: 1, expected: [4, 2, -0.5, 1] }
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
];
|
|
164
|
+
//# sourceMappingURL=conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conformance.js","sourceRoot":"","sources":["../../src/scales/conformance.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAwB5D;;;;GAIG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAoC;IACtE;QACE,EAAE,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KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,IAAI,EAAC;SACnC;KACF;IACD;QACE,EAAE,EAAE,8BAA8B;QAClC,UAAU,EAAE;YACV,IAAI,EAAE,YAAY;YAClB,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC;YACd,KAAK,EAAE;gBACL,IAAI,EAAE,QAAQ;gBACd,MAAM,EAAE;oBACN,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;oBACZ,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;iBAChB;aACF;YACD,QAAQ,EAAE;gBACR,SAAS,EAAE,SAAS;gBACpB,QAAQ,EAAE,QAAQ;gBAClB,MAAM,EAAE,aAAa;gBACrB,kBAAkB,EAAE,GAAG;aACxB;SACF;QACD,iBAAiB,EAAE,OAAO;QAC1B,OAAO,EAAE;YACP,EAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,EAAC;YAC1C,EAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,EAAC;SACtC;KACF;CACF,CAAC"}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
/** Signed extension of the sRGB transfer curve, preserving extended-range RGB values. */
|
|
3
|
-
export declare function decodeSRGB(v: number): number;
|
|
4
|
-
export declare function encodeSRGB(v: number): number;
|
|
5
|
-
/** Converts RGB primaries and sRGB/linear transfer without tone mapping or clipping. */
|
|
6
|
-
export declare function convertScaleColor(color: ScaleColor, from: ScaleColorEncoding, to: ScaleColorEncoding): ScaleColor;
|
|
7
|
-
/** IEEE-754 binary16 packing with round-to-nearest, ties-to-even. */
|
|
8
|
-
export declare function packFloat16(value: number): number;
|
|
9
|
-
/** IEEE-754 binary16 decode into a JavaScript number. */
|
|
10
|
-
export declare function unpackFloat16(bits: number): number;
|
|
11
|
-
/** Float16 storage words for one unpremultiplied scene-linear RGBA color. */
|
|
12
|
-
export declare function packRGBA16F(color: ScaleColor): Uint16Array;
|
|
1
|
+
export * from '@math.gl/core/color';
|
|
13
2
|
//# sourceMappingURL=hdr-colors.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hdr-colors.d.ts","sourceRoot":"","sources":["../../src/scales/hdr-colors.ts"],"names":[],"mappings":"AAIA,
|
|
1
|
+
{"version":3,"file":"hdr-colors.d.ts","sourceRoot":"","sources":["../../src/scales/hdr-colors.ts"],"names":[],"mappings":"AAIA,cAAc,qBAAqB,CAAC"}
|
|
@@ -1,115 +1,5 @@
|
|
|
1
1
|
// math.gl
|
|
2
2
|
// SPDX-License-Identifier: MIT
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
const TO_XYZ = {
|
|
6
|
-
srgb: [
|
|
7
|
-
0.4124564, 0.3575761, 0.1804375, 0.2126729, 0.7151522, 0.072175, 0.0193339, 0.119192, 0.9503041
|
|
8
|
-
],
|
|
9
|
-
'display-p3': [
|
|
10
|
-
0.48657095, 0.26566769, 0.19821729, 0.22897456, 0.69173852, 0.07928691, 0, 0.04511338,
|
|
11
|
-
1.04394437
|
|
12
|
-
],
|
|
13
|
-
rec2020: [
|
|
14
|
-
0.63695805, 0.1446169, 0.16888098, 0.26270021, 0.67799807, 0.05930172, 0, 0.02807269, 1.06098506
|
|
15
|
-
]
|
|
16
|
-
};
|
|
17
|
-
const FROM_XYZ = {
|
|
18
|
-
srgb: [
|
|
19
|
-
3.2404542, -1.5371385, -0.4985314, -0.969266, 1.8760108, 0.041556, 0.0556434, -0.2040259,
|
|
20
|
-
1.0572252
|
|
21
|
-
],
|
|
22
|
-
'display-p3': [
|
|
23
|
-
2.49349691, -0.93138362, -0.40271078, -0.82948897, 1.76266406, 0.02362469, 0.03584583,
|
|
24
|
-
-0.07617239, 0.95688452
|
|
25
|
-
],
|
|
26
|
-
rec2020: [
|
|
27
|
-
1.71665119, -0.35567078, -0.25336628, -0.66668435, 1.61648124, 0.01576855, 0.01763986,
|
|
28
|
-
-0.04277061, 0.94210312
|
|
29
|
-
]
|
|
30
|
-
};
|
|
31
|
-
function transform(m, [r, g, b]) {
|
|
32
|
-
return [
|
|
33
|
-
m[0] * r + m[1] * g + m[2] * b,
|
|
34
|
-
m[3] * r + m[4] * g + m[5] * b,
|
|
35
|
-
m[6] * r + m[7] * g + m[8] * b
|
|
36
|
-
];
|
|
37
|
-
}
|
|
38
|
-
/** Signed extension of the sRGB transfer curve, preserving extended-range RGB values. */
|
|
39
|
-
export function decodeSRGB(v) {
|
|
40
|
-
const x = Math.abs(v);
|
|
41
|
-
return Math.sign(v) * (x <= 0.04045 ? x / 12.92 : ((x + 0.055) / 1.055) ** 2.4);
|
|
42
|
-
}
|
|
43
|
-
export function encodeSRGB(v) {
|
|
44
|
-
const x = Math.abs(v);
|
|
45
|
-
return Math.sign(v) * (x <= 0.0031308 ? 12.92 * x : 1.055 * x ** (1 / 2.4) - 0.055);
|
|
46
|
-
}
|
|
47
|
-
function decode(v, transfer) {
|
|
48
|
-
if (transfer === 'linear')
|
|
49
|
-
return v;
|
|
50
|
-
if (transfer === 'srgb')
|
|
51
|
-
return decodeSRGB(v);
|
|
52
|
-
throw new Error(`Transfer ${transfer} requires an explicit HDR display-referred conversion`);
|
|
53
|
-
}
|
|
54
|
-
function encode(v, transfer) {
|
|
55
|
-
if (transfer === 'linear')
|
|
56
|
-
return v;
|
|
57
|
-
if (transfer === 'srgb')
|
|
58
|
-
return encodeSRGB(v);
|
|
59
|
-
throw new Error(`Transfer ${transfer} requires an explicit HDR display-referred conversion`);
|
|
60
|
-
}
|
|
61
|
-
/** Converts RGB primaries and sRGB/linear transfer without tone mapping or clipping. */
|
|
62
|
-
export function convertScaleColor(color, from, to) {
|
|
63
|
-
if (color.some(channel => !Number.isFinite(channel))) {
|
|
64
|
-
throw new Error('Color channels must be finite');
|
|
65
|
-
}
|
|
66
|
-
if (from.transfer === 'pq' ||
|
|
67
|
-
from.transfer === 'hlg' ||
|
|
68
|
-
to.transfer === 'pq' ||
|
|
69
|
-
to.transfer === 'hlg') {
|
|
70
|
-
throw new Error('PQ/HLG conversions require explicit luminance and display assumptions');
|
|
71
|
-
}
|
|
72
|
-
const linear = color.slice(0, 3).map(v => decode(v, from.transfer));
|
|
73
|
-
const converted = from.primaries === to.primaries
|
|
74
|
-
? linear
|
|
75
|
-
: transform(FROM_XYZ[to.primaries], transform(TO_XYZ[from.primaries], linear));
|
|
76
|
-
return [
|
|
77
|
-
encode(converted[0], to.transfer),
|
|
78
|
-
encode(converted[1], to.transfer),
|
|
79
|
-
encode(converted[2], to.transfer),
|
|
80
|
-
color[3]
|
|
81
|
-
];
|
|
82
|
-
}
|
|
83
|
-
/** IEEE-754 binary16 packing with round-to-nearest, ties-to-even. */
|
|
84
|
-
export function packFloat16(value) {
|
|
85
|
-
const sign = value < 0 || Object.is(value, -0) ? 0x8000 : 0;
|
|
86
|
-
const magnitude = Math.abs(value);
|
|
87
|
-
if (Number.isNaN(magnitude))
|
|
88
|
-
return 0x7e00;
|
|
89
|
-
if (magnitude >= 65520)
|
|
90
|
-
return sign | 0x7c00;
|
|
91
|
-
if (magnitude <= 2 ** -25)
|
|
92
|
-
return sign;
|
|
93
|
-
const exponent = Math.max(-14, Math.floor(Math.log2(magnitude)));
|
|
94
|
-
const scaled = magnitude * 2 ** (10 - exponent);
|
|
95
|
-
const lower = Math.floor(scaled);
|
|
96
|
-
const fraction = scaled - lower;
|
|
97
|
-
const significand = lower + (fraction > 0.5 || (fraction === 0.5 && lower % 2) ? 1 : 0);
|
|
98
|
-
return sign | (((exponent + 14) << 10) + significand);
|
|
99
|
-
}
|
|
100
|
-
/** IEEE-754 binary16 decode into a JavaScript number. */
|
|
101
|
-
export function unpackFloat16(bits) {
|
|
102
|
-
const sign = bits & 0x8000 ? -1 : 1;
|
|
103
|
-
const exp = (bits >>> 10) & 31;
|
|
104
|
-
const mantissa = bits & 1023;
|
|
105
|
-
if (exp === 0)
|
|
106
|
-
return sign * mantissa * 2 ** -24;
|
|
107
|
-
if (exp === 31)
|
|
108
|
-
return mantissa ? NaN : sign * Infinity;
|
|
109
|
-
return sign * (1 + mantissa / 1024) * 2 ** (exp - 15);
|
|
110
|
-
}
|
|
111
|
-
/** Float16 storage words for one unpremultiplied scene-linear RGBA color. */
|
|
112
|
-
export function packRGBA16F(color) {
|
|
113
|
-
return Uint16Array.from(color, packFloat16);
|
|
114
|
-
}
|
|
4
|
+
export * from '@math.gl/core/color';
|
|
115
5
|
//# sourceMappingURL=hdr-colors.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hdr-colors.js","sourceRoot":"","sources":["../../src/scales/hdr-colors.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;
|
|
1
|
+
{"version":3,"file":"hdr-colors.js","sourceRoot":"","sources":["../../src/scales/hdr-colors.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,cAAc,qBAAqB,CAAC"}
|