dash-core-components 4.2.0 → 4.4.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 (47) hide show
  1. package/dash_core_components/async-datepicker.js +1 -1
  2. package/dash_core_components/async-datepicker.js.map +1 -1
  3. package/dash_core_components/async-dropdown.js +1 -1
  4. package/dash_core_components/async-dropdown.js.map +1 -1
  5. package/dash_core_components/async-graph.js +1 -1
  6. package/dash_core_components/async-graph.js.map +1 -1
  7. package/dash_core_components/async-highlight.js +1 -1
  8. package/dash_core_components/async-highlight.js.map +1 -1
  9. package/dash_core_components/async-markdown.js +1 -1
  10. package/dash_core_components/async-markdown.js.map +1 -1
  11. package/dash_core_components/async-slider.js +1 -1
  12. package/dash_core_components/async-slider.js.map +1 -1
  13. package/dash_core_components/async-upload.js +1 -1
  14. package/dash_core_components/async-upload.js.map +1 -1
  15. package/dash_core_components/dash_core_components-shared.js +1 -1
  16. package/dash_core_components/dash_core_components-shared.js.map +1 -1
  17. package/dash_core_components/dash_core_components.js +1 -1
  18. package/dash_core_components/dash_core_components.js.map +1 -1
  19. package/lib/components/Clipboard.react.js +220 -173
  20. package/lib/components/ConfirmDialog.react.js +62 -34
  21. package/lib/components/ConfirmDialogProvider.react.js +45 -21
  22. package/lib/components/Download.react.js +46 -22
  23. package/lib/components/Geolocation.react.js +92 -64
  24. package/lib/components/Graph.react.js +99 -71
  25. package/lib/components/Interval.react.js +88 -56
  26. package/lib/components/Link.react.js +6 -5
  27. package/lib/components/Location.react.js +127 -97
  28. package/lib/components/Markdown.react.js +37 -16
  29. package/lib/components/Store.react.js +177 -128
  30. package/lib/components/Upload.react.js +28 -8
  31. package/lib/fragments/DatePickerRange.tsx +11 -9
  32. package/lib/fragments/Dropdown.tsx +1 -1
  33. package/lib/fragments/Graph.privateprops.js +9 -3
  34. package/lib/fragments/Graph.react.js +426 -339
  35. package/lib/fragments/Markdown.react.js +160 -120
  36. package/lib/fragments/Math.react.js +49 -24
  37. package/lib/fragments/Upload.react.js +341 -302
  38. package/lib/utils/LazyLoader/graph.js +3 -2
  39. package/lib/utils/LazyLoader/hljs.js +5 -2
  40. package/lib/utils/LazyLoader/markdown.js +3 -2
  41. package/lib/utils/LazyLoader/mathjax.js +5 -2
  42. package/lib/utils/LazyLoader/plotly.js +6 -7
  43. package/lib/utils/LazyLoader/upload.js +3 -2
  44. package/lib/utils/LoadingElement.js +3 -2
  45. package/lib/utils/MarkdownHighlighter.js +6 -5
  46. package/lib/utils/ResizeDetector.js +14 -9
  47. package/package.json +16 -15
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -15,141 +16,180 @@ var _Markdown = require("../components/Markdown.react");
15
16
  var _Link = _interopRequireDefault(require("./../components/Link.react"));
16
17
  var _LoadingElement = _interopRequireDefault(require("../utils/LoadingElement"));
17
18
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
18
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
19
20
  function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t.return || t.return(); } finally { if (u) throw o; } } }; }
20
21
  function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
21
22
  function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
22
- class DashMarkdown extends _react.Component {
23
- constructor(props) {
24
- super(props);
23
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
24
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
25
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
26
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
27
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
28
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
29
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
30
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
31
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
32
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
33
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
34
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
35
+ var DashMarkdown = exports.default = /*#__PURE__*/function (_Component) {
36
+ function DashMarkdown(props) {
37
+ var _this;
38
+ _classCallCheck(this, DashMarkdown);
39
+ _this = _callSuper(this, DashMarkdown, [props]);
25
40
  if (_MarkdownHighlighter.default.isReady !== true) {
26
- _MarkdownHighlighter.default.isReady.then(() => {
27
- this.setState({});
41
+ _MarkdownHighlighter.default.isReady.then(function () {
42
+ _this.setState({});
28
43
  });
29
44
  }
30
- this.highlightCode = this.highlightCode.bind(this);
31
- this.dedent = this.dedent.bind(this);
45
+ _this.highlightCode = _this.highlightCode.bind(_this);
46
+ _this.dedent = _this.dedent.bind(_this);
47
+ return _this;
32
48
  }
33
- componentDidMount() {
34
- this.highlightCode();
35
- }
36
- componentDidUpdate() {
37
- this.highlightCode();
38
- }
39
- highlightCode() {
40
- var isHighlighted = node => {
41
- // a highlighted node will have <span> children which are what color the text
42
- return node.children.length > 0;
43
- };
44
- if (this.mdContainer) {
45
- var nodes = this.mdContainer.querySelectorAll('pre code');
46
- if (_MarkdownHighlighter.default.hljs) {
47
- for (var i = 0; i < nodes.length; i++) {
48
- if (!isHighlighted(nodes[i])) {
49
- nodes[i].removeAttribute('data-highlighted');
50
- _MarkdownHighlighter.default.hljs.highlightElement(nodes[i]);
49
+ _inherits(DashMarkdown, _Component);
50
+ return _createClass(DashMarkdown, [{
51
+ key: "componentDidMount",
52
+ value: function componentDidMount() {
53
+ this.highlightCode();
54
+ }
55
+ }, {
56
+ key: "componentDidUpdate",
57
+ value: function componentDidUpdate() {
58
+ this.highlightCode();
59
+ }
60
+ }, {
61
+ key: "highlightCode",
62
+ value: function highlightCode() {
63
+ var isHighlighted = function isHighlighted(node) {
64
+ // a highlighted node will have <span> children which are what color the text
65
+ return node.children.length > 0;
66
+ };
67
+ if (this.mdContainer) {
68
+ var nodes = this.mdContainer.querySelectorAll('pre code');
69
+ if (_MarkdownHighlighter.default.hljs) {
70
+ for (var i = 0; i < nodes.length; i++) {
71
+ if (!isHighlighted(nodes[i])) {
72
+ nodes[i].removeAttribute('data-highlighted');
73
+ _MarkdownHighlighter.default.hljs.highlightElement(nodes[i]);
74
+ }
51
75
  }
76
+ } else {
77
+ _MarkdownHighlighter.default.loadhljs();
52
78
  }
53
- } else {
54
- _MarkdownHighlighter.default.loadhljs();
55
79
  }
56
80
  }
57
- }
58
- dedent(text) {
59
- var lines = text.split(/\r\n|\r|\n/);
60
- var commonPrefix = null;
61
- var _iterator = _createForOfIteratorHelper(lines),
62
- _step;
63
- try {
64
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
65
- var line = _step.value;
66
- var preMatch = line && line.match(/^\s*(?=\S)/);
67
- if (preMatch) {
68
- var prefix = preMatch[0];
69
- if (commonPrefix !== null) {
70
- for (var i = 0; i < commonPrefix.length; i++) {
71
- // Like Python's textwrap.dedent, we'll remove both
72
- // space and tab characters, but only if they match
73
- if (prefix[i] !== commonPrefix[i]) {
74
- commonPrefix = commonPrefix.substr(0, i);
75
- break;
81
+ }, {
82
+ key: "dedent",
83
+ value: function dedent(text) {
84
+ var lines = text.split(/\r\n|\r|\n/);
85
+ var commonPrefix = null;
86
+ var _iterator = _createForOfIteratorHelper(lines),
87
+ _step;
88
+ try {
89
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
90
+ var line = _step.value;
91
+ var preMatch = line && line.match(/^\s*(?=\S)/);
92
+ if (preMatch) {
93
+ var prefix = preMatch[0];
94
+ if (commonPrefix !== null) {
95
+ for (var i = 0; i < commonPrefix.length; i++) {
96
+ // Like Python's textwrap.dedent, we'll remove both
97
+ // space and tab characters, but only if they match
98
+ if (prefix[i] !== commonPrefix[i]) {
99
+ commonPrefix = commonPrefix.substr(0, i);
100
+ break;
101
+ }
76
102
  }
103
+ } else {
104
+ commonPrefix = prefix;
105
+ }
106
+ if (!commonPrefix) {
107
+ break;
77
108
  }
78
- } else {
79
- commonPrefix = prefix;
80
- }
81
- if (!commonPrefix) {
82
- break;
83
109
  }
84
110
  }
111
+ } catch (err) {
112
+ _iterator.e(err);
113
+ } finally {
114
+ _iterator.f();
85
115
  }
86
- } catch (err) {
87
- _iterator.e(err);
88
- } finally {
89
- _iterator.f();
116
+ var commonLen = commonPrefix ? commonPrefix.length : 0;
117
+ return lines.map(function (line) {
118
+ return line.match(/\S/) ? line.substr(commonLen) : '';
119
+ }).join('\n');
90
120
  }
91
- var commonLen = commonPrefix ? commonPrefix.length : 0;
92
- return lines.map(line => {
93
- return line.match(/\S/) ? line.substr(commonLen) : '';
94
- }).join('\n');
95
- }
96
- render() {
97
- var _this$props = this.props,
98
- id = _this$props.id,
99
- style = _this$props.style,
100
- className = _this$props.className,
101
- highlight_config = _this$props.highlight_config,
102
- dangerously_allow_html = _this$props.dangerously_allow_html,
103
- link_target = _this$props.link_target,
104
- mathjax = _this$props.mathjax,
105
- children = _this$props.children,
106
- dedent = _this$props.dedent;
107
- var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
108
- var displayText = dedent && textProp ? this.dedent(textProp) : textProp;
109
- var componentTransforms = {
110
- dccLink: props => /*#__PURE__*/_react.default.createElement(_Link.default, props),
111
- dccMarkdown: props => /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, (0, _ramda.mergeDeepRight)((0, _ramda.pick)(['dangerously_allow_html', 'dedent'], this.props), (0, _ramda.pick)(['children'], props))),
112
- dashMathjax: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
113
- tex: props.value,
114
- inline: props.inline
115
- })
116
- };
117
- var regexMath = value => {
118
- var newValue = value.replace(/(\${1,2})((?:\\.|[^$])+)\1/g, function (m, tag, src) {
119
- var inline = tag.length === 1 || src.indexOf('\n') === -1;
120
- return "<dashMathjax value='".concat(src, "' inline='").concat(inline, "'/>");
121
- });
122
- return newValue;
123
- };
124
- return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
125
- id: id,
126
- ref: node => {
127
- this.mdContainer = node;
128
- },
129
- style: style,
130
- className: (highlight_config && highlight_config.theme || className) && "".concat(className ? className : '', " ").concat(highlight_config && highlight_config.theme && highlight_config.theme === 'dark' ? 'hljs-dark' : '')
131
- }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
132
- source: displayText,
133
- escapeHtml: !dangerously_allow_html,
134
- linkTarget: link_target,
135
- plugins: mathjax ? [_remarkMath.default] : [],
136
- renderers: {
137
- math: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
138
- tex: props.value,
139
- inline: false
140
- }),
141
- inlineMath: props => /*#__PURE__*/_react.default.createElement(_Math.default, {
142
- tex: props.value,
143
- inline: true
144
- }),
145
- html: props => props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
146
- jsx: mathjax ? regexMath(props.value) : props.value,
147
- components: componentTransforms,
148
- renderInWrapper: false
149
- })
150
- }
151
- }));
152
- }
153
- }
154
- exports.default = DashMarkdown;
121
+ }, {
122
+ key: "render",
123
+ value: function render() {
124
+ var _this2 = this;
125
+ var _this$props = this.props,
126
+ id = _this$props.id,
127
+ style = _this$props.style,
128
+ className = _this$props.className,
129
+ highlight_config = _this$props.highlight_config,
130
+ dangerously_allow_html = _this$props.dangerously_allow_html,
131
+ link_target = _this$props.link_target,
132
+ mathjax = _this$props.mathjax,
133
+ children = _this$props.children,
134
+ dedent = _this$props.dedent;
135
+ var textProp = (0, _ramda.type)(children) === 'Array' ? children.join('\n') : children;
136
+ var displayText = dedent && textProp ? this.dedent(textProp) : textProp;
137
+ var componentTransforms = {
138
+ dccLink: function dccLink(props) {
139
+ return /*#__PURE__*/_react.default.createElement(_Link.default, props);
140
+ },
141
+ dccMarkdown: function dccMarkdown(props) {
142
+ return /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, (0, _ramda.mergeDeepRight)((0, _ramda.pick)(['dangerously_allow_html', 'dedent'], _this2.props), (0, _ramda.pick)(['children'], props)));
143
+ },
144
+ dashMathjax: function dashMathjax(props) {
145
+ return /*#__PURE__*/_react.default.createElement(_Math.default, {
146
+ tex: props.value,
147
+ inline: props.inline
148
+ });
149
+ }
150
+ };
151
+ var regexMath = function regexMath(value) {
152
+ var newValue = value.replace(/(\${1,2})((?:\\.|[^$])+)\1/g, function (m, tag, src) {
153
+ var inline = tag.length === 1 || src.indexOf('\n') === -1;
154
+ return "<dashMathjax value='".concat(src, "' inline='").concat(inline, "'/>");
155
+ });
156
+ return newValue;
157
+ };
158
+ return /*#__PURE__*/_react.default.createElement(_LoadingElement.default, {
159
+ id: id,
160
+ ref: function ref(node) {
161
+ _this2.mdContainer = node;
162
+ },
163
+ style: style,
164
+ className: (highlight_config && highlight_config.theme || className) && "".concat(className ? className : '', " ").concat(highlight_config && highlight_config.theme && highlight_config.theme === 'dark' ? 'hljs-dark' : '')
165
+ }, /*#__PURE__*/_react.default.createElement(_reactMarkdown.default, {
166
+ source: displayText,
167
+ escapeHtml: !dangerously_allow_html,
168
+ linkTarget: link_target,
169
+ plugins: mathjax ? [_remarkMath.default] : [],
170
+ renderers: {
171
+ math: function math(props) {
172
+ return /*#__PURE__*/_react.default.createElement(_Math.default, {
173
+ tex: props.value,
174
+ inline: false
175
+ });
176
+ },
177
+ inlineMath: function inlineMath(props) {
178
+ return /*#__PURE__*/_react.default.createElement(_Math.default, {
179
+ tex: props.value,
180
+ inline: true
181
+ });
182
+ },
183
+ html: function html(props) {
184
+ return props.escapeHtml ? props.value : /*#__PURE__*/_react.default.createElement(_reactJsxParser.default, {
185
+ jsx: mathjax ? regexMath(props.value) : props.value,
186
+ components: componentTransforms,
187
+ renderInWrapper: false
188
+ });
189
+ }
190
+ }
191
+ }));
192
+ }
193
+ }]);
194
+ }(_react.Component);
155
195
  DashMarkdown.propTypes = _Markdown.propTypes;
@@ -1,5 +1,6 @@
1
1
  "use strict";
2
2
 
3
+ function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
3
4
  Object.defineProperty(exports, "__esModule", {
4
5
  value: true
5
6
  });
@@ -7,34 +8,58 @@ exports.propTypes = exports.defaultProps = exports.default = void 0;
7
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
8
9
  var _react = _interopRequireWildcard(require("react"));
9
10
  var _mathjax = _interopRequireDefault(require("../utils/LazyLoader/mathjax"));
10
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
11
12
  function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- class DashMath extends _react.Component {
13
- constructor(props) {
14
- super(props);
15
- this.span_element = /*#__PURE__*/_react.default.createRef();
13
+ function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
14
+ function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
15
+ function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
16
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
17
+ function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
18
+ function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
19
+ function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
20
+ function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
21
+ function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
22
+ function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
23
+ function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
24
+ function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
25
+ var DashMath = exports.default = /*#__PURE__*/function (_Component) {
26
+ function DashMath(props) {
27
+ var _this;
28
+ _classCallCheck(this, DashMath);
29
+ _this = _callSuper(this, DashMath, [props]);
30
+ _this.span_element = /*#__PURE__*/_react.default.createRef();
31
+ return _this;
16
32
  }
17
- componentDidMount() {
18
- this.renderMath();
19
- }
20
- componentDidUpdate(prevProps) {
21
- if (prevProps.tex !== this.props.tex || prevProps.inline !== this.props.inline) {
33
+ _inherits(DashMath, _Component);
34
+ return _createClass(DashMath, [{
35
+ key: "componentDidMount",
36
+ value: function componentDidMount() {
22
37
  this.renderMath();
23
38
  }
24
- }
25
- renderMath() {
26
- var current = this.span_element.current;
27
- (0, _mathjax.default)().then(function () {
28
- window.MathJax.typeset([current]);
29
- });
30
- }
31
- render() {
32
- return /*#__PURE__*/_react.default.createElement("span", {
33
- ref: this.span_element
34
- }, this.props.inline ? '\\(' : '\\[', this.props.tex, this.props.inline ? '\\)' : '\\]');
35
- }
36
- }
37
- exports.default = DashMath;
39
+ }, {
40
+ key: "componentDidUpdate",
41
+ value: function componentDidUpdate(prevProps) {
42
+ if (prevProps.tex !== this.props.tex || prevProps.inline !== this.props.inline) {
43
+ this.renderMath();
44
+ }
45
+ }
46
+ }, {
47
+ key: "renderMath",
48
+ value: function renderMath() {
49
+ var current = this.span_element.current;
50
+ (0, _mathjax.default)().then(function () {
51
+ window.MathJax.typeset([current]);
52
+ });
53
+ }
54
+ }, {
55
+ key: "render",
56
+ value: function render() {
57
+ return /*#__PURE__*/_react.default.createElement("span", {
58
+ ref: this.span_element
59
+ }, this.props.inline ? '\\(' : '\\[', this.props.tex, this.props.inline ? '\\)' : '\\]');
60
+ }
61
+ }]);
62
+ }(_react.Component);
38
63
  DashMath.propTypes = {
39
64
  tex: _propTypes.default.string,
40
65
  inline: _propTypes.default.bool