@khanacademy/perseus-editor 9.0.0 → 11.0.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/all-editors.d.ts +1 -2
- package/dist/components/interactive-graph-settings.d.ts +0 -17
- package/dist/components/start-coords-line.d.ts +8 -0
- package/dist/components/start-coords-multiline.d.ts +9 -0
- package/dist/components/start-coords-settings.d.ts +9 -0
- package/dist/components/util.d.ts +2 -1
- package/dist/components/widget-editor.d.ts +1 -1
- package/dist/es/index.js +419 -754
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +411 -750
- package/dist/index.js.map +1 -1
- package/dist/util/object-utils.d.ts +1 -0
- package/dist/widgets/interactive-graph-editor.d.ts +82 -40
- package/package.json +3 -3
- package/dist/components/start-coord-settings.d.ts +0 -9
- package/dist/stateful-article-editor.d.ts +0 -10
- package/dist/widgets/unit-editor.d.ts +0 -33
package/dist/index.js
CHANGED
|
@@ -83,7 +83,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
|
|
|
83
83
|
|
|
84
84
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
85
85
|
const libName = "@khanacademy/perseus-editor";
|
|
86
|
-
const libVersion = "
|
|
86
|
+
const libVersion = "11.0.0";
|
|
87
87
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
88
88
|
|
|
89
89
|
function _extends() {
|
|
@@ -260,7 +260,7 @@ const JsonEditor = createReactClass__default["default"]({
|
|
|
260
260
|
});
|
|
261
261
|
|
|
262
262
|
const {
|
|
263
|
-
InlineIcon: InlineIcon$
|
|
263
|
+
InlineIcon: InlineIcon$a
|
|
264
264
|
} = perseus.components;
|
|
265
265
|
class SectionControlButton extends React__namespace.Component {
|
|
266
266
|
render() {
|
|
@@ -278,13 +278,13 @@ class SectionControlButton extends React__namespace.Component {
|
|
|
278
278
|
role: "button",
|
|
279
279
|
hideDefaultFocusRing: true,
|
|
280
280
|
"aria-label": title,
|
|
281
|
-
style: styles$
|
|
281
|
+
style: styles$I.button
|
|
282
282
|
}, _ref => {
|
|
283
|
-
return /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
283
|
+
return /*#__PURE__*/React__namespace.createElement(InlineIcon$a, icon);
|
|
284
284
|
});
|
|
285
285
|
}
|
|
286
286
|
}
|
|
287
|
-
const styles$
|
|
287
|
+
const styles$I = aphrodite.StyleSheet.create({
|
|
288
288
|
button: {
|
|
289
289
|
backgroundColor: wonderBlocksTokens.color.gold,
|
|
290
290
|
margin: 2,
|
|
@@ -20607,7 +20607,7 @@ const DragTarget = createReactClass__default["default"]({
|
|
|
20607
20607
|
});
|
|
20608
20608
|
|
|
20609
20609
|
const {
|
|
20610
|
-
InlineIcon: InlineIcon$
|
|
20610
|
+
InlineIcon: InlineIcon$9
|
|
20611
20611
|
} = perseus.components;
|
|
20612
20612
|
const {
|
|
20613
20613
|
iconChevronDown: iconChevronDown$1,
|
|
@@ -20717,7 +20717,7 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20717
20717
|
className: "perseus-widget-editor-title-id",
|
|
20718
20718
|
href: "#",
|
|
20719
20719
|
onClick: this._toggleWidget
|
|
20720
|
-
}, this.props.id, this.state.showWidget ? /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
20720
|
+
}, this.props.id, this.state.showWidget ? /*#__PURE__*/React__namespace.createElement(InlineIcon$9, iconChevronDown$1) : /*#__PURE__*/React__namespace.createElement(InlineIcon$9, iconChevronRight)), supportsStaticMode && /*#__PURE__*/React__namespace.createElement("input", {
|
|
20721
20721
|
type: "button"
|
|
20722
20722
|
// @ts-expect-error - TS2322 - Type '(e: Event) => void' is not assignable to type 'MouseEventHandler<HTMLInputElement>'.
|
|
20723
20723
|
,
|
|
@@ -20789,13 +20789,13 @@ class WidgetSelect extends React__namespace.Component {
|
|
|
20789
20789
|
* that collapse a region.
|
|
20790
20790
|
*/
|
|
20791
20791
|
function ToggleableCaret(props) {
|
|
20792
|
-
const iconStyle = props.isExpanded ? styles$
|
|
20792
|
+
const iconStyle = props.isExpanded ? styles$H.expanded : styles$H.collapsed;
|
|
20793
20793
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
20794
20794
|
icon: caretRight__default["default"],
|
|
20795
20795
|
style: iconStyle
|
|
20796
20796
|
});
|
|
20797
20797
|
}
|
|
20798
|
-
const styles$
|
|
20798
|
+
const styles$H = aphrodite.StyleSheet.create({
|
|
20799
20799
|
collapsed: {
|
|
20800
20800
|
transition: ".15s"
|
|
20801
20801
|
},
|
|
@@ -20825,16 +20825,16 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20825
20825
|
showErrors
|
|
20826
20826
|
} = this.state;
|
|
20827
20827
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20828
|
-
style: styles$
|
|
20828
|
+
style: styles$G.errorContainer
|
|
20829
20829
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20830
|
-
style: styles$
|
|
20830
|
+
style: styles$G.title,
|
|
20831
20831
|
onClick: this.handleToggleTexErrors
|
|
20832
20832
|
}, /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
|
|
20833
20833
|
isExpanded: showErrors
|
|
20834
20834
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20835
|
-
style: styles$
|
|
20835
|
+
style: styles$G.errorExplanation
|
|
20836
20836
|
}, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20837
|
-
style: styles$
|
|
20837
|
+
style: styles$G.error,
|
|
20838
20838
|
key: index
|
|
20839
20839
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20840
20840
|
style: {
|
|
@@ -20843,7 +20843,7 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20843
20843
|
}, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
|
|
20844
20844
|
}
|
|
20845
20845
|
}
|
|
20846
|
-
const styles$
|
|
20846
|
+
const styles$G = aphrodite.StyleSheet.create({
|
|
20847
20847
|
title: {
|
|
20848
20848
|
backgroundColor: "#eee",
|
|
20849
20849
|
fontSize: "1.25em",
|
|
@@ -21826,7 +21826,7 @@ class IframeContentRenderer extends React__namespace.Component {
|
|
|
21826
21826
|
|
|
21827
21827
|
const {
|
|
21828
21828
|
HUD: HUD$1,
|
|
21829
|
-
InlineIcon: InlineIcon$
|
|
21829
|
+
InlineIcon: InlineIcon$8
|
|
21830
21830
|
} = perseus.components;
|
|
21831
21831
|
const {
|
|
21832
21832
|
iconCircleArrowDown: iconCircleArrowDown$1,
|
|
@@ -21981,7 +21981,7 @@ class ArticleEditor extends React__namespace.Component {
|
|
|
21981
21981
|
onClick: () => {
|
|
21982
21982
|
this._handleAddSectionAfter(this._sections().length - 1);
|
|
21983
21983
|
}
|
|
21984
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
21984
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconPlus$4), " Add a section")));
|
|
21985
21985
|
}
|
|
21986
21986
|
_renderLinterHUD() {
|
|
21987
21987
|
return /*#__PURE__*/React__namespace.createElement(HUD$1, {
|
|
@@ -22134,7 +22134,7 @@ class ArticleEditor extends React__namespace.Component {
|
|
|
22134
22134
|
*/
|
|
22135
22135
|
const {
|
|
22136
22136
|
ButtonGroup: ButtonGroup$5,
|
|
22137
|
-
InlineIcon: InlineIcon$
|
|
22137
|
+
InlineIcon: InlineIcon$7
|
|
22138
22138
|
} = perseus.components;
|
|
22139
22139
|
const {
|
|
22140
22140
|
devices
|
|
@@ -22145,9 +22145,9 @@ const {
|
|
|
22145
22145
|
iconTablet
|
|
22146
22146
|
} = perseus.icons;
|
|
22147
22147
|
const ViewportResizer = props => {
|
|
22148
|
-
const phoneButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
22149
|
-
const tabletButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
22150
|
-
const desktopButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
22148
|
+
const phoneButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconMobilePhone), " Phone");
|
|
22149
|
+
const tabletButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconTablet), " Tablet");
|
|
22150
|
+
const desktopButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$7, iconDesktop), " Desktop");
|
|
22151
22151
|
|
|
22152
22152
|
// TODO(david): Allow input of custom viewport sizes.
|
|
22153
22153
|
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
@@ -23481,7 +23481,7 @@ class StructuredItemDiff extends React__namespace.Component {
|
|
|
23481
23481
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
23482
23482
|
const {
|
|
23483
23483
|
InfoTip: InfoTip$m,
|
|
23484
|
-
InlineIcon: InlineIcon$
|
|
23484
|
+
InlineIcon: InlineIcon$6
|
|
23485
23485
|
} = perseus.components;
|
|
23486
23486
|
const {
|
|
23487
23487
|
iconCircleArrowDown,
|
|
@@ -23550,11 +23550,11 @@ class HintEditor extends React__namespace.Component {
|
|
|
23550
23550
|
type: "button",
|
|
23551
23551
|
className: this.props.isLast ? "hidden" : "",
|
|
23552
23552
|
onClick: ___default["default"].partial(this.props.onMove, 1)
|
|
23553
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
23553
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconCircleArrowDown)), " ", /*#__PURE__*/React__namespace.createElement("button", {
|
|
23554
23554
|
type: "button",
|
|
23555
23555
|
className: this.props.isFirst ? "hidden" : "",
|
|
23556
23556
|
onClick: ___default["default"].partial(this.props.onMove, -1)
|
|
23557
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
23557
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, 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", {
|
|
23558
23558
|
type: "checkbox"
|
|
23559
23559
|
// @ts-expect-error - TS2322 - Type 'boolean | null | undefined' is not assignable to type 'boolean | undefined'.
|
|
23560
23560
|
,
|
|
@@ -23564,7 +23564,7 @@ class HintEditor extends React__namespace.Component {
|
|
|
23564
23564
|
type: "button",
|
|
23565
23565
|
className: "remove-hint simple-button orange",
|
|
23566
23566
|
onClick: this.props.onRemove
|
|
23567
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
23567
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconTrash$5), "Remove this hint", " ")));
|
|
23568
23568
|
}
|
|
23569
23569
|
}
|
|
23570
23570
|
/* A single hint-row containing a hint editor and preview */
|
|
@@ -23783,7 +23783,7 @@ class CombinedHintsEditor extends React__namespace.Component {
|
|
|
23783
23783
|
type: "button",
|
|
23784
23784
|
className: "add-hint simple-button orange",
|
|
23785
23785
|
onClick: this.addHint
|
|
23786
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
23786
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$6, iconPlus$3), " Add a hint"))));
|
|
23787
23787
|
/* eslint-enable max-len */
|
|
23788
23788
|
}
|
|
23789
23789
|
}
|
|
@@ -24593,12 +24593,12 @@ class SimpleButton extends React__namespace.Component {
|
|
|
24593
24593
|
...otherProps
|
|
24594
24594
|
} = this.props;
|
|
24595
24595
|
return /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
24596
|
-
className: aphrodite.css(styles$
|
|
24596
|
+
className: aphrodite.css(styles$F.baseButton, color === "green" && styles$F.green, color === "orange" && styles$F.orange),
|
|
24597
24597
|
onClick: onClick
|
|
24598
24598
|
}, otherProps), children);
|
|
24599
24599
|
}
|
|
24600
24600
|
}
|
|
24601
|
-
const styles$
|
|
24601
|
+
const styles$F = aphrodite.StyleSheet.create({
|
|
24602
24602
|
baseButton: {
|
|
24603
24603
|
top: "0",
|
|
24604
24604
|
fontSize: "11px",
|
|
@@ -24643,7 +24643,7 @@ const styles$E = aphrodite.StyleSheet.create({
|
|
|
24643
24643
|
});
|
|
24644
24644
|
|
|
24645
24645
|
const {
|
|
24646
|
-
InlineIcon: InlineIcon$
|
|
24646
|
+
InlineIcon: InlineIcon$5
|
|
24647
24647
|
} = perseus.components;
|
|
24648
24648
|
const {
|
|
24649
24649
|
iconChevronDown,
|
|
@@ -24811,23 +24811,23 @@ const LeafContainer = _ref2 => {
|
|
|
24811
24811
|
} = _ref2;
|
|
24812
24812
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24813
24813
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24814
|
-
className: aphrodite.css(styles$
|
|
24814
|
+
className: aphrodite.css(styles$E.containerHeader)
|
|
24815
24815
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24816
24816
|
depth: path.length,
|
|
24817
|
-
className: aphrodite.css(styles$
|
|
24817
|
+
className: aphrodite.css(styles$E.containerTitle)
|
|
24818
24818
|
}, capitalize(name)));
|
|
24819
24819
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24820
|
-
className: aphrodite.css(styles$
|
|
24820
|
+
className: aphrodite.css(styles$E.container)
|
|
24821
24821
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
24822
|
-
className: aphrodite.css(styles$
|
|
24822
|
+
className: aphrodite.css(styles$E.row, styles$E.rowHeading)
|
|
24823
24823
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24824
|
-
className: aphrodite.css(styles$
|
|
24824
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
24825
24825
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24826
|
-
className: "pod-title " + aphrodite.css(styles$
|
|
24826
|
+
className: "pod-title " + aphrodite.css(styles$E.containerHeader)
|
|
24827
24827
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24828
|
-
className: aphrodite.css(styles$
|
|
24828
|
+
className: aphrodite.css(styles$E.containerTitle)
|
|
24829
24829
|
}, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24830
|
-
className: aphrodite.css(styles$
|
|
24830
|
+
className: aphrodite.css(styles$E.columnRight)
|
|
24831
24831
|
}, previewHeading)), children);
|
|
24832
24832
|
};
|
|
24833
24833
|
const ArrayContainer = props => {
|
|
@@ -24840,11 +24840,11 @@ const ArrayContainer = props => {
|
|
|
24840
24840
|
actions
|
|
24841
24841
|
} = props;
|
|
24842
24842
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24843
|
-
className: aphrodite.css(styles$
|
|
24843
|
+
className: aphrodite.css(styles$E.container)
|
|
24844
24844
|
}, controls && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24845
|
-
className: aphrodite.css(styles$
|
|
24845
|
+
className: aphrodite.css(styles$E.columnLeft, styles$E.containerHeader)
|
|
24846
24846
|
}, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24847
|
-
className: aphrodite.css(styles$
|
|
24847
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
24848
24848
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
24849
24849
|
href: "javascript:void 0",
|
|
24850
24850
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24858,28 +24858,28 @@ const ObjectContainer = _ref3 => {
|
|
|
24858
24858
|
path
|
|
24859
24859
|
} = _ref3;
|
|
24860
24860
|
const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
|
|
24861
|
-
className: aphrodite.css(styles$
|
|
24861
|
+
className: aphrodite.css(styles$E.containerHeader)
|
|
24862
24862
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24863
24863
|
depth: path.length,
|
|
24864
|
-
className: aphrodite.css(styles$
|
|
24864
|
+
className: aphrodite.css(styles$E.containerTitle)
|
|
24865
24865
|
}, capitalize(name)), controls);
|
|
24866
24866
|
const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24867
|
-
className: aphrodite.css(styles$
|
|
24867
|
+
className: aphrodite.css(styles$E.containerHeader, styles$E.previewCollectionHeader)
|
|
24868
24868
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24869
24869
|
depth: path.length,
|
|
24870
|
-
className: aphrodite.css(styles$
|
|
24870
|
+
className: aphrodite.css(styles$E.containerTitle)
|
|
24871
24871
|
}, capitalize(name)));
|
|
24872
24872
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24873
24873
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24874
|
-
className: aphrodite.css(styles$
|
|
24874
|
+
className: aphrodite.css(styles$E.container)
|
|
24875
24875
|
}, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
|
|
24876
|
-
className: aphrodite.css(styles$
|
|
24876
|
+
className: aphrodite.css(styles$E.row)
|
|
24877
24877
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24878
|
-
className: aphrodite.css(styles$
|
|
24878
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
24879
24879
|
}, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24880
|
-
className: aphrodite.css(styles$
|
|
24880
|
+
className: aphrodite.css(styles$E.columnRight)
|
|
24881
24881
|
}, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24882
|
-
className: aphrodite.css(path.length > 0 && styles$
|
|
24882
|
+
className: aphrodite.css(path.length > 0 && styles$E.contentIndent)
|
|
24883
24883
|
}, children));
|
|
24884
24884
|
};
|
|
24885
24885
|
|
|
@@ -24999,11 +24999,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24999
24999
|
className: "framework-perseus"
|
|
25000
25000
|
}, lens(renderers).get(path));
|
|
25001
25001
|
return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25002
|
-
className: aphrodite.css(styles$
|
|
25002
|
+
className: aphrodite.css(styles$E.row)
|
|
25003
25003
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25004
|
-
className: aphrodite.css(styles$
|
|
25004
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
25005
25005
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25006
|
-
className: aphrodite.css(sticky && styles$
|
|
25006
|
+
className: aphrodite.css(sticky && styles$E.sticky)
|
|
25007
25007
|
},
|
|
25008
25008
|
/*#__PURE__*/
|
|
25009
25009
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -25011,9 +25011,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25011
25011
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25012
25012
|
apiOptions: apiOptions
|
|
25013
25013
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25014
|
-
className: aphrodite.css(styles$
|
|
25014
|
+
className: aphrodite.css(styles$E.columnRight)
|
|
25015
25015
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25016
|
-
className: aphrodite.css(sticky && styles$
|
|
25016
|
+
className: aphrodite.css(sticky && styles$E.sticky)
|
|
25017
25017
|
}, preview))));
|
|
25018
25018
|
});
|
|
25019
25019
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25029,13 +25029,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25029
25029
|
className: "framework-perseus"
|
|
25030
25030
|
}, lens(renderers).get(path));
|
|
25031
25031
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25032
|
-
className: aphrodite.css(styles$
|
|
25032
|
+
className: aphrodite.css(styles$E.row)
|
|
25033
25033
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25034
|
-
className: aphrodite.css(styles$
|
|
25034
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
25035
25035
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25036
|
-
className: aphrodite.css(sticky && styles$
|
|
25036
|
+
className: aphrodite.css(sticky && styles$E.sticky)
|
|
25037
25037
|
}, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
|
|
25038
|
-
className: aphrodite.css(styles$
|
|
25038
|
+
className: aphrodite.css(styles$E.hintEditor),
|
|
25039
25039
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25040
25040
|
apiOptions: apiOptions,
|
|
25041
25041
|
showTitle: false,
|
|
@@ -25050,9 +25050,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25050
25050
|
isFirst: true,
|
|
25051
25051
|
isLast: true
|
|
25052
25052
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25053
|
-
className: aphrodite.css(styles$
|
|
25053
|
+
className: aphrodite.css(styles$E.columnRight)
|
|
25054
25054
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25055
|
-
className: aphrodite.css(sticky && styles$
|
|
25055
|
+
className: aphrodite.css(sticky && styles$E.sticky)
|
|
25056
25056
|
}, preview)));
|
|
25057
25057
|
});
|
|
25058
25058
|
const TagsNodeContent = props => {
|
|
@@ -25069,9 +25069,9 @@ const TagsNodeContent = props => {
|
|
|
25069
25069
|
return null;
|
|
25070
25070
|
}
|
|
25071
25071
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25072
|
-
className: aphrodite.css(styles$
|
|
25072
|
+
className: aphrodite.css(styles$E.columnLeft)
|
|
25073
25073
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25074
|
-
className: aphrodite.css(styles$
|
|
25074
|
+
className: aphrodite.css(styles$E.tagsEditor)
|
|
25075
25075
|
}, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
|
|
25076
25076
|
value: data,
|
|
25077
25077
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25102,31 +25102,31 @@ const ArrayNodeContent = props => {
|
|
|
25102
25102
|
const subpath = path.concat(i);
|
|
25103
25103
|
const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25104
25104
|
key: "moveArrayElementUp",
|
|
25105
|
-
className: aphrodite.css(styles$
|
|
25105
|
+
className: aphrodite.css(styles$E.control)
|
|
25106
25106
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25107
25107
|
color: "orange",
|
|
25108
25108
|
title: "Move up",
|
|
25109
25109
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25110
25110
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25111
|
-
className: aphrodite.css(styles$
|
|
25112
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
25111
|
+
className: aphrodite.css(styles$E.verticalFlip)
|
|
25112
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25113
25113
|
key: "moveArrayElementDown",
|
|
25114
|
-
className: aphrodite.css(styles$
|
|
25114
|
+
className: aphrodite.css(styles$E.control)
|
|
25115
25115
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25116
25116
|
color: "orange",
|
|
25117
25117
|
title: "Move down",
|
|
25118
25118
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25119
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
25119
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25120
25120
|
key: "removeArrayElement",
|
|
25121
|
-
className: aphrodite.css(styles$
|
|
25121
|
+
className: aphrodite.css(styles$E.control)
|
|
25122
25122
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25123
25123
|
color: "orange",
|
|
25124
25124
|
title: "Delete",
|
|
25125
25125
|
onClick: () => actions.removeArrayElement(subpath)
|
|
25126
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
25126
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconTrash$4)))];
|
|
25127
25127
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25128
25128
|
key: i,
|
|
25129
|
-
className: aphrodite.css(styles$
|
|
25129
|
+
className: aphrodite.css(styles$E.arrayElement, !elementIsLeaf && styles$E.arrayElementAndNotLeaf)
|
|
25130
25130
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25131
25131
|
key: i,
|
|
25132
25132
|
shape: shape.elementShape,
|
|
@@ -25152,7 +25152,7 @@ const ObjectNodeContent = props => {
|
|
|
25152
25152
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25153
25153
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
|
|
25154
25154
|
key: subkey,
|
|
25155
|
-
className: aphrodite.css(styles$
|
|
25155
|
+
className: aphrodite.css(styles$E.objectElement)
|
|
25156
25156
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25157
25157
|
shape: shape.shape[subkey],
|
|
25158
25158
|
data: data[subkey],
|
|
@@ -25322,7 +25322,7 @@ class MultiRendererEditor extends React__namespace.Component {
|
|
|
25322
25322
|
}, this._renderContent());
|
|
25323
25323
|
}
|
|
25324
25324
|
}
|
|
25325
|
-
const styles$
|
|
25325
|
+
const styles$E = aphrodite.StyleSheet.create({
|
|
25326
25326
|
// This is used in a number of places throughout this file.
|
|
25327
25327
|
container: {},
|
|
25328
25328
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -25424,116 +25424,6 @@ const styles$D = aphrodite.StyleSheet.create({
|
|
|
25424
25424
|
}
|
|
25425
25425
|
});
|
|
25426
25426
|
|
|
25427
|
-
/* eslint-disable react/no-unsafe */
|
|
25428
|
-
const StatefulArticleEditor = createReactClass__default["default"]({
|
|
25429
|
-
displayName: "StatefulArticleEditor",
|
|
25430
|
-
getInitialState: function () {
|
|
25431
|
-
return ___default["default"]({}).extend(this.props, {
|
|
25432
|
-
mode: "edit",
|
|
25433
|
-
onChange: this.handleChange,
|
|
25434
|
-
ref: "editor",
|
|
25435
|
-
screen: "phone"
|
|
25436
|
-
});
|
|
25437
|
-
},
|
|
25438
|
-
componentDidMount: function () {
|
|
25439
|
-
// TODO(scottgrant): This is a hack to remove the deprecated call to
|
|
25440
|
-
// this.isMounted() but is still considered an anti-pattern.
|
|
25441
|
-
this._isMounted = true;
|
|
25442
|
-
},
|
|
25443
|
-
// getInitialState isn't called if the react component is re-rendered
|
|
25444
|
-
// in-place on the dom, in which case this is called instead, so we
|
|
25445
|
-
// need to update the state here.
|
|
25446
|
-
// (This component is currently re-rendered by the "Add image" button.)
|
|
25447
|
-
UNSAFE_componentWillReceiveProps: function (nextProps) {
|
|
25448
|
-
// be careful not to overwrite our onChange and ref
|
|
25449
|
-
this.setState(___default["default"](nextProps).omit("onChange", "ref"));
|
|
25450
|
-
},
|
|
25451
|
-
componentWillUnmount: function () {
|
|
25452
|
-
this._isMounted = false;
|
|
25453
|
-
},
|
|
25454
|
-
getSaveWarnings: function () {
|
|
25455
|
-
// eslint-disable-next-line react/no-string-refs
|
|
25456
|
-
return this.refs.editor.getSaveWarnings();
|
|
25457
|
-
},
|
|
25458
|
-
serialize: function () {
|
|
25459
|
-
// eslint-disable-next-line react/no-string-refs
|
|
25460
|
-
return this.refs.editor.serialize();
|
|
25461
|
-
},
|
|
25462
|
-
handleChange: function (newState, cb) {
|
|
25463
|
-
if (this._isMounted) {
|
|
25464
|
-
this.setState(newState, cb);
|
|
25465
|
-
}
|
|
25466
|
-
},
|
|
25467
|
-
scorePreview: function () {
|
|
25468
|
-
// eslint-disable-next-line react/no-string-refs
|
|
25469
|
-
return this.refs.editor.scorePreview();
|
|
25470
|
-
},
|
|
25471
|
-
render: function () {
|
|
25472
|
-
const {
|
|
25473
|
-
mode,
|
|
25474
|
-
screen
|
|
25475
|
-
} = this.state;
|
|
25476
|
-
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25477
|
-
style: styles$C.controlBar
|
|
25478
|
-
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
25479
|
-
style: styles$C.controls
|
|
25480
|
-
}, "Mode:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25481
|
-
onClick: () => this.setState({
|
|
25482
|
-
mode: "edit"
|
|
25483
|
-
}),
|
|
25484
|
-
style: mode === "edit" ? styles$C.controlSelected : styles$C.control
|
|
25485
|
-
}, "EDIT"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25486
|
-
onClick: () => this.setState({
|
|
25487
|
-
mode: "preview"
|
|
25488
|
-
}),
|
|
25489
|
-
style: mode === "preview" ? styles$C.controlSelected : styles$C.control
|
|
25490
|
-
}, "PREVIEW"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25491
|
-
onClick: () => this.setState({
|
|
25492
|
-
mode: "json"
|
|
25493
|
-
}),
|
|
25494
|
-
style: mode === "json" ? styles$C.controlSelected : styles$C.control
|
|
25495
|
-
}, "JSON")), /*#__PURE__*/React__namespace.createElement("span", {
|
|
25496
|
-
style: styles$C.controls
|
|
25497
|
-
}, "Screen:", " ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25498
|
-
onClick: () => this.setState({
|
|
25499
|
-
screen: "phone"
|
|
25500
|
-
}),
|
|
25501
|
-
style: screen === "phone" ? styles$C.controlSelected : styles$C.control
|
|
25502
|
-
}, "PHONE"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25503
|
-
onClick: () => this.setState({
|
|
25504
|
-
screen: "tablet"
|
|
25505
|
-
}),
|
|
25506
|
-
style: screen === "tablet" ? styles$C.controlSelected : styles$C.control
|
|
25507
|
-
}, "TABLET"), " | ", /*#__PURE__*/React__namespace.createElement("span", {
|
|
25508
|
-
onClick: () => this.setState({
|
|
25509
|
-
screen: "desktop"
|
|
25510
|
-
}),
|
|
25511
|
-
style: screen === "desktop" ? styles$C.controlSelected : styles$C.control
|
|
25512
|
-
}, "DESKTOP"))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25513
|
-
style: styles$C.editor
|
|
25514
|
-
}, /*#__PURE__*/React__namespace.createElement(ArticleEditor, this.state)));
|
|
25515
|
-
}
|
|
25516
|
-
});
|
|
25517
|
-
const styles$C = {
|
|
25518
|
-
controlBar: {
|
|
25519
|
-
marginBottom: 25,
|
|
25520
|
-
marginTop: 5
|
|
25521
|
-
},
|
|
25522
|
-
controls: {
|
|
25523
|
-
marginRight: 10
|
|
25524
|
-
},
|
|
25525
|
-
controlSelected: {
|
|
25526
|
-
cursor: "default",
|
|
25527
|
-
fontWeight: 700
|
|
25528
|
-
},
|
|
25529
|
-
control: {
|
|
25530
|
-
cursor: "pointer"
|
|
25531
|
-
},
|
|
25532
|
-
editor: {
|
|
25533
|
-
marginTop: -20
|
|
25534
|
-
}
|
|
25535
|
-
};
|
|
25536
|
-
|
|
25537
25427
|
/* eslint-disable react/no-unsafe, react/sort-comp */
|
|
25538
25428
|
|
|
25539
25429
|
/* Renders an EditorPage (or an ArticleEditor) as a non-controlled component.
|
|
@@ -26003,7 +25893,7 @@ class DeprecatedStandinEditor extends React__namespace.Component {
|
|
|
26003
25893
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
26004
25894
|
const {
|
|
26005
25895
|
InfoTip: InfoTip$j,
|
|
26006
|
-
InlineIcon: InlineIcon$
|
|
25896
|
+
InlineIcon: InlineIcon$4
|
|
26007
25897
|
} = perseus.components;
|
|
26008
25898
|
const {
|
|
26009
25899
|
iconPlus: iconPlus$2,
|
|
@@ -26135,14 +26025,14 @@ class DropdownEditor extends React__namespace.Component {
|
|
|
26135
26025
|
this, i)
|
|
26136
26026
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
26137
26027
|
className: "remove-choice"
|
|
26138
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
26028
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconTrash$3)))));
|
|
26139
26029
|
}, this)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
26140
26030
|
className: "add-choice-container"
|
|
26141
26031
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
26142
26032
|
href: "#",
|
|
26143
26033
|
className: "simple-button orange",
|
|
26144
26034
|
onClick: this.addChoice
|
|
26145
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
26035
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$4, iconPlus$2), " Add a choice", " ")));
|
|
26146
26036
|
}
|
|
26147
26037
|
}
|
|
26148
26038
|
|
|
@@ -26997,7 +26887,7 @@ class AnswerOption extends React__namespace.Component {
|
|
|
26997
26887
|
|
|
26998
26888
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
26999
26889
|
const {
|
|
27000
|
-
InlineIcon: InlineIcon$
|
|
26890
|
+
InlineIcon: InlineIcon$3,
|
|
27001
26891
|
TextInput: TextInput$6
|
|
27002
26892
|
} = perseus.components;
|
|
27003
26893
|
const {
|
|
@@ -27053,10 +26943,10 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27053
26943
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27054
26944
|
className: "perseus-widget-row"
|
|
27055
26945
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
27056
|
-
className: aphrodite.css(styles$
|
|
26946
|
+
className: aphrodite.css(styles$D.title)
|
|
27057
26947
|
}, "Title:", " ", /*#__PURE__*/React__namespace.createElement(TextInput$6, {
|
|
27058
26948
|
value: this.props.title,
|
|
27059
|
-
className: aphrodite.css(styles$
|
|
26949
|
+
className: aphrodite.css(styles$D.input)
|
|
27060
26950
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
27061
26951
|
,
|
|
27062
26952
|
onChange: this.change("title")
|
|
@@ -27078,10 +26968,10 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27078
26968
|
},
|
|
27079
26969
|
className: "add-hint simple-button orange",
|
|
27080
26970
|
onClick: this.handleAddHint
|
|
27081
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
26971
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconPlus$1), " Add a hint"), this.props.hint && /*#__PURE__*/React__namespace.createElement("div", {
|
|
27082
26972
|
className: "perseus-hint-editor"
|
|
27083
26973
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
27084
|
-
className: aphrodite.css(styles$
|
|
26974
|
+
className: aphrodite.css(styles$D.hintsTitle)
|
|
27085
26975
|
}, "Hint"), /*#__PURE__*/React__namespace.createElement(Editor, {
|
|
27086
26976
|
ref: this.hintEditor,
|
|
27087
26977
|
content: this.props.hint ? this.props.hint.content : "",
|
|
@@ -27100,7 +26990,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27100
26990
|
type: "button",
|
|
27101
26991
|
className: "remove-hint simple-button orange",
|
|
27102
26992
|
onClick: this.handleRemoveHint
|
|
27103
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
26993
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$3, iconTrash$2), " Remove this hint")));
|
|
27104
26994
|
}
|
|
27105
26995
|
getSaveWarnings = () => {
|
|
27106
26996
|
return this.editor.current?.getSaveWarnings();
|
|
@@ -27113,7 +27003,7 @@ class GradedGroupEditor extends React__namespace.Component {
|
|
|
27113
27003
|
};
|
|
27114
27004
|
};
|
|
27115
27005
|
}
|
|
27116
|
-
const styles$
|
|
27006
|
+
const styles$D = aphrodite.StyleSheet.create({
|
|
27117
27007
|
title: {
|
|
27118
27008
|
fontSize: 18,
|
|
27119
27009
|
fontWeight: "bold"
|
|
@@ -28049,7 +27939,7 @@ class IframeEditor extends React__namespace.Component {
|
|
|
28049
27939
|
/* eslint-disable jsx-a11y/anchor-is-valid, react/sort-comp */
|
|
28050
27940
|
const {
|
|
28051
27941
|
InfoTip: InfoTip$f,
|
|
28052
|
-
InlineIcon: InlineIcon$
|
|
27942
|
+
InlineIcon: InlineIcon$2,
|
|
28053
27943
|
RangeInput: RangeInput$5
|
|
28054
27944
|
} = perseus.components;
|
|
28055
27945
|
const defaultBoxSize = 400;
|
|
@@ -28175,7 +28065,7 @@ class ImageEditor extends React__namespace.Component {
|
|
|
28175
28065
|
// eslint-disable-next-line react/jsx-no-bind
|
|
28176
28066
|
,
|
|
28177
28067
|
onClick: this.removeLabel.bind(this, i)
|
|
28178
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
28068
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$2, perseus.icons.iconTrash))));
|
|
28179
28069
|
}
|
|
28180
28070
|
change() {
|
|
28181
28071
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -28484,13 +28374,13 @@ function MathquillInput(props) {
|
|
|
28484
28374
|
}
|
|
28485
28375
|
});
|
|
28486
28376
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
28487
|
-
style: styles$
|
|
28377
|
+
style: styles$C.outerWrapper
|
|
28488
28378
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
28489
28379
|
ref: mathFieldWrapperRef,
|
|
28490
28380
|
className: "perseus-math-input mq-editable-field mq-math-mode"
|
|
28491
28381
|
}));
|
|
28492
28382
|
}
|
|
28493
|
-
const styles$
|
|
28383
|
+
const styles$C = aphrodite.StyleSheet.create({
|
|
28494
28384
|
outerWrapper: {
|
|
28495
28385
|
display: "inline-block",
|
|
28496
28386
|
borderStyle: "solid",
|
|
@@ -28502,7 +28392,7 @@ const styles$A = aphrodite.StyleSheet.create({
|
|
|
28502
28392
|
});
|
|
28503
28393
|
|
|
28504
28394
|
const {
|
|
28505
|
-
NumberInput: NumberInput$
|
|
28395
|
+
NumberInput: NumberInput$d
|
|
28506
28396
|
} = perseus.components;
|
|
28507
28397
|
const {
|
|
28508
28398
|
getDependencies: getDependencies$8
|
|
@@ -28562,7 +28452,7 @@ class FunctionEditor extends React__namespace.Component {
|
|
|
28562
28452
|
className: "perseus-widget-row"
|
|
28563
28453
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
28564
28454
|
className: "perseus-widget-left-col"
|
|
28565
|
-
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28455
|
+
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$d, {
|
|
28566
28456
|
value: this.props.strokeWidth,
|
|
28567
28457
|
placeholder: 2,
|
|
28568
28458
|
onChange: this.change("strokeWidth")
|
|
@@ -28629,7 +28519,7 @@ class LabelEditor extends React__namespace.Component {
|
|
|
28629
28519
|
}
|
|
28630
28520
|
|
|
28631
28521
|
const {
|
|
28632
|
-
NumberInput: NumberInput$
|
|
28522
|
+
NumberInput: NumberInput$c
|
|
28633
28523
|
} = perseus.components;
|
|
28634
28524
|
const {
|
|
28635
28525
|
getDependencies: getDependencies$6
|
|
@@ -28697,7 +28587,7 @@ class LineEditor extends React__namespace.Component {
|
|
|
28697
28587
|
className: "perseus-widget-row"
|
|
28698
28588
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
28699
28589
|
className: "perseus-widget-left-col"
|
|
28700
|
-
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28590
|
+
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$c, {
|
|
28701
28591
|
value: this.props.strokeWidth,
|
|
28702
28592
|
placeholder: 2,
|
|
28703
28593
|
onChange: this.change("strokeWidth")
|
|
@@ -28707,7 +28597,7 @@ class LineEditor extends React__namespace.Component {
|
|
|
28707
28597
|
|
|
28708
28598
|
const {
|
|
28709
28599
|
ButtonGroup: ButtonGroup$3,
|
|
28710
|
-
NumberInput: NumberInput$
|
|
28600
|
+
NumberInput: NumberInput$b
|
|
28711
28601
|
} = perseus.components;
|
|
28712
28602
|
class ConstraintEditor extends React__namespace.Component {
|
|
28713
28603
|
static defaultProps = {
|
|
@@ -28747,7 +28637,7 @@ class ConstraintEditor extends React__namespace.Component {
|
|
|
28747
28637
|
onChange: this.change("constraint")
|
|
28748
28638
|
})), this.props.constraint === "snap" && /*#__PURE__*/React__namespace.createElement("div", {
|
|
28749
28639
|
className: "perseus-widget-row"
|
|
28750
|
-
}, "Snap:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28640
|
+
}, "Snap:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$b, {
|
|
28751
28641
|
value: this.props.snap,
|
|
28752
28642
|
placeholder: 0,
|
|
28753
28643
|
onChange: this.change("snap")
|
|
@@ -28790,7 +28680,7 @@ class ConstraintEditor extends React__namespace.Component {
|
|
|
28790
28680
|
}
|
|
28791
28681
|
|
|
28792
28682
|
const {
|
|
28793
|
-
NumberInput: NumberInput$
|
|
28683
|
+
NumberInput: NumberInput$a
|
|
28794
28684
|
} = perseus.components;
|
|
28795
28685
|
const {
|
|
28796
28686
|
getDependencies: getDependencies$5
|
|
@@ -28848,13 +28738,13 @@ class MovableLineEditor extends React__namespace.Component {
|
|
|
28848
28738
|
onChange: this.change("endY")
|
|
28849
28739
|
}), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
|
|
28850
28740
|
className: "perseus-widget-row"
|
|
28851
|
-
}, "Start updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28741
|
+
}, "Start updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), /*#__PURE__*/React__namespace.createElement(NumberInput$a, {
|
|
28852
28742
|
value: this.props.startSubscript,
|
|
28853
28743
|
placeholder: 0,
|
|
28854
28744
|
onChange: this.change("startSubscript")
|
|
28855
28745
|
})), /*#__PURE__*/React__namespace.createElement("div", {
|
|
28856
28746
|
className: "perseus-widget-row"
|
|
28857
|
-
}, "End updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "m ="), /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28747
|
+
}, "End updates ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_m, y_m)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "m ="), /*#__PURE__*/React__namespace.createElement(NumberInput$a, {
|
|
28858
28748
|
value: this.props.endSubscript,
|
|
28859
28749
|
placeholder: 0,
|
|
28860
28750
|
onChange: this.change("endSubscript")
|
|
@@ -28865,7 +28755,7 @@ class MovableLineEditor extends React__namespace.Component {
|
|
|
28865
28755
|
}
|
|
28866
28756
|
|
|
28867
28757
|
const {
|
|
28868
|
-
NumberInput: NumberInput$
|
|
28758
|
+
NumberInput: NumberInput$9
|
|
28869
28759
|
} = perseus.components;
|
|
28870
28760
|
const {
|
|
28871
28761
|
getDependencies: getDependencies$4
|
|
@@ -28913,7 +28803,7 @@ class MovablePointEditor extends React__namespace.Component {
|
|
|
28913
28803
|
onChange: this.change("startY")
|
|
28914
28804
|
}), /*#__PURE__*/React__namespace.createElement(TeX, null, "\\Large)")), /*#__PURE__*/React__namespace.createElement("div", {
|
|
28915
28805
|
className: "perseus-widget-row"
|
|
28916
|
-
}, "Update ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28806
|
+
}, "Update ", /*#__PURE__*/React__namespace.createElement(TeX, null, "(x_n, y_n)"), " for ", /*#__PURE__*/React__namespace.createElement(TeX, null, "n ="), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$9, {
|
|
28917
28807
|
value: this.props.varSubscript,
|
|
28918
28808
|
placeholder: 0,
|
|
28919
28809
|
onChange: this.change("varSubscript")
|
|
@@ -28922,7 +28812,7 @@ class MovablePointEditor extends React__namespace.Component {
|
|
|
28922
28812
|
}
|
|
28923
28813
|
|
|
28924
28814
|
const {
|
|
28925
|
-
NumberInput: NumberInput$
|
|
28815
|
+
NumberInput: NumberInput$8
|
|
28926
28816
|
} = perseus.components;
|
|
28927
28817
|
const {
|
|
28928
28818
|
getDependencies: getDependencies$3
|
|
@@ -28988,7 +28878,7 @@ class ParametricEditor extends React__namespace.Component {
|
|
|
28988
28878
|
className: "perseus-widget-row"
|
|
28989
28879
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
28990
28880
|
className: "perseus-widget-left-col"
|
|
28991
|
-
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
28881
|
+
}, "Width:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$8, {
|
|
28992
28882
|
value: this.props.strokeWidth,
|
|
28993
28883
|
placeholder: 2,
|
|
28994
28884
|
onChange: this.change("strokeWidth")
|
|
@@ -29560,16 +29450,16 @@ const LabeledRow = props => {
|
|
|
29560
29450
|
style
|
|
29561
29451
|
} = props;
|
|
29562
29452
|
return /*#__PURE__*/React__namespace.createElement("label", {
|
|
29563
|
-
className: aphrodite.css(styles$
|
|
29453
|
+
className: aphrodite.css(styles$B.label)
|
|
29564
29454
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29565
|
-
style: [styles$
|
|
29455
|
+
style: [styles$B.row, style]
|
|
29566
29456
|
}, labelSide === "start" || /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29567
|
-
style: styles$
|
|
29457
|
+
style: styles$B.spaceEnd
|
|
29568
29458
|
}, label), children, labelSide === "end" && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelSmall, {
|
|
29569
|
-
style: styles$
|
|
29459
|
+
style: styles$B.spaceStart
|
|
29570
29460
|
}, label)));
|
|
29571
29461
|
};
|
|
29572
|
-
const styles$
|
|
29462
|
+
const styles$B = aphrodite.StyleSheet.create({
|
|
29573
29463
|
label: {
|
|
29574
29464
|
width: "fit-content"
|
|
29575
29465
|
},
|
|
@@ -29646,11 +29536,11 @@ class Spring extends React__namespace.Component {
|
|
|
29646
29536
|
} = this.props;
|
|
29647
29537
|
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
29648
29538
|
"aria-hidden": "true",
|
|
29649
|
-
style: [styles$
|
|
29539
|
+
style: [styles$A.grow, style]
|
|
29650
29540
|
});
|
|
29651
29541
|
}
|
|
29652
29542
|
}
|
|
29653
|
-
const styles$
|
|
29543
|
+
const styles$A = aphrodite.StyleSheet.create({
|
|
29654
29544
|
grow: {
|
|
29655
29545
|
flexGrow: 1
|
|
29656
29546
|
}
|
|
@@ -29686,22 +29576,12 @@ function Heading(_ref) {
|
|
|
29686
29576
|
isCollapsible,
|
|
29687
29577
|
onToggle
|
|
29688
29578
|
} = _ref;
|
|
29689
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
29690
|
-
style:
|
|
29691
|
-
|
|
29692
|
-
justifyContent: "space-between",
|
|
29693
|
-
backgroundColor: wonderBlocksTokens.color.offBlack8,
|
|
29694
|
-
padding: wonderBlocksTokens.spacing.xSmall_8,
|
|
29695
|
-
marginTop: wonderBlocksTokens.spacing.small_12,
|
|
29696
|
-
// NOTE(jeremy): This is the inverse of the @editorPadding CSS
|
|
29697
|
-
// variable found in perseus-editor.less. For now, it must
|
|
29698
|
-
// match otherwise there's a gap from this header to the edge
|
|
29699
|
-
// of the editor borders.
|
|
29700
|
-
marginInline: -10,
|
|
29701
|
-
cursor: isCollapsible ? "pointer" : "default",
|
|
29702
|
-
userSelect: "none"
|
|
29703
|
-
},
|
|
29579
|
+
return /*#__PURE__*/React__namespace.createElement(Clickable__default["default"], {
|
|
29580
|
+
style: [styles$z.container, !isCollapsible && styles$z.notClickable],
|
|
29581
|
+
disabled: !isCollapsible,
|
|
29704
29582
|
onClick: () => isCollapsible && onToggle?.(!isOpen)
|
|
29583
|
+
}, () => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29584
|
+
style: styles$z.heading
|
|
29705
29585
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, {
|
|
29706
29586
|
style: {
|
|
29707
29587
|
fontSize: 14,
|
|
@@ -29709,8 +29589,31 @@ function Heading(_ref) {
|
|
|
29709
29589
|
}
|
|
29710
29590
|
}, title), isCollapsible && /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
|
|
29711
29591
|
isExpanded: isOpen
|
|
29712
|
-
}));
|
|
29592
|
+
})));
|
|
29713
29593
|
}
|
|
29594
|
+
const styles$z = aphrodite.StyleSheet.create({
|
|
29595
|
+
container: {
|
|
29596
|
+
marginTop: wonderBlocksTokens.spacing.small_12,
|
|
29597
|
+
// NOTE(jeremy): This is the inverse of the @editorPadding CSS
|
|
29598
|
+
// variable found in perseus-editor.less. For now, it must
|
|
29599
|
+
// match otherwise there's a gap from this header to the edge
|
|
29600
|
+
// of the editor borders.
|
|
29601
|
+
marginInline: -10,
|
|
29602
|
+
backgroundColor: wonderBlocksTokens.color.offBlack8,
|
|
29603
|
+
padding: wonderBlocksTokens.spacing.xSmall_8
|
|
29604
|
+
},
|
|
29605
|
+
heading: {
|
|
29606
|
+
flexDirection: "row",
|
|
29607
|
+
justifyContent: "space-between",
|
|
29608
|
+
userSelect: "none"
|
|
29609
|
+
},
|
|
29610
|
+
notClickable: {
|
|
29611
|
+
// We don't need the text to be grayed out.
|
|
29612
|
+
color: "inherit",
|
|
29613
|
+
// We don't need the pointer to show the "not allowed" symbol.
|
|
29614
|
+
cursor: "default"
|
|
29615
|
+
}
|
|
29616
|
+
});
|
|
29714
29617
|
|
|
29715
29618
|
function focusWithChromeStickyFocusBugWorkaround(element) {
|
|
29716
29619
|
// NOTE(marksandstrom) Chrome sticky focus bug.
|
|
@@ -29818,6 +29721,28 @@ function degreeToRadian(degrees) {
|
|
|
29818
29721
|
function radianToDegree(radians) {
|
|
29819
29722
|
return radians / Math.PI * 180;
|
|
29820
29723
|
}
|
|
29724
|
+
function getDefaultGraphStartCoords(graph, range, step) {
|
|
29725
|
+
switch (graph.type) {
|
|
29726
|
+
case "linear":
|
|
29727
|
+
case "ray":
|
|
29728
|
+
return perseus.getLineCoords({
|
|
29729
|
+
...graph,
|
|
29730
|
+
startCoords: undefined
|
|
29731
|
+
}, range, step);
|
|
29732
|
+
case "segment":
|
|
29733
|
+
return perseus.getSegmentCoords({
|
|
29734
|
+
...graph,
|
|
29735
|
+
startCoords: undefined
|
|
29736
|
+
}, range, step);
|
|
29737
|
+
case "linear-system":
|
|
29738
|
+
return perseus.getLinearSystemCoords({
|
|
29739
|
+
...graph,
|
|
29740
|
+
startCoords: undefined
|
|
29741
|
+
}, range, step);
|
|
29742
|
+
default:
|
|
29743
|
+
return undefined;
|
|
29744
|
+
}
|
|
29745
|
+
}
|
|
29821
29746
|
|
|
29822
29747
|
/**
|
|
29823
29748
|
* Dropdown for selecting a locked figure to add to an interactive graph.
|
|
@@ -29833,17 +29758,17 @@ const LockedFigureSelect = props => {
|
|
|
29833
29758
|
} = props;
|
|
29834
29759
|
const figureTypes = props.showM2Features ? ["point", "line", "vector", "ellipse", "polygon"] : ["point", "line"];
|
|
29835
29760
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29836
|
-
style: styles$
|
|
29761
|
+
style: styles$y.container
|
|
29837
29762
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionMenu, {
|
|
29838
29763
|
menuText: "Add locked figure",
|
|
29839
|
-
style: styles$
|
|
29764
|
+
style: styles$y.addElementSelect
|
|
29840
29765
|
}, figureTypes.map(figureType => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.ActionItem, {
|
|
29841
29766
|
key: `${id}-${figureType}`,
|
|
29842
29767
|
label: figureType,
|
|
29843
29768
|
onClick: () => onChange(figureType)
|
|
29844
29769
|
}))));
|
|
29845
29770
|
};
|
|
29846
|
-
const styles$
|
|
29771
|
+
const styles$y = aphrodite.StyleSheet.create({
|
|
29847
29772
|
container: {
|
|
29848
29773
|
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
29849
29774
|
},
|
|
@@ -29874,19 +29799,19 @@ const AngleInput = props => {
|
|
|
29874
29799
|
}
|
|
29875
29800
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
29876
29801
|
tag: "label",
|
|
29877
|
-
style: styles$
|
|
29802
|
+
style: styles$x.row
|
|
29878
29803
|
}, "angle (degrees)", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
29879
29804
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
29880
29805
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
29881
29806
|
type: "number",
|
|
29882
29807
|
value: angleInput,
|
|
29883
29808
|
onChange: handleAngleChange,
|
|
29884
|
-
style: styles$
|
|
29809
|
+
style: styles$x.textField
|
|
29885
29810
|
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
29886
29811
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
29887
29812
|
}));
|
|
29888
29813
|
};
|
|
29889
|
-
const styles$
|
|
29814
|
+
const styles$x = aphrodite.StyleSheet.create({
|
|
29890
29815
|
row: {
|
|
29891
29816
|
display: "flex",
|
|
29892
29817
|
flexDirection: "row",
|
|
@@ -29935,32 +29860,32 @@ const CoordinatePairInput = props => {
|
|
|
29935
29860
|
onChange(newCoords);
|
|
29936
29861
|
}
|
|
29937
29862
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
29938
|
-
style: [styles$
|
|
29863
|
+
style: [styles$w.row, style]
|
|
29939
29864
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
29940
29865
|
tag: "label",
|
|
29941
|
-
style: styles$
|
|
29866
|
+
style: styles$w.row
|
|
29942
29867
|
}, labels ? labels[0] : "x coord", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
29943
29868
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
29944
29869
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
29945
29870
|
type: "number",
|
|
29946
29871
|
value: coordState[0],
|
|
29947
29872
|
onChange: newValue => handleCoordChange(newValue, 0),
|
|
29948
|
-
style: [styles$
|
|
29873
|
+
style: [styles$w.textField, error ? styles$w.errorField : undefined]
|
|
29949
29874
|
})), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
29950
29875
|
size: wonderBlocksTokens.spacing.medium_16
|
|
29951
29876
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
29952
29877
|
tag: "label",
|
|
29953
|
-
style: styles$
|
|
29878
|
+
style: styles$w.row
|
|
29954
29879
|
}, labels ? labels[1] : "y coord", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
29955
29880
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
29956
29881
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.TextField, {
|
|
29957
29882
|
type: "number",
|
|
29958
29883
|
value: coordState[1],
|
|
29959
29884
|
onChange: newValue => handleCoordChange(newValue, 1),
|
|
29960
|
-
style: [styles$
|
|
29885
|
+
style: [styles$w.textField, error ? styles$w.errorField : undefined]
|
|
29961
29886
|
})));
|
|
29962
29887
|
};
|
|
29963
|
-
const styles$
|
|
29888
|
+
const styles$w = aphrodite.StyleSheet.create({
|
|
29964
29889
|
row: {
|
|
29965
29890
|
display: "flex",
|
|
29966
29891
|
flexDirection: "row",
|
|
@@ -29993,14 +29918,14 @@ const PerseusEditorAccordion = props => {
|
|
|
29993
29918
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksAccordion.AccordionSection, {
|
|
29994
29919
|
expanded: expanded,
|
|
29995
29920
|
onToggle: onToggle,
|
|
29996
|
-
style: [styles$
|
|
29997
|
-
headerStyle: styles$
|
|
29921
|
+
style: [styles$v.container, containerStyle],
|
|
29922
|
+
headerStyle: styles$v.accordionHeader,
|
|
29998
29923
|
header: header
|
|
29999
29924
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30000
|
-
style: [styles$
|
|
29925
|
+
style: [styles$v.accordionPanel, panelStyle]
|
|
30001
29926
|
}, children)));
|
|
30002
29927
|
};
|
|
30003
|
-
const styles$
|
|
29928
|
+
const styles$v = aphrodite.StyleSheet.create({
|
|
30004
29929
|
container: {
|
|
30005
29930
|
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
30006
29931
|
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
@@ -30031,13 +29956,13 @@ const ColorSwatch = props => {
|
|
|
30031
29956
|
"aria-label":
|
|
30032
29957
|
// Don't include an aria label for decorative circles.
|
|
30033
29958
|
!decorative ? `${color}, ${filled ? "filled" : "open"}` : undefined,
|
|
30034
|
-
style: [styles$
|
|
29959
|
+
style: [styles$u.colorSwatch, {
|
|
30035
29960
|
border: `4px solid ${perseus.lockedFigureColors[color]}`,
|
|
30036
29961
|
backgroundColor: filled ? perseus.lockedFigureColors[color] : wonderBlocksTokens.color.white
|
|
30037
29962
|
}]
|
|
30038
29963
|
});
|
|
30039
29964
|
};
|
|
30040
|
-
const styles$
|
|
29965
|
+
const styles$u = aphrodite.StyleSheet.create({
|
|
30041
29966
|
colorSwatch: {
|
|
30042
29967
|
// Add a white outline so that the color swatch is visible when
|
|
30043
29968
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30056,10 +29981,10 @@ const ColorSelect = props => {
|
|
|
30056
29981
|
onChange
|
|
30057
29982
|
} = props;
|
|
30058
29983
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30059
|
-
style: [styles$
|
|
29984
|
+
style: [styles$t.row, style]
|
|
30060
29985
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30061
29986
|
tag: "label",
|
|
30062
|
-
style: styles$
|
|
29987
|
+
style: styles$t.row
|
|
30063
29988
|
}, "color", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30064
29989
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30065
29990
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30078,7 +30003,7 @@ const ColorSelect = props => {
|
|
|
30078
30003
|
})
|
|
30079
30004
|
})))));
|
|
30080
30005
|
};
|
|
30081
|
-
const styles$
|
|
30006
|
+
const styles$t = aphrodite.StyleSheet.create({
|
|
30082
30007
|
row: {
|
|
30083
30008
|
display: "flex",
|
|
30084
30009
|
flexDirection: "row",
|
|
@@ -30094,17 +30019,17 @@ const EllipseSwatch = props => {
|
|
|
30094
30019
|
} = props;
|
|
30095
30020
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30096
30021
|
"aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
|
|
30097
|
-
style: [styles$
|
|
30022
|
+
style: [styles$s.container, {
|
|
30098
30023
|
border: `4px ${strokeStyle} ${perseus.lockedFigureColors[color]}`
|
|
30099
30024
|
}]
|
|
30100
30025
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30101
|
-
style: [styles$
|
|
30026
|
+
style: [styles$s.innerCircle, {
|
|
30102
30027
|
backgroundColor: perseus.lockedFigureColors[color],
|
|
30103
30028
|
opacity: perseus.lockedFigureFillStyles[fillStyle]
|
|
30104
30029
|
}]
|
|
30105
30030
|
}));
|
|
30106
30031
|
};
|
|
30107
|
-
const styles$
|
|
30032
|
+
const styles$s = aphrodite.StyleSheet.create({
|
|
30108
30033
|
container: {
|
|
30109
30034
|
// Add a white outline so that the color swatch is visible when
|
|
30110
30035
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30135,40 +30060,40 @@ const LockedFigureSettingsActions = props => {
|
|
|
30135
30060
|
onRemove
|
|
30136
30061
|
} = props;
|
|
30137
30062
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30138
|
-
style: styles$
|
|
30063
|
+
style: styles$r.container
|
|
30139
30064
|
}, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
30140
30065
|
startIcon: trashIcon__default["default"],
|
|
30141
30066
|
"aria-label": `Delete locked ${figureType}`,
|
|
30142
30067
|
onClick: onRemove,
|
|
30143
30068
|
kind: "tertiary",
|
|
30144
|
-
style: styles$
|
|
30069
|
+
style: styles$r.deleteButton
|
|
30145
30070
|
}, "Delete"), /*#__PURE__*/React__namespace.createElement(Spring, null), props.showM2Features && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30146
30071
|
icon: caretDoubleUpIcon__default["default"],
|
|
30147
30072
|
size: "small",
|
|
30148
30073
|
"aria-label": `Move locked ${figureType} to the back`,
|
|
30149
30074
|
onClick: () => onMove("back"),
|
|
30150
|
-
style: styles$
|
|
30075
|
+
style: styles$r.iconButton
|
|
30151
30076
|
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30152
30077
|
icon: caretUpIcon__default["default"],
|
|
30153
30078
|
size: "small",
|
|
30154
30079
|
"aria-label": `Move locked ${figureType} backward`,
|
|
30155
30080
|
onClick: () => onMove("backward"),
|
|
30156
|
-
style: styles$
|
|
30081
|
+
style: styles$r.iconButton
|
|
30157
30082
|
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30158
30083
|
icon: caretDownIcon__default["default"],
|
|
30159
30084
|
size: "small",
|
|
30160
30085
|
"aria-label": `Move locked ${figureType} forward`,
|
|
30161
30086
|
onClick: () => onMove("forward"),
|
|
30162
|
-
style: styles$
|
|
30087
|
+
style: styles$r.iconButton
|
|
30163
30088
|
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
30164
30089
|
icon: caretDoubleDownIcon__default["default"],
|
|
30165
30090
|
size: "small",
|
|
30166
30091
|
"aria-label": `Move locked ${figureType} to the front`,
|
|
30167
30092
|
onClick: () => onMove("front"),
|
|
30168
|
-
style: styles$
|
|
30093
|
+
style: styles$r.iconButton
|
|
30169
30094
|
})));
|
|
30170
30095
|
};
|
|
30171
|
-
const styles$
|
|
30096
|
+
const styles$r = aphrodite.StyleSheet.create({
|
|
30172
30097
|
container: {
|
|
30173
30098
|
width: "100%",
|
|
30174
30099
|
flexDirection: "row",
|
|
@@ -30215,7 +30140,7 @@ const LockedEllipseSettings = props => {
|
|
|
30215
30140
|
/*#__PURE__*/
|
|
30216
30141
|
// Summary: Ellipse, center, radius, color (opacity, dashed)
|
|
30217
30142
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30218
|
-
style: styles$
|
|
30143
|
+
style: styles$q.row
|
|
30219
30144
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Ellipse (${center[0]}, ${center[1]}), radius ${radius[0]}, ${radius[1]}`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30220
30145
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30221
30146
|
}), /*#__PURE__*/React__namespace.createElement(EllipseSwatch, {
|
|
@@ -30224,19 +30149,19 @@ const LockedEllipseSettings = props => {
|
|
|
30224
30149
|
strokeStyle: strokeStyle
|
|
30225
30150
|
}))
|
|
30226
30151
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30227
|
-
style: styles$
|
|
30152
|
+
style: styles$q.row
|
|
30228
30153
|
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30229
30154
|
coord: center,
|
|
30230
|
-
style: styles$
|
|
30155
|
+
style: styles$q.spaceUnder,
|
|
30231
30156
|
onChange: newCoords => onChangeProps({
|
|
30232
30157
|
center: newCoords
|
|
30233
30158
|
})
|
|
30234
30159
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30235
|
-
style: styles$
|
|
30160
|
+
style: styles$q.spaceUnder
|
|
30236
30161
|
}, /*#__PURE__*/React__namespace.createElement(InfoTip$d, null, "The coordinates for the center of the ellipse."))), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30237
30162
|
coord: radius,
|
|
30238
30163
|
labels: ["x radius", "y radius"],
|
|
30239
|
-
style: styles$
|
|
30164
|
+
style: styles$q.spaceUnder,
|
|
30240
30165
|
onChange: newCoords => onChangeProps({
|
|
30241
30166
|
radius: newCoords
|
|
30242
30167
|
})
|
|
@@ -30248,7 +30173,7 @@ const LockedEllipseSettings = props => {
|
|
|
30248
30173
|
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30249
30174
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30250
30175
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30251
|
-
style: [styles$
|
|
30176
|
+
style: [styles$q.row, styles$q.spaceUnder]
|
|
30252
30177
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30253
30178
|
selectedValue: color,
|
|
30254
30179
|
onChange: handleColorChange
|
|
@@ -30256,7 +30181,7 @@ const LockedEllipseSettings = props => {
|
|
|
30256
30181
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30257
30182
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30258
30183
|
tag: "label",
|
|
30259
|
-
style: styles$
|
|
30184
|
+
style: styles$q.row
|
|
30260
30185
|
}, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30261
30186
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30262
30187
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30273,7 +30198,7 @@ const LockedEllipseSettings = props => {
|
|
|
30273
30198
|
label: option
|
|
30274
30199
|
}))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30275
30200
|
tag: "label",
|
|
30276
|
-
style: styles$
|
|
30201
|
+
style: styles$q.row
|
|
30277
30202
|
}, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30278
30203
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30279
30204
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30297,7 +30222,7 @@ const LockedEllipseSettings = props => {
|
|
|
30297
30222
|
onRemove: onRemove
|
|
30298
30223
|
}));
|
|
30299
30224
|
};
|
|
30300
|
-
const styles$
|
|
30225
|
+
const styles$q = aphrodite.StyleSheet.create({
|
|
30301
30226
|
row: {
|
|
30302
30227
|
display: "flex",
|
|
30303
30228
|
flexDirection: "row",
|
|
@@ -30318,7 +30243,7 @@ const LabeledSwitch = props => {
|
|
|
30318
30243
|
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
30319
30244
|
const switchId = ids.get("switch");
|
|
30320
30245
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30321
|
-
style: [styles$
|
|
30246
|
+
style: [styles$p.row, style]
|
|
30322
30247
|
}, /*#__PURE__*/React__namespace.createElement(Switch__default["default"], {
|
|
30323
30248
|
id: switchId,
|
|
30324
30249
|
checked: checked,
|
|
@@ -30330,7 +30255,7 @@ const LabeledSwitch = props => {
|
|
|
30330
30255
|
htmlFor: switchId
|
|
30331
30256
|
}, label));
|
|
30332
30257
|
};
|
|
30333
|
-
const styles$
|
|
30258
|
+
const styles$p = aphrodite.StyleSheet.create({
|
|
30334
30259
|
row: {
|
|
30335
30260
|
flexDirection: "row",
|
|
30336
30261
|
alignItems: "center"
|
|
@@ -30364,13 +30289,13 @@ const DefiningPointSettings = props => {
|
|
|
30364
30289
|
return /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
30365
30290
|
expanded: expanded,
|
|
30366
30291
|
onToggle: onToggle,
|
|
30367
|
-
containerStyle: styles$
|
|
30368
|
-
panelStyle: styles$
|
|
30292
|
+
containerStyle: styles$o.container,
|
|
30293
|
+
panelStyle: styles$o.accordionPanel,
|
|
30369
30294
|
header:
|
|
30370
30295
|
/*#__PURE__*/
|
|
30371
30296
|
// Summary: Point, coords, color (filled/open)
|
|
30372
30297
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30373
|
-
style: styles$
|
|
30298
|
+
style: styles$o.row
|
|
30374
30299
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${label || "Point"} (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30375
30300
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30376
30301
|
}), showPoint && /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
@@ -30380,7 +30305,7 @@ const DefiningPointSettings = props => {
|
|
|
30380
30305
|
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30381
30306
|
coord: coord,
|
|
30382
30307
|
error: !!error,
|
|
30383
|
-
style: styles$
|
|
30308
|
+
style: styles$o.spaceUnder,
|
|
30384
30309
|
onChange: newCoords => {
|
|
30385
30310
|
onChangeProps({
|
|
30386
30311
|
coord: newCoords
|
|
@@ -30389,12 +30314,12 @@ const DefiningPointSettings = props => {
|
|
|
30389
30314
|
}), onTogglePoint && /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30390
30315
|
label: "show point on graph",
|
|
30391
30316
|
checked: !!showPoint,
|
|
30392
|
-
style: showPoint && styles$
|
|
30317
|
+
style: showPoint && styles$o.spaceUnder,
|
|
30393
30318
|
onChange: onTogglePoint
|
|
30394
30319
|
}), showPoint && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30395
30320
|
selectedValue: pointColor,
|
|
30396
30321
|
onChange: handleColorChange,
|
|
30397
|
-
style: styles$
|
|
30322
|
+
style: styles$o.spaceUnder
|
|
30398
30323
|
}), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30399
30324
|
label: "open point",
|
|
30400
30325
|
checked: !filled,
|
|
@@ -30405,7 +30330,7 @@ const DefiningPointSettings = props => {
|
|
|
30405
30330
|
}
|
|
30406
30331
|
})));
|
|
30407
30332
|
};
|
|
30408
|
-
const styles$
|
|
30333
|
+
const styles$o = aphrodite.StyleSheet.create({
|
|
30409
30334
|
container: {
|
|
30410
30335
|
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30411
30336
|
marginBottom: 0,
|
|
@@ -30432,15 +30357,15 @@ const LineSwatch = props => {
|
|
|
30432
30357
|
lineStyle
|
|
30433
30358
|
} = props;
|
|
30434
30359
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30435
|
-
style: styles$
|
|
30360
|
+
style: styles$n.container
|
|
30436
30361
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30437
30362
|
"aria-label": `${color}, ${lineStyle}`,
|
|
30438
|
-
style: [styles$
|
|
30363
|
+
style: [styles$n.lineSwatch, {
|
|
30439
30364
|
border: `5px ${lineStyle} ${perseus.lockedFigureColors[color]}`
|
|
30440
30365
|
}]
|
|
30441
30366
|
}));
|
|
30442
30367
|
};
|
|
30443
|
-
const styles$
|
|
30368
|
+
const styles$n = aphrodite.StyleSheet.create({
|
|
30444
30369
|
container: {
|
|
30445
30370
|
backgroundColor: wonderBlocksTokens.color.white,
|
|
30446
30371
|
justifyContent: "center",
|
|
@@ -30499,7 +30424,7 @@ const LockedLineSettings = props => {
|
|
|
30499
30424
|
expanded: props.expanded,
|
|
30500
30425
|
onToggle: props.onToggle,
|
|
30501
30426
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30502
|
-
style: styles$
|
|
30427
|
+
style: styles$m.row
|
|
30503
30428
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30504
30429
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30505
30430
|
}), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
|
|
@@ -30508,7 +30433,7 @@ const LockedLineSettings = props => {
|
|
|
30508
30433
|
}))
|
|
30509
30434
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30510
30435
|
tag: "label",
|
|
30511
|
-
style: [styles$
|
|
30436
|
+
style: [styles$m.row, styles$m.spaceUnder]
|
|
30512
30437
|
}, "kind", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30513
30438
|
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30514
30439
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30529,7 +30454,7 @@ const LockedLineSettings = props => {
|
|
|
30529
30454
|
value: "segment",
|
|
30530
30455
|
label: "segment"
|
|
30531
30456
|
}))), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30532
|
-
style: styles$
|
|
30457
|
+
style: styles$m.row
|
|
30533
30458
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30534
30459
|
selectedValue: lineColor,
|
|
30535
30460
|
onChange: handleColorChange
|
|
@@ -30537,7 +30462,7 @@ const LockedLineSettings = props => {
|
|
|
30537
30462
|
size: wonderBlocksTokens.spacing.small_12
|
|
30538
30463
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30539
30464
|
tag: "label",
|
|
30540
|
-
style: styles$
|
|
30465
|
+
style: styles$m.row
|
|
30541
30466
|
}, "style", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30542
30467
|
size: wonderBlocksTokens.spacing.xxxSmall_4
|
|
30543
30468
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30548,7 +30473,7 @@ const LockedLineSettings = props => {
|
|
|
30548
30473
|
// Placeholder is required, but never gets used.
|
|
30549
30474
|
,
|
|
30550
30475
|
placeholder: "",
|
|
30551
|
-
style: styles$
|
|
30476
|
+
style: styles$m.selectMarginOffset
|
|
30552
30477
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30553
30478
|
value: "solid",
|
|
30554
30479
|
label: "solid"
|
|
@@ -30556,7 +30481,7 @@ const LockedLineSettings = props => {
|
|
|
30556
30481
|
value: "dashed",
|
|
30557
30482
|
label: "dashed"
|
|
30558
30483
|
})))), isInvalid && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30559
|
-
style: styles$
|
|
30484
|
+
style: styles$m.errorText
|
|
30560
30485
|
}, lengthZeroStr), /*#__PURE__*/React__namespace.createElement(DefiningPointSettings, _extends({
|
|
30561
30486
|
label: "Point 1",
|
|
30562
30487
|
showPoint: showPoint1,
|
|
@@ -30582,7 +30507,7 @@ const LockedLineSettings = props => {
|
|
|
30582
30507
|
onRemove: onRemove
|
|
30583
30508
|
}));
|
|
30584
30509
|
};
|
|
30585
|
-
const styles$
|
|
30510
|
+
const styles$m = aphrodite.StyleSheet.create({
|
|
30586
30511
|
row: {
|
|
30587
30512
|
display: "flex",
|
|
30588
30513
|
flexDirection: "row",
|
|
@@ -30627,7 +30552,7 @@ const LockedPointSettings = props => {
|
|
|
30627
30552
|
/*#__PURE__*/
|
|
30628
30553
|
// Summary: Point, coords, color (filled/open)
|
|
30629
30554
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30630
|
-
style: styles$
|
|
30555
|
+
style: styles$l.row
|
|
30631
30556
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Point (${coord[0]}, ${coord[1]})`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30632
30557
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30633
30558
|
}), /*#__PURE__*/React__namespace.createElement(ColorSwatch, {
|
|
@@ -30636,7 +30561,7 @@ const LockedPointSettings = props => {
|
|
|
30636
30561
|
}))
|
|
30637
30562
|
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30638
30563
|
coord: coord,
|
|
30639
|
-
style: styles$
|
|
30564
|
+
style: styles$l.spaceUnder,
|
|
30640
30565
|
onChange: newCoord => {
|
|
30641
30566
|
onChangeProps({
|
|
30642
30567
|
coord: newCoord
|
|
@@ -30645,7 +30570,7 @@ const LockedPointSettings = props => {
|
|
|
30645
30570
|
}), /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30646
30571
|
selectedValue: pointColor,
|
|
30647
30572
|
onChange: handleColorChange,
|
|
30648
|
-
style: styles$
|
|
30573
|
+
style: styles$l.spaceUnder
|
|
30649
30574
|
}), /*#__PURE__*/React__namespace.createElement(LabeledSwitch, {
|
|
30650
30575
|
label: "open point",
|
|
30651
30576
|
checked: !filled,
|
|
@@ -30661,7 +30586,7 @@ const LockedPointSettings = props => {
|
|
|
30661
30586
|
onRemove: onRemove
|
|
30662
30587
|
}));
|
|
30663
30588
|
};
|
|
30664
|
-
const styles$
|
|
30589
|
+
const styles$l = aphrodite.StyleSheet.create({
|
|
30665
30590
|
row: {
|
|
30666
30591
|
flexDirection: "row",
|
|
30667
30592
|
alignItems: "center"
|
|
@@ -30679,17 +30604,17 @@ const PolygonSwatch = props => {
|
|
|
30679
30604
|
} = props;
|
|
30680
30605
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30681
30606
|
"aria-label": `${color}, stroke ${strokeStyle}, fill ${fillStyle}`,
|
|
30682
|
-
style: [styles$
|
|
30607
|
+
style: [styles$k.container, {
|
|
30683
30608
|
border: `4px ${strokeStyle} ${perseus.lockedFigureColors[color]}`
|
|
30684
30609
|
}]
|
|
30685
30610
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30686
|
-
style: [styles$
|
|
30611
|
+
style: [styles$k.innerSquare, {
|
|
30687
30612
|
backgroundColor: perseus.lockedFigureColors[color],
|
|
30688
30613
|
opacity: perseus.lockedFigureFillStyles[fillStyle]
|
|
30689
30614
|
}]
|
|
30690
30615
|
}));
|
|
30691
30616
|
};
|
|
30692
|
-
const styles$
|
|
30617
|
+
const styles$k = aphrodite.StyleSheet.create({
|
|
30693
30618
|
container: {
|
|
30694
30619
|
// Add a white outline so that the color swatch is visible when
|
|
30695
30620
|
// the dropdown option is highlighted with its blue background.
|
|
@@ -30731,7 +30656,7 @@ const LockedPolygonSettings = props => {
|
|
|
30731
30656
|
/*#__PURE__*/
|
|
30732
30657
|
// Summary: Polygon, number of sides, style swatch
|
|
30733
30658
|
React__namespace.createElement(wonderBlocksCore.View, {
|
|
30734
|
-
style: styles$
|
|
30659
|
+
style: styles$j.row
|
|
30735
30660
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Polygon, ${points.length} sides`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30736
30661
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30737
30662
|
}), /*#__PURE__*/React__namespace.createElement(PolygonSwatch, {
|
|
@@ -30740,7 +30665,7 @@ const LockedPolygonSettings = props => {
|
|
|
30740
30665
|
strokeStyle: strokeStyle
|
|
30741
30666
|
}))
|
|
30742
30667
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30743
|
-
style: [styles$
|
|
30668
|
+
style: [styles$j.row, styles$j.spaceUnder]
|
|
30744
30669
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30745
30670
|
selectedValue: color,
|
|
30746
30671
|
onChange: handleColorChange
|
|
@@ -30748,7 +30673,7 @@ const LockedPolygonSettings = props => {
|
|
|
30748
30673
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30749
30674
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30750
30675
|
tag: "label",
|
|
30751
|
-
style: styles$
|
|
30676
|
+
style: styles$j.row
|
|
30752
30677
|
}, "fill", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30753
30678
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30754
30679
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30765,7 +30690,7 @@ const LockedPolygonSettings = props => {
|
|
|
30765
30690
|
label: option
|
|
30766
30691
|
}))))), /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30767
30692
|
tag: "label",
|
|
30768
|
-
style: [styles$
|
|
30693
|
+
style: [styles$j.row, styles$j.spaceUnder]
|
|
30769
30694
|
}, "stroke", /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30770
30695
|
size: wonderBlocksTokens.spacing.xxSmall_6
|
|
30771
30696
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
@@ -30788,17 +30713,17 @@ const LockedPolygonSettings = props => {
|
|
|
30788
30713
|
onChange: newValue => onChangeProps({
|
|
30789
30714
|
showVertices: newValue
|
|
30790
30715
|
}),
|
|
30791
|
-
style: styles$
|
|
30716
|
+
style: styles$j.spaceUnder
|
|
30792
30717
|
}), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
30793
30718
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Points"),
|
|
30794
30719
|
expanded: true,
|
|
30795
|
-
containerStyle: styles$
|
|
30796
|
-
panelStyle: styles$
|
|
30720
|
+
containerStyle: styles$j.pointAccordionContainer,
|
|
30721
|
+
panelStyle: styles$j.pointAccordionPanel
|
|
30797
30722
|
}, points.map((point, index) => {
|
|
30798
30723
|
const pointLabel = String.fromCharCode(65 + index);
|
|
30799
30724
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30800
30725
|
key: `locked-polygon-point-${point[0]}-${point[1]}-index-${index}`,
|
|
30801
|
-
style: [styles$
|
|
30726
|
+
style: [styles$j.row, styles$j.spaceUnder]
|
|
30802
30727
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${pointLabel}:`), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30803
30728
|
size: wonderBlocksTokens.spacing.medium_16
|
|
30804
30729
|
}), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
@@ -30826,7 +30751,7 @@ const LockedPolygonSettings = props => {
|
|
|
30826
30751
|
points: newPoints
|
|
30827
30752
|
});
|
|
30828
30753
|
},
|
|
30829
|
-
style: styles$
|
|
30754
|
+
style: styles$j.icon
|
|
30830
30755
|
}));
|
|
30831
30756
|
}), /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
30832
30757
|
kind: "tertiary",
|
|
@@ -30843,7 +30768,7 @@ const LockedPolygonSettings = props => {
|
|
|
30843
30768
|
onRemove: onRemove
|
|
30844
30769
|
}));
|
|
30845
30770
|
};
|
|
30846
|
-
const styles$
|
|
30771
|
+
const styles$j = aphrodite.StyleSheet.create({
|
|
30847
30772
|
row: {
|
|
30848
30773
|
display: "flex",
|
|
30849
30774
|
flexDirection: "row",
|
|
@@ -30901,7 +30826,7 @@ const LockedVectorSettings = props => {
|
|
|
30901
30826
|
expanded: props.expanded,
|
|
30902
30827
|
onToggle: props.onToggle,
|
|
30903
30828
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30904
|
-
style: styles$
|
|
30829
|
+
style: styles$i.row
|
|
30905
30830
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, lineLabel), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
30906
30831
|
size: wonderBlocksTokens.spacing.xSmall_8
|
|
30907
30832
|
}), /*#__PURE__*/React__namespace.createElement(LineSwatch, {
|
|
@@ -30909,19 +30834,19 @@ const LockedVectorSettings = props => {
|
|
|
30909
30834
|
lineStyle: "solid"
|
|
30910
30835
|
}))
|
|
30911
30836
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30912
|
-
style: [styles$
|
|
30837
|
+
style: [styles$i.row, styles$i.spaceUnder]
|
|
30913
30838
|
}, /*#__PURE__*/React__namespace.createElement(ColorSelect, {
|
|
30914
30839
|
selectedValue: lineColor,
|
|
30915
30840
|
onChange: handleColorChange
|
|
30916
30841
|
})), isInvalid && /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelMedium, {
|
|
30917
|
-
style: styles$
|
|
30842
|
+
style: styles$i.errorText
|
|
30918
30843
|
}, lengthErrorMessage), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
30919
30844
|
expanded: true // Initial state is expanded
|
|
30920
30845
|
,
|
|
30921
|
-
containerStyle: styles$
|
|
30922
|
-
panelStyle: styles$
|
|
30846
|
+
containerStyle: styles$i.container,
|
|
30847
|
+
panelStyle: styles$i.accordionPanel,
|
|
30923
30848
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30924
|
-
style: styles$
|
|
30849
|
+
style: styles$i.row
|
|
30925
30850
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Tail (${tail[0]}, ${tail[1]})`))
|
|
30926
30851
|
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30927
30852
|
coord: tail,
|
|
@@ -30932,10 +30857,10 @@ const LockedVectorSettings = props => {
|
|
|
30932
30857
|
})), /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
30933
30858
|
expanded: true // Initial state is expanded
|
|
30934
30859
|
,
|
|
30935
|
-
containerStyle: styles$
|
|
30936
|
-
panelStyle: styles$
|
|
30860
|
+
containerStyle: styles$i.container,
|
|
30861
|
+
panelStyle: styles$i.accordionPanel,
|
|
30937
30862
|
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
30938
|
-
style: styles$
|
|
30863
|
+
style: styles$i.row
|
|
30939
30864
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `Tip (${tip[0]}, ${tip[1]})`))
|
|
30940
30865
|
}, /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
30941
30866
|
coord: tip,
|
|
@@ -30950,7 +30875,7 @@ const LockedVectorSettings = props => {
|
|
|
30950
30875
|
onRemove: onRemove
|
|
30951
30876
|
}));
|
|
30952
30877
|
};
|
|
30953
|
-
const styles$
|
|
30878
|
+
const styles$i = aphrodite.StyleSheet.create({
|
|
30954
30879
|
accordionPanel: {
|
|
30955
30880
|
paddingBottom: wonderBlocksTokens.spacing.medium_16
|
|
30956
30881
|
},
|
|
@@ -31127,7 +31052,7 @@ const LockedFiguresSection = props => {
|
|
|
31127
31052
|
onRemove: () => removeLockedFigure(index)
|
|
31128
31053
|
}));
|
|
31129
31054
|
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31130
|
-
style: styles$
|
|
31055
|
+
style: styles$h.buttonContainer
|
|
31131
31056
|
}, /*#__PURE__*/React__namespace.createElement(LockedFigureSelect, {
|
|
31132
31057
|
showM2Features: props.showM2Features,
|
|
31133
31058
|
showM2bFeatures: props.showM2bFeatures,
|
|
@@ -31138,10 +31063,10 @@ const LockedFiguresSection = props => {
|
|
|
31138
31063
|
}), showExpandButton && /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
31139
31064
|
kind: "secondary",
|
|
31140
31065
|
onClick: () => toggleExpanded(allCollapsed),
|
|
31141
|
-
style: styles$
|
|
31066
|
+
style: styles$h.button
|
|
31142
31067
|
}, buttonLabel))));
|
|
31143
31068
|
};
|
|
31144
|
-
const styles$
|
|
31069
|
+
const styles$h = aphrodite.StyleSheet.create({
|
|
31145
31070
|
buttonContainer: {
|
|
31146
31071
|
flexDirection: "row",
|
|
31147
31072
|
alignItems: "center"
|
|
@@ -31177,7 +31102,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
31177
31102
|
// Never uses placeholder, always has value
|
|
31178
31103
|
,
|
|
31179
31104
|
placeholder: "",
|
|
31180
|
-
style: styles$
|
|
31105
|
+
style: styles$g.singleSelectShort
|
|
31181
31106
|
}, [...[...Array(7).keys()].map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31182
31107
|
key: n,
|
|
31183
31108
|
value: `${n}`,
|
|
@@ -31188,7 +31113,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
31188
31113
|
label: "unlimited"
|
|
31189
31114
|
})]);
|
|
31190
31115
|
};
|
|
31191
|
-
const styles$
|
|
31116
|
+
const styles$g = aphrodite.StyleSheet.create({
|
|
31192
31117
|
singleSelectShort: {
|
|
31193
31118
|
// Non-standard spacing, but it's the smallest we can go
|
|
31194
31119
|
// without running into styling issues with the dropdown.
|
|
@@ -31201,7 +31126,7 @@ const GraphTypeSelector = props => {
|
|
|
31201
31126
|
selectedValue: props.graphType,
|
|
31202
31127
|
onChange: props.onChange,
|
|
31203
31128
|
placeholder: "Select a graph type",
|
|
31204
|
-
style: styles$
|
|
31129
|
+
style: styles$f.singleSelectShort
|
|
31205
31130
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31206
31131
|
value: "linear",
|
|
31207
31132
|
label: "Linear function"
|
|
@@ -31234,7 +31159,7 @@ const GraphTypeSelector = props => {
|
|
|
31234
31159
|
label: "Angle"
|
|
31235
31160
|
}));
|
|
31236
31161
|
};
|
|
31237
|
-
const styles$
|
|
31162
|
+
const styles$f = aphrodite.StyleSheet.create({
|
|
31238
31163
|
singleSelectShort: {
|
|
31239
31164
|
// Non-standard spacing, but it's the smallest we can go
|
|
31240
31165
|
// without running into styling issues with the dropdown.
|
|
@@ -31316,10 +31241,7 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
31316
31241
|
backgroundImage: defaultBackgroundImage$1,
|
|
31317
31242
|
markings: "graph",
|
|
31318
31243
|
showProtractor: false,
|
|
31319
|
-
|
|
31320
|
-
showTooltips: false,
|
|
31321
|
-
rulerLabel: "",
|
|
31322
|
-
rulerTicks: 10
|
|
31244
|
+
showTooltips: false
|
|
31323
31245
|
};
|
|
31324
31246
|
componentDidMount() {
|
|
31325
31247
|
// TODO(scottgrant): This is a hack to remove the deprecated call to
|
|
@@ -31346,19 +31268,6 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
31346
31268
|
return perseus.Changeable.change.apply(_this, args);
|
|
31347
31269
|
};
|
|
31348
31270
|
})();
|
|
31349
|
-
|
|
31350
|
-
// TODO(aria): Make either a wrapper for standard events to work
|
|
31351
|
-
// with this.change, or make these use some TextInput/NumberInput box
|
|
31352
|
-
changeRulerLabel = e => {
|
|
31353
|
-
this.change({
|
|
31354
|
-
rulerLabel: e.target.value
|
|
31355
|
-
});
|
|
31356
|
-
};
|
|
31357
|
-
changeRulerTicks = e => {
|
|
31358
|
-
this.change({
|
|
31359
|
-
rulerTicks: +e.target.value
|
|
31360
|
-
});
|
|
31361
|
-
};
|
|
31362
31271
|
changeBackgroundUrl = e => {
|
|
31363
31272
|
// Only continue on blur or "enter"
|
|
31364
31273
|
if (e.type === "keypress" && e.key !== "Enter") {
|
|
@@ -31679,10 +31588,10 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
31679
31588
|
onChange: this.change
|
|
31680
31589
|
}))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
31681
31590
|
label: "Background image URL:",
|
|
31682
|
-
style: styles$
|
|
31591
|
+
style: styles$e.resetSpaceTop
|
|
31683
31592
|
}, /*#__PURE__*/React__namespace.createElement("input", {
|
|
31684
31593
|
type: "text",
|
|
31685
|
-
className: aphrodite.css(styles$
|
|
31594
|
+
className: aphrodite.css(styles$e.backgroundUrlInput),
|
|
31686
31595
|
ref: this.bgUrlRef,
|
|
31687
31596
|
value: this.state.backgroundImage.url || "",
|
|
31688
31597
|
onChange: e => {
|
|
@@ -31698,98 +31607,25 @@ class InteractiveGraphSettings extends React__namespace.Component {
|
|
|
31698
31607
|
onKeyPress: this.changeBackgroundUrl,
|
|
31699
31608
|
onBlur: this.changeBackgroundUrl
|
|
31700
31609
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$c, 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, {
|
|
31701
|
-
style: styles$
|
|
31610
|
+
style: styles$e.protractorSection
|
|
31702
31611
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31703
|
-
style: styles$
|
|
31612
|
+
style: styles$e.checkboxRow
|
|
31704
31613
|
}, /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
31705
|
-
label: "Show ruler",
|
|
31706
|
-
showRuler: this.props.showRuler,
|
|
31707
|
-
onChange: this.change,
|
|
31708
|
-
style: styles$d.resetSpaceTop
|
|
31709
|
-
}), /*#__PURE__*/React__namespace.createElement(PropCheckBox$7, {
|
|
31710
31614
|
label: "Show protractor",
|
|
31711
31615
|
showProtractor: this.props.showProtractor,
|
|
31712
31616
|
onChange: this.change,
|
|
31713
|
-
style: styles$
|
|
31714
|
-
})),
|
|
31617
|
+
style: styles$e.resetSpaceTop
|
|
31618
|
+
})), this.props.showProtractor && /*#__PURE__*/React__namespace.createElement(Banner__default["default"], {
|
|
31715
31619
|
layout: "floating",
|
|
31716
|
-
text: "The
|
|
31620
|
+
text: "The protractor is not accessible. Please consider an alternate approach.",
|
|
31717
31621
|
kind: "warning"
|
|
31718
|
-
})
|
|
31719
|
-
style: styles$d.spaceTop
|
|
31720
|
-
}, /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
31721
|
-
label: "Ruler label:",
|
|
31722
|
-
style: styles$d.resetSpaceTop
|
|
31723
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
31724
|
-
id: "ruler-label-select",
|
|
31725
|
-
selectedValue: this.props.rulerLabel,
|
|
31726
|
-
onChange: newValue => {
|
|
31727
|
-
this.change({
|
|
31728
|
-
rulerLabel: newValue
|
|
31729
|
-
});
|
|
31730
|
-
},
|
|
31731
|
-
placeholder: "None",
|
|
31732
|
-
style: styles$d.singleSelectShort
|
|
31733
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31734
|
-
value: "",
|
|
31735
|
-
label: "None",
|
|
31736
|
-
horizontalRule: "full-width"
|
|
31737
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31738
|
-
value: "mm",
|
|
31739
|
-
label: "Milimeters"
|
|
31740
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31741
|
-
value: "cm",
|
|
31742
|
-
label: "Centimeters"
|
|
31743
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31744
|
-
value: "m",
|
|
31745
|
-
label: "Meters"
|
|
31746
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31747
|
-
value: "km",
|
|
31748
|
-
label: "Kilometers",
|
|
31749
|
-
horizontalRule: "full-width"
|
|
31750
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31751
|
-
value: "in",
|
|
31752
|
-
label: "Inches"
|
|
31753
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31754
|
-
value: "ft",
|
|
31755
|
-
label: "Feet"
|
|
31756
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31757
|
-
value: "yd",
|
|
31758
|
-
label: "Yards"
|
|
31759
|
-
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31760
|
-
value: "mi",
|
|
31761
|
-
label: "Miles"
|
|
31762
|
-
}))), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
31763
|
-
label: "Ruler ticks:"
|
|
31764
|
-
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.SingleSelect, {
|
|
31765
|
-
id: "ruler-ticks-select",
|
|
31766
|
-
selectedValue: `${this.props.rulerTicks}`,
|
|
31767
|
-
onChange: newValue => {
|
|
31768
|
-
this.change({
|
|
31769
|
-
rulerTicks: newValue
|
|
31770
|
-
});
|
|
31771
|
-
},
|
|
31772
|
-
placeholder: "10",
|
|
31773
|
-
style: styles$d.singleSelectShort
|
|
31774
|
-
}, [1, 2, 4, 8, 10, 16].map(value => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31775
|
-
key: value,
|
|
31776
|
-
value: `${value}`,
|
|
31777
|
-
label: `${value}`
|
|
31778
|
-
}))))))));
|
|
31622
|
+
}))));
|
|
31779
31623
|
}
|
|
31780
31624
|
}
|
|
31781
|
-
const styles$
|
|
31625
|
+
const styles$e = aphrodite.StyleSheet.create({
|
|
31782
31626
|
resetSpaceTop: {
|
|
31783
31627
|
marginTop: 0
|
|
31784
31628
|
},
|
|
31785
|
-
spaceTop: {
|
|
31786
|
-
marginTop: wonderBlocksTokens.spacing.xSmall_8
|
|
31787
|
-
},
|
|
31788
|
-
singleSelectShort: {
|
|
31789
|
-
// Non-standard spacing, but it's the smallest we can go
|
|
31790
|
-
// without running into styling issues with the dropdown.
|
|
31791
|
-
height: 26
|
|
31792
|
-
},
|
|
31793
31629
|
backgroundUrlInput: {
|
|
31794
31630
|
border: `1px solid ${wonderBlocksTokens.color.offBlack32}`,
|
|
31795
31631
|
borderRadius: wonderBlocksTokens.spacing.xxxSmall_4,
|
|
@@ -31801,7 +31637,7 @@ const styles$d = aphrodite.StyleSheet.create({
|
|
|
31801
31637
|
justifyContent: "space-between",
|
|
31802
31638
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
31803
31639
|
},
|
|
31804
|
-
|
|
31640
|
+
protractorSection: {
|
|
31805
31641
|
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
31806
31642
|
borderTop: `1px solid ${wonderBlocksTokens.color.offBlack16}`,
|
|
31807
31643
|
paddingTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
@@ -31825,14 +31661,14 @@ const SegmentCountSelector = _ref => {
|
|
|
31825
31661
|
const num = +newValue;
|
|
31826
31662
|
onChange(num);
|
|
31827
31663
|
},
|
|
31828
|
-
style: styles$
|
|
31664
|
+
style: styles$d.singleSelectShort
|
|
31829
31665
|
}, ___default["default"].range(1, 7).map(n => /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
31830
31666
|
key: n,
|
|
31831
31667
|
value: `${n}`,
|
|
31832
31668
|
label: `${n} segment${n > 1 ? "s" : ""}`
|
|
31833
31669
|
})));
|
|
31834
31670
|
};
|
|
31835
|
-
const styles$
|
|
31671
|
+
const styles$d = aphrodite.StyleSheet.create({
|
|
31836
31672
|
singleSelectShort: {
|
|
31837
31673
|
// Non-standard spacing, but it's the smallest we can go
|
|
31838
31674
|
// without running into styling issues with the dropdown.
|
|
@@ -31840,76 +31676,142 @@ const styles$c = aphrodite.StyleSheet.create({
|
|
|
31840
31676
|
}
|
|
31841
31677
|
});
|
|
31842
31678
|
|
|
31843
|
-
const
|
|
31679
|
+
const StartCoordsLine = props => {
|
|
31680
|
+
const {
|
|
31681
|
+
startCoords,
|
|
31682
|
+
onChange
|
|
31683
|
+
} = props;
|
|
31684
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31685
|
+
style: styles$c.tile
|
|
31686
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 1:"), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31687
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
31688
|
+
}), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
31689
|
+
coord: startCoords[0],
|
|
31690
|
+
labels: ["x", "y"],
|
|
31691
|
+
onChange: value => onChange([value, startCoords[1]])
|
|
31692
|
+
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31693
|
+
style: styles$c.tile
|
|
31694
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 2:"), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31695
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
31696
|
+
}), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
31697
|
+
coord: startCoords[1],
|
|
31698
|
+
labels: ["x", "y"],
|
|
31699
|
+
onChange: value => onChange([startCoords[0], value])
|
|
31700
|
+
})));
|
|
31701
|
+
};
|
|
31702
|
+
const styles$c = aphrodite.StyleSheet.create({
|
|
31703
|
+
tile: {
|
|
31704
|
+
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
31705
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
31706
|
+
padding: wonderBlocksTokens.spacing.small_12,
|
|
31707
|
+
borderRadius: wonderBlocksTokens.spacing.xSmall_8,
|
|
31708
|
+
flexDirection: "row",
|
|
31709
|
+
alignItems: "center"
|
|
31710
|
+
}
|
|
31711
|
+
});
|
|
31712
|
+
|
|
31713
|
+
const StartCoordsMultiline = props => {
|
|
31844
31714
|
const {
|
|
31845
|
-
type,
|
|
31846
31715
|
startCoords,
|
|
31716
|
+
type,
|
|
31847
31717
|
onChange
|
|
31848
31718
|
} = props;
|
|
31719
|
+
const graphName = type === "segment" ? "Segment" : "Line";
|
|
31720
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, startCoords.map((coordPair, i) => /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
31721
|
+
key: `segment-${i}-start-coords`,
|
|
31722
|
+
header: /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, `${graphName} ${i + 1}`),
|
|
31723
|
+
expanded: true
|
|
31724
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31725
|
+
style: styles$b.nestedTile
|
|
31726
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 1:"), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31727
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
31728
|
+
}), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
31729
|
+
coord: coordPair[0],
|
|
31730
|
+
labels: ["x", "y"],
|
|
31731
|
+
onChange: value => {
|
|
31732
|
+
const newCoords = [...startCoords];
|
|
31733
|
+
newCoords[i] = [value, coordPair[1]];
|
|
31734
|
+
onChange(newCoords);
|
|
31735
|
+
}
|
|
31736
|
+
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31737
|
+
style: styles$b.nestedTile
|
|
31738
|
+
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksTypography.LabelLarge, null, "Point 2:"), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31739
|
+
size: wonderBlocksTokens.spacing.small_12
|
|
31740
|
+
}), /*#__PURE__*/React__namespace.createElement(CoordinatePairInput, {
|
|
31741
|
+
coord: coordPair[1],
|
|
31742
|
+
labels: ["x", "y"],
|
|
31743
|
+
onChange: value => {
|
|
31744
|
+
const newCoords = [...startCoords];
|
|
31745
|
+
newCoords[i] = [coordPair[0], value];
|
|
31746
|
+
onChange(newCoords);
|
|
31747
|
+
}
|
|
31748
|
+
})))));
|
|
31749
|
+
};
|
|
31750
|
+
const styles$b = aphrodite.StyleSheet.create({
|
|
31751
|
+
nestedTile: {
|
|
31752
|
+
paddingBottom: wonderBlocksTokens.spacing.small_12,
|
|
31753
|
+
flexDirection: "row",
|
|
31754
|
+
alignItems: "center"
|
|
31755
|
+
}
|
|
31756
|
+
});
|
|
31849
31757
|
|
|
31850
|
-
|
|
31758
|
+
const StartCoordsSettingsInner = props => {
|
|
31759
|
+
const {
|
|
31760
|
+
type,
|
|
31761
|
+
range,
|
|
31762
|
+
step,
|
|
31763
|
+
onChange
|
|
31764
|
+
} = props;
|
|
31851
31765
|
switch (type) {
|
|
31766
|
+
// Graphs with startCoords of type CollinearTuple
|
|
31852
31767
|
case "linear":
|
|
31853
31768
|
case "ray":
|
|
31854
|
-
|
|
31855
|
-
|
|
31856
|
-
|
|
31857
|
-
|
|
31858
|
-
|
|
31859
|
-
|
|
31860
|
-
|
|
31861
|
-
|
|
31862
|
-
|
|
31863
|
-
|
|
31864
|
-
|
|
31769
|
+
// Gets the startCoords from props if they're passed in,
|
|
31770
|
+
// otherwise calculates the default startCoords.
|
|
31771
|
+
const linearCoords = perseus.getLineCoords(props, range, step);
|
|
31772
|
+
return /*#__PURE__*/React__namespace.createElement(StartCoordsLine, {
|
|
31773
|
+
startCoords: linearCoords,
|
|
31774
|
+
onChange: onChange
|
|
31775
|
+
});
|
|
31776
|
+
// Graphs with startCoords of type CollinearTuple[]
|
|
31777
|
+
case "linear-system":
|
|
31778
|
+
case "segment":
|
|
31779
|
+
const multiLineCoords =
|
|
31780
|
+
// Gets the startCoords from props if they're passed in,
|
|
31781
|
+
// otherwise calculates the default startCoords.
|
|
31782
|
+
type === "segment" ? perseus.getSegmentCoords(props, range, step) : perseus.getLinearSystemCoords(props, range, step);
|
|
31783
|
+
return /*#__PURE__*/React__namespace.createElement(StartCoordsMultiline, {
|
|
31784
|
+
type: type,
|
|
31785
|
+
startCoords: multiLineCoords,
|
|
31786
|
+
onChange: onChange
|
|
31787
|
+
});
|
|
31865
31788
|
default:
|
|
31866
31789
|
return null;
|
|
31867
31790
|
}
|
|
31868
31791
|
};
|
|
31869
|
-
const
|
|
31792
|
+
const StartCoordsSettings = props => {
|
|
31870
31793
|
const {
|
|
31871
|
-
type,
|
|
31872
31794
|
range,
|
|
31873
31795
|
step,
|
|
31874
31796
|
onChange
|
|
31875
31797
|
} = props;
|
|
31876
31798
|
const [isOpen, setIsOpen] = React__namespace.useState(true);
|
|
31877
|
-
|
|
31878
|
-
return null;
|
|
31879
|
-
}
|
|
31880
|
-
const defaultStartCoords = perseus.getLineCoords({
|
|
31881
|
-
type: type
|
|
31882
|
-
}, range, step);
|
|
31883
|
-
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31884
|
-
style: styles$b.container
|
|
31885
|
-
}, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31799
|
+
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, /*#__PURE__*/React__namespace.createElement(Heading, {
|
|
31886
31800
|
isCollapsible: true,
|
|
31887
31801
|
title: "Start coordinates",
|
|
31888
31802
|
isOpen: isOpen,
|
|
31889
31803
|
onToggle: () => setIsOpen(!isOpen)
|
|
31890
|
-
}), isOpen && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(
|
|
31891
|
-
type: type,
|
|
31892
|
-
startCoords: props.startCoords ?? defaultStartCoords,
|
|
31893
|
-
onChange: onChange
|
|
31894
|
-
}), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31804
|
+
}), isOpen && /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement(StartCoordsSettingsInner, props), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
31895
31805
|
size: wonderBlocksTokens.spacing.small_12
|
|
31896
31806
|
}), /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
31897
31807
|
startIcon: arrowCounterClockwise__default["default"],
|
|
31898
31808
|
kind: "tertiary",
|
|
31899
31809
|
size: "small",
|
|
31900
31810
|
onClick: () => {
|
|
31901
|
-
onChange(
|
|
31811
|
+
onChange(getDefaultGraphStartCoords(props, range, step));
|
|
31902
31812
|
}
|
|
31903
|
-
}, "Use default start
|
|
31813
|
+
}, "Use default start coordinates")));
|
|
31904
31814
|
};
|
|
31905
|
-
const styles$b = aphrodite.StyleSheet.create({
|
|
31906
|
-
tile: {
|
|
31907
|
-
backgroundColor: wonderBlocksTokens.color.fadedBlue8,
|
|
31908
|
-
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
31909
|
-
padding: wonderBlocksTokens.spacing.small_12,
|
|
31910
|
-
borderRadius: wonderBlocksTokens.spacing.xSmall_8
|
|
31911
|
-
}
|
|
31912
|
-
});
|
|
31913
31815
|
|
|
31914
31816
|
const {
|
|
31915
31817
|
InfoTip: InfoTip$b
|
|
@@ -31987,10 +31889,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
31987
31889
|
backgroundImage: this.props.backgroundImage,
|
|
31988
31890
|
markings: this.props.markings,
|
|
31989
31891
|
showProtractor: this.props.showProtractor,
|
|
31990
|
-
showRuler: this.props.showRuler,
|
|
31991
31892
|
showTooltips: this.props.showTooltips,
|
|
31992
|
-
rulerLabel: this.props.rulerLabel,
|
|
31993
|
-
rulerTicks: this.props.rulerTicks,
|
|
31994
31893
|
lockedFigures: this.props.lockedFigures,
|
|
31995
31894
|
trackInteraction: function () {},
|
|
31996
31895
|
onChange: newProps => {
|
|
@@ -32177,7 +32076,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32177
32076
|
}
|
|
32178
32077
|
});
|
|
32179
32078
|
}
|
|
32180
|
-
})),
|
|
32079
|
+
})), this.props.graph?.type && this.props.apiOptions.flags?.mafs?.["start-coords-ui"] && /*#__PURE__*/React__namespace.createElement(StartCoordsSettings, _extends({}, this.props.graph, {
|
|
32181
32080
|
range: this.props.range,
|
|
32182
32081
|
step: this.props.step,
|
|
32183
32082
|
onChange: this.changeStartCoords
|
|
@@ -32192,10 +32091,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32192
32091
|
backgroundImage: this.props.backgroundImage,
|
|
32193
32092
|
markings: this.props.markings,
|
|
32194
32093
|
showProtractor: this.props.showProtractor,
|
|
32195
|
-
showRuler: this.props.showRuler,
|
|
32196
32094
|
showTooltips: this.props.showTooltips,
|
|
32197
|
-
rulerLabel: this.props.rulerLabel,
|
|
32198
|
-
rulerTicks: this.props.rulerTicks,
|
|
32199
32095
|
onChange: this.props.onChange
|
|
32200
32096
|
}), this.props.correct.type === "polygon" && /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
32201
32097
|
label: "Student answer must"
|
|
@@ -32253,7 +32149,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32253
32149
|
});
|
|
32254
32150
|
};
|
|
32255
32151
|
changeStartCoords = coords => {
|
|
32256
|
-
if (this.props.graph?.type
|
|
32152
|
+
if (!this.props.graph?.type) {
|
|
32257
32153
|
return;
|
|
32258
32154
|
}
|
|
32259
32155
|
const graph = {
|
|
@@ -32270,7 +32166,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32270
32166
|
// is copied from the question editor and pasted into the hint editor
|
|
32271
32167
|
// (double brackets in the markdown).
|
|
32272
32168
|
serialize() {
|
|
32273
|
-
const json = ___default["default"].pick(this.props, "step", "backgroundImage", "markings", "labels", "showProtractor", "
|
|
32169
|
+
const json = ___default["default"].pick(this.props, "step", "backgroundImage", "markings", "labels", "showProtractor", "showTooltips", "range", "gridStep", "snapStep", "lockedFigures");
|
|
32274
32170
|
|
|
32275
32171
|
// eslint-disable-next-line react/no-string-refs
|
|
32276
32172
|
const graph = this.refs.graph;
|
|
@@ -32286,7 +32182,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
32286
32182
|
});
|
|
32287
32183
|
___default["default"].each(["allowReflexAngles", "angleOffsetDeg", "numPoints", "numSides", "numSegments", "showAngles", "showSides", "snapTo", "snapDegrees"], function (key) {
|
|
32288
32184
|
if (___default["default"].has(correct, key)) {
|
|
32289
|
-
// @ts-expect-error - TS2339 - Property 'graph' does not exist on type 'Pick<any, "step" | "range" | "backgroundImage" | "snapStep" | "labels" | "showTooltips" | "markings" | "gridStep" | "showProtractor"
|
|
32185
|
+
// @ts-expect-error - TS2339 - Property 'graph' does not exist on type 'Pick<any, "step" | "range" | "backgroundImage" | "snapStep" | "labels" | "showTooltips" | "markings" | "gridStep" | "showProtractor">'.
|
|
32290
32186
|
json.graph[key] = correct[key];
|
|
32291
32187
|
}
|
|
32292
32188
|
});
|
|
@@ -34018,7 +33914,7 @@ class MatrixEditor extends React__namespace.Component {
|
|
|
34018
33914
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
34019
33915
|
const {
|
|
34020
33916
|
InfoTip: InfoTip$9,
|
|
34021
|
-
NumberInput: NumberInput$
|
|
33917
|
+
NumberInput: NumberInput$7,
|
|
34022
33918
|
PropCheckBox: PropCheckBox$5,
|
|
34023
33919
|
RangeInput: RangeInput$2
|
|
34024
33920
|
} = perseus.components;
|
|
@@ -34071,14 +33967,14 @@ class MeasurerEditor extends React__namespace.Component {
|
|
|
34071
33967
|
className: "perseus-widget-row"
|
|
34072
33968
|
}, /*#__PURE__*/React__namespace.createElement("label", {
|
|
34073
33969
|
className: "perseus-widget-left-col"
|
|
34074
|
-
}, "Pixels from top:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
33970
|
+
}, "Pixels from top:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
|
|
34075
33971
|
placeholder: 0,
|
|
34076
33972
|
onChange: this._changeTop,
|
|
34077
33973
|
value: image.top,
|
|
34078
33974
|
useArrowKeys: true
|
|
34079
33975
|
})), /*#__PURE__*/React__namespace.createElement("label", {
|
|
34080
33976
|
className: "perseus-widget-right-col"
|
|
34081
|
-
}, "Pixels from left:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
33977
|
+
}, "Pixels from left:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
|
|
34082
33978
|
placeholder: 0,
|
|
34083
33979
|
onChange: this._changeLeft,
|
|
34084
33980
|
value: image.left,
|
|
@@ -34124,14 +34020,14 @@ class MeasurerEditor extends React__namespace.Component {
|
|
|
34124
34020
|
key: n,
|
|
34125
34021
|
value: n
|
|
34126
34022
|
}, n);
|
|
34127
|
-
})))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Ruler pixels per unit:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34023
|
+
})))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Ruler pixels per unit:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
|
|
34128
34024
|
placeholder: 40
|
|
34129
34025
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
34130
34026
|
,
|
|
34131
34027
|
onChange: this.change("rulerPixels"),
|
|
34132
34028
|
value: this.props.rulerPixels,
|
|
34133
34029
|
useArrowKeys: true
|
|
34134
|
-
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Ruler length in units:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34030
|
+
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Ruler length in units:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$7, {
|
|
34135
34031
|
placeholder: 10
|
|
34136
34032
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
34137
34033
|
,
|
|
@@ -34179,7 +34075,7 @@ class MeasurerEditor extends React__namespace.Component {
|
|
|
34179
34075
|
}
|
|
34180
34076
|
|
|
34181
34077
|
const {
|
|
34182
|
-
NumberInput: NumberInput$
|
|
34078
|
+
NumberInput: NumberInput$6,
|
|
34183
34079
|
TextInput: TextInput$4
|
|
34184
34080
|
} = perseus.components;
|
|
34185
34081
|
class MoleculeWidgetEditor extends React__namespace.Component {
|
|
@@ -34217,7 +34113,7 @@ class MoleculeWidgetEditor extends React__namespace.Component {
|
|
|
34217
34113
|
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "SMILES:\xA0", /*#__PURE__*/React__namespace.createElement(TextInput$4, {
|
|
34218
34114
|
onChange: this.updateMolecule,
|
|
34219
34115
|
value: this.props.smiles
|
|
34220
|
-
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Rotation (deg):\xA0", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34116
|
+
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Rotation (deg):\xA0", /*#__PURE__*/React__namespace.createElement(NumberInput$6, {
|
|
34221
34117
|
onChange: this.updateRotation,
|
|
34222
34118
|
value: this.props.rotationAngle
|
|
34223
34119
|
}))));
|
|
@@ -34228,7 +34124,7 @@ class MoleculeWidgetEditor extends React__namespace.Component {
|
|
|
34228
34124
|
const {
|
|
34229
34125
|
ButtonGroup: ButtonGroup$1,
|
|
34230
34126
|
InfoTip: InfoTip$8,
|
|
34231
|
-
NumberInput: NumberInput$
|
|
34127
|
+
NumberInput: NumberInput$5,
|
|
34232
34128
|
PropCheckBox: PropCheckBox$4,
|
|
34233
34129
|
RangeInput: RangeInput$1
|
|
34234
34130
|
} = perseus.components;
|
|
@@ -34408,7 +34304,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34408
34304
|
}, "\u2264"), /*#__PURE__*/React__namespace.createElement("option", {
|
|
34409
34305
|
value: "ge",
|
|
34410
34306
|
"aria-label": "Greater than or equal"
|
|
34411
|
-
}, "\u2265")), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34307
|
+
}, "\u2265")), " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34412
34308
|
value: this.props.correctX,
|
|
34413
34309
|
format: this.props.labelStyle
|
|
34414
34310
|
// eslint-disable-next-line react/jsx-no-bind
|
|
@@ -34420,7 +34316,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34420
34316
|
useArrowKeys: true
|
|
34421
34317
|
}), /*#__PURE__*/React__namespace.createElement(InfoTip$8, null, /*#__PURE__*/React__namespace.createElement("p", null, "This is the correct answer. The answer is validated (as right or wrong) by using only the end position of the point and the relation (=, <, >, \u2264, \u2265)."))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
34422
34318
|
className: "perseus-widget-row"
|
|
34423
|
-
}, this.props.static ? /*#__PURE__*/React__namespace.createElement("label", null, "Range:") : /*#__PURE__*/React__namespace.createElement("label", null, "Position:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34319
|
+
}, this.props.static ? /*#__PURE__*/React__namespace.createElement("label", null, "Range:") : /*#__PURE__*/React__namespace.createElement("label", null, "Position:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34424
34320
|
value: this.props.initialX,
|
|
34425
34321
|
format: this.props.labelStyle
|
|
34426
34322
|
// eslint-disable-next-line react/jsx-no-bind
|
|
@@ -34440,7 +34336,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34440
34336
|
className: "perseus-widget-row"
|
|
34441
34337
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
34442
34338
|
className: "perseus-widget-left-col"
|
|
34443
|
-
}, "Labels:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34339
|
+
}, "Labels:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34444
34340
|
value: labelRange[0],
|
|
34445
34341
|
placeholder: range[0],
|
|
34446
34342
|
format: this.props.labelStyle,
|
|
@@ -34449,7 +34345,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34449
34345
|
,
|
|
34450
34346
|
onChange: this.onLabelRangeChange.bind(this, 0),
|
|
34451
34347
|
useArrowKeys: true
|
|
34452
|
-
}), /*#__PURE__*/React__namespace.createElement("span", null, " & "), /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34348
|
+
}), /*#__PURE__*/React__namespace.createElement("span", null, " & "), /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34453
34349
|
value: labelRange[1],
|
|
34454
34350
|
placeholder: range[1],
|
|
34455
34351
|
format: this.props.labelStyle,
|
|
@@ -34487,7 +34383,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34487
34383
|
onChange: this.props.onChange
|
|
34488
34384
|
})), /*#__PURE__*/React__namespace.createElement("div", {
|
|
34489
34385
|
className: "perseus-widget-row"
|
|
34490
|
-
}, isTickCtrl && /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34386
|
+
}, isTickCtrl && /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("label", null, "Start num divisions at", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34491
34387
|
value: this.props.numDivisions || null,
|
|
34492
34388
|
format: "decimal",
|
|
34493
34389
|
onChange: this.onNumDivisionsChange,
|
|
@@ -34496,7 +34392,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34496
34392
|
},
|
|
34497
34393
|
placeholder: width / this.props.tickStep,
|
|
34498
34394
|
useArrowKeys: true
|
|
34499
|
-
})), /*#__PURE__*/React__namespace.createElement(InfoTip$8, null, /*#__PURE__*/React__namespace.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34395
|
+
})), /*#__PURE__*/React__namespace.createElement(InfoTip$8, null, /*#__PURE__*/React__namespace.createElement("p", null, "This controls the number (and position) of the tick marks. The number of divisions is constrained to", " " + divisionRange[0] + EN_DASH + divisionRange[1], ".", /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("strong", null, "Note:"), " The user will be able to specify the number of divisions in a number input."))), !isTickCtrl && /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("label", null, "Num divisions:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34500
34396
|
value: this.props.numDivisions || null,
|
|
34501
34397
|
format: "decimal",
|
|
34502
34398
|
onChange: this.onNumDivisionsChange,
|
|
@@ -34505,7 +34401,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34505
34401
|
},
|
|
34506
34402
|
placeholder: width / this.props.tickStep,
|
|
34507
34403
|
useArrowKeys: true
|
|
34508
|
-
})), " ", /*#__PURE__*/React__namespace.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34404
|
+
})), " ", /*#__PURE__*/React__namespace.createElement("label", null, "or tick step:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34509
34405
|
value: this.props.tickStep || null,
|
|
34510
34406
|
format: this.props.labelStyle,
|
|
34511
34407
|
onChange: this.onTickStepChange,
|
|
@@ -34516,7 +34412,7 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34516
34412
|
useArrowKeys: true
|
|
34517
34413
|
})), /*#__PURE__*/React__namespace.createElement(InfoTip$8, null, /*#__PURE__*/React__namespace.createElement("p", null, "This controls the number (and position) of the tick marks; you can either set the number of divisions (2 divisions would split the entire range in two halves), or the tick step (the distance between ticks) and the other value will be updated accordingly.", " ", /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("strong", null, "Note:"), " There is no check to see if labels coordinate with the tick marks, which may be confusing for users if the blue labels and black ticks are off-step.")))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
34518
34414
|
className: "perseus-widget-row"
|
|
34519
|
-
}, /*#__PURE__*/React__namespace.createElement("label", null, "Snap increments per tick:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34415
|
+
}, /*#__PURE__*/React__namespace.createElement("label", null, "Snap increments per tick:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$5, {
|
|
34520
34416
|
value: snapDivisions,
|
|
34521
34417
|
checkValidity: val => val > 0,
|
|
34522
34418
|
format: this.props.labelStyle
|
|
@@ -34532,9 +34428,9 @@ class NumberLineEditor extends React__namespace.Component {
|
|
|
34532
34428
|
const {
|
|
34533
34429
|
ButtonGroup,
|
|
34534
34430
|
InfoTip: InfoTip$7,
|
|
34535
|
-
InlineIcon: InlineIcon$
|
|
34431
|
+
InlineIcon: InlineIcon$1,
|
|
34536
34432
|
MultiButtonGroup,
|
|
34537
|
-
NumberInput: NumberInput$
|
|
34433
|
+
NumberInput: NumberInput$4,
|
|
34538
34434
|
PropCheckBox: PropCheckBox$3,
|
|
34539
34435
|
TextInput: TextInput$3
|
|
34540
34436
|
} = perseus.components;
|
|
@@ -34638,7 +34534,7 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34638
34534
|
})));
|
|
34639
34535
|
const maxError = i => /*#__PURE__*/React__namespace.createElement("div", {
|
|
34640
34536
|
className: "perseus-widget-row"
|
|
34641
|
-
}, /*#__PURE__*/React__namespace.createElement("label", null, "Max error", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34537
|
+
}, /*#__PURE__*/React__namespace.createElement("label", null, "Max error", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$4, {
|
|
34642
34538
|
className: "max-error",
|
|
34643
34539
|
value: answers[i]["maxError"],
|
|
34644
34540
|
onChange: this.updateAnswer(i, "maxError"),
|
|
@@ -34713,7 +34609,7 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34713
34609
|
key: i
|
|
34714
34610
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
34715
34611
|
className: "input-answer-editor-value-container" + (answer.maxError ? " with-max-error" : "")
|
|
34716
|
-
}, /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34612
|
+
}, /*#__PURE__*/React__namespace.createElement(NumberInput$4, {
|
|
34717
34613
|
value: answer.value,
|
|
34718
34614
|
className: "numeric-input-value",
|
|
34719
34615
|
placeholder: "answer",
|
|
@@ -34760,7 +34656,7 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34760
34656
|
className: "max-error-container"
|
|
34761
34657
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
34762
34658
|
className: "max-error-plusmn"
|
|
34763
|
-
}, "\xB1"), /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
34659
|
+
}, "\xB1"), /*#__PURE__*/React__namespace.createElement(NumberInput$4, {
|
|
34764
34660
|
placeholder: 0,
|
|
34765
34661
|
value: answers[i]["maxError"],
|
|
34766
34662
|
format: ___default["default"].last(answer.answerForms || []),
|
|
@@ -34788,7 +34684,7 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34788
34684
|
this.onTrashAnswer(i);
|
|
34789
34685
|
},
|
|
34790
34686
|
onKeyDown: e => this.onSpace(e, this.onTrashAnswer)
|
|
34791
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
34687
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$1, iconTrash$1)), /*#__PURE__*/React__namespace.createElement("a", {
|
|
34792
34688
|
href: "#",
|
|
34793
34689
|
className: "options-toggle",
|
|
34794
34690
|
"aria-label": "Toggle options",
|
|
@@ -34799,7 +34695,7 @@ class NumericInputEditor extends React__namespace.Component {
|
|
|
34799
34695
|
this.onToggleOptions(i);
|
|
34800
34696
|
},
|
|
34801
34697
|
onKeyDown: e => this.onSpace(e, this.onToggleOptions)
|
|
34802
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$
|
|
34698
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$1, iconGear))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
34803
34699
|
className: "input-answer-editor-message"
|
|
34804
34700
|
}, editor), this.state.showOptions[i] && /*#__PURE__*/React__namespace.createElement("div", {
|
|
34805
34701
|
className: "options-container"
|
|
@@ -35114,7 +35010,7 @@ class PassageEditor extends React__namespace.Component {
|
|
|
35114
35010
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
35115
35011
|
const {
|
|
35116
35012
|
InfoTip: InfoTip$4,
|
|
35117
|
-
NumberInput: NumberInput$
|
|
35013
|
+
NumberInput: NumberInput$3,
|
|
35118
35014
|
TextInput: TextInput$2
|
|
35119
35015
|
} = perseus.components;
|
|
35120
35016
|
class PassageRefEditor extends React__namespace.Component {
|
|
@@ -35143,12 +35039,12 @@ class PassageRefEditor extends React__namespace.Component {
|
|
|
35143
35039
|
return perseus.EditorJsonify.serialize.call(this);
|
|
35144
35040
|
};
|
|
35145
35041
|
render() {
|
|
35146
|
-
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Passage Number: ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
35042
|
+
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Passage Number: ", /*#__PURE__*/React__namespace.createElement(NumberInput$3, {
|
|
35147
35043
|
value: this.props.passageNumber
|
|
35148
35044
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
35149
35045
|
,
|
|
35150
35046
|
onChange: this.change("passageNumber")
|
|
35151
|
-
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Reference Number: ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
35047
|
+
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Reference Number: ", /*#__PURE__*/React__namespace.createElement(NumberInput$3, {
|
|
35152
35048
|
value: this.props.referenceNumber
|
|
35153
35049
|
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
35154
35050
|
,
|
|
@@ -35200,7 +35096,7 @@ class PassageRefTargetEditor extends React__namespace.Component {
|
|
|
35200
35096
|
|
|
35201
35097
|
const {
|
|
35202
35098
|
InfoTip: InfoTip$3,
|
|
35203
|
-
NumberInput: NumberInput$
|
|
35099
|
+
NumberInput: NumberInput$2,
|
|
35204
35100
|
RangeInput,
|
|
35205
35101
|
TextListEditor: TextListEditor$1
|
|
35206
35102
|
} = perseus.components;
|
|
@@ -35450,7 +35346,7 @@ class PlotterEditor extends React__namespace.Component {
|
|
|
35450
35346
|
className: "set-from-scale-box"
|
|
35451
35347
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
35452
35348
|
className: "categories-title"
|
|
35453
|
-
}, "Set Categories From Scale"), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Tick Step:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
35349
|
+
}, "Set Categories From Scale"), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Tick Step:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$2, {
|
|
35454
35350
|
placeholder: 1,
|
|
35455
35351
|
useArrowKeys: true,
|
|
35456
35352
|
value: this.state.tickStep,
|
|
@@ -35462,7 +35358,7 @@ class PlotterEditor extends React__namespace.Component {
|
|
|
35462
35358
|
onChange: this.handleChangeRange
|
|
35463
35359
|
}))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("button", {
|
|
35464
35360
|
onClick: this.setCategoriesFromScale
|
|
35465
|
-
}, "Set Categories", " "))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Label Interval:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
35361
|
+
}, "Set Categories", " "))), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, "Label Interval:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$2, {
|
|
35466
35362
|
useArrowKeys: true,
|
|
35467
35363
|
value: this.props.labelInterval,
|
|
35468
35364
|
onChange: this.changeLabelInterval
|
|
@@ -35512,7 +35408,7 @@ class PlotterEditor extends React__namespace.Component {
|
|
|
35512
35408
|
* This editor is for embedding Khan Academy Python programs.
|
|
35513
35409
|
*/
|
|
35514
35410
|
const {
|
|
35515
|
-
NumberInput: NumberInput$
|
|
35411
|
+
NumberInput: NumberInput$1,
|
|
35516
35412
|
TextInput: TextInput$1
|
|
35517
35413
|
} = perseus.components;
|
|
35518
35414
|
function validateOptions(height, programID) {
|
|
@@ -35559,7 +35455,7 @@ class PythonProgramEditor extends React__namespace.Component {
|
|
|
35559
35455
|
value: this.props.programID,
|
|
35560
35456
|
onChange: this.change("programID"),
|
|
35561
35457
|
placeholder: "123"
|
|
35562
|
-
})), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("label", null, "Height:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$
|
|
35458
|
+
})), /*#__PURE__*/React__namespace.createElement("br", null), /*#__PURE__*/React__namespace.createElement("label", null, "Height:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput$1, {
|
|
35563
35459
|
value: this.props.height,
|
|
35564
35460
|
onChange: this.change("height"),
|
|
35565
35461
|
placeholder: "400"
|
|
@@ -35569,7 +35465,7 @@ class PythonProgramEditor extends React__namespace.Component {
|
|
|
35569
35465
|
|
|
35570
35466
|
/* eslint-disable jsx-a11y/anchor-is-valid, react/forbid-prop-types, react/sort-comp */
|
|
35571
35467
|
const {
|
|
35572
|
-
InlineIcon
|
|
35468
|
+
InlineIcon,
|
|
35573
35469
|
PropCheckBox: PropCheckBox$1
|
|
35574
35470
|
} = perseus.components;
|
|
35575
35471
|
const {
|
|
@@ -35621,7 +35517,7 @@ class ChoiceEditor extends React__namespace.Component {
|
|
|
35621
35517
|
this.props.onDelete();
|
|
35622
35518
|
},
|
|
35623
35519
|
title: "Remove this choice"
|
|
35624
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon
|
|
35520
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconTrash));
|
|
35625
35521
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
35626
35522
|
className: "choice-clue-editors"
|
|
35627
35523
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
@@ -35732,13 +35628,13 @@ class RadioEditor extends React__namespace.Component {
|
|
|
35732
35628
|
// eslint-disable-next-line react/jsx-no-bind
|
|
35733
35629
|
,
|
|
35734
35630
|
onClick: this.addChoice.bind(this, false)
|
|
35735
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon
|
|
35631
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconPlus), " Add a choice", " "), !this.props.hasNoneOfTheAbove && /*#__PURE__*/React__namespace.createElement("a", {
|
|
35736
35632
|
className: "simple-button",
|
|
35737
35633
|
href: "#"
|
|
35738
35634
|
// eslint-disable-next-line react/jsx-no-bind
|
|
35739
35635
|
,
|
|
35740
35636
|
onClick: this.addChoice.bind(this, true)
|
|
35741
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon
|
|
35637
|
+
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconPlus), " None of the above", " ")));
|
|
35742
35638
|
}
|
|
35743
35639
|
change = (() => {
|
|
35744
35640
|
var _this = this;
|
|
@@ -35978,7 +35874,7 @@ class SorterEditor extends React__namespace.Component {
|
|
|
35978
35874
|
/* eslint-disable react/sort-comp */
|
|
35979
35875
|
const {
|
|
35980
35876
|
InfoTip: InfoTip$1,
|
|
35981
|
-
NumberInput
|
|
35877
|
+
NumberInput
|
|
35982
35878
|
} = perseus.components;
|
|
35983
35879
|
const Table = perseus.TableWidget.widget;
|
|
35984
35880
|
class TableEditor extends React__namespace.Component {
|
|
@@ -36017,7 +35913,7 @@ class TableEditor extends React__namespace.Component {
|
|
|
36017
35913
|
});
|
|
36018
35914
|
return /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
36019
35915
|
className: "perseus-widget-row"
|
|
36020
|
-
}, /*#__PURE__*/React__namespace.createElement("label", null, "Number of columns:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput
|
|
35916
|
+
}, /*#__PURE__*/React__namespace.createElement("label", null, "Number of columns:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput, {
|
|
36021
35917
|
ref: this.numberOfColumns,
|
|
36022
35918
|
value: this.props.columns,
|
|
36023
35919
|
onChange: val => {
|
|
@@ -36028,7 +35924,7 @@ class TableEditor extends React__namespace.Component {
|
|
|
36028
35924
|
useArrowKeys: true
|
|
36029
35925
|
}))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
36030
35926
|
className: "perseus-widget-row"
|
|
36031
|
-
}, /*#__PURE__*/React__namespace.createElement("label", null, "Number of rows:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput
|
|
35927
|
+
}, /*#__PURE__*/React__namespace.createElement("label", null, "Number of rows:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput
|
|
36032
35928
|
// eslint-disable-next-line react/no-string-refs
|
|
36033
35929
|
, {
|
|
36034
35930
|
ref: "numberOfRows",
|
|
@@ -36085,240 +35981,6 @@ class TableEditor extends React__namespace.Component {
|
|
|
36085
35981
|
};
|
|
36086
35982
|
}
|
|
36087
35983
|
|
|
36088
|
-
/* eslint-disable react/no-unsafe */
|
|
36089
|
-
const {
|
|
36090
|
-
InlineIcon,
|
|
36091
|
-
NumberInput
|
|
36092
|
-
} = perseus.components;
|
|
36093
|
-
const {
|
|
36094
|
-
iconOk,
|
|
36095
|
-
iconRemove
|
|
36096
|
-
} = perseus.icons;
|
|
36097
|
-
|
|
36098
|
-
// TODO(joel): teach KAS how to accept an answer only if it's expressed in
|
|
36099
|
-
// terms of a certain type.
|
|
36100
|
-
// TODO(joel): Allow sigfigs within a range rather than an exact expected
|
|
36101
|
-
// value?
|
|
36102
|
-
|
|
36103
|
-
const ALL = "all";
|
|
36104
|
-
const SOME = "some";
|
|
36105
|
-
const MAX_SIGFIGS = 10;
|
|
36106
|
-
const sigfigPrint = function (num, sigfigs) {
|
|
36107
|
-
return perseus.displaySigFigs(num, sigfigs, -MAX_SIGFIGS, false);
|
|
36108
|
-
};
|
|
36109
|
-
|
|
36110
|
-
// Extract the primitive units from a unit expression. This first simplifies
|
|
36111
|
-
// `expr` to a `Mul` like "5 kg m / s^2" then removes the first term.
|
|
36112
|
-
const primUnits = function (expr) {
|
|
36113
|
-
return expr.simplify().asMul().partition()[1].flatten().simplify();
|
|
36114
|
-
};
|
|
36115
|
-
// Show the name of a unit and whether it's recognized by KAS.
|
|
36116
|
-
//
|
|
36117
|
-
// In the future I plan for this to show an example of a thing that would be
|
|
36118
|
-
// accepted in that unit.
|
|
36119
|
-
class UnitExample extends React__namespace.Component {
|
|
36120
|
-
// TODO(jangmi, CP-3288): Remove usage of `UNSAFE_componentWillMount`
|
|
36121
|
-
UNSAFE_componentWillMount() {
|
|
36122
|
-
// @ts-expect-error - TS2345 - Argument of type 'Readonly<any> & Readonly<{ children?: ReactNode; }>' is not assignable to parameter of type '{ name: any; original: any; sigfigs: any; }'.
|
|
36123
|
-
this._checkValidity(this.props);
|
|
36124
|
-
}
|
|
36125
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
36126
|
-
this._checkValidity(nextProps);
|
|
36127
|
-
}
|
|
36128
|
-
_checkValidity = _ref => {
|
|
36129
|
-
let {
|
|
36130
|
-
name,
|
|
36131
|
-
original,
|
|
36132
|
-
sigfigs
|
|
36133
|
-
} = _ref;
|
|
36134
|
-
const parseResult = KAS__namespace.unitParse(name);
|
|
36135
|
-
let solvedExample = "";
|
|
36136
|
-
|
|
36137
|
-
// A unit is valid if it parses and is equivalent to the original.
|
|
36138
|
-
let valid = true;
|
|
36139
|
-
if (parseResult.parsed && original) {
|
|
36140
|
-
const x = new KAS__namespace.Var("x");
|
|
36141
|
-
const {
|
|
36142
|
-
unit
|
|
36143
|
-
} = parseResult;
|
|
36144
|
-
const equality = new KAS__namespace.Eq(original, "=", new KAS__namespace.Mul(x, unit));
|
|
36145
|
-
try {
|
|
36146
|
-
const answer = equality.solveLinearEquationForVariable(x);
|
|
36147
|
-
|
|
36148
|
-
// The third parameter is the least significant decimal place.
|
|
36149
|
-
// I.e. the index of the last place you care about
|
|
36150
|
-
// (543210.(-1)(-2)(-3) etc). We use -10 because that should
|
|
36151
|
-
// always be safe since we only care up to maximum 10 decimal
|
|
36152
|
-
// places.
|
|
36153
|
-
solvedExample = sigfigPrint(answer.eval(), sigfigs);
|
|
36154
|
-
valid = KAS__namespace.compare(primUnits(original), primUnits(unit)).equal;
|
|
36155
|
-
} catch (e) {
|
|
36156
|
-
valid = false;
|
|
36157
|
-
}
|
|
36158
|
-
} else {
|
|
36159
|
-
valid = false;
|
|
36160
|
-
}
|
|
36161
|
-
this.setState({
|
|
36162
|
-
valid,
|
|
36163
|
-
solvedExample
|
|
36164
|
-
});
|
|
36165
|
-
};
|
|
36166
|
-
render() {
|
|
36167
|
-
let icon;
|
|
36168
|
-
if (this.state.valid) {
|
|
36169
|
-
icon = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("span", {
|
|
36170
|
-
className: "unit-example-okay"
|
|
36171
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconOk)), this.state.solvedExample);
|
|
36172
|
-
} else {
|
|
36173
|
-
icon = /*#__PURE__*/React__namespace.createElement("span", {
|
|
36174
|
-
className: "unit-example-not-okay"
|
|
36175
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconRemove));
|
|
36176
|
-
}
|
|
36177
|
-
return /*#__PURE__*/React__namespace.createElement("div", null, icon, " ", this.props.name);
|
|
36178
|
-
}
|
|
36179
|
-
}
|
|
36180
|
-
class UnitInputEditor extends React__namespace.Component {
|
|
36181
|
-
parsed;
|
|
36182
|
-
groupId;
|
|
36183
|
-
original;
|
|
36184
|
-
static propTypes = {
|
|
36185
|
-
...perseus.Changeable.propTypes,
|
|
36186
|
-
value: PropTypes__default["default"].string,
|
|
36187
|
-
acceptingUnits: PropTypes__default["default"].arrayOf(PropTypes__default["default"].string),
|
|
36188
|
-
accepting: PropTypes__default["default"].oneOf([ALL, SOME]),
|
|
36189
|
-
sigfigs: PropTypes__default["default"].number
|
|
36190
|
-
};
|
|
36191
|
-
static widgetName = "unit-input";
|
|
36192
|
-
static defaultProps = {
|
|
36193
|
-
value: "5x10^5 kg m / s^2",
|
|
36194
|
-
accepting: ALL,
|
|
36195
|
-
sigfigs: 3
|
|
36196
|
-
};
|
|
36197
|
-
constructor(props) {
|
|
36198
|
-
super(props);
|
|
36199
|
-
this.groupId = ___default["default"].uniqueId("accepting");
|
|
36200
|
-
this._doOriginal(props);
|
|
36201
|
-
}
|
|
36202
|
-
UNSAFE_componentWillReceiveProps(nextProps) {
|
|
36203
|
-
this._doOriginal(nextProps);
|
|
36204
|
-
}
|
|
36205
|
-
change = (() => {
|
|
36206
|
-
var _this = this;
|
|
36207
|
-
return function () {
|
|
36208
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
36209
|
-
args[_key] = arguments[_key];
|
|
36210
|
-
}
|
|
36211
|
-
return perseus.Changeable.change.apply(_this, args);
|
|
36212
|
-
};
|
|
36213
|
-
})();
|
|
36214
|
-
handleAcceptingUnitsChange = event => {
|
|
36215
|
-
const acceptingUnits = event.target.value.split(",").map(str => str.trim()).filter(str => str !== "");
|
|
36216
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
36217
|
-
this.change({
|
|
36218
|
-
acceptingUnits
|
|
36219
|
-
});
|
|
36220
|
-
};
|
|
36221
|
-
handleSigfigChange = sigfigs => {
|
|
36222
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
36223
|
-
this.change({
|
|
36224
|
-
sigfigs
|
|
36225
|
-
});
|
|
36226
|
-
};
|
|
36227
|
-
_checkSigfigValidity = sigfigs => {
|
|
36228
|
-
return sigfigs > 0 && sigfigs <= MAX_SIGFIGS;
|
|
36229
|
-
};
|
|
36230
|
-
_setAccepting = val => {
|
|
36231
|
-
// @ts-expect-error - TS2554 - Expected 3 arguments, but got 1.
|
|
36232
|
-
this.change({
|
|
36233
|
-
accepting: val
|
|
36234
|
-
});
|
|
36235
|
-
};
|
|
36236
|
-
_doOriginal = props => {
|
|
36237
|
-
const tryParse = KAS__namespace.unitParse(props.value);
|
|
36238
|
-
this.parsed = false;
|
|
36239
|
-
|
|
36240
|
-
// Only update this state if the unit parsed *and* it has a magnitude
|
|
36241
|
-
// attached to it. KAS can also parse units without magnitudes ("1.2
|
|
36242
|
-
// g" vs "g").
|
|
36243
|
-
if (tryParse.parsed && tryParse.type === "unitMagnitude") {
|
|
36244
|
-
this.original = tryParse.expr;
|
|
36245
|
-
this.parsed = true;
|
|
36246
|
-
}
|
|
36247
|
-
};
|
|
36248
|
-
onChange = event => {
|
|
36249
|
-
this.props.onChange({
|
|
36250
|
-
value: event.target.value
|
|
36251
|
-
});
|
|
36252
|
-
};
|
|
36253
|
-
getSaveWarnings = () => {
|
|
36254
|
-
const {
|
|
36255
|
-
value,
|
|
36256
|
-
accepting,
|
|
36257
|
-
acceptingUnits
|
|
36258
|
-
} = this.props;
|
|
36259
|
-
const warnings = [];
|
|
36260
|
-
const tryParse = KAS__namespace.unitParse(value);
|
|
36261
|
-
if (!tryParse.parsed) {
|
|
36262
|
-
warnings.push("Answer did not parse");
|
|
36263
|
-
}
|
|
36264
|
-
if (accepting === SOME && acceptingUnits.length === 0) {
|
|
36265
|
-
warnings.push("There are no accepted units");
|
|
36266
|
-
}
|
|
36267
|
-
return warnings;
|
|
36268
|
-
};
|
|
36269
|
-
serialize = () => {
|
|
36270
|
-
return perseus.EditorJsonify.serialize.call(this);
|
|
36271
|
-
};
|
|
36272
|
-
render() {
|
|
36273
|
-
const {
|
|
36274
|
-
acceptingUnits = [],
|
|
36275
|
-
accepting
|
|
36276
|
-
} = this.props;
|
|
36277
|
-
let acceptingElem = null;
|
|
36278
|
-
if (accepting === SOME) {
|
|
36279
|
-
const unitsArr = acceptingUnits.map((name, i) => /*#__PURE__*/React__namespace.createElement(UnitExample, {
|
|
36280
|
-
name: name,
|
|
36281
|
-
original: this.original || null,
|
|
36282
|
-
sigfigs: this.props.sigfigs,
|
|
36283
|
-
key: i
|
|
36284
|
-
}));
|
|
36285
|
-
|
|
36286
|
-
// @ts-expect-error - TS2322 - Type 'Element' is not assignable to type 'null'.
|
|
36287
|
-
acceptingElem = /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
36288
|
-
type: "text",
|
|
36289
|
-
defaultValue: acceptingUnits.join(", "),
|
|
36290
|
-
onChange: this.handleAcceptingUnitsChange
|
|
36291
|
-
}), " ", "(comma-separated)", unitsArr);
|
|
36292
|
-
}
|
|
36293
|
-
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
36294
|
-
className: "unit-editor"
|
|
36295
|
-
}, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
36296
|
-
value: this.props.value,
|
|
36297
|
-
className: "unit-editor-canonical",
|
|
36298
|
-
onChange: this.onChange
|
|
36299
|
-
}), " ", this.parsed ? /*#__PURE__*/React__namespace.createElement("span", {
|
|
36300
|
-
className: "unit-example-okay"
|
|
36301
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconOk)) : /*#__PURE__*/React__namespace.createElement("span", {
|
|
36302
|
-
className: "unit-example-not-okay"
|
|
36303
|
-
}, /*#__PURE__*/React__namespace.createElement(InlineIcon, iconRemove))), /*#__PURE__*/React__namespace.createElement("div", null, "Significant Figures:", " ", /*#__PURE__*/React__namespace.createElement(NumberInput, {
|
|
36304
|
-
value: this.props.sigfigs,
|
|
36305
|
-
onChange: this.handleSigfigChange,
|
|
36306
|
-
checkValidity: this._checkSigfigValidity,
|
|
36307
|
-
useArrowKeys: true
|
|
36308
|
-
})), /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
36309
|
-
type: "radio",
|
|
36310
|
-
name: this.groupId,
|
|
36311
|
-
onChange: () => this._setAccepting(ALL),
|
|
36312
|
-
checked: this.props.accepting === ALL
|
|
36313
|
-
}), " Any equivalent unit "), /*#__PURE__*/React__namespace.createElement("label", null, /*#__PURE__*/React__namespace.createElement("input", {
|
|
36314
|
-
type: "radio",
|
|
36315
|
-
name: this.groupId,
|
|
36316
|
-
onChange: () => this._setAccepting(SOME),
|
|
36317
|
-
checked: this.props.accepting === SOME
|
|
36318
|
-
}), " Only these units ")), acceptingElem);
|
|
36319
|
-
}
|
|
36320
|
-
}
|
|
36321
|
-
|
|
36322
35984
|
const {
|
|
36323
35985
|
InfoTip
|
|
36324
35986
|
} = perseus.components;
|
|
@@ -36376,7 +36038,7 @@ class VideoEditor extends React__namespace.Component {
|
|
|
36376
36038
|
}
|
|
36377
36039
|
}
|
|
36378
36040
|
|
|
36379
|
-
var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, PythonProgramEditor, SimpleMarkdownTesterEditor, SorterEditor, TableEditor,
|
|
36041
|
+
var AllEditors = [CategorizerEditor, CSProgramEditor, DefinitionEditor, DropdownEditor, ExampleGraphieWidgetEditor, ExampleWidgetEditor, ExplanationEditor, ExpressionEditor, GradedGroupEditor, GradedGroupSetEditor, GrapherEditor, GroupEditor, IframeEditor, ImageEditor, InputNumberEditor, InteractionEditor, InteractiveGraphEditor, LabelImageEditor, MatcherEditor, MatrixEditor, MeasurerEditor, MoleculeWidgetEditor, NumberLineEditor, NumericInputEditor, OrdererEditor, PassageEditor, PassageRefEditor, PassageRefTargetEditor, PlotterEditor, PythonProgramEditor, SimpleMarkdownTesterEditor, SorterEditor, TableEditor, VideoEditor, RadioEditor, DeprecatedStandinEditor];
|
|
36380
36042
|
|
|
36381
36043
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
36382
36044
|
class TextInput extends React__namespace.Component {
|
|
@@ -36608,7 +36270,6 @@ exports.EditorPage = EditorPage;
|
|
|
36608
36270
|
exports.IframeContentRenderer = IframeContentRenderer;
|
|
36609
36271
|
exports.ItemDiff = ItemDiff;
|
|
36610
36272
|
exports.MultiRendererEditor = MultiRendererEditor;
|
|
36611
|
-
exports.StatefulArticleEditor = StatefulArticleEditor;
|
|
36612
36273
|
exports.StatefulEditorPage = StatefulEditorPage;
|
|
36613
36274
|
exports.StructuredItemDiff = StructuredItemDiff;
|
|
36614
36275
|
exports.ViewportResizer = ViewportResizer;
|