Socket
Socket
Sign inDemoInstall

3dmol

Package Overview
Dependencies
59
Maintainers
2
Versions
38
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.3 to 2.0.4

.devcontainer/devcontainers.json

2

build/3Dmol-min.js.LICENSE.txt
/*!
* 3dmol v2.0.3
* 3dmol v2.0.4
* JavaScript/TypeScript molecular visualization library
* Author: David Koes and contributors
*/
/*!
* 3dmol v2.0.3
* 3dmol v2.0.4
* JavaScript/TypeScript molecular visualization library

@@ -4,0 +4,0 @@ * Author: David Koes and contributors

@@ -9,2 +9,2 @@ export declare var autoinit: boolean;

export declare var viewers: any;
export declare function autoload(viewer?: any, callback?: any): void;
export declare function autoload(viewer?: any, callback?: (arg0: any) => void): void;
import { Geometry } from "./WebGL";
import { Color, Colored } from "colors";
/**

@@ -15,2 +16,7 @@ * Enum for cylinder cap styles.

}
export interface Point {
x: number;
y: number;
z: number;
}
/**

@@ -25,3 +31,3 @@ * Lower level utilities for creating WebGL shape geometries.

* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo

@@ -32,3 +38,3 @@ * @param {Point}

* to
* @param {float}
* @param {number}
* radius

@@ -41,6 +47,6 @@ * @param {Color}

* */
function drawCylinder(geo: Geometry, from: any, to: any, radius: number, color: any, fromCap?: CAP, toCap?: CAP): void;
function drawCylinder(geo: Geometry, from: any, to: any, radius: number, color: Color | Color[], fromCap?: CAP, toCap?: CAP): void;
/** Create a cone
* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo

@@ -51,3 +57,3 @@ * @param {Point}

* to
* @param {float}
* @param {number}
* radius

@@ -57,16 +63,17 @@ * @param {Color}

* */
function drawCone(geo: Geometry, from: any, to: any, radius: number, color?: any): void;
function drawCone(geo: Geometry, from: any, to: any, radius: number, color?: Color): void;
/** Create a sphere.
* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo
* @param {Point}
* pos
* @param {float}
* @param {number}
* radius
* @param {Color}
* color
* @param {number} quality of sphere (default 2, higher increases number of triangles)
* @param {number}
* sphereQuality - Quality of sphere (default 2, higher increases number of triangles)
*/
function drawSphere(geo: Geometry, pos: any, radius: any, color: any, sphereQuality?: any): void;
function drawSphere(geo: Geometry, pos: any, radius: number, color: Colored, sphereQuality?: number): void;
}

@@ -253,2 +253,3 @@ import { Geometry } from "./WebGL";

private static deepCopyAndCache;
private static readonly ignoredKeys;
/** given a selection specification, return true if atom is selected.

@@ -488,3 +489,3 @@ * Does not support context-aware selectors like expand/within/byres.

static parseCrd(data: any, format: string): any;
static parseMolData(data?: any, format?: string, options?: any): any;
static parseMolData(data?: string | ArrayBuffer, format?: string, options?: ParserOptionsSpec): any;
}

@@ -491,0 +492,0 @@ /** Atom style specification */

@@ -0,1 +1,2 @@

import { Renderer } from "./WebGL";
import { Vector3, XYZ } from "./WebGL/math";

@@ -237,3 +238,3 @@ import { Mesh } from "./WebGL";

*/
getRenderer(): any;
getRenderer(): Renderer;
/**

@@ -1012,3 +1013,3 @@ * Set the duration of the hover delay

*/
hasVolumetricRender(): any;
hasVolumetricRender(): boolean;
/**

@@ -1015,0 +1016,0 @@ * Enable/disable fog for content far from the camera

@@ -26,3 +26,3 @@ import { Color } from "./colors";

range(): [number, number];
valueToHex(val: any, range: any): any;
valueToHex(val: number, range?: number[]): number;
}

@@ -37,6 +37,6 @@ /**

mult: number;
max: number;
min: number;
constructor(min: any, max: any);
valueToHex(val: any, range: any): any;
max?: number;
min?: number;
constructor(min?: number, max?: number);
valueToHex(val: number, range?: any[]): number;
range(): [number, number];

@@ -68,4 +68,4 @@ }

min: number;
constructor(min: any, max: any);
valueToHex(val: any, range: any): number;
constructor(min: number, max: number);
valueToHex(val: number, range?: any[]): number;
range(): [number, number];

@@ -98,3 +98,3 @@ }

range(): [number, number];
valueToHex(val: any, range: any): number;
valueToHex(val: number, range?: any[]): number;
}

@@ -101,0 +101,0 @@ export declare const builtinGradients: {

@@ -58,3 +58,3 @@ import { Vector2 } from "./WebGL";

frame: any;
constructor(text: any, parameters: any);
constructor(text: string, parameters: LabelSpec);
getStyle(): any;

@@ -61,0 +61,0 @@ setContext(): void;

@@ -0,1 +1,2 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**

@@ -10,3 +11,3 @@ * This parses the ChemDoodle json file format. Although this is registered

* @category Parsers
*/
export declare function CDJSON(str: any, options: any): any[][] & Record<string, any>;
*/
export declare function CDJSON(str: string, options: ParserOptionsSpec): any[][] & Record<string, any>;
import { ParserOptionsSpec } from './ParserOptionsSpec';
/**
* Puts atoms specified in mmCIF fromat in str into atoms
*
* @param {string} str
* @param {ParserOptionsSpec} options
* @category Parsers
*/
*/
export declare function CIF(str: string, options?: ParserOptionsSpec): any[] & Record<string, any>;

@@ -0,9 +1,9 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* @param {string}
* str
* @param {ParserOptionsSpec}
* options
* @param {string}
* str
* @param {ParserOptionsSpec}
* options
* @category Parsers
*/
export declare function CUBE(str: any, options: any): any[][] & Record<string, any>;
export declare function CUBE(str: string, options: ParserOptionsSpec): any[][] & Record<string, any>;
/**
* Parse a gro file from str and create atoms
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options*
* @category Parsers
*/
export declare function GRO(str: any): any[][] & Record<string, any>;
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options*
* @category Parsers
*/
export declare function GRO(str: string): any[][] & Record<string, any>;

@@ -0,6 +1,7 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* Parse a lammps trajectory file from str and create atoms
*
* @category Parsers
*/
export declare function LAMMPSTRJ(str: any, options: any): any[];
*/
export declare function LAMMPSTRJ(str: string, options: ParserOptionsSpec): any[];

@@ -1,5 +0,7 @@

/** @param bindata - binary UInt8Array buffer or a base64 encoded string
* @param ParserOptionsSpec
* @category Parsers
import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* @param bindata - binary UInt8Array buffer or a base64 encoded string
* @param ParserOptionsSpec
* @category Parsers
*/
export declare function MMTFparser(bindata: any, options: any): any[][] & Record<string, any>;
export declare function MMTFparser(bindata: any, options: ParserOptionsSpec): any[][] & Record<string, any>;

@@ -0,1 +1,2 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**

@@ -7,3 +8,3 @@ * @param {string}

* @category Parsers
*/
export declare function MOL2(str: any, options: any): any[][] & Record<string, any>;
*/
export declare function MOL2(str: string, options: ParserOptionsSpec): any[][] & Record<string, any>;

@@ -0,2 +1,6 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* Parse pdb file from str and create atoms if computeStruct is true will always perform secondary structure analysis,
* otherwise only do analysis of SHEET/HELIX comments are missing
*
* @param {string} str

@@ -8,3 +12,3 @@ * @param {ParserOptionsSpec} options - keepH (do not strip hydrogens), noSecondaryStructure,

*
*/
export declare function PDB(str: any, options: any): any[] & Record<string, any>;
*/
export declare function PDB(str: string, options: ParserOptionsSpec): any[] & Record<string, any>;

@@ -0,4 +1,4 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* Parse a pqr file from str and create atoms. A pqr file is assumed to be a
* whitespace delimited PDB with charge and radius fields.
* Parse a pqr file from str and create atoms. A pqr file is assumed to be a whitespace delimited PDB with charge and radius fields.
*

@@ -9,4 +9,4 @@ * @param {string}

* options - noSecondaryStructure (do not compute ss)
* @category Parsers
*/
export declare function PQR(str: any, options: any): any[][] & Record<string, any>;
* @category Parsers
*/
export declare function PQR(str: string, options: ParserOptionsSpec): any[][] & Record<string, any>;
/**
* Parse a prmtop file from str and create atoms
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
* @category Parsers
*/
export declare function PRMTOP(str: any): any[][];
*/
export declare function PRMTOP(str: string): any[][];

@@ -0,1 +1,2 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**

@@ -7,4 +8,3 @@ * @param {string}

* @category Parsers
*/
export declare function SDF(str: any, options: any): any[][] & Record<string, any>;
*/
export declare function SDF(str: string, options: ParserOptionsSpec): any;

@@ -1,119 +0,1 @@

export declare const anumToSymbol: {
1: string;
2: string;
3: string;
4: string;
5: string;
6: string;
7: string;
8: string;
9: string;
10: string;
11: string;
12: string;
13: string;
14: string;
15: string;
16: string;
17: string;
18: string;
19: string;
20: string;
21: string;
22: string;
23: string;
24: string;
25: string;
26: string;
27: string;
28: string;
29: string;
30: string;
31: string;
32: string;
33: string;
34: string;
35: string;
36: string;
37: string;
38: string;
39: string;
40: string;
41: string;
42: string;
43: string;
44: string;
45: string;
46: string;
47: string;
48: string;
49: string;
50: string;
51: string;
52: string;
53: string;
54: string;
55: string;
56: string;
71: string;
72: string;
73: string;
74: string;
75: string;
76: string;
77: string;
78: string;
79: string;
80: string;
81: string;
82: string;
83: string;
84: string;
85: string;
86: string;
87: string;
88: string;
104: string;
105: string;
106: string;
107: string;
108: string;
109: string;
110: string;
111: string;
112: string;
113: string;
114: string;
115: string;
116: string;
117: string;
118: string;
57: string;
58: string;
59: string;
60: string;
61: string;
62: string;
63: string;
64: string;
65: string;
66: string;
67: string;
68: string;
69: string;
70: string;
89: string;
90: string;
91: string;
92: string;
93: string;
94: string;
95: string;
96: string;
97: string;
98: string;
99: string;
100: string;
101: string;
102: string;
};
export declare const anumToSymbol: any;

@@ -1,1 +0,13 @@

export declare function areConnected(atom1: any, atom2: any): boolean;
export declare function areConnected(atom1: {
elem: any;
x: number;
y: number;
z: number;
altLoc: string;
}, atom2: {
elem: any;
x: number;
y: number;
z: number;
altLoc: string;
}): boolean;

@@ -1,1 +0,1 @@

export declare function assignBackboneHBonds(atomsarray: any, hbondCutoff: any): void;
export declare function assignBackboneHBonds(atomsarray: string | any[], hbondCutoff: number): void;

@@ -1,1 +0,4 @@

export declare function assignBonds(atoms: any): void;
/**
* @param {AtomSpec[]} atoms
*/
export declare function assignBonds(atoms: string | any[]): void;

@@ -1,1 +0,5 @@

export declare function assignPDBBonds(atomsarray: any): void;
/**
* @param {AtomSpec[]}
* atomsarray
*/
export declare function assignPDBBonds(atomsarray: string | any[]): void;

@@ -1,1 +0,1 @@

export declare function atomNameToElem(name: any, nothetero: any): any;
export declare function atomNameToElem(name: string, nothetero: boolean): string;

@@ -1,78 +0,3 @@

export declare let bondTable: {
H: number;
He: number;
Li: number;
Be: number;
B: number;
C: number;
N: number;
O: number;
F: number;
Ne: number;
Na: number;
Mg: number;
Al: number;
Si: number;
P: number;
S: number;
Cl: number;
Ar: number;
K: number;
Ca: number;
Sc: number;
Ti: number;
V: number;
Mn: number;
Fe: number;
Co: number;
Ni: number;
Cu: number;
Zn: number;
Ga: number;
Ge: number;
Se: number;
Br: number;
Kr: number;
Rb: number;
Sr: number;
Y: number;
Zr: number;
Nb: number;
Mo: number;
Tc: number;
Ru: number;
Rh: number;
Pd: number;
Ag: number;
Cd: number;
In: number;
Sn: number;
Sb: number;
Te: number;
I: number;
Xe: number;
Cs: number;
Ba: number;
Lu: number;
Hf: number;
Ta: number;
W: number;
Re: number;
Os: number;
Ir: number;
Pt: number;
Au: number;
Hg: number;
Tl: number;
Pb: number;
Bi: number;
Rn: number;
};
/** Get the length used for bond identification for the specified element.
*
*/
export declare function bondLength(elem: any): any;
/** Set the length used for bond identification for the specified element.
*
*/
export declare let bondTable: any;
export declare function bondLength(elem: string | number): any;
export declare function setBondLength(elem: string, radius: number): void;

@@ -1,1 +0,1 @@

export declare function computeSecondaryStructure(atomsarray: any, hbondCutoff: any): void;
export declare function computeSecondaryStructure(atomsarray: string | any[], hbondCutoff: number | undefined): void;

@@ -1,1 +0,7 @@

export declare function getSinglePDB(lines: any, options: any, sslookup: any): Record<string, any>[];
import { ParserOptionsSpec } from "../ParserOptionsSpec";
export declare function getSinglePDB(lines: string[], options: ParserOptionsSpec, sslookup: {
[x: string]: {
[x: string]: any;
};
hasOwnProperty?: any;
}): Record<string, any>[];

@@ -1,1 +0,6 @@

export declare function isEmpty(obj: any): boolean;
export declare function isEmpty(obj: {
[x: string]: {
[x: string]: any;
};
hasOwnProperty?: any;
}): boolean;

@@ -1,1 +0,9 @@

export declare function processSymmetries(copyMatrices: any, atoms: any, options: any, cryst: any): void;
import { ParserOptionsSpec } from 'parsers/ParserOptionsSpec';
export declare function processSymmetries(copyMatrices: string[] | any[], atoms: any[], options: ParserOptionsSpec, cryst: {
a: any;
b: number;
c: number;
alpha: number;
beta: number;
gamma: number;
}): void;

@@ -1,1 +0,1 @@

export declare function validateBonds(atomsarray: any, serialToIndex: any): void;
export declare function validateBonds(atomsarray: string[] | any[], serialToIndex: number[]): void;

@@ -7,3 +7,3 @@ /**

* @category Parsers
*/
export declare function VASP(str: any): any[][] & Record<string, any>;
*/
export declare function VASP(str: string): any[][] & Record<string, any>;
import { ParserOptionsSpec } from './ParserOptionsSpec';
/**
* Read an XYZ file from str and return result
*
* @param {string} str
* @param {ParserOptionsSpec} options
* @category Parsers
*/
*/
export declare function XYZ(str: string, options: ParserOptionsSpec): any[][] & Record<string, any>;

@@ -170,2 +170,2 @@ export declare const partialCharges: {

};
export declare function applyPartialCharges(atom: any, keepexisting: any): void;
export declare function applyPartialCharges(atom: Record<string, any>, keepexisting: boolean): void;

@@ -18,5 +18,9 @@ /**

* Render surface synchronously if true
* @param {boolean} [$3Dmol.SyncSurface=false]
* @param {boolean} [$3Dmol.syncSurface=false]
* @type {boolean} */
export declare var syncSurface: boolean;
/**
*
* @param {boolean} val - Whether surfaces should be rendered synchronously or in parallel.
*/
export declare function setSyncSurface(val: boolean): void;

@@ -73,2 +77,4 @@ export declare class MarchingCubeInitializer {

verts: any[];
static MarchingCube: MarchingCubeInitializer;
constructor();
readonly vdwRadii: {

@@ -109,3 +115,3 @@ H: number;

marchingcubeinit(stype: any): void;
marchingcube(stype: any): void;
marchingcube(stype: number): void;
}

@@ -90,2 +90,4 @@ import { AtomStyleSpec, BondStyle, GLModel } from "./GLModel";

model?: GLModel | number | GLModel[] | number[];
/** frame index of individual frame to style; will apply to all frames if not set */
frame?: number;
/** index of the atom or atoms to select */

@@ -92,0 +94,0 @@ index?: number | number[];

@@ -54,7 +54,7 @@ import { Matrix4 } from "./WebGL/math";

};
vasp: (str: any) => void;
dx: (str: any) => void;
cube(str: any): void;
ccp4(bin: any): void;
vasp: (str: string) => void;
dx: (str: string) => void;
cube(str: string): void;
ccp4(bin: Int8Array): void;
}
export {};

@@ -30,3 +30,3 @@ import { Sphere } from "./WebGL/shapes";

export declare class GLVolumetricRender {
static interpolateArray(data: any, fitCount: any): any[];
static interpolateArray(data: string | any[], fitCount: number): any[];
hidden: boolean;

@@ -47,3 +47,24 @@ boundingSphere: Sphere;

minunit: any;
constructor(data: any, spec: any);
constructor(data: {
matrix: {
elements: any;
};
size: {
x: number;
y: number;
z: number;
};
unit: {
x: number;
y: number;
z: number;
};
origin: {
x: number;
y: number;
z: number;
};
data: number[];
getIndex: (arg0: number, arg1: number, arg2: number) => number;
}, spec: VolumetricRendererSpec);
/**

@@ -54,4 +75,9 @@ * Initialize webgl objects for rendering

*/
globj(group: any): void;
removegl(group: any): void;
globj(group: {
remove: (arg0: any) => void;
add: (arg0: any) => void;
}): void;
removegl(group: {
remove: (arg0: any) => void;
}): void;
get position(): Vector3;

@@ -58,0 +84,0 @@ get x(): number;

@@ -12,2 +12,2 @@ import { Matrix3 } from "../math";

*/
export declare function conversionMatrix3(a: any, b: number, c: number, alpha: number, beta: number, gamma: number): Matrix3;
export declare function conversionMatrix3(a: number, b: number, c: number, alpha: number, beta: number, gamma: number): Matrix3;

@@ -12,3 +12,3 @@ /**

devicePixelRatio: number;
domElement: Element;
domElement: HTMLCanvasElement;
autoClear: boolean;

@@ -45,3 +45,2 @@ autoClearColor: boolean;

private _oldFlipSided;
private _oldBlending;
private _oldDepthTest;

@@ -92,2 +91,3 @@ private _oldDepthWrite;

supportsImposters: boolean;
regen: boolean;
};

@@ -110,3 +110,3 @@ getContext(): WebGLRenderingContext | WebGL2RenderingContext;

renderBuffer(camera: any, lights: any, fog: any, material: any, geometryGroup: any, object: any): void;
render(scene: any, camera: any, forceClear: any): void;
render(scene: any, camera: any, forceClear?: any): void;
reinitFrameBuffer(): void;

@@ -113,0 +113,0 @@ setFrameBuffer(): void;

@@ -21,8 +21,8 @@ import { Color } from "../../../../colors";

type: string;
value: any[];
value: number[];
};
directionalLightDirection: {
type: string;
value: any[];
value: number[];
};
};

@@ -21,8 +21,8 @@ import { Color } from "../../../../colors";

type: string;
value: any[];
value: number[];
};
directionalLightDirection: {
type: string;
value: any[];
value: number[];
};
};

@@ -21,8 +21,8 @@ import { Color } from "../../../../colors";

type: string;
value: any[];
value: number[];
};
directionalLightDirection: {
type: string;
value: any[];
value: number[];
};
};

@@ -21,8 +21,8 @@ import { Color } from "../../../../colors";

type: string;
value: any[];
value: number[];
};
directionalLightDirection: {
type: string;
value: any[];
value: number[];
};
};

@@ -0,1 +1,2 @@

import { Matrix4 } from "WebGL/math";
import { Color } from "../../../../colors";

@@ -45,7 +46,7 @@ export declare const uniforms: {

type: string;
value: any[];
value: Matrix4[];
};
projinv: {
type: string;
value: any[];
value: Matrix4[];
};

@@ -52,0 +53,0 @@ transfermin: {

@@ -5,5 +5,8 @@ {

},
"plugins": ["plugins/markdown",
"../../node_modules/better-docs/typescript",
"../../node_modules/better-docs/category"],
"plugins": [
"plugins/markdown",
"../../node_modules/better-docs/typescript",
"../../node_modules/better-docs/category"
],
"recurseDepth": 10,
"source": {

@@ -13,35 +16,59 @@ "includePattern": "\\.(jsx|js|ts|tsx)$"

"templates": {
"search": true,
"cleverLinks": true,
"monospaceLinks": false,
"footer": "",
"copyright":"3Dmol.js © 2019-2022",
"copyright":"3Dmol.js © 2019-2023",
"linenums" : true,
"collapseSymbols" : false,
"inverseNav" : true,
"highlightTutorialCode" : true,
"better-docs": {
"name": "<a href=\"http://3dmol.org\"><b>3Dmol</b>.js</a>",
"title": "3Dmol.js Documentation",
"css": "../tutorials/style.css",
"navLinks": [
{
"label": "Github",
"href": "https://github.com/3dmol/3Dmol.js"
}
]
}
"highlightTutorialCode" : true
},
"markdown" : {
"parser" : "gfm",
"hardwrap" : true
"hardwrap": true,
"idInHeadings": true
},
"opts":{
"encoding": "utf8",
"destination": "doc/",
"recurse": true,
"encoding": "utf8",
"template": "./node_modules/better-docs",
"destination": "doc",
"tutorials": "tutorials",
"search": true
},
"tutorials": "tutorials/"
"verbose": true,
"template": "./node_modules/clean-jsdoc-theme",
"copyright": "3Dmol.js © 2019-2023",
"theme_opts": {
"default_theme": "light",
"includeFilesListInHomepage": true,
"homepageTitle": "3Dmol.js",
"displayModuleHeader": true,
"footer":"3Dmol.js © 2019-2023 | <a href='https://pitt.edu/' target='_blank'>University of Pittsburgh</a> | <a href='https://github.com/3dmol/3Dmol.js/blob/master/LICENSE' target='_blank'>License</a>",
"title": "3Dmol.js",
"create_style": "article ul li { list-style: disc}",
"menu": [
{
"title": " Documentation",
"link": "https://3dmol.org/doc/index.html"
},
{
"title": "Tutorials",
"link": "tutorial-home.html"
},
{
"title": "GitHub",
"link": "https://github.com/3dmol/3Dmol.js",
"target": "_blank"
}
],
"meta": [
{
"name": "Author",
"content": "David Koes & 3Dmoljs Contributors"
},
{
"name": "Description",
"content": "A modern, object-oriented JavaScript library for visualizing molecular data"
}
]
},
"tutorials": "tutorials/"
}
}
{
"name": "3dmol",
"version": "2.0.3",
"version": "2.0.4",
"description": "JavaScript/TypeScript molecular visualization library",

@@ -25,2 +25,6 @@ "repository": {

},
"engines": {
"npm": ">=8.11",
"node": ">=16.16.0"
},
"license": "BSD-3-Clause",

@@ -30,4 +34,7 @@ "main": "build/3Dmol.js",

"scripts": {
"build": "webpack --config webpack.dev.js --mode development && webpack --config webpack.prod.js --mode production && python3 tests/auto/generate_tests.py && npm run doc",
"prepare": "npm run build",
"build": "npm run build:dev && npm run build:prod && npm run generate:tests && npm run doc",
"build:dev": "webpack --config webpack.dev.js --mode development",
"build:prod": "webpack --config webpack.prod.js --mode production",
"prepare": "npm run build:dev && npm run build:prod",
"postinstall": "npm run build",
"jest": "npx jest --testPathIgnorePatterns=render.test.js",

@@ -38,14 +45,12 @@ "test": "npm run generate:jest && npm run jest && npm run glcheck",

"clean:glcheck": "rm -rf ./tests/glcheck/render-failures",
"generate:tests": "python3 tests/auto/generate_tests.py",
"generate:glcheck": "python3 ./tests/glcheck/generate_glcheck_render_tests.py -min",
"generate:jest": "python3 tests/jest/generate_jest_render_tests.py",
"cover": "npm run generate:jest && npx jest --coverage",
"doc": "npx jsdoc -c jsdoc.conf.json src doc.md"
"doc": "rm -rf doc/ && npx jsdoc -c jsdoc.conf.json src doc.md"
},
"engines": {
"npm": ">=8.11",
"node": ">=16.16.0"
},
"dependencies": {
"clean-jsdoc-theme": "^4.2.9",
"iobuffer": "^5.3.1",
"netcdfjs": "^2.0.2",
"netcdfjs": "^3.0.0",
"pako": "^2.1.0",

@@ -58,2 +63,3 @@ "upng-js": "^2.1.0"

"@babel/plugin-transform-typescript": "^7.20.7",
"@types/pako": "^2.0.0",
"better-docs": "github:3dmol/better-docs#master",

@@ -60,0 +66,0 @@ "canvas": "^2.11.0",

//auto-initialization
import { createViewer } from "./GLViewer";
import { GLViewer, createViewer } from "./GLViewer";
import { SurfaceType } from "./ProteinSurface4";

@@ -20,4 +20,4 @@ import { get, specStringToObject } from "./utilities";

//viewer and callback are used by the testing harness
export function autoload(viewer?, callback?) {
var i, dataname, type;
export function autoload(viewer?: any, callback?: (arg0: any) => void) {
var i: string | number, dataname: string, type: string;
if (document.querySelector(".viewer_3Dmoljs") != null)

@@ -77,3 +77,3 @@ autoinit = true;

datauri.push(uri);
datatypes.push(uri.substr(uri.lastIndexOf('.') + 1));
datatypes.push(uri.substring(uri.lastIndexOf('.') + 1));
} else if (i.substring(0, 3) === "cid" && (i !== "cid")) {

@@ -118,3 +118,3 @@ datauri.push("https://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/cid/" + divdata[i] + "/SDF?record_type=3d");

var m = stylere.exec(dataname);
var selname, newsel, styleobj;
var selname: string, newsel: any, styleobj: any;
if (m) {

@@ -149,3 +149,3 @@ selname = "select" + m[1];

//apply all the selections/styles parsed out above to the passed viewer
var applyStyles = function (glviewer) {
var applyStyles = function (glviewer: GLViewer) {
glviewer.setStyle(select, style);

@@ -171,3 +171,3 @@

if (UI) {
viewer.addSurface(SurfaceType.VDW, sty, sel, sel).then((surfid) => {
viewer.addSurface(SurfaceType.VDW, sty, sel, sel).then((surfid: any) => {
UI.loadSurface("VDW", sel, sty, surfid);

@@ -220,4 +220,4 @@ });

//load multiple data elements in serial
i = 0;
var process = function (moldata) {
let i = 0;
var process = function (moldata: any) {
//add moldata to viewer and load next model

@@ -231,3 +231,3 @@ uri = datauri[i]; //this is where the moldata came from

}
i += 1;
i +=1;
if (i < datauri.length) {

@@ -234,0 +234,0 @@ get(datauri[i]).then(process);

@@ -1,2 +0,2 @@

import { Gradient, GradientType } from "./Gradient";
import { GradientType } from "./Gradient";

@@ -3,0 +3,0 @@ /* @interface

import { Vector3 } from "./WebGL/math";
import { Geometry } from "./WebGL";
import { Color, Colored } from "colors";

@@ -20,2 +21,7 @@

export interface Point {
x: number;
y: number;
z: number;
}

@@ -33,3 +39,3 @@ /**

function getRotationMatrix(dx: number, dy: number, dz: number) {
var dxy = Math.sqrt(dx * dx + dy * dy);
var dxy = Math.hypot(dx, dy);
var dyz;

@@ -53,3 +59,3 @@

dy = -sinA * dx + cosA * dy;
dyz = Math.sqrt(dy * dy + dz * dz);
dyz = Math.hypot(dy, dz);

@@ -130,3 +136,3 @@ // about new x axis - Theta

getVerticesForRadius(radius, cap, capType) {
getVerticesForRadius(radius: any, cap: CAP, capType: any) {
if (typeof (this.cache) !== "undefined" && this.cache[radius] !== undefined)

@@ -279,7 +285,6 @@ if (this.cache[radius][cap + capType] !== undefined)

/**
* Create a cylinder
* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo

@@ -290,3 +295,3 @@ * @param {Point}

* to
* @param {float}
* @param {number}
* radius

@@ -299,3 +304,3 @@ * @param {Color}

* */
export function drawCylinder(geo: Geometry, from, to, radius: number, color, fromCap:CAP = 0, toCap:CAP = 0) {
export function drawCylinder(geo: Geometry, from: any, to: any, radius: number, color: Color | Color[], fromCap:CAP = 0, toCap:CAP = 0) {
if (!from || !to)

@@ -306,3 +311,3 @@ return;

var drawcaps = toCap || fromCap;
color = color || { r: 0, g: 0, b: 0 };
color = color || ({ r: 0, g: 0, b: 0 } as Color);

@@ -366,8 +371,8 @@ var e = getRotationMatrix(to.x-from.x, to.y-from.y, to.z-from.z);

// colors
colorArray[offset] = color.r;
colorArray[offset + 3] = color.r;
colorArray[offset + 1] = color.g;
colorArray[offset + 4] = color.g;
colorArray[offset + 2] = color.b;
colorArray[offset + 5] = color.b;
colorArray[offset] = (color as Color).r;
colorArray[offset + 3] = (color as Color).r;
colorArray[offset + 1] = (color as Color).g;
colorArray[offset + 4] = (color as Color).g;
colorArray[offset + 2] = (color as Color).b;
colorArray[offset + 5] = (color as Color).b;

@@ -457,16 +462,16 @@ // faces

colorArray[v1offset] = color.r;
colorArray[v2offset] = color.r;
colorArray[v3offset] = color.r;
colorArray[v4offset] = color.r;
colorArray[v1offset] = (color as Color).r;
colorArray[v2offset] = (color as Color).r;
colorArray[v3offset] = (color as Color).r;
colorArray[v4offset] = (color as Color).r;
colorArray[v1offset + 1] = color.g;
colorArray[v2offset + 1] = color.g;
colorArray[v3offset + 1] = color.g;
colorArray[v4offset + 1] = color.g;
colorArray[v1offset + 1] = (color as Color).g;
colorArray[v2offset + 1] = (color as Color).g;
colorArray[v3offset + 1] = (color as Color).g;
colorArray[v4offset + 1] = (color as Color).g;
colorArray[v1offset + 2] = color.b;
colorArray[v2offset + 2] = color.b;
colorArray[v3offset + 2] = color.b;
colorArray[v4offset + 2] = color.b;
colorArray[v1offset + 2] = (color as Color).b;
colorArray[v2offset + 2] = (color as Color).b;
colorArray[v3offset + 2] = (color as Color).b;
colorArray[v4offset + 2] = (color as Color).b;

@@ -582,3 +587,3 @@ nx1 = e[0] * normals[v1].x + e[3] * normals[v1].y + e[6] * normals[v1].z;

* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo

@@ -589,3 +594,3 @@ * @param {Point}

* to
* @param {float}
* @param {number}
* radius

@@ -595,9 +600,9 @@ * @param {Color}

* */
export function drawCone (geo: Geometry, from, to, radius: number, color?) {
export function drawCone (geo: Geometry, from: any, to: any, radius: number, color?: Color) {
if (!from || !to)
return;
//TODO: check if from and to do not contain x,y,z and if so generate a center based on the passed selections
// TODO: check if from and to do not contain x,y,z and if so generate a center based on the passed selections
color = color || { r: 0, g: 0, b: 0 };
color = color || ({ r: 0, g: 0, b: 0 } as Color);

@@ -695,2 +700,7 @@ let ndir = new Vector3(to.x-from.x, to.y-from.y, to.z-from.z);

interface MyObject {
vertices: any[];
verticesRows: any[][];
normals: any[];
}

@@ -702,3 +712,3 @@ // Sphere component sphereVertexCache

getVerticesForRadius(radius, sphereQuality) {
getVerticesForRadius(radius: number, sphereQuality: any) {
sphereQuality = sphereQuality || 2;

@@ -713,3 +723,3 @@

var obj = {
var obj: MyObject = {
vertices: [],

@@ -772,13 +782,14 @@ verticesRows: [],

* @memberof GLDraw
* @param {geometry}
* @param {Geometry}
* geo
* @param {Point}
* pos
* @param {float}
* @param {number}
* radius
* @param {Color}
* color
* @param {number} quality of sphere (default 2, higher increases number of triangles)
* @param {number}
* sphereQuality - Quality of sphere (default 2, higher increases number of triangles)
*/
export function drawSphere(geo:Geometry, pos, radius, color, sphereQuality?) {
export function drawSphere(geo:Geometry, pos: any, radius: number, color: Colored, sphereQuality?: number) {

@@ -807,5 +818,5 @@ var vobj = sphereVertexCache.getVerticesForRadius(radius, sphereQuality);

colorArray[offset] = color.r;
colorArray[offset + 1] = color.g;
colorArray[offset + 2] = color.b;
colorArray[offset] = (color as Colored).r;
colorArray[offset + 1] = (color as Colored).g;
colorArray[offset + 2] = (color as Colored).b;

@@ -812,0 +823,0 @@ }

@@ -6,3 +6,3 @@ import { Geometry, Material } from "./WebGL";

import { DoubleSide } from "./WebGL";
import { Color, CC, ColorSpec } from "./colors";
import { Color, CC, ColorSpec, Colored } from "./colors";
import { MarchingCube } from "./ProteinSurface4";

@@ -14,5 +14,3 @@ import { VolumeData } from "./VolumeData";

import { adjustVolumeStyle, extend, Func, makeFunction } from "./utilities";
import { Gradient, GradientType } from "./Gradient";
import { LineStyleSpec } from "GLModel";
import { VolumetricRendererSpec } from "VolumetricRender";
import { GradientType } from "./Gradient";

@@ -755,6 +753,6 @@

this.intersectionShape.sphere.push(new Sphere(sphereSpec.center, sphereSpec.radius));
GLDraw.drawSphere(this.geo, sphereSpec.center,
sphereSpec.radius, sphereSpec.color as Colored, sphereSpec.quality);
GLDraw.drawSphere(this.geo, sphereSpec.center,
sphereSpec.radius, sphereSpec.color, sphereSpec.quality);
this.components.push({

@@ -761,0 +759,0 @@ centroid: new Vector3(sphereSpec.center.x,

@@ -28,3 +28,3 @@ import { CC, Color } from "./colors";

//return a Gradient object, even if what is specified is descriptive
export function getGradient(grad): GradientType {
export function getGradient(grad: any): GradientType {
if (grad instanceof GradientType) {

@@ -87,4 +87,4 @@ return grad;

//map value to hex color, range is provided
valueToHex(val, range) {
var lo, hi;
valueToHex(val: number, range?: number[]) {
var lo: number, hi: number;
val = this.mult * val; //reverse if necessary

@@ -111,3 +111,3 @@ if (range) {

else middle = (lo + hi) / 2;
var scale, color;
var scale: number, color: number;

@@ -139,5 +139,5 @@ //scale bottom from red to white

mult: number;
max: number;
min: number;
constructor(min, max) {
max?: number;
min?: number;
constructor(min?: number, max?: number) {
super();

@@ -157,4 +157,4 @@ this.mult = 1.0;

//map value to hex color, range is provided
valueToHex(val, range) {
var lo, hi;
valueToHex(val: number, range?: any[]) {
var lo: number, hi: number;
val = this.mult * val;

@@ -165,4 +165,4 @@ if (range) {

} else {
lo = this.min;
hi = this.max;
lo = this.min!;
hi = this.max!;
}

@@ -181,3 +181,3 @@

var scale, color;
var scale: number, color: number;
if (val < q1) {

@@ -238,3 +238,3 @@ //scale green up, red up, blue down

min: number;
constructor(min, max) {
constructor(min: number, max: number) {
super();

@@ -258,4 +258,4 @@ this.mult = 1.0;

//map value to hex color, range is provided
valueToHex(val, range) {
var lo, hi;
valueToHex(val: number, range?: any[]) {
var lo: number, hi: number;
val = this.mult * val;

@@ -359,4 +359,4 @@ if (range) {

//map value to hex color, range is provided
valueToHex(val, range) {
var lo, hi;
valueToHex(val: number, range?: any[]) {
var lo: number, hi: number;
if (range) {

@@ -394,11 +394,10 @@ lo = range[0];

//map from names to gradient constructors
export const builtinGradients = {
rwb: RWB,
RWB: RWB,
roygb: ROYGB,
ROYGB: ROYGB,
sinebow: Sinebow,
linear: CustomLinear
export const builtinGradients = {
"rwb": RWB,
"RWB": RWB,
"roygb": ROYGB,
"ROYGB": ROYGB,
"sinebow": Sinebow,
"linear": CustomLinear
};

@@ -405,0 +404,0 @@

@@ -6,3 +6,2 @@ import {

Sprite,
Vector3,
Vector2,

@@ -14,8 +13,8 @@ } from "./WebGL";

//Adapted from the text sprite example from http://stemkoski.github.io/Three.js/index.html
// Adapted from the text sprite example from http://stemkoski.github.io/Three.js/index.html
export let LabelCount = 0;
// function for drawing rounded rectangles - for Label drawing
function roundRect(ctx, x, y, w, h, r, drawBorder) {
// Function for drawing rounded rectangles - for Label drawing
function roundRect(ctx: CanvasRenderingContext2D, x: any, y: any, w: number, h: number, r: number, drawBorder: boolean) {
ctx.beginPath();

@@ -37,3 +36,3 @@ ctx.moveTo(x + r, y);

//do all the checks to figure out what color is desired
function getColor(style, stylealpha?: any, init?: any) {
function getColor(style: any, stylealpha?: any, init?: any) {
var ret = init;

@@ -111,3 +110,3 @@ if (typeof style != "undefined") {

frame: any;
constructor(text, parameters) {
constructor(text: string, parameters: LabelSpec) {
this.id = LabelCount++;

@@ -189,3 +188,3 @@ this.stylespec = parameters || {};

) {
spriteAlignment = SpriteAlignment[spriteAlignment];
spriteAlignment = (SpriteAlignment as any)[spriteAlignment] ;
}

@@ -192,0 +191,0 @@

@@ -0,1 +1,3 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**

@@ -10,4 +12,5 @@ * This parses the ChemDoodle json file format. Although this is registered

* @category Parsers
*/
export function CDJSON(str, options) {
*/
export function CDJSON(str: string, options: ParserOptionsSpec) {
var atoms: any[][] & Record<string, any> = [[]];

@@ -18,3 +21,3 @@ if (typeof str === "string") {

}
var molecules = str.m;
var molecules = (str as any).m;
var atomsInFile = molecules[0].a; // Assumes there is at least one

@@ -45,3 +48,3 @@ var bondsInFile = molecules[0].b; // molecule and ignores any more

var elem = currentAtom.l || "C";
atom.elem = elem[0].toUpperCase() + elem.substr(1).toLowerCase();
atom.elem = elem[0].toUpperCase() + elem.substring(1).toLowerCase();

@@ -48,0 +51,0 @@ atom.serial = atoms[atoms.length - 1].length;

import { ParserOptionsSpec } from './ParserOptionsSpec';
// puts atoms specified in mmCIF fromat in str into atoms

@@ -7,10 +6,12 @@ import { assignBonds } from "./utils/assignBonds";

import { processSymmetries } from "./utils/processSymmetries";
import { conversionMatrix3, Matrix4, Vector3, } from "../WebGL"
import { conversionMatrix3, Matrix3, Matrix4, Vector3, } from "../WebGL"
/**
* Puts atoms specified in mmCIF fromat in str into atoms
*
* @param {string} str
* @param {ParserOptionsSpec} options
* @category Parsers
*/
*/
export function CIF(str: string, options: ParserOptionsSpec = {}) {

@@ -24,3 +25,3 @@ var atoms: any[] & Record<string, any> = [];

//coordinate conversion
var fractionalToCartesian = function (cmat, x, y, z) {
var fractionalToCartesian = function (cmat: Matrix3, x: number, y: number, z: number) {
return new Vector3(x, y, z).applyMatrix3(cmat);

@@ -30,3 +31,3 @@ };

// Used to handle quotes correctly
function splitRespectingQuotes(string, separator) {
function splitRespectingQuotes(string: string, separator: string | any[]) {
var sections: any[] = [];

@@ -37,3 +38,3 @@ var sectionStart = 0;

while (
string.substr(sectionEnd, separator.length) !== separator &&
string.substring(sectionEnd, sectionEnd + separator.length) !== separator &&
sectionEnd < string.length

@@ -55,3 +56,3 @@ ) {

}
sections.push(string.substr(sectionStart, sectionEnd - sectionStart));
sections.push(string.substring(sectionStart, sectionEnd));
sectionStart = sectionEnd = sectionEnd + separator.length;

@@ -96,3 +97,3 @@ }

line = lineArr.join('');
line = line.substr(0, dot) + "_" + line.substr(dot + 1);
line = line.substring(0, dot) + "_" + line.substring(dot + 1);
}

@@ -128,3 +129,3 @@ }

// if nothing left on the line go to the next one
var restOfLine = linesFiltered[lineNum].substr(
var restOfLine = linesFiltered[lineNum].substring(
linesFiltered[lineNum].indexOf(dataItemName) + dataItemName.length

@@ -135,3 +136,3 @@ );

if (linesFiltered[lineNum][0] === ";") {
var dataBlock = linesFiltered[lineNum].substr(1);
var dataBlock = linesFiltered[lineNum].substring(1);
lineNum++;

@@ -150,3 +151,3 @@ while (linesFiltered[lineNum] !== ";") {

lineNum++;
} else if (linesFiltered[lineNum].substr(0, 5) === "loop_") {
} else if (linesFiltered[lineNum].substring(0, 5) === "loop_") {
lineNum++;

@@ -198,3 +199,3 @@ var dataItems: any[] = [];

var conversionMatrix;
var conversionMatrix: Matrix3;
if (mmCIF._cell_length_a !== undefined) {

@@ -272,3 +273,3 @@ var a = parseFloat(mmCIF._cell_length_a);

}
atom.elem = elem[0].toUpperCase() + elem.substr(1, 1).toLowerCase();
atom.elem = elem[0].toUpperCase() + elem.substring(1, 2).toLowerCase();
atom.bonds = [];

@@ -332,3 +333,3 @@ atom.ss = "c";

}
var parseTerm = function (term) {
var parseTerm = function (term: string) {
var negative = term.match("-");

@@ -338,3 +339,3 @@ term = term.replace(/[-xyz]/g, "");

var numerator, denominator;
var numerator: number, denominator: number;
if (fractionParts[1] === undefined) {

@@ -358,3 +359,3 @@ denominator = 1;

);
var componentStrings = transform.split(",").map(function (val) {
var componentStrings = transform.split(",").map(function (val: string) {
return val.replace(/-/g, "+-");

@@ -361,0 +362,0 @@ });

import { Vector3, Matrix4 } from "../WebGL";
import { assignBonds } from "./utils/assignBonds";
import { anumToSymbol } from "./utils/anumToSymbol";
import { ParserOptionsSpec } from "./ParserOptionsSpec";
/**
* @param {string}
* str
* @param {ParserOptionsSpec}
* options
* @param {string}
* str
* @param {ParserOptionsSpec}
* options
* @category Parsers
*/
export function CUBE(str, options) {
export function CUBE(str: string, options: ParserOptionsSpec) {
options = options || {};

@@ -40,6 +40,6 @@ var atoms: any[][] & Record<string, any> = [[]];

// we are going to go with n<0 means angstrom - note this is just the first n
var convFactor = (lineArr[0] > 0) ? 0.529177 : 1;
var convFactor = ((lineArr[0] as any) > 0) ? 0.529177 : 1;
origin.multiplyScalar(convFactor);
var nX = Math.abs(lineArr[0]);
var nX = Math.abs((lineArr[0] as any));
var xVec = new Vector3(parseFloat(lineArr[1]),

@@ -50,3 +50,3 @@ parseFloat(lineArr[2]), parseFloat(lineArr[3]))

lineArr = lines[4].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
var nY = Math.abs(lineArr[0]);
var nY = Math.abs((lineArr[0] as any));
var yVec = new Vector3(parseFloat(lineArr[1]),

@@ -57,3 +57,3 @@ parseFloat(lineArr[2]), parseFloat(lineArr[3]))

lineArr = lines[5].replace(/^\s+/, "").replace(/\s+/g, " ").split(" ");
var nZ = Math.abs(lineArr[0]);
var nZ = Math.abs((lineArr[0] as any));
var zVec = new Vector3(parseFloat(lineArr[1]),

@@ -60,0 +60,0 @@ parseFloat(lineArr[2]), parseFloat(lineArr[3]))

@@ -6,11 +6,11 @@ import { assignPDBBonds } from "./utils/assignPDBBonds";

* Parse a gro file from str and create atoms
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options*
* @category Parsers
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options*
* @category Parsers
*/
*/
export function GRO(str /*, options*/) {
export function GRO(str: string /*, options*/) {
var allatoms: any[][] & Record<string, any> = [];

@@ -57,3 +57,3 @@ var lines = str.split(/\r?\n|\r/);

for (var b = 0; b < 3; b++) {
box[b] = parseFloat(box[b]) * 10.0;
(box[b] as any) = parseFloat(box[b]) * 10.0;
}

@@ -60,0 +60,0 @@ allatoms.box = box;

@@ -0,1 +1,2 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
import { assignBonds } from "./utils/assignBonds";

@@ -5,8 +6,9 @@

* Parse a lammps trajectory file from str and create atoms
*
* @category Parsers
*/
*/
export function LAMMPSTRJ(str, options) {
export function LAMMPSTRJ(str: string, options: ParserOptionsSpec) {
var atoms: any[] = [];
var dic = {
var dic:any = {
id: "serial",

@@ -47,3 +49,3 @@ type: "atom",

var atom: Record<string, any> = {};
var properties = {};
var properties: any = {};
var tokens = lines[j].split(" ");

@@ -50,0 +52,0 @@ for (var k = 0; k < tokens.length; k++) {

import { base64ToArray } from "../utilities";
import { Matrix4 } from "../WebGL";
import { ParserOptionsSpec } from "./ParserOptionsSpec";
import { computeSecondaryStructure } from "./utils/computeSecondaryStructure";

@@ -11,8 +12,8 @@ import { processSymmetries } from "./utils/processSymmetries";

var fromCharCode = function (charCodeArray) {
var fromCharCode = function (charCodeArray: any) {
return String.fromCharCode.apply(null, charCodeArray).replace(/\0/g, '');
};
var convertSS = function (val) {
//convert mmtf code to 3dmol code
var convertSS = function (val: number | boolean) {
// Convert mmtf code to 3dmol code
/*

@@ -45,8 +46,10 @@ 0: pi helix

/** @param bindata - binary UInt8Array buffer or a base64 encoded string
* @param ParserOptionsSpec
* @category Parsers
/**
* @param bindata - binary UInt8Array buffer or a base64 encoded string
* @param ParserOptionsSpec
* @category Parsers
*/
export function MMTFparser(bindata, options) {
export function MMTFparser(bindata: any, options: ParserOptionsSpec) {
var noH = !options.keepH; // suppress hydrogens by default

@@ -73,3 +76,2 @@ var selAltLoc = options.altLoc ? options.altLoc : 'A'; //default alternate location to select if present

// setup index counters
var modelIndex = 0;
var chainIndex = 0;

@@ -81,4 +83,2 @@ var groupIndex = 0;

var secStructList = mmtfData.secStructList;
var insCodeList = mmtfData.insCodeList;
var sequenceIndexList = mmtfData.sequenceIndexList;
var bFactorList = mmtfData.bFactorList;

@@ -94,3 +94,3 @@ var altLocList = mmtfData.altLocList;

// hoisted loop variables
var i, j, k, kl, m, n;
var i: number, j: number, k: number, kl: number, m: number, n: number;

@@ -116,3 +116,3 @@

let chainIsPolymer: boolean[] = [];
mmtfData.entityList.forEach(entity => {
mmtfData.entityList.forEach((entity: { chainIndexList: any[]; type: string; }) => {
entity.chainIndexList.forEach(ch => {

@@ -164,11 +164,2 @@ chainIsPolymer[ch] = entity.type == "polymer";

}
var insCode = null as string | null;
if (mmtfData.insCodeList) {
insCode = String.fromCharCode(insCodeList[groupIndex]);
}
var sequenceIndex = null;
if (sequenceIndexList) {
sequenceIndex = sequenceIndexList[groupIndex];
}
var groupId = mmtfData.groupIdList[groupIndex];

@@ -178,4 +169,4 @@ var groupName = groupData.groupName;

var startAtom = atomIndex;
//note the following is not identical to respecting HETATM records
//this information isn't available in MMTF.
// Note the following is not identical to respecting HETATM records
// this information isn't available in MMTF.
let isHETATM = mmtfHETATMtypes.has(groupType) || !chainIsPolymer[chainIndex];

@@ -311,4 +302,2 @@

}
modelIndex += 1;
}

@@ -315,0 +304,0 @@

@@ -0,3 +1,4 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
let SYBYLtoElem = {
let SYBYLtoElem:any = {
'C.1': 'C',

@@ -53,4 +54,4 @@ 'C1': 'C',

// parse SYBYL mol2 file from string - assumed to only contain one molecule
// tag
// Parse SYBYL mol2 file from string - assumed to only contain one molecule tag
/**

@@ -62,4 +63,5 @@ * @param {string}

* @category Parsers
*/
export function MOL2(str, options) {
*/
export function MOL2(str: string, options: ParserOptionsSpec) {
var atoms: any[][] & Record<string,any> = [[]];

@@ -77,3 +79,3 @@ var noH = false;

var lines = str.substr(mol_pos, str.length).split(/\r?\n|\r/);
var lines = str.substring(mol_pos).split(/\r?\n|\r/);
while (lines.length > 0) {

@@ -100,3 +102,3 @@ // serial is atom's index in file; index is atoms index in 'atoms'

var end = start + natoms;
var line;
var line: string;
// Process ATOMS

@@ -113,3 +115,3 @@ for (i = start; i < end; i++) {

elem = elem.split(".")[0];
elem = elem[0].toUpperCase() + elem.substr(1).toLowerCase();
elem = elem[0].toUpperCase() + elem.substring(1).toLowerCase();
}

@@ -116,0 +118,0 @@

@@ -1,9 +0,8 @@

// parse pdb file from str and create atoms
// if computeStruct is true will always perform secondary structure
// analysis,
// otherwise only do analysis of SHEET/HELIX comments are missing
import { ParserOptionsSpec } from "./ParserOptionsSpec";
import { getSinglePDB } from "./utils/getSinglePDB";
/**
* Parse pdb file from str and create atoms if computeStruct is true will always perform secondary structure analysis,
* otherwise only do analysis of SHEET/HELIX comments are missing
*
* @param {string} str

@@ -15,4 +14,5 @@ * @param {ParserOptionsSpec} options - keepH (do not strip hydrogens), noSecondaryStructure,

*
*/
export function PDB(str, options) {
*/
export function PDB(str: string, options: ParserOptionsSpec) {
options = options || {};

@@ -22,3 +22,3 @@ var atoms: any[] & Record<string, any> = []; //a separate list for each model

atoms.modelData = [];
var lines = str.split(/\r?\n|\r/);
var lines: any = str.split(/\r?\n|\r/);
while (lines.length > 0) {

@@ -25,0 +25,0 @@ var pdbinfo = getSinglePDB(lines, options, sslookup);

@@ -0,16 +1,17 @@

import { ParserOptionsSpec } from "./ParserOptionsSpec";
import { assignPDBBonds } from "./utils/assignPDBBonds";
import { computeSecondaryStructure } from "./utils/computeSecondaryStructure";
/**
* Parse a pqr file from str and create atoms. A pqr file is assumed to be a
* whitespace delimited PDB with charge and radius fields.
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
* @category Parsers
*/
export function PQR(str, options) {
/**
* Parse a pqr file from str and create atoms. A pqr file is assumed to be a whitespace delimited PDB with charge and radius fields.
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
* @category Parsers
*/
export function PQR(str: string, options: ParserOptionsSpec) {
var atoms: any[][] & Record<string, any> = [[]];

@@ -21,6 +22,6 @@ var computeStruct = !options.noSecondaryStructure;

var lines = str.split(/\r?\n|\r/);
var line;
var line: string | string[];
for (let i = 0; i < lines.length; i++) {
line = lines[i].replace(/^\s*/, ''); // remove indent
var recordName = line.substr(0, 6);
var recordName = line.substring(0, 6);

@@ -41,12 +42,12 @@ if (recordName.indexOf("END") == 0) {

// be filled out (e.g. the chain) so this doesn't work
var hetflag;
let serial = parseInt(line.substr(6, 5));
let atom = line.substr(12, 4).replace(/ /g, "");
let resn = line.substr(17, 3).trim();
let chain = line.substr(21, 1);
let resi = parseInt(line.substr(22, 4));
var hetflag: boolean;
let serial = parseInt(line.substring(6, 11));
let atom = line.substring(12, 16).replace(/ /g, "");
let resn = line.substring(17, 20).trim();
let chain = line.substring(21, 22);
let resi = parseInt(line.substring(22, 26));
// however let's split the coordinates, charge and radius by
// whitespace
// to support extra precision
var vals = line.substr(30).trim().split(/\s+/);
var vals = line.substring(30).trim().split(/\s+/);
var x = parseFloat(vals[0]);

@@ -62,3 +63,3 @@ var y = parseFloat(vals[1]);

// second character in the atom name being lowercase
elem = atom.substr(0, 2);
elem = atom.substring(0, 2);
}

@@ -96,6 +97,6 @@

// described in CONECT. But what about 2JYT???
var from = parseInt(line.substr(6, 5));
var from = parseInt(line.substring(6, 11));
var fromAtom = atoms[atoms.length-1][serialToIndex[from]];
for (let j = 0; j < 4; j++) {
var to = parseInt(line.substr([ 11, 16, 21, 26 ][j], 5));
var to = parseInt(line.substring([ 11, 16, 21, 26 ][j], [ 11, 16, 21, 26 ][j] + 5));
var toAtom = atoms[atoms.length-1][serialToIndex[to]];

@@ -102,0 +103,0 @@ if (fromAtom !== undefined && toAtom !== undefined) {

// @ts-nocheck
/**
* Parse a prmtop file from str and create atoms
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
*
* @param {string}
* str
* @param {ParserOptionsSpec}
* options - noSecondaryStructure (do not compute ss)
* @category Parsers
*/
*/
export function PRMTOP(str /*, options*/) {
export function PRMTOP(str: string /*, options*/) {
var atoms = [];
var atomIndex;
var atomIndex: number;
var count = 0;

@@ -17,0 +17,0 @@ var lines = str.split(/\r?\n|\r/);

@@ -1,8 +0,5 @@

/*
* @param {!Array.<string>} lines
* @param {ParserOptionsSpec} options
* @returns {!Array.<Array<Object>>}
*/
var parseV2000 = function (lines, options) {
var atoms: any[][] & Record<string, any> = [[]];
import { ParserOptionsSpec } from "./ParserOptionsSpec";
var parseV2000 = function (lines: any, options: ParserOptionsSpec) {
var atoms: any & Record<string, any> = [[]];
var noH = false;

@@ -13,19 +10,19 @@ if (typeof options.keepH !== "undefined") noH = !options.keepH;

if (lines.length < 4) break;
var atomCount = parseInt(lines[3].substr(0, 3));
var atomCount = parseInt(lines[3].substring(0, 3));
if (isNaN(atomCount) || atomCount <= 0) break;
var bondCount = parseInt(lines[3].substr(3, 3));
var bondCount = parseInt(lines[3].substring(3, 6));
var offset = 4;
if (lines.length < 4 + atomCount + bondCount) break;
// serial is atom's index in file; index is atoms index in 'atoms'
// Serial is atom's index in file; index is atoms index in 'atoms'
var serialToIndex: number[] = [];
var start = atoms[atoms.length - 1].length;
var end = start + atomCount;
var i, line;
var i: number, line: string;
for (i = start; i < end; i++, offset++) {
line = lines[offset];
var atom: Record<string, any> = {};
var elem = line.substr(31, 3).replace(/ /g, "");
var elem = line.substring(31, 34).replace(/ /g, "");
atom.atom = atom.elem =
elem[0].toUpperCase() + elem.substr(1).toLowerCase();
elem[0].toUpperCase() + elem.substring(1).toLowerCase();

@@ -35,5 +32,5 @@ if (atom.elem !== "H" || !noH) {

serialToIndex[i] = atoms[atoms.length - 1].length;
atom.x = parseFloat(line.substr(0, 10));
atom.y = parseFloat(line.substr(10, 10));
atom.z = parseFloat(line.substr(20, 10));
atom.x = parseFloat(line.substring(0, 10));
atom.y = parseFloat(line.substring(10, 20));
atom.z = parseFloat(line.substring(20, 30));
atom.hetflag = true;

@@ -50,5 +47,5 @@ atom.bonds = [];

line = lines[offset];
var from = serialToIndex[parseInt(line.substr(0, 3)) - 1 + start];
var to = serialToIndex[parseInt(line.substr(3, 3)) - 1 + start];
var order = parseFloat(line.substr(6));
var from = serialToIndex[parseInt(line.substring(0, 3)) - 1 + start];
var to = serialToIndex[parseInt(line.substring(3, 6)) - 1 + start];
var order = parseFloat(line.substring(6));
if (typeof from != "undefined" && typeof to != "undefined") {

@@ -72,8 +69,9 @@ atoms[atoms.length - 1][from].bonds.push(to);

/*
/**
* @param {!Array.<string>} lines
* @param {ParserOptionsSpec} options
* @returns {!Array.<!Array<!Object>>}
*/
var parseV3000 = function (lines, options) {
*/
var parseV3000 = function (lines: any, options: ParserOptionsSpec) {
var atoms: any[][] & Record<string, any> = [[]];

@@ -89,3 +87,3 @@ var noH = false;

var counts = lines[5].substr(13).match(/\S+/g);
var counts = lines[5].substring(13).match(/\S+/g);

@@ -107,11 +105,11 @@ if (counts.length < 2) break;

var end = start + atomCount;
var i, line;
var i: number, line: string;
for (i = start; i < end; i++, offset++) {
line = lines[offset];
var atomParts = line.substr(6).match(/\S+/g);
if (atomParts.length > 4) {
var atomParts = line.substring(6).match(/\S+/g);
if (atomParts!.length > 4) {
var atom: Record<string, any> = {};
var elem = atomParts[1].replace(/ /g, "");
var elem = atomParts![1].replace(/ /g, "");
atom.atom = atom.elem =
elem[0].toUpperCase() + elem.substr(1).toLowerCase();
elem[0].toUpperCase() + elem.substring(1).toLowerCase();

@@ -121,5 +119,5 @@ if (atom.elem !== "H" || !noH) {

serialToIndex[i] = atoms[atoms.length - 1].length;
atom.x = parseFloat(atomParts[2]);
atom.y = parseFloat(atomParts[3]);
atom.z = parseFloat(atomParts[4]);
atom.x = parseFloat(atomParts![2]);
atom.y = parseFloat(atomParts![3]);
atom.z = parseFloat(atomParts![4]);
atom.hetflag = true;

@@ -143,7 +141,7 @@ atom.bonds = [];

line = lines[offset];
var bondParts = line.substr(6).match(/\S+/g);
if (bondParts.length > 3) {
var from = serialToIndex[parseInt(bondParts[2]) - 1 + start];
var to = serialToIndex[parseInt(bondParts[3]) - 1 + start];
var order = parseFloat(bondParts[1]);
var bondParts = line.substring(6).match(/\S+/g);
if (bondParts!.length > 3) {
var from = serialToIndex[parseInt(bondParts![2]) - 1 + start];
var to = serialToIndex[parseInt(bondParts![3]) - 1 + start];
var order = parseFloat(bondParts![1]);
if (typeof from != "undefined" && typeof to != "undefined") {

@@ -172,3 +170,2 @@ atoms[atoms.length - 1][from].bonds.push(to);

/**

@@ -180,9 +177,9 @@ * @param {string}

* @category Parsers
*/
*/
export function SDF(str, options) {
export function SDF(str: string, options: ParserOptionsSpec) {
var molformat = "V2000";
var lines = str.split(/\r?\n|\r/);
if (lines.length > 3 && lines[3].length > 38) {
molformat = lines[3].substr(34, 5);
molformat = lines[3].substring(34, 39);
}

@@ -194,3 +191,3 @@ if (molformat === "V2000") {

}
return [[]];
return [['']];
}

@@ -1,2 +0,2 @@

export const anumToSymbol = {
export const anumToSymbol:any = {
1: 'H', 2: 'He',

@@ -3,0 +3,0 @@ 3:'Li',4:'Be', 5: 'B', 6: 'C', 7:'N', 8:'O', 9:'F', 10: 'Ne',

import { bondLength } from "./bondLength";
/*
* return true if atom1 and atom2 are probably bonded to each other based on distance alone
*/
export function areConnected(atom1, atom2) {
* Return true if atom1 and atom2 are probably bonded to each other based on distance alone
*/
export function areConnected(atom1: { elem: any; x: number; y: number; z: number; altLoc: string; }, atom2: { elem: any; x: number; y: number; z: number; altLoc: string; }) {
var maxsq = bondLength(atom1.elem) + bondLength(atom2.elem);

@@ -8,0 +9,0 @@ maxsq += 0.25; // fudge factor, especially important for md frames, also see 1i3d

@@ -1,5 +0,5 @@

// this will identify all hydrogen bonds between backbone
// This will identify all hydrogen bonds between backbone
// atoms; assume atom names are correct, only identifies
// single closest hbond
export function assignBackboneHBonds(atomsarray, hbondCutoff) {
export function assignBackboneHBonds(atomsarray: string | any[], hbondCutoff: number) {
let maxlength = hbondCutoff || 3.2;

@@ -6,0 +6,0 @@ let maxlengthSq = maxlength*maxlength;

import { areConnected } from "./areConnected";
/*
/**
* @param {AtomSpec[]} atoms
*/
export function assignBonds(atoms) {
// assign bonds - yuck, can't count on connect records
*/
export function assignBonds(atoms: string | any[]) {
// Assign bonds - yuck, can't count on connect records
for (var i = 0, n = atoms.length; i < n; i++) {

@@ -35,3 +36,3 @@ // Don't reindex if atoms are already indexed

var findConnections = function (points, otherPoints) {
var findConnections = function (points: string | any[], otherPoints: string | any[]) {
for (var i = 0; i < points.length; i++) {

@@ -38,0 +39,0 @@ var atom1 = points[i];

@@ -1,3 +0,2 @@

// this is optimized for proteins where it is assumed connected
// atoms are on the same or next residue
// This is optimized for proteins where it is assumed connected atoms are on the same or next residue

@@ -8,11 +7,13 @@ import { areConnected } from "./areConnected";

/*
/**
* @param {AtomSpec[]}
* atomsarray
*/
export function assignPDBBonds(atomsarray) {
*/
export function assignPDBBonds(atomsarray: string | any[]) {
// assign bonds - yuck, can't count on connect records
var protatoms: any[] = [];
var hetatoms: any[] = [];
var i, n;
var i: number, n: number;
for (i = 0, n = atomsarray.length; i < n; i++) {

@@ -36,3 +37,3 @@ var atom: any = atomsarray[i];

var reschain = -1;
var lastResConnected;
var lastResConnected: boolean;

@@ -39,0 +40,0 @@ for (i = 0, n = protatoms.length; i < n; i++) {

import { bondTable } from "./bondLength";
//attempts to infer atomic element from an atom name
export function atomNameToElem(name, nothetero) {
// Attempts to infer atomic element from an atom name
export function atomNameToElem(name: string, nothetero: boolean) {
var elem = name.replace(/ /g, "");

@@ -10,3 +10,3 @@ if(elem.length > 0 && elem[0] == 'H' && elem != 'Hg' && elem != 'He' && elem != 'Hf' && elem != 'Hs' && elem != 'Ho') {

if(elem.length > 1) {
elem = elem[0].toUpperCase() + elem.substr(1).toLowerCase();
elem = elem[0].toUpperCase() + elem.substring(1).toLowerCase();
if(typeof(bondTable[elem]) === 'undefined') {

@@ -13,0 +13,0 @@ //not a known element, probably should just use first letter

/* Covalent radii lookup table used to identify bonds in assignBonds
*/
export let bondTable = {
// Covalent radii lookup table used to identify bonds in assignBonds
export let bondTable:any = {
H :0.37, He:0.32,

@@ -16,12 +15,8 @@ Li:1.34,Be:0.90, B :0.82,C :0.77,N :0.75,O :0.73,F :0.71,Ne:0.69,

/** Get the length used for bond identification for the specified element.
*
*/
export function bondLength(elem) {
// Get the length used for bond identification for the specified element.
export function bondLength(elem: string | number) {
return bondTable[elem] || 1.6;
};
/** Set the length used for bond identification for the specified element.
*
*/
// Set the length used for bond identification for the specified element.
export function setBondLength(elem:string, radius:number) {

@@ -28,0 +23,0 @@ if(radius < 0) radius = 0;

import { assignBackboneHBonds } from "./assignBackboneHBonds";
export function computeSecondaryStructure(atomsarray, hbondCutoff) {
assignBackboneHBonds(atomsarray, hbondCutoff);
export function computeSecondaryStructure(atomsarray: string | any[], hbondCutoff: number | undefined) {
assignBackboneHBonds(atomsarray, hbondCutoff!);
// compute, per residue, what the secondary structure is
var chres = {}; // lookup by chain and resid
var i, il, c, r; // i: used in for loop, il: length of atomsarray
var atom, val;
var i: number, il: number, c: string | number, r: number; // i: used in for loop, il: length of atomsarray
var atom: { chain: string | number; hbondDistanceSq: number; hbondOther: any; resi: number; ss: string; ssbegin: boolean; ssend: boolean; }, val: string;

@@ -11,0 +11,0 @@ //identify helices first

@@ -9,5 +9,6 @@ import { Matrix4 } from "../../WebGL";

import { validateBonds } from "./validateBonds";
import { ParserOptionsSpec } from "../ParserOptionsSpec";
//return one model worth of pdb, returns atoms, modelData, and remaining lines
export function getSinglePDB(lines, options, sslookup) {
// Return one model worth of pdb, returns atoms, modelData, and remaining lines
export function getSinglePDB(lines: string[], options: ParserOptionsSpec, sslookup: { [x: string]: { [x: string]: any; }; hasOwnProperty?: any; }) {
var atoms: any[] = [];

@@ -22,8 +23,7 @@ var assignbonds =

var modelData: Record<string, any> = { symmetries: [] };
var atom;
var atom: any;
var remainingLines = [];
var hasStruct = false;
var serialToIndex: number[] = []; // map from pdb serial to index in atoms
var line;
var line: string | string[];
var seenbonds: Record<any, any> = {}; //sometimes connect records are duplicated as an unofficial means of relaying bond orders

@@ -33,5 +33,6 @@

line = lines[i].replace(/^\s*/, ""); // remove indent
var recordName = line.substr(0, 6);
var startChain, startResi, endChain, endResi;
var recordName = line.substring(0, 6);
var startChain: string, startResi: number, endResi: number;
if (recordName.indexOf("END") == 0) {

@@ -50,21 +51,21 @@ remainingLines = lines.slice(i + 1);

} else if (recordName == "ATOM " || recordName == "HETATM") {
var resn, chain, resi, icode, x, y, z, hetflag, elem, serial, altLoc, b;
altLoc = line.substr(16, 1);
var resn: any, chain: any, resi: string | number, icode: string, x: number, y: number, z: number, hetflag: boolean, elem: string | string[], serial: number, altLoc: string, b: number;
altLoc = line.substring(16, 17);
if (altLoc != " " && altLoc != selAltLoc && selAltLoc != "*") continue;
serial = parseInt(line.substr(6, 5));
atom = line.substr(12, 4).replace(/ /g, "");
resn = line.substr(17, 3).replace(/ /g, "");
chain = line.substr(21, 1);
resi = parseInt(line.substr(22, 4));
icode = line.substr(26, 1);
x = parseFloat(line.substr(30, 8));
y = parseFloat(line.substr(38, 8));
z = parseFloat(line.substr(46, 8));
b = parseFloat(line.substr(60, 8));
elem = line.substr(76, 2).replace(/ /g, "");
serial = parseInt(line.substring(6, 11));
atom = line.substring(12, 16).replace(/ /g, "");
resn = line.substring(17, 20).replace(/ /g, "");
chain = line.substring(21, 22);
resi = parseInt(line.substring(22, 26));
icode = line.substring(26, 27);
x = parseFloat(line.substring(30, 38));
y = parseFloat(line.substring(38, 46));
z = parseFloat(line.substring(46, 54));
b = parseFloat(line.substring(60, 68));
elem = line.substring(76, 78).replace(/ /g, "");
if (elem === "" || typeof bondTable[elem] === "undefined") {
// for some incorrect PDB files
elem = atomNameToElem(line.substr(12, 2), line[0] == "A");
elem = atomNameToElem(line.substring(12, 14), line[0] == "A");
} else {
elem = elem[0].toUpperCase() + elem.substr(1).toLowerCase();
elem = elem[0].toUpperCase() + elem.substring(1).toLowerCase();
}

@@ -101,7 +102,5 @@

} else if (recordName == "SHEET ") {
hasStruct = true;
startChain = line.substr(21, 1);
startResi = parseInt(line.substr(22, 4));
endChain = line.substr(32, 1);
endResi = parseInt(line.substr(33, 4));
startChain = line.substring(21, 22);
startResi = parseInt(line.substring(22, 26));
endResi = parseInt(line.substring(33, 37));
if (!(startChain in sslookup)) {

@@ -120,3 +119,3 @@ sslookup[startChain] = {};

// described in CONECT. But what about 2JYT???
var from = parseInt(line.substr(6, 5));
var from = parseInt(line.substring(6, 11));
var fromindex = serialToIndex[from];

@@ -126,3 +125,3 @@ var fromAtom = atoms[fromindex];

for (let j = 0; j < 4; j++) {
var to = parseInt(line.substr(coffsets[j], 5));
var to = parseInt(line.substring(coffsets[j], coffsets[j]+5));
var toindex = serialToIndex[to];

@@ -161,7 +160,5 @@ let from_to = fromindex+":"+toindex;

} else if (recordName == "HELIX ") {
hasStruct = true;
startChain = line.substr(19, 1);
startResi = parseInt(line.substr(21, 4));
endChain = line.substr(31, 1);
endResi = parseInt(line.substr(33, 4));
startChain = line.substring(19, 20);
startResi = parseInt(line.substring(21, 25));
endResi = parseInt(line.substring(33, 37));
if (!(startChain in sslookup)) {

@@ -178,9 +175,9 @@ sslookup[startChain] = {};

recordName == "REMARK" &&
line.substr(13, 5) == "BIOMT"
line.substring(13, 18) == "BIOMT"
) {
var n;
var n: number;
var matrix = new Matrix4();
for (n = 1; n <= 3; n++) {
line = lines[i].replace(/^\s*/, "");
if (parseInt(line.substr(18, 1)) == n) {
if (parseInt(line.substring(18, 19)) == n) {
// check for all

@@ -191,9 +188,9 @@ // three lines

// "BIOMT" to n
matrix.elements[n - 1] = parseFloat(line.substr(23, 10));
matrix.elements[n - 1 + 4] = parseFloat(line.substr(33, 10));
matrix.elements[n - 1 + 8] = parseFloat(line.substr(43, 10));
matrix.elements[n - 1 + 12] = parseFloat(line.substr(53));
matrix.elements[n - 1] = parseFloat(line.substring(23, 33));
matrix.elements[n - 1 + 4] = parseFloat(line.substring(33, 43));
matrix.elements[n - 1 + 8] = parseFloat(line.substring(43, 53));
matrix.elements[n - 1 + 12] = parseFloat(line.substring(53));
i++;
} else {
while (line.substr(13, 5) == "BIOMT") {
while (line.substring(13, 18) == "BIOMT") {
i++;

@@ -211,9 +208,9 @@ line = lines[i].replace(/^\s*/, "");

} else if (recordName == "CRYST1") {
let a, b, c, alpha, beta, gamma;
a = parseFloat(line.substr(7, 8));
b = parseFloat(line.substr(16, 8));
c = parseFloat(line.substr(25, 8));
alpha = parseFloat(line.substr(34, 6));
beta = parseFloat(line.substr(41, 6));
gamma = parseFloat(line.substr(48, 6));
let a: number, b: number, c: number, alpha: number, beta: number, gamma: number;
a = parseFloat(line.substring(7, 15));
b = parseFloat(line.substring(16, 24));
c = parseFloat(line.substring(25, 33));
alpha = parseFloat(line.substring(34, 40));
beta = parseFloat(line.substring(41, 47));
gamma = parseFloat(line.substring(48, 54));
modelData.cryst = {

@@ -228,7 +225,7 @@ a: a,

} else if (recordName == "ANISOU") {
let serial = parseInt(line.substr(6, 5));
let serial = parseInt(line.substring(6, 11));
var anisouAtomIndex = serialToIndex[serial];
var anisouAtom = atoms[anisouAtomIndex];
if (anisouAtom) {
var vals = line.substr(30).trim().split(/\s+/);
var vals = line.substring(30).trim().split(/\s+/);
var uMat = {

@@ -235,0 +232,0 @@ u11: parseInt(vals[0]),

@@ -1,3 +0,3 @@

export function isEmpty(obj) {
var name;
export function isEmpty(obj: { [x: string]: { [x: string]: any; }; hasOwnProperty?: any; }) {
var name: string;
for (name in obj) {

@@ -4,0 +4,0 @@ return false;

@@ -0,9 +1,10 @@

import { ParserOptionsSpec } from 'parsers/ParserOptionsSpec';
import { Matrix3, conversionMatrix3, Vector3 } from '../../WebGL';
//adds symmetry info to either duplicate and rotate/translate biological unit later or add extra atoms now
//matrices may be modified if normalization is requested
export function processSymmetries(copyMatrices, atoms, options, cryst) {
// Adds symmetry info to either duplicate and rotate/translate biological unit later or add extra atoms now
// matrices may be modified if normalization is requested
export function processSymmetries(copyMatrices: string[] | any[], atoms: any[], options: ParserOptionsSpec, cryst: { a: any; b: number; c: number; alpha: number; beta: number; gamma: number; }) {
var dontDuplicate = !options.duplicateAssemblyAtoms;
var end = atoms.length;
var offset = end;
var t, l, n; // Used in for loops
var t: any, l: number, n: number; // Used in for loops

@@ -112,3 +113,3 @@ let modifiedIdentity = -1;

//we have explicitly duplicated the atoms, remove model symmetry information
copyMatrices.length = 0;
(copyMatrices as any).length = 0;
} else if (copyMatrices.length > 1) {

@@ -115,0 +116,0 @@ for (t = 0; t < atoms.length; t++) {

@@ -1,2 +0,2 @@

export const standardResidues = new Set([
export const standardResidues: Set<string> = new Set([
"ABU",

@@ -3,0 +3,0 @@ "ACD",

@@ -1,3 +0,3 @@

//make sure bonds are actually two way
export function validateBonds (atomsarray, serialToIndex) {
// Make sure bonds are actually two way
export function validateBonds (atomsarray: string[] | any[], serialToIndex: number[]) {
for (var i = 0, n = atomsarray.length; i < n; i++) {

@@ -4,0 +4,0 @@ var atom = atomsarray[i];

@@ -9,4 +9,5 @@ import { Matrix3 } from "../WebGL";

* @category Parsers
*/
export function VASP(str /*,options*/) {
*/
export function VASP(str: string /*,options*/) {
var atoms: any[][] & Record<string, any> = [[]];

@@ -37,5 +38,5 @@ var lattice: Record<string, number | Float32Array> = {};

lattice.xVec = new Float32Array(lines[2].replace(/^\s+/, "").split(/\s+/));
lattice.yVec = new Float32Array(lines[3].replace(/^\s+/, "").split(/\s+/));
lattice.zVec = new Float32Array(lines[4].replace(/^\s+/, "").split(/\s+/));
lattice.xVec = new Float32Array((lines[2] as any).replace(/^\s+/, "").split(/\s+/));
lattice.yVec = new Float32Array((lines[3] as any).replace(/^\s+/, "").split(/\s+/));
lattice.zVec = new Float32Array((lines[4] as any).replace(/^\s+/, "").split(/\s+/));

@@ -61,3 +62,3 @@ var matrix = new Matrix3(

var atomSpeciesNumber = new Int16Array(
lines[6].replace(/^\s+/, "").split(/\s+/)
(lines[6] as any).replace(/^\s+/, "").split(/\s+/)
);

@@ -92,7 +93,7 @@ var vaspMode = lines[7].replace(/\s+/, "");

var coords = new Float32Array(
lines[atomCounter + j].replace(/^\s+/, "").split(/\s+/)
(lines[atomCounter + j] as any).replace(/^\s+/, "").split(/\s+/)
);
var atom: Record<string, number | []> = {};
atom.elem = atomSymbol;
(atom.elem as any) = atomSymbol;
if (vaspMode == "cartesian") {

@@ -99,0 +100,0 @@ atom.x = lattice.length * coords[0];

import { ParserOptionsSpec } from './ParserOptionsSpec';
// read an XYZ file from str and return result

@@ -8,6 +7,9 @@ import { Matrix3 } from "../WebGL";

/**
* Read an XYZ file from str and return result
*
* @param {string} str
* @param {ParserOptionsSpec} options
* @category Parsers
*/
*/
export function XYZ(str: string, options: ParserOptionsSpec) {

@@ -53,3 +55,3 @@ options = options || {};

atom.atom = atom.elem =
elem[0].toUpperCase() + elem.substr(1, 1).toLowerCase();
elem[0].toUpperCase() + elem.substring(1, 2).toLowerCase();
atom.x = parseFloat(tokens[1]);

@@ -56,0 +58,0 @@ atom.y = parseFloat(tokens[2]);

@@ -174,9 +174,9 @@ //properties for mapping

//this can be supplied to mapAtomProperties
export function applyPartialCharges(atom, keepexisting) {
export function applyPartialCharges(atom: Record<string, any>, keepexisting: boolean) {
if(!keepexisting || typeof(atom.partialCharge) === "undefined") {
if(atom.resn && atom.atom) {
var key = atom.resn+":"+atom.atom;
atom.properties.partialCharge = partialCharges[key];
atom.properties.partialCharge = (partialCharges as any)[key];
}
}
};

@@ -98,2 +98,4 @@ // Specifications for various object types used in 3Dmol.js

model?: GLModel | number | GLModel[] | number[];
/** frame index of individual frame to style; will apply to all frames if not set */
frame?: number;
/** index of the atom or atoms to select */

@@ -100,0 +102,0 @@ index?: number | number[];

//Hackish way to create webworker (independent of $3Dmol namespace) within minified file
//We need to convert actual javascript into a string, not typescript, so for the time being
//this will remain a JS file

@@ -24,3 +25,3 @@ $3Dmol.workerString = function(){

}
ps.marchingcube(type);
ps.marchingcube(type); // jshint ignore:line
var VandF = ps.getFacesAndVertices(obj.atomsToShow);

@@ -35,8 +36,8 @@ self.postMessage(VandF);

// (See: http://stackoverflow.com/questions/1661197/what-characters-are-valid-for-javascript-variable-names)
$3Dmol.workerString += ";\nfunction _classCallCheck() {};"; //hack for babel
$3Dmol.workerString += ";\n"+$3Dmol.Vector3.toString();
$3Dmol.workerString += ";\n"+$3Dmol.MarchingCubeInitializer.toString()+";\nvar MarchingCube = new MarchingCubeInitializer();";
$3Dmol.workerString += ";\n"+$3Dmol.MarchingCubeInitializer.toString()+";\n\n";
$3Dmol.workerString += ";\n"+$3Dmol.PointGrid.toString()+";\n";
$3Dmol.workerString += ";\nvar ProteinSurface = "+$3Dmol.ProteinSurface.toString()+";\n";
$3Dmol.workerString = $3Dmol.workerString.replace(/[a-zA-Z_$]{1}[0-9a-zA-Z_$]*WEBPACK_IMPORTED_MODULE_[0-9]__\./g,''); //replace webpack generated prefixes
//console.log($3Dmol.workerString);
$3Dmol.SurfaceWorker = window.URL ? window.URL.createObjectURL(new Blob([$3Dmol.workerString],{type: 'text/javascript'})) : undefined;

@@ -281,3 +281,3 @@ //a collection of miscellaneous utility functions

str = str.replace(/%7E/, '~'); //copy/pasting urls sometimes does this
str = str.replace(/%7E/g, '~'); //copy/pasting urls sometimes does this
//convert things that look like numbers into numbers

@@ -423,5 +423,5 @@ var massage = function (val) {

}
if (query.substr(0, 5) === 'mmtf:') {
if (query.substring(0, 5) === 'mmtf:') {
pdbUri = options && options.pdbUri ? options.pdbUri : "https://mmtf.rcsb.org/v1.0/full/";
query = query.substr(5).toUpperCase();
query = query.substring(5).toUpperCase();
uri = pdbUri + query;

@@ -443,3 +443,3 @@ if (options && typeof options.noComputeSecondaryStructure === 'undefined') {

else {
if (query.substr(0, 4) === 'pdb:') {
if (query.substring(0, 4) === 'pdb:') {
type = 'mmtf';

@@ -454,3 +454,3 @@ if (options && options.format) {

}
query = query.substr(4).toUpperCase();
query = query.substring(4).toUpperCase();
if (!query.match(/^[1-9][A-Za-z0-9]{3}$/)) {

@@ -469,5 +469,5 @@ alert("Wrong PDB ID");

} else if (query.substr(0, 4) == 'cid:') {
} else if (query.substring(0, 4) == 'cid:') {
type = "sdf";
query = query.substr(4);
query = query.substring(4);
if (!query.match(/^[0-9]+$/)) {

@@ -478,4 +478,4 @@ alert("Wrong Compound ID"); return;

"/SDF?record_type=3d";
} else if (query.substr(0, 4) == 'url:') {
uri = query.substr(4);
} else if (query.substring(0, 4) == 'url:') {
uri = query.substring(4);
type = uri;

@@ -482,0 +482,0 @@ }

@@ -5,3 +5,3 @@ import { base64ToArray } from "./utilities";

import { CUBE } from "./parsers/CUBE";
import {inflate} from "pako";
import { inflate } from "pako";

@@ -56,3 +56,3 @@

try {
if (this[format] && this.isbinary.has(format)) {
if ((this as any)[format] && this.isbinary.has(format)) {
if (typeof (str) == "string") {

@@ -72,7 +72,7 @@ //assume base64 encoded

if (this[format]) {
if ((this as any)[format]) {
if (this.isbinary.has(format) && typeof (str) == "string") {
str = base64ToArray(str);
}
this[format](str);
(this as any)[format](str);
}

@@ -178,3 +178,3 @@

*/
vasp = function (str) {
vasp = function (str: string) {

@@ -203,3 +203,3 @@ var lines = str.replace(/^\s+/, "").split(/[\n\r]/);

// each dimension
var v;
var v: string[];
v = lines[2].replace(/^\s+/, "").split(/\s+/);

@@ -225,6 +225,7 @@ var xVec = new Vector3(parseFloat(v[0]), parseFloat(v[1]), parseFloat(v[2])).multiplyScalar(convFactor * l_units);

var nX = Math.abs(lineArr[0]);
var nY = Math.abs(lineArr[1]);
var nZ = Math.abs(lineArr[2]);
var nX = Math.abs(parseFloat(lineArr[0]));
var nY = Math.abs(parseFloat(lineArr[1]));
var nZ = Math.abs(parseFloat(lineArr[2]));
var origin = this.origin = new Vector3(0, 0, 0);

@@ -253,10 +254,10 @@

lines.splice(0, 1); //Remove the dimension line
lines.splice(0, 1); // Remove the dimension line
var raw = lines.join(" ");
raw = raw.replace(/^\s+/, '');
raw = raw.split(/[\s\r]+/);
raw.splice(nX * nY * nZ + 1);
var rawArray = raw.split(/[\s\r]+/);
rawArray.splice(nX * nY * nZ + 1);
var preConvertedData = new Float32Array(raw); //We still have to format it to get the density
var preConvertedData = Float32Array.from(rawArray, parseFloat); //We still have to format it to get the density

@@ -280,5 +281,5 @@ for (var i = 0; i < preConvertedData.length; i++) {

// parse dx data - does not support all features of the file format
dx = function (str) {
dx = function (str: string) {
var lines = str.split(/[\n\r]+/);
var m;
var m: string[];
var recounts = /gridpositions\s+counts\s+(\d+)\s+(\d+)\s+(\d+)/;

@@ -345,8 +346,8 @@ var reorig = /^origin\s+(\S+)\s+(\S+)\s+(\S+)/;

var raw = lines.splice(i).join(" ");
raw = raw.split(/[\s\r]+/);
this.data = new Float32Array(raw);
var rawArray = raw.split(/[\s\r]+/);
this.data = Float32Array.from(rawArray, parseFloat);
};
// parse cube data
cube(str) {
cube(str: string) {
var lines = str.split(/\r?\n/);

@@ -373,4 +374,4 @@

raw = raw.replace(/^\s+/, '');
raw = raw.split(/[\s\r]+/);
this.data = new Float32Array(raw);
var rawArray = raw.split(/[\s\r]+/);
this.data = Float32Array.from(rawArray, parseFloat);

@@ -382,3 +383,3 @@ };

//parse cp4 files
ccp4(bin) {
ccp4(bin: Int8Array) {

@@ -501,3 +502,3 @@ // http://www.ccp4.ac.uk/html/maplib.html#description

var h = header;
var basisX = [
var basisX: Array<any> = [
h.xlen,

@@ -508,3 +509,3 @@ 0,

var basisY = [
var basisY: Array<any> = [
h.ylen * Math.cos(Math.PI / 180.0 * h.gamma),

@@ -515,3 +516,3 @@ h.ylen * Math.sin(Math.PI / 180.0 * h.gamma),

var basisZ = [
var basisZ: Array<any> = [
h.zlen * Math.cos(Math.PI / 180.0 * h.beta),

@@ -530,5 +531,5 @@ h.zlen * (

var basis = [0, basisX, basisY, basisZ];
var nxyz = [0, h.MX, h.MY, h.MZ];
var mapcrs = [0, h.MAPC, h.MAPR, h.MAPS];
var basis: Array<any> = [0, basisX, basisY, basisZ];
var nxyz: Array<any> = [0, h.MX, h.MY, h.MZ];
var mapcrs: Array<any> = [0, h.MAPC, h.MAPR, h.MAPS];

@@ -535,0 +536,0 @@ this.matrix = new Matrix4();

import { Sphere } from "./WebGL/shapes";
import { Vector3, Matrix4 } from "./WebGL/math";
import { VolumetricMaterial, Mesh, Texture, Object3D } from "./WebGL";
import { VolumetricMaterial, Mesh, Texture, Object3D, Material } from "./WebGL";
import { CC } from "./colors";

@@ -34,4 +34,4 @@ import { GLShape } from "./GLShape";

static interpolateArray(data, fitCount) {
function linearInterpolate(before, after, atPoint) {
static interpolateArray(data: string | any[], fitCount: number) {
function linearInterpolate(before: number, after: number, atPoint: number) {
return before + (after - before) * atPoint;

@@ -69,3 +69,3 @@ }

constructor(data, spec) {
constructor(data: { matrix: { elements: any; }; size: { x: number; y: number; z: number; }; unit: { x: number; y: number; z: number; }; origin: { x: number; y: number; z: number; }; data: number[]; getIndex: (arg0: number, arg1: number, arg2: number) => number; }, spec: VolumetricRendererSpec) {
spec = spec || {};

@@ -78,4 +78,4 @@ var transferfn = Object.assign([], spec.transferfn);

// arrange points based on position property
transferfn.forEach(function (a) { a.value = parseFloat(a.value); });
transferfn.sort(function (a, b) { return a.value - b.value; });
transferfn.forEach(function (a: { value: any; }) { a.value = parseFloat(a.value); });
transferfn.sort(function (a: { value: number; }, b: { value: number; }) { return a.value - b.value; });
this.min = transferfn[0].value;

@@ -235,3 +235,3 @@ if (transferfn.length == 0) transferfn.push(transferfn[0]); //need at least two

*/
globj(group) {
globj(group: { remove: (arg0: any) => void; add: (arg0: any) => void; }) {

@@ -267,3 +267,3 @@ if (this.renderedShapeObj) {

var mesh = new Mesh(this.geo, material);
var mesh = new Mesh(this.geo, (material as Material));
this.shapeObj.add(mesh);

@@ -275,3 +275,3 @@

removegl(group) {
removegl(group: { remove: (arg0: any) => void; }) {
if (this.renderedShapeObj) {

@@ -278,0 +278,0 @@ // dispose of geos and materials

@@ -1,2 +0,1 @@

import type { Quaternion } from "./math";
import { Object3D } from "./core";

@@ -3,0 +2,0 @@ import { Matrix4, Vector3 } from "./math";

@@ -5,3 +5,3 @@ import type { Material } from './../materials/Material';

import { Vector3 } from "../math";
import { CC, Color, Colored } from "../../colors";
import { CC, Color } from "../../colors";
const BUFFERSIZE = 65535; //limited to 16bit indices

@@ -58,3 +58,3 @@ export class GeometryGroup {

var centroid = new Vector3();
var offset, x, y, z;
var offset: number, x: number, y: number, z: number;

@@ -91,10 +91,10 @@ for (var i = 0; i < this.vertices; ++i) {

//vertex indices
var a,
b,
c,
var a: number,
b: number,
c: number,
//and actual vertices
vA,
vB,
vC,
norm;
vA: Vector3,
vB: Vector3,
vC: Vector3,
norm: { normalize: () => void; x: number; y: number; z: number; };

@@ -202,3 +202,3 @@ for (var i = 0; i < faces.length / 3; ++i) {

" point [\n";
let x, y, z;
let x: string | number, y: string | number, z: string | number;
for (let i = 0; i < this.vertices; ++i) {

@@ -247,3 +247,3 @@ let offset = i * 3;

ret += indent + " coord Coordinate {\n" + indent + " point [\n";
let x, y, z;
let x: string | number, y: string | number, z: string | number;
for (let i = 0; i < this.vertices; ++i) {

@@ -250,0 +250,0 @@ let offset = i * 3;

@@ -257,3 +257,3 @@ import type { Material } from './../materials/Material';

__removeObject<T extends Object3D>(object: T) {
var idx;
var idx: number;
if (object instanceof Light) {

@@ -260,0 +260,0 @@ idx = this.__lights.indexOf(object as unknown as Light);

@@ -10,7 +10,4 @@ import type { Vector3 } from '../math';

static unprojectVector(vector: Vector3, camera: Camera) {
camera.projectionMatrixInverse.getInverse(camera.projectionMatrix);
viewProjectionMatrix.multiplyMatrices(camera.matrixWorld, camera.projectionMatrixInverse);
return vector.applyProjection(viewProjectionMatrix);

@@ -21,7 +18,4 @@

static projectVector(vector: Vector3, camera: Camera) {
camera.matrixWorldInverse.getInverse(camera.matrixWorld);
viewProjectionMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);
return vector.applyProjection(viewProjectionMatrix);

@@ -31,12 +25,8 @@ };

projectVector(vector: Vector3, camera: Camera) {
return Projector.projectVector(vector, camera);
}
unprojectVector(vector: Vector3, camera: Camera) {
return Projector.unprojectVector(vector, camera);
}
}

@@ -9,4 +9,2 @@ import type { Camera } from '../Camera';

const viewProjectionMatrix = new Matrix4();

@@ -106,16 +104,16 @@

//Iterate through intersection objects
var i,
il,
norm,
normProj,
cylProj,
rayProj,
distance,
closestDistSq,
denom,
discriminant,
s,
t,
s_c,
t_c;
var i: number,
il: number,
norm: Vector3,
normProj: number,
cylProj: number,
rayProj: number,
distance: number,
closestDistSq: number,
denom: number,
discriminant: number,
s: number,
t: number,
s_c: number,
t_c: number;
//triangle faces

@@ -122,0 +120,0 @@ for (i = 0, il = intersectionShape.triangle.length; i < il; i++) {

@@ -64,3 +64,3 @@ import {FrontSide} from "../constants/Sides";

} else {
this[key] = newValue;
(this as any)[key] = newValue;
}

@@ -67,0 +67,0 @@ }

@@ -16,3 +16,3 @@ // return conversion matrix given crystal unit cell parameters

export function conversionMatrix3(
a: any,
a: number,
b: number,

@@ -24,7 +24,9 @@ c: number,

) {
// convert to radians
// Convert to radians
alpha = (alpha * Math.PI) / 180;
beta = (beta * Math.PI) / 180;
gamma = (gamma * Math.PI) / 180;
const sqr = (x) => x*x;
const sqr = (x: number) => {
return x*x
};
const cosAlpha = Math.cos(alpha);

@@ -31,0 +33,0 @@ const cosBeta = Math.cos(beta);

@@ -31,3 +31,3 @@ /**

devicePixelRatio = 1.0; //set in setSize
domElement: Element;
domElement: HTMLCanvasElement;
autoClear = true;

@@ -73,3 +73,2 @@ autoClearColor = true;

private _oldFlipSided = -1 as number | boolean;
private _oldBlending = -1;
private _oldDepthTest = -1;

@@ -220,2 +219,3 @@ private _oldDepthWrite = -1;

supportsImposters: Boolean(this._extFragDepth) || !this.isWebGL1(),
regen: false
};

@@ -332,3 +332,3 @@ }

if (!material.imposter)
//ignore reflection with imposters
// Ignore reflection with imposters
flipSided = reflected ? !flipSided : flipSided;

@@ -391,3 +391,2 @@

}
this._oldBlending = blending;
}

@@ -437,2 +436,3 @@

program = this.setProgram(camera, lights, fog, material, object, this);
if(!program) return;

@@ -578,3 +578,3 @@ attributes = program.attributes;

render(scene, camera, forceClear) {
render(scene, camera, forceClear?) {
if (camera instanceof Camera === false) {

@@ -1206,2 +1206,4 @@ console.error("Renderer.render: camera is not an instance of Camera.");

if (shader == null) return null;
this._gl.shaderSource(shader, str);

@@ -1258,2 +1260,3 @@ this._gl.compileShader(shader);

program = this._gl.createProgram();
if(program == null) return null;

@@ -1284,4 +1287,4 @@ // set up precision

this._gl.attachShader(program, glVertexShader);
this._gl.attachShader(program, glFragmentShader);
if(glVertexShader != null) this._gl.attachShader(program, glVertexShader);
if(glFragmentShader != null) this._gl.attachShader(program, glFragmentShader);

@@ -1359,2 +1362,3 @@ this._gl.linkProgram(program);

}
if( material.program == null) return null;

@@ -1516,3 +1520,3 @@ var refreshMaterial = false;

private addObject(object, scene) {
var g, gl, geometry, material, geometryGroup;
var g, gl, geometry, geometryGroup;

@@ -1535,3 +1539,2 @@ if (!object.__webglInit) {

geometry = object.geometry;
material = object.material;

@@ -1807,7 +1810,5 @@ for (g = 0, gl = geometry.geometryGroups.length; g < gl; g++) {

intensity,
distance,
zlights = this._lights,
dirColors = zlights.directional.colors,
dirPositions = zlights.directional.positions,
dirCount = 0,
dirLength = 0,

@@ -1821,6 +1822,4 @@ dirOffset = 0;

intensity = light.intensity;
distance = light.distance;
if (light instanceof Light) {
dirCount++;

@@ -2017,3 +2016,2 @@ this._direction.getPositionFromMatrix(light.matrixWorld);

this._currentCamera = null;
this._oldBlending = -1;
this._oldDepthWrite = -1;

@@ -2032,3 +2030,2 @@ this._oldDepthTest = -1;

this._currentCamera = null;
this._oldBlending = -1;
this._oldDepthWrite = -1;

@@ -2035,0 +2032,0 @@ this._oldDepthTest = -1;

@@ -8,4 +8,4 @@ import { Color } from "../../../../colors";

fogFar: { type: 'f', value: 2000},
directionalLightColor: { type: 'fv', value: [] },
directionalLightDirection: { type: 'fv', value: [] }
}
directionalLightColor: { type: 'fv', value: [] as number[] },
directionalLightDirection: { type: 'fv', value: [] as number[] }
}

@@ -8,4 +8,4 @@ import { Color } from "../../../../colors";

fogFar: { type: 'f', value: 2000},
directionalLightColor: { type: 'fv', value: [] },
directionalLightDirection: { type: 'fv', value: [] }
}
directionalLightColor: { type: 'fv', value: [] as number[] },
directionalLightDirection: { type: 'fv', value: [] as number[] }
}

@@ -8,4 +8,4 @@ import { Color } from "../../../../colors";

fogFar: { type: 'f', value: 2000},
directionalLightColor: { type: 'fv', value: [] },
directionalLightDirection: { type: 'fv', value: [] }
}
directionalLightColor: { type: 'fv', value: [] as number[] },
directionalLightDirection: { type: 'fv', value: [] as number[] }
}

@@ -8,4 +8,4 @@ import { Color } from "../../../../colors";

fogFar: { type: 'f', value: 2000},
directionalLightColor: { type: 'fv', value: [] },
directionalLightDirection: { type: 'fv', value: [] }
}
directionalLightColor: { type: 'fv', value: [] as number[] },
directionalLightDirection: { type: 'fv', value: [] as number[] }
}

@@ -0,1 +1,2 @@

import { Matrix4 } from "WebGL/math";
import { Color } from "../../../../colors";

@@ -14,7 +15,6 @@

subsamples: { type: 'f', value: 5.0}, //how many substeps to take
textmat: { type: 'mat4', value: []},
projinv: { type: 'mat4', value: []},
textmat: { type: 'mat4', value: [] as Matrix4[] },
projinv: { type: 'mat4', value: [] as Matrix4[] },
transfermin: {type: 'f', value: -0.2 },
transfermax: {type: 'f', value: 0.2},
}
}

@@ -11,4 +11,3 @@ {

"declaration": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": false,
"noUnusedLocals": true,
"moduleResolution": "node",

@@ -15,0 +14,0 @@ "lib": [

@@ -11,39 +11,45 @@ /* eslint-disable no-undef*/

module.exports = {
module.exports = {
target: "web",
entry: {'3Dmol':["./src/index.ts",
"./src/SurfaceWorker.js",
"./src/exporter.js"
],
'3Dmol.ui': [ "./src/ui/ui.js",
entry: {
'3Dmol': [
"./src/index.ts",
"./src/SurfaceWorker.js",
"./src/exporter.js"
],
'3Dmol.ui': [
"./src/ui/ui.js",
"./src/ui/state.js",
"./src/ui/icon.js",
"./src/ui/form.js",
"./src/ui/defaultValues.js"]},
"./src/ui/form.js",
"./src/ui/defaultValues.js"
]
},
output: {
path: path.resolve(__dirname, "build"),
globalObject: "this",
library: '[name]',
libraryTarget: "umd",
globalObject: "this"
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".json"],
},
module: {
rules: [
{ test: /\.tsx?$/, loader: "ts-loader"},
{ test: /\.frag/, loader: "raw-loader" },
{ test: /\.vert/, loader: "raw-loader" }
{ test: /\.tsx?$/, loader: "ts-loader" },
{ test: /\.frag$/, loader: "raw-loader" },
{ test: /\.vert$/, loader: "raw-loader" }
],
},
plugins: [
new webpack.ProvidePlugin({
MMTF: path.resolve(__dirname, "./src/vendor/mmtf.js"),
$: "jquery"
MMTF: path.resolve(__dirname, "./src/vendor/mmtf.js"),
$: "jquery"
}),
new webpack.BannerPlugin({ banner }),
new ESLintPlugin()],
new webpack.BannerPlugin({ banner }),
new ESLintPlugin()
],
stats: {
errorDetails: true,
}
};
/* eslint-disable no-undef*/
const { merge } = require('webpack-merge');

@@ -7,7 +6,7 @@ const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'development',
devtool: 'inline-source-map',
mode: 'development',
devtool: 'inline-source-map',
output: {
filename: `[name].js`,
}
filename: '[name].js',
},
});
/* eslint-disable no-undef*/
const { merge } = require('webpack-merge');

@@ -8,5 +7,5 @@ const common = require('./webpack.common.js');

module.exports = merge(common, {
mode: 'production',
mode: "production",
optimization: {
usedExports: false, //essential for pulling in $3Dmol namespace
usedExports: false,
minimizer: [

@@ -18,6 +17,5 @@ new TerserPlugin({

compress: true,
mangle:
{
mangle: {
reserved: ["MarchingCube"],
}
},
},

@@ -29,3 +27,3 @@ }),

filename: `[name]-min.js`,
}
},
});

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc