@pie-lib/graphing 4.0.23 → 4.0.24-beta.10
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 +0 -92
- package/lib/__tests__/bg.test.js +282 -0
- package/lib/__tests__/coordinates-label.test.js +276 -0
- package/lib/__tests__/graph-with-controls.test.js +275 -0
- package/lib/__tests__/graph.test.js +927 -0
- package/lib/__tests__/grid-setup.test.js +729 -0
- package/lib/__tests__/grid.test.js +29 -0
- package/lib/__tests__/key-legend.test.js +321 -0
- package/lib/__tests__/label-svg-icon.test.js +373 -0
- package/lib/__tests__/labels.test.js +61 -0
- package/lib/__tests__/mark-label.test.js +133 -0
- package/lib/__tests__/toggle-bar.test.js +197 -0
- package/lib/__tests__/tool-menu.test.js +151 -0
- package/lib/__tests__/undo-redo.test.js +31 -0
- package/lib/__tests__/use-debounce.test.js +24 -0
- package/lib/__tests__/utils.js +70 -0
- package/lib/__tests__/utils.test.js +123 -0
- package/lib/axis/__tests__/arrow.test.js +60 -0
- package/lib/axis/__tests__/axes.test.js +195 -0
- package/lib/container/__tests__/actions.test.js +108 -0
- package/lib/container/__tests__/index.test.js +503 -0
- package/lib/container/__tests__/marks.test.js +259 -0
- package/lib/container/__tests__/middleware.test.js +244 -0
- package/lib/container/__tests__/reducer.test.js +450 -0
- package/lib/mark-label.js +7 -197
- package/lib/mark-label.js.map +1 -1
- package/lib/tools/absolute/__tests__/component.test.js +65 -0
- package/lib/tools/circle/__tests__/bg-circle.test.js +33 -0
- package/lib/tools/circle/__tests__/component.test.js +615 -0
- package/lib/tools/circle/__tests__/index.test.js +576 -0
- package/lib/tools/circle/component.js +3 -34
- package/lib/tools/circle/component.js.map +1 -1
- package/lib/tools/exponential/__tests__/component.test.js +64 -0
- package/lib/tools/exponential/__tests__/index.test.js +828 -0
- package/lib/tools/line/__tests__/component.test.js +45 -0
- package/lib/tools/parabola/__tests__/component.test.js +64 -0
- package/lib/tools/parabola/__tests__/index.test.js +564 -0
- package/lib/tools/point/__tests__/component.test.js +434 -0
- package/lib/tools/point/__tests__/index.test.js +262 -0
- package/lib/tools/point/component.js +8 -29
- package/lib/tools/point/component.js.map +1 -1
- package/lib/tools/polygon/__tests__/component.test.js +485 -0
- package/lib/tools/polygon/__tests__/index.test.js +303 -0
- package/lib/tools/polygon/__tests__/line.test.js +50 -0
- package/lib/tools/polygon/__tests__/polygon.test.js +85 -0
- package/lib/tools/polygon/component.js +6 -31
- package/lib/tools/polygon/component.js.map +1 -1
- package/lib/tools/ray/__tests__/component.test.js +35 -0
- package/lib/tools/segment/__tests__/component.test.js +35 -0
- package/lib/tools/shared/__tests__/arrow-head.test.js +45 -0
- package/lib/tools/shared/line/__tests__/index.test.js +124 -0
- package/lib/tools/shared/line/__tests__/line-path.test.js +62 -0
- package/lib/tools/shared/line/__tests__/with-root-edge.test.js +90 -0
- package/lib/tools/shared/line/index.js +3 -34
- package/lib/tools/shared/line/index.js.map +1 -1
- package/lib/tools/shared/point/__tests__/arrow-point.test.js +127 -0
- package/lib/tools/shared/point/__tests__/base-point.test.js +122 -0
- package/lib/tools/sine/__tests__/component.test.js +72 -0
- package/lib/tools/vector/__tests__/component.test.js +32 -0
- package/package.json +17 -17
- package/src/__tests__/graph.test.jsx +1 -76
- package/src/__tests__/mark-label.test.jsx +1 -375
- package/src/mark-label.jsx +8 -209
- package/src/tools/circle/component.jsx +3 -26
- package/src/tools/point/__tests__/component.test.jsx +1 -127
- package/src/tools/point/component.jsx +8 -21
- package/src/tools/polygon/component.jsx +6 -24
- package/src/tools/shared/line/index.jsx +3 -26
- package/LICENSE.md +0 -5
package/lib/mark-label.js
CHANGED
|
@@ -19,17 +19,6 @@ var _labelSvgIcon = _interopRequireDefault(require("./label-svg-icon"));
|
|
|
19
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); }
|
|
20
20
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
21
21
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
22
|
-
var DEBOUNCE_DELAY = 500;
|
|
23
|
-
// A new label insists on the focus and the caret for this long, and again on each of the ticks
|
|
24
|
-
// below. No single moment is reliable: the authoring host re-renders the whole element while it
|
|
25
|
-
// saves, and the input is replaced under this component more than once. Nothing typed yet is what
|
|
26
|
-
// tells a transient blur apart from the user leaving the label.
|
|
27
|
-
var INSIST_ON_FOCUS_FOR = 500;
|
|
28
|
-
var INSIST_AT = [0, 50, 120, 250, 400, 700, 1000];
|
|
29
|
-
// how many times a label will do the heavier focus cycle to get a caret back
|
|
30
|
-
var MAX_CARET_CYCLES = 3;
|
|
31
|
-
// how wide an editable label input is while it is empty
|
|
32
|
-
var EMPTY_INPUT_WIDTH = 30;
|
|
33
22
|
var StyledInputCorrect = (0, _styles.styled)('div')(function (_ref2) {
|
|
34
23
|
var theme = _ref2.theme;
|
|
35
24
|
return {
|
|
@@ -148,30 +137,12 @@ var coordinates = exports.coordinates = function coordinates(graphProps, mark) {
|
|
|
148
137
|
return {};
|
|
149
138
|
}
|
|
150
139
|
};
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Whether the document's caret is in this input. The characters land at the caret, not at the
|
|
154
|
-
* focused node - an input can be the active element with no caret anywhere, and then keypress fires
|
|
155
|
-
* and nothing is inserted, with nothing in the page cancelling anything.
|
|
156
|
-
*/
|
|
157
|
-
var caretIsInside = function caretIsInside(node) {
|
|
158
|
-
if (typeof document === 'undefined' || !document.getSelection) {
|
|
159
|
-
return true;
|
|
160
|
-
}
|
|
161
|
-
var selection = document.getSelection();
|
|
162
|
-
if (!selection || !selection.rangeCount || !selection.anchorNode) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
var anchor = selection.anchorNode;
|
|
166
|
-
return anchor === node || anchor === node.parentNode || node.contains(anchor);
|
|
167
|
-
};
|
|
168
140
|
var LabelInput = function LabelInput(_ref5) {
|
|
169
141
|
var _ref = _ref5._ref,
|
|
170
142
|
externalInputRef = _ref5.externalInputRef,
|
|
171
143
|
label = _ref5.label,
|
|
172
144
|
disabled = _ref5.disabled,
|
|
173
145
|
inputStyle = _ref5.inputStyle,
|
|
174
|
-
minWidth = _ref5.minWidth,
|
|
175
146
|
onChange = _ref5.onChange,
|
|
176
147
|
onBlur = _ref5.onBlur;
|
|
177
148
|
return /*#__PURE__*/_react["default"].createElement(_reactInputAutosize["default"], {
|
|
@@ -181,7 +152,6 @@ var LabelInput = function LabelInput(_ref5) {
|
|
|
181
152
|
},
|
|
182
153
|
disabled: disabled,
|
|
183
154
|
inputStyle: inputStyle,
|
|
184
|
-
minWidth: minWidth,
|
|
185
155
|
value: label,
|
|
186
156
|
onChange: onChange,
|
|
187
157
|
onBlur: onBlur
|
|
@@ -193,26 +163,21 @@ LabelInput.propTypes = {
|
|
|
193
163
|
label: _propTypes["default"].string,
|
|
194
164
|
disabled: _propTypes["default"].bool,
|
|
195
165
|
inputStyle: _propTypes["default"].object,
|
|
196
|
-
minWidth: _propTypes["default"].number,
|
|
197
166
|
onChange: _propTypes["default"].func,
|
|
198
167
|
onBlur: _propTypes["default"].func
|
|
199
168
|
};
|
|
200
169
|
var MarkLabel = exports.MarkLabel = function MarkLabel(props) {
|
|
201
|
-
// the state repositions the label once the input has a size, the ref is never a render behind
|
|
202
|
-
var inputNode = (0, _react.useRef)(null);
|
|
203
170
|
var _useState = (0, _react.useState)(null),
|
|
204
171
|
_useState2 = (0, _slicedToArray2["default"])(_useState, 2),
|
|
205
172
|
input = _useState2[0],
|
|
206
173
|
setInput = _useState2[1];
|
|
207
174
|
var _ref = (0, _react.useCallback)(function (node) {
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
}, []);
|
|
175
|
+
return setInput(node);
|
|
176
|
+
});
|
|
211
177
|
var theme = (0, _styles.useTheme)();
|
|
212
178
|
var mark = props.mark,
|
|
213
179
|
graphProps = props.graphProps,
|
|
214
180
|
disabled = props.disabled,
|
|
215
|
-
autoFocus = props.autoFocus,
|
|
216
181
|
externalInputRef = props.inputRef;
|
|
217
182
|
var _useState3 = (0, _react.useState)(mark.label),
|
|
218
183
|
_useState4 = (0, _slicedToArray2["default"])(_useState3, 2),
|
|
@@ -221,168 +186,27 @@ var MarkLabel = exports.MarkLabel = function MarkLabel(props) {
|
|
|
221
186
|
var correctness = mark.correctness,
|
|
222
187
|
correctnesslabel = mark.correctnesslabel,
|
|
223
188
|
correctlabel = mark.correctlabel;
|
|
224
|
-
var isFocused = function isFocused() {
|
|
225
|
-
return !!inputNode.current && typeof document !== 'undefined' && document.activeElement === inputNode.current;
|
|
226
|
-
};
|
|
227
|
-
|
|
228
|
-
// an empty label with an enabled input is one the user just added: label mode has to be on and it
|
|
229
|
-
// always starts off. Read from the mark, not from autoFocus, because the tool that asked for the
|
|
230
|
-
// label can be remounted by the marks coming back from the host before the input renders.
|
|
231
|
-
var isNewLabel = (0, _react.useRef)(mark.label === '' && !disabled && !mark.disabled);
|
|
232
|
-
var insistUntil = (0, _react.useRef)(0);
|
|
233
|
-
var lastSaved = (0, _react.useRef)(mark.label);
|
|
234
|
-
var insisting = function insisting() {
|
|
235
|
-
return Date.now() < insistUntil.current && !(inputNode.current && inputNode.current.value);
|
|
236
|
-
};
|
|
237
|
-
// the whole window losing the focus is not the user leaving the label - another window, the
|
|
238
|
-
// devtools, or the host moving the focus while it saves. The window blur arrives before the
|
|
239
|
-
// input's own blur, so this flag is set by the time the label is asked to give itself up.
|
|
240
|
-
var windowAway = (0, _react.useRef)(false);
|
|
241
|
-
// our own blur, from the focus cycle that puts a missing caret back
|
|
242
|
-
var selfFocusing = (0, _react.useRef)(false);
|
|
243
|
-
var caretCycles = (0, _react.useRef)(0);
|
|
244
189
|
var onChange = function onChange(e) {
|
|
245
190
|
return setLabel(e.target.value);
|
|
246
191
|
};
|
|
247
|
-
var saveLabel = function saveLabel(value) {
|
|
248
|
-
if (value === lastSaved.current) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
lastSaved.current = value;
|
|
252
|
-
props.onChange(value);
|
|
253
|
-
};
|
|
254
192
|
var handleBlur = (0, _react.useCallback)(function () {
|
|
255
|
-
// in the DNA env the focus is moved while the model is saved - not the user leaving the label
|
|
256
|
-
if (insisting() || windowAway.current || selfFocusing.current) {
|
|
257
|
-
return;
|
|
258
|
-
}
|
|
259
|
-
isNewLabel.current = false;
|
|
260
193
|
if (label === '') {
|
|
261
194
|
props.onChange('');
|
|
262
|
-
} else if (label !== mark.label) {
|
|
263
|
-
// the debounce can still be pending, and once the focus is gone an echo of the model would
|
|
264
|
-
// overwrite what was typed before it fires
|
|
265
|
-
saveLabel(label);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
// lets the tool know that this label is not being edited anymore, so it stops auto focusing it
|
|
269
|
-
if (props.onBlur) {
|
|
270
|
-
props.onBlur();
|
|
271
195
|
}
|
|
272
|
-
}, [label,
|
|
273
|
-
var debouncedLabel = (0, _useDebounce.useDebounce)(label,
|
|
196
|
+
}, [label, props.onChange]);
|
|
197
|
+
var debouncedLabel = (0, _useDebounce.useDebounce)(label, 200);
|
|
274
198
|
|
|
275
|
-
//
|
|
276
|
-
// older label and overwrite what was typed meanwhile
|
|
199
|
+
// useState only sets the value once, to synch props to state need useEffect
|
|
277
200
|
(0, _react.useEffect)(function () {
|
|
278
|
-
if (isFocused()) {
|
|
279
|
-
return;
|
|
280
|
-
}
|
|
281
201
|
setLabel(mark.label);
|
|
282
202
|
}, [mark.label]);
|
|
283
203
|
|
|
284
204
|
// pick up the change to debouncedLabel and save it
|
|
285
205
|
(0, _react.useEffect)(function () {
|
|
286
206
|
if (typeof debouncedLabel === 'string' && debouncedLabel !== mark.label) {
|
|
287
|
-
|
|
207
|
+
props.onChange(debouncedLabel);
|
|
288
208
|
}
|
|
289
209
|
}, [debouncedLabel]);
|
|
290
|
-
var focusInput = function focusInput() {
|
|
291
|
-
var node = inputNode.current;
|
|
292
|
-
|
|
293
|
-
// node.disabled, not the disabled prop: a disabled input silently ignores focus()
|
|
294
|
-
if (!autoFocus && !isNewLabel.current && !insisting() || !node || node.disabled) {
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
var wasFocused = isFocused();
|
|
298
|
-
if (!wasFocused) {
|
|
299
|
-
node.focus();
|
|
300
|
-
|
|
301
|
-
// a new label is focused once, so it cannot fight over the focus with another one
|
|
302
|
-
if (isFocused()) {
|
|
303
|
-
isNewLabel.current = false;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
if (!node.setSelectionRange) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
// a label that was already being edited keeps the caret the user put in it; one that has just
|
|
311
|
-
// taken the focus gets it at the end, otherwise typing continues in front of the existing label
|
|
312
|
-
var keepCaret = wasFocused && node.value;
|
|
313
|
-
var start = keepCaret ? node.selectionStart : (node.value || '').length;
|
|
314
|
-
var end = keepCaret ? node.selectionEnd : start;
|
|
315
|
-
|
|
316
|
-
// The characters land at the document's caret, not at the focused node. An input focused while
|
|
317
|
-
// it was being replaced, or while the window was away, ends up as the active element with no
|
|
318
|
-
// caret anywhere: keypress fires and nothing is inserted, with nothing in the page cancelling
|
|
319
|
-
// anything. Re-asserting the range is what puts the caret back.
|
|
320
|
-
if (!caretIsInside(node)) {
|
|
321
|
-
node.setSelectionRange(start, end);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
// and if it still is not there, a focus cycle is the heavier way to get it. Every focusInput
|
|
325
|
-
// call is another go at it - after each render, on each insist tick, and when the window comes
|
|
326
|
-
// back - up to a few times per label, since the state comes back as the input is replaced.
|
|
327
|
-
if (caretIsInside(node) || caretCycles.current >= MAX_CARET_CYCLES) {
|
|
328
|
-
return;
|
|
329
|
-
}
|
|
330
|
-
caretCycles.current += 1;
|
|
331
|
-
// our own blur, so the label is not given up over it
|
|
332
|
-
selfFocusing.current = true;
|
|
333
|
-
node.blur();
|
|
334
|
-
node.focus();
|
|
335
|
-
node.setSelectionRange(start, end);
|
|
336
|
-
selfFocusing.current = false;
|
|
337
|
-
};
|
|
338
|
-
|
|
339
|
-
// after every render: the input can appear a render or more later (the mark comes back from an
|
|
340
|
-
// async model save) and a replaced node loses the focus without this component being told
|
|
341
|
-
(0, _react.useEffect)(function () {
|
|
342
|
-
return focusInput();
|
|
343
|
-
});
|
|
344
|
-
|
|
345
|
-
// and again on a timer, for the DNA env, where the focus is moved once the renders are over. The
|
|
346
|
-
// original code focused from a setTimeout, which is what let it survive that.
|
|
347
|
-
(0, _react.useEffect)(function () {
|
|
348
|
-
if (!autoFocus && !isNewLabel.current) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
if (!insistUntil.current) {
|
|
352
|
-
insistUntil.current = Date.now() + INSIST_ON_FOCUS_FOR;
|
|
353
|
-
}
|
|
354
|
-
var timers = INSIST_AT.map(function (delay) {
|
|
355
|
-
return setTimeout(focusInput, delay);
|
|
356
|
-
});
|
|
357
|
-
return function () {
|
|
358
|
-
return timers.forEach(function (t) {
|
|
359
|
-
return clearTimeout(t);
|
|
360
|
-
});
|
|
361
|
-
};
|
|
362
|
-
}, [autoFocus]);
|
|
363
|
-
|
|
364
|
-
// the blur that came with the window going away is ignored, so the label is still the one being
|
|
365
|
-
// edited when the window comes back and it takes the focus, and its selection, back
|
|
366
|
-
(0, _react.useEffect)(function () {
|
|
367
|
-
var onWindowBlur = function onWindowBlur() {
|
|
368
|
-
windowAway.current = true;
|
|
369
|
-
};
|
|
370
|
-
var onWindowFocus = function onWindowFocus() {
|
|
371
|
-
// coming back only means something if the window went away: moving the focus from one element
|
|
372
|
-
// to another inside the page reaches window too in some implementations
|
|
373
|
-
if (!windowAway.current) {
|
|
374
|
-
return;
|
|
375
|
-
}
|
|
376
|
-
windowAway.current = false;
|
|
377
|
-
focusInput();
|
|
378
|
-
};
|
|
379
|
-
window.addEventListener('blur', onWindowBlur);
|
|
380
|
-
window.addEventListener('focus', onWindowFocus);
|
|
381
|
-
return function () {
|
|
382
|
-
window.removeEventListener('blur', onWindowBlur);
|
|
383
|
-
window.removeEventListener('focus', onWindowFocus);
|
|
384
|
-
};
|
|
385
|
-
}, [autoFocus]);
|
|
386
210
|
var rect = input ? input.getBoundingClientRect() : {
|
|
387
211
|
width: 0,
|
|
388
212
|
height: 0
|
|
@@ -406,13 +230,7 @@ var MarkLabel = exports.MarkLabel = function MarkLabel(props) {
|
|
|
406
230
|
externalInputRef: externalInputRef,
|
|
407
231
|
label: labelValue,
|
|
408
232
|
disabled: disabledInput,
|
|
409
|
-
inputStyle: inputStyle
|
|
410
|
-
// an editable label sizes itself to its content, so an empty one is 2px wide: enough for the
|
|
411
|
-
// caret, not enough for anybody to see that the label is waiting to be typed into. Chrome
|
|
412
|
-
// does not blink the caret of an input inside an svg foreignObject, it only paints a hairline,
|
|
413
|
-
// so the box itself has to say that it has the focus.
|
|
414
|
-
,
|
|
415
|
-
minWidth: disabledInput ? 1 : EMPTY_INPUT_WIDTH,
|
|
233
|
+
inputStyle: inputStyle,
|
|
416
234
|
onChange: onChange,
|
|
417
235
|
onBlur: handleBlur
|
|
418
236
|
});
|
|
@@ -452,20 +270,12 @@ var MarkLabel = exports.MarkLabel = function MarkLabel(props) {
|
|
|
452
270
|
style: style
|
|
453
271
|
}, renderInput(studentInputStyle, label));
|
|
454
272
|
}
|
|
455
|
-
|
|
456
|
-
// an empty label that cannot be edited is just an empty box - the config draws the background
|
|
457
|
-
// marks into every correct answer graph too
|
|
458
|
-
if (disabledInput && !label) {
|
|
459
|
-
return null;
|
|
460
|
-
}
|
|
461
273
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
462
274
|
style: style
|
|
463
275
|
}, renderInput(getInputStyles(theme, disabled, mark.disabled), label));
|
|
464
276
|
};
|
|
465
277
|
MarkLabel.propTypes = {
|
|
466
|
-
autoFocus: _propTypes["default"].bool,
|
|
467
278
|
disabled: _propTypes["default"].bool,
|
|
468
|
-
onBlur: _propTypes["default"].func,
|
|
469
279
|
onChange: _propTypes["default"].func,
|
|
470
280
|
graphProps: _plot.types.GraphPropsType,
|
|
471
281
|
inputRef: _propTypes["default"].func,
|
package/lib/mark-label.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mark-label.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_styles","_reactInputAutosize","_useDebounce","_plot","_renderUi","_labelSvgIcon","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","DEBOUNCE_DELAY","INSIST_ON_FOCUS_FOR","INSIST_AT","MAX_CARET_CYCLES","EMPTY_INPUT_WIDTH","StyledInputCorrect","styled","_ref2","theme","padding","spacing","borderRadius","fontSize","backgroundColor","color","defaults","WHITE","CORRECT_WITH_ICON","border","concat","StyledInputIncorrect","_ref3","INCORRECT_WITH_ICON","StyledInputMissing","_ref4","MISSING_WITH_ICON","fontWeight","StyledIncorrect","getInputStyles","disabled","markDisabled","fontFamily","typography","PRIMARY_DARK","SECONDARY","WebkitOpacity","undefined","WebkitTextFillColor","getStudentInputStyles","position","exports","graphProps","mark","rect","width","height","scale","domain","range","shift","rightEdge","x","bottomEdge","y","h","max","v","min","coordinates","left","top","caretIsInside","node","document","getSelection","selection","rangeCount","anchorNode","anchor","parentNode","contains","LabelInput","_ref5","_ref","externalInputRef","label","inputStyle","minWidth","onChange","onBlur","createElement","inputRef","value","propTypes","PropTypes","func","string","bool","object","number","MarkLabel","props","inputNode","useRef","_useState","useState","_useState2","_slicedToArray2","input","setInput","useCallback","current","useTheme","autoFocus","_useState3","_useState4","setLabel","correctness","correctnesslabel","correctlabel","isFocused","activeElement","isNewLabel","insistUntil","lastSaved","insisting","Date","now","windowAway","selfFocusing","caretCycles","target","saveLabel","handleBlur","debouncedLabel","useDebounce","useEffect","focusInput","wasFocused","focus","setSelectionRange","keepCaret","start","selectionStart","end","selectionEnd","blur","timers","map","delay","setTimeout","clearTimeout","onWindowBlur","onWindowFocus","window","addEventListener","removeEventListener","getBoundingClientRect","pos","leftTop","style","pointerEvents","display","alignItems","gap","secondLabelStyle","disabledInput","renderInput","labelValue","studentInputStyle","type","Fragment","marginLeft","types","GraphPropsType","_default"],"sources":["../src/mark-label.jsx"],"sourcesContent":["import React, { useCallback, useEffect, useRef, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { styled, useTheme } from '@mui/material/styles';\nimport AutosizeInput from 'react-input-autosize';\nimport { useDebounce } from './use-debounce';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport SvgIcon from './label-svg-icon';\n\nconst DEBOUNCE_DELAY = 500;\n// A new label insists on the focus and the caret for this long, and again on each of the ticks\n// below. No single moment is reliable: the authoring host re-renders the whole element while it\n// saves, and the input is replaced under this component more than once. Nothing typed yet is what\n// tells a transient blur apart from the user leaving the label.\nconst INSIST_ON_FOCUS_FOR = 500;\nconst INSIST_AT = [0, 50, 120, 250, 400, 700, 1000];\n// how many times a label will do the heavier focus cycle to get a caret back\nconst MAX_CARET_CYCLES = 3;\n// how wide an editable label input is while it is empty\nconst EMPTY_INPUT_WIDTH = 30;\n\nconst StyledInputCorrect = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.CORRECT_WITH_ICON,\n border: `solid 1px ${color.defaults.CORRECT_WITH_ICON}`,\n}));\n\nconst StyledInputIncorrect = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.INCORRECT_WITH_ICON,\n border: `solid 1px ${color.defaults.INCORRECT_WITH_ICON}`,\n}));\n\nconst StyledInputMissing = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.MISSING_WITH_ICON,\n border: `solid 1px ${color.defaults.MISSING_WITH_ICON}`,\n fontWeight: 'bold',\n}));\n\nconst StyledIncorrect = styled('div')(() => ({\n float: 'right',\n padding: 0,\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.INCORRECT_WITH_ICON,\n fontWeight: 'bold',\n}));\n\nconst getInputStyles = (theme, disabled, markDisabled) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n fontFamily: theme.typography.fontFamily,\n fontSize: '10px',\n border: disabled\n ? `solid 1px ${color.defaults.PRIMARY_DARK}`\n : markDisabled\n ? `solid 1px ${color.disabled()}`\n : `solid 1px ${color.defaults.SECONDARY}`,\n borderRadius: '3px',\n color: markDisabled ? color.disabled() : color.defaults.PRIMARY_DARK,\n backgroundColor: color.defaults.WHITE,\n WebkitOpacity: disabled ? '1' : undefined,\n WebkitTextFillColor: markDisabled ? color.disabled() : undefined,\n});\n\nconst getStudentInputStyles = () => ({\n padding: '0',\n border: 'none',\n color: 'inherit',\n fontWeight: 'bold',\n});\n\nexport const position = (graphProps, mark, rect = { width: 0, height: 0 }) => {\n const { scale, domain, range } = graphProps;\n const shift = 5;\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 = { width: 0, height: 0 }, position) => {\n const { scale } = graphProps;\n const shift = 5;\n\n switch (position) {\n case 'bottom-right':\n return { left: scale.x(mark.x) + shift, top: scale.y(mark.y) + shift };\n case 'bottom-left':\n return { left: scale.x(mark.x) - shift - rect.width, top: scale.y(mark.y) + shift };\n case 'top-left':\n return { left: scale.x(mark.x) - shift - rect.width, top: scale.y(mark.y) - shift - rect.height };\n case 'top-right':\n return { left: scale.x(mark.x) + shift, top: scale.y(mark.y) - shift - rect.height };\n default:\n return {};\n }\n};\n\n/**\n * Whether the document's caret is in this input. The characters land at the caret, not at the\n * focused node - an input can be the active element with no caret anywhere, and then keypress fires\n * and nothing is inserted, with nothing in the page cancelling anything.\n */\nconst caretIsInside = (node) => {\n if (typeof document === 'undefined' || !document.getSelection) {\n return true;\n }\n\n const selection = document.getSelection();\n\n if (!selection || !selection.rangeCount || !selection.anchorNode) {\n return false;\n }\n\n const anchor = selection.anchorNode;\n\n return anchor === node || anchor === node.parentNode || node.contains(anchor);\n};\n\nconst LabelInput = ({ _ref, externalInputRef, label, disabled, inputStyle, minWidth, onChange, onBlur }) => (\n <AutosizeInput\n inputRef={(r) => {\n _ref(r);\n externalInputRef(r);\n }}\n disabled={disabled}\n inputStyle={inputStyle}\n minWidth={minWidth}\n value={label}\n onChange={onChange}\n onBlur={onBlur}\n />\n);\n\nLabelInput.propTypes = {\n _ref: PropTypes.func,\n externalInputRef: PropTypes.func,\n label: PropTypes.string,\n disabled: PropTypes.bool,\n inputStyle: PropTypes.object,\n minWidth: PropTypes.number,\n onChange: PropTypes.func,\n onBlur: PropTypes.func,\n};\n\nexport const MarkLabel = (props) => {\n // the state repositions the label once the input has a size, the ref is never a render behind\n const inputNode = useRef(null);\n const [input, setInput] = useState(null);\n const _ref = useCallback((node) => {\n inputNode.current = node;\n setInput(node);\n }, []);\n const theme = useTheme();\n\n const { mark, graphProps, disabled, autoFocus, inputRef: externalInputRef } = props;\n\n const [label, setLabel] = useState(mark.label);\n const { correctness, correctnesslabel, correctlabel } = mark;\n\n const isFocused = () =>\n !!inputNode.current && typeof document !== 'undefined' && document.activeElement === inputNode.current;\n\n // an empty label with an enabled input is one the user just added: label mode has to be on and it\n // always starts off. Read from the mark, not from autoFocus, because the tool that asked for the\n // label can be remounted by the marks coming back from the host before the input renders.\n const isNewLabel = useRef(mark.label === '' && !disabled && !mark.disabled);\n const insistUntil = useRef(0);\n const lastSaved = useRef(mark.label);\n const insisting = () => Date.now() < insistUntil.current && !(inputNode.current && inputNode.current.value);\n // the whole window losing the focus is not the user leaving the label - another window, the\n // devtools, or the host moving the focus while it saves. The window blur arrives before the\n // input's own blur, so this flag is set by the time the label is asked to give itself up.\n const windowAway = useRef(false);\n // our own blur, from the focus cycle that puts a missing caret back\n const selfFocusing = useRef(false);\n const caretCycles = useRef(0);\n\n const onChange = (e) => setLabel(e.target.value);\n\n const saveLabel = (value) => {\n if (value === lastSaved.current) {\n return;\n }\n\n lastSaved.current = value;\n props.onChange(value);\n };\n\n const handleBlur = useCallback(() => {\n // in the DNA env the focus is moved while the model is saved - not the user leaving the label\n if (insisting() || windowAway.current || selfFocusing.current) {\n return;\n }\n\n isNewLabel.current = false;\n\n if (label === '') {\n props.onChange('');\n } else if (label !== mark.label) {\n // the debounce can still be pending, and once the focus is gone an echo of the model would\n // overwrite what was typed before it fires\n saveLabel(label);\n }\n\n // lets the tool know that this label is not being edited anymore, so it stops auto focusing it\n if (props.onBlur) {\n props.onBlur();\n }\n }, [label, mark.label, props.onChange, props.onBlur]);\n\n const debouncedLabel = useDebounce(label, DEBOUNCE_DELAY);\n\n // props to state, but not while focused: the mark can come back from an async model save with an\n // older label and overwrite what was typed meanwhile\n useEffect(() => {\n if (isFocused()) {\n return;\n }\n\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 saveLabel(debouncedLabel);\n }\n }, [debouncedLabel]);\n\n const focusInput = () => {\n const node = inputNode.current;\n\n // node.disabled, not the disabled prop: a disabled input silently ignores focus()\n if ((!autoFocus && !isNewLabel.current && !insisting()) || !node || node.disabled) {\n return;\n }\n\n const wasFocused = isFocused();\n\n if (!wasFocused) {\n node.focus();\n\n // a new label is focused once, so it cannot fight over the focus with another one\n if (isFocused()) {\n isNewLabel.current = false;\n }\n }\n\n if (!node.setSelectionRange) {\n return;\n }\n\n // a label that was already being edited keeps the caret the user put in it; one that has just\n // taken the focus gets it at the end, otherwise typing continues in front of the existing label\n const keepCaret = wasFocused && node.value;\n const start = keepCaret ? node.selectionStart : (node.value || '').length;\n const end = keepCaret ? node.selectionEnd : start;\n\n // The characters land at the document's caret, not at the focused node. An input focused while\n // it was being replaced, or while the window was away, ends up as the active element with no\n // caret anywhere: keypress fires and nothing is inserted, with nothing in the page cancelling\n // anything. Re-asserting the range is what puts the caret back.\n if (!caretIsInside(node)) {\n node.setSelectionRange(start, end);\n }\n\n // and if it still is not there, a focus cycle is the heavier way to get it. Every focusInput\n // call is another go at it - after each render, on each insist tick, and when the window comes\n // back - up to a few times per label, since the state comes back as the input is replaced.\n if (caretIsInside(node) || caretCycles.current >= MAX_CARET_CYCLES) {\n return;\n }\n\n caretCycles.current += 1;\n // our own blur, so the label is not given up over it\n selfFocusing.current = true;\n node.blur();\n node.focus();\n node.setSelectionRange(start, end);\n selfFocusing.current = false;\n };\n\n // after every render: the input can appear a render or more later (the mark comes back from an\n // async model save) and a replaced node loses the focus without this component being told\n useEffect(() => focusInput());\n\n // and again on a timer, for the DNA env, where the focus is moved once the renders are over. The\n // original code focused from a setTimeout, which is what let it survive that.\n useEffect(() => {\n if (!autoFocus && !isNewLabel.current) {\n return;\n }\n\n if (!insistUntil.current) {\n insistUntil.current = Date.now() + INSIST_ON_FOCUS_FOR;\n }\n\n const timers = INSIST_AT.map((delay) => setTimeout(focusInput, delay));\n\n return () => timers.forEach((t) => clearTimeout(t));\n }, [autoFocus]);\n\n // the blur that came with the window going away is ignored, so the label is still the one being\n // edited when the window comes back and it takes the focus, and its selection, back\n useEffect(() => {\n const onWindowBlur = () => {\n windowAway.current = true;\n };\n\n const onWindowFocus = () => {\n // coming back only means something if the window went away: moving the focus from one element\n // to another inside the page reaches window too in some implementations\n if (!windowAway.current) {\n return;\n }\n\n windowAway.current = false;\n focusInput();\n };\n\n window.addEventListener('blur', onWindowBlur);\n window.addEventListener('focus', onWindowFocus);\n\n return () => {\n window.removeEventListener('blur', onWindowBlur);\n window.removeEventListener('focus', onWindowFocus);\n };\n }, [autoFocus]);\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 display: 'flex',\n alignItems: 'center',\n gap: '3px',\n ...leftTop,\n };\n\n const secondLabelStyle = {\n ...style,\n top: leftTop.top + 25,\n };\n\n const disabledInput = disabled || mark.disabled;\n\n const renderInput = (inputStyle, labelValue) => (\n <LabelInput\n _ref={_ref}\n externalInputRef={externalInputRef}\n label={labelValue}\n disabled={disabledInput}\n inputStyle={inputStyle}\n // an editable label sizes itself to its content, so an empty one is 2px wide: enough for the\n // caret, not enough for anybody to see that the label is waiting to be typed into. Chrome\n // does not blink the caret of an input inside an svg foreignObject, it only paints a hairline,\n // so the box itself has to say that it has the focus.\n minWidth={disabledInput ? 1 : EMPTY_INPUT_WIDTH}\n onChange={onChange}\n onBlur={handleBlur}\n />\n );\n\n const studentInputStyle = getStudentInputStyles();\n\n if (correctness === 'correct' && correctnesslabel === 'correct' && correctlabel) {\n return (\n <StyledInputCorrect style={style}>\n <SvgIcon type=\"correct\" />\n {renderInput(studentInputStyle, correctlabel)}\n </StyledInputCorrect>\n );\n }\n\n if (correctness === 'correct' && correctnesslabel === 'correct' && !correctlabel) {\n return null;\n }\n\n if (correctness === 'correct' && correctnesslabel === 'incorrect') {\n return (\n <>\n <StyledInputIncorrect style={style}>\n <SvgIcon type=\"incorrect\" />\n {label === '' ? (\n <SvgIcon type=\"empty\" style={{ marginLeft: '3px' }} />\n ) : (\n renderInput(studentInputStyle, label)\n )}\n </StyledInputIncorrect>\n <StyledInputMissing style={secondLabelStyle}>{renderInput(studentInputStyle, correctlabel)}</StyledInputMissing>\n </>\n );\n }\n\n if (correctness === 'missing') {\n return <StyledInputMissing style={style}>{renderInput(studentInputStyle, label)}</StyledInputMissing>;\n }\n\n if (correctness === 'incorrect') {\n return <StyledIncorrect style={style}>{renderInput(studentInputStyle, label)}</StyledIncorrect>;\n }\n\n // an empty label that cannot be edited is just an empty box - the config draws the background\n // marks into every correct answer graph too\n if (disabledInput && !label) {\n return null;\n }\n\n return <div style={style}>{renderInput(getInputStyles(theme, disabled, mark.disabled), label)}</div>;\n};\n\nMarkLabel.propTypes = {\n autoFocus: PropTypes.bool,\n disabled: PropTypes.bool,\n onBlur: PropTypes.func,\n onChange: PropTypes.func,\n graphProps: types.GraphPropsType,\n inputRef: PropTypes.func,\n mark: PropTypes.object,\n};\n\nexport default MarkLabel;\n"],"mappings":";;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAA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","_interopRequireDefault","_styles","_reactInputAutosize","_useDebounce","_plot","_renderUi","_labelSvgIcon","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","ownKeys","keys","getOwnPropertySymbols","filter","enumerable","push","apply","_objectSpread","arguments","length","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","StyledInputCorrect","styled","_ref2","theme","padding","spacing","borderRadius","fontSize","backgroundColor","color","defaults","WHITE","CORRECT_WITH_ICON","border","concat","StyledInputIncorrect","_ref3","INCORRECT_WITH_ICON","StyledInputMissing","_ref4","MISSING_WITH_ICON","fontWeight","StyledIncorrect","getInputStyles","disabled","markDisabled","fontFamily","typography","PRIMARY_DARK","SECONDARY","WebkitOpacity","undefined","WebkitTextFillColor","getStudentInputStyles","position","exports","graphProps","mark","rect","width","height","scale","domain","range","shift","rightEdge","x","bottomEdge","y","h","max","v","min","coordinates","left","top","LabelInput","_ref5","_ref","externalInputRef","label","inputStyle","onChange","onBlur","createElement","inputRef","value","propTypes","PropTypes","func","string","bool","object","MarkLabel","props","_useState","useState","_useState2","_slicedToArray2","input","setInput","useCallback","node","useTheme","_useState3","_useState4","setLabel","correctness","correctnesslabel","correctlabel","target","handleBlur","debouncedLabel","useDebounce","useEffect","getBoundingClientRect","pos","leftTop","style","pointerEvents","display","alignItems","gap","secondLabelStyle","disabledInput","renderInput","labelValue","studentInputStyle","type","Fragment","marginLeft","types","GraphPropsType","_default"],"sources":["../src/mark-label.jsx"],"sourcesContent":["import React, { useCallback, useEffect, useState } from 'react';\nimport PropTypes from 'prop-types';\nimport { styled, useTheme } from '@mui/material/styles';\nimport AutosizeInput from 'react-input-autosize';\nimport { useDebounce } from './use-debounce';\nimport { types } from '@pie-lib/plot';\nimport { color } from '@pie-lib/render-ui';\nimport SvgIcon from './label-svg-icon';\n\nconst StyledInputCorrect = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.CORRECT_WITH_ICON,\n border: `solid 1px ${color.defaults.CORRECT_WITH_ICON}`,\n}));\n\nconst StyledInputIncorrect = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.INCORRECT_WITH_ICON,\n border: `solid 1px ${color.defaults.INCORRECT_WITH_ICON}`,\n}));\n\nconst StyledInputMissing = styled('div')(({ theme }) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.MISSING_WITH_ICON,\n border: `solid 1px ${color.defaults.MISSING_WITH_ICON}`,\n fontWeight: 'bold',\n}));\n\nconst StyledIncorrect = styled('div')(() => ({\n float: 'right',\n padding: 0,\n borderRadius: '4px',\n fontSize: '10px',\n backgroundColor: color.defaults.WHITE,\n color: color.defaults.INCORRECT_WITH_ICON,\n fontWeight: 'bold',\n}));\n\nconst getInputStyles = (theme, disabled, markDisabled) => ({\n float: 'right',\n padding: theme.spacing(0.5),\n fontFamily: theme.typography.fontFamily,\n fontSize: '10px',\n border: disabled\n ? `solid 1px ${color.defaults.PRIMARY_DARK}`\n : markDisabled\n ? `solid 1px ${color.disabled()}`\n : `solid 1px ${color.defaults.SECONDARY}`,\n borderRadius: '3px',\n color: markDisabled ? color.disabled() : color.defaults.PRIMARY_DARK,\n backgroundColor: color.defaults.WHITE,\n WebkitOpacity: disabled ? '1' : undefined,\n WebkitTextFillColor: markDisabled ? color.disabled() : undefined,\n});\n\nconst getStudentInputStyles = () => ({\n padding: '0',\n border: 'none',\n color: 'inherit',\n fontWeight: 'bold',\n});\n\nexport const position = (graphProps, mark, rect = { width: 0, height: 0 }) => {\n const { scale, domain, range } = graphProps;\n const shift = 5;\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 = { width: 0, height: 0 }, position) => {\n const { scale } = graphProps;\n const shift = 5;\n\n switch (position) {\n case 'bottom-right':\n return { left: scale.x(mark.x) + shift, top: scale.y(mark.y) + shift };\n case 'bottom-left':\n return { left: scale.x(mark.x) - shift - rect.width, top: scale.y(mark.y) + shift };\n case 'top-left':\n return { left: scale.x(mark.x) - shift - rect.width, top: scale.y(mark.y) - shift - rect.height };\n case 'top-right':\n return { left: scale.x(mark.x) + shift, top: scale.y(mark.y) - shift - rect.height };\n default:\n return {};\n }\n};\n\nconst LabelInput = ({ _ref, externalInputRef, label, disabled, inputStyle, onChange, onBlur }) => (\n <AutosizeInput\n inputRef={(r) => {\n _ref(r);\n externalInputRef(r);\n }}\n disabled={disabled}\n inputStyle={inputStyle}\n value={label}\n onChange={onChange}\n onBlur={onBlur}\n />\n);\n\nLabelInput.propTypes = {\n _ref: PropTypes.func,\n externalInputRef: PropTypes.func,\n label: PropTypes.string,\n disabled: PropTypes.bool,\n inputStyle: PropTypes.object,\n onChange: PropTypes.func,\n onBlur: PropTypes.func,\n};\n\nexport const MarkLabel = (props) => {\n const [input, setInput] = useState(null);\n const _ref = useCallback((node) => setInput(node));\n const theme = useTheme();\n\n const { mark, graphProps, disabled, inputRef: externalInputRef } = props;\n\n const [label, setLabel] = useState(mark.label);\n const { correctness, correctnesslabel, correctlabel } = mark;\n\n const onChange = (e) => setLabel(e.target.value);\n\n const handleBlur = useCallback(() => {\n if (label === '') {\n props.onChange('');\n }\n }, [label, props.onChange]);\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 display: 'flex',\n alignItems: 'center',\n gap: '3px',\n ...leftTop,\n };\n\n const secondLabelStyle = {\n ...style,\n top: leftTop.top + 25,\n };\n\n const disabledInput = disabled || mark.disabled;\n\n const renderInput = (inputStyle, labelValue) => (\n <LabelInput\n _ref={_ref}\n externalInputRef={externalInputRef}\n label={labelValue}\n disabled={disabledInput}\n inputStyle={inputStyle}\n onChange={onChange}\n onBlur={handleBlur}\n />\n );\n\n const studentInputStyle = getStudentInputStyles();\n\n if (correctness === 'correct' && correctnesslabel === 'correct' && correctlabel) {\n return (\n <StyledInputCorrect style={style}>\n <SvgIcon type=\"correct\" />\n {renderInput(studentInputStyle, correctlabel)}\n </StyledInputCorrect>\n );\n }\n\n if (correctness === 'correct' && correctnesslabel === 'correct' && !correctlabel) {\n return null;\n }\n\n if (correctness === 'correct' && correctnesslabel === 'incorrect') {\n return (\n <>\n <StyledInputIncorrect style={style}>\n <SvgIcon type=\"incorrect\" />\n {label === '' ? (\n <SvgIcon type=\"empty\" style={{ marginLeft: '3px' }} />\n ) : (\n renderInput(studentInputStyle, label)\n )}\n </StyledInputIncorrect>\n <StyledInputMissing style={secondLabelStyle}>{renderInput(studentInputStyle, correctlabel)}</StyledInputMissing>\n </>\n );\n }\n\n if (correctness === 'missing') {\n return <StyledInputMissing style={style}>{renderInput(studentInputStyle, label)}</StyledInputMissing>;\n }\n\n if (correctness === 'incorrect') {\n return <StyledIncorrect style={style}>{renderInput(studentInputStyle, label)}</StyledIncorrect>;\n }\n\n return <div style={style}>{renderInput(getInputStyles(theme, disabled, mark.disabled), label)}</div>;\n};\n\nMarkLabel.propTypes = {\n disabled: PropTypes.bool,\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F,WAAW,KAAK,SAAS,EAAE;IAC7B,oBAAOpI,MAAA,YAAA6G,aAAA,CAAC9C,kBAAkB;MAACgF,KAAK,EAAEA;IAAM,GAAEO,WAAW,CAACE,iBAAiB,EAAE/C,KAAK,CAAsB,CAAC;EACvG;EAEA,IAAI2B,WAAW,KAAK,WAAW,EAAE;IAC/B,oBAAOpI,MAAA,YAAA6G,aAAA,CAAC1C,eAAe;MAAC4E,KAAK,EAAEA;IAAM,GAAEO,WAAW,CAACE,iBAAiB,EAAE/C,KAAK,CAAmB,CAAC;EACjG;EAEA,oBAAOzG,MAAA,YAAA6G,aAAA;IAAKkC,KAAK,EAAEA;EAAM,GAAEO,WAAW,CAAClF,cAAc,CAACpB,KAAK,EAAEqB,QAAQ,EAAEa,IAAI,CAACb,QAAQ,CAAC,EAAEoC,KAAK,CAAO,CAAC;AACtG,CAAC;AAEDa,SAAS,CAACN,SAAS,GAAG;EACpB3C,QAAQ,EAAE4C,qBAAS,CAACG,IAAI;EACxBT,QAAQ,EAAEM,qBAAS,CAACC,IAAI;EACxBjC,UAAU,EAAE2E,WAAK,CAACC,cAAc;EAChC/C,QAAQ,EAAEG,qBAAS,CAACC,IAAI;EACxBhC,IAAI,EAAE+B,qBAAS,CAACI;AAClB,CAAC;AAAC,IAAAyC,QAAA,GAAA9E,OAAA,cAEasC,SAAS","ignoreList":[]}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _withRootEdge = require("../../shared/line/with-root-edge");
|
|
4
|
+
var _graphingUtils = require("@pie-lib/graphing-utils");
|
|
5
|
+
var _plot = require("@pie-lib/plot");
|
|
6
|
+
var _utils = require("../../../__tests__/utils");
|
|
7
|
+
var xy = _plot.utils.xy;
|
|
8
|
+
jest.mock('@pie-lib/graphing-utils', function () {
|
|
9
|
+
return {
|
|
10
|
+
buildDataPoints: jest.fn().mockReturnValue([]),
|
|
11
|
+
absoluteFromTwoPoints: jest.fn(function () {
|
|
12
|
+
return jest.fn();
|
|
13
|
+
}),
|
|
14
|
+
getAmplitudeAndFreq: jest.fn().mockReturnValue({
|
|
15
|
+
freq: 4,
|
|
16
|
+
amplitude: 1
|
|
17
|
+
})
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
jest.mock('../../shared/line/with-root-edge', function () {
|
|
21
|
+
return {
|
|
22
|
+
withRootEdge: jest.fn(),
|
|
23
|
+
rootEdgeComponent: jest.fn()
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
describe('Absolute', function () {
|
|
27
|
+
var fnBody;
|
|
28
|
+
var graphProps;
|
|
29
|
+
var root;
|
|
30
|
+
var edge;
|
|
31
|
+
var result;
|
|
32
|
+
beforeEach(function () {
|
|
33
|
+
require('../component');
|
|
34
|
+
fnBody = _withRootEdge.withRootEdge.mock.calls[0][0];
|
|
35
|
+
graphProps = (0, _utils.graphProps)();
|
|
36
|
+
root = xy(0, 0);
|
|
37
|
+
edge = xy(1, 1);
|
|
38
|
+
result = fnBody({
|
|
39
|
+
graphProps: graphProps,
|
|
40
|
+
root: root,
|
|
41
|
+
edge: edge
|
|
42
|
+
});
|
|
43
|
+
});
|
|
44
|
+
it('fnBody is not null', function () {
|
|
45
|
+
expect(fnBody).toBeDefined();
|
|
46
|
+
});
|
|
47
|
+
it('calls buildDataPoints', function () {
|
|
48
|
+
var _graphProps = graphProps,
|
|
49
|
+
domain = _graphProps.domain,
|
|
50
|
+
range = _graphProps.range;
|
|
51
|
+
expect(_graphingUtils.buildDataPoints).toHaveBeenCalledWith(domain, range, root, edge, expect.anything(), true);
|
|
52
|
+
});
|
|
53
|
+
it('calls absoluteFromTwoPoints', function () {
|
|
54
|
+
expect(_graphingUtils.absoluteFromTwoPoints).toHaveBeenCalledWith(root, edge);
|
|
55
|
+
});
|
|
56
|
+
it('returns dataPoints', function () {
|
|
57
|
+
expect(result).toEqual({
|
|
58
|
+
enableCurve: false,
|
|
59
|
+
root: root,
|
|
60
|
+
edge: edge,
|
|
61
|
+
dataPoints: []
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfd2l0aFJvb3RFZGdlIiwicmVxdWlyZSIsIl9ncmFwaGluZ1V0aWxzIiwiX3Bsb3QiLCJfdXRpbHMiLCJ4eSIsInV0aWxzIiwiamVzdCIsIm1vY2siLCJidWlsZERhdGFQb2ludHMiLCJmbiIsIm1vY2tSZXR1cm5WYWx1ZSIsImFic29sdXRlRnJvbVR3b1BvaW50cyIsImdldEFtcGxpdHVkZUFuZEZyZXEiLCJmcmVxIiwiYW1wbGl0dWRlIiwid2l0aFJvb3RFZGdlIiwicm9vdEVkZ2VDb21wb25lbnQiLCJkZXNjcmliZSIsImZuQm9keSIsImdyYXBoUHJvcHMiLCJyb290IiwiZWRnZSIsInJlc3VsdCIsImJlZm9yZUVhY2giLCJjYWxscyIsImdldEdyYXBoUHJvcHMiLCJpdCIsImV4cGVjdCIsInRvQmVEZWZpbmVkIiwiX2dyYXBoUHJvcHMiLCJkb21haW4iLCJyYW5nZSIsInRvSGF2ZUJlZW5DYWxsZWRXaXRoIiwiYW55dGhpbmciLCJ0b0VxdWFsIiwiZW5hYmxlQ3VydmUiLCJkYXRhUG9pbnRzIl0sInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL3Rvb2xzL2Fic29sdXRlL19fdGVzdHNfXy9jb21wb25lbnQudGVzdC5qc3giXSwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgd2l0aFJvb3RFZGdlIH0gZnJvbSAnLi4vLi4vc2hhcmVkL2xpbmUvd2l0aC1yb290LWVkZ2UnO1xuaW1wb3J0IHsgYWJzb2x1dGVGcm9tVHdvUG9pbnRzLCBidWlsZERhdGFQb2ludHMgfSBmcm9tICdAcGllLWxpYi9ncmFwaGluZy11dGlscyc7XG5pbXBvcnQgeyB1dGlscyB9IGZyb20g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O0FBQ0osQ0FBQyxDQUFDIiwiaWdub3JlTGlzdCI6W119
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
5
|
+
var _testUtils = require("@pie-lib/test-utils");
|
|
6
|
+
var _react = _interopRequireDefault(require("react"));
|
|
7
|
+
var _bgCircle = require("../bg-circle");
|
|
8
|
+
var _utils = require("../../../__tests__/utils");
|
|
9
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
11
|
+
describe('BgCircle', function () {
|
|
12
|
+
var onChange = jest.fn();
|
|
13
|
+
var renderComponent = function renderComponent(extras) {
|
|
14
|
+
var defaults = {
|
|
15
|
+
classes: {},
|
|
16
|
+
className: 'className',
|
|
17
|
+
onChange: onChange,
|
|
18
|
+
x: 0,
|
|
19
|
+
y: 0,
|
|
20
|
+
graphProps: (0, _utils.graphProps)()
|
|
21
|
+
};
|
|
22
|
+
var props = _objectSpread(_objectSpread({}, defaults), extras);
|
|
23
|
+
return (0, _testUtils.render)(/*#__PURE__*/_react["default"].createElement(_bgCircle.BgCircle, props));
|
|
24
|
+
};
|
|
25
|
+
describe('rendering', function () {
|
|
26
|
+
it('renders without crashing', function () {
|
|
27
|
+
var _renderComponent = renderComponent(),
|
|
28
|
+
container = _renderComponent.container;
|
|
29
|
+
expect(container.firstChild).toBeInTheDocument();
|
|
30
|
+
});
|
|
31
|
+
});
|
|
32
|
+
});
|
|
33
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJfdGVzdFV0aWxzIiwicmVxdWlyZSIsIl9yZWFjdCIsIl9pbnRlcm9wUmVxdWlyZURlZmF1bHQiLCJfYmdDaXJjbGUiLCJfdXRpbHMiLCJvd25LZXlzIiwiZSIsInIiLCJ0IiwiT2JqZWN0Iiwia2V5cyIsImdldE93blByb3BlcnR5U3ltYm9scyIsIm8iLCJmaWx0ZXIiLCJnZXRPd25Qcm9wZXJ0eURlc2NyaXB0b3IiLCJlbnVtZXJhYmxlIiwicHVzaCIsImFwcGx5IiwiX29iamVjdFNwcmVhZCIsImFyZ3VtZW50cyIsImxlbmd0aCIsImZvckVhY2giLCJfZGVmaW5lUHJvcGVydHkyIiwiZ2V0T3duUHJvcGVydHlEZXNjcmlwdG9ycyIsImRlZmluZVByb3BlcnRpZXMiLCJkZWZpbmVQcm9wZXJ0eSIsImRlc2NyaWJlIiwib25DaGFuZ2UiLCJqZXN0IiwiZm4iLCJyZW5kZXJDb21wb25lbnQiLCJleHRyYXMiLCJkZWZhdWx0cyIsImNsYXNzZXMiLCJjbGFzc05hbWUiLCJ4IiwieSIsImdyYXBoUHJvcHMiLCJwcm9wcyIsInJlbmRlciIsImNyZWF0ZUVsZW1lbnQiLCJCZ0NpcmNsZSIsIml0IiwiX3JlbmRlckNvbXBvbmVudCIsImNvbnRhaW5lciIsImV4cGVjdCIsImZpcnN0Q2hpbGQiLCJ0b0JlSW5UaGVEb2N1bWVudCJdLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy90b29scy9jaXJjbGUvX190ZXN0c19fL2JnLWNpcmNsZS50ZXN0LmpzeCJdL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