@e-infra/react-molstar-wrapper 0.0.8
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/LICENSE.md +9 -0
- package/README.md +94 -0
- package/dist/index.cjs.js +1258 -0
- package/dist/index.cjs.js.map +1 -0
- package/dist/index.cjs2.js +8 -0
- package/dist/index.cjs2.js.map +1 -0
- package/dist/index.cjs3.js +8 -0
- package/dist/index.cjs3.js.map +1 -0
- package/dist/index.es.js +1258 -0
- package/dist/index.es.js.map +1 -0
- package/dist/index.es2.js +8 -0
- package/dist/index.es2.js.map +1 -0
- package/dist/index.es3.js +8 -0
- package/dist/index.es3.js.map +1 -0
- package/dist/react-molstar-wrapper.css +32 -0
- package/dist/types/components.d.ts +2 -0
- package/dist/types/core/Manager.d.ts +19 -0
- package/dist/types/core/Manager.d.ts.map +1 -0
- package/dist/types/core/Plugin.d.ts +26 -0
- package/dist/types/core/Plugin.d.ts.map +1 -0
- package/dist/types/core/exceptions.d.ts +8 -0
- package/dist/types/core/exceptions.d.ts.map +1 -0
- package/dist/types/core/tree/chopping.d.ts +13 -0
- package/dist/types/core/tree/chopping.d.ts.map +1 -0
- package/dist/types/core/tree/colors.d.ts +14 -0
- package/dist/types/core/tree/colors.d.ts.map +1 -0
- package/dist/types/core/tree/create-mvs.d.ts +6 -0
- package/dist/types/core/tree/create-mvs.d.ts.map +1 -0
- package/dist/types/core/tree/index.d.ts +2 -0
- package/dist/types/core/tree/index.d.ts.map +1 -0
- package/dist/types/core/tree/rendering.d.ts +6 -0
- package/dist/types/core/tree/rendering.d.ts.map +1 -0
- package/dist/types/core/tree/selectors.d.ts +34 -0
- package/dist/types/core/tree/selectors.d.ts.map +1 -0
- package/dist/types/core/types.d.ts +44 -0
- package/dist/types/core/types.d.ts.map +1 -0
- package/dist/types/hooks.d.ts +2 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/react/ErrorView.d.ts +2 -0
- package/dist/types/react/ErrorView.d.ts.map +1 -0
- package/dist/types/react/LoaderView.d.ts +2 -0
- package/dist/types/react/LoaderView.d.ts.map +1 -0
- package/dist/types/react/Viewer.d.ts +86 -0
- package/dist/types/react/Viewer.d.ts.map +1 -0
- package/dist/types/react/types.d.ts +49 -0
- package/dist/types/react/types.d.ts.map +1 -0
- package/package.json +85 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# The MIT License
|
|
2
|
+
|
|
3
|
+
Copyright 2025 - now, react-molstar-wrapper contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# react-molstar-wrapper
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@e-infra/react-molstar-wrapper)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A React wrapper for the Mol* molecular visualization library, providing seamless integration of molecular structure visualization capabilities into React applications.
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
This package provides a lightweight React wrapper around the [Mol*](https://molstar.org/) molecular visualization library, enabling developers to easily integrate 3D molecular structure visualization into their React applications.
|
|
11
|
+
|
|
12
|
+
## Installation
|
|
13
|
+
|
|
14
|
+
### npm
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
npm install react-molstar-wrapper
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### bun
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
bun install react-molstar-wrapper
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### React
|
|
29
|
+
|
|
30
|
+
This component must be used within **Client Components** as Mol* requires the `document` object to be available at runtime.
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import Viewer from "react-molstar-wrapper";
|
|
34
|
+
import "react-molstar-wrapper/style.css";
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Next.js Integration
|
|
38
|
+
|
|
39
|
+
When using Next.js, the component must be imported dynamically to avoid server-side rendering issues. Add the `"use client"` directive and use Next.js's `dynamic` import:
|
|
40
|
+
|
|
41
|
+
```typescript
|
|
42
|
+
"use client";
|
|
43
|
+
|
|
44
|
+
import "react-molstar-wrapper/style.css";
|
|
45
|
+
import dynamic from "next/dynamic";
|
|
46
|
+
|
|
47
|
+
const Viewer = dynamic(
|
|
48
|
+
() => import("react-molstar-wrapper").then((mod) => mod.Viewer),
|
|
49
|
+
{ ssr: false }
|
|
50
|
+
);
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
This approach prevents errors related to `document` not being defined during server-side rendering, as Mol* expects the DOM to be available during initialization.
|
|
54
|
+
|
|
55
|
+
### Notice
|
|
56
|
+
|
|
57
|
+
It is important to include library styles as well! Otherwise loader and error view will be broken.
|
|
58
|
+
|
|
59
|
+
```typescript
|
|
60
|
+
import "react-molstar-wrapper/style.css";
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Example
|
|
64
|
+
|
|
65
|
+
```typescript
|
|
66
|
+
|
|
67
|
+
import "react-molstar-wrapper/style.css";
|
|
68
|
+
import Viewer from "react-molstar-wrapper";
|
|
69
|
+
import type { Protein } from "react-molstar-wrapper";
|
|
70
|
+
|
|
71
|
+
const proteins: Protein[] = [
|
|
72
|
+
{
|
|
73
|
+
uniProtId: "P12345";
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
|
|
77
|
+
<Viewer
|
|
78
|
+
proteins={proteins}
|
|
79
|
+
spin={true}
|
|
80
|
+
/>
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
## Advanced Usage
|
|
84
|
+
|
|
85
|
+
(TODO)
|
|
86
|
+
|
|
87
|
+
## Documentation
|
|
88
|
+
|
|
89
|
+
- [Contributing Guide](CONTRIBUTING.md) - Development setup, code quality, and contribution guidelines
|
|
90
|
+
- [Changelog](CHANGELOG.md) - Version history and release notes
|
|
91
|
+
|
|
92
|
+
## License
|
|
93
|
+
|
|
94
|
+
See [LICENSE.md](LICENSE.md) for details.
|