bravais 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/LICENSE +21 -0
  3. package/README.md +46 -2
  4. package/THIRD_PARTY_NOTICES.md +51 -0
  5. package/dist/bravais.js +2349 -0
  6. package/dist/bravais.js.map +1 -0
  7. package/dist/types/cif/errors.d.ts +4 -0
  8. package/dist/types/cif/parser.d.ts +32 -0
  9. package/dist/types/cif/structure.d.ts +15 -0
  10. package/dist/types/cif/symmetry-operators.d.ts +6 -0
  11. package/dist/types/cif/tokenizer.d.ts +17 -0
  12. package/dist/types/index.d.ts +28 -0
  13. package/dist/types/render/camera.d.ts +26 -0
  14. package/dist/types/render/gizmo.d.ts +17 -0
  15. package/dist/types/render/legend.d.ts +7 -0
  16. package/dist/types/render/materials.d.ts +43 -0
  17. package/dist/types/render/model.d.ts +19 -0
  18. package/dist/types/render/oklab.d.ts +23 -0
  19. package/dist/types/render/palette.d.ts +12 -0
  20. package/dist/types/render/stage.d.ts +12 -0
  21. package/dist/types/render/thumbnails.d.ts +17 -0
  22. package/dist/types/render/view-state.d.ts +13 -0
  23. package/dist/types/render/viewer.d.ts +39 -0
  24. package/dist/types/scene/build.d.ts +43 -0
  25. package/dist/types/structure/bonds.d.ts +21 -0
  26. package/dist/types/structure/closure.d.ts +15 -0
  27. package/dist/types/structure/elements.d.ts +12 -0
  28. package/dist/types/structure/expand.d.ts +6 -0
  29. package/dist/types/structure/fractional.d.ts +11 -0
  30. package/dist/types/structure/images.d.ts +13 -0
  31. package/dist/types/structure/lattice.d.ts +10 -0
  32. package/dist/types/structure/types.d.ts +52 -0
  33. package/dist/types/symmetry/dataset.d.ts +43 -0
  34. package/dist/types/symmetry/moyo.d.ts +54 -0
  35. package/dist/types/symmetry/resolve.d.ts +11 -0
  36. package/dist/types/symmetry/symbol.d.ts +10 -0
  37. package/package.json +67 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 0.1.1 - 2026-10-16
4
+
5
+ - The TrackballControls addon is bundled, so the module imports only `three`
6
+ itself. A consumer without a bundler maps one module instead of two, and an
7
+ Electron app packaged with electron-builder, which drops every dependency's
8
+ `examples` folder, no longer loses the addon.
9
+
10
+ ## 0.1.0 - 2026-10-15
11
+
12
+ First public release.
13
+
14
+ - Reads CIFs, applying the file's operator loop or the space-group operations
15
+ from moyo when the loop is missing.
16
+ - `symmetryDataset(structure)`: moyo's analysis of the atoms, with the
17
+ standard space group and its Hall setting, Wyckoff letters, site
18
+ symmetries, and the structure in the standard cell.
19
+ - `typesetSymbol(symbol)`: a Hermann-Mauguin symbol as textbooks print it,
20
+ Fm3̅m and P2₁/c, from the ASCII forms of moyo, spglib and CIF files.
21
+ - A rhombohedral symbol without `:H` or `:R` is read in the setting the
22
+ listed atoms fit, or the cell shape selects. A file whose atoms are listed
23
+ already expanded but do not close under its operations is refused instead
24
+ of being drawn wrong.
25
+ - Expands the structure, repeats boundary sites as image atoms, and finds
26
+ bonds with VESTA's cutoff table.
27
+ - Renders with three.js: ray-cast atoms, closed bond tubes, occupancy pies on
28
+ shared sites, the cell frame, depth fading, and a trackball with inertia.
29
+ - A session element palette kept distinct in OKLab, an element legend, an a,
30
+ b, c axes gizmo whose letters turn white over the arrows, layered viewers
31
+ with transferable view states, and a shared thumbnail renderer.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jiacheng Wang
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,47 @@
1
- # Temporary Holding Version
1
+ # bravais
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![npm](https://img.shields.io/npm/v/bravais)](https://www.npmjs.com/package/bravais)
4
+ [![CI](https://github.com/jcwang587/bravais/actions/workflows/ci.yml/badge.svg)](https://github.com/jcwang587/bravais/actions/workflows/ci.yml)
5
+
6
+ A minimal crystal structure viewer for the web.
7
+
8
+ ## Install
9
+
10
+ ```sh
11
+ npm install bravais three
12
+ ```
13
+
14
+ ## Use
15
+
16
+ ```js
17
+ import { buildScene, createViewer, expandStructure, readCif } from "bravais";
18
+
19
+ const scene = buildScene(expandStructure(await readCif(cifText)));
20
+ createViewer(document.getElementById("viewer")).setLayers([{ scene }]);
21
+ ```
22
+
23
+ ## Built with
24
+
25
+ - [three.js](https://threejs.org/): rendering, as a peer dependency.
26
+ - [moyo](https://github.com/spglib/moyo): space-group
27
+ operations, bundled as WebAssembly.
28
+ - [VESTA](https://jp-minerals.org/vesta/en/): the bond cutoffs, the element
29
+ colours, used here in Pretty Lattice's softened version, and the
30
+ occupancy pies.
31
+ - [pymatgen](https://github.com/materialsproject/pymatgen): the copy of
32
+ VESTA's cutoff table this package ships.
33
+ - OKLab: Björn Ottosson's public-domain colour formulas. They supply no
34
+ colours: they measure how alike two colours look, and move an element's
35
+ colour only when it would clash with one already on screen.
36
+
37
+ Thanks to Feitong Song's
38
+ [Pretty Lattice](https://github.com/songfeitong/pretty-lattice), which this
39
+ viewer follows in its lighting and materials, depth fading, trackball feel,
40
+ axes gizmo, legend swatch, standard view and softened element colours.
41
+
42
+ The code was written by Claude Code, under the author's direction and review.
43
+
44
+ ## License
45
+
46
+ [MIT](LICENSE). Notices for the bundled third-party material are in
47
+ [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
@@ -0,0 +1,51 @@
1
+ # Third-party notices
2
+
3
+ bravais is MIT licensed (see [LICENSE](LICENSE)). It ships material from the
4
+ three MIT-licensed projects below, bundled into `dist/bravais.js`. Each is
5
+ reproduced with its copyright notice, and the MIT permission notice at the
6
+ end applies to all three.
7
+
8
+ ## moyo
9
+
10
+ The space-group operations and the symmetry analysis come from the
11
+ WebAssembly build of [moyo](https://github.com/spglib/moyo), used under its
12
+ MIT licence.
13
+
14
+ Copyright (c) 2023 Kohei Shinohara
15
+
16
+ ## pymatgen
17
+
18
+ The bond cutoff table (`src/data/vesta-cutoffs.json`) is copied from
19
+ [pymatgen](https://github.com/materialsproject/pymatgen)'s
20
+ `vesta_cutoffs.yaml`. The values originate in VESTA (K. Momma and F. Izumi).
21
+
22
+ Copyright (c) 2011-2012 MIT & The Regents of the University of California,
23
+ through Lawrence Berkeley National Laboratory
24
+
25
+ ## Pretty Lattice
26
+
27
+ The element colour table (`src/data/element-colors.json`) is
28
+ [Pretty Lattice](https://github.com/songfeitong/pretty-lattice)'s softened
29
+ version of VESTA's element colours.
30
+
31
+ Copyright (c) 2026 Feitong Song
32
+
33
+ ## MIT permission notice
34
+
35
+ Permission is hereby granted, free of charge, to any person obtaining a copy
36
+ of this software and associated documentation files (the "Software"), to deal
37
+ in the Software without restriction, including without limitation the rights
38
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39
+ copies of the Software, and to permit persons to whom the Software is
40
+ furnished to do so, subject to the following conditions:
41
+
42
+ The above copyright notice and this permission notice shall be included in all
43
+ copies or substantial portions of the Software.
44
+
45
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
49
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
50
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
51
+ SOFTWARE.