@math.gl/types 4.2.0-alpha.3 → 4.2.0-alpha.5

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/LICENSE CHANGED
@@ -22,6 +22,33 @@ THE SOFTWARE.
22
22
 
23
23
  ---
24
24
 
25
+ Some primitive tessellation approaches were originally inspired by the TDL WebGL samples under
26
+ the New BSD License:
27
+
28
+ Copyright (c) 2011, Google Inc. All rights reserved.
29
+
30
+ Redistribution and use in source and binary forms, with or without modification, are permitted
31
+ provided that the following conditions are met:
32
+
33
+ 1. Redistributions of source code must retain the above copyright notice, this list of conditions
34
+ and the following disclaimer.
35
+ 2. Redistributions in binary form must reproduce the above copyright notice, this list of
36
+ conditions and the following disclaimer in the documentation and/or other materials provided
37
+ with the distribution.
38
+ 3. Neither the name of Google Inc. nor the names of its contributors may be used to endorse or
39
+ promote products derived from this software without specific prior written permission.
40
+
41
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
42
+ IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
43
+ FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
44
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
45
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46
+ DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
47
+ IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
48
+ OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
49
+
50
+ ---
51
+
25
52
  math.gl builds on docs and code from "gl-matrix", which is MIT licensed as follows:
26
53
 
27
54
  Copyright (c) 2015, Brandon Jones, Colin MacKenzie IV.
@@ -87,3 +114,27 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
87
114
  See the License for the specific language governing permissions and limitations under the License.
88
115
 
89
116
  Cesium-derived code can be found in the submodule: modules/3d-tiles
117
+
118
+ ---
119
+
120
+ The @math.gl/geometry primitive tessellators are adapted from luma.gl under the MIT License:
121
+
122
+ Copyright (c) 2020 vis.gl contributors
123
+
124
+ Permission is hereby granted, free of charge, to any person obtaining a copy
125
+ of this software and associated documentation files (the "Software"), to deal
126
+ in the Software without restriction, including without limitation the rights
127
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
128
+ copies of the Software, and to permit persons to whom the Software is
129
+ furnished to do so, subject to the following conditions:
130
+
131
+ The above copyright notice and this permission notice shall be included in
132
+ all copies or substantial portions of the Software.
133
+
134
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
135
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
136
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
137
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
138
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
139
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
140
+ THE SOFTWARE.
@@ -1,11 +1,17 @@
1
+ /// <reference lib="es2025.float16" preserve="true" />
1
2
  /**
2
- * Type covering all non-big typed arrays
3
+ * Type covering all non-big JavaScript typed arrays, including `Float16Array`.
4
+ *
5
+ * @remarks Including `Float16Array` does not guarantee that `globalThis.Float16Array` exists.
3
6
  */
4
- export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float32Array | Float64Array;
7
+ export type TypedArray = Int8Array | Uint8Array | Uint8ClampedArray | Int16Array | Uint16Array | Int32Array | Uint32Array | Float16Array | Float32Array | Float64Array;
5
8
  /**
6
- * Type covering constructors for all non-big typed arrays
9
+ * Type covering constructors for all non-big JavaScript typed arrays, including
10
+ * `Float16ArrayConstructor`.
11
+ *
12
+ * @remarks Including `Float16ArrayConstructor` does not install `globalThis.Float16Array`.
7
13
  */
8
- export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
14
+ export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float16ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
9
15
  /**
10
16
  * Type covering all big typed arrays
11
17
  */
@@ -1 +1 @@
1
- {"version":3,"file":"array-types.d.ts","sourceRoot":"","sources":["../src/array-types.ts"],"names":[],"mappings":"AAIA;;GAEG;AACH,MAAM,MAAM,UAAU,GAClB,SAAS,GACT,UAAU,GACV,iBAAiB,GACjB,UAAU,GACV,WAAW,GACX,UAAU,GACV,WAAW,GACX,YAAY,GACZ,YAAY,CAAC;AAEjB;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAC7B,oBAAoB,GACpB,qBAAqB,GACrB,4BAA4B,GAC5B,qBAAqB,GACrB,sBAAsB,GACtB,qBAAqB,GACrB,sBAAsB,GACtB,uBAAuB,GACvB,uBAAuB,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,GAAG,cAAc,CAAC;AAE3D;;GAEG;AACH,MAAM,MAAM,wB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,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,MAAM,EAAE,CAAC;AAEjD,oDAAoD;AACpD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,qDAAqD;AACrD,MAAM,MAAM,aAAa,GAAG,YAAY,GAAG,UAAU,CAAC;AAEtD,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC;AAExD,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,aAAa,GAAG,UAAU,CAAC"}
@@ -1,5 +1,6 @@
1
1
  // math.gl
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
+ /// <reference lib="es2025.float16" preserve="true" />
4
5
  export {};
5
6
  //# sourceMappingURL=array-types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"array-types.js","sourceRoot":"","sources":["../src/array-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC"}
1
+ {"version":3,"file":"array-types.js","sourceRoot":"","sources":["../src/array-types.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAKpC,sDAAsD"}
@@ -0,0 +1,26 @@
1
+ import type { TypedArrayConstructor } from "./array-types.js";
2
+ /**
3
+ * The native `Float16Array` constructor exposed by the current JavaScript runtime.
4
+ *
5
+ * @remarks This is `undefined` when the runtime does not provide `Float16Array`. The value is
6
+ * captured when this module is evaluated, so a polyfill must be installed before importing
7
+ * `@math.gl/types`.
8
+ */
9
+ export declare const NativeFloat16ArrayConstructor: TypedArrayConstructor | undefined;
10
+ /**
11
+ * Returns the typed array constructor used for half-precision storage.
12
+ *
13
+ * @returns The native `Float16Array` constructor when available, otherwise `Uint16Array`.
14
+ * @remarks The `Uint16Array` fallback stores encoded IEEE 754 binary16 bit patterns. Unlike a
15
+ * native `Float16Array`, it does not encode numeric assignments or decode values when read.
16
+ */
17
+ export declare function getFloat16ArrayConstructor(): TypedArrayConstructor;
18
+ /**
19
+ * Checks whether a value is the native `Float16Array` constructor for the current runtime.
20
+ *
21
+ * @param value The value to test.
22
+ * @returns `true` when `value` matches `NativeFloat16ArrayConstructor`. Returns `false` for the
23
+ * `Uint16Array` fallback.
24
+ */
25
+ export declare function isFloat16ArrayConstructor(value: unknown): boolean;
26
+ //# sourceMappingURL=float16.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"float16.d.ts","sourceRoot":"","sources":["../src/float16.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,qBAAqB,EAAC,yBAAsB;AAEzD;;;;;;GAMG;AACH,eAAO,MAAM,6BAA6B,EAAE,qBAAqB,GAAG,SAC3C,CAAC;AAE1B;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,qBAAqB,CAElE;AAED;;;;;;GAMG;AACH,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAEjE"}
@@ -0,0 +1,32 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+ /**
5
+ * The native `Float16Array` constructor exposed by the current JavaScript runtime.
6
+ *
7
+ * @remarks This is `undefined` when the runtime does not provide `Float16Array`. The value is
8
+ * captured when this module is evaluated, so a polyfill must be installed before importing
9
+ * `@math.gl/types`.
10
+ */
11
+ export const NativeFloat16ArrayConstructor = globalThis.Float16Array;
12
+ /**
13
+ * Returns the typed array constructor used for half-precision storage.
14
+ *
15
+ * @returns The native `Float16Array` constructor when available, otherwise `Uint16Array`.
16
+ * @remarks The `Uint16Array` fallback stores encoded IEEE 754 binary16 bit patterns. Unlike a
17
+ * native `Float16Array`, it does not encode numeric assignments or decode values when read.
18
+ */
19
+ export function getFloat16ArrayConstructor() {
20
+ return NativeFloat16ArrayConstructor ?? Uint16Array;
21
+ }
22
+ /**
23
+ * Checks whether a value is the native `Float16Array` constructor for the current runtime.
24
+ *
25
+ * @param value The value to test.
26
+ * @returns `true` when `value` matches `NativeFloat16ArrayConstructor`. Returns `false` for the
27
+ * `Uint16Array` fallback.
28
+ */
29
+ export function isFloat16ArrayConstructor(value) {
30
+ return Boolean(NativeFloat16ArrayConstructor && value === NativeFloat16ArrayConstructor);
31
+ }
32
+ //# sourceMappingURL=float16.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"float16.js","sourceRoot":"","sources":["../src/float16.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAIpC;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,6BAA6B,GACxC,UAAU,CAAC,YAAY,CAAC;AAE1B;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;IACxC,OAAO,6BAA6B,IAAI,WAAW,CAAC;AACtD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,yBAAyB,CAAC,KAAc;IACtD,OAAO,OAAO,CAAC,6BAA6B,IAAI,KAAK,KAAK,6BAA6B,CAAC,CAAC;AAC3F,CAAC"}
package/dist/index.cjs CHANGED
@@ -17,13 +17,16 @@ var __copyProps = (to, from, except, desc) => {
17
17
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
18
 
19
19
  // dist/index.js
20
- var dist_exports = {};
21
- __export(dist_exports, {
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ NativeFloat16ArrayConstructor: () => NativeFloat16ArrayConstructor,
23
+ getFloat16ArrayConstructor: () => getFloat16ArrayConstructor,
24
+ isFloat16ArrayConstructor: () => isFloat16ArrayConstructor,
22
25
  isNumberArray: () => isNumberArray,
23
26
  isNumericArray: () => isNumericArray,
24
27
  isTypedArray: () => isTypedArray
25
28
  });
26
- module.exports = __toCommonJS(dist_exports);
29
+ module.exports = __toCommonJS(index_exports);
27
30
 
28
31
  // dist/is-array.js
29
32
  function isTypedArray(value) {
@@ -38,4 +41,13 @@ function isNumberArray(value) {
38
41
  function isNumericArray(value) {
39
42
  return isTypedArray(value) || isNumberArray(value);
40
43
  }
44
+
45
+ // dist/float16.js
46
+ var NativeFloat16ArrayConstructor = globalThis.Float16Array;
47
+ function getFloat16ArrayConstructor() {
48
+ return NativeFloat16ArrayConstructor ?? Uint16Array;
49
+ }
50
+ function isFloat16ArrayConstructor(value) {
51
+ return Boolean(NativeFloat16ArrayConstructor && value === NativeFloat16ArrayConstructor);
52
+ }
41
53
  //# sourceMappingURL=index.cjs.map
@@ -1,7 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
- "sources": ["../src/index.ts", "../src/is-array.ts"],
4
- "sourcesContent": ["// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nexport type {\n // typed arrays\n TypedArray,\n TypedArrayConstructor,\n BigTypedArray,\n BigTypedArrayConstructor,\n // numeric arrays (sized number arrays)\n NumberArray,\n NumberArray1,\n NumberArray2,\n NumberArray3,\n NumberArray4,\n NumberArray6,\n NumberArray8,\n NumberArray9,\n NumberArray12,\n NumberArray16,\n // numeric arrays (sized number arrays or typed arrays)\n NumericArray,\n NumericArray1,\n NumericArray2,\n NumericArray3,\n NumericArray4,\n NumericArray6,\n NumericArray8,\n NumericArray9,\n NumericArray12,\n NumericArray16\n} from './array-types';\n\nexport {isTypedArray, isNumberArray, isNumericArray} from './is-array';\n\nexport type {Bounds, Bounds2D, Bounds3D} from './bounds-types';\n", "// math.gl\n// SPDX-License-Identifier: MIT\n// Copyright (c) vis.gl contributors\n\nimport {TypedArray, NumericArray, NumberArray} from './array-types';\n\n/**\n * Check is an array is a typed array\n * @param value value to be tested\n * @returns input with type narrowed to TypedArray, or null\n */\nexport function isTypedArray(value: unknown): value is TypedArray {\n return ArrayBuffer.isView(value) && !(value instanceof DataView);\n}\n\n/**\n * Check is an array is an array of numbers)\n * @param value value to be tested\n * @returns input with type narrowed to NumberArray, or null\n */\nexport function isNumberArray(value: unknown): value is NumberArray {\n if (Array.isArray(value)) {\n return value.length === 0 || typeof value[0] === 'number';\n }\n return false;\n}\n\n/**\n * Check is an array is a numeric array (typed array or array of numbers)\n * @param value value to be tested\n * @returns input with type narrowed to NumericArray, or null\n */\nexport function isNumericArray(value: unknown): value is NumericArray {\n return isTypedArray(value) || isNumberArray(value);\n}\n"],
5
- "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;ACWM,SAAU,aAAa,OAAc;AACzC,SAAO,YAAY,OAAO,KAAK,KAAK,EAAE,iBAAiB;AACzD;AAOM,SAAU,cAAc,OAAc;AAC1C,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,WAAW,KAAK,OAAO,MAAM,CAAC,MAAM;EACnD;AACA,SAAO;AACT;AAOM,SAAU,eAAe,OAAc;AAC3C,SAAO,aAAa,KAAK,KAAK,cAAc,KAAK;AACnD;",
3
+ "sources": ["../src/index.ts", "../src/is-array.ts", "../src/float16.ts"],
4
+ "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;ACWM,SAAU,aAAa,OAAc;AACzC,SAAO,YAAY,OAAO,KAAK,KAAK,EAAE,iBAAiB;AACzD;AAOM,SAAU,cAAc,OAAc;AAC1C,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM,WAAW,KAAK,OAAO,MAAM,CAAC,MAAM;EACnD;AACA,SAAO;AACT;AAOM,SAAU,eAAe,OAAc;AAC3C,SAAO,aAAa,KAAK,KAAK,cAAc,KAAK;AACnD;;;ACrBO,IAAM,gCACX,WAAW;AASP,SAAU,6BAA0B;AACxC,SAAO,iCAAiC;AAC1C;AASM,SAAU,0BAA0B,OAAc;AACtD,SAAO,QAAQ,iCAAiC,UAAU,6BAA6B;AACzF;",
6
5
  "names": []
7
6
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export type { TypedArray, TypedArrayConstructor, BigTypedArray, BigTypedArrayConstructor, NumberArray, NumberArray1, NumberArray2, NumberArray3, NumberArray4, NumberArray6, NumberArray8, NumberArray9, NumberArray12, NumberArray16, NumericArray, NumericArray1, NumericArray2, NumericArray3, NumericArray4, NumericArray6, NumericArray8, NumericArray9, NumericArray12, NumericArray16 } from "./array-types.js";
2
2
  export { isTypedArray, isNumberArray, isNumericArray } from "./is-array.js";
3
+ export { NativeFloat16ArrayConstructor, getFloat16ArrayConstructor, isFloat16ArrayConstructor } from "./float16.js";
3
4
  export type { Bounds, Bounds2D, Bounds3D } from "./bounds-types.js";
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAEV,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,wBAAwB,EAExB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EAEb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACf,yBAAsB;AAEvB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAC,sBAAmB;AAEvE,YAAY,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAC,0BAAuB"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,YAAY,EAEV,UAAU,EACV,qBAAqB,EACrB,aAAa,EACb,wBAAwB,EAExB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,aAAa,EAEb,YAAY,EACZ,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,aAAa,EACb,cAAc,EACd,cAAc,EACf,yBAAsB;AAEvB,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAC,sBAAmB;AACvE,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EAC1B,qBAAkB;AAEnB,YAAY,EAAC,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAC,0BAAuB"}
package/dist/index.js CHANGED
@@ -2,4 +2,5 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
  export { isTypedArray, isNumberArray, isNumericArray } from "./is-array.js";
5
+ export { NativeFloat16ArrayConstructor, getFloat16ArrayConstructor, isFloat16ArrayConstructor } from "./float16.js";
5
6
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAgCpC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAC,sBAAmB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAgCpC,OAAO,EAAC,YAAY,EAAE,aAAa,EAAE,cAAc,EAAC,sBAAmB;AACvE,OAAO,EACL,6BAA6B,EAC7B,0BAA0B,EAC1B,yBAAyB,EAC1B,qBAAkB"}
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "publishConfig": {
7
7
  "access": "public"
8
8
  },
9
- "version": "4.2.0-alpha.3",
9
+ "version": "4.2.0-alpha.5",
10
10
  "keywords": [
11
11
  "typescript",
12
12
  "javascript",
@@ -35,5 +35,5 @@
35
35
  "sideEffects": [
36
36
  "./src/bigint.js"
37
37
  ],
38
- "gitHead": "4238aa95fb38da43a65c6e5f2b8343a875666d92"
38
+ "gitHead": "9c13785761867748e2edb167b5f2749dce803039"
39
39
  }
@@ -2,8 +2,15 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  // Copyright (c) vis.gl contributors
4
4
 
5
+ // Float16Array is declared in a separate TypeScript library. Preserve this reference so
6
+ // published declarations remain self-contained without changing the target or emitting runtime code.
7
+ // eslint-disable-next-line spaced-comment
8
+ /// <reference lib="es2025.float16" preserve="true" />
9
+
5
10
  /**
6
- * Type covering all non-big typed arrays
11
+ * Type covering all non-big JavaScript typed arrays, including `Float16Array`.
12
+ *
13
+ * @remarks Including `Float16Array` does not guarantee that `globalThis.Float16Array` exists.
7
14
  */
8
15
  export type TypedArray =
9
16
  | Int8Array
@@ -13,11 +20,15 @@ export type TypedArray =
13
20
  | Uint16Array
14
21
  | Int32Array
15
22
  | Uint32Array
23
+ | Float16Array
16
24
  | Float32Array
17
25
  | Float64Array;
18
26
 
19
27
  /**
20
- * Type covering constructors for all non-big typed arrays
28
+ * Type covering constructors for all non-big JavaScript typed arrays, including
29
+ * `Float16ArrayConstructor`.
30
+ *
31
+ * @remarks Including `Float16ArrayConstructor` does not install `globalThis.Float16Array`.
21
32
  */
22
33
  export type TypedArrayConstructor =
23
34
  | Int8ArrayConstructor
@@ -27,6 +38,7 @@ export type TypedArrayConstructor =
27
38
  | Uint16ArrayConstructor
28
39
  | Int32ArrayConstructor
29
40
  | Uint32ArrayConstructor
41
+ | Float16ArrayConstructor
30
42
  | Float32ArrayConstructor
31
43
  | Float64ArrayConstructor;
32
44
 
package/src/float16.ts ADDED
@@ -0,0 +1,37 @@
1
+ // math.gl
2
+ // SPDX-License-Identifier: MIT
3
+ // Copyright (c) vis.gl contributors
4
+
5
+ import type {TypedArrayConstructor} from './array-types';
6
+
7
+ /**
8
+ * The native `Float16Array` constructor exposed by the current JavaScript runtime.
9
+ *
10
+ * @remarks This is `undefined` when the runtime does not provide `Float16Array`. The value is
11
+ * captured when this module is evaluated, so a polyfill must be installed before importing
12
+ * `@math.gl/types`.
13
+ */
14
+ export const NativeFloat16ArrayConstructor: TypedArrayConstructor | undefined =
15
+ globalThis.Float16Array;
16
+
17
+ /**
18
+ * Returns the typed array constructor used for half-precision storage.
19
+ *
20
+ * @returns The native `Float16Array` constructor when available, otherwise `Uint16Array`.
21
+ * @remarks The `Uint16Array` fallback stores encoded IEEE 754 binary16 bit patterns. Unlike a
22
+ * native `Float16Array`, it does not encode numeric assignments or decode values when read.
23
+ */
24
+ export function getFloat16ArrayConstructor(): TypedArrayConstructor {
25
+ return NativeFloat16ArrayConstructor ?? Uint16Array;
26
+ }
27
+
28
+ /**
29
+ * Checks whether a value is the native `Float16Array` constructor for the current runtime.
30
+ *
31
+ * @param value The value to test.
32
+ * @returns `true` when `value` matches `NativeFloat16ArrayConstructor`. Returns `false` for the
33
+ * `Uint16Array` fallback.
34
+ */
35
+ export function isFloat16ArrayConstructor(value: unknown): boolean {
36
+ return Boolean(NativeFloat16ArrayConstructor && value === NativeFloat16ArrayConstructor);
37
+ }
package/src/index.ts CHANGED
@@ -33,5 +33,10 @@ export type {
33
33
  } from './array-types';
34
34
 
35
35
  export {isTypedArray, isNumberArray, isNumericArray} from './is-array';
36
+ export {
37
+ NativeFloat16ArrayConstructor,
38
+ getFloat16ArrayConstructor,
39
+ isFloat16ArrayConstructor
40
+ } from './float16';
36
41
 
37
42
  export type {Bounds, Bounds2D, Bounds3D} from './bounds-types';