icn3d 3.43.0 → 3.44.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.
Files changed (38) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +48 -4
  3. package/css/icn3d.css +0 -0
  4. package/css/lib/fonts/la-brands-400.eot +0 -0
  5. package/css/lib/fonts/la-brands-400.svg +0 -0
  6. package/css/lib/fonts/la-brands-400.ttf +0 -0
  7. package/css/lib/fonts/la-brands-400.woff +0 -0
  8. package/css/lib/fonts/la-brands-400.woff2 +0 -0
  9. package/css/lib/fonts/la-regular-400.eot +0 -0
  10. package/css/lib/fonts/la-regular-400.svg +0 -0
  11. package/css/lib/fonts/la-regular-400.ttf +0 -0
  12. package/css/lib/fonts/la-regular-400.woff +0 -0
  13. package/css/lib/fonts/la-regular-400.woff2 +0 -0
  14. package/css/lib/fonts/la-solid-900.eot +0 -0
  15. package/css/lib/fonts/la-solid-900.svg +0 -0
  16. package/css/lib/fonts/la-solid-900.ttf +0 -0
  17. package/css/lib/fonts/la-solid-900.woff +0 -0
  18. package/css/lib/fonts/la-solid-900.woff2 +0 -0
  19. package/css/lib/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  20. package/css/lib/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  21. package/css/lib/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  22. package/css/lib/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  23. package/css/lib/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  24. package/css/lib/images/ui-bg_gloss-wave_25_333333_500x100.png +0 -0
  25. package/css/lib/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  26. package/css/lib/images/ui-bg_gloss-wave_55_5c9ccc_500x100.png +0 -0
  27. package/css/lib/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  28. package/css/lib/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  29. package/css/lib/images/ui-icons_222222_256x240.png +0 -0
  30. package/css/lib/images/ui-icons_228ef1_256x240.png +0 -0
  31. package/css/lib/images/ui-icons_ef8c08_256x240.png +0 -0
  32. package/css/lib/images/ui-icons_ffd27a_256x240.png +0 -0
  33. package/css/lib/images/ui-icons_ffffff_256x240.png +0 -0
  34. package/icn3d.js +70245 -21517
  35. package/icn3d.min.js +16 -5
  36. package/icn3d.module.js +71114 -22386
  37. package/package.json +2 -7
  38. package/three.module.js +0 -50834
package/LICENSE CHANGED
File without changes
package/README.md CHANGED
@@ -14,7 +14,6 @@ The following packages are required as shown in dependency:
14
14
 
15
15
  npm install jquery
16
16
  npm install jsdom
17
- npm install three
18
17
 
19
18
  Usage
20
19
  --------
@@ -23,7 +22,6 @@ Usage
23
22
 
24
23
  To use icn3d to generate Node.js scripts, the source code is from this icn3d npm package. As shown in [one example of Node.js script](https://github.com/ncbi/icn3d/blob/master/icn3dnode/interaction2.js), part of the script can be like the following. All classes and functions can be accessed with the variable "icn3dui". The class structure is listed at [iCn3D Doc](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#classstructure).
25
24
 
26
- global.THREE = require('three');
27
25
  let jsdom = require('jsdom');
28
26
  global.$ = require('jquery')(new jsdom.JSDOM().window);
29
27
 
@@ -34,13 +32,11 @@ Usage
34
32
 
35
33
  You can first specify the "dependencies.js" file as follows:
36
34
 
37
- import * as THREE from 'icn3d/three'
38
35
  import $ from 'jquery'
39
36
  import 'jquery-ui-bundle';
40
37
 
41
38
  import 'jquery-ui-bundle/jquery-ui.min.css';
42
39
 
43
- global.THREE = THREE
44
40
  global.$ = $
45
41
  global.jQuery = $
46
42
 
@@ -67,6 +63,54 @@ Usage
67
63
 
68
64
  export default Icn3dViewer;
69
65
 
66
+ <b>Use typescript</b>
67
+
68
+ A few adjustments need to be made to use icn3d with React and typescript. The useEffect needs to be adjusted to include type information, and separate the async call out into its own function. See the following example:
69
+
70
+ interface MyProps{
71
+ pageInfo: ExampleObject
72
+ }
73
+
74
+ export const Icn3dViewer: React.FC<MyProps> = ({ pageInfo }) => {
75
+ useEffect(() => {
76
+ const fetchViewer = async (): Promise<void> => {
77
+ const cfg = {
78
+ divid: 'icn3dwrap',
79
+ width: '50%',
80
+ height: '100%',
81
+ resize: true,
82
+ rotate: 'right',
83
+ mobilemenu: true,
84
+ showcommand: false,
85
+ showtitle: false,
86
+ mmdbid: pageInfo.mmdbid,
87
+ show2d: true,
88
+ };
89
+ const icn3dui = new icn3d.iCn3DUI(cfg);
90
+ await icn3dui.show3DStructure();
91
+ };
92
+
93
+ void fetchViewer();
94
+
95
+ return () => {};
96
+ }, [pageInfo]);
97
+ return <div id="icn3dwrap" />;
98
+ };
99
+
100
+ The config can be customized as needed, while any dependencies the useEffect has need to be added to the end. (In this example, pageInfo).
101
+
102
+ If your typescript compiler complains about missing type definition files, create a file named icn3d.d.ts in your project's root directory and fill it with the following:
103
+
104
+ declare module 'icn3d/module' {
105
+ export class iCn3DUI {
106
+ constructor(cfg: object);
107
+
108
+ show3DStructure(): Promise<void>;
109
+ }
110
+ }
111
+
112
+ declare module 'icn3d/three' {}
113
+
70
114
  * <b>Use icn3d as a 3D Viewer with jQuery</b>
71
115
 
72
116
  The source code is available in the [iCn3D GitHub page](https://github.com/ncbi/icn3d). You can following the instruction at [iCn3D Doc](https://www.ncbi.nlm.nih.gov/Structure/icn3d/icn3d.html#HowToUse). The JavaScript code could be as simple as the following:
package/css/icn3d.css CHANGED
File without changes
Binary file
File without changes
Binary file
Binary file
Binary file
Binary file
File without changes
Binary file
Binary file
Binary file
Binary file
File without changes
Binary file
Binary file
Binary file