@khanacademy/perseus-editor 6.9.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 +204 -238
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +204 -239
- package/dist/index.js.map +1 -1
- package/dist/widgets/interactive-graph-editor.d.ts +242 -113
- package/package.json +4 -4
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,80 +30344,146 @@ 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
|
-
|
|
30388
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30389
|
-
tag: "label"
|
|
30390
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30465
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30466
|
+
tag: "label",
|
|
30391
30467
|
style: styles$q.row
|
|
30392
|
-
}, "angle", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30468
|
+
}, "angle (degrees)", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30393
30469
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30394
30470
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30395
|
-
|
|
30471
|
+
type: "number",
|
|
30396
30472
|
value: angleInput,
|
|
30397
30473
|
onChange: handleAngleChange,
|
|
30398
30474
|
style: styles$q.textField
|
|
30399
|
-
})
|
|
30475
|
+
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30400
30476
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30401
|
-
})
|
|
30402
|
-
style: styles$q.row
|
|
30403
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, null, "radians"), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30404
|
-
style: styles$q.switch
|
|
30405
|
-
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30406
|
-
onChange: handleAngleTypeChange,
|
|
30407
|
-
checked: isInDegrees
|
|
30408
|
-
})), /*#__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
|
+
}));
|
|
30409
30478
|
};
|
|
30410
30479
|
const styles$q = aphrodite.StyleSheet.create({
|
|
30411
30480
|
row: {
|
|
30481
|
+
display: "flex",
|
|
30412
30482
|
flexDirection: "row",
|
|
30413
30483
|
alignItems: "center"
|
|
30414
30484
|
},
|
|
30415
|
-
switch: {
|
|
30416
|
-
marginLeft: wonderBlocksTokens.spacing.xxSmall_6,
|
|
30417
|
-
marginRight: wonderBlocksTokens.spacing.xxSmall_6
|
|
30418
|
-
},
|
|
30419
30485
|
textField: {
|
|
30420
|
-
|
|
30486
|
+
width: wonderBlocksTokens.spacing.xxxLarge_64
|
|
30421
30487
|
}
|
|
30422
30488
|
});
|
|
30423
30489
|
|
|
@@ -30455,16 +30521,14 @@ const ColorSelect = props => {
|
|
|
30455
30521
|
style,
|
|
30456
30522
|
onChange
|
|
30457
30523
|
} = props;
|
|
30458
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30459
|
-
const id = ids.get("color-select");
|
|
30460
30524
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30461
30525
|
style: [styles$o.row, style]
|
|
30462
30526
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30463
|
-
|
|
30464
|
-
style: styles$o.
|
|
30465
|
-
|
|
30466
|
-
|
|
30467
|
-
|
|
30527
|
+
tag: "label",
|
|
30528
|
+
style: styles$o.row
|
|
30529
|
+
}, "color", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30530
|
+
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30531
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30468
30532
|
selectedValue: selectedValue,
|
|
30469
30533
|
onChange: onChange
|
|
30470
30534
|
// Placeholder is required, but never gets used.
|
|
@@ -30478,15 +30542,13 @@ const ColorSelect = props => {
|
|
|
30478
30542
|
color: colorName,
|
|
30479
30543
|
decorative: true
|
|
30480
30544
|
})
|
|
30481
|
-
}, colorName))));
|
|
30545
|
+
}, colorName)))));
|
|
30482
30546
|
};
|
|
30483
30547
|
const styles$o = aphrodite.StyleSheet.create({
|
|
30484
30548
|
row: {
|
|
30549
|
+
display: "flex",
|
|
30485
30550
|
flexDirection: "row",
|
|
30486
30551
|
alignItems: "center"
|
|
30487
|
-
},
|
|
30488
|
-
label: {
|
|
30489
|
-
marginInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30490
30552
|
}
|
|
30491
30553
|
});
|
|
30492
30554
|
|
|
@@ -30503,12 +30565,6 @@ const CoordinatePairInput = props => {
|
|
|
30503
30565
|
const [coordState, setCoordState] = React__namespace.useState([
|
|
30504
30566
|
// Using strings to make it easier to work with the text fields.
|
|
30505
30567
|
coord[0].toString(), coord[1].toString()]);
|
|
30506
|
-
|
|
30507
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30508
|
-
// with their respective text fields.
|
|
30509
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30510
|
-
const xCoordId = ids.get("x-coord");
|
|
30511
|
-
const yCoordId = ids.get("y-coord");
|
|
30512
30568
|
function handleCoordChange(newValue, coordIndex) {
|
|
30513
30569
|
// Update the local state (update the input field value).
|
|
30514
30570
|
const newCoordState = [...coordState];
|
|
@@ -30529,40 +30585,38 @@ const CoordinatePairInput = props => {
|
|
|
30529
30585
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30530
30586
|
style: [styles$n.row, styles$n.spaceUnder]
|
|
30531
30587
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30532
|
-
|
|
30533
|
-
style: styles$n.
|
|
30534
|
-
|
|
30535
|
-
|
|
30536
|
-
|
|
30588
|
+
tag: "label",
|
|
30589
|
+
style: styles$n.row
|
|
30590
|
+
}, labels ? labels[0] : "x coord", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30591
|
+
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30592
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30537
30593
|
type: "number",
|
|
30538
30594
|
value: coordState[0],
|
|
30539
30595
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
30540
30596
|
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30541
|
-
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30597
|
+
})), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30542
30598
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30543
30599
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30544
|
-
|
|
30545
|
-
style: styles$n.
|
|
30546
|
-
|
|
30547
|
-
|
|
30548
|
-
|
|
30600
|
+
tag: "label",
|
|
30601
|
+
style: styles$n.row
|
|
30602
|
+
}, labels ? labels[1] : "y coord", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30603
|
+
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30604
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
30549
30605
|
type: "number",
|
|
30550
30606
|
value: coordState[1],
|
|
30551
30607
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
30552
30608
|
style: [styles$n.textField, error ? styles$n.errorField : undefined]
|
|
30553
|
-
})));
|
|
30609
|
+
}))));
|
|
30554
30610
|
};
|
|
30555
30611
|
const styles$n = aphrodite.StyleSheet.create({
|
|
30556
30612
|
row: {
|
|
30613
|
+
display: "flex",
|
|
30557
30614
|
flexDirection: "row",
|
|
30558
30615
|
alignItems: "center"
|
|
30559
30616
|
},
|
|
30560
30617
|
spaceUnder: {
|
|
30561
30618
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30562
30619
|
},
|
|
30563
|
-
label: {
|
|
30564
|
-
marginInlineEnd: wonderBlocksTokens.spacing.xxSmall_6
|
|
30565
|
-
},
|
|
30566
30620
|
textField: {
|
|
30567
30621
|
width: wonderBlocksTokens.spacing.xxxLarge_64
|
|
30568
30622
|
},
|
|
@@ -30586,7 +30640,7 @@ const EllipseSwatch = props => {
|
|
|
30586
30640
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30587
30641
|
style: [styles$m.innerCircle, {
|
|
30588
30642
|
backgroundColor: perseus.lockedFigureColors[color],
|
|
30589
|
-
opacity: perseus.
|
|
30643
|
+
opacity: perseus.lockedFigureFillStyles[fillStyle]
|
|
30590
30644
|
}]
|
|
30591
30645
|
}));
|
|
30592
30646
|
};
|
|
@@ -30704,9 +30758,6 @@ const LockedEllipseSettings = props => {
|
|
|
30704
30758
|
onChangeProps,
|
|
30705
30759
|
onRemove
|
|
30706
30760
|
} = props;
|
|
30707
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30708
|
-
const strokeSelectId = ids.get("stroke-style-select");
|
|
30709
|
-
const fillSelectId = ids.get("fill-style-select");
|
|
30710
30761
|
function handleColorChange(newValue) {
|
|
30711
30762
|
onChangeProps({
|
|
30712
30763
|
color: newValue
|
|
@@ -30758,10 +30809,10 @@ const LockedEllipseSettings = props => {
|
|
|
30758
30809
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30759
30810
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30760
30811
|
tag: "label",
|
|
30761
|
-
|
|
30762
|
-
|
|
30763
|
-
|
|
30764
|
-
|
|
30812
|
+
style: styles$j.row
|
|
30813
|
+
}, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30814
|
+
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30815
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30765
30816
|
selectedValue: fillStyle,
|
|
30766
30817
|
onChange: value => onChangeProps({
|
|
30767
30818
|
fillStyle: value
|
|
@@ -30769,18 +30820,16 @@ const LockedEllipseSettings = props => {
|
|
|
30769
30820
|
// Placeholder is required, but never gets used.
|
|
30770
30821
|
,
|
|
30771
30822
|
placeholder: ""
|
|
30772
|
-
}, Object.keys(perseus.
|
|
30823
|
+
}, Object.keys(perseus.lockedFigureFillStyles).map(option => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30773
30824
|
key: option,
|
|
30774
30825
|
value: option,
|
|
30775
30826
|
label: option
|
|
30776
|
-
}, option)))), /*#__PURE__*/React__namespace.createElement(
|
|
30777
|
-
style: styles$j.row
|
|
30778
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30827
|
+
}, option))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30779
30828
|
tag: "label",
|
|
30780
|
-
|
|
30781
|
-
|
|
30782
|
-
|
|
30783
|
-
|
|
30829
|
+
style: styles$j.row
|
|
30830
|
+
}, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30831
|
+
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30832
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
30784
30833
|
selectedValue: strokeStyle,
|
|
30785
30834
|
onChange: value => onChangeProps({
|
|
30786
30835
|
strokeStyle: value
|
|
@@ -30801,12 +30850,10 @@ const LockedEllipseSettings = props => {
|
|
|
30801
30850
|
};
|
|
30802
30851
|
const styles$j = aphrodite.StyleSheet.create({
|
|
30803
30852
|
row: {
|
|
30853
|
+
display: "flex",
|
|
30804
30854
|
flexDirection: "row",
|
|
30805
30855
|
alignItems: "center"
|
|
30806
30856
|
},
|
|
30807
|
-
label: {
|
|
30808
|
-
marginInlineEnd: wonderBlocksTokens.spacing.xxSmall_6
|
|
30809
|
-
},
|
|
30810
30857
|
spaceUnder: {
|
|
30811
30858
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
30812
30859
|
}
|
|
@@ -30966,12 +31013,6 @@ const LockedLineSettings = props => {
|
|
|
30966
31013
|
onRemove
|
|
30967
31014
|
} = props;
|
|
30968
31015
|
const [point1, point2] = points;
|
|
30969
|
-
|
|
30970
|
-
// Generate unique IDs so that the programmatic labels can be associated
|
|
30971
|
-
// with their respective text fields.
|
|
30972
|
-
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30973
|
-
const kindSelectId = ids.get("line-kind-select");
|
|
30974
|
-
const styleSelectId = ids.get("line-style-select");
|
|
30975
31016
|
const capitalizeKind = kind.charAt(0).toUpperCase() + kind.slice(1);
|
|
30976
31017
|
const lineLabel = `${capitalizeKind} (${point1.coord[0]},
|
|
30977
31018
|
${point1.coord[1]}), (${point2.coord[0]}, ${point2.coord[1]})`;
|
|
@@ -31012,14 +31053,12 @@ const LockedLineSettings = props => {
|
|
|
31012
31053
|
color: lineColor,
|
|
31013
31054
|
lineStyle: lineStyle
|
|
31014
31055
|
}))
|
|
31015
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31016
|
-
style: [styles$f.row, styles$f.spaceUnder]
|
|
31017
31056
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
31018
|
-
|
|
31019
|
-
style: styles$f.
|
|
31020
|
-
|
|
31021
|
-
|
|
31022
|
-
|
|
31057
|
+
tag: "label",
|
|
31058
|
+
style: [styles$f.row, styles$f.spaceUnder]
|
|
31059
|
+
}, "kind", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31060
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
31061
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
31023
31062
|
selectedValue: kind,
|
|
31024
31063
|
onChange: value => onChangeProps({
|
|
31025
31064
|
kind: value
|
|
@@ -31037,20 +31076,18 @@ const LockedLineSettings = props => {
|
|
|
31037
31076
|
value: "segment",
|
|
31038
31077
|
label: "segment"
|
|
31039
31078
|
}))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31040
|
-
style:
|
|
31079
|
+
style: styles$f.row
|
|
31041
31080
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
31042
31081
|
selectedValue: lineColor,
|
|
31043
31082
|
onChange: handleColorChange
|
|
31044
31083
|
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31045
31084
|
size: wonderBlocksTokens.spacing.small_12
|
|
31046
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
31085
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
31086
|
+
tag: "label",
|
|
31047
31087
|
style: styles$f.row
|
|
31048
|
-
}, /*#__PURE__*/React__namespace.createElement(
|
|
31049
|
-
|
|
31050
|
-
|
|
31051
|
-
tag: "label"
|
|
31052
|
-
}, "style"), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
31053
|
-
id: styleSelectId,
|
|
31088
|
+
}, "style", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31089
|
+
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
31090
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
31054
31091
|
selectedValue: lineStyle,
|
|
31055
31092
|
onChange: value => onChangeProps({
|
|
31056
31093
|
lineStyle: value
|
|
@@ -31094,15 +31131,13 @@ const LockedLineSettings = props => {
|
|
|
31094
31131
|
};
|
|
31095
31132
|
const styles$f = aphrodite.StyleSheet.create({
|
|
31096
31133
|
row: {
|
|
31134
|
+
display: "flex",
|
|
31097
31135
|
flexDirection: "row",
|
|
31098
31136
|
alignItems: "center"
|
|
31099
31137
|
},
|
|
31100
31138
|
spaceUnder: {
|
|
31101
31139
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
31102
31140
|
},
|
|
31103
|
-
label: {
|
|
31104
|
-
marginInlineEnd: wonderBlocksTokens.spacing.xxxSmall_4
|
|
31105
|
-
},
|
|
31106
31141
|
selectMarginOffset: {
|
|
31107
31142
|
// Align with the point settings accordions.
|
|
31108
31143
|
marginInlineEnd: -wonderBlocksTokens.spacing.xxxSmall_4
|
|
@@ -31315,90 +31350,6 @@ const LockedFigureSettings = props => {
|
|
|
31315
31350
|
return null;
|
|
31316
31351
|
};
|
|
31317
31352
|
|
|
31318
|
-
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
31319
|
-
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
31320
|
-
//
|
|
31321
|
-
// There is a bug in Chrome related to sticky positioning and
|
|
31322
|
-
// focus: When a child of an element with sticky positioning is
|
|
31323
|
-
// focused with the focus() method, the scrollable area
|
|
31324
|
-
// containing that element will scroll to the top (even though
|
|
31325
|
-
// the element is already visble on the page). For a dropdown
|
|
31326
|
-
// this means that the area will be scrolled to the top when
|
|
31327
|
-
// the user interacts with the dropdown (since we actively
|
|
31328
|
-
// manage dropdown header and option focus for keyboard users).
|
|
31329
|
-
//
|
|
31330
|
-
// To work around this bug the `preventScroll` focus option is
|
|
31331
|
-
// used.
|
|
31332
|
-
//
|
|
31333
|
-
// Using `focusOptions` is an experimental browser feature
|
|
31334
|
-
// "that should not be used in production code". However, since
|
|
31335
|
-
// Chrome is the only browser we support that exhibits this
|
|
31336
|
-
// buggy behavior and using `focusOptions` works around the
|
|
31337
|
-
// bug, it is perfectly reasonable to use the feature in this
|
|
31338
|
-
// case. We are not relying on the effect of the
|
|
31339
|
-
// `preventScroll` option otherwise.
|
|
31340
|
-
//
|
|
31341
|
-
// focusOptions documentation:
|
|
31342
|
-
//
|
|
31343
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus
|
|
31344
|
-
//
|
|
31345
|
-
// Note that there could be cases where we want default focus() behavior.
|
|
31346
|
-
// One that comes to mind is a dropdown with a long list of options that
|
|
31347
|
-
// might be rendered off screen when opened. With this workaround the
|
|
31348
|
-
// selected option would not be scrolled into view if the option is near
|
|
31349
|
-
// the end of the list. We're not aware of any uses of the dropdown where
|
|
31350
|
-
// this is an issue, however, so there isn't currently a way to out of the
|
|
31351
|
-
// `preventScroll` behavior.
|
|
31352
|
-
|
|
31353
|
-
// @ts-expect-error - TS2339 - Property 'focus' does not exist on type 'Element'.
|
|
31354
|
-
element.focus({
|
|
31355
|
-
preventScroll: true
|
|
31356
|
-
});
|
|
31357
|
-
}
|
|
31358
|
-
const DEFAULT_COLOR = "grayH";
|
|
31359
|
-
function getDefaultFigureForType(type) {
|
|
31360
|
-
switch (type) {
|
|
31361
|
-
case "point":
|
|
31362
|
-
return {
|
|
31363
|
-
type: "point",
|
|
31364
|
-
coord: [0, 0],
|
|
31365
|
-
color: DEFAULT_COLOR,
|
|
31366
|
-
filled: true
|
|
31367
|
-
};
|
|
31368
|
-
case "line":
|
|
31369
|
-
return {
|
|
31370
|
-
type: "line",
|
|
31371
|
-
kind: "line",
|
|
31372
|
-
points: [getDefaultFigureForType("point"), {
|
|
31373
|
-
...getDefaultFigureForType("point"),
|
|
31374
|
-
coord: [2, 2]
|
|
31375
|
-
}],
|
|
31376
|
-
color: DEFAULT_COLOR,
|
|
31377
|
-
lineStyle: "solid",
|
|
31378
|
-
showPoint1: false,
|
|
31379
|
-
showPoint2: false
|
|
31380
|
-
};
|
|
31381
|
-
case "ellipse":
|
|
31382
|
-
return {
|
|
31383
|
-
type: "ellipse",
|
|
31384
|
-
center: [0, 0],
|
|
31385
|
-
radius: [1, 1],
|
|
31386
|
-
angle: 0,
|
|
31387
|
-
color: DEFAULT_COLOR,
|
|
31388
|
-
fillStyle: "none",
|
|
31389
|
-
strokeStyle: "solid"
|
|
31390
|
-
};
|
|
31391
|
-
case "vector":
|
|
31392
|
-
return {
|
|
31393
|
-
type: "vector",
|
|
31394
|
-
points: [[0, 0], [2, 2]],
|
|
31395
|
-
color: DEFAULT_COLOR
|
|
31396
|
-
};
|
|
31397
|
-
default:
|
|
31398
|
-
throw new wonderStuffCore.UnreachableCaseError(type);
|
|
31399
|
-
}
|
|
31400
|
-
}
|
|
31401
|
-
|
|
31402
31353
|
const LockedFiguresSection = props => {
|
|
31403
31354
|
// Keep track of all figures' accordions' expanded states for the
|
|
31404
31355
|
// expand/collapse all button. Set the whole array to false initially.
|
|
@@ -31451,6 +31402,12 @@ const LockedFiguresSection = props => {
|
|
|
31451
31402
|
const buttonLabel = allCollapsed ? "Expand all" : "Collapse all";
|
|
31452
31403
|
const showExpandButton = !!figures?.length;
|
|
31453
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
|
+
}
|
|
31454
31411
|
return /*#__PURE__*/React__namespace.createElement(LockedFigureSettings, _extends({
|
|
31455
31412
|
key: `${uniqueId}-locked-${figure}-${index}`,
|
|
31456
31413
|
showM2Features: props.showM2Features,
|
|
@@ -31573,6 +31530,15 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31573
31530
|
UNSAFE_componentWillMount() {
|
|
31574
31531
|
DeprecationMixin.UNSAFE_componentWillMount.call(this);
|
|
31575
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
|
+
}
|
|
31576
31542
|
render() {
|
|
31577
31543
|
let graph;
|
|
31578
31544
|
let equationString;
|
|
@@ -31615,10 +31581,9 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31615
31581
|
});
|
|
31616
31582
|
}
|
|
31617
31583
|
};
|
|
31618
|
-
|
|
31619
31584
|
// This is used to force a remount of the graph component
|
|
31620
31585
|
// when there's a significant change
|
|
31621
|
-
const graphKey =
|
|
31586
|
+
const graphKey = InteractiveGraphEditor.buildGraphKey(correct);
|
|
31622
31587
|
graph =
|
|
31623
31588
|
/*#__PURE__*/
|
|
31624
31589
|
// There are a bunch of props that renderer.jsx passes to widgets via
|