mc-react-structure-visualizer 0.4.0 → 0.4.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.
package/README.md CHANGED
@@ -1,74 +1,74 @@
1
- # React Materials Cloud Structure Visualizer
2
-
3
- A React component to visualize structures on the Materials Cloud platform.
4
-
5
- # Getting Started with Create React App
6
-
7
- This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
8
-
9
- ## Available Scripts
10
-
11
- In the project directory, you can run:
12
-
13
- ### `npm start`
14
-
15
- Runs the app in the development mode.\
16
- Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
17
-
18
- The page will reload when you make changes.\
19
- You may also see any lint errors in the console.
20
-
21
- ### `npm test`
22
-
23
- Launches the test runner in the interactive watch mode.\
24
- See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
25
-
26
- ### `npm run build`
27
-
28
- Builds the app for production to the `build` folder.\
29
- It correctly bundles React in production mode and optimizes the build for the best performance.
30
-
31
- The build is minified and the filenames include the hashes.\
32
- Your app is ready to be deployed!
33
-
34
- See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
35
-
36
- ### `npm run eject`
37
-
38
- **Note: this is a one-way operation. Once you `eject`, you can't go back!**
39
-
40
- If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
41
-
42
- Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
43
-
44
- You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
45
-
46
- ## Learn More
47
-
48
- You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
49
-
50
- To learn React, check out the [React documentation](https://reactjs.org/).
51
-
52
- ### Code Splitting
53
-
54
- This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
55
-
56
- ### Analyzing the Bundle Size
57
-
58
- This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
59
-
60
- ### Making a Progressive Web App
61
-
62
- This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
63
-
64
- ### Advanced Configuration
65
-
66
- This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
67
-
68
- ### Deployment
69
-
70
- This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
71
-
72
- ### `npm run build` fails to minify
73
-
74
- This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
1
+ # React Materials Cloud Structure Visualizer
2
+
3
+ A React component to visualize structures on the Materials Cloud platform.
4
+
5
+ # Getting Started with Create React App
6
+
7
+ This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
8
+
9
+ ## Available Scripts
10
+
11
+ In the project directory, you can run:
12
+
13
+ ### `npm start`
14
+
15
+ Runs the app in the development mode.\
16
+ Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
17
+
18
+ The page will reload when you make changes.\
19
+ You may also see any lint errors in the console.
20
+
21
+ ### `npm test`
22
+
23
+ Launches the test runner in the interactive watch mode.\
24
+ See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
25
+
26
+ ### `npm run build`
27
+
28
+ Builds the app for production to the `build` folder.\
29
+ It correctly bundles React in production mode and optimizes the build for the best performance.
30
+
31
+ The build is minified and the filenames include the hashes.\
32
+ Your app is ready to be deployed!
33
+
34
+ See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
35
+
36
+ ### `npm run eject`
37
+
38
+ **Note: this is a one-way operation. Once you `eject`, you can't go back!**
39
+
40
+ If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
41
+
42
+ Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
43
+
44
+ You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
45
+
46
+ ## Learn More
47
+
48
+ You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
49
+
50
+ To learn React, check out the [React documentation](https://reactjs.org/).
51
+
52
+ ### Code Splitting
53
+
54
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
55
+
56
+ ### Analyzing the Bundle Size
57
+
58
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
59
+
60
+ ### Making a Progressive Web App
61
+
62
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
63
+
64
+ ### Advanced Configuration
65
+
66
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
67
+
68
+ ### Deployment
69
+
70
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
71
+
72
+ ### `npm run build` fails to minify
73
+
74
+ This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
@@ -27,8 +27,14 @@
27
27
  }
28
28
 
29
29
  .control-box-row {
30
- margin: 5px 5px;
30
+ margin: 5px 0px;
31
+ padding: 0px 10px;
32
+ width: 100%;
31
33
  line-height: inherit;
34
+ /* background-color: pink; */
35
+ display: flex;
36
+ justify-content: space-between;
37
+ align-items: stretch;
32
38
  }
33
39
 
34
40
  .control-box-row label {
@@ -55,6 +61,7 @@
55
61
  }
56
62
 
57
63
  .control-box-row .camera-controls {
58
- margin: 0px 30px;
64
+ margin-left: auto;
65
+ margin-right: auto;
59
66
  display: inline;
60
67
  }
@@ -3,10 +3,10 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.default = void 0;
6
+ exports["default"] = void 0;
7
7
  var _react = _interopRequireDefault(require("react"));
8
8
  require("./index.css");
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
9
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
10
10
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
11
11
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
12
12
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
@@ -45,12 +45,14 @@ var ControlBox = /*#__PURE__*/function (_React$Component) {
45
45
  key: "render",
46
46
  value: function render() {
47
47
  var _this2 = this;
48
- return /*#__PURE__*/_react.default.createElement("div", {
48
+ return /*#__PURE__*/_react["default"].createElement("div", {
49
49
  className: "control-box"
50
- }, /*#__PURE__*/_react.default.createElement("div", {
50
+ }, /*#__PURE__*/_react["default"].createElement("div", {
51
51
  className: "control-box-row"
52
- }, /*#__PURE__*/_react.default.createElement("label", null, "Supercell: "), [0, 1, 2].map(function (index) {
53
- return /*#__PURE__*/_react.default.createElement("input", {
52
+ }, /*#__PURE__*/_react["default"].createElement("div", {
53
+ className: "supercell-container"
54
+ }, /*#__PURE__*/_react["default"].createElement("label", null, "Supercell: "), [0, 1, 2].map(function (index) {
55
+ return /*#__PURE__*/_react["default"].createElement("input", {
54
56
  key: index,
55
57
  className: "supercell-input",
56
58
  type: "number",
@@ -60,38 +62,37 @@ var ControlBox = /*#__PURE__*/function (_React$Component) {
60
62
  return _this2.handleSupercellChange(index, e.target.value);
61
63
  }
62
64
  });
63
- }), /*#__PURE__*/_react.default.createElement("div", {
65
+ })), /*#__PURE__*/_react["default"].createElement("div", {
64
66
  className: "camera-controls"
65
- }, /*#__PURE__*/_react.default.createElement("label", null, "Camera: "), /*#__PURE__*/_react.default.createElement("button", {
67
+ }, /*#__PURE__*/_react["default"].createElement("label", null, "Camera: "), /*#__PURE__*/_react["default"].createElement("button", {
66
68
  onClick: function onClick() {
67
69
  return _this2.handleCameraEvent("x");
68
70
  }
69
- }, "x"), /*#__PURE__*/_react.default.createElement("button", {
71
+ }, "x"), /*#__PURE__*/_react["default"].createElement("button", {
70
72
  onClick: function onClick() {
71
73
  return _this2.handleCameraEvent("y");
72
74
  }
73
- }, "y"), /*#__PURE__*/_react.default.createElement("button", {
75
+ }, "y"), /*#__PURE__*/_react["default"].createElement("button", {
74
76
  onClick: function onClick() {
75
77
  return _this2.handleCameraEvent("z");
76
78
  }
77
- }, "z"))), /*#__PURE__*/_react.default.createElement("div", {
79
+ }, "z"))), /*#__PURE__*/_react["default"].createElement("div", {
78
80
  className: "control-box-row"
79
- }, /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
81
+ }, /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
80
82
  className: "option-checkbox",
81
83
  type: "checkbox",
82
84
  checked: this.props.viewerParams.bonds,
83
85
  onChange: function onChange() {
84
86
  return _this2.handleOptionChange("bonds");
85
87
  }
86
- }), "Bonds"), /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
88
+ }), "Bonds"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
87
89
  className: "option-checkbox",
88
90
  type: "checkbox",
89
91
  checked: this.props.viewerParams.atomLabels,
90
92
  onChange: function onChange() {
91
93
  return _this2.handleOptionChange("atomLabels");
92
- },
93
- disabled: true
94
- }), "Atom Labels"), /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
94
+ }
95
+ }), "Atom labels"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
95
96
  className: "option-checkbox",
96
97
  type: "checkbox",
97
98
  checked: this.props.viewerParams.packedCell,
@@ -99,7 +100,7 @@ var ControlBox = /*#__PURE__*/function (_React$Component) {
99
100
  return _this2.handleOptionChange("packedCell");
100
101
  },
101
102
  disabled: true
102
- }), "Packed Cell"), /*#__PURE__*/_react.default.createElement("label", null, /*#__PURE__*/_react.default.createElement("input", {
103
+ }), "Packed cell"), /*#__PURE__*/_react["default"].createElement("label", null, /*#__PURE__*/_react["default"].createElement("input", {
103
104
  className: "option-checkbox",
104
105
  type: "checkbox",
105
106
  checked: this.props.viewerParams.spaceFilling,
@@ -110,6 +111,6 @@ var ControlBox = /*#__PURE__*/function (_React$Component) {
110
111
  }
111
112
  }]);
112
113
  return ControlBox;
113
- }(_react.default.Component);
114
+ }(_react["default"].Component);
114
115
  var _default = ControlBox;
115
- exports.default = _default;
116
+ exports["default"] = _default;
@@ -4,13 +4,14 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var $3Dmol = _interopRequireWildcard(require("3dmol"));
10
10
  require("./Visualizer3dmol.css");
11
+ var _utils = require("@testing-library/user-event/dist/utils");
11
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
12
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
13
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
14
15
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
15
16
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
16
17
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -42,7 +43,7 @@ var Visualizer3dmol = /*#__PURE__*/function (_React$Component) {
42
43
  value: function componentDidMount() {
43
44
  // set up the viewer instance
44
45
  var config = {
45
- backgroundColor: "mintcream",
46
+ backgroundColor: "white",
46
47
  orthographic: true
47
48
  };
48
49
  this.viewer = $3Dmol.createViewer(this.divId, config);
@@ -58,6 +59,7 @@ var Visualizer3dmol = /*#__PURE__*/function (_React$Component) {
58
59
  }, {
59
60
  key: "updateView",
60
61
  value: function updateView() {
62
+ var _this2 = this;
61
63
  this.viewer.removeAllModels();
62
64
  this.model = this.viewer.addModel(this.props.cifText, "cif");
63
65
  var style = {
@@ -80,7 +82,25 @@ var Visualizer3dmol = /*#__PURE__*/function (_React$Component) {
80
82
  var sc = this.props.viewerParams.supercell;
81
83
  this.viewer.replicateUnitCell(sc[0], sc[1], sc[2], this.model);
82
84
  this.model.assignBonds();
85
+ this.viewer.removeAllLabels();
86
+ if (this.props.viewerParams.atomLabels) {
87
+ this.model.atoms.forEach(function (atom) {
88
+ _this2.viewer.addLabel(atom.elem, {
89
+ position: {
90
+ x: atom.x,
91
+ y: atom.y,
92
+ z: atom.z
93
+ },
94
+ fontColor: atom.color,
95
+ fontSize: 18,
96
+ showBackground: false,
97
+ backgroundOpacity: 0.5,
98
+ inFront: false
99
+ }, null, true);
100
+ });
101
+ }
83
102
  this.viewer.zoomTo();
103
+ this.viewer.zoom(1.4);
84
104
  this.viewer.render();
85
105
  }
86
106
  }, {
@@ -98,18 +118,19 @@ var Visualizer3dmol = /*#__PURE__*/function (_React$Component) {
98
118
  this.viewer.setView([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
99
119
  }
100
120
  this.viewer.zoomTo();
121
+ this.viewer.zoom(1.4);
101
122
  }
102
123
  }
103
124
  }, {
104
125
  key: "render",
105
126
  value: function render() {
106
- return /*#__PURE__*/_react.default.createElement("div", {
127
+ return /*#__PURE__*/_react["default"].createElement("div", {
107
128
  id: this.divId,
108
129
  className: "gldiv"
109
130
  }, "No data!");
110
131
  }
111
132
  }]);
112
133
  return Visualizer3dmol;
113
- }(_react.default.Component);
134
+ }(_react["default"].Component);
114
135
  var _default = Visualizer3dmol;
115
- exports.default = _default;
136
+ exports["default"] = _default;
@@ -7,7 +7,7 @@
7
7
  z-index: 2;
8
8
  height: 370px;
9
9
  width: 450px;
10
- background: #f5fffa;
10
+ background: white;
11
11
  text-align: center;
12
12
  border: 1px solid #999;
13
13
  display: flex;
@@ -21,13 +21,23 @@
21
21
  }
22
22
 
23
23
  .mouse-disabled-note {
24
- background-color: #fafafa;
24
+ background-color: #fff1f1;
25
25
  border: 1px solid black;
26
26
  color: #353434;
27
- padding: 5px;
27
+ padding: 2px 6px;
28
28
  border-radius: 5px;
29
29
  position: absolute;
30
- top: 15px;
31
- left: 170px;
30
+ top: 10px;
31
+ left: 10px;
32
32
  z-index: 3;
33
+ cursor: pointer;
34
+ user-select: none;
35
+ }
36
+
37
+ .on {
38
+ background-color: #e9ffe7;
39
+ }
40
+
41
+ .mouse-disabled-note:hover {
42
+ filter: brightness(90%);
33
43
  }
@@ -4,11 +4,11 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _Visualizer3dmol = _interopRequireDefault(require("./3dmol/Visualizer3dmol"));
10
10
  require("./index.css");
11
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
11
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
12
12
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
13
13
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
14
14
  function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
@@ -34,23 +34,32 @@ var StructureWindow = /*#__PURE__*/function (_React$Component) {
34
34
  var _this = this;
35
35
  var swClassName = "structure-window";
36
36
  if (!this.props.mouseEnabled) swClassName += " disable-mouse";
37
- return /*#__PURE__*/_react.default.createElement("div", {
37
+ var mouseNoteText = "Interaction off";
38
+ var mouseNoteClass = "mouse-disabled-note";
39
+ if (this.props.mouseEnabled) {
40
+ mouseNoteText = "Interaction on";
41
+ mouseNoteClass = "mouse-disabled-note on";
42
+ }
43
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("div", {
38
44
  className: "structure-window-outer",
39
45
  onClick: function onClick() {
40
- return _this.props.setMouseEnabled();
46
+ return _this.props.setMouseEnabledState(true);
41
47
  }
42
- }, /*#__PURE__*/_react.default.createElement("div", {
48
+ }, /*#__PURE__*/_react["default"].createElement("div", {
43
49
  className: swClassName
44
- }, /*#__PURE__*/_react.default.createElement(_Visualizer3dmol.default, {
50
+ }, /*#__PURE__*/_react["default"].createElement(_Visualizer3dmol["default"], {
45
51
  ref: this.props.visualizerRef,
46
52
  viewerParams: this.props.viewerParams,
47
53
  cifText: this.props.cifText
48
- })), !this.props.mouseEnabled && /*#__PURE__*/_react.default.createElement("div", {
49
- className: "mouse-disabled-note"
50
- }, "Click to interact!"));
54
+ }))), /*#__PURE__*/_react["default"].createElement("div", {
55
+ className: mouseNoteClass,
56
+ onClick: function onClick() {
57
+ return _this.props.setMouseEnabledState(!_this.props.mouseEnabled);
58
+ }
59
+ }, mouseNoteText));
51
60
  }
52
61
  }]);
53
62
  return StructureWindow;
54
- }(_react.default.Component);
63
+ }(_react["default"].Component);
55
64
  var _default = StructureWindow;
56
- exports.default = _default;
65
+ exports["default"] = _default;
package/dist/index.js CHANGED
@@ -4,12 +4,12 @@ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" =
4
4
  Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
- exports.default = void 0;
7
+ exports["default"] = void 0;
8
8
  var _react = _interopRequireDefault(require("react"));
9
9
  var _ControlBox = _interopRequireDefault(require("./ControlBox"));
10
10
  var _StructureWindow = _interopRequireDefault(require("./StructureWindow"));
11
11
  require("./index.css");
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
13
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
14
14
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
15
15
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -44,14 +44,14 @@ var StructureVisualizer = /*#__PURE__*/function (_React$Component) {
44
44
  };
45
45
 
46
46
  // use Ref to send events to the visualizer backend
47
- _this.visualizerRef = /*#__PURE__*/_react.default.createRef();
47
+ _this.visualizerRef = /*#__PURE__*/_react["default"].createRef();
48
48
 
49
49
  // Ref to detect click outside
50
- _this.wrapperRef = /*#__PURE__*/_react.default.createRef();
50
+ _this.wrapperRef = /*#__PURE__*/_react["default"].createRef();
51
51
  _this.handleClickOutside = _this.handleClickOutside.bind(_assertThisInitialized(_this));
52
52
  _this.handleViewerParamChange = _this.handleViewerParamChange.bind(_assertThisInitialized(_this));
53
53
  _this.handleViewerEvent = _this.handleViewerEvent.bind(_assertThisInitialized(_this));
54
- _this.setMouseEnabled = _this.setMouseEnabled.bind(_assertThisInitialized(_this));
54
+ _this.setMouseEnabledState = _this.setMouseEnabledState.bind(_assertThisInitialized(_this));
55
55
  return _this;
56
56
  }
57
57
  _createClass(StructureVisualizer, [{
@@ -74,10 +74,10 @@ var StructureVisualizer = /*#__PURE__*/function (_React$Component) {
74
74
  }
75
75
  }
76
76
  }, {
77
- key: "setMouseEnabled",
78
- value: function setMouseEnabled() {
77
+ key: "setMouseEnabledState",
78
+ value: function setMouseEnabledState(state) {
79
79
  this.setState({
80
- mouseEnabled: true
80
+ mouseEnabled: state
81
81
  });
82
82
  }
83
83
  }, {
@@ -95,16 +95,16 @@ var StructureVisualizer = /*#__PURE__*/function (_React$Component) {
95
95
  }, {
96
96
  key: "render",
97
97
  value: function render() {
98
- return /*#__PURE__*/_react.default.createElement("div", {
98
+ return /*#__PURE__*/_react["default"].createElement("div", {
99
99
  ref: this.wrapperRef,
100
100
  className: "structure-visualizer"
101
- }, /*#__PURE__*/_react.default.createElement(_StructureWindow.default, {
101
+ }, /*#__PURE__*/_react["default"].createElement(_StructureWindow["default"], {
102
102
  visualizerRef: this.visualizerRef,
103
103
  viewerParams: this.state.viewerParams,
104
104
  cifText: this.props.cifText,
105
105
  mouseEnabled: this.state.mouseEnabled,
106
- setMouseEnabled: this.setMouseEnabled
107
- }), /*#__PURE__*/_react.default.createElement(_ControlBox.default, {
106
+ setMouseEnabledState: this.setMouseEnabledState
107
+ }), /*#__PURE__*/_react["default"].createElement(_ControlBox["default"], {
108
108
  viewerParams: this.state.viewerParams,
109
109
  onViewerParamChange: this.handleViewerParamChange,
110
110
  onViewerEvent: this.handleViewerEvent
@@ -112,6 +112,6 @@ var StructureVisualizer = /*#__PURE__*/function (_React$Component) {
112
112
  }
113
113
  }]);
114
114
  return StructureVisualizer;
115
- }(_react.default.Component);
115
+ }(_react["default"].Component);
116
116
  var _default = StructureVisualizer;
117
- exports.default = _default;
117
+ exports["default"] = _default;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mc-react-structure-visualizer",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "author": "Kristjan Eimre <kristjan.eimre@epfl.ch>",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -24,7 +24,8 @@
24
24
  },
25
25
  "scripts": {
26
26
  "start": "react-scripts start",
27
- "build": "SET NODE_ENV=production && rm -rf dist && npx babel src/StructureVisualizer --out-dir dist --copy-files",
27
+ "prebuild": "rimraf dist",
28
+ "build": "SET NODE_ENV=production && npx babel src/StructureVisualizer --out-dir dist --copy-files",
28
29
  "test": "react-scripts test",
29
30
  "eject": "react-scripts eject"
30
31
  },
@@ -51,6 +52,7 @@
51
52
  "@babel/core": "^7.20.12",
52
53
  "@babel/preset-env": "^7.20.2",
53
54
  "@babel/preset-react": "^7.18.6",
54
- "babel-loader": "^9.1.2"
55
+ "babel-loader": "^9.1.2",
56
+ "rimraf": "^4.1.2"
55
57
  }
56
58
  }
package/public/index.html CHANGED
@@ -1,43 +1,43 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8" />
5
- <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
- <meta name="viewport" content="width=device-width, initial-scale=1" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-react-app"
11
- />
12
- <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
- <!--
14
- manifest.json provides metadata used when your web app is installed on a
15
- user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
- -->
17
- <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
- <!--
19
- Notice the use of %PUBLIC_URL% in the tags above.
20
- It will be replaced with the URL of the `public` folder during the build.
21
- Only files inside the `public` folder can be referenced from the HTML.
22
-
23
- Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
- work correctly both with client-side routing and a non-root public URL.
25
- Learn how to configure a non-root public URL by running `npm run build`.
26
- -->
27
- <title>React App</title>
28
- </head>
29
- <body>
30
- <noscript>You need to enable JavaScript to run this app.</noscript>
31
- <div id="root"></div>
32
- <!--
33
- This HTML file is a template.
34
- If you open it directly in the browser, you will see an empty page.
35
-
36
- You can add webfonts, meta tags, or analytics to this file.
37
- The build step will place the bundled scripts into the <body> tag.
38
-
39
- To begin the development, run `npm start` or `yarn start`.
40
- To create a production bundle, use `npm run build` or `yarn build`.
41
- -->
42
- </body>
43
- </html>
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8" />
5
+ <link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
6
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
7
+ <meta name="theme-color" content="#000000" />
8
+ <meta
9
+ name="description"
10
+ content="Web site created using create-react-app"
11
+ />
12
+ <link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
13
+ <!--
14
+ manifest.json provides metadata used when your web app is installed on a
15
+ user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
16
+ -->
17
+ <link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
18
+ <!--
19
+ Notice the use of %PUBLIC_URL% in the tags above.
20
+ It will be replaced with the URL of the `public` folder during the build.
21
+ Only files inside the `public` folder can be referenced from the HTML.
22
+
23
+ Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
24
+ work correctly both with client-side routing and a non-root public URL.
25
+ Learn how to configure a non-root public URL by running `npm run build`.
26
+ -->
27
+ <title>React App</title>
28
+ </head>
29
+ <body>
30
+ <noscript>You need to enable JavaScript to run this app.</noscript>
31
+ <div id="root"></div>
32
+ <!--
33
+ This HTML file is a template.
34
+ If you open it directly in the browser, you will see an empty page.
35
+
36
+ You can add webfonts, meta tags, or analytics to this file.
37
+ The build step will place the bundled scripts into the <body> tag.
38
+
39
+ To begin the development, run `npm start` or `yarn start`.
40
+ To create a production bundle, use `npm run build` or `yarn build`.
41
+ -->
42
+ </body>
43
+ </html>
@@ -1,25 +1,25 @@
1
- {
2
- "short_name": "React App",
3
- "name": "Create React App Sample",
4
- "icons": [
5
- {
6
- "src": "favicon.ico",
7
- "sizes": "64x64 32x32 24x24 16x16",
8
- "type": "image/x-icon"
9
- },
10
- {
11
- "src": "logo192.png",
12
- "type": "image/png",
13
- "sizes": "192x192"
14
- },
15
- {
16
- "src": "logo512.png",
17
- "type": "image/png",
18
- "sizes": "512x512"
19
- }
20
- ],
21
- "start_url": ".",
22
- "display": "standalone",
23
- "theme_color": "#000000",
24
- "background_color": "#ffffff"
25
- }
1
+ {
2
+ "short_name": "React App",
3
+ "name": "Create React App Sample",
4
+ "icons": [
5
+ {
6
+ "src": "favicon.ico",
7
+ "sizes": "64x64 32x32 24x24 16x16",
8
+ "type": "image/x-icon"
9
+ },
10
+ {
11
+ "src": "logo192.png",
12
+ "type": "image/png",
13
+ "sizes": "192x192"
14
+ },
15
+ {
16
+ "src": "logo512.png",
17
+ "type": "image/png",
18
+ "sizes": "512x512"
19
+ }
20
+ ],
21
+ "start_url": ".",
22
+ "display": "standalone",
23
+ "theme_color": "#000000",
24
+ "background_color": "#ffffff"
25
+ }
package/public/robots.txt CHANGED
@@ -1,3 +1,3 @@
1
- # https://www.robotstxt.org/robotstxt.html
2
- User-agent: *
3
- Disallow:
1
+ # https://www.robotstxt.org/robotstxt.html
2
+ User-agent: *
3
+ Disallow:
package/src/App.css CHANGED
@@ -1,38 +1,38 @@
1
- /* .App {
2
- text-align: center;
3
- }
4
-
5
- .App-logo {
6
- height: 40vmin;
7
- pointer-events: none;
8
- }
9
-
10
- @media (prefers-reduced-motion: no-preference) {
11
- .App-logo {
12
- animation: App-logo-spin infinite 20s linear;
13
- }
14
- }
15
-
16
- .App-header {
17
- background-color: #282c34;
18
- min-height: 100vh;
19
- display: flex;
20
- flex-direction: column;
21
- align-items: center;
22
- justify-content: center;
23
- font-size: calc(10px + 2vmin);
24
- color: white;
25
- }
26
-
27
- .App-link {
28
- color: #61dafb;
29
- }
30
-
31
- @keyframes App-logo-spin {
32
- from {
33
- transform: rotate(0deg);
34
- }
35
- to {
36
- transform: rotate(360deg);
37
- }
38
- } */
1
+ /* .App {
2
+ text-align: center;
3
+ }
4
+
5
+ .App-logo {
6
+ height: 40vmin;
7
+ pointer-events: none;
8
+ }
9
+
10
+ @media (prefers-reduced-motion: no-preference) {
11
+ .App-logo {
12
+ animation: App-logo-spin infinite 20s linear;
13
+ }
14
+ }
15
+
16
+ .App-header {
17
+ background-color: #282c34;
18
+ min-height: 100vh;
19
+ display: flex;
20
+ flex-direction: column;
21
+ align-items: center;
22
+ justify-content: center;
23
+ font-size: calc(10px + 2vmin);
24
+ color: white;
25
+ }
26
+
27
+ .App-link {
28
+ color: #61dafb;
29
+ }
30
+
31
+ @keyframes App-logo-spin {
32
+ from {
33
+ transform: rotate(0deg);
34
+ }
35
+ to {
36
+ transform: rotate(360deg);
37
+ }
38
+ } */
@@ -27,8 +27,14 @@
27
27
  }
28
28
 
29
29
  .control-box-row {
30
- margin: 5px 5px;
30
+ margin: 5px 0px;
31
+ padding: 0px 10px;
32
+ width: 100%;
31
33
  line-height: inherit;
34
+ /* background-color: pink; */
35
+ display: flex;
36
+ justify-content: space-between;
37
+ align-items: stretch;
32
38
  }
33
39
 
34
40
  .control-box-row label {
@@ -55,6 +61,7 @@
55
61
  }
56
62
 
57
63
  .control-box-row .camera-controls {
58
- margin: 0px 30px;
64
+ margin-left: auto;
65
+ margin-right: auto;
59
66
  display: inline;
60
67
  }
@@ -25,19 +25,21 @@ class ControlBox extends React.Component {
25
25
  return (
26
26
  <div className="control-box">
27
27
  <div className="control-box-row">
28
- <label>Supercell: </label>
29
- {[0, 1, 2].map((index) => (
30
- <input
31
- key={index}
32
- className="supercell-input"
33
- type="number"
34
- min="1"
35
- value={this.props.viewerParams.supercell[index]}
36
- onChange={(e) =>
37
- this.handleSupercellChange(index, e.target.value)
38
- }
39
- />
40
- ))}
28
+ <div className="supercell-container">
29
+ <label>Supercell: </label>
30
+ {[0, 1, 2].map((index) => (
31
+ <input
32
+ key={index}
33
+ className="supercell-input"
34
+ type="number"
35
+ min="1"
36
+ value={this.props.viewerParams.supercell[index]}
37
+ onChange={(e) =>
38
+ this.handleSupercellChange(index, e.target.value)
39
+ }
40
+ />
41
+ ))}
42
+ </div>
41
43
  <div className="camera-controls">
42
44
  <label>Camera: </label>
43
45
  <button onClick={() => this.handleCameraEvent("x")}>x</button>
@@ -61,9 +63,8 @@ class ControlBox extends React.Component {
61
63
  type="checkbox"
62
64
  checked={this.props.viewerParams.atomLabels}
63
65
  onChange={() => this.handleOptionChange("atomLabels")}
64
- disabled={true}
65
66
  />
66
- Atom Labels
67
+ Atom labels
67
68
  </label>
68
69
  <label>
69
70
  <input
@@ -73,7 +74,7 @@ class ControlBox extends React.Component {
73
74
  onChange={() => this.handleOptionChange("packedCell")}
74
75
  disabled={true}
75
76
  />
76
- Packed Cell
77
+ Packed cell
77
78
  </label>
78
79
  <label>
79
80
  <input
@@ -3,6 +3,7 @@ import React from "react";
3
3
  import * as $3Dmol from "3dmol";
4
4
 
5
5
  import "./Visualizer3dmol.css";
6
+ import { isLabelWithInternallyDisabledControl } from "@testing-library/user-event/dist/utils";
6
7
 
7
8
  class Visualizer3dmol extends React.Component {
8
9
  constructor(props) {
@@ -17,7 +18,7 @@ class Visualizer3dmol extends React.Component {
17
18
 
18
19
  componentDidMount() {
19
20
  // set up the viewer instance
20
- let config = { backgroundColor: "mintcream", orthographic: true };
21
+ let config = { backgroundColor: "white", orthographic: true };
21
22
  this.viewer = $3Dmol.createViewer(this.divId, config);
22
23
 
23
24
  this.updateView();
@@ -51,9 +52,30 @@ class Visualizer3dmol extends React.Component {
51
52
  this.viewer.addUnitCell(this.model);
52
53
  let sc = this.props.viewerParams.supercell;
53
54
  this.viewer.replicateUnitCell(sc[0], sc[1], sc[2], this.model);
55
+
54
56
  this.model.assignBonds();
55
57
 
58
+ this.viewer.removeAllLabels();
59
+ if (this.props.viewerParams.atomLabels) {
60
+ this.model.atoms.forEach((atom) => {
61
+ this.viewer.addLabel(
62
+ atom.elem,
63
+ {
64
+ position: { x: atom.x, y: atom.y, z: atom.z },
65
+ fontColor: atom.color,
66
+ fontSize: 18,
67
+ showBackground: false,
68
+ backgroundOpacity: 0.5,
69
+ inFront: false,
70
+ },
71
+ null,
72
+ true
73
+ );
74
+ });
75
+ }
76
+
56
77
  this.viewer.zoomTo();
78
+ this.viewer.zoom(1.4);
57
79
  this.viewer.render();
58
80
  }
59
81
 
@@ -70,6 +92,7 @@ class Visualizer3dmol extends React.Component {
70
92
  this.viewer.setView([0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0]);
71
93
  }
72
94
  this.viewer.zoomTo();
95
+ this.viewer.zoom(1.4);
73
96
  }
74
97
  }
75
98
 
@@ -7,7 +7,7 @@
7
7
  z-index: 2;
8
8
  height: 370px;
9
9
  width: 450px;
10
- background: #f5fffa;
10
+ background: white;
11
11
  text-align: center;
12
12
  border: 1px solid #999;
13
13
  display: flex;
@@ -21,13 +21,23 @@
21
21
  }
22
22
 
23
23
  .mouse-disabled-note {
24
- background-color: #fafafa;
24
+ background-color: #fff1f1;
25
25
  border: 1px solid black;
26
26
  color: #353434;
27
- padding: 5px;
27
+ padding: 2px 6px;
28
28
  border-radius: 5px;
29
29
  position: absolute;
30
- top: 15px;
31
- left: 170px;
30
+ top: 10px;
31
+ left: 10px;
32
32
  z-index: 3;
33
+ cursor: pointer;
34
+ user-select: none;
35
+ }
36
+
37
+ .on {
38
+ background-color: #e9ffe7;
39
+ }
40
+
41
+ .mouse-disabled-note:hover {
42
+ filter: brightness(90%);
33
43
  }
@@ -12,21 +12,35 @@ class StructureWindow extends React.Component {
12
12
  render() {
13
13
  let swClassName = "structure-window";
14
14
  if (!this.props.mouseEnabled) swClassName += " disable-mouse";
15
+
16
+ let mouseNoteText = "Interaction off";
17
+ let mouseNoteClass = "mouse-disabled-note";
18
+ if (this.props.mouseEnabled) {
19
+ mouseNoteText = "Interaction on";
20
+ mouseNoteClass = "mouse-disabled-note on";
21
+ }
15
22
  return (
16
- <div
17
- className="structure-window-outer"
18
- onClick={() => this.props.setMouseEnabled()}
19
- >
20
- <div className={swClassName}>
21
- <Visualizer3dmol
22
- ref={this.props.visualizerRef}
23
- viewerParams={this.props.viewerParams}
24
- cifText={this.props.cifText}
25
- />
23
+ <div>
24
+ <div
25
+ className="structure-window-outer"
26
+ onClick={() => this.props.setMouseEnabledState(true)}
27
+ >
28
+ <div className={swClassName}>
29
+ <Visualizer3dmol
30
+ ref={this.props.visualizerRef}
31
+ viewerParams={this.props.viewerParams}
32
+ cifText={this.props.cifText}
33
+ />
34
+ </div>
35
+ </div>
36
+ <div
37
+ className={mouseNoteClass}
38
+ onClick={() =>
39
+ this.props.setMouseEnabledState(!this.props.mouseEnabled)
40
+ }
41
+ >
42
+ {mouseNoteText}
26
43
  </div>
27
- {!this.props.mouseEnabled && (
28
- <div className="mouse-disabled-note">Click to interact!</div>
29
- )}
30
44
  </div>
31
45
  );
32
46
  }
@@ -30,7 +30,7 @@ class StructureVisualizer extends React.Component {
30
30
 
31
31
  this.handleViewerParamChange = this.handleViewerParamChange.bind(this);
32
32
  this.handleViewerEvent = this.handleViewerEvent.bind(this);
33
- this.setMouseEnabled = this.setMouseEnabled.bind(this);
33
+ this.setMouseEnabledState = this.setMouseEnabledState.bind(this);
34
34
  }
35
35
 
36
36
  componentDidMount() {
@@ -47,8 +47,8 @@ class StructureVisualizer extends React.Component {
47
47
  }
48
48
  }
49
49
 
50
- setMouseEnabled() {
51
- this.setState({ mouseEnabled: true });
50
+ setMouseEnabledState(state) {
51
+ this.setState({ mouseEnabled: state });
52
52
  }
53
53
 
54
54
  handleViewerParamChange(param, value) {
@@ -72,7 +72,7 @@ class StructureVisualizer extends React.Component {
72
72
  viewerParams={this.state.viewerParams}
73
73
  cifText={this.props.cifText}
74
74
  mouseEnabled={this.state.mouseEnabled}
75
- setMouseEnabled={this.setMouseEnabled}
75
+ setMouseEnabledState={this.setMouseEnabledState}
76
76
  />
77
77
  <ControlBox
78
78
  viewerParams={this.state.viewerParams}
package/src/index.css CHANGED
@@ -1,13 +1,13 @@
1
- body {
2
- margin: 0;
3
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
- sans-serif;
6
- -webkit-font-smoothing: antialiased;
7
- -moz-osx-font-smoothing: grayscale;
8
- }
9
-
10
- code {
11
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
- monospace;
13
- }
1
+ body {
2
+ margin: 0;
3
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4
+ 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5
+ sans-serif;
6
+ -webkit-font-smoothing: antialiased;
7
+ -moz-osx-font-smoothing: grayscale;
8
+ }
9
+
10
+ code {
11
+ font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12
+ monospace;
13
+ }
package/src/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import React from 'react';
2
- import ReactDOM from 'react-dom/client';
3
- import './index.css';
4
- import App from './App';
5
- import reportWebVitals from './reportWebVitals';
6
-
7
- const root = ReactDOM.createRoot(document.getElementById('root'));
8
- root.render(
9
- <React.StrictMode>
10
- <App />
11
- </React.StrictMode>
12
- );
13
-
14
- // If you want to start measuring performance in your app, pass a function
15
- // to log results (for example: reportWebVitals(console.log))
16
- // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17
- reportWebVitals();
1
+ import React from 'react';
2
+ import ReactDOM from 'react-dom/client';
3
+ import './index.css';
4
+ import App from './App';
5
+ import reportWebVitals from './reportWebVitals';
6
+
7
+ const root = ReactDOM.createRoot(document.getElementById('root'));
8
+ root.render(
9
+ <React.StrictMode>
10
+ <App />
11
+ </React.StrictMode>
12
+ );
13
+
14
+ // If you want to start measuring performance in your app, pass a function
15
+ // to log results (for example: reportWebVitals(console.log))
16
+ // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
17
+ reportWebVitals();
@@ -1,13 +1,13 @@
1
- const reportWebVitals = onPerfEntry => {
2
- if (onPerfEntry && onPerfEntry instanceof Function) {
3
- import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
- getCLS(onPerfEntry);
5
- getFID(onPerfEntry);
6
- getFCP(onPerfEntry);
7
- getLCP(onPerfEntry);
8
- getTTFB(onPerfEntry);
9
- });
10
- }
11
- };
12
-
13
- export default reportWebVitals;
1
+ const reportWebVitals = onPerfEntry => {
2
+ if (onPerfEntry && onPerfEntry instanceof Function) {
3
+ import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
4
+ getCLS(onPerfEntry);
5
+ getFID(onPerfEntry);
6
+ getFCP(onPerfEntry);
7
+ getLCP(onPerfEntry);
8
+ getTTFB(onPerfEntry);
9
+ });
10
+ }
11
+ };
12
+
13
+ export default reportWebVitals;