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 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
  [![npm](https://img.shields.io/npm/v/bravais)](https://www.npmjs.com/package/bravais)
4
4
  [![CI](https://github.com/jcwang587/bravais/actions/workflows/ci.yml/badge.svg)](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 scene = buildScene(expandStructure(await readCif(cifText)));
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/): 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.
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), 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.
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). Notices for the bundled third-party material are in
47
- [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
50
+ [MIT](LICENSE)
@@ -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/`. Each is reproduced
5
- with its copyright notice, and the MIT permission notice at the end applies
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