From 55f0da2871021bdb2cd00eb68c9acc62fd9d35d7 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Thu, 27 Nov 2025 21:41:11 +0200 Subject: [PATCH 1/9] chore: new code/esse + remove math re-exporting --- dist/js/abstract/array_with_ids.d.ts | 43 -- dist/js/abstract/array_with_ids.js | 88 --- dist/js/abstract/scalar_with_id.d.ts | 25 - dist/js/abstract/scalar_with_id.js | 44 -- dist/js/basis/basis.js | 17 +- dist/js/basis/coordinates.js | 7 +- dist/js/basis/types.d.ts | 1 - dist/js/basis/types.js | 2 - dist/js/cell/primitive_cell.js | 37 +- dist/js/lattice/lattice.js | 47 +- dist/js/lattice/lattice_bravais.d.ts | 59 -- dist/js/lattice/lattice_bravais.js | 118 ---- dist/js/lattice/lattice_vectors.d.ts | 46 -- dist/js/lattice/lattice_vectors.js | 98 --- .../lattice/reciprocal/lattice_reciprocal.js | 32 +- dist/js/lattice/types.d.ts | 49 -- dist/js/lattice/types.js | 127 ---- dist/js/made.d.ts | 458 ------------ dist/js/made.js | 2 - dist/js/material.d.ts | 3 +- dist/js/materialMixin.d.ts | 6 +- dist/js/math.d.ts | 459 ------------ dist/js/math.js | 7 - dist/js/parsers/poscar.js | 4 +- dist/js/parsers/xyz_combinatorial_basis.js | 7 +- dist/js/tools/basis.js | 9 +- dist/js/tools/cell.js | 9 +- dist/js/tools/supercell.js | 6 +- dist/js/tools/surface.js | 24 +- dist/js/types.d.ts | 1 - dist/js/types.js | 2 - dist/js/types/index.d.ts | 1 - dist/js/types/index.js | 17 - dist/js/types/material.d.ts | 18 - dist/js/types/material.js | 2 - package-lock.json | 654 +++++++++++++++--- package.json | 4 +- src/js/basis/basis.ts | 2 +- src/js/basis/coordinates.ts | 3 +- src/js/cell/primitive_cell.ts | 3 +- src/js/lattice/lattice.ts | 2 +- .../lattice/reciprocal/lattice_reciprocal.ts | 2 +- src/js/made.ts | 2 - src/js/material.ts | 7 +- src/js/materialMixin.ts | 4 +- src/js/math.ts | 6 - src/js/parsers/poscar.ts | 2 +- src/js/parsers/xyz_combinatorial_basis.ts | 2 +- src/js/tools/basis.ts | 2 +- src/js/tools/cell.ts | 2 +- src/js/tools/supercell.ts | 2 +- src/js/tools/surface.ts | 2 +- 52 files changed, 660 insertions(+), 1916 deletions(-) delete mode 100644 dist/js/abstract/array_with_ids.d.ts delete mode 100644 dist/js/abstract/array_with_ids.js delete mode 100644 dist/js/abstract/scalar_with_id.d.ts delete mode 100644 dist/js/abstract/scalar_with_id.js delete mode 100644 dist/js/basis/types.d.ts delete mode 100644 dist/js/basis/types.js delete mode 100644 dist/js/lattice/lattice_bravais.d.ts delete mode 100644 dist/js/lattice/lattice_bravais.js delete mode 100644 dist/js/lattice/lattice_vectors.d.ts delete mode 100644 dist/js/lattice/lattice_vectors.js delete mode 100644 dist/js/lattice/types.d.ts delete mode 100644 dist/js/lattice/types.js delete mode 100644 dist/js/math.d.ts delete mode 100644 dist/js/math.js delete mode 100644 dist/js/types.d.ts delete mode 100644 dist/js/types.js delete mode 100644 dist/js/types/index.d.ts delete mode 100644 dist/js/types/index.js delete mode 100644 dist/js/types/material.d.ts delete mode 100644 dist/js/types/material.js delete mode 100644 src/js/math.ts diff --git a/dist/js/abstract/array_with_ids.d.ts b/dist/js/abstract/array_with_ids.d.ts deleted file mode 100644 index 6226720fd..000000000 --- a/dist/js/abstract/array_with_ids.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ObjectWithIdAndValue, ValueOrObject } from "./scalar_with_id"; -type Predicate = (o: T) => boolean; -type MapFunction = (value: T, index: number, array: T[]) => T; -export declare function isArrayOfObjectsWithIdAndValue(valueOrObjects: ValueOrObject[]): valueOrObjects is ObjectWithIdAndValue[]; -/** - * Helper class representing an ArrayWithIds. Used to explicitly track values assigned to atoms, for example. - */ -export declare class ArrayWithIds { - array: T[]; - /** - * Create a an array with ids. - * @param {Array} array - Either regular array or ArrayWithIds (see @example above) - */ - constructor(array?: ObjectWithIdAndValue[] | T[]); - /** - * Serialize class instance to JSON. - * @example [{"id" : 0, "value" : "Si" }, {"id" : 1, "value" : "Si" }] - */ - toJSON(): ObjectWithIdAndValue[]; - /** - * Apply function fn to each element of the array and replace `array` with the result. - * @param fn - The function to be applied to each array element. - */ - mapArrayInPlace(fn: MapFunction): void; - getArrayElementByIndex(idx: number): T; - /** - * Get the index of the array element that passes the predicate. - * @param {Function} predicate - The function to be applied to each array element. - */ - getArrayIndexByPredicate(predicate: Predicate): number; - /** - * Add an entity to array. - * @param el - The entity to be added to array. If Object with 'value' key, its value will be added. - */ - addElement(el: ValueOrObject): void; - /** - * Remove an entity to array. Either by passing the entity, or the corresponding index. - * @param el - The entity to be added to array. If Object with 'value' key, its value will be added. - * @param idx - The entity to be added to array. If Object with 'value' key, its value will be added. - */ - removeElement(el: ValueOrObject | null, idx?: number): void; -} -export {}; diff --git a/dist/js/abstract/array_with_ids.js b/dist/js/abstract/array_with_ids.js deleted file mode 100644 index 21c45a5be..000000000 --- a/dist/js/abstract/array_with_ids.js +++ /dev/null @@ -1,88 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ArrayWithIds = exports.isArrayOfObjectsWithIdAndValue = void 0; -const underscore_1 = __importDefault(require("underscore")); -const scalar_with_id_1 = require("./scalar_with_id"); -function isArrayOfObjectsWithIdAndValue(valueOrObjects) { - return (0, scalar_with_id_1.isObjectWithIdAndValue)(valueOrObjects[0]); -} -exports.isArrayOfObjectsWithIdAndValue = isArrayOfObjectsWithIdAndValue; -/** - * Helper class representing an ArrayWithIds. Used to explicitly track values assigned to atoms, for example. - */ -class ArrayWithIds { - /** - * Create a an array with ids. - * @param {Array} array - Either regular array or ArrayWithIds (see @example above) - */ - constructor(array = []) { - if (!underscore_1.default.isArray(array)) { - throw new Error("ArrayWithIds.constructor: pass array on initialization"); - } - // if passed an array with ids as config, only store the values in array - if (isArrayOfObjectsWithIdAndValue(array)) { - this.array = array.sort((a, b) => a.id - b.id).map((element) => element.value); - } - else { - this.array = [...array]; - } - } - /** - * Serialize class instance to JSON. - * @example [{"id" : 0, "value" : "Si" }, {"id" : 1, "value" : "Si" }] - */ - toJSON() { - // from ["a", "b"] to [{id: 0, value: "a"}, {id: 1, value: "b"}] - return this.array.map((el, idx) => new scalar_with_id_1.ScalarWithId(el, idx).toJSON()); - } - /** - * Apply function fn to each element of the array and replace `array` with the result. - * @param fn - The function to be applied to each array element. - */ - mapArrayInPlace(fn) { - if (!underscore_1.default.isFunction(fn)) { - throw new Error("ArrayWithIds.mapArray: must pass function as argument"); - } - this.array = this.array.map(fn); - } - getArrayElementByIndex(idx) { - return this.array[idx]; - } - /** - * Get the index of the array element that passes the predicate. - * @param {Function} predicate - The function to be applied to each array element. - */ - getArrayIndexByPredicate(predicate) { - return this.array.findIndex((el) => predicate(el)); - } - /** - * Add an entity to array. - * @param el - The entity to be added to array. If Object with 'value' key, its value will be added. - */ - addElement(el) { - const value = (0, scalar_with_id_1.isObjectWithIdAndValue)(el) ? el.value : el; - if (el) - this.array.push(value); - } - /** - * Remove an entity to array. Either by passing the entity, or the corresponding index. - * @param el - The entity to be added to array. If Object with 'value' key, its value will be added. - * @param idx - The entity to be added to array. If Object with 'value' key, its value will be added. - */ - removeElement(el, idx) { - let _idx; - if (idx === undefined) { - _idx = this.array.findIndex((elm) => elm === el); - } - else { - _idx = idx; - } - if (_idx !== undefined) { - this.array.splice(_idx, 1); - } - } -} -exports.ArrayWithIds = ArrayWithIds; diff --git a/dist/js/abstract/scalar_with_id.d.ts b/dist/js/abstract/scalar_with_id.d.ts deleted file mode 100644 index a6351958a..000000000 --- a/dist/js/abstract/scalar_with_id.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -export interface ObjectWithIdAndValue { - id: number; - value: T; -} -export type ValueOrObject = ObjectWithIdAndValue | T; -export type ValueOrObjectArray = ObjectWithIdAndValue[] | T[]; -export declare function isObjectWithIdAndValue(valueOrObject: ValueOrObject): valueOrObject is ObjectWithIdAndValue; -/** - * Helper class representing a scalar with an associated id. - */ -export declare class ScalarWithId { - id: number; - value: T; - /** - * Create a an array with ids. - * @param valueOrObject - a ScalarWithID, or any other type. - * @param id - numerical id (Integer). - */ - constructor(valueOrObject: ValueOrObject, id?: number); - /** - * Serialize class instance to JSON. - * @example {"id" : 0, "value" : "Si" } - */ - toJSON(): ObjectWithIdAndValue; -} diff --git a/dist/js/abstract/scalar_with_id.js b/dist/js/abstract/scalar_with_id.js deleted file mode 100644 index 2d33d3517..000000000 --- a/dist/js/abstract/scalar_with_id.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.ScalarWithId = exports.isObjectWithIdAndValue = void 0; -const underscore_1 = __importDefault(require("underscore")); -function isObjectWithIdAndValue(valueOrObject) { - return Boolean(underscore_1.default.isObject(valueOrObject) && !underscore_1.default.isArray(valueOrObject) && valueOrObject.value); -} -exports.isObjectWithIdAndValue = isObjectWithIdAndValue; -/** - * Helper class representing a scalar with an associated id. - */ -class ScalarWithId { - /** - * Create a an array with ids. - * @param valueOrObject - a ScalarWithID, or any other type. - * @param id - numerical id (Integer). - */ - constructor(valueOrObject, id = 0) { - // if already passing a ScalarWithId => preserve original - if (isObjectWithIdAndValue(valueOrObject)) { - // NOTE - Arrays are Objects too - this.id = valueOrObject.id; - this.value = valueOrObject.value; - } - else { - this.id = id; - this.value = valueOrObject; - } - } - /** - * Serialize class instance to JSON. - * @example {"id" : 0, "value" : "Si" } - */ - toJSON() { - return { - id: this.id, - value: this.value, - }; - } -} -exports.ScalarWithId = ScalarWithId; diff --git a/dist/js/basis/basis.js b/dist/js/basis/basis.js index f45a7f1c9..b01e084cc 100644 --- a/dist/js/basis/basis.js +++ b/dist/js/basis/basis.js @@ -1,7 +1,4 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Basis = void 0; // @ts-ignore @@ -11,7 +8,7 @@ const lodash_1 = require("lodash"); const cell_1 = require("../cell/cell"); const constants_1 = require("../constants"); const lattice_1 = require("../lattice/lattice"); -const math_1 = __importDefault(require("../math")); +const math_1 = require("@mat3ra/code/dist/js/math"); const coordinates_1 = require("./coordinates"); const elements_1 = require("./elements"); const labels_1 = require("./labels"); @@ -166,7 +163,7 @@ class Basis extends entity_1.InMemoryEntity { } toStandardRepresentation() { this.toCrystal(); - this._coordinates.mapArrayInPlace((point) => point.map((x) => math_1.default.mod(x))); + this._coordinates.mapArrayInPlace((point) => point.map((x) => math_1.math.mod(x))); } /** A representation where all coordinates are within 0 and 1 in crystal units */ get standardRepresentation() { @@ -240,7 +237,7 @@ class Basis extends entity_1.InMemoryEntity { get formula() { const counts = this.uniqueElementCountsSortedByElectronegativity; const countsValues = (0, lodash_1.values)(counts); - const gcd = countsValues.length > 1 ? math_1.default.gcd(...countsValues) : countsValues[0]; + const gcd = countsValues.length > 1 ? math_1.math.gcd(...countsValues) : countsValues[0]; return (0, lodash_1.toPairs)(counts) .map(([element, count]) => element + (count / gcd === 1 ? "" : count / gcd)) .reduce((acc, part) => acc + part, ""); @@ -293,7 +290,7 @@ class Basis extends entity_1.InMemoryEntity { const element = entry[0]; const coordinate = entry[1]; const atomicLabel = entry[2]; - const toleratedCoordinate = coordinate.map((x) => math_1.default.round(x, constants_1.HASH_TOLERANCE)); + const toleratedCoordinate = coordinate.map((x) => math_1.math.round(x, constants_1.HASH_TOLERANCE)); return `${element}${atomicLabel} ${toleratedCoordinate.join()}`; }); return `${standardRep.sort().join(";")};`; @@ -364,7 +361,7 @@ class Basis extends entity_1.InMemoryEntity { hasEquivalentCellTo(anotherBasisClsInstance) { return !this.cell.vectorArrays .map((vector, idx) => { - return math_1.default.vEqualWithTolerance(vector, anotherBasisClsInstance.cell.vectorArrays[idx]); + return math_1.math.vEqualWithTolerance(vector, anotherBasisClsInstance.cell.vectorArrays[idx]); }) .some((x) => !x); } @@ -401,7 +398,7 @@ class Basis extends entity_1.InMemoryEntity { const tolerance = overlapCoefficient * ((0, periodic_table_js_1.getElementAtomicRadius)(el1) + (0, periodic_table_js_1.getElementAtomicRadius)(el2)); // in angstroms // @ts-ignore - const distance = math_1.default.vDist(entry1.value, entry2.value); + const distance = math_1.math.vDist(entry1.value, entry2.value); if (distance < tolerance) { overlaps.push({ id1: i, @@ -437,7 +434,7 @@ class Basis extends entity_1.InMemoryEntity { if (this._elements.values.length >= 2) { for (let i = 0; i < this._elements.values.length; i++) { for (let j = i + 1; j < this._elements.values.length; j++) { - const distance = math_1.default.vDist(this._coordinates.getElementValueByIndex(i), this._coordinates.getElementValueByIndex(j)); + const distance = math_1.math.vDist(this._coordinates.getElementValueByIndex(i), this._coordinates.getElementValueByIndex(j)); if (distance && distance > maxDistance) { maxDistance = distance; } diff --git a/dist/js/basis/coordinates.js b/dist/js/basis/coordinates.js index bd9e8b87a..d0b9f1938 100644 --- a/dist/js/basis/coordinates.js +++ b/dist/js/basis/coordinates.js @@ -1,12 +1,9 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Coordinates = exports.Coordinate = void 0; const code_1 = require("@mat3ra/code"); +const math_1 = require("@mat3ra/code/dist/js/math"); const underscore_string_1 = require("underscore.string"); -const math_1 = __importDefault(require("../math")); class Coordinate extends code_1.RoundedValueWithId { constructor({ value, id }) { super(id, value); @@ -61,7 +58,7 @@ class Coordinates extends code_1.RoundedArrayWithIds { }); } getCenterPoint() { - const transposed = math_1.default.transpose(this.values); + const transposed = math_1.math.transpose(this.values); const center = [0, 0, 0]; for (let i = 0; i < 3; i++) { const axisCoords = transposed[i]; diff --git a/dist/js/basis/types.d.ts b/dist/js/basis/types.d.ts deleted file mode 100644 index 6b9c597ac..000000000 --- a/dist/js/basis/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type Coordinate = number[]; diff --git a/dist/js/basis/types.js b/dist/js/basis/types.js deleted file mode 100644 index c8ad2e549..000000000 --- a/dist/js/basis/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/js/cell/primitive_cell.js b/dist/js/cell/primitive_cell.js index 5d6e8e2c3..ebda53e28 100644 --- a/dist/js/cell/primitive_cell.js +++ b/dist/js/cell/primitive_cell.js @@ -1,10 +1,7 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.getPrimitiveLatticeVectorsFromConfig = void 0; -const math_1 = __importDefault(require("../math")); +const math_1 = require("@mat3ra/code/dist/js/math"); /** * Routines for calculating primitive cell vectors from conventional cell Bravais parameters. * Following Setyawan, W., & Curtarolo, S. (2010). doi:10.1016/j.commatsci.2010.05.010 @@ -75,39 +72,39 @@ const PRIMITIVE_CELLS = { }, HEX: ({ a, c }) => { return [ - [a / 2, (-a * math_1.default.sqrt(3)) / 2, 0], - [a / 2, (a * math_1.default.sqrt(3)) / 2, 0], + [a / 2, (-a * math_1.math.sqrt(3)) / 2, 0], + [a / 2, (a * math_1.math.sqrt(3)) / 2, 0], [0, 0, c], ]; }, RHL: ({ a, alpha }) => { - const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI); - const cosHalfAlpha = math_1.default.sqrt((1 / 2) * (1 + cosAlpha)); - const sinHalfAlpha = math_1.default.sqrt((1 / 2) * (1 - cosAlpha)); + const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI); + const cosHalfAlpha = math_1.math.sqrt((1 / 2) * (1 + cosAlpha)); + const sinHalfAlpha = math_1.math.sqrt((1 / 2) * (1 - cosAlpha)); return [ [a * cosHalfAlpha, -a * sinHalfAlpha, 0.0], [a * cosHalfAlpha, a * sinHalfAlpha, 0.0], [ (a * cosAlpha) / cosHalfAlpha, 0.0, - a * math_1.default.sqrt(1 - (cosAlpha * cosAlpha) / (cosHalfAlpha * cosHalfAlpha)), + a * math_1.math.sqrt(1 - (cosAlpha * cosAlpha) / (cosHalfAlpha * cosHalfAlpha)), ], ]; }, MCL: ({ a, b, c, alpha }) => { - const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI); + const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI); return [ [a, 0, 0], [0, b, 0], - [0, c * cosAlpha, c * math_1.default.sqrt(1 - cosAlpha * cosAlpha)], + [0, c * cosAlpha, c * math_1.math.sqrt(1 - cosAlpha * cosAlpha)], ]; }, MCLC: ({ a, b, c, alpha }) => { - const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI); + const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI); return [ [a / 2, b / 2, 0], [-a / 2, b / 2, 0], - [0, c * cosAlpha, c * math_1.default.sqrt(1 - cosAlpha * cosAlpha)], + [0, c * cosAlpha, c * math_1.math.sqrt(1 - cosAlpha * cosAlpha)], ]; }, // Algorithm from http://pymatgen.org/_modules/pymatgen/core/lattice.html (from_params) @@ -116,9 +113,9 @@ const PRIMITIVE_CELLS = { // eslint-disable-next-line no-param-reassign [alpha, beta, gamma] = [alpha, beta, gamma].map( // @ts-ignore - (x) => math_1.default.unit(x, "degree").to("rad").value); - const [cosAlpha, cosBeta, cosGamma] = [alpha, beta, gamma].map((x) => math_1.default.cos(x)); - const [sinAlpha, sinBeta] = [alpha, beta].map((x) => math_1.default.sin(x)); + (x) => math_1.math.unit(x, "degree").to("rad").value); + const [cosAlpha, cosBeta, cosGamma] = [alpha, beta, gamma].map((x) => math_1.math.cos(x)); + const [sinAlpha, sinBeta] = [alpha, beta].map((x) => math_1.math.sin(x)); let acosArg = (cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta); if (acosArg < -1) { acosArg = -1; @@ -126,9 +123,9 @@ const PRIMITIVE_CELLS = { else if (acosArg > 1) { acosArg = 1; } - const gammaStar = math_1.default.acos(acosArg); - const cosGammaStar = math_1.default.cos(gammaStar); - const sinGammaStar = math_1.default.sin(gammaStar); + const gammaStar = math_1.math.acos(acosArg); + const cosGammaStar = math_1.math.cos(gammaStar); + const sinGammaStar = math_1.math.sin(gammaStar); return [ [a * sinBeta, 0.0, a * cosBeta], [-b * sinAlpha * cosGammaStar, b * sinAlpha * sinGammaStar, b * cosAlpha], diff --git a/dist/js/lattice/lattice.js b/dist/js/lattice/lattice.js index b32742ef5..da86b14d3 100644 --- a/dist/js/lattice/lattice.js +++ b/dist/js/lattice/lattice.js @@ -22,17 +22,14 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.Lattice = exports.LatticeVectors = exports.nonPeriodicLatticeScalingFactor = void 0; const constants_1 = require("@mat3ra/code/dist/js/constants"); const entity_1 = require("@mat3ra/code/dist/js/entity"); +const math_1 = require("@mat3ra/code/dist/js/math"); const lodash = __importStar(require("lodash")); const cell_1 = require("../cell/cell"); const primitive_cell_1 = require("../cell/primitive_cell"); -const math_1 = __importDefault(require("../math")); const lattice_types_1 = require("./lattice_types"); const unit_cell_1 = require("./unit_cell"); /** @@ -69,17 +66,17 @@ class Lattice extends entity_1.InMemoryEntity { const { a } = this; const { b } = this; const { c } = this; - const alphaRad = math_1.default.unit(this.alpha, "deg").toNumber("rad"); - const betaRad = math_1.default.unit(this.beta, "deg").toNumber("rad"); - const gammaRad = math_1.default.unit(this.gamma, "deg").toNumber("rad"); - const cosAlpha = math_1.default.cos(alphaRad); - const cosBeta = math_1.default.cos(betaRad); - const cosGamma = math_1.default.cos(gammaRad); - const sinAlpha = math_1.default.sin(alphaRad); - const sinBeta = math_1.default.sin(betaRad); - const gammaStar = math_1.default.acos((cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta)); - const cosGammaStar = math_1.default.cos(gammaStar); - const sinGammaStar = math_1.default.sin(gammaStar); + const alphaRad = math_1.math.unit(this.alpha, "deg").toNumber("rad"); + const betaRad = math_1.math.unit(this.beta, "deg").toNumber("rad"); + const gammaRad = math_1.math.unit(this.gamma, "deg").toNumber("rad"); + const cosAlpha = math_1.math.cos(alphaRad); + const cosBeta = math_1.math.cos(betaRad); + const cosGamma = math_1.math.cos(gammaRad); + const sinAlpha = math_1.math.sin(alphaRad); + const sinBeta = math_1.math.sin(betaRad); + const gammaStar = math_1.math.acos((cosAlpha * cosBeta - cosGamma) / (sinAlpha * sinBeta)); + const cosGammaStar = math_1.math.cos(gammaStar); + const sinGammaStar = math_1.math.sin(gammaStar); const vectorA = [a * sinBeta, 0.0, a * cosBeta]; const vectorB = [ -b * sinAlpha * cosGammaStar, @@ -94,12 +91,12 @@ class Lattice extends entity_1.InMemoryEntity { } static fromVectorsArray(vectors, units = Lattice.defaultConfig.units, type = "TRI") { const [aVec, bVec, cVec] = vectors; - const a = math_1.default.vlen(aVec); - const b = math_1.default.vlen(bVec); - const c = math_1.default.vlen(cVec); - const alpha = math_1.default.angle(bVec, cVec, "deg"); - const beta = math_1.default.angle(aVec, cVec, "deg"); - const gamma = math_1.default.angle(aVec, bVec, "deg"); + const a = math_1.math.vlen(aVec); + const b = math_1.math.vlen(bVec); + const c = math_1.math.vlen(cVec); + const alpha = math_1.math.angle(bVec, cVec, "deg"); + const beta = math_1.math.angle(aVec, cVec, "deg"); + const gamma = math_1.math.angle(aVec, bVec, "deg"); return new Lattice({ a, b, @@ -144,7 +141,7 @@ class Lattice extends entity_1.InMemoryEntity { */ get typeExtended() { const { a, b, c, alpha, beta, gamma, type } = this; - const cosAlpha = math_1.default.cos((alpha / 180) * math_1.default.PI); + const cosAlpha = math_1.math.cos((alpha / 180) * math_1.math.PI); switch (type) { case "BCT": return c < a ? "BCT-1" : "BCT-2"; @@ -179,14 +176,14 @@ class Lattice extends entity_1.InMemoryEntity { * Calculate the volume of the lattice cell. */ get volume() { - return math_1.default.abs(math_1.default.det(this.vectorArrays)); + return math_1.math.abs(math_1.math.det(this.vectorArrays)); } /* * Returns a "default" primitive lattice by type, with lattice parameters scaled by the length of "a", * @param latticeConfig {Object} LatticeBravais config (see constructor) */ static getDefaultPrimitiveLatticeConfigByType(latticeConfig) { - const f_ = math_1.default.roundArrayOrNumber; + const f_ = math_1.math.roundArrayOrNumber; // construct new primitive cell using lattice parameters and skip rounding the vectors const vectors = (0, primitive_cell_1.getPrimitiveLatticeVectorsFromConfig)(latticeConfig); // create new lattice from primitive cell @@ -224,7 +221,7 @@ class Lattice extends entity_1.InMemoryEntity { scaledLattice.beta, scaledLattice.gamma, ] - .map((x) => math_1.default.round(x, constants_1.HASH_TOLERANCE)) + .map((x) => math_1.math.round(x, constants_1.HASH_TOLERANCE)) .join(";")};`; } /** diff --git a/dist/js/lattice/lattice_bravais.d.ts b/dist/js/lattice/lattice_bravais.d.ts deleted file mode 100644 index 8b28fc43d..000000000 --- a/dist/js/lattice/lattice_bravais.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { LatticeImplicitSchema, LatticeTypeSchema } from "@mat3ra/esse/dist/js/types"; -import { Vector, VectorsAsArray } from "./types"; -export type Units = Required["units"]; -export interface FromVectorsProps { - a: Vector; - b: Vector; - c: Vector; - alat?: number; - units?: Units["length"]; - type?: LatticeTypeSchema; - skipRounding?: boolean; -} -export declare class LatticeBravais implements LatticeImplicitSchema { - a: number; - b: number; - c: number; - alpha: number; - beta: number; - gamma: number; - units: Units; - type: LatticeImplicitSchema["type"]; - /** - * Create a Bravais lattice. - */ - constructor(config: Partial); - static _roundValue(x: number): number; - /** - * Create a Bravais lattice from vectors. - */ - static fromVectors({ a, b, c, alat, units, type, skipRounding, }: FromVectorsProps): LatticeBravais; - /** - * See fromVectors above. - */ - static fromVectorArrays(array: VectorsAsArray, type: LatticeTypeSchema, skipRounding?: boolean): LatticeBravais; - /** - * Get the list of editable keys (eg. 'a', 'alpha') for the current lattice. - * @return {Object} - * @example {a: true, b: false, c: false, alpha: true, beta: false, gamma: false} - */ - get editables(): {}; - /** - * Serialize class instance to JSON. - * @example As below: - { - "a" : 3.867, - "b" : 3.867, - "c" : 3.867, - "alpha" : 60, - "beta" : 60, - "gamma" : 60, - "units" : { - "length" : "angstrom", - "angle" : "degree" - }, - "type" : "FCC" - } - */ - toJSON(): LatticeImplicitSchema; -} diff --git a/dist/js/lattice/lattice_bravais.js b/dist/js/lattice/lattice_bravais.js deleted file mode 100644 index a3a80cc98..000000000 --- a/dist/js/lattice/lattice_bravais.js +++ /dev/null @@ -1,118 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LatticeBravais = void 0; -const constants_1 = __importDefault(require("../constants")); -const math_1 = __importDefault(require("../math")); -const types_1 = require("./types"); -/* - * @summary: class that holds parameters of a Bravais Lattice: a, b, c, alpha, beta, gamma + corresponding units. - * When stored as class variables units for lengths are always "angstrom"s, angle - "degree"s - */ -class LatticeBravais { - /** - * Create a Bravais lattice. - */ - constructor(config) { - const { a = 1, // default lattice is cubic with unity in edge sizes - b = a, c = a, alpha = 90, beta = alpha, gamma = alpha, - // if we do not know what lattice type this is => set to TRI - type = "TRI", units = { - length: "angstrom", - angle: "degree", - }, } = config; - const k = constants_1.default.units.bohr === units.length ? constants_1.default.coefficients.BOHR_TO_ANGSTROM : 1; - this.a = a * k; - this.b = b * k; - this.c = c * k; - this.alpha = alpha; - this.beta = beta; - this.gamma = gamma; - this.type = type; - this.units = units; - } - static _roundValue(x) { - return math_1.default.precise(math_1.default.roundToZero(x)); - } - /** - * Create a Bravais lattice from vectors. - */ - static fromVectors({ a, b, c, alat = 1, units = "angstrom", type = "TRI", skipRounding = false, }) { - const roundValue = skipRounding ? (x) => x : this._roundValue; - const config = { - a: roundValue(math_1.default.vlen(a) * alat), - b: roundValue(math_1.default.vlen(b) * alat), - c: roundValue(math_1.default.vlen(c) * alat), - alpha: roundValue(math_1.default.angle(b, c, "deg")), - beta: roundValue(math_1.default.angle(a, c, "deg")), - gamma: roundValue(math_1.default.angle(a, b, "deg")), - // initially we do not know what lattice type this is => set to TRI - type, - units: { - length: units, - angle: "degree", - }, - }; - return new this.prototype.constructor(config); - } - /** - * See fromVectors above. - */ - static fromVectorArrays(array, type, skipRounding = true) { - return this.fromVectors({ - a: array[0], - b: array[1], - c: array[2], - type, - skipRounding, // do not round the values to avoid loosing precision by default - }); - } - /** - * Get the list of editable keys (eg. 'a', 'alpha') for the current lattice. - * @return {Object} - * @example {a: true, b: false, c: false, alpha: true, beta: false, gamma: false} - */ - get editables() { - var _a; - const object = {}; - const editablesList = (_a = types_1.LATTICE_TYPE_CONFIGS.find((entry) => entry.code === this.type)) === null || _a === void 0 ? void 0 : _a.editables; - // ["a", "gamma"] => {a: true, gamma: true} - if (editablesList) { - editablesList.forEach((element) => { - Object.assign(object, { - [element]: true, - }); - }); - } - return object; - } - /** - * Serialize class instance to JSON. - * @example As below: - { - "a" : 3.867, - "b" : 3.867, - "c" : 3.867, - "alpha" : 60, - "beta" : 60, - "gamma" : 60, - "units" : { - "length" : "angstrom", - "angle" : "degree" - }, - "type" : "FCC" - } - */ - toJSON() { - return { - ...this, - units: { - length: this.units.length, - angle: this.units.angle, - }, - }; - } -} -exports.LatticeBravais = LatticeBravais; diff --git a/dist/js/lattice/lattice_vectors.d.ts b/dist/js/lattice/lattice_vectors.d.ts deleted file mode 100644 index 6876cb63c..000000000 --- a/dist/js/lattice/lattice_vectors.d.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { LatticeExplicitUnit, LatticeImplicitSchema } from "@mat3ra/esse/dist/js/types"; -import { Vector } from "./types"; -type RequiredLatticeExplicitUnit = Required; -export interface BravaisConfigProps extends Partial { - isConventional?: boolean; -} -export declare class LatticeVectors implements RequiredLatticeExplicitUnit { - a: RequiredLatticeExplicitUnit["a"]; - b: RequiredLatticeExplicitUnit["b"]; - c: RequiredLatticeExplicitUnit["c"]; - alat: RequiredLatticeExplicitUnit["alat"]; - units: RequiredLatticeExplicitUnit["units"]; - /** - * Create a Bravais lattice. - */ - constructor(config: LatticeExplicitUnit); - static _roundValue(arr: number[]): number[]; - static fromBravais({ a, // default lattice is cubic with unity in edge sizes - b, c, alpha, beta, gamma, units, type, isConventional, }: BravaisConfigProps): LatticeVectors; - get vectorArrays(): [Vector, Vector, Vector]; - /** - * Serialize class instance to JSON. - * @example As below: - { - "a" : [ - 3.34892, - 0, - 1.9335 - ], - "b" : [ - 1.116307, - 3.157392, - 1.9335 - ], - "c" : [ - 0, - 0, - 3.867 - ], - "alat" : 1, - "units" : "angstrom" - } - */ - toJSON(): RequiredLatticeExplicitUnit; -} -export {}; diff --git a/dist/js/lattice/lattice_vectors.js b/dist/js/lattice/lattice_vectors.js deleted file mode 100644 index d14a3e2c9..000000000 --- a/dist/js/lattice/lattice_vectors.js +++ /dev/null @@ -1,98 +0,0 @@ -"use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LatticeVectors = void 0; -const primitive_cell_1 = require("../cell/primitive_cell"); -const constants_1 = __importDefault(require("../constants")); -const math_1 = __importDefault(require("../math")); -/* - * @summary: class that holds parameters of a Bravais Lattice: a, b, c, alpha, beta, gamma + corresponding units. - * When stored as class variables units for lengths are always "angstrom"s, angle - "degree"s - */ -class LatticeVectors { - /** - * Create a Bravais lattice. - */ - constructor(config) { - const { a, b, c, alat = 1, units = "angstrom" } = config; - const k = constants_1.default.units.bohr === units ? constants_1.default.coefficients.BOHR_TO_ANGSTROM : 1; - this.a = a.map((x) => x * k); - this.b = b.map((x) => x * k); - this.c = c.map((x) => x * k); - this.alat = alat; - this.units = "angstrom"; - } - static _roundValue(arr) { - return arr.map((el) => math_1.default.precise(math_1.default.roundToZero(el))); - } - /* - * Constructs a Bravais lattice from lattice vectors - * Supports conventional lattice as parameters and primitive too. - * Algorithm from http://pymatgen.org/_modules/pymatgen/core/lattice.html (from_params) - * For parameters see `LatticeBravais.constructor`. - */ - static fromBravais({ a = 1, // default lattice is cubic with unity in edge sizes - b = a, c = a, alpha = 90, beta = 90, gamma = 90, units = { - length: "angstrom", - angle: "degree", - }, type = "TRI", isConventional = false, }) { - // use "direct" lattice constructor for primitive lattice - // eslint-disable-next-line no-param-reassign - if (!isConventional) - type = "TRI"; - // set precision and remove JS floating point artifacts - const [vectorA, vectorB, vectorC] = (0, primitive_cell_1.primitiveCell)({ - a, - b, - c, - alpha, - beta, - gamma, - units, - type, - }); - return new LatticeVectors({ - a: vectorA, - b: vectorB, - c: vectorC, - alat: 1, - }); - } - get vectorArrays() { - return [this.a, this.b, this.c]; - } - /** - * Serialize class instance to JSON. - * @example As below: - { - "a" : [ - 3.34892, - 0, - 1.9335 - ], - "b" : [ - 1.116307, - 3.157392, - 1.9335 - ], - "c" : [ - 0, - 0, - 3.867 - ], - "alat" : 1, - "units" : "angstrom" - } - */ - toJSON() { - return { - ...this, - a: LatticeVectors._roundValue(this.a), - b: LatticeVectors._roundValue(this.b), - c: LatticeVectors._roundValue(this.c), - }; - } -} -exports.LatticeVectors = LatticeVectors; diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.js b/dist/js/lattice/reciprocal/lattice_reciprocal.js index 21f90c7a2..6cafd5eec 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.js +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.js @@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) { Object.defineProperty(exports, "__esModule", { value: true }); exports.ReciprocalLattice = void 0; const constants_1 = require("@mat3ra/code/dist/js/constants"); +const math_1 = require("@mat3ra/code/dist/js/math"); const lodash_1 = __importDefault(require("lodash")); -const math_1 = __importDefault(require("../../math")); const lattice_1 = require("../lattice"); const paths_1 = require("./paths"); const symmetry_points_1 = require("./symmetry_points"); @@ -17,12 +17,12 @@ class ReciprocalLattice extends lattice_1.Lattice { */ get reciprocalVectors() { const vectors_ = this.vectors.vectorArrays; - const a = math_1.default.vlen(vectors_[0]); - const divider = math_1.default.multiply(vectors_[0], math_1.default.cross(vectors_[1], vectors_[2])) / a; + const a = math_1.math.vlen(vectors_[0]); + const divider = math_1.math.multiply(vectors_[0], math_1.math.cross(vectors_[1], vectors_[2])) / a; return [ - math_1.default.multiply(math_1.default.cross(vectors_[1], vectors_[2]), 1 / divider), - math_1.default.multiply(math_1.default.cross(vectors_[2], vectors_[0]), 1 / divider), - math_1.default.multiply(math_1.default.cross(vectors_[0], vectors_[1]), 1 / divider), + math_1.math.multiply(math_1.math.cross(vectors_[1], vectors_[2]), 1 / divider), + math_1.math.multiply(math_1.math.cross(vectors_[2], vectors_[0]), 1 / divider), + math_1.math.multiply(math_1.math.cross(vectors_[0], vectors_[1]), 1 / divider), ]; } /** @@ -30,7 +30,7 @@ class ReciprocalLattice extends lattice_1.Lattice { * @return {number[]} */ get reciprocalVectorNorms() { - return this.reciprocalVectors.map((vec) => math_1.default.norm(vec)); + return this.reciprocalVectors.map((vec) => math_1.math.norm(vec)); } /** * Ratio of reciprocal vector norms scaled by the inverse of the largest component. @@ -38,7 +38,7 @@ class ReciprocalLattice extends lattice_1.Lattice { */ get reciprocalVectorRatios() { const norms = this.reciprocalVectorNorms; - const maxNorm = math_1.default.max(...norms); + const maxNorm = math_1.math.max(...norms); return norms.map((n) => n / maxNorm); } /** @@ -47,7 +47,7 @@ class ReciprocalLattice extends lattice_1.Lattice { * @return {KPointCoordinates} */ getCartesianCoordinates(point) { - return math_1.default.multiply(point, this.reciprocalVectors); + return math_1.math.multiply(point, this.reciprocalVectors); } /** * Get the list of high-symmetry points for the current lattice. @@ -74,7 +74,7 @@ class ReciprocalLattice extends lattice_1.Lattice { const symmPoints = this.symmetryPoints; dataPoints.forEach((point, index) => { const symmPoint = symmPoints.find((x) => { - return math_1.default.vEqualWithTolerance(x.coordinates, point, 1e-4); + return math_1.math.vEqualWithTolerance(x.coordinates, point, 1e-4); }); if (symmPoint) { kpointPath.push({ @@ -96,8 +96,8 @@ class ReciprocalLattice extends lattice_1.Lattice { calculateDimension(nPoints, index) { const norms = this.reciprocalVectorNorms; const [j, k] = [0, 1, 2].filter((i) => i !== index); // get indices of other two dimensions - const N = math_1.default.cbrt((nPoints * norms[index] ** 2) / (norms[j] * norms[k])); - return math_1.default.max(1, math_1.default.ceil(N)); + const N = math_1.math.cbrt((nPoints * norms[index] ** 2) / (norms[j] * norms[k])); + return math_1.math.max(1, math_1.math.ceil(N)); } /** * Calculate grid dimensions from total number of k-points. @@ -112,10 +112,10 @@ class ReciprocalLattice extends lattice_1.Lattice { const { a } = this; return { [constants_1.ATOMIC_COORD_UNITS.cartesian]: { - [constants_1.units.angstrom]: (2 * math_1.default.PI) / a, + [constants_1.units.angstrom]: (2 * math_1.math.PI) / a, }, [constants_1.units.angstrom]: { - [constants_1.ATOMIC_COORD_UNITS.cartesian]: a / (2 * math_1.default.PI), + [constants_1.ATOMIC_COORD_UNITS.cartesian]: a / (2 * math_1.math.PI), }, }; } @@ -130,7 +130,7 @@ class ReciprocalLattice extends lattice_1.Lattice { getDimensionsFromSpacing(spacing, units = constants_1.ATOMIC_COORD_UNITS.cartesian) { const factor = this.conversionTable[units][constants_1.ATOMIC_COORD_UNITS.cartesian] || 1; return this.reciprocalVectorNorms.map((norm) => { - return math_1.default.max(1, math_1.default.ceil(lodash_1.default.round(norm / (spacing * factor), 4))); + return math_1.math.max(1, math_1.math.ceil(lodash_1.default.round(norm / (spacing * factor), 4))); }); } /** @@ -143,7 +143,7 @@ class ReciprocalLattice extends lattice_1.Lattice { const factor = this.conversionTable[constants_1.ATOMIC_COORD_UNITS.cartesian][units] || 1; const norms = this.reciprocalVectorNorms; return (factor * - math_1.default.mean(dimensions.map((dim, i) => norms[i] / math_1.default.max(1, dim)))); + math_1.math.mean(dimensions.map((dim, i) => norms[i] / math_1.math.max(1, dim)))); } } exports.ReciprocalLattice = ReciprocalLattice; diff --git a/dist/js/lattice/types.d.ts b/dist/js/lattice/types.d.ts deleted file mode 100644 index 3fb8dbb55..000000000 --- a/dist/js/lattice/types.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ArrayOf3NumberElementsSchema, LatticeTypeSchema } from "@mat3ra/esse/dist/js/types"; -export declare const DEFAULT_LATTICE_UNITS: { - length: { - angstrom: string; - }; - angle: { - degree: string; - }; -}; -export declare enum LatticeTypeExtended { - BCC = "BCC", - BCT_1 = "BCT-1", - BCT_2 = "BCT-2", - CUB = "CUB", - FCC = "FCC", - HEX = "HEX", - MCL = "MCL", - MCLC_1 = "MCLC-1", - MCLC_2 = "MCLC-2", - MCLC_3 = "MCLC-3", - MCLC_4 = "MCLC-4", - MCLC_5 = "MCLC-5", - ORC = "ORC", - ORCC = "ORCC", - ORCF_1 = "ORCF-1", - ORCF_2 = "ORCF-2", - ORCF_3 = "ORCF-3", - ORCI = "ORCI", - RHL_1 = "RHL-1", - RHL_2 = "RHL-2", - TET = "TET", - TRI_1a = "TRI_1a", - TRI_2a = "TRI_2a", - TRI_1b = "TRI_1b" -} -export type Vector = ArrayOf3NumberElementsSchema; -export interface VectorsAsArray extends Array { - 0: Vector; - 1: Vector; - 2: Vector; -} -interface LatticeTypeConfig { - label: string; - code: LatticeTypeSchema; - editables: string[]; - editablesConventional: string[]; -} -export declare const LATTICE_TYPE_CONFIGS: LatticeTypeConfig[]; -export {}; diff --git a/dist/js/lattice/types.js b/dist/js/lattice/types.js deleted file mode 100644 index 5ed682bef..000000000 --- a/dist/js/lattice/types.js +++ /dev/null @@ -1,127 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.LATTICE_TYPE_CONFIGS = exports.LatticeTypeExtended = exports.DEFAULT_LATTICE_UNITS = void 0; -exports.DEFAULT_LATTICE_UNITS = { - // by default lattice vectors shall be measured in angstrom, angles - in degrees - length: { - angstrom: "angstrom", - }, - angle: { - degree: "degree", - }, -}; -var LatticeTypeExtended; -(function (LatticeTypeExtended) { - LatticeTypeExtended["BCC"] = "BCC"; - LatticeTypeExtended["BCT_1"] = "BCT-1"; - LatticeTypeExtended["BCT_2"] = "BCT-2"; - LatticeTypeExtended["CUB"] = "CUB"; - LatticeTypeExtended["FCC"] = "FCC"; - LatticeTypeExtended["HEX"] = "HEX"; - LatticeTypeExtended["MCL"] = "MCL"; - LatticeTypeExtended["MCLC_1"] = "MCLC-1"; - LatticeTypeExtended["MCLC_2"] = "MCLC-2"; - LatticeTypeExtended["MCLC_3"] = "MCLC-3"; - LatticeTypeExtended["MCLC_4"] = "MCLC-4"; - LatticeTypeExtended["MCLC_5"] = "MCLC-5"; - LatticeTypeExtended["ORC"] = "ORC"; - LatticeTypeExtended["ORCC"] = "ORCC"; - LatticeTypeExtended["ORCF_1"] = "ORCF-1"; - LatticeTypeExtended["ORCF_2"] = "ORCF-2"; - LatticeTypeExtended["ORCF_3"] = "ORCF-3"; - LatticeTypeExtended["ORCI"] = "ORCI"; - LatticeTypeExtended["RHL_1"] = "RHL-1"; - LatticeTypeExtended["RHL_2"] = "RHL-2"; - LatticeTypeExtended["TET"] = "TET"; - LatticeTypeExtended["TRI_1a"] = "TRI_1a"; - LatticeTypeExtended["TRI_2a"] = "TRI_2a"; - LatticeTypeExtended["TRI_1b"] = "TRI_1b"; -})(LatticeTypeExtended = exports.LatticeTypeExtended || (exports.LatticeTypeExtended = {})); -exports.LATTICE_TYPE_CONFIGS = [ - { - label: "Simple Cubic", - code: "CUB", - // editables for primitive cell => WARNING: not tested - editables: ["a"], - // editables for conventional cell, taken from the publication above - editablesConventional: ["a"], - }, - { - label: "Face-centered Cubic", - code: "FCC", - editables: ["a"], - editablesConventional: ["a"], - }, - { - label: "Body-centered Cubic", - code: "BCC", - editables: ["a"], - editablesConventional: ["a"], - }, - { - label: "Tetragonal", - code: "TET", - editables: ["a", "c"], - editablesConventional: ["a", "c"], - }, - { - label: "Body-centered Tetragonal", - code: "BCT", - editables: ["a"], - editablesConventional: ["a", "c"], - }, - { - label: "Orthorombic", - code: "ORC", - editables: ["a", "b", "c"], - editablesConventional: ["a", "b", "c"], - }, - { - label: "Orthorombic Face-centered", - code: "ORCF", - editables: ["a", "b", "c"], - editablesConventional: ["a", "b", "c"], - }, - { - label: "Orthorombic Body-centered", - code: "ORCI", - editables: ["a", "alpha", "gamma"], - editablesConventional: ["a", "b", "c"], - }, - { - label: "Orthorombic Base-centered", - code: "ORCC", - editables: ["a", "c", "alpha"], - editablesConventional: ["a", "b", "c"], - }, - { - label: "Hexagonal", - code: "HEX", - editables: ["a", "c"], - editablesConventional: ["a", "c"], - }, - { - label: "Rhombohedral", - code: "RHL", - editables: ["a", "alpha"], - editablesConventional: ["a", "alpha"], - }, - { - label: "Monoclinic", - code: "MCL", - editables: ["a", "b", "c", "alpha"], - editablesConventional: ["a", "b", "c", "alpha"], - }, - { - label: "Monoclinic Base-centered", - code: "MCLC", - editables: ["a", "c", "alpha", "gamma"], - editablesConventional: ["a", "b", "c", "alpha"], - }, - { - label: "Triclinic", - code: "TRI", - editables: ["a", "b", "c", "alpha", "beta", "gamma"], - editablesConventional: ["a", "b", "c", "alpha", "beta", "gamma"], - }, -]; diff --git a/dist/js/made.d.ts b/dist/js/made.d.ts index b9ca12acd..4093c0a78 100644 --- a/dist/js/made.d.ts +++ b/dist/js/made.d.ts @@ -32,464 +32,6 @@ export declare const Made: { crystal: string; cartesian: string; }; - math: { - PI: number; - trunc: (x: number) => number; - product: (v1: number[], v2: number[]) => number; - vlen: (v: number[]) => number; - angle: (a: number[], b: number[], unit: string) => number; - angleUpTo90: (a: number[], b: number[], unit: string) => number; - vDist: (v1: number[], v2: number[]) => number | undefined; - vEqualWithTolerance: (vec1: number[], vec2: number[], tolerance?: number | undefined) => boolean; - mod: (num: number, tolerance?: number | undefined) => number; - isBetweenZeroInclusiveAndOne: (number: number, tolerance?: number | undefined) => boolean; - cartesianProduct: (...arg: number[][]) => number[][]; - almostEqual: (a: number, b: number, tolerance?: number | undefined) => boolean; - combinations: (a: number, b: number, c: number) => number[][]; - combinationsFromIntervals: (arrA: number[], arrB: number[], arrC: number[]) => number[][]; - calculateSegmentsBetweenPoints3D: (point1: (string | number)[], point2: (string | number)[], n: string | number) => number[][]; - roundToZero: (n: number) => number; - precise: (x: number, n?: number | undefined) => number; - roundValueToNDecimals: (value: number, decimals?: number | undefined) => number; - numberToPrecision: typeof import("@mat3ra/code/dist/js/math").numberToPrecision; - roundCustom: (value: number, decimals?: number | undefined, method?: import("@mat3ra/code/dist/js/math").RoundingMethodEnum | undefined) => number; - RoundingMethod: typeof import("@mat3ra/code/dist/js/math").RoundingMethodEnum; - roundArrayOrNumber: (value: unknown, decimals?: number | undefined, method?: import("@mat3ra/code/dist/js/math").RoundingMethodEnum | undefined) => unknown; - e: number; - pi: number; - i: number; - Infinity: number; - LN2: number; - LN10: number; - LOG2E: number; - LOG10E: number; - NaN: number; - null: number; - phi: number; - SQRT1_2: number; - SQRT2: number; - tau: number; - uninitialized: any; - version: string; - expression: import("mathjs").MathNode; - json: import("mathjs").MathJsJson; - config: (options: import("mathjs").ConfigOptions) => import("mathjs").ConfigOptions; - typed: (name: string, signatures: Record any>) => (...args: any[]) => any; - bignumber(x?: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | null | undefined): import("mathjs").BigNumber; - boolean(x: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | null): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - chain(value?: any): import("mathjs").MathJsChain; - complex(arg?: string | import("mathjs").Complex | import("mathjs").PolarCoordinates | undefined): import("mathjs").Complex; - complex(arg?: import("mathjs").MathArray | import("mathjs").Matrix | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - complex(re: number, im: number): import("mathjs").Complex; - createUnit(name: string, definition?: string | import("mathjs").UnitDefinition | undefined, options?: import("mathjs").CreateUnitOptions | undefined): import("mathjs").Unit; - createUnit(units: Record, options?: import("mathjs").CreateUnitOptions | undefined): import("mathjs").Unit; - fraction(args: import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction; - fraction(numerator: string | number | import("mathjs").MathArray | import("mathjs").Matrix, denominator?: string | number | import("mathjs").MathArray | import("mathjs").Matrix | undefined): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction; - index(...ranges: any[]): import("mathjs").Index; - matrix(format?: "sparse" | "dense" | undefined): import("mathjs").Matrix; - matrix(data: import("mathjs").MathArray | import("mathjs").Matrix, format?: "sparse" | "dense" | undefined, dataType?: string | undefined): import("mathjs").Matrix; - number(value?: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit | null | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - number(unit: import("mathjs").Unit, valuelessUnit: string | import("mathjs").Unit): number; - sparse(data?: import("mathjs").MathArray | import("mathjs").Matrix | undefined, dataType?: string | undefined): import("mathjs").Matrix; - splitUnit(unit: import("mathjs").Unit, parts: import("mathjs").Unit[]): import("mathjs").Unit[]; - string(value: import("mathjs").MathType | null): string | import("mathjs").MathArray | import("mathjs").Matrix; - unit(unit: string): import("mathjs").Unit; - unit(value: number | import("mathjs").MathArray | import("mathjs").Matrix, unit: string): import("mathjs").Unit; - compile(expr: import("mathjs").MathExpression): import("mathjs").EvalFunction; - compile(exprs: import("mathjs").MathExpression[]): import("mathjs").EvalFunction[]; - eval(expr: import("mathjs").MathExpression | import("mathjs").MathExpression[], scope?: object | undefined): any; - help(search: () => any): import("mathjs").Help; - parse(expr: import("mathjs").MathExpression, options?: any): import("mathjs").MathNode; - parse(exprs: import("mathjs").MathExpression[], options?: any): import("mathjs").MathNode[]; - parser(): import("mathjs").Parser; - derivative(expr: string | import("mathjs").MathNode, variable: string | import("mathjs").MathNode, options?: { - simplify: boolean; - } | undefined): import("mathjs").MathNode; - lsolve(L: import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - lup(A?: import("mathjs").MathArray | import("mathjs").Matrix | undefined): { - L: import("mathjs").MathArray | import("mathjs").Matrix; - U: import("mathjs").MathArray | import("mathjs").Matrix; - P: number[]; - }; - lusolve(A: number | import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix, order?: number | undefined, threshold?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - qr(A: import("mathjs").MathArray | import("mathjs").Matrix): { - Q: import("mathjs").MathArray | import("mathjs").Matrix; - R: import("mathjs").MathArray | import("mathjs").Matrix; - }; - rationalize(expr: string | import("mathjs").MathNode, optional?: boolean | object | undefined, detailed?: true | undefined): { - expression: string | import("mathjs").MathNode; - variables: string[]; - coefficients: import("mathjs").MathType[]; - }; - rationalize(expr: string | import("mathjs").MathNode, optional?: boolean | object | undefined, detailed?: false | undefined): import("mathjs").MathNode; - simplify(expr: string | import("mathjs").MathNode, rules?: (string | { - l: string; - r: string; - } | ((node: import("mathjs").MathNode) => import("mathjs").MathNode))[] | undefined, scope?: object | undefined): import("mathjs").MathNode; - slu(A: import("mathjs").Matrix, order: number, threshold: number): object; - usolve(U: import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - abs(x: number): number; - abs(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - abs(x: import("mathjs").Fraction): import("mathjs").Fraction; - abs(x: import("mathjs").Complex): import("mathjs").Complex; - abs(x: import("mathjs").MathArray): import("mathjs").MathArray; - abs(x: import("mathjs").Matrix): import("mathjs").Matrix; - abs(x: import("mathjs").Unit): import("mathjs").Unit; - add(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - cbrt(x: number, allRoots?: boolean | undefined): number; - cbrt(x: import("mathjs").BigNumber, allRoots?: boolean | undefined): import("mathjs").BigNumber; - cbrt(x: import("mathjs").Fraction, allRoots?: boolean | undefined): import("mathjs").Fraction; - cbrt(x: import("mathjs").Complex, allRoots?: boolean | undefined): import("mathjs").Complex; - cbrt(x: import("mathjs").MathArray, allRoots?: boolean | undefined): import("mathjs").MathArray; - cbrt(x: import("mathjs").Matrix, allRoots?: boolean | undefined): import("mathjs").Matrix; - cbrt(x: import("mathjs").Unit, allRoots?: boolean | undefined): import("mathjs").Unit; - ceil(x: number): number; - ceil(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - ceil(x: import("mathjs").Fraction): import("mathjs").Fraction; - ceil(x: import("mathjs").Complex): import("mathjs").Complex; - ceil(x: import("mathjs").MathArray): import("mathjs").MathArray; - ceil(x: import("mathjs").Matrix): import("mathjs").Matrix; - ceil(x: import("mathjs").Unit): import("mathjs").Unit; - cube(x: number): number; - cube(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cube(x: import("mathjs").Fraction): import("mathjs").Fraction; - cube(x: import("mathjs").Complex): import("mathjs").Complex; - cube(x: import("mathjs").MathArray): import("mathjs").MathArray; - cube(x: import("mathjs").Matrix): import("mathjs").Matrix; - cube(x: import("mathjs").Unit): import("mathjs").Unit; - divide(x: import("mathjs").Unit, y: import("mathjs").Unit): import("mathjs").Unit; - divide(x: number, y: number): number; - divide(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotDivide(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotMultiply(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotPow(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - exp(x: number): number; - exp(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - exp(x: import("mathjs").Complex): import("mathjs").Complex; - exp(x: import("mathjs").MathArray): import("mathjs").MathArray; - exp(x: import("mathjs").Matrix): import("mathjs").Matrix; - expm1(x: number): number; - expm1(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - expm1(x: import("mathjs").Complex): import("mathjs").Complex; - expm1(x: import("mathjs").MathArray): import("mathjs").MathArray; - expm1(x: import("mathjs").Matrix): import("mathjs").Matrix; - fix(x: number): number; - fix(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - fix(x: import("mathjs").Fraction): import("mathjs").Fraction; - fix(x: import("mathjs").Complex): import("mathjs").Complex; - fix(x: import("mathjs").MathArray): import("mathjs").MathArray; - fix(x: import("mathjs").Matrix): import("mathjs").Matrix; - floor(x: number): number; - floor(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - floor(x: import("mathjs").Fraction): import("mathjs").Fraction; - floor(x: import("mathjs").Complex): import("mathjs").Complex; - floor(x: import("mathjs").MathArray): import("mathjs").MathArray; - floor(x: import("mathjs").Matrix): import("mathjs").Matrix; - gcd(...args: number[]): number; - gcd(...args: import("mathjs").BigNumber[]): import("mathjs").BigNumber; - gcd(...args: import("mathjs").Fraction[]): import("mathjs").Fraction; - gcd(...args: import("mathjs").MathArray[]): import("mathjs").MathArray; - gcd(...args: import("mathjs").Matrix[]): import("mathjs").Matrix; - hypot(...args: number[]): number; - hypot(...args: import("mathjs").BigNumber[]): import("mathjs").BigNumber; - lcm(a: number, b: number): number; - lcm(a: import("mathjs").BigNumber, b: import("mathjs").BigNumber): import("mathjs").BigNumber; - lcm(a: import("mathjs").MathArray, b: import("mathjs").MathArray): import("mathjs").MathArray; - lcm(a: import("mathjs").Matrix, b: import("mathjs").Matrix): import("mathjs").Matrix; - log(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex; - log10(x: number): number; - log10(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - log10(x: import("mathjs").Complex): import("mathjs").Complex; - log10(x: import("mathjs").MathArray): import("mathjs").MathArray; - log10(x: import("mathjs").Matrix): import("mathjs").Matrix; - log1p(x: number, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): number; - log1p(x: import("mathjs").BigNumber, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").BigNumber; - log1p(x: import("mathjs").Complex, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").Complex; - log1p(x: import("mathjs").MathArray, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").MathArray; - log1p(x: import("mathjs").Matrix, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").Matrix; - log2(x: number): number; - log2(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - log2(x: import("mathjs").Complex): import("mathjs").Complex; - log2(x: import("mathjs").MathArray): import("mathjs").MathArray; - log2(x: import("mathjs").Matrix): import("mathjs").Matrix; - multiply(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathType): import("mathjs").MathArray | import("mathjs").Matrix; - multiply(x: import("mathjs").Unit, y: import("mathjs").Unit): import("mathjs").Unit; - multiply(x: number, y: number): number; - multiply(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - norm(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, p?: string | number | import("mathjs").BigNumber | undefined): number | import("mathjs").BigNumber; - nthRoot(a: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, root?: number | import("mathjs").BigNumber | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex; - pow(x: import("mathjs").MathType, y: number | import("mathjs").BigNumber | import("mathjs").Complex): import("mathjs").MathType; - round(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex, n?: number | import("mathjs").MathArray | import("mathjs").BigNumber | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex; - sign(x: number): number; - sign(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sign(x: import("mathjs").Fraction): import("mathjs").Fraction; - sign(x: import("mathjs").Complex): import("mathjs").Complex; - sign(x: import("mathjs").MathArray): import("mathjs").MathArray; - sign(x: import("mathjs").Matrix): import("mathjs").Matrix; - sign(x: import("mathjs").Unit): import("mathjs").Unit; - sqrt(x: number): number; - sqrt(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sqrt(x: import("mathjs").Complex): import("mathjs").Complex; - sqrt(x: import("mathjs").MathArray): import("mathjs").MathArray; - sqrt(x: import("mathjs").Matrix): import("mathjs").Matrix; - sqrt(x: import("mathjs").Unit): import("mathjs").Unit; - square(x: number): number; - square(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - square(x: import("mathjs").Fraction): import("mathjs").Fraction; - square(x: import("mathjs").Complex): import("mathjs").Complex; - square(x: import("mathjs").MathArray): import("mathjs").MathArray; - square(x: import("mathjs").Matrix): import("mathjs").Matrix; - square(x: import("mathjs").Unit): import("mathjs").Unit; - subtract(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - unaryMinus(x: number): number; - unaryMinus(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - unaryMinus(x: import("mathjs").Fraction): import("mathjs").Fraction; - unaryMinus(x: import("mathjs").Complex): import("mathjs").Complex; - unaryMinus(x: import("mathjs").MathArray): import("mathjs").MathArray; - unaryMinus(x: import("mathjs").Matrix): import("mathjs").Matrix; - unaryMinus(x: import("mathjs").Unit): import("mathjs").Unit; - unaryPlus(x: number): number; - unaryPlus(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - unaryPlus(x: import("mathjs").Fraction): import("mathjs").Fraction; - unaryPlus(x: string): string; - unaryPlus(x: import("mathjs").Complex): import("mathjs").Complex; - unaryPlus(x: import("mathjs").MathArray): import("mathjs").MathArray; - unaryPlus(x: import("mathjs").Matrix): import("mathjs").Matrix; - unaryPlus(x: import("mathjs").Unit): import("mathjs").Unit; - xgcd(a: number | import("mathjs").BigNumber, b: number | import("mathjs").BigNumber): import("mathjs").MathArray; - bitAnd(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - bitNot(x: number): number; - bitNot(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - bitNot(x: import("mathjs").MathArray): import("mathjs").MathArray; - bitNot(x: import("mathjs").Matrix): import("mathjs").Matrix; - bitOr(x: number, y: number): number; - bitOr(x: import("mathjs").BigNumber, y: import("mathjs").BigNumber): import("mathjs").BigNumber; - bitOr(x: import("mathjs").MathArray, y: import("mathjs").MathArray): import("mathjs").MathArray; - bitOr(x: import("mathjs").Matrix, y: import("mathjs").Matrix): import("mathjs").Matrix; - bitXor(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - leftShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - rightArithShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - rightLogShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix, y: number): number | import("mathjs").MathArray | import("mathjs").Matrix; - bellNumbers(n: number): number; - bellNumbers(n: import("mathjs").BigNumber): import("mathjs").BigNumber; - catalan(n: number): number; - catalan(n: import("mathjs").BigNumber): import("mathjs").BigNumber; - composition(n: number | import("mathjs").BigNumber, k: number | import("mathjs").BigNumber): number | import("mathjs").BigNumber; - stirlingS2(n: number | import("mathjs").BigNumber, k: number | import("mathjs").BigNumber): number | import("mathjs").BigNumber; - arg(x: number | import("mathjs").Complex): number; - arg(x: import("mathjs").BigNumber | import("mathjs").Complex): import("mathjs").BigNumber; - arg(x: import("mathjs").MathArray): import("mathjs").MathArray; - arg(x: import("mathjs").Matrix): import("mathjs").Matrix; - conj(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex; - im(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - re(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - distance(x: object | import("mathjs").MathArray | import("mathjs").Matrix, y: object | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").BigNumber; - intersect(w: import("mathjs").MathArray | import("mathjs").Matrix, x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix, z: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray; - and(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - not(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - or(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - xor(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - concat(...args: (import("mathjs").MathArray | import("mathjs").Matrix)[]): import("mathjs").MathArray | import("mathjs").Matrix; - cross(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - det(x: import("mathjs").MathArray | import("mathjs").Matrix): number; - diag(X: import("mathjs").MathArray | import("mathjs").Matrix, format?: string | undefined): import("mathjs").Matrix; - diag(X: import("mathjs").MathArray | import("mathjs").Matrix, k: number | import("mathjs").BigNumber, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - dot(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): number; - expm(x: import("mathjs").Matrix): import("mathjs").Matrix; - identity(size: number | import("mathjs").MathArray | import("mathjs").Matrix, format?: string | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - identity(m: number, n: number, format?: string | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - filter(x: import("mathjs").MathArray | import("mathjs").Matrix | string[], test: RegExp | ((value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix | string[]) => boolean)): import("mathjs").MathArray | import("mathjs").Matrix; - flatten(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - forEach(x: import("mathjs").MathArray | import("mathjs").Matrix, callback: (value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix) => void): void; - inv(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex; - kron(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").Matrix; - map(x: import("mathjs").MathArray | import("mathjs").Matrix, callback: (value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix) => string | import("mathjs").MathType): import("mathjs").MathArray | import("mathjs").Matrix; - ones(size: number | number[], format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - ones(m: number, n: number, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - partitionSelect(x: import("mathjs").MathArray | import("mathjs").Matrix, k: number, compare?: "asc" | "desc" | ((a: any, b: any) => number) | undefined): any; - range(str: string, includeEnd?: boolean | undefined): import("mathjs").Matrix; - range(start: number | import("mathjs").BigNumber, end: number | import("mathjs").BigNumber, includeEnd?: boolean | undefined): import("mathjs").Matrix; - range(start: number | import("mathjs").BigNumber, end: number | import("mathjs").BigNumber, step: number | import("mathjs").BigNumber, includeEnd?: boolean | undefined): import("mathjs").Matrix; - reshape(x: import("mathjs").MathArray | import("mathjs").Matrix, sizes: number[]): import("mathjs").MathArray | import("mathjs").Matrix; - resize(x: import("mathjs").MathArray | import("mathjs").Matrix, size: import("mathjs").MathArray | import("mathjs").Matrix, defaultValue?: string | number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - size(x: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex | import("mathjs").Unit): import("mathjs").MathArray | import("mathjs").Matrix; - sort(x: import("mathjs").MathArray | import("mathjs").Matrix, compare: "asc" | "desc" | ((a: any, b: any) => number) | "natural"): import("mathjs").MathArray | import("mathjs").Matrix; - sqrtm(A: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - squeeze(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - subset(value: string | import("mathjs").MathArray | import("mathjs").Matrix, index: import("mathjs").Index, replacement?: any, defaultValue?: any): string | import("mathjs").MathArray | import("mathjs").Matrix; - trace(x: import("mathjs").MathArray | import("mathjs").Matrix): number; - transpose(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - zeros(size: number | number[], format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - zeros(m: number, n: number, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - factorial(n: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - gamma(n: number | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - kldivergence(q: import("mathjs").MathArray | import("mathjs").Matrix, p: import("mathjs").MathArray | import("mathjs").Matrix): number; - multinomial(a: number[] | import("mathjs").BigNumber[]): number | import("mathjs").BigNumber; - permutations(n: number | import("mathjs").BigNumber, k?: number | import("mathjs").BigNumber | undefined): number | import("mathjs").BigNumber; - pickRandom(array: number[], number?: number | undefined, weights?: number[] | undefined): number; - random(min?: number | undefined, max?: number | undefined): number; - random(size: import("mathjs").MathArray | import("mathjs").Matrix, min?: number | undefined, max?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - randomInt(min: number, max?: number | undefined): number; - randomInt(size: import("mathjs").MathArray | import("mathjs").Matrix, min?: number | undefined, max?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - compare(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction; - compareNatural(x: any, y: any): number; - compareText(x: string | import("mathjs").MathArray | import("mathjs").Matrix, y: string | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - deepEqual(x: import("mathjs").MathType, y: import("mathjs").MathType): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex | import("mathjs").Unit; - equal(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - equalText(x: string | import("mathjs").MathArray | import("mathjs").Matrix, y: string | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - larger(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - largerEq(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - smaller(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - smallerEq(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - unequal(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - setCartesian(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setDifference(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setDistinct(a: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setIntersect(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setIsSubset(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): boolean; - setMultiplicity(e: number | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex, a: import("mathjs").MathArray | import("mathjs").Matrix): number; - setPowerset(a: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setSize(a: import("mathjs").MathArray | import("mathjs").Matrix): number; - setSymDifference(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setUnion(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - erf(x: number | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - mad(array: import("mathjs").MathArray | import("mathjs").Matrix): any; - max(...args: import("mathjs").MathType[]): any; - max(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - mean(...args: import("mathjs").MathType[]): any; - mean(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - median(...args: import("mathjs").MathType[]): any; - min(...args: import("mathjs").MathType[]): any; - min(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - mode(...args: import("mathjs").MathType[]): any; - prod(...args: import("mathjs").MathType[]): any; - quantileSeq(A: import("mathjs").MathArray | import("mathjs").Matrix, prob: number | import("mathjs").MathArray | import("mathjs").BigNumber, sorted?: boolean | undefined): number | import("mathjs").MathArray | import("mathjs").BigNumber | import("mathjs").Unit; - std(array: import("mathjs").MathArray | import("mathjs").Matrix, normalization?: "unbiased" | "uncorrected" | "biased" | undefined): number; - sum(...args: (number | import("mathjs").BigNumber | import("mathjs").Fraction)[]): any; - sum(array: import("mathjs").MathArray | import("mathjs").Matrix): any; - var(...args: (number | import("mathjs").BigNumber | import("mathjs").Fraction)[]): any; - var(array: import("mathjs").MathArray | import("mathjs").Matrix, normalization?: "unbiased" | "uncorrected" | "biased" | undefined): any; - format(value: any, options?: number | import("mathjs").FormatOptions | ((item: any) => string) | undefined, callback?: ((value: any) => string) | undefined): string; - print(template: string, values: any, precision?: number | undefined, options?: number | object | undefined): void; - acos(x: number): number; - acos(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acos(x: import("mathjs").Complex): import("mathjs").Complex; - acos(x: import("mathjs").MathArray): import("mathjs").MathArray; - acos(x: import("mathjs").Matrix): import("mathjs").Matrix; - acosh(x: number): number; - acosh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acosh(x: import("mathjs").Complex): import("mathjs").Complex; - acosh(x: import("mathjs").MathArray): import("mathjs").MathArray; - acosh(x: import("mathjs").Matrix): import("mathjs").Matrix; - acot(x: number): number; - acot(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acot(x: import("mathjs").MathArray): import("mathjs").MathArray; - acot(x: import("mathjs").Matrix): import("mathjs").Matrix; - acoth(x: number): number; - acoth(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acoth(x: import("mathjs").MathArray): import("mathjs").MathArray; - acoth(x: import("mathjs").Matrix): import("mathjs").Matrix; - acsc(x: number): number; - acsc(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acsc(x: import("mathjs").MathArray): import("mathjs").MathArray; - acsc(x: import("mathjs").Matrix): import("mathjs").Matrix; - acsch(x: number): number; - acsch(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acsch(x: import("mathjs").MathArray): import("mathjs").MathArray; - acsch(x: import("mathjs").Matrix): import("mathjs").Matrix; - asec(x: number): number; - asec(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asec(x: import("mathjs").MathArray): import("mathjs").MathArray; - asec(x: import("mathjs").Matrix): import("mathjs").Matrix; - asech(x: number): number; - asech(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asech(x: import("mathjs").MathArray): import("mathjs").MathArray; - asech(x: import("mathjs").Matrix): import("mathjs").Matrix; - asin(x: number): number; - asin(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asin(x: import("mathjs").Complex): import("mathjs").Complex; - asin(x: import("mathjs").MathArray): import("mathjs").MathArray; - asin(x: import("mathjs").Matrix): import("mathjs").Matrix; - asinh(x: number): number; - asinh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asinh(x: import("mathjs").MathArray): import("mathjs").MathArray; - asinh(x: import("mathjs").Matrix): import("mathjs").Matrix; - atan(x: number): number; - atan(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - atan(x: import("mathjs").MathArray): import("mathjs").MathArray; - atan(x: import("mathjs").Matrix): import("mathjs").Matrix; - atan2(y: number, x: number): number; - atan2(y: import("mathjs").MathArray | import("mathjs").Matrix, x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - atanh(x: number): number; - atanh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - atanh(x: import("mathjs").MathArray): import("mathjs").MathArray; - atanh(x: import("mathjs").Matrix): import("mathjs").Matrix; - cos(x: number | import("mathjs").Unit): number; - cos(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cos(x: import("mathjs").Complex): import("mathjs").Complex; - cos(x: import("mathjs").MathArray): import("mathjs").MathArray; - cos(x: import("mathjs").Matrix): import("mathjs").Matrix; - cosh(x: number | import("mathjs").Unit): number; - cosh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cosh(x: import("mathjs").Complex): import("mathjs").Complex; - cosh(x: import("mathjs").MathArray): import("mathjs").MathArray; - cosh(x: import("mathjs").Matrix): import("mathjs").Matrix; - cot(x: number | import("mathjs").Unit): number; - cot(x: import("mathjs").Complex): import("mathjs").Complex; - cot(x: import("mathjs").MathArray): import("mathjs").MathArray; - cot(x: import("mathjs").Matrix): import("mathjs").Matrix; - coth(x: number | import("mathjs").Unit): number; - coth(x: import("mathjs").Complex): import("mathjs").Complex; - coth(x: import("mathjs").MathArray): import("mathjs").MathArray; - coth(x: import("mathjs").Matrix): import("mathjs").Matrix; - csc(x: number | import("mathjs").Unit): number; - csc(x: import("mathjs").Complex): import("mathjs").Complex; - csc(x: import("mathjs").MathArray): import("mathjs").MathArray; - csc(x: import("mathjs").Matrix): import("mathjs").Matrix; - csch(x: number | import("mathjs").Unit): number; - csch(x: import("mathjs").Complex): import("mathjs").Complex; - csch(x: import("mathjs").MathArray): import("mathjs").MathArray; - csch(x: import("mathjs").Matrix): import("mathjs").Matrix; - sec(x: number | import("mathjs").Unit): number; - sec(x: import("mathjs").Complex): import("mathjs").Complex; - sec(x: import("mathjs").MathArray): import("mathjs").MathArray; - sec(x: import("mathjs").Matrix): import("mathjs").Matrix; - sech(x: number | import("mathjs").Unit): number; - sech(x: import("mathjs").Complex): import("mathjs").Complex; - sech(x: import("mathjs").MathArray): import("mathjs").MathArray; - sech(x: import("mathjs").Matrix): import("mathjs").Matrix; - sin(x: number | import("mathjs").Unit): number; - sin(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sin(x: import("mathjs").Complex): import("mathjs").Complex; - sin(x: import("mathjs").MathArray): import("mathjs").MathArray; - sin(x: import("mathjs").Matrix): import("mathjs").Matrix; - sinh(x: number | import("mathjs").Unit): number; - sinh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sinh(x: import("mathjs").Complex): import("mathjs").Complex; - sinh(x: import("mathjs").MathArray): import("mathjs").MathArray; - sinh(x: import("mathjs").Matrix): import("mathjs").Matrix; - tan(x: number | import("mathjs").Unit): number; - tan(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - tan(x: import("mathjs").Complex): import("mathjs").Complex; - tan(x: import("mathjs").MathArray): import("mathjs").MathArray; - tan(x: import("mathjs").Matrix): import("mathjs").Matrix; - tanh(x: number | import("mathjs").Unit): number; - tanh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - tanh(x: import("mathjs").Complex): import("mathjs").Complex; - tanh(x: import("mathjs").MathArray): import("mathjs").MathArray; - tanh(x: import("mathjs").Matrix): import("mathjs").Matrix; - to(x: import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Unit, unit: string | import("mathjs").Unit): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Unit; - clone(x: any): any; - isInteger(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction): boolean; - isNaN(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isNegative(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isNumeric(x: any): x is number | boolean | import("mathjs").BigNumber | import("mathjs").Fraction; - isPositive(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isPrime(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): boolean; - isZero(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex | import("mathjs").Unit): boolean; - typeof(x: any): string; - import(object: import("mathjs").ImportObject | import("mathjs").ImportObject[], options: import("mathjs").ImportOptions): void; - }; Material: typeof Material; defaultMaterialConfig: import("@mat3ra/esse/dist/js/types").MaterialSchema; Lattice: typeof Lattice; diff --git a/dist/js/made.js b/dist/js/made.js index c1eed1c24..d98eb8ea2 100644 --- a/dist/js/made.js +++ b/dist/js/made.js @@ -28,7 +28,6 @@ Object.defineProperty(exports, "UnitCell", { enumerable: true, get: function () const material_1 = require("./material"); Object.defineProperty(exports, "defaultMaterialConfig", { enumerable: true, get: function () { return material_1.defaultMaterialConfig; } }); Object.defineProperty(exports, "Material", { enumerable: true, get: function () { return material_1.Material; } }); -const math_1 = __importDefault(require("./math")); const parsers_1 = __importDefault(require("./parsers/parsers")); exports.parsers = parsers_1.default; const index_1 = __importDefault(require("./tools/index")); @@ -38,7 +37,6 @@ exports.Made = { tolerance: constants_1.tolerance, units: constants_1.units, ATOMIC_COORD_UNITS: constants_1.ATOMIC_COORD_UNITS, - math: math_1.default, Material: material_1.Material, defaultMaterialConfig: material_1.defaultMaterialConfig, Lattice: lattice_1.Lattice, diff --git a/dist/js/material.d.ts b/dist/js/material.d.ts index 5cdf0460f..8c755e6b1 100644 --- a/dist/js/material.d.ts +++ b/dist/js/material.d.ts @@ -7,7 +7,8 @@ type BaseMaterial = MaterialMixinConstructor & typeof BaseInMemoryEntity; type MaterialSchemaWithConsistencyChecksAsString = Omit & { consistencyChecks?: ConsistencyCheck[]; }; +type Schema = MaterialSchemaWithConsistencyChecksAsString; declare const Material_base: BaseMaterial; -export declare class Material extends Material_base implements MaterialSchemaWithConsistencyChecksAsString { +export declare class Material extends Material_base implements Schema { constructor(config: MaterialSchema); } diff --git a/dist/js/materialMixin.d.ts b/dist/js/materialMixin.d.ts index 87dd406d7..61c04ab7b 100644 --- a/dist/js/materialMixin.d.ts +++ b/dist/js/materialMixin.d.ts @@ -1,5 +1,5 @@ import type { InMemoryEntity } from "@mat3ra/code/dist/js/entity"; -import type { NamedInMemoryEntity } from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin"; +import type { NamedEntity } from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin"; import type { Constructor } from "@mat3ra/code/dist/js/utils/types"; import type { AnyObject } from "@mat3ra/esse/dist/js/esse/types"; import type { AtomicConstraintsSchema, ConsistencyCheck, DerivedPropertiesSchema, FileSourceSchema, LatticeSchema, MaterialSchema } from "@mat3ra/esse/dist/js/types"; @@ -15,7 +15,7 @@ type MaterialMixinStaticProps = ReturnType; export type MaterialInMemoryEntity = InMemoryEntity & MaterialMixinProps; export type MaterialMixinConstructor = Constructor & MaterialMixinStaticProps; export type OptionallyConstrainedBasisConfig = BasisConfig & Partial>; -type Base = InMemoryEntity & NamedInMemoryEntity; +type Base = InMemoryEntity & NamedEntity; export declare function materialMixin(item: T): { toJSON(): MaterialSchema; name: string; @@ -110,7 +110,7 @@ export declare function materialMixin(item: T): { readonly scaledHash: string; external: { id: string | number; - source: string; + source: "MaterialsProject" | "MaterialsProjectLegacy" | "ICSD" | "2dmatpedia"; origin: boolean; data?: {} | undefined; doi?: string | undefined; diff --git a/dist/js/math.d.ts b/dist/js/math.d.ts deleted file mode 100644 index 7b9745e4f..000000000 --- a/dist/js/math.d.ts +++ /dev/null @@ -1,459 +0,0 @@ -declare const _default: { - PI: number; - trunc: (x: number) => number; - product: (v1: number[], v2: number[]) => number; - vlen: (v: number[]) => number; - angle: (a: number[], b: number[], unit: string) => number; - angleUpTo90: (a: number[], b: number[], unit: string) => number; - vDist: (v1: number[], v2: number[]) => number | undefined; - vEqualWithTolerance: (vec1: number[], vec2: number[], tolerance?: number | undefined) => boolean; - mod: (num: number, tolerance?: number | undefined) => number; - isBetweenZeroInclusiveAndOne: (number: number, tolerance?: number | undefined) => boolean; - cartesianProduct: (...arg: number[][]) => number[][]; - almostEqual: (a: number, b: number, tolerance?: number | undefined) => boolean; - combinations: (a: number, b: number, c: number) => number[][]; - combinationsFromIntervals: (arrA: number[], arrB: number[], arrC: number[]) => number[][]; - calculateSegmentsBetweenPoints3D: (point1: (string | number)[], point2: (string | number)[], n: string | number) => number[][]; - roundToZero: (n: number) => number; - precise: (x: number, n?: number | undefined) => number; - roundValueToNDecimals: (value: number, decimals?: number | undefined) => number; - numberToPrecision: typeof import("@mat3ra/code/dist/js/math").numberToPrecision; - roundCustom: (value: number, decimals?: number | undefined, method?: import("@mat3ra/code/dist/js/math").RoundingMethodEnum | undefined) => number; - RoundingMethod: typeof import("@mat3ra/code/dist/js/math").RoundingMethodEnum; - roundArrayOrNumber: (value: unknown, decimals?: number | undefined, method?: import("@mat3ra/code/dist/js/math").RoundingMethodEnum | undefined) => unknown; - e: number; - pi: number; - i: number; - Infinity: number; - LN2: number; - LN10: number; - LOG2E: number; - LOG10E: number; - NaN: number; - null: number; - phi: number; - SQRT1_2: number; - SQRT2: number; - tau: number; - uninitialized: any; - version: string; - expression: import("mathjs").MathNode; - json: import("mathjs").MathJsJson; - config: (options: import("mathjs").ConfigOptions) => import("mathjs").ConfigOptions; - typed: (name: string, signatures: Record any>) => (...args: any[]) => any; - bignumber(x?: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | null | undefined): import("mathjs").BigNumber; - boolean(x: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | null): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - chain(value?: any): import("mathjs").MathJsChain; - complex(arg?: string | import("mathjs").Complex | import("mathjs").PolarCoordinates | undefined): import("mathjs").Complex; - complex(arg?: import("mathjs").MathArray | import("mathjs").Matrix | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - complex(re: number, im: number): import("mathjs").Complex; - createUnit(name: string, definition?: string | import("mathjs").UnitDefinition | undefined, options?: import("mathjs").CreateUnitOptions | undefined): import("mathjs").Unit; - createUnit(units: Record, options?: import("mathjs").CreateUnitOptions | undefined): import("mathjs").Unit; - fraction(args: import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction; - fraction(numerator: string | number | import("mathjs").MathArray | import("mathjs").Matrix, denominator?: string | number | import("mathjs").MathArray | import("mathjs").Matrix | undefined): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Fraction; - index(...ranges: any[]): import("mathjs").Index; - matrix(format?: "sparse" | "dense" | undefined): import("mathjs").Matrix; - matrix(data: import("mathjs").MathArray | import("mathjs").Matrix, format?: "sparse" | "dense" | undefined, dataType?: string | undefined): import("mathjs").Matrix; - number(value?: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit | null | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - number(unit: import("mathjs").Unit, valuelessUnit: string | import("mathjs").Unit): number; - sparse(data?: import("mathjs").MathArray | import("mathjs").Matrix | undefined, dataType?: string | undefined): import("mathjs").Matrix; - splitUnit(unit: import("mathjs").Unit, parts: import("mathjs").Unit[]): import("mathjs").Unit[]; - string(value: import("mathjs").MathType | null): string | import("mathjs").MathArray | import("mathjs").Matrix; - unit(unit: string): import("mathjs").Unit; - unit(value: number | import("mathjs").MathArray | import("mathjs").Matrix, unit: string): import("mathjs").Unit; - compile(expr: import("mathjs").MathExpression): import("mathjs").EvalFunction; - compile(exprs: import("mathjs").MathExpression[]): import("mathjs").EvalFunction[]; - eval(expr: import("mathjs").MathExpression | import("mathjs").MathExpression[], scope?: object | undefined): any; - help(search: () => any): import("mathjs").Help; - parse(expr: import("mathjs").MathExpression, options?: any): import("mathjs").MathNode; - parse(exprs: import("mathjs").MathExpression[], options?: any): import("mathjs").MathNode[]; - parser(): import("mathjs").Parser; - derivative(expr: string | import("mathjs").MathNode, variable: string | import("mathjs").MathNode, options?: { - simplify: boolean; - } | undefined): import("mathjs").MathNode; - lsolve(L: import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - lup(A?: import("mathjs").MathArray | import("mathjs").Matrix | undefined): { - L: import("mathjs").MathArray | import("mathjs").Matrix; - U: import("mathjs").MathArray | import("mathjs").Matrix; - P: number[]; - }; - lusolve(A: number | import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix, order?: number | undefined, threshold?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - qr(A: import("mathjs").MathArray | import("mathjs").Matrix): { - Q: import("mathjs").MathArray | import("mathjs").Matrix; - R: import("mathjs").MathArray | import("mathjs").Matrix; - }; - rationalize(expr: string | import("mathjs").MathNode, optional?: boolean | object | undefined, detailed?: true | undefined): { - expression: string | import("mathjs").MathNode; - variables: string[]; - coefficients: import("mathjs").MathType[]; - }; - rationalize(expr: string | import("mathjs").MathNode, optional?: boolean | object | undefined, detailed?: false | undefined): import("mathjs").MathNode; - simplify(expr: string | import("mathjs").MathNode, rules?: (string | { - l: string; - r: string; - } | ((node: import("mathjs").MathNode) => import("mathjs").MathNode))[] | undefined, scope?: object | undefined): import("mathjs").MathNode; - slu(A: import("mathjs").Matrix, order: number, threshold: number): object; - usolve(U: import("mathjs").MathArray | import("mathjs").Matrix, b: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - abs(x: number): number; - abs(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - abs(x: import("mathjs").Fraction): import("mathjs").Fraction; - abs(x: import("mathjs").Complex): import("mathjs").Complex; - abs(x: import("mathjs").MathArray): import("mathjs").MathArray; - abs(x: import("mathjs").Matrix): import("mathjs").Matrix; - abs(x: import("mathjs").Unit): import("mathjs").Unit; - add(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - cbrt(x: number, allRoots?: boolean | undefined): number; - cbrt(x: import("mathjs").BigNumber, allRoots?: boolean | undefined): import("mathjs").BigNumber; - cbrt(x: import("mathjs").Fraction, allRoots?: boolean | undefined): import("mathjs").Fraction; - cbrt(x: import("mathjs").Complex, allRoots?: boolean | undefined): import("mathjs").Complex; - cbrt(x: import("mathjs").MathArray, allRoots?: boolean | undefined): import("mathjs").MathArray; - cbrt(x: import("mathjs").Matrix, allRoots?: boolean | undefined): import("mathjs").Matrix; - cbrt(x: import("mathjs").Unit, allRoots?: boolean | undefined): import("mathjs").Unit; - ceil(x: number): number; - ceil(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - ceil(x: import("mathjs").Fraction): import("mathjs").Fraction; - ceil(x: import("mathjs").Complex): import("mathjs").Complex; - ceil(x: import("mathjs").MathArray): import("mathjs").MathArray; - ceil(x: import("mathjs").Matrix): import("mathjs").Matrix; - ceil(x: import("mathjs").Unit): import("mathjs").Unit; - cube(x: number): number; - cube(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cube(x: import("mathjs").Fraction): import("mathjs").Fraction; - cube(x: import("mathjs").Complex): import("mathjs").Complex; - cube(x: import("mathjs").MathArray): import("mathjs").MathArray; - cube(x: import("mathjs").Matrix): import("mathjs").Matrix; - cube(x: import("mathjs").Unit): import("mathjs").Unit; - divide(x: import("mathjs").Unit, y: import("mathjs").Unit): import("mathjs").Unit; - divide(x: number, y: number): number; - divide(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotDivide(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotMultiply(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - dotPow(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - exp(x: number): number; - exp(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - exp(x: import("mathjs").Complex): import("mathjs").Complex; - exp(x: import("mathjs").MathArray): import("mathjs").MathArray; - exp(x: import("mathjs").Matrix): import("mathjs").Matrix; - expm1(x: number): number; - expm1(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - expm1(x: import("mathjs").Complex): import("mathjs").Complex; - expm1(x: import("mathjs").MathArray): import("mathjs").MathArray; - expm1(x: import("mathjs").Matrix): import("mathjs").Matrix; - fix(x: number): number; - fix(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - fix(x: import("mathjs").Fraction): import("mathjs").Fraction; - fix(x: import("mathjs").Complex): import("mathjs").Complex; - fix(x: import("mathjs").MathArray): import("mathjs").MathArray; - fix(x: import("mathjs").Matrix): import("mathjs").Matrix; - floor(x: number): number; - floor(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - floor(x: import("mathjs").Fraction): import("mathjs").Fraction; - floor(x: import("mathjs").Complex): import("mathjs").Complex; - floor(x: import("mathjs").MathArray): import("mathjs").MathArray; - floor(x: import("mathjs").Matrix): import("mathjs").Matrix; - gcd(...args: number[]): number; - gcd(...args: import("mathjs").BigNumber[]): import("mathjs").BigNumber; - gcd(...args: import("mathjs").Fraction[]): import("mathjs").Fraction; - gcd(...args: import("mathjs").MathArray[]): import("mathjs").MathArray; - gcd(...args: import("mathjs").Matrix[]): import("mathjs").Matrix; - hypot(...args: number[]): number; - hypot(...args: import("mathjs").BigNumber[]): import("mathjs").BigNumber; - lcm(a: number, b: number): number; - lcm(a: import("mathjs").BigNumber, b: import("mathjs").BigNumber): import("mathjs").BigNumber; - lcm(a: import("mathjs").MathArray, b: import("mathjs").MathArray): import("mathjs").MathArray; - lcm(a: import("mathjs").Matrix, b: import("mathjs").Matrix): import("mathjs").Matrix; - log(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex; - log10(x: number): number; - log10(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - log10(x: import("mathjs").Complex): import("mathjs").Complex; - log10(x: import("mathjs").MathArray): import("mathjs").MathArray; - log10(x: import("mathjs").Matrix): import("mathjs").Matrix; - log1p(x: number, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): number; - log1p(x: import("mathjs").BigNumber, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").BigNumber; - log1p(x: import("mathjs").Complex, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").Complex; - log1p(x: import("mathjs").MathArray, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").MathArray; - log1p(x: import("mathjs").Matrix, base?: number | import("mathjs").BigNumber | import("mathjs").Complex | undefined): import("mathjs").Matrix; - log2(x: number): number; - log2(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - log2(x: import("mathjs").Complex): import("mathjs").Complex; - log2(x: import("mathjs").MathArray): import("mathjs").MathArray; - log2(x: import("mathjs").Matrix): import("mathjs").Matrix; - multiply(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathType): import("mathjs").MathArray | import("mathjs").Matrix; - multiply(x: import("mathjs").Unit, y: import("mathjs").Unit): import("mathjs").Unit; - multiply(x: number, y: number): number; - multiply(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - norm(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, p?: string | number | import("mathjs").BigNumber | undefined): number | import("mathjs").BigNumber; - nthRoot(a: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex, root?: number | import("mathjs").BigNumber | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex; - pow(x: import("mathjs").MathType, y: number | import("mathjs").BigNumber | import("mathjs").Complex): import("mathjs").MathType; - round(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex, n?: number | import("mathjs").MathArray | import("mathjs").BigNumber | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex; - sign(x: number): number; - sign(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sign(x: import("mathjs").Fraction): import("mathjs").Fraction; - sign(x: import("mathjs").Complex): import("mathjs").Complex; - sign(x: import("mathjs").MathArray): import("mathjs").MathArray; - sign(x: import("mathjs").Matrix): import("mathjs").Matrix; - sign(x: import("mathjs").Unit): import("mathjs").Unit; - sqrt(x: number): number; - sqrt(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sqrt(x: import("mathjs").Complex): import("mathjs").Complex; - sqrt(x: import("mathjs").MathArray): import("mathjs").MathArray; - sqrt(x: import("mathjs").Matrix): import("mathjs").Matrix; - sqrt(x: import("mathjs").Unit): import("mathjs").Unit; - square(x: number): number; - square(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - square(x: import("mathjs").Fraction): import("mathjs").Fraction; - square(x: import("mathjs").Complex): import("mathjs").Complex; - square(x: import("mathjs").MathArray): import("mathjs").MathArray; - square(x: import("mathjs").Matrix): import("mathjs").Matrix; - square(x: import("mathjs").Unit): import("mathjs").Unit; - subtract(x: import("mathjs").MathType, y: import("mathjs").MathType): import("mathjs").MathType; - unaryMinus(x: number): number; - unaryMinus(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - unaryMinus(x: import("mathjs").Fraction): import("mathjs").Fraction; - unaryMinus(x: import("mathjs").Complex): import("mathjs").Complex; - unaryMinus(x: import("mathjs").MathArray): import("mathjs").MathArray; - unaryMinus(x: import("mathjs").Matrix): import("mathjs").Matrix; - unaryMinus(x: import("mathjs").Unit): import("mathjs").Unit; - unaryPlus(x: number): number; - unaryPlus(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - unaryPlus(x: import("mathjs").Fraction): import("mathjs").Fraction; - unaryPlus(x: string): string; - unaryPlus(x: import("mathjs").Complex): import("mathjs").Complex; - unaryPlus(x: import("mathjs").MathArray): import("mathjs").MathArray; - unaryPlus(x: import("mathjs").Matrix): import("mathjs").Matrix; - unaryPlus(x: import("mathjs").Unit): import("mathjs").Unit; - xgcd(a: number | import("mathjs").BigNumber, b: number | import("mathjs").BigNumber): import("mathjs").MathArray; - bitAnd(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - bitNot(x: number): number; - bitNot(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - bitNot(x: import("mathjs").MathArray): import("mathjs").MathArray; - bitNot(x: import("mathjs").Matrix): import("mathjs").Matrix; - bitOr(x: number, y: number): number; - bitOr(x: import("mathjs").BigNumber, y: import("mathjs").BigNumber): import("mathjs").BigNumber; - bitOr(x: import("mathjs").MathArray, y: import("mathjs").MathArray): import("mathjs").MathArray; - bitOr(x: import("mathjs").Matrix, y: import("mathjs").Matrix): import("mathjs").Matrix; - bitXor(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - leftShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - rightArithShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber, y: number | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - rightLogShift(x: number | import("mathjs").MathArray | import("mathjs").Matrix, y: number): number | import("mathjs").MathArray | import("mathjs").Matrix; - bellNumbers(n: number): number; - bellNumbers(n: import("mathjs").BigNumber): import("mathjs").BigNumber; - catalan(n: number): number; - catalan(n: import("mathjs").BigNumber): import("mathjs").BigNumber; - composition(n: number | import("mathjs").BigNumber, k: number | import("mathjs").BigNumber): number | import("mathjs").BigNumber; - stirlingS2(n: number | import("mathjs").BigNumber, k: number | import("mathjs").BigNumber): number | import("mathjs").BigNumber; - arg(x: number | import("mathjs").Complex): number; - arg(x: import("mathjs").BigNumber | import("mathjs").Complex): import("mathjs").BigNumber; - arg(x: import("mathjs").MathArray): import("mathjs").MathArray; - arg(x: import("mathjs").Matrix): import("mathjs").Matrix; - conj(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex; - im(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - re(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - distance(x: object | import("mathjs").MathArray | import("mathjs").Matrix, y: object | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").BigNumber; - intersect(w: import("mathjs").MathArray | import("mathjs").Matrix, x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix, z: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray; - and(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - not(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - or(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - xor(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit, y: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Complex | import("mathjs").Unit): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - concat(...args: (import("mathjs").MathArray | import("mathjs").Matrix)[]): import("mathjs").MathArray | import("mathjs").Matrix; - cross(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - det(x: import("mathjs").MathArray | import("mathjs").Matrix): number; - diag(X: import("mathjs").MathArray | import("mathjs").Matrix, format?: string | undefined): import("mathjs").Matrix; - diag(X: import("mathjs").MathArray | import("mathjs").Matrix, k: number | import("mathjs").BigNumber, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - dot(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): number; - expm(x: import("mathjs").Matrix): import("mathjs").Matrix; - identity(size: number | import("mathjs").MathArray | import("mathjs").Matrix, format?: string | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - identity(m: number, n: number, format?: string | undefined): number | import("mathjs").MathArray | import("mathjs").Matrix; - filter(x: import("mathjs").MathArray | import("mathjs").Matrix | string[], test: RegExp | ((value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix | string[]) => boolean)): import("mathjs").MathArray | import("mathjs").Matrix; - flatten(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - forEach(x: import("mathjs").MathArray | import("mathjs").Matrix, callback: (value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix) => void): void; - inv(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex; - kron(x: import("mathjs").MathArray | import("mathjs").Matrix, y: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").Matrix; - map(x: import("mathjs").MathArray | import("mathjs").Matrix, callback: (value: any, index: any, matrix: import("mathjs").MathArray | import("mathjs").Matrix) => string | import("mathjs").MathType): import("mathjs").MathArray | import("mathjs").Matrix; - ones(size: number | number[], format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - ones(m: number, n: number, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - partitionSelect(x: import("mathjs").MathArray | import("mathjs").Matrix, k: number, compare?: "asc" | "desc" | ((a: any, b: any) => number) | undefined): any; - range(str: string, includeEnd?: boolean | undefined): import("mathjs").Matrix; - range(start: number | import("mathjs").BigNumber, end: number | import("mathjs").BigNumber, includeEnd?: boolean | undefined): import("mathjs").Matrix; - range(start: number | import("mathjs").BigNumber, end: number | import("mathjs").BigNumber, step: number | import("mathjs").BigNumber, includeEnd?: boolean | undefined): import("mathjs").Matrix; - reshape(x: import("mathjs").MathArray | import("mathjs").Matrix, sizes: number[]): import("mathjs").MathArray | import("mathjs").Matrix; - resize(x: import("mathjs").MathArray | import("mathjs").Matrix, size: import("mathjs").MathArray | import("mathjs").Matrix, defaultValue?: string | number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - size(x: string | number | boolean | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Complex | import("mathjs").Unit): import("mathjs").MathArray | import("mathjs").Matrix; - sort(x: import("mathjs").MathArray | import("mathjs").Matrix, compare: "asc" | "desc" | ((a: any, b: any) => number) | "natural"): import("mathjs").MathArray | import("mathjs").Matrix; - sqrtm(A: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - squeeze(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - subset(value: string | import("mathjs").MathArray | import("mathjs").Matrix, index: import("mathjs").Index, replacement?: any, defaultValue?: any): string | import("mathjs").MathArray | import("mathjs").Matrix; - trace(x: import("mathjs").MathArray | import("mathjs").Matrix): number; - transpose(x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - zeros(size: number | number[], format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - zeros(m: number, n: number, format?: string | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - factorial(n: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber; - gamma(n: number | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - kldivergence(q: import("mathjs").MathArray | import("mathjs").Matrix, p: import("mathjs").MathArray | import("mathjs").Matrix): number; - multinomial(a: number[] | import("mathjs").BigNumber[]): number | import("mathjs").BigNumber; - permutations(n: number | import("mathjs").BigNumber, k?: number | import("mathjs").BigNumber | undefined): number | import("mathjs").BigNumber; - pickRandom(array: number[], number?: number | undefined, weights?: number[] | undefined): number; - random(min?: number | undefined, max?: number | undefined): number; - random(size: import("mathjs").MathArray | import("mathjs").Matrix, min?: number | undefined, max?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - randomInt(min: number, max?: number | undefined): number; - randomInt(size: import("mathjs").MathArray | import("mathjs").Matrix, min?: number | undefined, max?: number | undefined): import("mathjs").MathArray | import("mathjs").Matrix; - compare(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction; - compareNatural(x: any, y: any): number; - compareText(x: string | import("mathjs").MathArray | import("mathjs").Matrix, y: string | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - deepEqual(x: import("mathjs").MathType, y: import("mathjs").MathType): number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex | import("mathjs").Unit; - equal(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - equalText(x: string | import("mathjs").MathArray | import("mathjs").Matrix, y: string | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - larger(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - largerEq(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - smaller(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - smallerEq(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - unequal(x: string | import("mathjs").MathType, y: string | import("mathjs").MathType): boolean | import("mathjs").MathArray | import("mathjs").Matrix; - setCartesian(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setDifference(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setDistinct(a: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setIntersect(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setIsSubset(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): boolean; - setMultiplicity(e: number | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex, a: import("mathjs").MathArray | import("mathjs").Matrix): number; - setPowerset(a: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setSize(a: import("mathjs").MathArray | import("mathjs").Matrix): number; - setSymDifference(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - setUnion(a1: import("mathjs").MathArray | import("mathjs").Matrix, a2: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - erf(x: number | import("mathjs").MathArray | import("mathjs").Matrix): number | import("mathjs").MathArray | import("mathjs").Matrix; - mad(array: import("mathjs").MathArray | import("mathjs").Matrix): any; - max(...args: import("mathjs").MathType[]): any; - max(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - mean(...args: import("mathjs").MathType[]): any; - mean(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - median(...args: import("mathjs").MathType[]): any; - min(...args: import("mathjs").MathType[]): any; - min(A: import("mathjs").MathArray | import("mathjs").Matrix, dim?: number | undefined): any; - mode(...args: import("mathjs").MathType[]): any; - prod(...args: import("mathjs").MathType[]): any; - quantileSeq(A: import("mathjs").MathArray | import("mathjs").Matrix, prob: number | import("mathjs").MathArray | import("mathjs").BigNumber, sorted?: boolean | undefined): number | import("mathjs").MathArray | import("mathjs").BigNumber | import("mathjs").Unit; - std(array: import("mathjs").MathArray | import("mathjs").Matrix, normalization?: "unbiased" | "uncorrected" | "biased" | undefined): number; - sum(...args: (number | import("mathjs").BigNumber | import("mathjs").Fraction)[]): any; - sum(array: import("mathjs").MathArray | import("mathjs").Matrix): any; - var(...args: (number | import("mathjs").BigNumber | import("mathjs").Fraction)[]): any; - var(array: import("mathjs").MathArray | import("mathjs").Matrix, normalization?: "unbiased" | "uncorrected" | "biased" | undefined): any; - format(value: any, options?: number | import("mathjs").FormatOptions | ((item: any) => string) | undefined, callback?: ((value: any) => string) | undefined): string; - print(template: string, values: any, precision?: number | undefined, options?: number | object | undefined): void; - acos(x: number): number; - acos(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acos(x: import("mathjs").Complex): import("mathjs").Complex; - acos(x: import("mathjs").MathArray): import("mathjs").MathArray; - acos(x: import("mathjs").Matrix): import("mathjs").Matrix; - acosh(x: number): number; - acosh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acosh(x: import("mathjs").Complex): import("mathjs").Complex; - acosh(x: import("mathjs").MathArray): import("mathjs").MathArray; - acosh(x: import("mathjs").Matrix): import("mathjs").Matrix; - acot(x: number): number; - acot(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acot(x: import("mathjs").MathArray): import("mathjs").MathArray; - acot(x: import("mathjs").Matrix): import("mathjs").Matrix; - acoth(x: number): number; - acoth(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acoth(x: import("mathjs").MathArray): import("mathjs").MathArray; - acoth(x: import("mathjs").Matrix): import("mathjs").Matrix; - acsc(x: number): number; - acsc(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acsc(x: import("mathjs").MathArray): import("mathjs").MathArray; - acsc(x: import("mathjs").Matrix): import("mathjs").Matrix; - acsch(x: number): number; - acsch(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - acsch(x: import("mathjs").MathArray): import("mathjs").MathArray; - acsch(x: import("mathjs").Matrix): import("mathjs").Matrix; - asec(x: number): number; - asec(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asec(x: import("mathjs").MathArray): import("mathjs").MathArray; - asec(x: import("mathjs").Matrix): import("mathjs").Matrix; - asech(x: number): number; - asech(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asech(x: import("mathjs").MathArray): import("mathjs").MathArray; - asech(x: import("mathjs").Matrix): import("mathjs").Matrix; - asin(x: number): number; - asin(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asin(x: import("mathjs").Complex): import("mathjs").Complex; - asin(x: import("mathjs").MathArray): import("mathjs").MathArray; - asin(x: import("mathjs").Matrix): import("mathjs").Matrix; - asinh(x: number): number; - asinh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - asinh(x: import("mathjs").MathArray): import("mathjs").MathArray; - asinh(x: import("mathjs").Matrix): import("mathjs").Matrix; - atan(x: number): number; - atan(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - atan(x: import("mathjs").MathArray): import("mathjs").MathArray; - atan(x: import("mathjs").Matrix): import("mathjs").Matrix; - atan2(y: number, x: number): number; - atan2(y: import("mathjs").MathArray | import("mathjs").Matrix, x: import("mathjs").MathArray | import("mathjs").Matrix): import("mathjs").MathArray | import("mathjs").Matrix; - atanh(x: number): number; - atanh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - atanh(x: import("mathjs").MathArray): import("mathjs").MathArray; - atanh(x: import("mathjs").Matrix): import("mathjs").Matrix; - cos(x: number | import("mathjs").Unit): number; - cos(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cos(x: import("mathjs").Complex): import("mathjs").Complex; - cos(x: import("mathjs").MathArray): import("mathjs").MathArray; - cos(x: import("mathjs").Matrix): import("mathjs").Matrix; - cosh(x: number | import("mathjs").Unit): number; - cosh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - cosh(x: import("mathjs").Complex): import("mathjs").Complex; - cosh(x: import("mathjs").MathArray): import("mathjs").MathArray; - cosh(x: import("mathjs").Matrix): import("mathjs").Matrix; - cot(x: number | import("mathjs").Unit): number; - cot(x: import("mathjs").Complex): import("mathjs").Complex; - cot(x: import("mathjs").MathArray): import("mathjs").MathArray; - cot(x: import("mathjs").Matrix): import("mathjs").Matrix; - coth(x: number | import("mathjs").Unit): number; - coth(x: import("mathjs").Complex): import("mathjs").Complex; - coth(x: import("mathjs").MathArray): import("mathjs").MathArray; - coth(x: import("mathjs").Matrix): import("mathjs").Matrix; - csc(x: number | import("mathjs").Unit): number; - csc(x: import("mathjs").Complex): import("mathjs").Complex; - csc(x: import("mathjs").MathArray): import("mathjs").MathArray; - csc(x: import("mathjs").Matrix): import("mathjs").Matrix; - csch(x: number | import("mathjs").Unit): number; - csch(x: import("mathjs").Complex): import("mathjs").Complex; - csch(x: import("mathjs").MathArray): import("mathjs").MathArray; - csch(x: import("mathjs").Matrix): import("mathjs").Matrix; - sec(x: number | import("mathjs").Unit): number; - sec(x: import("mathjs").Complex): import("mathjs").Complex; - sec(x: import("mathjs").MathArray): import("mathjs").MathArray; - sec(x: import("mathjs").Matrix): import("mathjs").Matrix; - sech(x: number | import("mathjs").Unit): number; - sech(x: import("mathjs").Complex): import("mathjs").Complex; - sech(x: import("mathjs").MathArray): import("mathjs").MathArray; - sech(x: import("mathjs").Matrix): import("mathjs").Matrix; - sin(x: number | import("mathjs").Unit): number; - sin(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sin(x: import("mathjs").Complex): import("mathjs").Complex; - sin(x: import("mathjs").MathArray): import("mathjs").MathArray; - sin(x: import("mathjs").Matrix): import("mathjs").Matrix; - sinh(x: number | import("mathjs").Unit): number; - sinh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - sinh(x: import("mathjs").Complex): import("mathjs").Complex; - sinh(x: import("mathjs").MathArray): import("mathjs").MathArray; - sinh(x: import("mathjs").Matrix): import("mathjs").Matrix; - tan(x: number | import("mathjs").Unit): number; - tan(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - tan(x: import("mathjs").Complex): import("mathjs").Complex; - tan(x: import("mathjs").MathArray): import("mathjs").MathArray; - tan(x: import("mathjs").Matrix): import("mathjs").Matrix; - tanh(x: number | import("mathjs").Unit): number; - tanh(x: import("mathjs").BigNumber): import("mathjs").BigNumber; - tanh(x: import("mathjs").Complex): import("mathjs").Complex; - tanh(x: import("mathjs").MathArray): import("mathjs").MathArray; - tanh(x: import("mathjs").Matrix): import("mathjs").Matrix; - to(x: import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Unit, unit: string | import("mathjs").Unit): import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").Unit; - clone(x: any): any; - isInteger(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction): boolean; - isNaN(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isNegative(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isNumeric(x: any): x is number | boolean | import("mathjs").BigNumber | import("mathjs").Fraction; - isPositive(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Unit): boolean; - isPrime(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber): boolean; - isZero(x: number | import("mathjs").MathArray | import("mathjs").Matrix | import("mathjs").BigNumber | import("mathjs").Fraction | import("mathjs").Complex | import("mathjs").Unit): boolean; - typeof(x: any): string; - import(object: import("mathjs").ImportObject | import("mathjs").ImportObject[], options: import("mathjs").ImportOptions): void; -}; -export default _default; diff --git a/dist/js/math.js b/dist/js/math.js deleted file mode 100644 index 8894aa664..000000000 --- a/dist/js/math.js +++ /dev/null @@ -1,7 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -// TODO: adjust the imports and remove the need for re-exporting -const math_1 = require("@mat3ra/code/dist/js/math"); -exports.default = { - ...math_1.math, -}; diff --git a/dist/js/parsers/poscar.js b/dist/js/parsers/poscar.js index c35faec98..0ed0393d8 100644 --- a/dist/js/parsers/poscar.js +++ b/dist/js/parsers/poscar.js @@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) { }; Object.defineProperty(exports, "__esModule", { value: true }); exports.atomsCount = void 0; +const math_1 = require("@mat3ra/code/dist/js/math"); const underscore_string_1 = __importDefault(require("underscore.string")); const constrained_basis_1 = require("../basis/constrained_basis"); const cell_1 = require("../cell/cell"); const constants_1 = require("../constants"); const lattice_1 = require("../lattice/lattice"); -const math_1 = __importDefault(require("../math")); -const _print = (x, printFormat = "%14.9f") => underscore_string_1.default.sprintf(printFormat, math_1.default.precise(x)); +const _print = (x, printFormat = "%14.9f") => underscore_string_1.default.sprintf(printFormat, math_1.math.precise(x)); const _latticeVectorsToString = (vectors) => vectors.map((v) => v.map((c) => _print(c)).join("\t")).join("\n"); const atomicConstraintsCharFromBool = (bool) => (bool ? "T" : "F"); /** diff --git a/dist/js/parsers/xyz_combinatorial_basis.js b/dist/js/parsers/xyz_combinatorial_basis.js index 8b5230abf..fa36d4c5e 100644 --- a/dist/js/parsers/xyz_combinatorial_basis.js +++ b/dist/js/parsers/xyz_combinatorial_basis.js @@ -22,15 +22,12 @@ var __importStar = (this && this.__importStar) || function (mod) { __setModuleDefault(result, mod); return result; }; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); exports.CombinatorialBasis = exports.WrongBasisFormat = void 0; +const math_1 = require("@mat3ra/code/dist/js/math"); const lodash_1 = require("lodash"); const s = __importStar(require("underscore.string")); const cell_1 = require("../cell/cell"); -const math_1 = __importDefault(require("../math")); /** * @summary Combinatorial XYZ basis class and related. Create and get all information about basis and elements in it. * Constructor accepts string in extended XYZ format. Extended XYZ format is as follows: @@ -202,7 +199,7 @@ class CombinatorialBasis { dimensions.push(itemsSet); }); // @ts-ignore // We're multiplying objects with math, not numbers. No type casting will help. - const basisSet = math_1.default.cartesianProduct.apply(null, dimensions); + const basisSet = math_1.math.cartesianProduct.apply(null, dimensions); return basisSet.map((basis) => basis.filter((entry) => entry.element !== VACANCY_CHARACTER)); } /** diff --git a/dist/js/tools/basis.js b/dist/js/tools/basis.js index 6f60e9ce3..ef7baa130 100644 --- a/dist/js/tools/basis.js +++ b/dist/js/tools/basis.js @@ -1,13 +1,10 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); +const math_1 = require("@mat3ra/code/dist/js/math"); const lodash_1 = require("lodash"); const coordinates_1 = require("../basis/coordinates"); -const math_1 = __importDefault(require("../math")); -const ADD = math_1.default.add; -const MULT = math_1.default.multiply; +const ADD = math_1.math.add; +const MULT = math_1.math.multiply; /** * Returns a repeated basis of a crystal. * @param basis {Basis} Original basis. diff --git a/dist/js/tools/cell.js b/dist/js/tools/cell.js index 83c0a2733..85323888a 100644 --- a/dist/js/tools/cell.js +++ b/dist/js/tools/cell.js @@ -1,10 +1,7 @@ "use strict"; -var __importDefault = (this && this.__importDefault) || function (mod) { - return (mod && mod.__esModule) ? mod : { "default": mod }; -}; Object.defineProperty(exports, "__esModule", { value: true }); +const math_1 = require("@mat3ra/code/dist/js/math"); const cell_1 = require("../cell/cell"); -const math_1 = __importDefault(require("../math")); /** * Returns the list of points on the original lattice contained in the supercell in fractional coordinates. * Source: https://pymatgen.org/_modules/pymatgen/util/coord.html @@ -22,8 +19,8 @@ function latticePointsInSupercell(supercellMatrix) { [1, 1, 1], ]; const d_points = diagonals.map((point) => supercell.convertPointToCartesian(point)); - const mins = [0, 1, 2].map((i) => math_1.default.min(...d_points.map((p) => p[i]))); - const maxes = [0, 1, 2].map((i) => math_1.default.max(...d_points.map((p) => p[i])) + 1); + const mins = [0, 1, 2].map((i) => math_1.math.min(...d_points.map((p) => p[i]))); + const maxes = [0, 1, 2].map((i) => math_1.math.max(...d_points.map((p) => p[i])) + 1); const points = []; for (let i = mins[0]; i <= maxes[0]; i++) { for (let j = mins[1]; j <= maxes[1]; j++) { diff --git a/dist/js/tools/supercell.js b/dist/js/tools/supercell.js index 4f5b1e3c4..ac4105b3b 100644 --- a/dist/js/tools/supercell.js +++ b/dist/js/tools/supercell.js @@ -3,10 +3,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +const math_1 = require("@mat3ra/code/dist/js/math"); const lattice_1 = require("../lattice/lattice"); -const math_1 = __importDefault(require("../math")); const cell_1 = __importDefault(require("./cell")); -const ADD = math_1.default.add; +const ADD = math_1.math.add; /** * @summary Generates new basis for a supercell. For each site from basis generates shifts that are within supercell. */ @@ -39,7 +39,7 @@ function generateNewBasisWithinSupercell(basis, cell, supercell, supercellMatrix * @param supercellMatrix {Number[][]} */ function generateConfig(material, supercellMatrix) { - const det = math_1.default.det(supercellMatrix); + const det = math_1.math.det(supercellMatrix); if (det === 0) { throw new Error("Scaling matrix is degenerate."); } diff --git a/dist/js/tools/surface.js b/dist/js/tools/surface.js index 79d9516aa..b95dcf519 100644 --- a/dist/js/tools/surface.js +++ b/dist/js/tools/surface.js @@ -3,14 +3,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); +const math_1 = require("@mat3ra/code/dist/js/math"); const lattice_1 = require("../lattice/lattice"); -const math_1 = __importDefault(require("../math")); const supercell_1 = __importDefault(require("./supercell")); -const MULT = math_1.default.multiply; -const ADD = math_1.default.add; -const DOT = math_1.default.product; +const MULT = math_1.math.multiply; +const ADD = math_1.math.add; +const DOT = math_1.math.product; const getMatrixInLeftHandedRepresentation = (matrix) => { - return math_1.default.det(matrix) < 0 ? MULT(matrix, -1) : matrix; + return math_1.math.det(matrix) < 0 ? MULT(matrix, -1) : matrix; }; /** * Helper function for extended GCD. @@ -22,10 +22,10 @@ const getMatrixInLeftHandedRepresentation = (matrix) => { function extGCD(a, b) { if (b === 0) return [1, 0]; - if (math_1.default.mod(a, b) === 0) + if (math_1.math.mod(a, b) === 0) return [0, 1]; - const [x, y] = extGCD(b, math_1.default.mod(a, b)); - return [y, x - y * math_1.default.floor(a / b)]; + const [x, y] = extGCD(b, math_1.math.mod(a, b)); + return [y, x - y * math_1.math.floor(a / b)]; } /** * Generates a slab scaling matrix for the specified cell based on miller indices. @@ -36,7 +36,7 @@ function extGCD(a, b) { * @return {Number[][]} */ function getMillerScalingMatrix(cell, millerIndices, tol = 1e-8) { - if (!millerIndices.reduce((a, b) => math_1.default.abs(a) + math_1.default.abs(b))) + if (!millerIndices.reduce((a, b) => math_1.math.abs(a) + math_1.math.abs(b))) throw new Error("Miller indices are zeros."); let scalingMatrix; const [h, k, l] = millerIndices; @@ -78,19 +78,19 @@ function getMillerScalingMatrix(cell, millerIndices, tol = 1e-8) { const k1 = DOT(ADD(MULT(p, z1), MULT(q, z2)), z3); // @ts-ignore const k2 = DOT(ADD(MULT(l, z1), -MULT(k, z2)), z3); - if (math_1.default.abs(k2) > tol) { + if (math_1.math.abs(k2) > tol) { // For mathjs version 3.20: round(-0.5) = -0 // For mathjs version 5.10: round(-0.5) = -1 // Here we specify rounding method to Bankers // For Python 3.11: round(-0.5) = 0 const value = k1 / k2; - const roundedValue = math_1.default.roundCustom(value, 0, math_1.default.RoundingMethod.Bankers); + const roundedValue = math_1.math.roundCustom(value, 0, math_1.math.RoundingMethod.Bankers); const i = -roundedValue; [p, q] = [p + i * l, q - i * k]; } const [a, b] = extGCD(p * k + q * l, h); const c1 = [p * k + q * l, -p * h, -q * h]; - const c2 = [0, l, -k].map((c) => math_1.default.trunc(c / math_1.default.gcd(l, k))); // floor division + const c2 = [0, l, -k].map((c) => math_1.math.trunc(c / math_1.math.gcd(l, k))); // floor division const c3 = [b, a * p, a * q]; scalingMatrix = [c1, c2, c3]; } diff --git a/dist/js/types.d.ts b/dist/js/types.d.ts deleted file mode 100644 index 586292728..000000000 --- a/dist/js/types.d.ts +++ /dev/null @@ -1 +0,0 @@ -export type { MaterialInMemoryEntity } from "./materialMixin"; diff --git a/dist/js/types.js b/dist/js/types.js deleted file mode 100644 index c8ad2e549..000000000 --- a/dist/js/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/dist/js/types/index.d.ts b/dist/js/types/index.d.ts deleted file mode 100644 index 7cfe55328..000000000 --- a/dist/js/types/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./material"; diff --git a/dist/js/types/index.js b/dist/js/types/index.js deleted file mode 100644 index aaaf2164a..000000000 --- a/dist/js/types/index.js +++ /dev/null @@ -1,17 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -__exportStar(require("./material"), exports); diff --git a/dist/js/types/material.d.ts b/dist/js/types/material.d.ts deleted file mode 100644 index 9697ef84b..000000000 --- a/dist/js/types/material.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { AnyObject } from "@mat3ra/esse/dist/js/esse/types"; -import { MaterialSchema } from "@mat3ra/esse/dist/js/types"; -import { Basis } from "../basis/basis"; -import { ConstrainedBasis } from "../basis/constrained_basis"; -import { Cell } from "../cell/cell"; -export type MaterialJSON = MaterialSchema & AnyObject; -/** - * Interface defining the minimum required properties for a Material - * when used by other components like the supercell tools. - * This helps break circular dependencies. - */ -export interface MaterialInterface { - name: string; - Basis: Basis | ConstrainedBasis; - Lattice: { - vectors: Cell; - }; -} diff --git a/dist/js/types/material.js b/dist/js/types/material.js deleted file mode 100644 index c8ad2e549..000000000 --- a/dist/js/types/material.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/package-lock.json b/package-lock.json index 0efafc70b..96d8d0a18 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,8 +31,8 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "2025.10.8-0", - "@mat3ra/esse": "2025.10.8-0", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", + "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", "@types/crypto-js": "^4.2.2", @@ -2865,9 +2865,9 @@ "license": "MIT" }, "node_modules/@mat3ra/code": { - "version": "2025.10.8-0", - "resolved": "https://registry.npmjs.org/@mat3ra/code/-/code-2025.10.8-0.tgz", - "integrity": "sha512-DeRF2J1u8fDHSvW4lkXbwUEsdhcoMCzTzEyZR0Y9SBCdYxaD9w9+t1/Z7dJUeX4g1mlZkqVJ1NsheyqdOAUxJQ==", + "version": "0.0.0", + "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", + "integrity": "sha512-uhE+7eKKL/r7K+TDgO9THVsYZ0a3Vxfvmga2MZOI3yZJYDrOqAO62T6EGfmoEX0IixXEPe87aO/9jP07SVm4DA==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2949,12 +2949,6 @@ "node": ">=10" } }, - "node_modules/@mat3ra/code/node_modules/tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", - "dev": true - }, "node_modules/@mat3ra/code/node_modules/typed-function": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-1.1.0.tgz", @@ -2965,9 +2959,9 @@ } }, "node_modules/@mat3ra/esse": { - "version": "2025.10.8-0", - "resolved": "https://registry.npmjs.org/@mat3ra/esse/-/esse-2025.10.8-0.tgz", - "integrity": "sha512-JwHWF0nXdcv9pceYePNpAixnjIkQLPtlB2fm4MatRXiH9CqrPrHBRH+t/0v5O1Em2uM5jsnqA+EYB0toOMHOVw==", + "version": "0.0.0", + "resolved": "git+ssh://git@github.com/Exabyte-io/esse.git#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", + "integrity": "sha512-9n1FTk0n5xg0xf2gIPRjcv37OaoUeg4jzAxeBWB2neVsXn4xDJxfdGDcWVLo/2HnLAA0tC93ufx/T26pUSH8Aw==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2980,6 +2974,7 @@ "@babel/preset-typescript": "^7.27.0", "@babel/register": "^7.25.9", "@babel/runtime-corejs3": "^7.27.0", + "@mat3ra/utils": "^2025.11.20-0", "@types/chai": "^4.3.20", "@types/js-yaml": "^4.0.9", "@types/json-schema-merge-allof": "^0.6.5", @@ -3173,36 +3168,466 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@mat3ra/esse/node_modules/@babel/preset-react": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.27.1.tgz", - "integrity": "sha512-oJHWh2gLhU9dW9HHr42q0cI0/iHHXTLGe39qvpAZZzagHy0MzYLCnCVV0symeRvzmjHyVU7mw2K06E6u/JwbhA==", + "node_modules/@mat3ra/esse/node_modules/@babel/preset-react": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.27.1.tgz", + "integrity": "sha512-oJHWh2gLhU9dW9HHr42q0cI0/iHHXTLGe39qvpAZZzagHy0MzYLCnCVV0symeRvzmjHyVU7mw2K06E6u/JwbhA==", + "dev": true, + "dependencies": { + "@babel/helper-plugin-utils": "^7.27.1", + "@babel/helper-validator-option": "^7.27.1", + "@babel/plugin-transform-react-display-name": "^7.27.1", + "@babel/plugin-transform-react-jsx": "^7.27.1", + "@babel/plugin-transform-react-jsx-development": "^7.27.1", + "@babel/plugin-transform-react-pure-annotations": "^7.27.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@babel/runtime-corejs3": { + "version": "7.27.1", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.27.1.tgz", + "integrity": "sha512-909rVuj3phpjW6y0MCXAZ5iNeORePa6ldJvp2baWGcTjwqbBDDz6xoS5JHJ7lS88NlwLYj07ImL/8IUMtDZzTA==", + "dev": true, + "dependencies": { + "core-js-pure": "^3.30.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils": { + "version": "2025.11.20-0", + "resolved": "https://registry.npmjs.org/@mat3ra/utils/-/utils-2025.11.20-0.tgz", + "integrity": "sha512-igkswFIPrvIsOKiGdLE6ifgKGa3nruepjq2pPs9us+gHRn4tCaFNsBJqHw3ysw1dLgCtoYhHyYbMdpQu46+FCw==", + "dev": true, + "license": "ISC", + "dependencies": { + "@babel/cli": "7.16.0", + "@babel/core": "7.24.1", + "@babel/eslint-parser": "7.16.3", + "@babel/plugin-proposal-class-properties": "7.16.0", + "@babel/preset-env": "7.16.4", + "@babel/preset-react": "7.16.7", + "@babel/preset-typescript": "^7.22.5", + "@babel/register": "^7.16.0", + "@babel/runtime-corejs3": "7.16.8", + "crypto-js": "^4.1.1", + "js-yaml": "^4.1.0", + "lodash": "^4.17.21", + "mathjs": "12.4.1", + "semver": "^7.5.3", + "ts-node": "^10.9.1", + "typescript": "^4.5.5", + "underscore": "^1.13.3", + "underscore.string": "^3.3.4", + "uuid": "8.3.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/cli": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.16.0.tgz", + "integrity": "sha512-WLrM42vKX/4atIoQB+eb0ovUof53UUvecb4qGjU2PDDWRiZr50ZpiV8NpcLo7iSxeGYrRG0Mqembsa+UrTAV6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "commander": "^4.0.1", + "convert-source-map": "^1.1.0", + "fs-readdir-recursive": "^1.1.0", + "glob": "^7.0.0", + "make-dir": "^2.1.0", + "slash": "^2.0.0", + "source-map": "^0.5.0" + }, + "bin": { + "babel": "bin/babel.js", + "babel-external-helpers": "bin/babel-external-helpers.js" + }, + "engines": { + "node": ">=6.9.0" + }, + "optionalDependencies": { + "@nicolo-ribaudo/chokidar-2": "2.1.8-no-fsevents.3", + "chokidar": "^3.4.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/cli/node_modules/convert-source-map": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", + "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", + "dev": true, + "license": "MIT" + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/core": { + "version": "7.24.1", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.24.1.tgz", + "integrity": "sha512-F82udohVyIgGAY2VVj/g34TpFUG606rumIHjTfVbssPg2zTR7PuuEpZcX8JA6sgBfIYmJrFtWgPvHQuJamVqZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.24.1", + "@babel/generator": "^7.24.1", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.24.1", + "@babel/parser": "^7.24.1", + "@babel/template": "^7.24.0", + "@babel/traverse": "^7.24.1", + "@babel/types": "^7.24.0", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/core/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/eslint-parser": { + "version": "7.16.3", + "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.16.3.tgz", + "integrity": "sha512-iB4ElZT0jAt7PKVaeVulOECdGe6UnmA/O0P9jlF5g5GBOwDVbna8AXhHRu4s27xQf6OkveyA8iTDv1jHdDejgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "eslint-scope": "^5.1.1", + "eslint-visitor-keys": "^2.1.0", + "semver": "^6.3.0" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || >=14.0.0" + }, + "peerDependencies": { + "@babel/core": ">=7.11.0", + "eslint": "^7.5.0 || ^8.0.0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/eslint-parser/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/helper-define-polyfill-provider": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@babel/helper-define-polyfill-provider/-/helper-define-polyfill-provider-0.3.3.tgz", + "integrity": "sha512-z5aQKU4IzbqCC1XH0nAqfsFLMVSo22SBKUc0BxGrLkolTdPTructy0ToNnlO2zA4j9Q/7pjMZf0DSY+DSTYzww==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-compilation-targets": "^7.17.7", + "@babel/helper-plugin-utils": "^7.16.7", + "debug": "^4.1.1", + "lodash.debounce": "^4.0.8", + "resolve": "^1.14.2", + "semver": "^6.1.2" + }, + "peerDependencies": { + "@babel/core": "^7.4.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/helper-define-polyfill-provider/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/plugin-proposal-class-properties": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.16.0.tgz", + "integrity": "sha512-mCF3HcuZSY9Fcx56Lbn+CGdT44ioBMMvjNVldpKtj8tpniETdLjnxdHI1+sDWXIM1nNt+EanJOZ3IG9lzVjs7A==", + "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-create-class-features-plugin": "^7.16.0", + "@babel/helper-plugin-utils": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/plugin-proposal-private-property-in-object": { + "version": "7.21.11", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.11.tgz", + "integrity": "sha512-0QZ8qP/3RLDVBwBFoWAwCtgcDZJVwA5LUJRZU8x2YFfKNuFq161wK3cuGrALu5yiPu+vzwTAg/sMWVNeWeNyaw==", + "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-property-in-object instead.", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-annotate-as-pure": "^7.18.6", + "@babel/helper-create-class-features-plugin": "^7.21.0", + "@babel/helper-plugin-utils": "^7.20.2", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/preset-env": { + "version": "7.16.4", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.16.4.tgz", + "integrity": "sha512-v0QtNd81v/xKj4gNKeuAerQ/azeNn/G1B1qMLeXOcV8+4TWlD2j3NV1u8q29SDFBXx/NBq5kyEAO+0mpRgacjA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.16.4", + "@babel/helper-compilation-targets": "^7.16.3", + "@babel/helper-plugin-utils": "^7.14.5", + "@babel/helper-validator-option": "^7.14.5", + "@babel/plugin-bugfix-safari-id-destructuring-collision-in-function-expression": "^7.16.2", + "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining": "^7.16.0", + "@babel/plugin-proposal-async-generator-functions": "^7.16.4", + "@babel/plugin-proposal-class-properties": "^7.16.0", + "@babel/plugin-proposal-class-static-block": "^7.16.0", + "@babel/plugin-proposal-dynamic-import": "^7.16.0", + "@babel/plugin-proposal-export-namespace-from": "^7.16.0", + "@babel/plugin-proposal-json-strings": "^7.16.0", + "@babel/plugin-proposal-logical-assignment-operators": "^7.16.0", + "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0", + "@babel/plugin-proposal-numeric-separator": "^7.16.0", + "@babel/plugin-proposal-object-rest-spread": "^7.16.0", + "@babel/plugin-proposal-optional-catch-binding": "^7.16.0", + "@babel/plugin-proposal-optional-chaining": "^7.16.0", + "@babel/plugin-proposal-private-methods": "^7.16.0", + "@babel/plugin-proposal-private-property-in-object": "^7.16.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.16.0", + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-class-properties": "^7.12.13", + "@babel/plugin-syntax-class-static-block": "^7.14.5", + "@babel/plugin-syntax-dynamic-import": "^7.8.3", + "@babel/plugin-syntax-export-namespace-from": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.10.4", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.10.4", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-private-property-in-object": "^7.14.5", + "@babel/plugin-syntax-top-level-await": "^7.14.5", + "@babel/plugin-transform-arrow-functions": "^7.16.0", + "@babel/plugin-transform-async-to-generator": "^7.16.0", + "@babel/plugin-transform-block-scoped-functions": "^7.16.0", + "@babel/plugin-transform-block-scoping": "^7.16.0", + "@babel/plugin-transform-classes": "^7.16.0", + "@babel/plugin-transform-computed-properties": "^7.16.0", + "@babel/plugin-transform-destructuring": "^7.16.0", + "@babel/plugin-transform-dotall-regex": "^7.16.0", + "@babel/plugin-transform-duplicate-keys": "^7.16.0", + "@babel/plugin-transform-exponentiation-operator": "^7.16.0", + "@babel/plugin-transform-for-of": "^7.16.0", + "@babel/plugin-transform-function-name": "^7.16.0", + "@babel/plugin-transform-literals": "^7.16.0", + "@babel/plugin-transform-member-expression-literals": "^7.16.0", + "@babel/plugin-transform-modules-amd": "^7.16.0", + "@babel/plugin-transform-modules-commonjs": "^7.16.0", + "@babel/plugin-transform-modules-systemjs": "^7.16.0", + "@babel/plugin-transform-modules-umd": "^7.16.0", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.16.0", + "@babel/plugin-transform-new-target": "^7.16.0", + "@babel/plugin-transform-object-super": "^7.16.0", + "@babel/plugin-transform-parameters": "^7.16.3", + "@babel/plugin-transform-property-literals": "^7.16.0", + "@babel/plugin-transform-regenerator": "^7.16.0", + "@babel/plugin-transform-reserved-words": "^7.16.0", + "@babel/plugin-transform-shorthand-properties": "^7.16.0", + "@babel/plugin-transform-spread": "^7.16.0", + "@babel/plugin-transform-sticky-regex": "^7.16.0", + "@babel/plugin-transform-template-literals": "^7.16.0", + "@babel/plugin-transform-typeof-symbol": "^7.16.0", + "@babel/plugin-transform-unicode-escapes": "^7.16.0", + "@babel/plugin-transform-unicode-regex": "^7.16.0", + "@babel/preset-modules": "^0.1.5", + "@babel/types": "^7.16.0", + "babel-plugin-polyfill-corejs2": "^0.3.0", + "babel-plugin-polyfill-corejs3": "^0.4.0", + "babel-plugin-polyfill-regenerator": "^0.3.0", + "core-js-compat": "^3.19.1", + "semver": "^6.3.0" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/preset-env/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/preset-modules": { + "version": "0.1.6", + "resolved": "https://registry.npmjs.org/@babel/preset-modules/-/preset-modules-0.1.6.tgz", + "integrity": "sha512-ID2yj6K/4lKfhuU3+EX4UvNbIt7eACFbHmNUjzA+ep+B5971CknnA/9DEWKbRokfbbtblxxxXFJJrH47UEAMVg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.0.0", + "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/types": "^7.4.4", + "esutils": "^2.0.2" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/preset-react": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.16.7.tgz", + "integrity": "sha512-fWpyI8UM/HE6DfPBzD8LnhQ/OcH8AgTaqcqP2nGOXEUV+VKBR5JRN9hCk9ai+zQQ57vtm9oWeXguBCPNUjytgA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.16.7", + "@babel/helper-validator-option": "^7.16.7", + "@babel/plugin-transform-react-display-name": "^7.16.7", + "@babel/plugin-transform-react-jsx": "^7.16.7", + "@babel/plugin-transform-react-jsx-development": "^7.16.7", + "@babel/plugin-transform-react-pure-annotations": "^7.16.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/@babel/runtime-corejs3": { + "version": "7.16.8", + "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.16.8.tgz", + "integrity": "sha512-3fKhuICS1lMz0plI5ktOE/yEtBRMVxplzRkdn6mJQ197XiY0JnrzYV0+Mxozq3JZ8SBV9Ecurmw1XsGbwOf+Sg==", "dev": true, + "license": "MIT", "dependencies": { - "@babel/helper-plugin-utils": "^7.27.1", - "@babel/helper-validator-option": "^7.27.1", - "@babel/plugin-transform-react-display-name": "^7.27.1", - "@babel/plugin-transform-react-jsx": "^7.27.1", - "@babel/plugin-transform-react-jsx-development": "^7.27.1", - "@babel/plugin-transform-react-pure-annotations": "^7.27.1" + "core-js-pure": "^3.20.2", + "regenerator-runtime": "^0.13.4" }, "engines": { "node": ">=6.9.0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/babel-plugin-polyfill-corejs2": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.3.3.tgz", + "integrity": "sha512-8hOdmFYFSZhqg2C/JgLUQ+t52o5nirNwaWM2B9LWteozwIvM14VSwdsCAUET10qT+kmySAlseadmfeeSWFCy+Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.17.7", + "@babel/helper-define-polyfill-provider": "^0.3.3", + "semver": "^6.1.1" }, "peerDependencies": { "@babel/core": "^7.0.0-0" } }, - "node_modules/@mat3ra/esse/node_modules/@babel/runtime-corejs3": { - "version": "7.27.1", - "resolved": "https://registry.npmjs.org/@babel/runtime-corejs3/-/runtime-corejs3-7.27.1.tgz", - "integrity": "sha512-909rVuj3phpjW6y0MCXAZ5iNeORePa6ldJvp2baWGcTjwqbBDDz6xoS5JHJ7lS88NlwLYj07ImL/8IUMtDZzTA==", + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/babel-plugin-polyfill-corejs2/node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/babel-plugin-polyfill-corejs3": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs3/-/babel-plugin-polyfill-corejs3-0.4.0.tgz", + "integrity": "sha512-YxFreYwUfglYKdLUGvIF2nJEsGwj+RhWSX/ije3D2vQPOXuyMLMtg/cCGMDpOA7Nd+MwlNdnGODbd2EwUZPlsw==", "dev": true, + "license": "MIT", "dependencies": { - "core-js-pure": "^3.30.2" + "@babel/helper-define-polyfill-provider": "^0.3.0", + "core-js-compat": "^3.18.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/babel-plugin-polyfill-regenerator": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-regenerator/-/babel-plugin-polyfill-regenerator-0.3.1.tgz", + "integrity": "sha512-Y2B06tvgHYt1x0yz17jGkGeeMr5FeKUu+ASJ+N6nB5lQ8Dapfg42i0OVrf8PNGJ3zKL4A23snMi1IRwrqqND7A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-define-polyfill-provider": "^0.3.1" }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", "engines": { - "node": ">=6.9.0" + "node": ">= 6" + } + }, + "node_modules/@mat3ra/esse/node_modules/@mat3ra/utils/node_modules/semver": { + "version": "7.7.3", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.3.tgz", + "integrity": "sha512-SdsKMrI9TdgjdweUSR9MweHA4EJ8YxHn8DFaDisvhVlUOe4BF1tLD7GAj0lIqWVl+dPb/rExr0Btby5loQm20Q==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" } }, "node_modules/@mat3ra/esse/node_modules/ajv": { @@ -3300,6 +3725,13 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, + "node_modules/@mat3ra/esse/node_modules/regenerator-runtime": { + "version": "0.13.11", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.11.tgz", + "integrity": "sha512-kY1AZVr2Ra+t+piVaJ4gxaFaReZVH40AKNo7UCX6W+dEwBo/2oZJzqfuN1qLq1oL45o56cPaTXELwrTh8Fpggg==", + "dev": true, + "license": "MIT" + }, "node_modules/@mat3ra/esse/node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -3309,6 +3741,16 @@ "semver": "bin/semver.js" } }, + "node_modules/@mat3ra/esse/node_modules/source-map": { + "version": "0.5.7", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", + "integrity": "sha512-LbrmJOMUSdEVxIKvdcJzQC+nQhe8FUZQTXQy6+I75skNgn3OoQ0DZA8YnFa7gp8tqtL3KPf1kmo0R5DoApeSGQ==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/@mat3ra/tsconfig": { "version": "2024.6.3-0", "resolved": "https://registry.npmjs.org/@mat3ra/tsconfig/-/tsconfig-2024.6.3-0.tgz", @@ -3643,67 +4085,12 @@ "semver": "bin/semver.js" } }, - "node_modules/@mat3ra/utils/node_modules/complex.js": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.2.tgz", - "integrity": "sha512-qtx7HRhPGSCBtGiST4/WGHuW+zeaND/6Ld+db6PbrulIB1i2Ev/2UPiqcmpQNPSyfBKraC0EOvOKCB5dGZKt3g==", - "dev": true, - "engines": { - "node": "*" - }, - "funding": { - "type": "github", - "url": "https://github.com/sponsors/rawify" - } - }, "node_modules/@mat3ra/utils/node_modules/convert-source-map": { "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", "dev": true }, - "node_modules/@mat3ra/utils/node_modules/decimal.js": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz", - "integrity": "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==", - "dev": true - }, - "node_modules/@mat3ra/utils/node_modules/fraction.js": { - "version": "4.3.4", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", - "integrity": "sha512-pwiTgt0Q7t+GHZA4yaLjObx4vXmmdcS0iSJ19o8d/goUGgItX9UZWKWNnLHehxviD8wU2IWRsnR8cD5+yOJP2Q==", - "dev": true, - "engines": { - "node": "*" - }, - "funding": { - "type": "patreon", - "url": "https://github.com/sponsors/rawify" - } - }, - "node_modules/@mat3ra/utils/node_modules/mathjs": { - "version": "12.4.1", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-12.4.1.tgz", - "integrity": "sha512-welnW3khgwYjPYvECFHO+xkCxAx9IKIIPDDWPi8B5rKAvmgoEHnQX9slEmHKZTNaJiE+OS4qrJJcB4sfDn/4sw==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.24.0", - "complex.js": "^2.1.1", - "decimal.js": "^10.4.3", - "escape-latex": "^1.2.0", - "fraction.js": "4.3.4", - "javascript-natural-sort": "^0.7.1", - "seedrandom": "^3.0.5", - "tiny-emitter": "^2.1.0", - "typed-function": "^4.1.1" - }, - "bin": { - "mathjs": "bin/cli.js" - }, - "engines": { - "node": ">= 18" - } - }, "node_modules/@mat3ra/utils/node_modules/semver": { "version": "7.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", @@ -3725,21 +4112,6 @@ "node": ">=0.10.0" } }, - "node_modules/@mat3ra/utils/node_modules/tiny-emitter": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", - "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", - "dev": true - }, - "node_modules/@mat3ra/utils/node_modules/typed-function": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.1.tgz", - "integrity": "sha512-EGjWssW7Tsk4DGfE+5yluuljS1OGYWiI1J6e8puZz9nTMM51Oug8CD5Zo4gWMsOhq5BI+1bF+rWTm4Vbj3ivRA==", - "dev": true, - "engines": { - "node": ">= 18" - } - }, "node_modules/@nicolo-ribaudo/chokidar-2": { "version": "2.1.8-no-fsevents.3", "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/chokidar-2/-/chokidar-2-2.1.8-no-fsevents.3.tgz", @@ -3887,12 +4259,6 @@ "decimal.js": "^10.0.0" } }, - "node_modules/@types/mathjs/node_modules/decimal.js": { - "version": "10.5.0", - "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.5.0.tgz", - "integrity": "sha512-8vDa8Qxvr/+d94hSh5P3IJwI5t8/c0KsMp+g8bNw9cY2icONa5aPfvKeieW1WlG0WQYwwhJ7mjui2xtiePQSXw==", - "dev": true - }, "node_modules/@types/mocha": { "version": "10.0.10", "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", @@ -5106,6 +5472,20 @@ "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "integrity": "sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==" }, + "node_modules/complex.js": { + "version": "2.4.3", + "resolved": "https://registry.npmjs.org/complex.js/-/complex.js-2.4.3.tgz", + "integrity": "sha512-UrQVSUur14tNX6tiP4y8T4w4FeJAX3bi2cIv0pu/DTLFNxoq7z2Yh83Vfzztj6Px3X/lubqQ9IrPp7Bpn6p4MQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, "node_modules/compute-gcd": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/compute-gcd/-/compute-gcd-1.2.1.tgz", @@ -5240,6 +5620,13 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/decimal.js": { + "version": "10.6.0", + "resolved": "https://registry.npmjs.org/decimal.js/-/decimal.js-10.6.0.tgz", + "integrity": "sha512-YpgQiITW3JXGntzdUmyUR1V812Hn8T1YVXhCu+wO3OpS4eU9l4YdD3qjyiKdV6mvV29zapkMeD390UVEf2lkUg==", + "dev": true, + "license": "MIT" + }, "node_modules/deep-eql": { "version": "4.1.3", "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-4.1.3.tgz", @@ -6638,6 +7025,20 @@ "node": ">=8.0.0" } }, + "node_modules/fraction.js": { + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", + "integrity": "sha512-pwiTgt0Q7t+GHZA4yaLjObx4vXmmdcS0iSJ19o8d/goUGgItX9UZWKWNnLHehxviD8wU2IWRsnR8cD5+yOJP2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "patreon", + "url": "https://github.com/sponsors/rawify" + } + }, "node_modules/fromentries": { "version": "1.3.2", "resolved": "https://registry.npmjs.org/fromentries/-/fromentries-1.3.2.tgz", @@ -8440,6 +8841,30 @@ "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==" }, + "node_modules/mathjs": { + "version": "12.4.1", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-12.4.1.tgz", + "integrity": "sha512-welnW3khgwYjPYvECFHO+xkCxAx9IKIIPDDWPi8B5rKAvmgoEHnQX9slEmHKZTNaJiE+OS4qrJJcB4sfDn/4sw==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/runtime": "^7.24.0", + "complex.js": "^2.1.1", + "decimal.js": "^10.4.3", + "escape-latex": "^1.2.0", + "fraction.js": "4.3.4", + "javascript-natural-sort": "^0.7.1", + "seedrandom": "^3.0.5", + "tiny-emitter": "^2.1.0", + "typed-function": "^4.1.1" + }, + "bin": { + "mathjs": "bin/cli.js" + }, + "engines": { + "node": ">= 18" + } + }, "node_modules/md5": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/md5/-/md5-2.2.1.tgz", @@ -10359,6 +10784,13 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, + "node_modules/tiny-emitter": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/tiny-emitter/-/tiny-emitter-2.1.0.tgz", + "integrity": "sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==", + "dev": true, + "license": "MIT" + }, "node_modules/tinyglobby": { "version": "0.2.15", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.15.tgz", @@ -10617,6 +11049,16 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/typed-function": { + "version": "4.2.2", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.2.2.tgz", + "integrity": "sha512-VwaXim9Gp1bngi/q3do8hgttYn2uC3MoT/gfuMWylnj1IeZBUAyPddHZlo1K05BDoj8DYPpMdiHqH1dDYdJf2A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 18" + } + }, "node_modules/typedarray-to-buffer": { "version": "3.1.5", "resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz", diff --git a/package.json b/package.json index 02ed8fe24..b669ac7ee 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,8 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "2025.10.8-0", - "@mat3ra/esse": "2025.10.8-0", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", + "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", "@types/crypto-js": "^4.2.2", diff --git a/src/js/basis/basis.ts b/src/js/basis/basis.ts index 8eda33d18..4433b8dc5 100644 --- a/src/js/basis/basis.ts +++ b/src/js/basis/basis.ts @@ -7,7 +7,7 @@ import { chain, toPairs, uniq, values } from "lodash"; import { Cell } from "../cell/cell"; import { ATOMIC_COORD_UNITS, HASH_TOLERANCE } from "../constants"; import { nonPeriodicLatticeScalingFactor } from "../lattice/lattice"; -import math from "../math"; +import { math } from "@mat3ra/code/dist/js/math"; import { AtomicCoordinateValue, Coordinates } from "./coordinates"; import { AtomicElementValue, Elements } from "./elements"; import { AtomicLabelValue, Labels } from "./labels"; diff --git a/src/js/basis/coordinates.ts b/src/js/basis/coordinates.ts index ded014d5d..b6b881383 100644 --- a/src/js/basis/coordinates.ts +++ b/src/js/basis/coordinates.ts @@ -1,4 +1,5 @@ import { RoundedArrayWithIds, RoundedValueWithId, RoundedVector3D, Vector3D } from "@mat3ra/code"; +import { math } from "@mat3ra/code/dist/js/math"; import { AtomicCoordinateSchema, Coordinate3DSchema, @@ -7,8 +8,6 @@ import { } from "@mat3ra/esse/dist/js/types"; import { sprintf } from "underscore.string"; -import math from "../math"; - export type AtomicCoordinateValue = AtomicCoordinateSchema["value"]; type AxisType = "x" | "y" | "z"; diff --git a/src/js/cell/primitive_cell.ts b/src/js/cell/primitive_cell.ts index d89a1315b..80352547b 100644 --- a/src/js/cell/primitive_cell.ts +++ b/src/js/cell/primitive_cell.ts @@ -1,7 +1,6 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { LatticeSchema, Matrix3X3Schema } from "@mat3ra/esse/dist/js/types"; -import math from "../math"; - /** * Routines for calculating primitive cell vectors from conventional cell Bravais parameters. * Following Setyawan, W., & Curtarolo, S. (2010). doi:10.1016/j.commatsci.2010.05.010 diff --git a/src/js/lattice/lattice.ts b/src/js/lattice/lattice.ts index 5c5d43294..de674c79d 100644 --- a/src/js/lattice/lattice.ts +++ b/src/js/lattice/lattice.ts @@ -1,5 +1,6 @@ import { HASH_TOLERANCE } from "@mat3ra/code/dist/js/constants"; import { InMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { math } from "@mat3ra/code/dist/js/math"; import { Coordinate3DSchema, LatticeSchema, @@ -12,7 +13,6 @@ import * as lodash from "lodash"; import { Cell } from "../cell/cell"; import { getPrimitiveLatticeVectorsFromConfig } from "../cell/primitive_cell"; -import math from "../math"; import { LATTICE_TYPE_CONFIGS } from "./lattice_types"; import { UnitCell, UnitCellProps } from "./unit_cell"; diff --git a/src/js/lattice/reciprocal/lattice_reciprocal.ts b/src/js/lattice/reciprocal/lattice_reciprocal.ts index 35b734b81..1c15bd32c 100644 --- a/src/js/lattice/reciprocal/lattice_reciprocal.ts +++ b/src/js/lattice/reciprocal/lattice_reciprocal.ts @@ -1,8 +1,8 @@ import { ATOMIC_COORD_UNITS, units as UNITS } from "@mat3ra/code/dist/js/constants"; +import { math } from "@mat3ra/code/dist/js/math"; import { Vector3DSchema } from "@mat3ra/esse/dist/js/types"; import lodash from "lodash"; -import math from "../../math"; import { Lattice } from "../lattice"; import { paths } from "./paths"; import { symmetryPoints } from "./symmetry_points"; diff --git a/src/js/made.ts b/src/js/made.ts index 68904d700..6f367264a 100644 --- a/src/js/made.ts +++ b/src/js/made.ts @@ -7,7 +7,6 @@ import { DEFAULT_LATTICE_UNITS, LATTICE_TYPE_CONFIGS } from "./lattice/lattice_t import { ReciprocalLattice } from "./lattice/reciprocal/lattice_reciprocal"; import { UnitCell } from "./lattice/unit_cell"; import { defaultMaterialConfig, Material } from "./material"; -import MadeMath from "./math"; import parsers from "./parsers/parsers"; import tools from "./tools/index"; @@ -16,7 +15,6 @@ export const Made = { tolerance, units, ATOMIC_COORD_UNITS, - math: MadeMath, Material, defaultMaterialConfig, diff --git a/src/js/material.ts b/src/js/material.ts index 907587fea..d09ae1243 100644 --- a/src/js/material.ts +++ b/src/js/material.ts @@ -19,10 +19,9 @@ type MaterialSchemaWithConsistencyChecksAsString = Omit & Materia export type OptionallyConstrainedBasisConfig = BasisConfig & Partial>; -type Base = InMemoryEntity & NamedInMemoryEntity; +type Base = InMemoryEntity & NamedEntity; export function materialMixin(item: T) { const originalToJSON = item.toJSON.bind(item); diff --git a/src/js/math.ts b/src/js/math.ts deleted file mode 100644 index 5eaba1e07..000000000 --- a/src/js/math.ts +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: adjust the imports and remove the need for re-exporting -import { math } from "@mat3ra/code/dist/js/math"; - -export default { - ...math, -}; diff --git a/src/js/parsers/poscar.ts b/src/js/parsers/poscar.ts index b77508367..aded6af40 100644 --- a/src/js/parsers/poscar.ts +++ b/src/js/parsers/poscar.ts @@ -1,3 +1,4 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { BasisSchema, Coordinate3DSchema, @@ -13,7 +14,6 @@ import { Cell } from "../cell/cell"; import { ATOMIC_COORD_UNITS } from "../constants"; import { AtomicConstraintValue } from "../constraints/constraints"; import { Lattice } from "../lattice/lattice"; -import math from "../math"; const _print = (x: number, printFormat = "%14.9f") => s.sprintf(printFormat, math.precise(x)); const _latticeVectorsToString = (vectors: Vector3DSchema[]) => diff --git a/src/js/parsers/xyz_combinatorial_basis.ts b/src/js/parsers/xyz_combinatorial_basis.ts index e2fc29e7c..a17d02e17 100644 --- a/src/js/parsers/xyz_combinatorial_basis.ts +++ b/src/js/parsers/xyz_combinatorial_basis.ts @@ -1,3 +1,4 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { BasisSchema } from "@mat3ra/esse/dist/js/types"; import { chain, last, map } from "lodash"; import * as s from "underscore.string"; @@ -6,7 +7,6 @@ import { ElementsAndCoordinatesConfig } from "../basis/basis"; import { AtomicCoordinateValue } from "../basis/coordinates"; import { AtomicElementValue } from "../basis/elements"; import { Cell } from "../cell/cell"; -import math from "../math"; /** * @summary Combinatorial XYZ basis class and related. Create and get all information about basis and elements in it. diff --git a/src/js/tools/basis.ts b/src/js/tools/basis.ts index 76a903ea9..93104c499 100644 --- a/src/js/tools/basis.ts +++ b/src/js/tools/basis.ts @@ -1,9 +1,9 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { Coordinate3DSchema } from "@mat3ra/esse/dist/js/types"; import { chunk, flatten } from "lodash"; import { Basis } from "../basis/basis"; import { AtomicCoordinateValue, Coordinate } from "../basis/coordinates"; -import math from "../math"; const ADD = math.add; const MULT = math.multiply; diff --git a/src/js/tools/cell.ts b/src/js/tools/cell.ts index 684f937ec..cfe9474bd 100644 --- a/src/js/tools/cell.ts +++ b/src/js/tools/cell.ts @@ -1,7 +1,7 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { Coordinate3DSchema, Matrix3X3Schema } from "@mat3ra/esse/dist/js/types"; import { Cell } from "../cell/cell"; -import math from "../math"; /** * Returns the list of points on the original lattice contained in the supercell in fractional coordinates. diff --git a/src/js/tools/supercell.ts b/src/js/tools/supercell.ts index c08325da3..0ebc03143 100644 --- a/src/js/tools/supercell.ts +++ b/src/js/tools/supercell.ts @@ -1,3 +1,4 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { Coordinate3DSchema, Matrix3X3Schema } from "@mat3ra/esse/dist/js/types"; import { Basis } from "../basis/basis"; @@ -5,7 +6,6 @@ import { ConstrainedBasis } from "../basis/constrained_basis"; import { Cell } from "../cell/cell"; import { Lattice } from "../lattice/lattice"; import type { Material } from "../material"; -import math from "../math"; import cellTools from "./cell"; const ADD = math.add; diff --git a/src/js/tools/surface.ts b/src/js/tools/surface.ts index c8c28a450..c20410218 100644 --- a/src/js/tools/surface.ts +++ b/src/js/tools/surface.ts @@ -1,3 +1,4 @@ +import { math } from "@mat3ra/code/dist/js/math"; import { Coordinate3DSchema, MaterialSchema, @@ -8,7 +9,6 @@ import { import { Cell } from "../cell/cell"; import { Lattice } from "../lattice/lattice"; import { Material } from "../material"; -import math from "../math"; import SupercellTools from "./supercell"; const MULT = math.multiply; From 0c8354349e6729ba09740d8c62f4734ad9bc122e Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Thu, 27 Nov 2025 22:54:06 +0200 Subject: [PATCH 2/9] fix: materials --- dist/js/basis/basis.js | 2 +- dist/js/material.d.ts | 10 ++- dist/js/material.js | 17 +++-- dist/js/materialMixin.d.ts | 153 +++++-------------------------------- dist/js/materialMixin.js | 14 ++-- package-lock.json | 6 +- package.json | 2 +- src/js/basis/basis.ts | 2 +- src/js/material.ts | 41 +++++++--- src/js/materialMixin.ts | 62 ++++++++++++--- 10 files changed, 130 insertions(+), 179 deletions(-) diff --git a/dist/js/basis/basis.js b/dist/js/basis/basis.js index b01e084cc..716894ffb 100644 --- a/dist/js/basis/basis.js +++ b/dist/js/basis/basis.js @@ -4,11 +4,11 @@ exports.Basis = void 0; // @ts-ignore const periodic_table_js_1 = require("@exabyte-io/periodic-table.js"); const entity_1 = require("@mat3ra/code/dist/js/entity"); +const math_1 = require("@mat3ra/code/dist/js/math"); const lodash_1 = require("lodash"); const cell_1 = require("../cell/cell"); const constants_1 = require("../constants"); const lattice_1 = require("../lattice/lattice"); -const math_1 = require("@mat3ra/code/dist/js/math"); const coordinates_1 = require("./coordinates"); const elements_1 = require("./elements"); const labels_1 = require("./labels"); diff --git a/dist/js/material.d.ts b/dist/js/material.d.ts index 8c755e6b1..5f6cc1905 100644 --- a/dist/js/material.d.ts +++ b/dist/js/material.d.ts @@ -1,14 +1,16 @@ -import { HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { InMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { type DefaultableInMemoryEntityConstructor } from "@mat3ra/code/dist/js/entity/mixins/DefaultableMixin"; +import { HasConsistencyChecksInMemoryEntityConstructor } from "@mat3ra/code/dist/js/entity/mixins/HasConsistencyChecksMixin"; +import { type HasMetadataInMemoryEntityConstructor } from "@mat3ra/code/dist/js/entity/mixins/HasMetadataMixin"; +import { type NamedInMemoryEntityConstructor } from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin"; import type { ConsistencyCheck, MaterialSchema } from "@mat3ra/esse/dist/js/types"; import { type MaterialMixinConstructor, defaultMaterialConfig } from "./materialMixin"; export { defaultMaterialConfig }; -declare const BaseInMemoryEntity: typeof HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity; -type BaseMaterial = MaterialMixinConstructor & typeof BaseInMemoryEntity; +type BaseMaterial = typeof InMemoryEntity & HasConsistencyChecksInMemoryEntityConstructor & DefaultableInMemoryEntityConstructor & HasMetadataInMemoryEntityConstructor & NamedInMemoryEntityConstructor & MaterialMixinConstructor; type MaterialSchemaWithConsistencyChecksAsString = Omit & { consistencyChecks?: ConsistencyCheck[]; }; type Schema = MaterialSchemaWithConsistencyChecksAsString; declare const Material_base: BaseMaterial; export declare class Material extends Material_base implements Schema { - constructor(config: MaterialSchema); } diff --git a/dist/js/material.js b/dist/js/material.js index f503cbc9f..7ae00cf10 100644 --- a/dist/js/material.js +++ b/dist/js/material.js @@ -2,14 +2,17 @@ Object.defineProperty(exports, "__esModule", { value: true }); exports.Material = exports.defaultMaterialConfig = void 0; const entity_1 = require("@mat3ra/code/dist/js/entity"); +const DefaultableMixin_1 = require("@mat3ra/code/dist/js/entity/mixins/DefaultableMixin"); +const HasConsistencyChecksMixin_1 = require("@mat3ra/code/dist/js/entity/mixins/HasConsistencyChecksMixin"); +const HasMetadataMixin_1 = require("@mat3ra/code/dist/js/entity/mixins/HasMetadataMixin"); +const NamedEntityMixin_1 = require("@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin"); const materialMixin_1 = require("./materialMixin"); Object.defineProperty(exports, "defaultMaterialConfig", { enumerable: true, get: function () { return materialMixin_1.defaultMaterialConfig; } }); -const BaseInMemoryEntity = entity_1.HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity; -class Material extends BaseInMemoryEntity { - constructor(config) { - super(config); - (0, materialMixin_1.materialMixin)(this); - } +class Material extends entity_1.InMemoryEntity { } exports.Material = Material; -(0, materialMixin_1.materialMixinStaticProps)(Material); +(0, NamedEntityMixin_1.namedEntityMixin)(Material.prototype); +(0, DefaultableMixin_1.defaultableEntityMixin)(Material); +(0, HasConsistencyChecksMixin_1.hasConsistencyChecksMixin)(Material.prototype); +(0, HasMetadataMixin_1.hasMetadataMixin)(Material.prototype); +(0, materialMixin_1.materialMixin)(Material); diff --git a/dist/js/materialMixin.d.ts b/dist/js/materialMixin.d.ts index 61c04ab7b..b03e6def9 100644 --- a/dist/js/materialMixin.d.ts +++ b/dist/js/materialMixin.d.ts @@ -5,167 +5,52 @@ import type { AnyObject } from "@mat3ra/esse/dist/js/esse/types"; import type { AtomicConstraintsSchema, ConsistencyCheck, DerivedPropertiesSchema, FileSourceSchema, LatticeSchema, MaterialSchema } from "@mat3ra/esse/dist/js/types"; import type { BasisConfig } from "./basis/basis"; import { type ConstrainedBasisConfig, ConstrainedBasis } from "./basis/constrained_basis"; +import type { AtomicElementValue } from "./basis/elements"; import { Constraint } from "./constraints/constraints"; import { Lattice } from "./lattice/lattice"; export declare const defaultMaterialConfig: MaterialSchema; export interface MaterialSchemaJSON extends MaterialSchema, AnyObject { } -export type MaterialMixinProps = ReturnType; -type MaterialMixinStaticProps = ReturnType; -export type MaterialInMemoryEntity = InMemoryEntity & MaterialMixinProps; -export type MaterialMixinConstructor = Constructor & MaterialMixinStaticProps; -export type OptionallyConstrainedBasisConfig = BasisConfig & Partial>; -type Base = InMemoryEntity & NamedEntity; -export declare function materialMixin(item: T): { - toJSON(): MaterialSchema; +export type MaterialMixinProps = { + toJSON(): MaterialSchema & AnyObject; name: string; src: FileSourceSchema | undefined; updateFormula(): void; - /** - * Gets Bolean value for whether or not a material is non-periodic vs periodic. - * False = periodic, True = non-periodic - */ isNonPeriodic: boolean; - /** - * @summary Returns the specific derived property (as specified by name) for a material. - */ - getDerivedPropertyByName(name: string): { - name?: "volume" | undefined; - units?: "angstrom^3" | undefined; - value: number; - } | { - name?: "density" | undefined; - units?: "g/cm^3" | undefined; - value: number; - } | { - pointGroupSymbol?: string | undefined; - spaceGroupSymbol?: string | undefined; - tolerance?: { - units?: "angstrom" | undefined; - value: number; - } | undefined; - name?: "symmetry" | undefined; - } | { - name?: "elemental_ratio" | undefined; - value: number; - element?: string | undefined; - } | { - name?: "p-norm" | undefined; - degree?: number | undefined; - value: number; - } | { - name?: "inchi" | undefined; - value: string; - } | { - name?: "inchi_key" | undefined; - value: string; - } | undefined; - /** - * @summary Returns the derived properties array for a material. - */ + getDerivedPropertyByName(name: string): DerivedPropertiesSchema[0] | undefined; getDerivedProperties(): DerivedPropertiesSchema; - /** - * Gets material's formula - */ - readonly formula: string; - readonly unitCellFormula: string; + formula: string; + unitCellFormula: string; unsetFileProps(): void; - /** - * @param textOrObject Basis text or JSON object. - * @param format Format (xyz, etc.) - * @param unitz crystal/cartesian - */ setBasis(textOrObject: string | BasisConfig, format?: string, unitz?: string): void; setBasisConstraints(constraints: Constraint[]): void; setBasisConstraintsFromArrayOfObjects(constraints: AtomicConstraintsSchema): void; - readonly basis: OptionallyConstrainedBasisConfig; - readonly Basis: ConstrainedBasis; - /** - * High-level access to unique elements from material instead of basis. - */ - readonly uniqueElements: ("H" | "He" | "Li" | "Be" | "B" | "C" | "N" | "O" | "F" | "Ne" | "Na" | "Mg" | "Al" | "Si" | "P" | "S" | "Cl" | "Ar" | "K" | "Ca" | "Sc" | "Ti" | "V" | "Cr" | "Mn" | "Fe" | "Co" | "Ni" | "Cu" | "Zn" | "Ga" | "Ge" | "As" | "Se" | "Br" | "Kr" | "Rb" | "Sr" | "Y" | "Zr" | "Nb" | "Mo" | "Tc" | "Ru" | "Rh" | "Pd" | "Ag" | "Cd" | "In" | "Sn" | "Sb" | "Te" | "I" | "Xe" | "Cs" | "Ba" | "La" | "Ce" | "Pr" | "Nd" | "Pm" | "Sm" | "Eu" | "Gd" | "Tb" | "Dy" | "Ho" | "Er" | "Tm" | "Yb" | "Lu" | "Hf" | "Ta" | "W" | "Re" | "Os" | "Ir" | "Pt" | "Au" | "Hg" | "Tl" | "Pb" | "Bi" | "Po" | "At" | "Rn" | "Fr" | "Ra" | "Ac" | "Th" | "Pa" | "U" | "Np" | "Pu" | "Am" | "Cm" | "Bk" | "Cf" | "Es" | "Fm" | "Md" | "No" | "Lr" | "Rf" | "Db" | "Sg" | "Bh" | "Hs" | "Mt" | "Ds" | "Rg" | "Cn" | "Nh" | "Fl" | "Mc" | "Lv" | "Ts" | "Og" | "X" | "Vac")[]; + basis: OptionallyConstrainedBasisConfig; + Basis: ConstrainedBasis; + uniqueElements: AtomicElementValue[]; lattice: LatticeSchema; - readonly Lattice: Lattice; - /** - * Returns the inchi string from the derivedProperties for a non-periodic material, or throws an error if the - * inchi cannot be found. - * @returns {String} - */ + Lattice: Lattice; getInchiStringForHash(): string; - /** - * Calculates hash from basis and lattice. Algorithm expects the following: - * - asserts lattice units to be angstrom - * - asserts basis units to be crystal - * - asserts basis coordinates and lattice measurements are rounded to hash precision - * - forms strings for lattice and basis - * - creates MD5 hash from basisStr + latticeStr + salt - * @param salt Salt for hashing, empty string by default. - * @param isScaled Whether to scale the lattice parameter 'a' to 1. - */ calculateHash(salt?: string, isScaled?: boolean, bypassNonPeriodicCheck?: boolean): string; hash: string; - /** - * Calculates hash from basis and lattice as above + scales lattice properties to make lattice.a = 1 - */ - readonly scaledHash: string; - external: { - id: string | number; - source: "MaterialsProject" | "MaterialsProjectLegacy" | "ICSD" | "2dmatpedia"; - origin: boolean; - data?: {} | undefined; - doi?: string | undefined; - url?: string | undefined; - } | undefined; - /** - * Converts basis to crystal/fractional coordinates. - */ + get scaledHash(): string; + external: MaterialSchema["external"]; toCrystal(): void; - /** - * Converts current material's basis coordinates to cartesian. - * No changes if coordinates already cartesian. - */ toCartesian(): void; - /** - * Returns material's basis in XYZ format. - */ getBasisAsXyz(fractional?: boolean): string; - /** - * Returns material in Quantum Espresso output format: - * ``` - * CELL_PARAMETERS (angstroms) - * -0.543131284 -0.000000000 0.543131284 - * -0.000000000 0.543131284 0.543131284 - * -0.543131284 0.543131284 0.000000000 - * - * ATOMIC_POSITIONS (crystal) - * Si 0.000000000 0.000000000 -0.000000000 - * Si 0.250000000 0.250000000 0.250000000 - * ``` - */ getAsQEFormat(): string; - /** - * Returns material in POSCAR format. Pass `true` to ignore original poscar source and re-serialize. - */ getAsPOSCAR(ignoreOriginal?: boolean, omitConstraints?: boolean): string; - /** - * Returns a copy of the material with conventional cell constructed instead of primitive. - */ getACopyWithConventionalCell(): T; - /** - * @summary a series of checks for the material and returns an array of results in ConsistencyChecks format. - * @returns Array of checks results - */ getConsistencyChecks(): ConsistencyCheck[]; - /** - * @summary a series of checks for the material's basis and returns an array of results in ConsistencyChecks format. - * @returns Array of checks results - */ getBasisConsistencyChecks(): ConsistencyCheck[]; -} & { - _json: MaterialSchemaJSON; }; -export declare function materialMixinStaticProps>(item: T): { - readonly defaultConfig: MaterialSchema; +type MaterialMixinStaticProps = { + defaultConfig: MaterialSchema; constructMaterialFileSource(fileName: string, fileContent: string, fileExtension: string): FileSourceSchema; }; +export type MaterialInMemoryEntity = InMemoryEntity & MaterialMixinProps; +export type MaterialMixinConstructor = Constructor & MaterialMixinStaticProps; +type OptionallyConstrainedBasisConfig = BasisConfig & Partial>; +type Base = InMemoryEntity & NamedEntity; +export declare function materialMixin>(item: T): void; export {}; diff --git a/dist/js/materialMixin.js b/dist/js/materialMixin.js index a1fc6c65d..712a5d5e9 100644 --- a/dist/js/materialMixin.js +++ b/dist/js/materialMixin.js @@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); -exports.materialMixinStaticProps = exports.materialMixin = exports.defaultMaterialConfig = void 0; +exports.materialMixin = exports.defaultMaterialConfig = void 0; const crypto_js_1 = __importDefault(require("crypto-js")); const constrained_basis_1 = require("./basis/constrained_basis"); const conventional_cell_1 = require("./cell/conventional_cell"); @@ -51,8 +51,9 @@ exports.defaultMaterialConfig = { }, }, }; -function materialMixin(item) { +function materialPropertiesMixin(item) { const originalToJSON = item.toJSON.bind(item); + // @ts-expect-error const properties = { toJSON() { return { @@ -340,9 +341,7 @@ function materialMixin(item) { }, }; Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); - return properties; } -exports.materialMixin = materialMixin; function materialMixinStaticProps(item) { const properties = { get defaultConfig() { @@ -358,6 +357,9 @@ function materialMixinStaticProps(item) { }, }; Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); - return properties; } -exports.materialMixinStaticProps = materialMixinStaticProps; +function materialMixin(item) { + materialPropertiesMixin(item.prototype); + materialMixinStaticProps(item); +} +exports.materialMixin = materialMixin; diff --git a/package-lock.json b/package-lock.json index 96d8d0a18..4a95928b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", @@ -2866,8 +2866,8 @@ }, "node_modules/@mat3ra/code": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", - "integrity": "sha512-uhE+7eKKL/r7K+TDgO9THVsYZ0a3Vxfvmga2MZOI3yZJYDrOqAO62T6EGfmoEX0IixXEPe87aO/9jP07SVm4DA==", + "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", + "integrity": "sha512-z/9Bipd5XEKBj3/KqxuB4XHshxEkVrmLp41NOwVf96ny9two9lpUapkpzFWdM5uypYm76au04//p59Oo7GWRPQ==", "dev": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index b669ac7ee..62f4e5f95 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#19c904dcdae87b83f88b38c756abd746e2bd7927", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", diff --git a/src/js/basis/basis.ts b/src/js/basis/basis.ts index 4433b8dc5..3158cf0af 100644 --- a/src/js/basis/basis.ts +++ b/src/js/basis/basis.ts @@ -1,13 +1,13 @@ // @ts-ignore import { getElectronegativity, getElementAtomicRadius } from "@exabyte-io/periodic-table.js"; import { InMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { math } from "@mat3ra/code/dist/js/math"; import { BasisSchema, Coordinate3DSchema, Vector3DSchema } from "@mat3ra/esse/dist/js/types"; import { chain, toPairs, uniq, values } from "lodash"; import { Cell } from "../cell/cell"; import { ATOMIC_COORD_UNITS, HASH_TOLERANCE } from "../constants"; import { nonPeriodicLatticeScalingFactor } from "../lattice/lattice"; -import { math } from "@mat3ra/code/dist/js/math"; import { AtomicCoordinateValue, Coordinates } from "./coordinates"; import { AtomicElementValue, Elements } from "./elements"; import { AtomicLabelValue, Labels } from "./labels"; diff --git a/src/js/material.ts b/src/js/material.ts index d09ae1243..53aca2b66 100644 --- a/src/js/material.ts +++ b/src/js/material.ts @@ -1,18 +1,36 @@ -import { HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { InMemoryEntity } from "@mat3ra/code/dist/js/entity"; +import { + type DefaultableInMemoryEntityConstructor, + defaultableEntityMixin, +} from "@mat3ra/code/dist/js/entity/mixins/DefaultableMixin"; +import { + HasConsistencyChecksInMemoryEntityConstructor, + hasConsistencyChecksMixin, +} from "@mat3ra/code/dist/js/entity/mixins/HasConsistencyChecksMixin"; +import { + type HasMetadataInMemoryEntityConstructor, + hasMetadataMixin, +} from "@mat3ra/code/dist/js/entity/mixins/HasMetadataMixin"; +import { + type NamedInMemoryEntityConstructor, + namedEntityMixin, +} from "@mat3ra/code/dist/js/entity/mixins/NamedEntityMixin"; import type { ConsistencyCheck, MaterialSchema } from "@mat3ra/esse/dist/js/types"; import { type MaterialMixinConstructor, defaultMaterialConfig, materialMixin, - materialMixinStaticProps, } from "./materialMixin"; export { defaultMaterialConfig }; -const BaseInMemoryEntity = HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity; - -type BaseMaterial = MaterialMixinConstructor & typeof BaseInMemoryEntity; +type BaseMaterial = typeof InMemoryEntity & + HasConsistencyChecksInMemoryEntityConstructor & + DefaultableInMemoryEntityConstructor & + HasMetadataInMemoryEntityConstructor & + NamedInMemoryEntityConstructor & + MaterialMixinConstructor; // TODO: remove in-line type creation type MaterialSchemaWithConsistencyChecksAsString = Omit & { @@ -21,11 +39,10 @@ type MaterialSchemaWithConsistencyChecksAsString = Omit; -type MaterialMixinStaticProps = ReturnType; +export type MaterialMixinProps = { + toJSON(): MaterialSchema & AnyObject; + name: string; + src: FileSourceSchema | undefined; + updateFormula(): void; + isNonPeriodic: boolean; + getDerivedPropertyByName(name: string): DerivedPropertiesSchema[0] | undefined; + getDerivedProperties(): DerivedPropertiesSchema; + formula: string; + unitCellFormula: string; + unsetFileProps(): void; + setBasis(textOrObject: string | BasisConfig, format?: string, unitz?: string): void; + setBasisConstraints(constraints: Constraint[]): void; + setBasisConstraintsFromArrayOfObjects(constraints: AtomicConstraintsSchema): void; + basis: OptionallyConstrainedBasisConfig; + Basis: ConstrainedBasis; + uniqueElements: AtomicElementValue[]; + lattice: LatticeSchema; + Lattice: Lattice; + getInchiStringForHash(): string; + calculateHash(salt?: string, isScaled?: boolean, bypassNonPeriodicCheck?: boolean): string; + hash: string; + get scaledHash(): string; + external: MaterialSchema["external"]; + toCrystal(): void; + toCartesian(): void; + getBasisAsXyz(fractional?: boolean): string; + getAsQEFormat(): string; + getAsPOSCAR(ignoreOriginal?: boolean, omitConstraints?: boolean): string; + getACopyWithConventionalCell(): T; + getConsistencyChecks(): ConsistencyCheck[]; + getBasisConsistencyChecks(): ConsistencyCheck[]; +}; +type MaterialMixinStaticProps = { + defaultConfig: MaterialSchema; + constructMaterialFileSource( + fileName: string, + fileContent: string, + fileExtension: string, + ): FileSourceSchema; +}; export type MaterialInMemoryEntity = InMemoryEntity & MaterialMixinProps; export type MaterialMixinConstructor = Constructor & MaterialMixinStaticProps; -export type OptionallyConstrainedBasisConfig = BasisConfig & +type OptionallyConstrainedBasisConfig = BasisConfig & Partial>; type Base = InMemoryEntity & NamedEntity; -export function materialMixin(item: T) { +function materialPropertiesMixin(item: T) { const originalToJSON = item.toJSON.bind(item); - const properties = { - toJSON(): MaterialSchema { + // @ts-expect-error + const properties: MaterialMixinProps & InMemoryEntity & NamedEntity = { + toJSON(): MaterialSchema & AnyObject { return { ...originalToJSON(), lattice: this.Lattice.toJSON(), @@ -423,11 +464,9 @@ export function materialMixin(item: T) { }; Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); - - return properties as typeof properties & { _json: MaterialSchemaJSON }; } -export function materialMixinStaticProps>(item: T) { +function materialMixinStaticProps>(item: T) { const properties = { get defaultConfig() { return defaultMaterialConfig; @@ -448,6 +487,9 @@ export function materialMixinStaticProps>(item: T) { }; Object.defineProperties(item, Object.getOwnPropertyDescriptors(properties)); +} - return properties; +export function materialMixin>(item: T) { + materialPropertiesMixin(item.prototype); + materialMixinStaticProps(item); } From 129efd8757586eee241e00c840ce9f4730f869fc Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Fri, 28 Nov 2025 14:31:00 +0200 Subject: [PATCH 3/9] chore: declare correct types for createDefault --- dist/js/material.d.ts | 1 + src/js/material.ts | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/dist/js/material.d.ts b/dist/js/material.d.ts index 5f6cc1905..49e7fc9e0 100644 --- a/dist/js/material.d.ts +++ b/dist/js/material.d.ts @@ -13,4 +13,5 @@ type MaterialSchemaWithConsistencyChecksAsString = Omit Material; } diff --git a/src/js/material.ts b/src/js/material.ts index 53aca2b66..014a51aad 100644 --- a/src/js/material.ts +++ b/src/js/material.ts @@ -39,7 +39,9 @@ type MaterialSchemaWithConsistencyChecksAsString = Omit Material; +} namedEntityMixin(Material.prototype); defaultableEntityMixin(Material); From f803366d24a524861f4336dee22ae29c4757edd9 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Fri, 28 Nov 2025 17:37:13 +0200 Subject: [PATCH 4/9] chore: improve materials metadata types --- dist/js/material.d.ts | 2 +- package-lock.json | 12 ++++++------ package.json | 4 ++-- src/js/material.ts | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/dist/js/material.d.ts b/dist/js/material.d.ts index 49e7fc9e0..f410bfb02 100644 --- a/dist/js/material.d.ts +++ b/dist/js/material.d.ts @@ -6,7 +6,7 @@ import { type NamedInMemoryEntityConstructor } from "@mat3ra/code/dist/js/entity import type { ConsistencyCheck, MaterialSchema } from "@mat3ra/esse/dist/js/types"; import { type MaterialMixinConstructor, defaultMaterialConfig } from "./materialMixin"; export { defaultMaterialConfig }; -type BaseMaterial = typeof InMemoryEntity & HasConsistencyChecksInMemoryEntityConstructor & DefaultableInMemoryEntityConstructor & HasMetadataInMemoryEntityConstructor & NamedInMemoryEntityConstructor & MaterialMixinConstructor; +type BaseMaterial = typeof InMemoryEntity & HasConsistencyChecksInMemoryEntityConstructor & DefaultableInMemoryEntityConstructor & HasMetadataInMemoryEntityConstructor & NamedInMemoryEntityConstructor & MaterialMixinConstructor; type MaterialSchemaWithConsistencyChecksAsString = Omit & { consistencyChecks?: ConsistencyCheck[]; }; diff --git a/package-lock.json b/package-lock.json index 4a95928b8..ba53c6c4b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,8 +31,8 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", - "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", + "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#ac95943050a0b887d22b62e303cafa13c04edc8c", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", "@types/crypto-js": "^4.2.2", @@ -2866,8 +2866,8 @@ }, "node_modules/@mat3ra/code": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", - "integrity": "sha512-z/9Bipd5XEKBj3/KqxuB4XHshxEkVrmLp41NOwVf96ny9two9lpUapkpzFWdM5uypYm76au04//p59Oo7GWRPQ==", + "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", + "integrity": "sha512-4j0uYpGx9dloxeN4toQsPrV5oDr1T2tjYOnXiFm/JftrTmmU6yTorSmL5ATTIvw3V/MFQLwlNPpO61czbFIv6g==", "dev": true, "license": "Apache-2.0", "dependencies": { @@ -2960,8 +2960,8 @@ }, "node_modules/@mat3ra/esse": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/Exabyte-io/esse.git#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", - "integrity": "sha512-9n1FTk0n5xg0xf2gIPRjcv37OaoUeg4jzAxeBWB2neVsXn4xDJxfdGDcWVLo/2HnLAA0tC93ufx/T26pUSH8Aw==", + "resolved": "git+ssh://git@github.com/Exabyte-io/esse.git#ac95943050a0b887d22b62e303cafa13c04edc8c", + "integrity": "sha512-WmTLKfNOeSocISOK3K9b8/NxnskTnoE5meirHNuLB8W9aJKEyGo1wMb3B1tmSFZACbvS/5xMBvq6NlwD5yY4Ug==", "dev": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 62f4e5f95..6bf95ffc5 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,8 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#5803c543e812727ad32dffefd1426497694a427b", - "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#9cd6ac3b66837a45011974e2c637ca8e8a2d6c41", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", + "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#ac95943050a0b887d22b62e303cafa13c04edc8c", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", "@types/crypto-js": "^4.2.2", diff --git a/src/js/material.ts b/src/js/material.ts index 014a51aad..d62bba11c 100644 --- a/src/js/material.ts +++ b/src/js/material.ts @@ -28,7 +28,7 @@ export { defaultMaterialConfig }; type BaseMaterial = typeof InMemoryEntity & HasConsistencyChecksInMemoryEntityConstructor & DefaultableInMemoryEntityConstructor & - HasMetadataInMemoryEntityConstructor & + HasMetadataInMemoryEntityConstructor & NamedInMemoryEntityConstructor & MaterialMixinConstructor; From a3b5f329e1cb7b292d5f3d555c970ad211931712 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 5 Jan 2026 22:42:24 +0200 Subject: [PATCH 5/9] chore: improve types --- dist/js/lattice/reciprocal/lattice_reciprocal.d.ts | 6 ++---- dist/js/lattice/reciprocal/lattice_reciprocal.js | 2 -- src/js/lattice/reciprocal/lattice_reciprocal.ts | 10 ++++------ 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts index 59551a6ed..5725ff018 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts @@ -23,14 +23,12 @@ export declare class ReciprocalLattice extends Lattice { get reciprocalVectors(): Vector3DSchema[]; /** * Norms of reciprocal vectors. - * @return {number[]} */ - get reciprocalVectorNorms(): number[]; + get reciprocalVectorNorms(): Vector3DSchema; /** * Ratio of reciprocal vector norms scaled by the inverse of the largest component. - * @return {number[]} */ - get reciprocalVectorRatios(): number[]; + get reciprocalVectorRatios(): Vector3DSchema; /** * Get point (in crystal coordinates) in cartesian coordinates. * @param {KPointCoordinates} point - point in 3D space diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.js b/dist/js/lattice/reciprocal/lattice_reciprocal.js index 6cafd5eec..ef6c173bf 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.js +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.js @@ -27,14 +27,12 @@ class ReciprocalLattice extends lattice_1.Lattice { } /** * Norms of reciprocal vectors. - * @return {number[]} */ get reciprocalVectorNorms() { return this.reciprocalVectors.map((vec) => math_1.math.norm(vec)); } /** * Ratio of reciprocal vector norms scaled by the inverse of the largest component. - * @return {number[]} */ get reciprocalVectorRatios() { const norms = this.reciprocalVectorNorms; diff --git a/src/js/lattice/reciprocal/lattice_reciprocal.ts b/src/js/lattice/reciprocal/lattice_reciprocal.ts index 1c15bd32c..e7ee319d5 100644 --- a/src/js/lattice/reciprocal/lattice_reciprocal.ts +++ b/src/js/lattice/reciprocal/lattice_reciprocal.ts @@ -54,20 +54,18 @@ export class ReciprocalLattice extends Lattice { /** * Norms of reciprocal vectors. - * @return {number[]} */ - get reciprocalVectorNorms(): number[] { - return this.reciprocalVectors.map((vec) => math.norm(vec) as number); + get reciprocalVectorNorms(): Vector3DSchema { + return this.reciprocalVectors.map((vec) => math.norm(vec) as number) as Vector3DSchema; } /** * Ratio of reciprocal vector norms scaled by the inverse of the largest component. - * @return {number[]} */ - get reciprocalVectorRatios(): number[] { + get reciprocalVectorRatios(): Vector3DSchema { const norms: number[] = this.reciprocalVectorNorms; const maxNorm: number = math.max(...norms) as number; - return norms.map((n: number) => n / maxNorm); + return norms.map((n: number) => n / maxNorm) as Vector3DSchema; } /** From 1075e855bbcac621d9661af61daaa5a1ead291be Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 5 Jan 2026 22:58:34 +0200 Subject: [PATCH 6/9] fix: tests --- dist/js/materialMixin.js | 52 ++++++++++++++++++------------------ src/js/materialMixin.ts | 57 ++++++++++++++++++++-------------------- 2 files changed, 54 insertions(+), 55 deletions(-) diff --git a/dist/js/materialMixin.js b/dist/js/materialMixin.js index 712a5d5e9..6ea247f64 100644 --- a/dist/js/materialMixin.js +++ b/dist/js/materialMixin.js @@ -66,33 +66,33 @@ function materialPropertiesMixin(item) { }, get name() { var _a; - return (_a = item.prop("name")) !== null && _a !== void 0 ? _a : this.formula; // if name is not set, use formula, but keep empty string + return (_a = this.prop("name")) !== null && _a !== void 0 ? _a : this.formula; // if name is not set, use formula, but keep empty string }, set name(name) { - item.setProp("name", name); + this.setProp("name", name); }, get src() { - return item.prop("src"); + return this.prop("src"); }, set src(src) { - item.setProp("src", src); + this.setProp("src", src); }, updateFormula() { - item.setProp("formula", this.Basis.formula); - item.setProp("unitCellFormula", this.Basis.unitCellFormula); + this.setProp("formula", this.Basis.formula); + this.setProp("unitCellFormula", this.Basis.unitCellFormula); }, /** * Gets Bolean value for whether or not a material is non-periodic vs periodic. * False = periodic, True = non-periodic */ get isNonPeriodic() { - return item.prop("isNonPeriodic", false); + return this.prop("isNonPeriodic", false); }, /** * @summary Sets the value of isNonPeriodic based on Boolean value passed as an argument. */ set isNonPeriodic(bool) { - item.setProp("isNonPeriodic", bool); + this.setProp("isNonPeriodic", bool); }, /** * @summary Returns the specific derived property (as specified by name) for a material. @@ -104,21 +104,21 @@ function materialPropertiesMixin(item) { * @summary Returns the derived properties array for a material. */ getDerivedProperties() { - return item.prop("derivedProperties", []); + return this.prop("derivedProperties", []); }, /** * Gets material's formula */ get formula() { - return item.prop("formula") || this.Basis.formula; + return this.prop("formula") || this.Basis.formula; }, get unitCellFormula() { - return item.prop("unitCellFormula") || this.Basis.unitCellFormula; + return this.prop("unitCellFormula") || this.Basis.unitCellFormula; }, unsetFileProps() { - item.unsetProp("src"); - item.unsetProp("icsdId"); - item.unsetProp("external"); + this.unsetProp("src"); + this.unsetProp("icsdId"); + this.unsetProp("external"); }, /** * @param textOrObject Basis text or JSON object. @@ -133,7 +133,7 @@ function materialPropertiesMixin(item) { else { basis = textOrObject; } - item.setProp("basis", basis); + this.setProp("basis", basis); this.unsetFileProps(); this.updateFormula(); }, @@ -151,7 +151,7 @@ function materialPropertiesMixin(item) { this.setBasisConstraints(constraintsInstances); }, get basis() { - return item.prop("basis"); + return this.requiredProp("basis"); }, // returns the instance of {ConstrainedBasis} class get Basis() { @@ -169,7 +169,7 @@ function materialPropertiesMixin(item) { return this.Basis.uniqueElements; }, get lattice() { - return item.prop("lattice"); + return this.prop("lattice"); }, set lattice(config) { const originalIsInCrystalUnits = this.Basis.isInCrystalUnits; @@ -181,8 +181,8 @@ function materialPropertiesMixin(item) { basis.toCrystal(); // Preserve all properties from the original basis to ensure constraints are included const newBasisConfig = basis.toJSON(); - item.setProp("basis", newBasisConfig); - item.setProp("lattice", config); + this.setProp("basis", newBasisConfig); + this.setProp("lattice", config); this.unsetFileProps(); }, get Lattice() { @@ -222,10 +222,10 @@ function materialPropertiesMixin(item) { return crypto_js_1.default.MD5(message).toString(); }, set hash(hash) { - item.setProp("hash", hash); + this.setProp("hash", hash); }, get hash() { - return item.prop("hash"); + return this.prop("hash"); }, /** * Calculates hash from basis and lattice as above + scales lattice properties to make lattice.a = 1 @@ -234,10 +234,10 @@ function materialPropertiesMixin(item) { return this.calculateHash("", true); }, get external() { - return item.prop("external"); + return this.prop("external"); }, set external(external) { - item.setProp("external", external); + this.setProp("external", external); }, /** * Converts basis to crystal/fractional coordinates. @@ -245,7 +245,7 @@ function materialPropertiesMixin(item) { toCrystal() { const basis = this.Basis; basis.toCrystal(); - item.setProp("basis", basis.toJSON()); + this.setProp("basis", basis.toJSON()); }, /** * Converts current material's basis coordinates to cartesian. @@ -254,7 +254,7 @@ function materialPropertiesMixin(item) { toCartesian() { const basis = this.Basis; basis.toCartesian(); - item.setProp("basis", basis.toJSON()); + this.setProp("basis", basis.toJSON()); }, /** * Returns material's basis in XYZ format. @@ -293,7 +293,7 @@ function materialPropertiesMixin(item) { * Returns a copy of the material with conventional cell constructed instead of primitive. */ getACopyWithConventionalCell() { - const material = item.clone(); + const material = this.clone(); // if conventional and primitive cells are the same => return a copy. if ((0, conventional_cell_1.isConventionalCellSameAsPrimitiveForLatticeType)(this.Lattice.type)) return material; diff --git a/src/js/materialMixin.ts b/src/js/materialMixin.ts index 3bca1db11..0cd1f3751 100644 --- a/src/js/materialMixin.ts +++ b/src/js/materialMixin.ts @@ -136,24 +136,24 @@ function materialPropertiesMixin(item: T) { }, get name() { - return item.prop("name") ?? this.formula; // if name is not set, use formula, but keep empty string + return this.prop("name") ?? this.formula; // if name is not set, use formula, but keep empty string }, set name(name: string) { - item.setProp("name", name); + this.setProp("name", name); }, get src() { - return item.prop("src"); + return this.prop("src"); }, set src(src: FileSourceSchema | undefined) { - item.setProp("src", src); + this.setProp("src", src); }, updateFormula() { - item.setProp("formula", this.Basis.formula); - item.setProp("unitCellFormula", this.Basis.unitCellFormula); + this.setProp("formula", this.Basis.formula); + this.setProp("unitCellFormula", this.Basis.unitCellFormula); }, /** @@ -161,14 +161,14 @@ function materialPropertiesMixin(item: T) { * False = periodic, True = non-periodic */ get isNonPeriodic(): boolean { - return item.prop("isNonPeriodic", false); + return this.prop("isNonPeriodic", false); }, /** * @summary Sets the value of isNonPeriodic based on Boolean value passed as an argument. */ set isNonPeriodic(bool: boolean) { - item.setProp("isNonPeriodic", bool); + this.setProp("isNonPeriodic", bool); }, /** @@ -182,24 +182,24 @@ function materialPropertiesMixin(item: T) { * @summary Returns the derived properties array for a material. */ getDerivedProperties(): DerivedPropertiesSchema { - return item.prop("derivedProperties", []); + return this.prop("derivedProperties", []); }, /** * Gets material's formula */ get formula(): string { - return item.prop("formula") || this.Basis.formula; + return this.prop("formula") || this.Basis.formula; }, get unitCellFormula(): string { - return item.prop("unitCellFormula") || this.Basis.unitCellFormula; + return this.prop("unitCellFormula") || this.Basis.unitCellFormula; }, unsetFileProps() { - item.unsetProp("src"); - item.unsetProp("icsdId"); - item.unsetProp("external"); + this.unsetProp("src"); + this.unsetProp("icsdId"); + this.unsetProp("external"); }, /** @@ -214,7 +214,7 @@ function materialPropertiesMixin(item: T) { } else { basis = textOrObject as BasisConfig; } - item.setProp("basis", basis); + this.setProp("basis", basis); this.unsetFileProps(); this.updateFormula(); }, @@ -234,9 +234,8 @@ function materialPropertiesMixin(item: T) { this.setBasisConstraints(constraintsInstances); }, - get basis(): OptionallyConstrainedBasisConfig { - return item.prop("basis") as BasisConfig & - Partial>; + get basis() { + return this.requiredProp("basis"); }, // returns the instance of {ConstrainedBasis} class @@ -246,7 +245,7 @@ function materialPropertiesMixin(item: T) { return new ConstrainedBasis({ ...basisData, cell: this.Lattice.vectors, - constraints: (basisData as ConstrainedBasisConfig).constraints || [], + constraints: basisData.constraints || [], }); }, @@ -258,7 +257,7 @@ function materialPropertiesMixin(item: T) { }, get lattice(): LatticeSchema { - return item.prop("lattice") as LatticeSchema; + return this.prop("lattice") as LatticeSchema; }, set lattice(config: LatticeSchema) { @@ -272,8 +271,8 @@ function materialPropertiesMixin(item: T) { // Preserve all properties from the original basis to ensure constraints are included const newBasisConfig = basis.toJSON(); - item.setProp("basis", newBasisConfig); - item.setProp("lattice", config); + this.setProp("basis", newBasisConfig); + this.setProp("lattice", config); this.unsetFileProps(); }, @@ -317,11 +316,11 @@ function materialPropertiesMixin(item: T) { }, set hash(hash: string) { - item.setProp("hash", hash); + this.setProp("hash", hash); }, get hash(): string { - return item.prop("hash") as string; + return this.prop("hash") as string; }, /** @@ -332,10 +331,10 @@ function materialPropertiesMixin(item: T) { }, get external() { - return item.prop("external"); + return this.prop("external"); }, set external(external: MaterialSchema["external"]) { - item.setProp("external", external); + this.setProp("external", external); }, /** @@ -344,7 +343,7 @@ function materialPropertiesMixin(item: T) { toCrystal() { const basis = this.Basis; basis.toCrystal(); - item.setProp("basis", basis.toJSON()); + this.setProp("basis", basis.toJSON()); }, /** @@ -354,7 +353,7 @@ function materialPropertiesMixin(item: T) { toCartesian() { const basis = this.Basis; basis.toCartesian(); - item.setProp("basis", basis.toJSON()); + this.setProp("basis", basis.toJSON()); }, /** @@ -396,7 +395,7 @@ function materialPropertiesMixin(item: T) { * Returns a copy of the material with conventional cell constructed instead of primitive. */ getACopyWithConventionalCell(): T { - const material = item.clone(); + const material = this.clone(); // if conventional and primitive cells are the same => return a copy. if (isConventionalCellSameAsPrimitiveForLatticeType(this.Lattice.type)) From caf00919c4959317151b815538ad32f6d6e0fd28 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 5 Jan 2026 23:07:30 +0200 Subject: [PATCH 7/9] fix: tests --- package-lock.json | 6 +++--- package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index ba53c6c4b..bd9e26304 100644 --- a/package-lock.json +++ b/package-lock.json @@ -31,7 +31,7 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#cb3fa59e2cc143d744f9019322208d928ff8de88", "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#ac95943050a0b887d22b62e303cafa13c04edc8c", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", @@ -2866,8 +2866,8 @@ }, "node_modules/@mat3ra/code": { "version": "0.0.0", - "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", - "integrity": "sha512-4j0uYpGx9dloxeN4toQsPrV5oDr1T2tjYOnXiFm/JftrTmmU6yTorSmL5ATTIvw3V/MFQLwlNPpO61czbFIv6g==", + "resolved": "git+ssh://git@github.com/Exabyte-io/code.git#cb3fa59e2cc143d744f9019322208d928ff8de88", + "integrity": "sha512-lxmiLW3kCYWc2of2BWbrE+NNU4DcRNGtaJYJ7C9UA7y2JQXjuHYX1dqCDh5hN3A6esu8giEOXsBwf+b64M9EYQ==", "dev": true, "license": "Apache-2.0", "dependencies": { diff --git a/package.json b/package.json index 6bf95ffc5..d01958274 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "@babel/register": "^7.22.15", "@babel/runtime-corejs3": "^7.16.8", "@exabyte-io/eslint-config": "2025.5.13-0", - "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#b51e5b119a3f1ed5278fce201dd1f23d36dbf0dd", + "@mat3ra/code": "git+https://github.com/Exabyte-io/code.git#cb3fa59e2cc143d744f9019322208d928ff8de88", "@mat3ra/esse": "git+https://github.com/Exabyte-io/esse#ac95943050a0b887d22b62e303cafa13c04edc8c", "@mat3ra/tsconfig": "2024.6.3-0", "@mat3ra/utils": "2025.4.14-0", From 97fed705bca34ee9e8a1c2c34cbb0c265d4ab460 Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 5 Jan 2026 23:14:09 +0200 Subject: [PATCH 8/9] chore: improve types --- dist/js/lattice/reciprocal/lattice_reciprocal.d.ts | 4 ++-- dist/js/lattice/reciprocal/lattice_reciprocal.js | 2 +- src/js/lattice/reciprocal/lattice_reciprocal.ts | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts index 5725ff018..2eec29563 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts @@ -65,9 +65,9 @@ export declare class ReciprocalLattice extends Lattice { /** * Calculate grid dimensions from total number of k-points. * @param {number} nKpoints - Total number of k-points. - * @return {number[]} - Grid dimensions + * @return Grid dimensions */ - getDimensionsFromPointsCount(nKpoints: number): number[]; + getDimensionsFromPointsCount(nKpoints: number): [number, number, number]; get conversionTable(): ConversionTable; /** * Calculate grid dimensions from k-point spacing, i.e. diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.js b/dist/js/lattice/reciprocal/lattice_reciprocal.js index ef6c173bf..7c8c56c92 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.js +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.js @@ -100,7 +100,7 @@ class ReciprocalLattice extends lattice_1.Lattice { /** * Calculate grid dimensions from total number of k-points. * @param {number} nKpoints - Total number of k-points. - * @return {number[]} - Grid dimensions + * @return Grid dimensions */ getDimensionsFromPointsCount(nKpoints) { const indices = [0, 1, 2]; diff --git a/src/js/lattice/reciprocal/lattice_reciprocal.ts b/src/js/lattice/reciprocal/lattice_reciprocal.ts index e7ee319d5..97265978e 100644 --- a/src/js/lattice/reciprocal/lattice_reciprocal.ts +++ b/src/js/lattice/reciprocal/lattice_reciprocal.ts @@ -137,11 +137,11 @@ export class ReciprocalLattice extends Lattice { /** * Calculate grid dimensions from total number of k-points. * @param {number} nKpoints - Total number of k-points. - * @return {number[]} - Grid dimensions + * @return Grid dimensions */ - getDimensionsFromPointsCount(nKpoints: number): number[] { - const indices: number[] = [0, 1, 2]; - return indices.map((i) => this.calculateDimension(nKpoints, i)); + getDimensionsFromPointsCount(nKpoints: number): [number, number, number] { + const indices = [0, 1, 2] as const; + return indices.map((i) => this.calculateDimension(nKpoints, i)) as [number, number, number]; } get conversionTable(): ConversionTable { From 47b3e12a859c45fa72079ed4ddd1675a6a32b4fe Mon Sep 17 00:00:00 2001 From: Kostiantyn Dvornik Date: Mon, 5 Jan 2026 23:19:06 +0200 Subject: [PATCH 9/9] chore: improve types --- dist/js/lattice/reciprocal/lattice_reciprocal.d.ts | 5 ++--- dist/js/lattice/reciprocal/lattice_reciprocal.js | 1 - src/js/lattice/reciprocal/lattice_reciprocal.ts | 12 ++++-------- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts index 2eec29563..20e8ffc16 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.d.ts @@ -67,7 +67,7 @@ export declare class ReciprocalLattice extends Lattice { * @param {number} nKpoints - Total number of k-points. * @return Grid dimensions */ - getDimensionsFromPointsCount(nKpoints: number): [number, number, number]; + getDimensionsFromPointsCount(nKpoints: number): Vector3DSchema; get conversionTable(): ConversionTable; /** * Calculate grid dimensions from k-point spacing, i.e. @@ -75,9 +75,8 @@ export declare class ReciprocalLattice extends Lattice { * Note: just as the lattice vectors spacing is in cartesian (2pi / a) units by default * @param {number} spacing - maximum Spacing between k-points * @param {string} units - units of spacing parameter (default: 2pi / a) - * @return {number[]} */ - getDimensionsFromSpacing(spacing: number, units?: string): number[]; + getDimensionsFromSpacing(spacing: number, units?: string): Vector3DSchema; /** * Calculate grid spacing as average of spacing along individual reciprocal axes. * @param {number[]} dimensions - Array of dimensions diff --git a/dist/js/lattice/reciprocal/lattice_reciprocal.js b/dist/js/lattice/reciprocal/lattice_reciprocal.js index 7c8c56c92..76c294536 100644 --- a/dist/js/lattice/reciprocal/lattice_reciprocal.js +++ b/dist/js/lattice/reciprocal/lattice_reciprocal.js @@ -123,7 +123,6 @@ class ReciprocalLattice extends lattice_1.Lattice { * Note: just as the lattice vectors spacing is in cartesian (2pi / a) units by default * @param {number} spacing - maximum Spacing between k-points * @param {string} units - units of spacing parameter (default: 2pi / a) - * @return {number[]} */ getDimensionsFromSpacing(spacing, units = constants_1.ATOMIC_COORD_UNITS.cartesian) { const factor = this.conversionTable[units][constants_1.ATOMIC_COORD_UNITS.cartesian] || 1; diff --git a/src/js/lattice/reciprocal/lattice_reciprocal.ts b/src/js/lattice/reciprocal/lattice_reciprocal.ts index 97265978e..95e41d2e5 100644 --- a/src/js/lattice/reciprocal/lattice_reciprocal.ts +++ b/src/js/lattice/reciprocal/lattice_reciprocal.ts @@ -139,9 +139,9 @@ export class ReciprocalLattice extends Lattice { * @param {number} nKpoints - Total number of k-points. * @return Grid dimensions */ - getDimensionsFromPointsCount(nKpoints: number): [number, number, number] { + getDimensionsFromPointsCount(nKpoints: number) { const indices = [0, 1, 2] as const; - return indices.map((i) => this.calculateDimension(nKpoints, i)) as [number, number, number]; + return indices.map((i) => this.calculateDimension(nKpoints, i)) as Vector3DSchema; } get conversionTable(): ConversionTable { @@ -162,16 +162,12 @@ export class ReciprocalLattice extends Lattice { * Note: just as the lattice vectors spacing is in cartesian (2pi / a) units by default * @param {number} spacing - maximum Spacing between k-points * @param {string} units - units of spacing parameter (default: 2pi / a) - * @return {number[]} */ - getDimensionsFromSpacing( - spacing: number, - units: string = ATOMIC_COORD_UNITS.cartesian, - ): number[] { + getDimensionsFromSpacing(spacing: number, units: string = ATOMIC_COORD_UNITS.cartesian) { const factor: number = this.conversionTable[units][ATOMIC_COORD_UNITS.cartesian] || 1; return this.reciprocalVectorNorms.map((norm: number) => { return math.max(1, math.ceil(lodash.round(norm / (spacing * factor), 4))) as number; - }); + }) as Vector3DSchema; } /**