Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: bump to [email protected] #13

Merged
merged 3 commits into from
Aug 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ module.exports = getESLintConfig({
{
files: ['modules/**/*.ts', 'modules/**/*.js'],
rules: {
'no-use-before-define': 0,
'import/no-unresolved': 0,
'import/named': 0,
'@typescript-eslint/ban-ts-comment': 0 // We do need our ts-ignores
}
},
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# CHANGELOG

## v4.1.0
## v4.1.0-alpha.1

- feat: Add sized array types (#11)
- feat(types): Add bounds types (#12)
Expand Down
3 changes: 2 additions & 1 deletion modules/core/src/classes/euler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
const ERR_UNKNOWN_ORDER = 'Unknown Euler angle order';
const ALMOST_ONE = 0.99999;

// eslint-disable-next-line no-shadow
enum RotationOrder {
ZYX = 0,
YXZ = 1,
Expand Down Expand Up @@ -71,8 +72,8 @@
super(-0, -0, -0, -0);
// eslint-disable-next-line prefer-rest-params
if (arguments.length > 0 && Array.isArray(arguments[0])) {
// eslint-disable-next-line prefer-rest-params
// @ts-expect-error
// eslint-disable-next-line prefer-rest-params
this.fromVector3(...arguments);
} else {
this.set(x, y, z, order);
Expand Down Expand Up @@ -290,17 +291,17 @@
getQuaternion(): Quaternion {
const q = new Quaternion();
switch (this[3]) {
case RotationOrder.XYZ:

Check warning on line 294 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateX(this[0]).rotateY(this[1]).rotateZ(this[2]);
case RotationOrder.YXZ:

Check warning on line 296 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateY(this[0]).rotateX(this[1]).rotateZ(this[2]);
case RotationOrder.ZXY:

Check warning on line 298 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateZ(this[0]).rotateX(this[1]).rotateY(this[2]);
case RotationOrder.ZYX:

Check warning on line 300 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateZ(this[0]).rotateY(this[1]).rotateX(this[2]);
case RotationOrder.YZX:

Check warning on line 302 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateY(this[0]).rotateZ(this[1]).rotateX(this[2]);
case RotationOrder.XZY:

Check warning on line 304 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
return q.rotateX(this[0]).rotateZ(this[1]).rotateY(this[2]);
default:
throw new Error(ERR_UNKNOWN_ORDER);
Expand Down Expand Up @@ -407,7 +408,7 @@
const d = Math.sin(y);
const f = Math.sin(z);
switch (this[3]) {
case Euler.XYZ: {

Check warning on line 411 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
const ae = a * e,
af = a * f,
be = b * e,
Expand All @@ -423,7 +424,7 @@
te[10] = a * c;
break;
}
case Euler.YXZ: {

Check warning on line 427 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
const ce = c * e,
cf = c * f,
de = d * e,
Expand All @@ -439,7 +440,7 @@
te[10] = a * c;
break;
}
case Euler.ZXY: {

Check warning on line 443 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
const ce = c * e,
cf = c * f,
de = d * e,
Expand All @@ -455,7 +456,7 @@
te[10] = a * c;
break;
}
case Euler.ZYX: {

Check warning on line 459 in modules/core/src/classes/euler.ts

View workflow job for this annotation

GitHub Actions / test (20)

The case statement does not have a shared enum type with the switch predicate
const ae = a * e,
af = a * f,
be = b * e,
Expand Down
1 change: 1 addition & 0 deletions modules/core/src/classes/matrix3.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
import {transformMat3 as vec2_transformMat3} from '../gl-matrix/vec2';
import {transformMat3 as vec3_transformMat3} from '../gl-matrix/vec3';

// eslint-disable-next-line no-shadow
enum INDICES {
COL0ROW0 = 0,
COL0ROW1 = 1,
Expand Down
1 change: 1 addition & 0 deletions modules/core/src/classes/matrix4.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {transformMat4 as vec2_transformMat4} from '../gl-matrix/vec2';
import {transformMat4 as vec3_transformMat4} from '../gl-matrix/vec3';
import {transformMat4 as vec4_transformMat4} from '../gl-matrix/vec4';

// eslint-disable-next-line no-shadow
enum INDICES {
COL0ROW0 = 0,
COL0ROW1 = 1,
Expand Down
3 changes: 1 addition & 2 deletions modules/core/src/classes/spherical-coordinates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
// Adaptation of THREE.js Spherical class, under MIT license
import {NumericArray} from '@math.gl/types';
import {Vector3} from './vector3';
import {formatValue, equals, config} from '../lib/common';
import {degrees, radians, clamp} from '../lib/common';
import {formatValue, equals, config, degrees, radians, clamp} from '../lib/common';
// @ts-ignore gl-matrix types...
import * as vec3 from '../gl-matrix/vec3';

Expand Down
18 changes: 9 additions & 9 deletions modules/core/src/gl-matrix/vec2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import * as glMatrix from './common.js';
/**
* Creates a new, empty vec2
*
* @returns {NumericArray} a new 2D vector
* @returns a new 2D vector
*/
export function create() {
export function create(): NumericArray {
const out = new glMatrix.ARRAY_TYPE(2);
if (glMatrix.ARRAY_TYPE != Float32Array) {
out[0] = 0;
Expand All @@ -26,10 +26,10 @@ export function create() {
/**
* Creates a new vec2 initialized with values from an existing vector
*
* @param {Readonly<NumericArray>} a vector to clone
* @returns {NumericArray} a new 2D vector
* @param a vector to clone
* @returns a new 2D vector
*/
export function clone(a) {
export function clone(a: Readonly<NumericArray>): NumericArray {
const out = new glMatrix.ARRAY_TYPE(2);
out[0] = a[0];
out[1] = a[1];
Expand All @@ -39,11 +39,11 @@ export function clone(a) {
/**
* Creates a new vec2 initialized with the given values
*
* @param {Number} x X component
* @param {Number} y Y component
* @returns {NumericArray} a new 2D vector
* @param x X component
* @param y Y component
* @returns a new 2D vector
*/
export function fromValues(x, y) {
export function fromValues(x: number, y: number): NumericArray {
const out = new glMatrix.ARRAY_TYPE(2);
out[0] = x;
out[1] = y;
Expand Down
17 changes: 15 additions & 2 deletions modules/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,22 @@
// Copyright (c) vis.gl contributors

// types
export type {TypedArray, TypedArrayConstructor, NumberArray, NumericArray} from '@math.gl/types';
export type {
TypedArray,
TypedArrayConstructor,
NumericArray,
NumberArray,
NumberArray2,
NumberArray3,
NumberArray4,
NumberArray6,
NumberArray8,
NumberArray9,
NumberArray12,
NumberArray16
} from '@math.gl/types';

export type {isTypedArray, isNumericArray} from '@math.gl/types';
export type {isTypedArray, isNumberArray, isNumericArray} from '@math.gl/types';

// classes
export {Vector2} from './classes/vector2';
Expand Down
4 changes: 3 additions & 1 deletion modules/core/src/lib/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
// SPDX-License-Identifier: MIT
// Copyright (c) vis.gl contributors

/* eslint-disable no-shadow */ // radians and degrees are common variable names

import type {NumericArray} from '@math.gl/types';

import type {MathArray} from '../classes/base/math-array';
Expand Down Expand Up @@ -301,7 +303,7 @@ function duplicateArray(array: NumericArray): NumericArray {
// otherwise applies func to the argument value
function map(
value: number | NumericArray,
func: (x: number, index?: number, result?: NumericArray) => number,
func: (x: number, index?: number, resultArray?: NumericArray) => number,
result?: NumericArray
): number | NumericArray {
if (isArray(value)) {
Expand Down
3 changes: 2 additions & 1 deletion modules/culling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
"src"
],
"dependencies": {
"@math.gl/core": "4.1.0-alpha.1"
"@math.gl/core": "4.1.0-alpha.1",
"@math.gl/types": "4.1.0-alpha.1"
},
"gitHead": "e1a95300cb225a90da6e90333d4adf290f7ba501"
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
// This file is derived from the Cesium math library under Apache 2 license
// See LICENSE.md and https://github.com/AnalyticalGraphicsInc/cesium/blob/master/LICENSE.md

import {Vector3, Matrix3, Matrix4, Quaternion, NumericArray} from '@math.gl/core';
import {NumericArray} from '@math.gl/types';
import {Vector3, Matrix3, Matrix4, Quaternion} from '@math.gl/core';
import type {BoundingVolume} from './bounding-volume';
import {BoundingSphere} from './bounding-sphere';
import type {Plane} from '../plane';
Expand Down
3 changes: 2 additions & 1 deletion modules/culling/src/lib/perspective-frustum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
// - It has not been fully adapted to math.gl conventions
// - Documentation has not been ported

import {assert, Matrix4, NumericArray, Vector2} from '@math.gl/core';
import {NumericArray} from '@math.gl/types';
import {assert, Matrix4, Vector2} from '@math.gl/core';
import {PerspectiveOffCenterFrustum} from './perspective-off-center-frustum';
import {CullingVolume} from './culling-volume';

Expand Down
3 changes: 2 additions & 1 deletion modules/geospatial/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"src"
],
"dependencies": {
"@math.gl/core": "4.1.0-alpha.1"
"@math.gl/core": "4.1.0-alpha.1",
"@math.gl/types": "4.1.0-alpha.1"
},
"gitHead": "e1a95300cb225a90da6e90333d4adf290f7ba501"
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
// SPDX-License-Identifier: MIT and Apache-2.0
// Copyright (c) vis.gl contributors

import {NumericArray, Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';
import {NumericArray} from '@math.gl/types';
import {Vector3, assert, equals as equalsEpsilon} from '@math.gl/core';

import type {Ellipsoid} from '../ellipsoid';

Expand Down
1 change: 1 addition & 0 deletions modules/web-mercator/src/web-mercator-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ export function addMetersToLngLat(lngLatZ: number[], xyz: number[]): number[] {
const [longitude, latitude, z0] = lngLatZ;
const [x, y, z] = xyz;

// eslint-disable-next-line no-shadow
const {unitsPerMeter, unitsPerMeter2} = getDistanceScales({
longitude,
latitude,
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"examples/*"
],
"scripts": {
"bootstrap": "yarn && ocular-bootstrap",
"bootstrap": "ocular-bootstrap",
"clean": "ocular-clean",
"build": "npm run clean && time ocular-build",
"cover": "ocular-test cover",
Expand All @@ -26,9 +26,10 @@
"@probe.gl/bench": "^4.0.0",
"@turf/destination": "^6.0.1",
"@types/tape-promise": "^4.0.1",
"ocular-dev-tools": "2.0.0-alpha.33",
"ocular-dev-tools": "2.0.0-alpha.34",
"pre-commit": "^1.2.2",
"puppeteer": "^22.0.0"
"puppeteer": "^22.0.0",
"tap-spec": "^5.0.0"
},
"resolutions": {
"typescript": "5.4.3"
Expand Down
Loading
Loading