@pie-lib/math-input 6.8.4-next.0 → 6.8.5-next.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 (55) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/lib/horizontal-keypad.js.map +1 -1
  3. package/lib/index.js.map +1 -1
  4. package/lib/keypad/index.js.map +1 -1
  5. package/lib/keypad/keys-layout.js.map +1 -1
  6. package/lib/keys/basic-operators.js.map +1 -1
  7. package/lib/keys/comparison.js.map +1 -1
  8. package/lib/keys/constants.js.map +1 -1
  9. package/lib/keys/digits.js.map +1 -1
  10. package/lib/keys/exponent.js.map +1 -1
  11. package/lib/keys/fractions.js.map +1 -1
  12. package/lib/keys/geometry.js.map +1 -1
  13. package/lib/keys/grades.js.map +1 -1
  14. package/lib/keys/index.js.map +1 -1
  15. package/lib/keys/log.js.map +1 -1
  16. package/lib/keys/logic.js.map +1 -1
  17. package/lib/keys/matrices.js.map +1 -1
  18. package/lib/keys/misc.js.map +1 -1
  19. package/lib/keys/operators.js.map +1 -1
  20. package/lib/keys/statistics.js.map +1 -1
  21. package/lib/keys/sub-sup.js.map +1 -1
  22. package/lib/keys/utils.js.map +1 -1
  23. package/lib/keys/vars.js.map +1 -1
  24. package/lib/math-input.js.map +1 -1
  25. package/lib/mq/custom-elements.js.map +1 -1
  26. package/lib/mq/input.js.map +1 -1
  27. package/lib/mq/static.js +1 -1
  28. package/lib/mq/static.js.map +1 -1
  29. package/package.json +2 -2
  30. package/src/horizontal-keypad.jsx +4 -4
  31. package/src/index.jsx +7 -7
  32. package/src/keypad/index.jsx +66 -97
  33. package/src/keypad/keys-layout.js +1 -1
  34. package/src/keys/basic-operators.js +5 -5
  35. package/src/keys/comparison.js +5 -5
  36. package/src/keys/constants.js +4 -4
  37. package/src/keys/digits.js +5 -5
  38. package/src/keys/exponent.js +4 -4
  39. package/src/keys/fractions.js +3 -3
  40. package/src/keys/geometry.js +24 -24
  41. package/src/keys/grades.js +43 -67
  42. package/src/keys/index.js +1 -1
  43. package/src/keys/log.js +3 -3
  44. package/src/keys/logic.js +2 -2
  45. package/src/keys/matrices.js +2 -2
  46. package/src/keys/misc.js +10 -10
  47. package/src/keys/operators.js +1 -1
  48. package/src/keys/statistics.js +5 -5
  49. package/src/keys/sub-sup.js +2 -2
  50. package/src/keys/utils.js +8 -8
  51. package/src/keys/vars.js +3 -3
  52. package/src/math-input.jsx +14 -14
  53. package/src/mq/custom-elements.js +1 -1
  54. package/src/mq/input.jsx +6 -6
  55. package/src/mq/static.jsx +7 -14
@@ -5,11 +5,11 @@ const set = mkSet('sub-sup');
5
5
  export const superscript = set({
6
6
  name: 'Superscript',
7
7
  latex: 'x^{}',
8
- command: '^'
8
+ command: '^',
9
9
  });
10
10
 
11
11
  export const subscript = set({
12
12
  name: 'Subscript',
13
13
  latex: 'x_{}',
14
- command: '_'
14
+ command: '_',
15
15
  });
package/src/keys/utils.js CHANGED
@@ -1,21 +1,21 @@
1
1
  import _ from 'lodash';
2
2
 
3
- export const mkSet = category => o => ({ ...o, category });
3
+ export const mkSet = (category) => (o) => ({ ...o, category });
4
4
 
5
- export const toArray = o => Object.keys(o).map(k => o[k]);
5
+ export const toArray = (o) => Object.keys(o).map((k) => o[k]);
6
6
 
7
- export const toKey = category => v => {
7
+ export const toKey = (category) => (v) => {
8
8
  if (typeof v === 'string') {
9
9
  return {
10
10
  name: v,
11
11
  label: v,
12
12
  category,
13
- write: v
13
+ write: v,
14
14
  };
15
15
  } else {
16
16
  return {
17
17
  ...v,
18
- category
18
+ category,
19
19
  };
20
20
  }
21
21
  };
@@ -42,10 +42,10 @@ export const transformToKeySetStructure = (data = []) => {
42
42
  return structure;
43
43
  };
44
44
 
45
- const latexAndNameDontExist = base => k => {
45
+ const latexAndNameDontExist = (base) => (k) => {
46
46
  const flattened = _.flatten(base);
47
- const latexExists = flattened.some(b => b.latex === k.latex);
48
- const nameExists = flattened.some(b => b.name === k.name);
47
+ const latexExists = flattened.some((b) => b.latex === k.latex);
48
+ const nameExists = flattened.some((b) => b.name === k.name);
49
49
  return !latexExists && !nameExists;
50
50
  };
51
51
 
package/src/keys/vars.js CHANGED
@@ -5,15 +5,15 @@ const set = mkSet('vars');
5
5
  export const x = set({
6
6
  name: 'X',
7
7
  latex: 'x',
8
- write: 'x'
8
+ write: 'x',
9
9
  });
10
10
  export const y = set({
11
11
  name: 'Y',
12
12
  latex: 'y',
13
- write: 'y'
13
+ write: 'y',
14
14
  });
15
15
  export const theta = set({
16
16
  name: 'Theta',
17
17
  latex: '\\theta',
18
- write: '\\theta'
18
+ write: '\\theta',
19
19
  });
@@ -16,22 +16,22 @@ export class MathInput extends React.Component {
16
16
  keyset: PropTypes.array,
17
17
  displayMode: PropTypes.oneOf(['block', 'block-on-focus']),
18
18
  latex: PropTypes.string,
19
- onChange: PropTypes.func
19
+ onChange: PropTypes.func,
20
20
  };
21
21
 
22
22
  static defaultProps = {
23
23
  keyset: [],
24
- displayMode: 'block'
24
+ displayMode: 'block',
25
25
  };
26
26
 
27
27
  constructor(props) {
28
28
  super(props);
29
29
  this.state = {
30
- focused: false
30
+ focused: false,
31
31
  };
32
32
  }
33
33
 
34
- keypadPress = key => {
34
+ keypadPress = (key) => {
35
35
  log('[keypadPress] key:', key);
36
36
 
37
37
  if (!this.input) {
@@ -57,7 +57,7 @@ export class MathInput extends React.Component {
57
57
  this.setState({ focused: false });
58
58
  };
59
59
 
60
- changeLatex = l => {
60
+ changeLatex = (l) => {
61
61
  const { onChange } = this.props;
62
62
 
63
63
  if (onChange && l !== this.props.latex) {
@@ -76,7 +76,7 @@ export class MathInput extends React.Component {
76
76
  <div className={classNames(classes.mathInput, className, focused && classes.focused)}>
77
77
  <mq.Input
78
78
  className={classes.mqInput}
79
- innerRef={r => (this.input = r)}
79
+ innerRef={(r) => (this.input = r)}
80
80
  onFocus={this.inputFocus}
81
81
  onBlur={this.inputBlur}
82
82
  latex={latex}
@@ -93,25 +93,25 @@ export class MathInput extends React.Component {
93
93
  }
94
94
 
95
95
  const grey = 'rgba(0, 0, 0, 0.23)';
96
- const styles = theme => ({
96
+ const styles = (theme) => ({
97
97
  formGroup: {
98
98
  display: 'flex',
99
99
  textAlign: 'right',
100
- float: 'right'
100
+ float: 'right',
101
101
  },
102
102
  pad: {
103
103
  width: '100%',
104
- display: 'flex'
104
+ display: 'flex',
105
105
  },
106
106
  mathInput: {
107
107
  borderRadius: '4px',
108
108
  border: `solid 1px ${grey}`,
109
109
  marginTop: theme.spacing.unit,
110
110
  marginBottom: theme.spacing.unit,
111
- transition: 'border 200ms linear'
111
+ transition: 'border 200ms linear',
112
112
  },
113
113
  focused: {
114
- border: `solid 1px ${theme.palette.primary.main}`
114
+ border: `solid 1px ${theme.palette.primary.main}`,
115
115
  },
116
116
  mqInput: {
117
117
  width: '100%',
@@ -121,8 +121,8 @@ const styles = theme => ({
121
121
  '&.mq-focused': {
122
122
  outline: 'none',
123
123
  boxShadow: 'none',
124
- border: `solid 0px ${theme.palette.primary.dark}`
125
- }
126
- }
124
+ border: `solid 0px ${theme.palette.primary.dark}`,
125
+ },
126
+ },
127
127
  });
128
128
  export default withStyles(styles)(MathInput);
@@ -3,7 +3,7 @@ const registerLineBreak = function(MQ) {
3
3
  return {
4
4
  htmlString: '<div class="newLine"></div>',
5
5
  text: () => 'testText',
6
- latex: () => '\\embed{newLine}[]'
6
+ latex: () => '\\embed{newLine}[]',
7
7
  };
8
8
  });
9
9
  };
package/src/mq/input.jsx CHANGED
@@ -28,7 +28,7 @@ export class Input extends React.Component {
28
28
  onChange: PropTypes.func,
29
29
  latex: PropTypes.string,
30
30
  onFocus: PropTypes.func,
31
- onBlur: PropTypes.func
31
+ onBlur: PropTypes.func,
32
32
  };
33
33
 
34
34
  componentDidMount() {
@@ -38,8 +38,8 @@ export class Input extends React.Component {
38
38
 
39
39
  this.mathField = MQ.MathField(this.input, {
40
40
  handlers: {
41
- edit: this.onInputEdit.bind(this)
42
- }
41
+ edit: this.onInputEdit.bind(this),
42
+ },
43
43
  });
44
44
 
45
45
  this.updateLatex();
@@ -77,7 +77,7 @@ export class Input extends React.Component {
77
77
  command(v) {
78
78
  log('command: ', v);
79
79
  if (Array.isArray(v)) {
80
- v.forEach(vv => {
80
+ v.forEach((vv) => {
81
81
  this.mathField.cmd(vv);
82
82
  });
83
83
  } else {
@@ -117,7 +117,7 @@ export class Input extends React.Component {
117
117
  this.focus();
118
118
  };
119
119
 
120
- onKeyPress = event => {
120
+ onKeyPress = (event) => {
121
121
  const keys = Object.keys(this.mathField.__controller.options);
122
122
 
123
123
  if (keys.indexOf('ignoreNextMousedown') < 0) {
@@ -152,7 +152,7 @@ export class Input extends React.Component {
152
152
  onClick={onClick}
153
153
  onFocus={onFocus}
154
154
  onBlur={onBlur}
155
- ref={r => (this.input = r)}
155
+ ref={(r) => (this.input = r)}
156
156
  />
157
157
  );
158
158
  }
package/src/mq/static.jsx CHANGED
@@ -29,7 +29,7 @@ export default class Static extends React.Component {
29
29
  getFieldName: PropTypes.func,
30
30
  onSubFieldChange: PropTypes.func,
31
31
  onSubFieldFocus: PropTypes.func,
32
- setInput: PropTypes.func
32
+ setInput: PropTypes.func,
33
33
  };
34
34
 
35
35
  componentDidMount() {
@@ -55,7 +55,7 @@ export default class Static extends React.Component {
55
55
  if (this.input && regexMatch && regexMatch?.length) {
56
56
  try {
57
57
  field.__controller.cursor.insLeftOf(field.__controller.cursor.parent[-1].parent);
58
- field.el().dispatchEvent(new KeyboardEvent("keydown", { keyCode: 8 }));
58
+ field.el().dispatchEvent(new KeyboardEvent('keydown', { keyCode: 8 }));
59
59
  } catch (e) {
60
60
  console.error(e.toString());
61
61
  }
@@ -73,8 +73,8 @@ export default class Static extends React.Component {
73
73
  if (!this.mathField) {
74
74
  this.mathField = MQ.StaticMath(this.input, {
75
75
  handlers: {
76
- edit: this.onInputEdit.bind(this)
77
- }
76
+ edit: this.onInputEdit.bind(this),
77
+ },
78
78
  });
79
79
  }
80
80
 
@@ -118,7 +118,7 @@ export default class Static extends React.Component {
118
118
  }
119
119
  }
120
120
 
121
- onFocus = e => {
121
+ onFocus = (e) => {
122
122
  try {
123
123
  let rootBlock = e.target.parentElement.nextSibling;
124
124
  let id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
@@ -128,7 +128,7 @@ export default class Static extends React.Component {
128
128
  id = parseInt(rootBlock.getAttribute('mathquill-block-id'), 10);
129
129
  }
130
130
 
131
- const innerField = this.mathField.innerFields.find(f => f.id === id);
131
+ const innerField = this.mathField.innerFields.find((f) => f.id === id);
132
132
 
133
133
  if (innerField) {
134
134
  const name = this.props.getFieldName(innerField, this.mathField.innerFields);
@@ -146,13 +146,6 @@ export default class Static extends React.Component {
146
146
  render() {
147
147
  const { onBlur, className } = this.props;
148
148
 
149
- return (
150
- <span
151
- className={className}
152
- onFocus={this.onFocus}
153
- onBlur={onBlur}
154
- ref={r => (this.input = r)}
155
- />
156
- );
149
+ return <span className={className} onFocus={this.onFocus} onBlur={onBlur} ref={(r) => (this.input = r)} />;
157
150
  }
158
151
  }