bravais 0.1.3 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +21 -18
- package/THIRD_PARTY_NOTICES.md +11 -3
- package/dist/bravais.js +498 -435
- package/dist/bravais.js.map +1 -1
- package/dist/types/cif/symmetry-operators.d.ts +2 -2
- package/dist/types/index.d.ts +7 -7
- package/dist/types/render/gizmo.d.ts +4 -1
- package/dist/types/render/materials.d.ts +1 -2
- package/dist/types/render/model.d.ts +9 -0
- package/dist/types/render/palette.d.ts +5 -6
- package/dist/types/render/thumbnails.d.ts +4 -3
- package/dist/types/render/view-state.d.ts +2 -2
- package/dist/types/render/viewer.d.ts +13 -13
- package/dist/types/scene/build.d.ts +7 -9
- package/dist/types/structure/expand.d.ts +3 -2
- package/dist/types/structure/lattice.d.ts +3 -3
- package/dist/types/symmetry/dataset.d.ts +2 -4
- package/dist/types/symmetry/moyo.d.ts +6 -8
- package/dist/types/symmetry/symbol.d.ts +5 -7
- package/examples/CoO.cif +254 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0 - 2026-10-20
|
|
4
|
+
|
|
5
|
+
- The first structure shows sooner, and the page no longer freezes while it
|
|
6
|
+
waits: the viewer and the thumbnail renderer compile all their shaders at
|
|
7
|
+
once when they are created, so the driver compiles them in parallel. On an
|
|
8
|
+
M2 Max with nothing cached, the first frame comes after 0.4 s instead of
|
|
9
|
+
0.7 s, and the longest freeze is 0.1 s instead of 0.65 s.
|
|
10
|
+
- Right after a viewer is created, while its shaders compile, `setLayers` and
|
|
11
|
+
`render` draw once the shaders are ready instead of before they return.
|
|
12
|
+
- The README example runs as written: it gives the viewer's container a height
|
|
13
|
+
and loads `examples/CoO.cif`, a COD structure the package now ships.
|
|
14
|
+
|
|
15
|
+
## 0.1.4 - 2026-10-19
|
|
16
|
+
|
|
17
|
+
- Switching structures is faster: the viewer keeps its compiled shaders
|
|
18
|
+
instead of compiling them again, builds the axes once instead of leaking a
|
|
19
|
+
new set on every switch, and resizes the canvas only when its size changes.
|
|
20
|
+
- The README, the package description and the doc comments are shorter and
|
|
21
|
+
plainer.
|
|
22
|
+
|
|
3
23
|
## 0.1.3 - 2026-10-19
|
|
4
24
|
|
|
5
25
|
- A layer at opacity 0 is no longer drawn but still frames the view, so a
|
package/README.md
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
[](https://www.npmjs.com/package/bravais)
|
|
4
4
|
[](https://github.com/jcwang587/bravais/actions/workflows/ci.yml)
|
|
5
5
|
|
|
6
|
-
A minimal crystal structure viewer for the web.
|
|
6
|
+
A minimal crystal structure viewer for the web. Try the
|
|
7
|
+
[demo](https://jcwang.dev/bravais/).
|
|
7
8
|
|
|
8
9
|
## Install
|
|
9
10
|
|
|
@@ -13,35 +14,37 @@ npm install bravais three
|
|
|
13
14
|
|
|
14
15
|
## Use
|
|
15
16
|
|
|
17
|
+
Add a container with a height:
|
|
18
|
+
|
|
19
|
+
```html
|
|
20
|
+
<div id="viewer" style="height: 480px"></div>
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Then read a CIF and visualize it:
|
|
24
|
+
|
|
16
25
|
```js
|
|
17
26
|
import { buildScene, createViewer, expandStructure, readCif } from "bravais";
|
|
18
27
|
|
|
19
|
-
const
|
|
28
|
+
const response = await fetch("https://unpkg.com/bravais/examples/CoO.cif");
|
|
29
|
+
const scene = buildScene(expandStructure(await readCif(await response.text())));
|
|
20
30
|
createViewer(document.getElementById("viewer")).setLayers([{ scene }]);
|
|
21
31
|
```
|
|
22
32
|
|
|
23
33
|
## Built with
|
|
24
34
|
|
|
25
|
-
- [three.js](https://threejs.org/)
|
|
26
|
-
- [moyo](https://github.com/spglib/moyo)
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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.
|
|
35
|
+
- [three.js](https://threejs.org/) for rendering.
|
|
36
|
+
- [moyo](https://github.com/spglib/moyo) for space-group symmetry.
|
|
37
|
+
- [VESTA](https://jp-minerals.org/vesta/en/)'s bond cutoffs and occupancy
|
|
38
|
+
pies, with the cutoff table from
|
|
39
|
+
[pymatgen](https://github.com/materialsproject/pymatgen).
|
|
40
|
+
- Björn Ottosson's OKLab colour space, to keep element colours apart.
|
|
36
41
|
|
|
37
42
|
Thanks to Feitong Song's
|
|
38
|
-
[Pretty Lattice](https://github.com/songfeitong/pretty-lattice),
|
|
39
|
-
|
|
40
|
-
axes gizmo, legend swatch, standard view and softened element colours.
|
|
43
|
+
[Pretty Lattice](https://github.com/songfeitong/pretty-lattice), whose look,
|
|
44
|
+
controls and softened element colours this viewer follows.
|
|
41
45
|
|
|
42
46
|
The code was written by Claude Code, under the author's direction and review.
|
|
43
47
|
|
|
44
48
|
## License
|
|
45
49
|
|
|
46
|
-
[MIT](LICENSE)
|
|
47
|
-
[THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
|
|
50
|
+
[MIT](LICENSE)
|
package/THIRD_PARTY_NOTICES.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
# Third-party notices
|
|
2
2
|
|
|
3
3
|
bravais is MIT licensed (see [LICENSE](LICENSE)). It ships material from the
|
|
4
|
-
four MIT-licensed projects below, bundled into `dist
|
|
5
|
-
with its copyright notice, and the
|
|
6
|
-
to all four.
|
|
4
|
+
four MIT-licensed projects below, bundled into `dist/`, and one example
|
|
5
|
+
structure file. Each project is reproduced with its copyright notice, and the
|
|
6
|
+
MIT permission notice at the end applies to all four.
|
|
7
7
|
|
|
8
8
|
## three.js
|
|
9
9
|
|
|
@@ -38,6 +38,14 @@ version of VESTA's element colours.
|
|
|
38
38
|
|
|
39
39
|
Copyright (c) 2026 Feitong Song
|
|
40
40
|
|
|
41
|
+
## Example structure
|
|
42
|
+
|
|
43
|
+
`examples/CoO.cif`, the structure the README example loads, is entry 9008618
|
|
44
|
+
of the [Crystallography Open Database](https://www.crystallography.net/cod/),
|
|
45
|
+
shipped unchanged. Its header asks that the source of the data be credited:
|
|
46
|
+
R. W. G. Wyckoff, _Crystal Structures_, vol. 1, 2nd ed., Interscience
|
|
47
|
+
Publishers, New York, 1963.
|
|
48
|
+
|
|
41
49
|
## MIT permission notice
|
|
42
50
|
|
|
43
51
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|