Skip to content

Commit 7088d8f

Browse files
Merge pull request #37 from BasicPrimitives/treeshaking
Added tree shaking support for core library
2 parents e7f80a0 + b3d8187 commit 7088d8f

File tree

84 files changed

+3693
-3740
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+3693
-3740
lines changed

client/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"@testing-library/react": "^11.1.0",
1616
"@testing-library/user-event": "^12.1.10",
1717
"axios": "^0.21.0",
18-
"basicprimitives": "^5.9.2",
19-
"basicprimitivesreact": "^5.9.3",
18+
"basicprimitives": "^6.0.3",
19+
"basicprimitivesreact": "^6.0.3",
2020
"blob-stream": "^0.1.3",
2121
"clsx": "^1.1.1",
2222
"codemirror": "^5.58.2",

client/src/components/Options/CheckboxOption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual } from 'lodash';
33
import PropTypes from 'prop-types';
44
import Checkbox from '@material-ui/core/Checkbox';
55
import FormControlLabel from '@material-ui/core/FormControlLabel';
@@ -17,7 +17,7 @@ class CheckboxOption extends Component { // eslint-disable-line react/prefer-sta
1717
const nextOptions = this.getUsedOptions(nextProps);
1818
const currentOptions = this.getUsedOptions(this.props);
1919

20-
return !_.isEqual(currentOptions, nextOptions);
20+
return !isEqual(currentOptions, nextOptions);
2121
}
2222

2323
getUsedOptions(props) { // eslint-disable-line class-methods-use-this

client/src/components/Options/ComboBoxOption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual } from 'lodash';
33
import PropTypes from 'prop-types';
44
import FormLabel from '@material-ui/core/FormLabel';
55
import MenuItem from '@material-ui/core/MenuItem';
@@ -34,7 +34,7 @@ class ComboBoxOption extends Component {
3434
const nextOptions = this.getUsedOptions(nextProps);
3535
const currentOptions = this.getUsedOptions(this.props);
3636

37-
return !_.isEqual(currentOptions, nextOptions);
37+
return !isEqual(currentOptions, nextOptions);
3838
}
3939

4040
getValue(value) {

client/src/components/Options/ItemsOrderOption.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { Component } from 'react';
22
import PropTypes from 'prop-types';
3-
import _ from 'lodash';
3+
import { isEqual } from 'lodash';
44
import { SortableContainer, SortableElement, arrayMove } from 'react-sortable-hoc';
55
import List from '@material-ui/core/List';
66
import ListItem from '@material-ui/core/ListItem';
@@ -45,7 +45,7 @@ class ItemsOrderOption extends Component {
4545

4646
componentWillReceiveProps({ items: newItems }) {
4747
const { items } = this.state;
48-
if (!_.isEqual(newItems, items)) {
48+
if (!isEqual(newItems, items)) {
4949
this.setState({
5050
items: newItems
5151
});
@@ -56,7 +56,7 @@ class ItemsOrderOption extends Component {
5656
// eslint-disable-line no-unused-vars
5757
const { items } = this.state;
5858
const { items: newItems } = nextState;
59-
return !_.isEqual(items, newItems);
59+
return !isEqual(items, newItems);
6060
}
6161

6262
onSortEnd({ oldIndex, newIndex }) {

client/src/components/Options/RadioGroupOption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual } from 'lodash';
33
import PropTypes from 'prop-types';
44
import Radio from '@material-ui/core/Radio';
55
import RadioGroup from '@material-ui/core/RadioGroup';
@@ -29,7 +29,7 @@ class RadioGroupOption extends Component {
2929
const nextOptions = this.getUsedOptions(nextProps);
3030
const currentOptions = this.getUsedOptions(this.props);
3131

32-
return !_.isEqual(currentOptions, nextOptions);
32+
return !isEqual(currentOptions, nextOptions);
3333
}
3434

3535
getValue(value) {

client/src/components/Options/SizeOption.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual } from 'lodash';
33
import PropTypes from 'prop-types';
44
import FormLabel from '@material-ui/core/FormLabel';
55
import MenuItem from '@material-ui/core/MenuItem';
66
import FormControl from '@material-ui/core/FormControl';
77
import Select from '@material-ui/core/Select';
8-
import primitives from 'basicprimitives';
8+
import { Size } from 'basicprimitives';
99
import Tooltip from '@material-ui/core/Tooltip';
1010

1111
class SizeOption extends Component {
@@ -25,17 +25,17 @@ class SizeOption extends Component {
2525
const nextOptions = this.getUsedOptions(nextProps);
2626
const currentOptions = this.getUsedOptions(this.props);
2727

28-
return !_.isEqual(currentOptions, nextOptions);
28+
return !isEqual(currentOptions, nextOptions);
2929
}
3030

3131
onWidthChange(width) {
3232
const { onChange, value } = this.props;
33-
onChange(new primitives.common.Size(width, value.height));
33+
onChange(new Size(width, value.height));
3434
}
3535

3636
onHeightChange(height) {
3737
const { onChange, value } = this.props;
38-
onChange(new primitives.common.Size(value.width, height));
38+
onChange(new Size(value.width, height));
3939
}
4040

4141
getUsedOptions(props) { // eslint-disable-line class-methods-use-this

client/src/components/Options/TextOption.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual } from 'lodash';
33
import PropTypes from 'prop-types';
44
import TextField from '@material-ui/core/TextField';
55

@@ -56,7 +56,7 @@ class TextOption extends Component { // eslint-disable-line react/prefer-statele
5656
const currentOptions = this.getUsedOptions(this.props);
5757
const { value } = this.state;
5858
const { newValue } = nextState;
59-
return !(_.isEqual(currentOptions, nextOptions) && value === newValue);
59+
return !(isEqual(currentOptions, nextOptions) && value === newValue);
6060
}
6161

6262
onTimer() {

client/src/components/Options/ThicknessOption.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import React, { Component } from 'react';
2-
import _ from 'lodash';
2+
import { isEqual, startCase, camelCase } from 'lodash';
33
import PropTypes from 'prop-types';
44
import FormLabel from '@material-ui/core/FormLabel';
55
import MenuItem from '@material-ui/core/MenuItem';
66
import FormControl from '@material-ui/core/FormControl';
77
import Select from '@material-ui/core/Select';
88
import Tooltip from '@material-ui/core/Tooltip';
9-
import primitives from 'basicprimitives';
9+
import { Thickness } from 'basicprimitives';
1010

1111
class ThicknessOption extends Component {
1212
static propTypes = {
@@ -26,12 +26,12 @@ class ThicknessOption extends Component {
2626
const nextOptions = this.getUsedOptions(nextProps);
2727
const currentOptions = this.getUsedOptions(this.props);
2828

29-
return !_.isEqual(currentOptions, nextOptions);
29+
return !isEqual(currentOptions, nextOptions);
3030
}
3131

3232
onPropertyChange(propertyName, propertyValue) {
3333
const { onChange, value } = this.props;
34-
const result = new primitives.common.Thickness(value);
34+
const result = new Thickness(value);
3535
result[propertyName] = propertyValue;
3636
onChange(result);
3737
}
@@ -58,7 +58,7 @@ class ThicknessOption extends Component {
5858
</Tooltip>
5959
{names.map(name => {
6060
return <FormControl className={'option-panel-item'} key={`${propertyName}-${name}`}>
61-
<FormLabel key={`${propertyName}-${name}-label`} id={`${propertyName}-${name}-label`}>{_.startCase(_.camelCase(name))}</FormLabel>
61+
<FormLabel key={`${propertyName}-${name}-label`} id={`${propertyName}-${name}-label`}>{startCase(camelCase(name))}</FormLabel>
6262
<Select
6363
labelId={`${propertyName}-${name}-label`}
6464
key={`${propertyName}-${name}`}

0 commit comments

Comments
 (0)