@pie-lib/graphing-solution-set 2.17.0 → 2.19.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.
- package/CHANGELOG.md +24 -52
- package/package.json +9 -8
- package/src/axis/axes.jsx +1 -1
- package/src/coordinates-label.jsx +1 -1
- package/src/graph-with-controls.jsx +1 -1
- package/src/grid-setup.jsx +1 -1
- package/src/labels.jsx +1 -1
- package/src/mark-label.jsx +1 -1
- package/src/toggle-bar.jsx +1 -1
- package/src/tools/polygon/line.jsx +1 -1
- package/src/tools/polygon/polygon.jsx +1 -1
- package/src/tools/shared/arrow-head.jsx +1 -1
- package/src/tools/shared/line/index.jsx +1 -1
- package/src/tools/shared/line/line-path.jsx +1 -1
- package/src/tools/shared/point/base-point.jsx +1 -1
- package/src/tools/shared/point/index.jsx +1 -1
- package/src/tools/shared/styles.js +1 -1
- package/src/undo-redo.jsx +1 -1
- package/lib/axis/arrow.js +0 -115
- package/lib/axis/arrow.js.map +0 -1
- package/lib/axis/axes.js +0 -415
- package/lib/axis/axes.js.map +0 -1
- package/lib/axis/index.js +0 -26
- package/lib/axis/index.js.map +0 -1
- package/lib/bg.js +0 -139
- package/lib/bg.js.map +0 -1
- package/lib/container/actions.js +0 -24
- package/lib/container/actions.js.map +0 -1
- package/lib/container/index.js +0 -166
- package/lib/container/index.js.map +0 -1
- package/lib/container/marks.js +0 -27
- package/lib/container/marks.js.map +0 -1
- package/lib/container/middleware.js +0 -25
- package/lib/container/middleware.js.map +0 -1
- package/lib/container/reducer.js +0 -25
- package/lib/container/reducer.js.map +0 -1
- package/lib/coordinates-label.js +0 -109
- package/lib/coordinates-label.js.map +0 -1
- package/lib/graph-with-controls.js +0 -372
- package/lib/graph-with-controls.js.map +0 -1
- package/lib/graph.js +0 -419
- package/lib/graph.js.map +0 -1
- package/lib/grid-setup.js +0 -462
- package/lib/grid-setup.js.map +0 -1
- package/lib/grid.js +0 -176
- package/lib/grid.js.map +0 -1
- package/lib/index.js +0 -51
- package/lib/index.js.map +0 -1
- package/lib/labels.js +0 -299
- package/lib/labels.js.map +0 -1
- package/lib/mark-label.js +0 -208
- package/lib/mark-label.js.map +0 -1
- package/lib/shared/index.js +0 -136
- package/lib/toggle-bar.js +0 -336
- package/lib/toggle-bar.js.map +0 -1
- package/lib/tool-menu.js +0 -325
- package/lib/tool-menu.js.map +0 -1
- package/lib/tools/index.js +0 -29
- package/lib/tools/index.js.map +0 -1
- package/lib/tools/line/component.js +0 -106
- package/lib/tools/line/component.js.map +0 -1
- package/lib/tools/line/index.js +0 -16
- package/lib/tools/line/index.js.map +0 -1
- package/lib/tools/polygon/component.js +0 -457
- package/lib/tools/polygon/component.js.map +0 -1
- package/lib/tools/polygon/index.js +0 -106
- package/lib/tools/polygon/index.js.map +0 -1
- package/lib/tools/polygon/line.js +0 -151
- package/lib/tools/polygon/line.js.map +0 -1
- package/lib/tools/polygon/polygon.js +0 -171
- package/lib/tools/polygon/polygon.js.map +0 -1
- package/lib/tools/shared/arrow-head.js +0 -75
- package/lib/tools/shared/arrow-head.js.map +0 -1
- package/lib/tools/shared/line/index.js +0 -637
- package/lib/tools/shared/line/index.js.map +0 -1
- package/lib/tools/shared/line/line-path.js +0 -145
- package/lib/tools/shared/line/line-path.js.map +0 -1
- package/lib/tools/shared/line/with-root-edge.js +0 -155
- package/lib/tools/shared/line/with-root-edge.js.map +0 -1
- package/lib/tools/shared/point/arrow-point.js +0 -113
- package/lib/tools/shared/point/arrow-point.js.map +0 -1
- package/lib/tools/shared/point/arrow.js +0 -96
- package/lib/tools/shared/point/arrow.js.map +0 -1
- package/lib/tools/shared/point/base-point.js +0 -151
- package/lib/tools/shared/point/base-point.js.map +0 -1
- package/lib/tools/shared/point/index.js +0 -94
- package/lib/tools/shared/point/index.js.map +0 -1
- package/lib/tools/shared/styles.js +0 -49
- package/lib/tools/shared/styles.js.map +0 -1
- package/lib/tools/shared/types.js +0 -19
- package/lib/tools/shared/types.js.map +0 -1
- package/lib/undo-redo.js +0 -107
- package/lib/undo-redo.js.map +0 -1
- package/lib/use-debounce.js +0 -32
- package/lib/use-debounce.js.map +0 -1
- package/lib/utils.js +0 -314
- package/lib/utils.js.map +0 -1
package/lib/mark-label.js
DELETED
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
exports.position = exports["default"] = exports.coordinates = exports.MarkLabel = void 0;
|
|
11
|
-
|
|
12
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
13
|
-
|
|
14
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
15
|
-
|
|
16
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
17
|
-
|
|
18
|
-
var _classnames = _interopRequireDefault(require("classnames"));
|
|
19
|
-
|
|
20
|
-
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
21
|
-
|
|
22
|
-
var _styles = require("@material-ui/core/styles");
|
|
23
|
-
|
|
24
|
-
var _reactInputAutosize = _interopRequireDefault(require("react-input-autosize"));
|
|
25
|
-
|
|
26
|
-
var _useDebounce = require("./use-debounce");
|
|
27
|
-
|
|
28
|
-
var _plot = require("@pie-lib/plot");
|
|
29
|
-
|
|
30
|
-
var _index = require("./shared/index");
|
|
31
|
-
|
|
32
|
-
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); }
|
|
33
|
-
|
|
34
|
-
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; }
|
|
35
|
-
|
|
36
|
-
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; }
|
|
37
|
-
|
|
38
|
-
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) { (0, _defineProperty2["default"])(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; }
|
|
39
|
-
|
|
40
|
-
var styles = function styles(theme) {
|
|
41
|
-
return {
|
|
42
|
-
input: {
|
|
43
|
-
"float": 'right',
|
|
44
|
-
padding: theme.spacing.unit * 0.5,
|
|
45
|
-
fontFamily: theme.typography.fontFamily,
|
|
46
|
-
fontSize: theme.typography.fontSize,
|
|
47
|
-
border: "solid 1px ".concat(_index.color.defaults.SECONDARY),
|
|
48
|
-
borderRadius: '3px',
|
|
49
|
-
color: _index.color.defaults.PRIMARY_DARK
|
|
50
|
-
},
|
|
51
|
-
disabled: {
|
|
52
|
-
border: "solid 1px ".concat(_index.color.defaults.PRIMARY_DARK),
|
|
53
|
-
background: theme.palette.background.paper
|
|
54
|
-
},
|
|
55
|
-
disabledMark: {
|
|
56
|
-
border: "solid 1px ".concat(_index.color.disabled()),
|
|
57
|
-
background: theme.palette.background.paper,
|
|
58
|
-
color: _index.color.disabled()
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
var position = function position(graphProps, mark, rect) {
|
|
64
|
-
rect = rect || {
|
|
65
|
-
width: 0,
|
|
66
|
-
height: 0
|
|
67
|
-
};
|
|
68
|
-
var scale = graphProps.scale,
|
|
69
|
-
domain = graphProps.domain,
|
|
70
|
-
range = graphProps.range;
|
|
71
|
-
var shift = 10;
|
|
72
|
-
var rightEdge = scale.x(mark.x) + rect.width + shift;
|
|
73
|
-
var bottomEdge = scale.y(mark.y) + rect.height + shift;
|
|
74
|
-
var h = rightEdge >= scale.x(domain.max) ? 'left' : 'right';
|
|
75
|
-
var v = bottomEdge >= scale.y(range.min) ? 'top' : 'bottom';
|
|
76
|
-
return "".concat(v, "-").concat(h);
|
|
77
|
-
};
|
|
78
|
-
|
|
79
|
-
exports.position = position;
|
|
80
|
-
|
|
81
|
-
var coordinates = function coordinates(graphProps, mark, rect, position) {
|
|
82
|
-
var scale = graphProps.scale;
|
|
83
|
-
var shift = 10;
|
|
84
|
-
rect = rect || {
|
|
85
|
-
width: 0,
|
|
86
|
-
height: 0
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
switch (position) {
|
|
90
|
-
case 'bottom-right':
|
|
91
|
-
{
|
|
92
|
-
return {
|
|
93
|
-
left: scale.x(mark.x) + shift,
|
|
94
|
-
top: scale.y(mark.y) + shift
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
case 'bottom-left':
|
|
99
|
-
{
|
|
100
|
-
return {
|
|
101
|
-
left: scale.x(mark.x) - shift - rect.width,
|
|
102
|
-
top: scale.y(mark.y) + shift
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
case 'top-left':
|
|
107
|
-
{
|
|
108
|
-
return {
|
|
109
|
-
left: scale.x(mark.x) - shift - rect.width,
|
|
110
|
-
top: scale.y(mark.y) - shift - rect.height
|
|
111
|
-
};
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
case 'top-right':
|
|
115
|
-
{
|
|
116
|
-
return {
|
|
117
|
-
left: scale.x(mark.x) + shift,
|
|
118
|
-
top: scale.y(mark.y) - shift - rect.height
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
exports.coordinates = coordinates;
|
|
125
|
-
|
|
126
|
-
var MarkLabel = function MarkLabel(props) {
|
|
127
|
-
var _cn;
|
|
128
|
-
|
|
129
|
-
var _useState = (0, _react.useState)(null),
|
|
130
|
-
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
131
|
-
input = _useState2[0],
|
|
132
|
-
setInput = _useState2[1];
|
|
133
|
-
|
|
134
|
-
var _ref = (0, _react.useCallback)(function (node) {
|
|
135
|
-
return setInput(node);
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
var mark = props.mark,
|
|
139
|
-
graphProps = props.graphProps,
|
|
140
|
-
classes = props.classes,
|
|
141
|
-
disabled = props.disabled,
|
|
142
|
-
externalInputRef = props.inputRef,
|
|
143
|
-
theme = props.theme;
|
|
144
|
-
|
|
145
|
-
var _useState3 = (0, _react.useState)(mark.label),
|
|
146
|
-
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
147
|
-
label = _useState4[0],
|
|
148
|
-
setLabel = _useState4[1];
|
|
149
|
-
|
|
150
|
-
var onChange = function onChange(e) {
|
|
151
|
-
return setLabel(e.target.value);
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
var debouncedLabel = (0, _useDebounce.useDebounce)(label, 200); // useState only sets the value once, to synch props to state need useEffect
|
|
155
|
-
|
|
156
|
-
(0, _react.useEffect)(function () {
|
|
157
|
-
setLabel(mark.label);
|
|
158
|
-
}, [mark.label]); // pick up the change to debouncedLabel and save it
|
|
159
|
-
|
|
160
|
-
(0, _react.useEffect)(function () {
|
|
161
|
-
if (typeof debouncedLabel === 'string' && debouncedLabel !== mark.label) {
|
|
162
|
-
props.onChange(debouncedLabel);
|
|
163
|
-
}
|
|
164
|
-
}, [debouncedLabel]);
|
|
165
|
-
var rect = input ? input.getBoundingClientRect() : {
|
|
166
|
-
width: 0,
|
|
167
|
-
height: 0
|
|
168
|
-
};
|
|
169
|
-
var pos = position(graphProps, mark, rect);
|
|
170
|
-
var leftTop = coordinates(graphProps, mark, rect, pos);
|
|
171
|
-
|
|
172
|
-
var style = _objectSpread({
|
|
173
|
-
position: 'fixed',
|
|
174
|
-
pointerEvents: 'auto'
|
|
175
|
-
}, leftTop);
|
|
176
|
-
|
|
177
|
-
var disabledInput = disabled || mark.disabled;
|
|
178
|
-
return /*#__PURE__*/_react["default"].createElement(_reactInputAutosize["default"], {
|
|
179
|
-
inputRef: function inputRef(r) {
|
|
180
|
-
_ref(r);
|
|
181
|
-
|
|
182
|
-
externalInputRef(r);
|
|
183
|
-
},
|
|
184
|
-
disabled: disabledInput,
|
|
185
|
-
inputClassName: (0, _classnames["default"])(classes.input, (_cn = {}, (0, _defineProperty2["default"])(_cn, classes.disabled, disabled), (0, _defineProperty2["default"])(_cn, classes.disabledMark, mark.disabled), _cn)),
|
|
186
|
-
value: label,
|
|
187
|
-
style: style,
|
|
188
|
-
onChange: onChange
|
|
189
|
-
});
|
|
190
|
-
};
|
|
191
|
-
|
|
192
|
-
exports.MarkLabel = MarkLabel;
|
|
193
|
-
MarkLabel.propTypes = {
|
|
194
|
-
disabled: _propTypes["default"].bool,
|
|
195
|
-
onChange: _propTypes["default"].func,
|
|
196
|
-
graphProps: _plot.types.GraphPropsType,
|
|
197
|
-
classes: _propTypes["default"].object,
|
|
198
|
-
inputRef: _propTypes["default"].func,
|
|
199
|
-
mark: _propTypes["default"].object,
|
|
200
|
-
theme: _propTypes["default"].object
|
|
201
|
-
};
|
|
202
|
-
|
|
203
|
-
var _default = (0, _styles.withStyles)(styles, {
|
|
204
|
-
withTheme: true
|
|
205
|
-
})(MarkLabel);
|
|
206
|
-
|
|
207
|
-
exports["default"] = _default;
|
|
208
|
-
//# sourceMappingURL=mark-label.js.map
|
package/lib/mark-label.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/mark-label.jsx"],"names":["styles","theme","input","padding","spacing","unit","fontFamily","typography","fontSize","border","color","defaults","SECONDARY","borderRadius","PRIMARY_DARK","disabled","background","palette","paper","disabledMark","position","graphProps","mark","rect","width","height","scale","domain","range","shift","rightEdge","x","bottomEdge","y","h","max","v","min","coordinates","left","top","MarkLabel","props","setInput","_ref","node","classes","externalInputRef","inputRef","label","setLabel","onChange","e","target","value","debouncedLabel","getBoundingClientRect","pos","leftTop","style","pointerEvents","disabledInput","r","propTypes","PropTypes","bool","func","types","GraphPropsType","object","withTheme"],"mappings":";;;;;;;;;;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAEA,IAAMA,MAAM,GAAG,SAATA,MAAS,CAACC,KAAD;AAAA,SAAY;AACzBC,IAAAA,KAAK,EAAE;AACL,eAAO,OADF;AAELC,MAAAA,OAAO,EAAEF,KAAK,CAACG,OAAN,CAAcC,IAAd,GAAqB,GAFzB;AAGLC,MAAAA,UAAU,EAAEL,KAAK,CAACM,UAAN,CAAiBD,UAHxB;AAILE,MAAAA,QAAQ,EAAEP,KAAK,CAACM,UAAN,CAAiBC,QAJtB;AAKLC,MAAAA,MAAM,sBAAeC,aAAMC,QAAN,CAAeC,SAA9B,CALD;AAMLC,MAAAA,YAAY,EAAE,KANT;AAOLH,MAAAA,KAAK,EAAEA,aAAMC,QA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EAAEa,sBAAUE,IAFA;AAGpB7C,EAAAA,UAAU,EAAE8C,YAAMC,cAHE;AAIpBtB,EAAAA,OAAO,EAAEkB,sBAAUK,MAJC;AAKpBrB,EAAAA,QAAQ,EAAEgB,sBAAUE,IALA;AAMpB5C,EAAAA,IAAI,EAAE0C,sBAAUK,MANI;AAOpBpE,EAAAA,KAAK,EAAE+D,sBAAUK;AAPG,CAAtB;;eAUe,wBAAWrE,MAAX,EAAmB;AAAEsE,EAAAA,SAAS,EAAE;AAAb,CAAnB,EAAwC7B,SAAxC,C","sourcesContent":["import React, { useState, useCallback, useEffect } from 'react';\nimport cn from 'classnames';\nimport PropTypes from 'prop-types';\nimport { withStyles } from '@material-ui/core/styles';\nimport AutosizeInput from 'react-input-autosize';\nimport { useDebounce } from './use-debounce';\nimport { types } from '@pie-lib/plot';\nimport { color } from '../../render-ui/src/index';\n\nconst styles = (theme) => ({\n input: {\n float: 'right',\n padding: theme.spacing.unit * 0.5,\n fontFamily: theme.typography.fontFamily,\n fontSize: theme.typography.fontSize,\n border: `solid 1px ${color.defaults.SECONDARY}`,\n borderRadius: '3px',\n color: color.defaults.PRIMARY_DARK,\n },\n disabled: {\n border: `solid 1px ${color.defaults.PRIMARY_DARK}`,\n background: theme.palette.background.paper,\n },\n disabledMark: {\n border: `solid 1px ${color.disabled()}`,\n background: theme.palette.background.paper,\n color: color.disabled(),\n },\n});\n\nexport const position = (graphProps, mark, rect) => {\n rect = rect || { width: 0, height: 0 };\n const { scale, domain, range } = graphProps;\n const shift = 10;\n\n const rightEdge = scale.x(mark.x) + rect.width + shift;\n const bottomEdge = scale.y(mark.y) + rect.height + shift;\n\n const h = rightEdge >= scale.x(domain.max) ? 'left' : 'right';\n const v = bottomEdge >= scale.y(range.min) ? 'top' : 'bottom';\n\n return `${v}-${h}`;\n};\n\nexport const coordinates = (graphProps, mark, rect, position) => {\n const { scale } = graphProps;\n const shift = 10;\n rect = rect || { width: 0, height: 0 };\n\n switch (position) {\n case 'bottom-right': {\n return { left: scale.x(mark.x) + shift, top: scale.y(mark.y) + shift };\n }\n case 'bottom-left': {\n return { left: scale.x(mark.x) - shift - rect.width, top: scale.y(mark.y) + shift };\n }\n case 'top-left': {\n return {\n left: scale.x(mark.x) - shift - rect.width,\n top: scale.y(mark.y) - shift - rect.height,\n };\n }\n case 'top-right': {\n return {\n left: scale.x(mark.x) + shift,\n top: scale.y(mark.y) - shift - rect.height,\n };\n }\n }\n};\n\nexport const MarkLabel = (props) => {\n const [input, setInput] = useState(null);\n const _ref = useCallback((node) => setInput(node));\n\n const { mark, graphProps, classes, disabled, inputRef: externalInputRef, theme } = props;\n\n const [label, setLabel] = useState(mark.label);\n\n const onChange = (e) => setLabel(e.target.value);\n\n const debouncedLabel = useDebounce(label, 200);\n\n // useState only sets the value once, to synch props to state need useEffect\n useEffect(() => {\n setLabel(mark.label);\n }, [mark.label]);\n\n // pick up the change to debouncedLabel and save it\n useEffect(() => {\n if (typeof debouncedLabel === 'string' && debouncedLabel !== mark.label) {\n props.onChange(debouncedLabel);\n }\n }, [debouncedLabel]);\n\n const rect = input ? input.getBoundingClientRect() : { width: 0, height: 0 };\n const pos = position(graphProps, mark, rect);\n const leftTop = coordinates(graphProps, mark, rect, pos);\n\n const style = {\n position: 'fixed',\n pointerEvents: 'auto',\n ...leftTop,\n };\n\n const disabledInput = disabled || mark.disabled;\n\n return (\n <AutosizeInput\n inputRef={(r) => {\n _ref(r);\n externalInputRef(r);\n }}\n disabled={disabledInput}\n inputClassName={cn(classes.input, {\n [classes.disabled]: disabled,\n [classes.disabledMark]: mark.disabled,\n })}\n value={label}\n style={style}\n onChange={onChange}\n />\n );\n};\n\nMarkLabel.propTypes = {\n disabled: PropTypes.bool,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType,\n classes: PropTypes.object,\n inputRef: PropTypes.func,\n mark: PropTypes.object,\n theme: PropTypes.object,\n};\n\nexport default withStyles(styles, { withTheme: true })(MarkLabel);\n"],"file":"mark-label.js"}
|
package/lib/shared/index.js
DELETED
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
6
|
-
|
|
7
|
-
Object.defineProperty(exports, "__esModule", {
|
|
8
|
-
value: true
|
|
9
|
-
});
|
|
10
|
-
Object.defineProperty(exports, "AppendCSSRules", {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: function get() {
|
|
13
|
-
return _appendCssRules["default"];
|
|
14
|
-
}
|
|
15
|
-
});
|
|
16
|
-
Object.defineProperty(exports, "Collapsible", {
|
|
17
|
-
enumerable: true,
|
|
18
|
-
get: function get() {
|
|
19
|
-
return _collapsible["default"];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
Object.defineProperty(exports, "EnableAudioAutoplayImage", {
|
|
23
|
-
enumerable: true,
|
|
24
|
-
get: function get() {
|
|
25
|
-
return _enableAudioAutoplayImage["default"];
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
Object.defineProperty(exports, "Feedback", {
|
|
29
|
-
enumerable: true,
|
|
30
|
-
get: function get() {
|
|
31
|
-
return _feedback["default"];
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
Object.defineProperty(exports, "HtmlAndMath", {
|
|
35
|
-
enumerable: true,
|
|
36
|
-
get: function get() {
|
|
37
|
-
return _htmlAndMath["default"];
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
Object.defineProperty(exports, "InputContainer", {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function get() {
|
|
43
|
-
return _inputContainer["default"];
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
Object.defineProperty(exports, "PreviewLayout", {
|
|
47
|
-
enumerable: true,
|
|
48
|
-
get: function get() {
|
|
49
|
-
return _previewLayout["default"];
|
|
50
|
-
}
|
|
51
|
-
});
|
|
52
|
-
Object.defineProperty(exports, "PreviewPrompt", {
|
|
53
|
-
enumerable: true,
|
|
54
|
-
get: function get() {
|
|
55
|
-
return _previewPrompt["default"];
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
Object.defineProperty(exports, "Purpose", {
|
|
59
|
-
enumerable: true,
|
|
60
|
-
get: function get() {
|
|
61
|
-
return _purpose["default"];
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
Object.defineProperty(exports, "Readable", {
|
|
65
|
-
enumerable: true,
|
|
66
|
-
get: function get() {
|
|
67
|
-
return _readable["default"];
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
Object.defineProperty(exports, "UiLayout", {
|
|
71
|
-
enumerable: true,
|
|
72
|
-
get: function get() {
|
|
73
|
-
return _uiLayout["default"];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
exports.color = void 0;
|
|
77
|
-
Object.defineProperty(exports, "hasMedia", {
|
|
78
|
-
enumerable: true,
|
|
79
|
-
get: function get() {
|
|
80
|
-
return _hasMedia.hasMedia;
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
Object.defineProperty(exports, "hasText", {
|
|
84
|
-
enumerable: true,
|
|
85
|
-
get: function get() {
|
|
86
|
-
return _hasText.hasText;
|
|
87
|
-
}
|
|
88
|
-
});
|
|
89
|
-
exports.indicators = void 0;
|
|
90
|
-
Object.defineProperty(exports, "withUndoReset", {
|
|
91
|
-
enumerable: true,
|
|
92
|
-
get: function get() {
|
|
93
|
-
return _withUndoReset["default"];
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
var indicators = _interopRequireWildcard(require("./response-indicators"));
|
|
98
|
-
|
|
99
|
-
exports.indicators = indicators;
|
|
100
|
-
|
|
101
|
-
var _feedback = _interopRequireDefault(require("./feedback"));
|
|
102
|
-
|
|
103
|
-
var _collapsible = _interopRequireDefault(require("./collapsible"));
|
|
104
|
-
|
|
105
|
-
var _withUndoReset = _interopRequireDefault(require("./withUndoReset"));
|
|
106
|
-
|
|
107
|
-
var _previewLayout = _interopRequireDefault(require("./preview-layout"));
|
|
108
|
-
|
|
109
|
-
var _uiLayout = _interopRequireDefault(require("./ui-layout"));
|
|
110
|
-
|
|
111
|
-
var _htmlAndMath = _interopRequireDefault(require("./html-and-math"));
|
|
112
|
-
|
|
113
|
-
var _inputContainer = _interopRequireDefault(require("./input-container"));
|
|
114
|
-
|
|
115
|
-
var _previewPrompt = _interopRequireDefault(require("./preview-prompt"));
|
|
116
|
-
|
|
117
|
-
var _readable = _interopRequireDefault(require("./readable"));
|
|
118
|
-
|
|
119
|
-
var _purpose = _interopRequireDefault(require("./purpose"));
|
|
120
|
-
|
|
121
|
-
var color = _interopRequireWildcard(require("./color"));
|
|
122
|
-
|
|
123
|
-
exports.color = color;
|
|
124
|
-
|
|
125
|
-
var _hasText = require("./has-text");
|
|
126
|
-
|
|
127
|
-
var _hasMedia = require("./has-media");
|
|
128
|
-
|
|
129
|
-
var _enableAudioAutoplayImage = _interopRequireDefault(require("./assets/enableAudioAutoplayImage"));
|
|
130
|
-
|
|
131
|
-
var _appendCssRules = _interopRequireDefault(require("./append-css-rules"));
|
|
132
|
-
|
|
133
|
-
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); }
|
|
134
|
-
|
|
135
|
-
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; }
|
|
136
|
-
//# sourceMappingURL=index.js.map
|