@khanacademy/perseus-editor 6.10.0 → 6.11.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/dist/components/ellipse-swatch.d.ts +2 -2
- package/dist/components/util.d.ts +5 -2
- package/dist/es/index.js +161 -160
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +161 -161
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +242 -113
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -26,9 +26,9 @@ var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
|
|
|
26
26
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
27
27
|
var Banner = require('@khanacademy/wonder-blocks-banner');
|
|
28
28
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
29
|
-
var Switch = require('@khanacademy/wonder-blocks-switch');
|
|
30
29
|
var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
|
|
31
30
|
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
31
|
+
var Switch = require('@khanacademy/wonder-blocks-switch');
|
|
32
32
|
|
|
33
33
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
34
34
|
|
|
@@ -62,12 +62,12 @@ var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
|
62
62
|
var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
|
|
63
63
|
var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
|
|
64
64
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
65
|
-
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
66
65
|
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
66
|
+
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
67
67
|
|
|
68
68
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
69
69
|
const libName = "@khanacademy/perseus-editor";
|
|
70
|
-
const libVersion = "6.
|
|
70
|
+
const libVersion = "6.11.0";
|
|
71
71
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
72
72
|
|
|
73
73
|
function _extends() {
|
|
@@ -23464,7 +23464,7 @@ class StructuredItemDiff extends React__namespace.Component {
|
|
|
23464
23464
|
|
|
23465
23465
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
23466
23466
|
const {
|
|
23467
|
-
InfoTip: InfoTip$
|
|
23467
|
+
InfoTip: InfoTip$m,
|
|
23468
23468
|
InlineIcon: InlineIcon$7
|
|
23469
23469
|
} = perseus.components;
|
|
23470
23470
|
const {
|
|
@@ -23538,7 +23538,7 @@ class HintEditor extends React__namespace.Component {
|
|
|
23538
23538
|
type: "button",
|
|
23539
23539
|
className: this.props.isFirst ? "hidden" : "",
|
|
23540
23540
|
onClick: ___default["default"].partial(this.props.onMove, -1)
|
|
23541
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconCircleArrowUp)), " ", this.props.isLast && /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
23541
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconCircleArrowUp)), " ", this.props.isLast && /*#__PURE__*/React__namespace.createElement(InfoTip$m, null, /*#__PURE__*/React__namespace.createElement("p", null, "The last hint is automatically bolded."))), /*#__PURE__*/React__namespace.createElement("input", {
|
|
23542
23542
|
type: "checkbox"
|
|
23543
23543
|
// @ts-expect-error - TS2322 - Type 'boolean | null | undefined' is not assignable to type 'boolean | undefined'.
|
|
23544
23544
|
,
|
|
@@ -23773,7 +23773,7 @@ class CombinedHintsEditor extends React__namespace.Component {
|
|
|
23773
23773
|
}
|
|
23774
23774
|
|
|
23775
23775
|
const {
|
|
23776
|
-
InfoTip: InfoTip$
|
|
23776
|
+
InfoTip: InfoTip$l
|
|
23777
23777
|
} = perseus.components;
|
|
23778
23778
|
class ItemExtrasEditor extends React__namespace.Component {
|
|
23779
23779
|
static defaultProps = {
|
|
@@ -23918,7 +23918,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement("
|
|
|
23918
23918
|
type: "checkbox",
|
|
23919
23919
|
checked: props.checked,
|
|
23920
23920
|
onChange: props.onChange
|
|
23921
|
-
})), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
23921
|
+
})), /*#__PURE__*/React__namespace.createElement(InfoTip$l, null, props.infoTip));
|
|
23922
23922
|
|
|
23923
23923
|
const ITEM_DATA_VERSION = perseus.itemDataVersion;
|
|
23924
23924
|
class ItemEditor extends React__namespace.Component {
|
|
@@ -25713,7 +25713,7 @@ class BlurInput extends React__namespace.Component {
|
|
|
25713
25713
|
|
|
25714
25714
|
/* eslint-disable no-useless-escape */
|
|
25715
25715
|
const {
|
|
25716
|
-
InfoTip: InfoTip$
|
|
25716
|
+
InfoTip: InfoTip$k,
|
|
25717
25717
|
PropCheckBox: PropCheckBox$b
|
|
25718
25718
|
} = perseus.components;
|
|
25719
25719
|
const DEFAULT_WIDTH = 400;
|
|
@@ -25901,7 +25901,7 @@ class CSProgramEditor extends React__namespace.Component {
|
|
|
25901
25901
|
label: "Show Editor",
|
|
25902
25902
|
showEditor: this.props.showEditor,
|
|
25903
25903
|
onChange: this.props.onChange
|
|
25904
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
25904
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$k, null, "If you show the editor, you should use the \"full-width\" alignment to make room for the width of the editor."), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement(PropCheckBox$b, {
|
|
25905
25905
|
label: "Show Buttons",
|
|
25906
25906
|
showButtons: this.props.showButtons,
|
|
25907
25907
|
onChange: this.props.onChange
|
|
@@ -25909,7 +25909,7 @@ class CSProgramEditor extends React__namespace.Component {
|
|
|
25909
25909
|
name: "settings",
|
|
25910
25910
|
pairs: this.props.settings,
|
|
25911
25911
|
onChange: this._handleSettingsChange
|
|
25912
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
25912
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$k, null, "Settings that you add here are available to the program as an object returned by ", /*#__PURE__*/React__namespace.createElement("code", null, "Program.settings()"))));
|
|
25913
25913
|
}
|
|
25914
25914
|
}
|
|
25915
25915
|
|
|
@@ -25986,7 +25986,7 @@ class DeprecatedStandinEditor extends React__namespace.Component {
|
|
|
25986
25986
|
|
|
25987
25987
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
25988
25988
|
const {
|
|
25989
|
-
InfoTip: InfoTip$
|
|
25989
|
+
InfoTip: InfoTip$j,
|
|
25990
25990
|
InlineIcon: InlineIcon$5
|
|
25991
25991
|
} = perseus.components;
|
|
25992
25992
|
const {
|
|
@@ -26067,14 +26067,14 @@ class DropdownEditor extends React__namespace.Component {
|
|
|
26067
26067
|
className: "perseus-widget-dropdown"
|
|
26068
26068
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
26069
26069
|
className: "dropdown-info"
|
|
26070
|
-
}, "Dropdown", /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26070
|
+
}, "Dropdown", /*#__PURE__*/React__namespace.createElement(InfoTip$j, null, /*#__PURE__*/React__namespace.createElement("p", null, "The drop down is useful for making inequalities in a custom format. We normally use the symbols ", "<", ",", " ", ">", ", \u2264, \u2265 (in that order) which you can copy into the choices. When possible, use the \"multiple choice\" answer type instead."))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
26071
26071
|
className: "dropdown-placeholder"
|
|
26072
26072
|
}, /*#__PURE__*/React__namespace.createElement("input", {
|
|
26073
26073
|
type: "text",
|
|
26074
26074
|
placeholder: "Placeholder value",
|
|
26075
26075
|
value: this.props.placeholder,
|
|
26076
26076
|
onChange: this.onPlaceholderChange
|
|
26077
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26077
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$j, null, /*#__PURE__*/React__namespace.createElement("p", null, "This value will appear as the drop down default. It should give the user some indication of the values available in the drop down itself, e.g., Yes/No/Maybe."))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
26078
26078
|
className: "clearfix"
|
|
26079
26079
|
}), /*#__PURE__*/React__namespace.createElement("ul", {
|
|
26080
26080
|
className: "dropdown-choices"
|
|
@@ -26608,7 +26608,7 @@ const SortableItem = createReactClass__default["default"]({
|
|
|
26608
26608
|
});
|
|
26609
26609
|
|
|
26610
26610
|
const {
|
|
26611
|
-
InfoTip: InfoTip$
|
|
26611
|
+
InfoTip: InfoTip$i,
|
|
26612
26612
|
PropCheckBox: PropCheckBox$a
|
|
26613
26613
|
} = perseus.components;
|
|
26614
26614
|
|
|
@@ -26734,11 +26734,11 @@ class ExpressionEditor extends React__namespace.Component {
|
|
|
26734
26734
|
onChange: this.props.onChange,
|
|
26735
26735
|
labelAlignment: "right",
|
|
26736
26736
|
label: "Use \xD7 for rendering multiplication instead of a center dot."
|
|
26737
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26737
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "For pre-algebra problems this option displays multiplication as \\times instead of \\cdot in both the rendered output and the acceptable formats examples."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Function variables: ", /*#__PURE__*/React__namespace.createElement("input", {
|
|
26738
26738
|
type: "text",
|
|
26739
26739
|
defaultValue: this.props.functions.join(" "),
|
|
26740
26740
|
onChange: this.handleFunctions
|
|
26741
|
-
})), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26741
|
+
})), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "Single-letter variables listed here will be interpreted as functions. This let us know that f(x) means \"f of x\" and not \"f times x\"."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, "Button sets:"), buttonSetChoices), /*#__PURE__*/React__namespace.createElement("h3", {
|
|
26742
26742
|
className: "expression-editor-h3"
|
|
26743
26743
|
}, "Answers"), /*#__PURE__*/React__namespace.createElement("p", {
|
|
26744
26744
|
style: {
|
|
@@ -26952,14 +26952,14 @@ class AnswerOption extends React__namespace.Component {
|
|
|
26952
26952
|
onChange: this.props.onChange,
|
|
26953
26953
|
labelAlignment: "right",
|
|
26954
26954
|
label: "Answer expression must have the same form."
|
|
26955
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26955
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "The student's answer must be in the same form. Commutativity and excess negative signs are ignored."))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
26956
26956
|
className: "answer-option"
|
|
26957
26957
|
}, /*#__PURE__*/React__namespace.createElement(PropCheckBox$a, {
|
|
26958
26958
|
simplify: this.props.simplify,
|
|
26959
26959
|
onChange: this.props.onChange,
|
|
26960
26960
|
labelAlignment: "right",
|
|
26961
26961
|
label: "Answer expression must be fully expanded and simplified."
|
|
26962
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
26962
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$i, null, /*#__PURE__*/React__namespace.createElement("p", null, "The student's answer must be fully expanded and simplified. Answering this equation (x^2+2x+1) with this factored equation (x+1)^2 will render this response \"Your answer is not fully expanded and simplified.\""))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
26963
26963
|
className: "remove-container"
|
|
26964
26964
|
}, removeButton)));
|
|
26965
26965
|
}
|
|
@@ -27184,7 +27184,7 @@ const setArrayItem = (list, i, value) => [...list.slice(0, i), value, ...list.sl
|
|
|
27184
27184
|
/* eslint-disable react/forbid-prop-types, react/no-unsafe */
|
|
27185
27185
|
const {
|
|
27186
27186
|
ButtonGroup: ButtonGroup$4,
|
|
27187
|
-
InfoTip: InfoTip$
|
|
27187
|
+
InfoTip: InfoTip$h,
|
|
27188
27188
|
PropCheckBox: PropCheckBox$9,
|
|
27189
27189
|
RangeInput: RangeInput$6
|
|
27190
27190
|
} = perseus.components;
|
|
@@ -27645,7 +27645,7 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27645
27645
|
},
|
|
27646
27646
|
onKeyPress: this.changeBackgroundUrl,
|
|
27647
27647
|
onBlur: this.changeBackgroundUrl
|
|
27648
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
27648
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$h, null, /*#__PURE__*/React__namespace.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background.")))), ___default["default"].contains(this.props.editableSettings, "measure") && /*#__PURE__*/React__namespace.createElement("div", {
|
|
27649
27649
|
className: "misc-settings"
|
|
27650
27650
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27651
27651
|
className: "perseus-widget-row"
|
|
@@ -27683,7 +27683,7 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27683
27683
|
});
|
|
27684
27684
|
|
|
27685
27685
|
const {
|
|
27686
|
-
InfoTip: InfoTip$
|
|
27686
|
+
InfoTip: InfoTip$g,
|
|
27687
27687
|
MultiButtonGroup: MultiButtonGroup$1
|
|
27688
27688
|
} = perseus.components;
|
|
27689
27689
|
const {
|
|
@@ -27757,7 +27757,7 @@ class GrapherEditor extends React__namespace.Component {
|
|
|
27757
27757
|
className: "perseus-error"
|
|
27758
27758
|
}, this.props.graph.valid);
|
|
27759
27759
|
}
|
|
27760
|
-
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, "Correct answer", " ", /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
27760
|
+
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, "Correct answer", " ", /*#__PURE__*/React__namespace.createElement(InfoTip$g, null, /*#__PURE__*/React__namespace.createElement("p", null, "Graph the correct answer in the graph below and ensure the equation or point coordinates displayed represent the correct answer.")), " ", ": ", equationString), /*#__PURE__*/React__namespace.createElement(GraphSettings, {
|
|
27761
27761
|
editableSettings: ["graph", "snap", "image"],
|
|
27762
27762
|
box: getInteractiveBoxFromSizeClass$1(sizeClass),
|
|
27763
27763
|
range: this.props.graph.range,
|
|
@@ -28032,7 +28032,7 @@ class IframeEditor extends React__namespace.Component {
|
|
|
28032
28032
|
|
|
28033
28033
|
/* eslint-disable jsx-a11y/anchor-is-valid, react/sort-comp */
|
|
28034
28034
|
const {
|
|
28035
|
-
InfoTip: InfoTip$
|
|
28035
|
+
InfoTip: InfoTip$f,
|
|
28036
28036
|
InlineIcon: InlineIcon$3,
|
|
28037
28037
|
RangeInput: RangeInput$5
|
|
28038
28038
|
} = perseus.components;
|
|
@@ -28089,7 +28089,7 @@ class ImageEditor extends React__namespace.Component {
|
|
|
28089
28089
|
style: {
|
|
28090
28090
|
width: "100%"
|
|
28091
28091
|
}
|
|
28092
|
-
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("div", null, "Dimensions:"), /*#__PURE__*/React__namespace.createElement("p", null, backgroundImage.width, "x", backgroundImage.height))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("div", null, "Alt text:", /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
28092
|
+
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("div", null, "Dimensions:"), /*#__PURE__*/React__namespace.createElement("p", null, backgroundImage.width, "x", backgroundImage.height))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("div", null, "Alt text:", /*#__PURE__*/React__namespace.createElement(InfoTip$f, null, "This is important for screenreaders. The content of this alt text will be formatted as markdown (tables, emphasis, etc. are supported).")), /*#__PURE__*/React__namespace.createElement(Editor, {
|
|
28093
28093
|
apiOptions: this.props.apiOptions,
|
|
28094
28094
|
content: this.props.alt,
|
|
28095
28095
|
onChange: props => {
|
|
@@ -28113,7 +28113,7 @@ class ImageEditor extends React__namespace.Component {
|
|
|
28113
28113
|
}, this.state.backgroundImageError);
|
|
28114
28114
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
28115
28115
|
className: "perseus-image-editor"
|
|
28116
|
-
}, /*#__PURE__*/React__namespace.createElement("label", null, "Image url:", /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
28116
|
+
}, /*#__PURE__*/React__namespace.createElement("label", null, "Image url:", /*#__PURE__*/React__namespace.createElement(InfoTip$f, null, "Paste an image or graphie image URL."), this.state.backgroundImageError && backgroundImageErrorText, /*#__PURE__*/React__namespace.createElement(BlurInput, {
|
|
28117
28117
|
value: backgroundImage.url || "",
|
|
28118
28118
|
style: {
|
|
28119
28119
|
width: 332
|
|
@@ -28269,7 +28269,7 @@ class ImageEditor extends React__namespace.Component {
|
|
|
28269
28269
|
|
|
28270
28270
|
/* eslint-disable react/sort-comp */
|
|
28271
28271
|
const {
|
|
28272
|
-
InfoTip: InfoTip$
|
|
28272
|
+
InfoTip: InfoTip$e
|
|
28273
28273
|
} = perseus.components;
|
|
28274
28274
|
const answerTypes = {
|
|
28275
28275
|
number: {
|
|
@@ -28349,7 +28349,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28349
28349
|
value: "optional"
|
|
28350
28350
|
}, "will be accepted"), /*#__PURE__*/React__namespace.createElement("option", {
|
|
28351
28351
|
value: "enforced"
|
|
28352
|
-
}, "will be marked wrong"))), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
28352
|
+
}, "will be marked wrong"))), /*#__PURE__*/React__namespace.createElement(InfoTip$e, null, /*#__PURE__*/React__namespace.createElement("p", null, "Normally select \"will not be graded\". This will give the user a message saying the answer is correct but not simplified. The user will then have to simplify it and re-enter, but will not be penalized. (5th grade and anything after)"), /*#__PURE__*/React__namespace.createElement("p", null, "Select \"will be accepted\" only if the user is not expected to know how to simplify fractions yet. (Anything prior to 5th grade)"), /*#__PURE__*/React__namespace.createElement("p", null, "Select \"will be marked wrong\" only if we are specifically assessing the ability to simplify."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
28353
28353
|
type: "checkbox",
|
|
28354
28354
|
checked: this.props.inexact,
|
|
28355
28355
|
onChange: e => {
|
|
@@ -28385,7 +28385,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28385
28385
|
});
|
|
28386
28386
|
},
|
|
28387
28387
|
"aria-label": "Answer type"
|
|
28388
|
-
}, answerTypeOptions), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
28388
|
+
}, answerTypeOptions), /*#__PURE__*/React__namespace.createElement(InfoTip$e, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use the default \"Numbers\" unless the answer must be in a specific form (e.g., question is about converting decimals to fractions)."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Width", " ", /*#__PURE__*/React__namespace.createElement("select", {
|
|
28389
28389
|
value: this.props.size,
|
|
28390
28390
|
onChange: e => {
|
|
28391
28391
|
// @ts-expect-error - TS2322 - Type 'string' is not assignable to type '"small" | "normal" | undefined'.
|
|
@@ -28397,7 +28397,7 @@ class InputNumberEditor extends React__namespace.Component {
|
|
|
28397
28397
|
value: "normal"
|
|
28398
28398
|
}, "Normal (80px)"), /*#__PURE__*/React__namespace.createElement("option", {
|
|
28399
28399
|
value: "small"
|
|
28400
|
-
}, "Small (40px)"))), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
28400
|
+
}, "Small (40px)"))), /*#__PURE__*/React__namespace.createElement(InfoTip$e, null, /*#__PURE__*/React__namespace.createElement("p", null, "Use size \"Normal\" for all text boxes, unless there are multiple text boxes in one line and the answer area is too narrow to fit them."))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
28401
28401
|
type: "checkbox",
|
|
28402
28402
|
checked: this.props.rightAlign,
|
|
28403
28403
|
onChange: e => {
|
|
@@ -29664,7 +29664,7 @@ const styles$t = aphrodite.StyleSheet.create({
|
|
|
29664
29664
|
/* eslint-disable react/forbid-prop-types, react/no-unsafe */
|
|
29665
29665
|
const {
|
|
29666
29666
|
ButtonGroup: ButtonGroup$2,
|
|
29667
|
-
InfoTip: InfoTip$
|
|
29667
|
+
InfoTip: InfoTip$d,
|
|
29668
29668
|
PropCheckBox: PropCheckBox$7,
|
|
29669
29669
|
RangeInput: RangeInput$4
|
|
29670
29670
|
} = perseus.components;
|
|
@@ -30117,7 +30117,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
30117
30117
|
},
|
|
30118
30118
|
onKeyPress: this.changeBackgroundUrl,
|
|
30119
30119
|
onBlur: this.changeBackgroundUrl
|
|
30120
|
-
}), /*#__PURE__*/React__namespace.createElement(InfoTip$
|
|
30120
|
+
}), /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, /*#__PURE__*/React__namespace.createElement("p", null, "Create an image in graphie, or use the \"Add image\" function to create a background."))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30121
30121
|
style: styles$s.rulerSection
|
|
30122
30122
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30123
30123
|
style: styles$s.checkboxRow
|
|
@@ -30344,64 +30344,137 @@ const styles$r = aphrodite.StyleSheet.create({
|
|
|
30344
30344
|
}
|
|
30345
30345
|
});
|
|
30346
30346
|
|
|
30347
|
-
|
|
30348
|
-
|
|
30349
|
-
|
|
30350
|
-
|
|
30347
|
+
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
30348
|
+
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
30349
|
+
//
|
|
30350
|
+
// There is a bug in Chrome related to sticky positioning and
|
|
30351
|
+
// focus: When a child of an element with sticky positioning is
|
|
30352
|
+
// focused with the focus() method, the scrollable area
|
|
30353
|
+
// containing that element will scroll to the top (even though
|
|
30354
|
+
// the element is already visble on the page). For a dropdown
|
|
30355
|
+
// this means that the area will be scrolled to the top when
|
|
30356
|
+
// the user interacts with the dropdown (since we actively
|
|
30357
|
+
// manage dropdown header and option focus for keyboard users).
|
|
30358
|
+
//
|
|
30359
|
+
// To work around this bug the `preventScroll` focus option is
|
|
30360
|
+
// used.
|
|
30361
|
+
//
|
|
30362
|
+
// Using `focusOptions` is an experimental browser feature
|
|
30363
|
+
// "that should not be used in production code". However, since
|
|
30364
|
+
// Chrome is the only browser we support that exhibits this
|
|
30365
|
+
// buggy behavior and using `focusOptions` works around the
|
|
30366
|
+
// bug, it is perfectly reasonable to use the feature in this
|
|
30367
|
+
// case. We are not relying on the effect of the
|
|
30368
|
+
// `preventScroll` option otherwise.
|
|
30369
|
+
//
|
|
30370
|
+
// focusOptions documentation:
|
|
30371
|
+
//
|
|
30372
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
30373
|
+
//
|
|
30374
|
+
// Note that there could be cases where we want default focus() behavior.
|
|
30375
|
+
// One that comes to mind is a dropdown with a long list of options that
|
|
30376
|
+
// might be rendered off screen when opened. With this workaround the
|
|
30377
|
+
// selected option would not be scrolled into view if the option is near
|
|
30378
|
+
// the end of the list. We're not aware of any uses of the dropdown where
|
|
30379
|
+
// this is an issue, however, so there isn't currently a way to out of the
|
|
30380
|
+
// `preventScroll` behavior.
|
|
30381
|
+
|
|
30382
|
+
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element'.
|
|
30383
|
+
element.focus({
|
|
30384
|
+
preventScroll: true
|
|
30385
|
+
});
|
|
30386
|
+
}
|
|
30387
|
+
const DEFAULT_COLOR = "grayH";
|
|
30388
|
+
function getDefaultFigureForType(type) {
|
|
30389
|
+
switch (type) {
|
|
30390
|
+
case "point":
|
|
30391
|
+
return {
|
|
30392
|
+
type: "point",
|
|
30393
|
+
coord: [0, 0],
|
|
30394
|
+
color: DEFAULT_COLOR,
|
|
30395
|
+
filled: true
|
|
30396
|
+
};
|
|
30397
|
+
case "line":
|
|
30398
|
+
return {
|
|
30399
|
+
type: "line",
|
|
30400
|
+
kind: "line",
|
|
30401
|
+
points: [getDefaultFigureForType("point"), {
|
|
30402
|
+
...getDefaultFigureForType("point"),
|
|
30403
|
+
coord: [2, 2]
|
|
30404
|
+
}],
|
|
30405
|
+
color: DEFAULT_COLOR,
|
|
30406
|
+
lineStyle: "solid",
|
|
30407
|
+
showPoint1: false,
|
|
30408
|
+
showPoint2: false
|
|
30409
|
+
};
|
|
30410
|
+
case "vector":
|
|
30411
|
+
return {
|
|
30412
|
+
type: "vector",
|
|
30413
|
+
points: [[0, 0], [2, 2]],
|
|
30414
|
+
color: DEFAULT_COLOR
|
|
30415
|
+
};
|
|
30416
|
+
case "ellipse":
|
|
30417
|
+
return {
|
|
30418
|
+
type: "ellipse",
|
|
30419
|
+
center: [0, 0],
|
|
30420
|
+
radius: [1, 1],
|
|
30421
|
+
angle: 0,
|
|
30422
|
+
color: DEFAULT_COLOR,
|
|
30423
|
+
fillStyle: "none",
|
|
30424
|
+
strokeStyle: "solid"
|
|
30425
|
+
};
|
|
30426
|
+
case "polygon":
|
|
30427
|
+
return {
|
|
30428
|
+
type: "polygon",
|
|
30429
|
+
points: [[0, 2], [-1, 0], [1, 0]],
|
|
30430
|
+
color: DEFAULT_COLOR,
|
|
30431
|
+
showVertices: false,
|
|
30432
|
+
fillStyle: "none",
|
|
30433
|
+
strokeStyle: "solid"
|
|
30434
|
+
};
|
|
30435
|
+
default:
|
|
30436
|
+
throw new wonderStuffCore.UnreachableCaseError(type);
|
|
30437
|
+
}
|
|
30438
|
+
}
|
|
30439
|
+
function degreeToRadian(degrees) {
|
|
30351
30440
|
return degrees / 180 * Math.PI;
|
|
30352
|
-
}
|
|
30441
|
+
}
|
|
30442
|
+
function radianToDegree(radians) {
|
|
30443
|
+
return radians / Math.PI * 180;
|
|
30444
|
+
}
|
|
30445
|
+
|
|
30353
30446
|
const AngleInput = props => {
|
|
30354
30447
|
const {
|
|
30355
30448
|
angle,
|
|
30356
30449
|
onChange
|
|
30357
30450
|
} = props;
|
|
30358
|
-
const [angleInput, setAngleInput] = React__namespace.useState(angle.toString());
|
|
30359
|
-
const [isInDegrees, setIsInDegrees] = React__namespace.useState(false);
|
|
30451
|
+
const [angleInput, setAngleInput] = React__namespace.useState(radianToDegree(angle).toString());
|
|
30360
30452
|
function handleAngleChange(newValue) {
|
|
30361
|
-
let useDegrees = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : isInDegrees;
|
|
30362
30453
|
// Update the local state (update the input field value).
|
|
30363
30454
|
setAngleInput(newValue);
|
|
30364
|
-
|
|
30365
|
-
|
|
30366
|
-
|
|
30367
|
-
|
|
30368
|
-
if (useDegrees) {
|
|
30369
|
-
onChange(degreeToRadian(evaluatedAngle));
|
|
30370
|
-
} else {
|
|
30371
|
-
onChange(evaluatedAngle);
|
|
30372
|
-
}
|
|
30373
|
-
} catch (e) {
|
|
30374
|
-
// The user likely has not finished typing the expression.
|
|
30375
|
-
// Do nothing.
|
|
30455
|
+
|
|
30456
|
+
// If the new value is not a number, don't update the props.
|
|
30457
|
+
// If it's empty, keep the props the same value instead of setting to 0.
|
|
30458
|
+
if (isNaN(+newValue) || newValue === "") {
|
|
30376
30459
|
return;
|
|
30377
30460
|
}
|
|
30378
|
-
}
|
|
30379
|
-
function handleAngleTypeChange() {
|
|
30380
|
-
// Change the angle based on the new angle type.
|
|
30381
|
-
handleAngleChange(angleInput, !isInDegrees);
|
|
30382
30461
|
|
|
30383
|
-
// Update the
|
|
30384
|
-
|
|
30462
|
+
// Update the graph.
|
|
30463
|
+
onChange(degreeToRadian(newValue));
|
|
30385
30464
|
}
|
|
30386
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
30387
|
-
style: [styles$q.row, styles$q.spaceUnder]
|
|
30388
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30465
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30389
30466
|
tag: "label",
|
|
30390
30467
|
style: styles$q.row
|
|
30391
|
-
}, "angle", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30468
|
+
}, "angle (degrees)", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30392
30469
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30393
30470
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30471
|
+
type: "number",
|
|
30394
30472
|
value: angleInput,
|
|
30395
30473
|
onChange: handleAngleChange,
|
|
30396
30474
|
style: styles$q.textField
|
|
30397
|
-
})
|
|
30475
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30398
30476
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30399
|
-
})
|
|
30400
|
-
style: styles$q.switch
|
|
30401
|
-
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30402
|
-
onChange: handleAngleTypeChange,
|
|
30403
|
-
checked: isInDegrees
|
|
30404
|
-
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "degrees"), /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, /*#__PURE__*/React__namespace.createElement("p", null, "The angle of rotation for the ellipse (if the x radius and y radius are different)."), /*#__PURE__*/React__namespace.createElement("p", null, "Expressions will be evaluted (e.g. \"pi/2\" or \"5pi/4\").")));
|
|
30477
|
+
}));
|
|
30405
30478
|
};
|
|
30406
30479
|
const styles$q = aphrodite.StyleSheet.create({
|
|
30407
30480
|
row: {
|
|
@@ -30409,12 +30482,8 @@ const styles$q = aphrodite.StyleSheet.create({
|
|
|
30409
30482
|
flexDirection: "row",
|
|
30410
30483
|
alignItems: "center"
|
|
30411
30484
|
},
|
|
30412
|
-
switch: {
|
|
30413
|
-
marginLeft: wonderBlocksTokens.spacing.xxSmall_6,
|
|
30414
|
-
marginRight: wonderBlocksTokens.spacing.xxSmall_6
|
|
30415
|
-
},
|
|
30416
30485
|
textField: {
|
|
30417
|
-
|
|
30486
|
+
width: wonderBlocksTokens.spacing.xxxLarge_64
|
|
30418
30487
|
}
|
|
30419
30488
|
});
|
|
30420
30489
|
|
|
@@ -30571,7 +30640,7 @@ const EllipseSwatch = props => {
|
|
|
30571
30640
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30572
30641
|
style: [styles$m.innerCircle, {
|
|
30573
30642
|
backgroundColor: perseus.lockedFigureColors[color],
|
|
30574
|
-
opacity: perseus.
|
|
30643
|
+
opacity: perseus.lockedFigureFillStyles[fillStyle]
|
|
30575
30644
|
}]
|
|
30576
30645
|
}));
|
|
30577
30646
|
};
|
|
@@ -30751,7 +30820,7 @@ const LockedEllipseSettings = props => {
|
|
|
30751
30820
|
// Placeholder is required, but never gets used.
|
|
30752
30821
|
,
|
|
30753
30822
|
placeholder: ""
|
|
30754
|
-
}, Object.keys(perseus.
|
|
30823
|
+
}, Object.keys(perseus.lockedFigureFillStyles).map(option => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30755
30824
|
key: option,
|
|
30756
30825
|
value: option,
|
|
30757
30826
|
label: option
|
|
@@ -31062,6 +31131,7 @@ const LockedLineSettings = props => {
|
|
|
31062
31131
|
};
|
|
31063
31132
|
const styles$f = aphrodite.StyleSheet.create({
|
|
31064
31133
|
row: {
|
|
31134
|
+
display: "flex",
|
|
31065
31135
|
flexDirection: "row",
|
|
31066
31136
|
alignItems: "center"
|
|
31067
31137
|
},
|
|
@@ -31280,90 +31350,6 @@ const LockedFigureSettings = props => {
|
|
|
31280
31350
|
return null;
|
|
31281
31351
|
};
|
|
31282
31352
|
|
|
31283
|
-
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
31284
|
-
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
31285
|
-
//
|
|
31286
|
-
// There is a bug in Chrome related to sticky positioning and
|
|
31287
|
-
// focus: When a child of an element with sticky positioning is
|
|
31288
|
-
// focused with the focus() method, the scrollable area
|
|
31289
|
-
// containing that element will scroll to the top (even though
|
|
31290
|
-
// the element is already visble on the page). For a dropdown
|
|
31291
|
-
// this means that the area will be scrolled to the top when
|
|
31292
|
-
// the user interacts with the dropdown (since we actively
|
|
31293
|
-
// manage dropdown header and option focus for keyboard users).
|
|
31294
|
-
//
|
|
31295
|
-
// To work around this bug the `preventScroll` focus option is
|
|
31296
|
-
// used.
|
|
31297
|
-
//
|
|
31298
|
-
// Using `focusOptions` is an experimental browser feature
|
|
31299
|
-
// "that should not be used in production code". However, since
|
|
31300
|
-
// Chrome is the only browser we support that exhibits this
|
|
31301
|
-
// buggy behavior and using `focusOptions` works around the
|
|
31302
|
-
// bug, it is perfectly reasonable to use the feature in this
|
|
31303
|
-
// case. We are not relying on the effect of the
|
|
31304
|
-
// `preventScroll` option otherwise.
|
|
31305
|
-
//
|
|
31306
|
-
// focusOptions documentation:
|
|
31307
|
-
//
|
|
31308
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
31309
|
-
//
|
|
31310
|
-
// Note that there could be cases where we want default focus() behavior.
|
|
31311
|
-
// One that comes to mind is a dropdown with a long list of options that
|
|
31312
|
-
// might be rendered off screen when opened. With this workaround the
|
|
31313
|
-
// selected option would not be scrolled into view if the option is near
|
|
31314
|
-
// the end of the list. We're not aware of any uses of the dropdown where
|
|
31315
|
-
// this is an issue, however, so there isn't currently a way to out of the
|
|
31316
|
-
// `preventScroll` behavior.
|
|
31317
|
-
|
|
31318
|
-
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element'.
|
|
31319
|
-
element.focus({
|
|
31320
|
-
preventScroll: true
|
|
31321
|
-
});
|
|
31322
|
-
}
|
|
31323
|
-
const DEFAULT_COLOR = "grayH";
|
|
31324
|
-
function getDefaultFigureForType(type) {
|
|
31325
|
-
switch (type) {
|
|
31326
|
-
case "point":
|
|
31327
|
-
return {
|
|
31328
|
-
type: "point",
|
|
31329
|
-
coord: [0, 0],
|
|
31330
|
-
color: DEFAULT_COLOR,
|
|
31331
|
-
filled: true
|
|
31332
|
-
};
|
|
31333
|
-
case "line":
|
|
31334
|
-
return {
|
|
31335
|
-
type: "line",
|
|
31336
|
-
kind: "line",
|
|
31337
|
-
points: [getDefaultFigureForType("point"), {
|
|
31338
|
-
...getDefaultFigureForType("point"),
|
|
31339
|
-
coord: [2, 2]
|
|
31340
|
-
}],
|
|
31341
|
-
color: DEFAULT_COLOR,
|
|
31342
|
-
lineStyle: "solid",
|
|
31343
|
-
showPoint1: false,
|
|
31344
|
-
showPoint2: false
|
|
31345
|
-
};
|
|
31346
|
-
case "ellipse":
|
|
31347
|
-
return {
|
|
31348
|
-
type: "ellipse",
|
|
31349
|
-
center: [0, 0],
|
|
31350
|
-
radius: [1, 1],
|
|
31351
|
-
angle: 0,
|
|
31352
|
-
color: DEFAULT_COLOR,
|
|
31353
|
-
fillStyle: "none",
|
|
31354
|
-
strokeStyle: "solid"
|
|
31355
|
-
};
|
|
31356
|
-
case "vector":
|
|
31357
|
-
return {
|
|
31358
|
-
type: "vector",
|
|
31359
|
-
points: [[0, 0], [2, 2]],
|
|
31360
|
-
color: DEFAULT_COLOR
|
|
31361
|
-
};
|
|
31362
|
-
default:
|
|
31363
|
-
throw new wonderStuffCore.UnreachableCaseError(type);
|
|
31364
|
-
}
|
|
31365
|
-
}
|
|
31366
|
-
|
|
31367
31353
|
const LockedFiguresSection = props => {
|
|
31368
31354
|
// Keep track of all figures' accordions' expanded states for the
|
|
31369
31355
|
// expand/collapse all button. Set the whole array to false initially.
|
|
@@ -31416,6 +31402,12 @@ const LockedFiguresSection = props => {
|
|
|
31416
31402
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
31417
31403
|
const showExpandButton = !!figures?.length;
|
|
31418
31404
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, figures?.map((figure, index) => {
|
|
31405
|
+
if (figure.type === "polygon") {
|
|
31406
|
+
// TODO(LEMS-1943): Implement locked polygon settings.
|
|
31407
|
+
// Remove this block once locked polygon settings are
|
|
31408
|
+
// implemented.
|
|
31409
|
+
return;
|
|
31410
|
+
}
|
|
31419
31411
|
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
31420
31412
|
key: `${uniqueId}-locked-${figure}-${index}`,
|
|
31421
31413
|
showM2Features: props.showM2Features,
|
|
@@ -31538,6 +31530,15 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31538
31530
|
UNSAFE_componentWillMount() {
|
|
31539
31531
|
DeprecationMixin.UNSAFE_componentWillMount.call(this);
|
|
31540
31532
|
}
|
|
31533
|
+
static buildGraphKey(correct) {
|
|
31534
|
+
const testGraphKey = [];
|
|
31535
|
+
for (const key in correct) {
|
|
31536
|
+
if (correct[key]) {
|
|
31537
|
+
typeof correct[key] === "number" || typeof correct[key] === "string" || typeof correct[key] === "boolean" ? testGraphKey.push(correct[key]) : testGraphKey.push(0);
|
|
31538
|
+
}
|
|
31539
|
+
}
|
|
31540
|
+
return testGraphKey.join(":");
|
|
31541
|
+
}
|
|
31541
31542
|
render() {
|
|
31542
31543
|
let graph;
|
|
31543
31544
|
let equationString;
|
|
@@ -31580,10 +31581,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31580
31581
|
});
|
|
31581
31582
|
}
|
|
31582
31583
|
};
|
|
31583
|
-
|
|
31584
31584
|
// This is used to force a remount of the graph component
|
|
31585
31585
|
// when there's a significant change
|
|
31586
|
-
const graphKey =
|
|
31586
|
+
const graphKey = InteractiveGraphEditor.buildGraphKey(correct);
|
|
31587
31587
|
graph =
|
|
31588
31588
|
/*#__PURE__*/
|
|
31589
31589
|
// There are a bunch of props that renderer.jsx passes to widgets via
|