@khanacademy/perseus-editor 5.2.2 → 5.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/device-framer.d.ts +6 -10
- package/dist/components/viewport-resizer.d.ts +8 -11
- package/dist/components/widget-editor.d.ts +1 -1
- package/dist/es/index.js +82 -97
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +85 -93
- package/dist/index.js.map +1 -1
- package/dist/item-editor.d.ts +2 -2
- package/dist/widgets/interactive-graph-editor.d.ts +8 -4
- package/package.json +3 -7
package/dist/index.js
CHANGED
|
@@ -6,12 +6,12 @@ var perseusCore = require('@khanacademy/perseus-core');
|
|
|
6
6
|
var perseus = require('@khanacademy/perseus');
|
|
7
7
|
var React = require('react');
|
|
8
8
|
var _ = require('underscore');
|
|
9
|
-
var PropTypes = require('prop-types');
|
|
10
9
|
var createReactClass = require('create-react-class');
|
|
11
10
|
var Clickable = require('@khanacademy/wonder-blocks-clickable');
|
|
12
|
-
var
|
|
11
|
+
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
13
12
|
var aphrodite = require('aphrodite');
|
|
14
13
|
var $ = require('jquery');
|
|
14
|
+
var PropTypes = require('prop-types');
|
|
15
15
|
var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
|
|
16
16
|
var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
|
|
17
17
|
var caretRight = require('@phosphor-icons/core/bold/caret-right-bold.svg');
|
|
@@ -23,9 +23,7 @@ var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
|
|
|
23
23
|
var mathInput = require('@khanacademy/math-input');
|
|
24
24
|
var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
|
|
25
25
|
var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
|
|
26
|
-
var Spacing = require('@khanacademy/wonder-blocks-spacing');
|
|
27
26
|
var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
|
|
28
|
-
var wonderBlocksTokens = require('@khanacademy/wonder-blocks-tokens');
|
|
29
27
|
var IconButton = require('@khanacademy/wonder-blocks-icon-button');
|
|
30
28
|
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
31
29
|
var Button = require('@khanacademy/wonder-blocks-button');
|
|
@@ -53,16 +51,14 @@ function _interopNamespace(e) {
|
|
|
53
51
|
|
|
54
52
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
55
53
|
var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
|
|
56
|
-
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
57
54
|
var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactClass);
|
|
58
55
|
var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
|
|
59
|
-
var Color__default = /*#__PURE__*/_interopDefaultLegacy(Color);
|
|
60
56
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
57
|
+
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
61
58
|
var caretRight__default = /*#__PURE__*/_interopDefaultLegacy(caretRight);
|
|
62
59
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
63
60
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
64
61
|
var KAS__namespace = /*#__PURE__*/_interopNamespace(KAS);
|
|
65
|
-
var Spacing__default = /*#__PURE__*/_interopDefaultLegacy(Spacing);
|
|
66
62
|
var IconButton__default = /*#__PURE__*/_interopDefaultLegacy(IconButton);
|
|
67
63
|
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
68
64
|
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
@@ -70,7 +66,7 @@ var i18n__namespace = /*#__PURE__*/_interopNamespace(i18n$1);
|
|
|
70
66
|
|
|
71
67
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
72
68
|
const libName = "@khanacademy/perseus-editor";
|
|
73
|
-
const libVersion = "5.2.
|
|
69
|
+
const libVersion = "5.2.4";
|
|
74
70
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
75
71
|
|
|
76
72
|
function _extends() {
|
|
@@ -108,48 +104,49 @@ const SCREEN_SIZES = {
|
|
|
108
104
|
framedWidth: 688
|
|
109
105
|
}
|
|
110
106
|
};
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
children
|
|
114
|
-
deviceType
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
//
|
|
135
|
-
// space
|
|
136
|
-
|
|
137
|
-
backgroundColor: "white",
|
|
138
|
-
color: "black",
|
|
139
|
-
textAlign: "left",
|
|
140
|
-
width: SCREEN_SIZES[deviceType].width,
|
|
141
|
-
height: SCREEN_SIZES[deviceType].height,
|
|
142
|
-
border: "solid 1px #CCC",
|
|
143
|
-
margin: 8,
|
|
144
|
-
zoom: scale
|
|
145
|
-
};
|
|
107
|
+
const DeviceFramer = _ref => {
|
|
108
|
+
let {
|
|
109
|
+
children,
|
|
110
|
+
deviceType = "phone",
|
|
111
|
+
nochrome
|
|
112
|
+
} = _ref;
|
|
113
|
+
const scale = React__namespace.useMemo(() => SCREEN_SIZES[deviceType].framedWidth / SCREEN_SIZES[deviceType].width, [deviceType]);
|
|
114
|
+
|
|
115
|
+
// In this mode we draw our own border and don't reserve
|
|
116
|
+
// space for a lint gutter.
|
|
117
|
+
const withChromeStyle = React__namespace.useMemo(() => ({
|
|
118
|
+
backgroundColor: "white",
|
|
119
|
+
overflow: "scroll",
|
|
120
|
+
color: "black",
|
|
121
|
+
textAlign: "left",
|
|
122
|
+
width: SCREEN_SIZES[deviceType].width,
|
|
123
|
+
height: SCREEN_SIZES[deviceType].height,
|
|
124
|
+
border: "solid 1px #CCC",
|
|
125
|
+
margin: 8,
|
|
126
|
+
zoom: scale
|
|
127
|
+
}), [deviceType, scale]);
|
|
128
|
+
if (nochrome) {
|
|
129
|
+
// Render content inside a variable height iframe. Used on the
|
|
130
|
+
// "edit" table of the content editor. In this mode, PerseusFrame
|
|
131
|
+
// will draw the border and reserve space on the right for
|
|
132
|
+
// lint indicators.
|
|
146
133
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
147
134
|
key: "screen",
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
135
|
+
style: {
|
|
136
|
+
overflow: "scroll",
|
|
137
|
+
width: SCREEN_SIZES[deviceType].framedWidth + 2 * perseus.constants.perseusFrameBorderWidth + perseus.constants.lintGutterWidth
|
|
138
|
+
}
|
|
139
|
+
}, /*#__PURE__*/React__namespace.createElement("div", null, children));
|
|
151
140
|
}
|
|
152
|
-
|
|
141
|
+
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
142
|
+
key: "screen",
|
|
143
|
+
className: "screen",
|
|
144
|
+
style: {
|
|
145
|
+
...withChromeStyle,
|
|
146
|
+
textAlign: "start"
|
|
147
|
+
}
|
|
148
|
+
}, children);
|
|
149
|
+
};
|
|
153
150
|
|
|
154
151
|
/* eslint-disable @babel/no-invalid-this */
|
|
155
152
|
const JsonEditor = createReactClass__default["default"]({
|
|
@@ -272,7 +269,7 @@ class SectionControlButton extends React__namespace.Component {
|
|
|
272
269
|
}
|
|
273
270
|
const styles$q = aphrodite.StyleSheet.create({
|
|
274
271
|
button: {
|
|
275
|
-
backgroundColor:
|
|
272
|
+
backgroundColor: wonderBlocksTokens.color.gold,
|
|
276
273
|
margin: 2,
|
|
277
274
|
paddingRight: 10,
|
|
278
275
|
paddingLeft: 10,
|
|
@@ -21001,7 +20998,8 @@ class Editor extends React__namespace.Component {
|
|
|
21001
20998
|
}
|
|
21002
20999
|
return /*#__PURE__*/React__namespace.createElement(WidgetEditor, _extends({
|
|
21003
21000
|
ref: id,
|
|
21004
|
-
id: id
|
|
21001
|
+
id: id,
|
|
21002
|
+
key: id
|
|
21005
21003
|
// eslint-disable-next-line react/jsx-no-bind
|
|
21006
21004
|
,
|
|
21007
21005
|
onChange: this._handleWidgetEditorChange.bind(this, id)
|
|
@@ -22108,42 +22106,30 @@ const {
|
|
|
22108
22106
|
iconMobilePhone,
|
|
22109
22107
|
iconTablet
|
|
22110
22108
|
} = perseus.icons;
|
|
22111
|
-
|
|
22112
|
-
|
|
22113
|
-
|
|
22114
|
-
|
|
22115
|
-
|
|
22116
|
-
|
|
22117
|
-
|
|
22118
|
-
|
|
22119
|
-
|
|
22120
|
-
|
|
22121
|
-
|
|
22122
|
-
|
|
22123
|
-
|
|
22124
|
-
|
|
22125
|
-
|
|
22126
|
-
|
|
22127
|
-
|
|
22128
|
-
|
|
22129
|
-
|
|
22130
|
-
|
|
22131
|
-
|
|
22132
|
-
|
|
22133
|
-
|
|
22134
|
-
|
|
22135
|
-
content: phoneButtonContents
|
|
22136
|
-
}, {
|
|
22137
|
-
value: devices.TABLET,
|
|
22138
|
-
content: tabletButtonContents
|
|
22139
|
-
}, {
|
|
22140
|
-
value: devices.DESKTOP,
|
|
22141
|
-
content: desktopButtonContents
|
|
22142
|
-
}],
|
|
22143
|
-
onChange: this.handleChange
|
|
22144
|
-
}));
|
|
22145
|
-
}
|
|
22146
|
-
}
|
|
22109
|
+
const ViewportResizer = props => {
|
|
22110
|
+
const phoneButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconMobilePhone), " Phone");
|
|
22111
|
+
const tabletButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconTablet), " Tablet");
|
|
22112
|
+
const desktopButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconDesktop), " Desktop");
|
|
22113
|
+
|
|
22114
|
+
// TODO(david): Allow input of custom viewport sizes.
|
|
22115
|
+
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
22116
|
+
className: "viewport-resizer"
|
|
22117
|
+
}, "Viewport:", " ", /*#__PURE__*/React__namespace.createElement(ButtonGroup$5, {
|
|
22118
|
+
value: props.deviceType,
|
|
22119
|
+
allowEmpty: false,
|
|
22120
|
+
buttons: [{
|
|
22121
|
+
value: devices.PHONE,
|
|
22122
|
+
content: phoneButtonContents
|
|
22123
|
+
}, {
|
|
22124
|
+
value: devices.TABLET,
|
|
22125
|
+
content: tabletButtonContents
|
|
22126
|
+
}, {
|
|
22127
|
+
value: devices.DESKTOP,
|
|
22128
|
+
content: desktopButtonContents
|
|
22129
|
+
}],
|
|
22130
|
+
onChange: props.onViewportSizeChanged
|
|
22131
|
+
}));
|
|
22132
|
+
};
|
|
22147
22133
|
|
|
22148
22134
|
/*
|
|
22149
22135
|
Software License Agreement (BSD License)
|
|
@@ -26690,6 +26676,7 @@ class ExpressionEditor extends React__namespace.Component {
|
|
|
26690
26676
|
widgetId: this.props.widgetId + "-" + ans.key
|
|
26691
26677
|
};
|
|
26692
26678
|
return lens(ans).merge([], {
|
|
26679
|
+
key,
|
|
26693
26680
|
draggable: true,
|
|
26694
26681
|
onChange: props => this.updateForm(Number.parseInt(ans.key ?? ""), props),
|
|
26695
26682
|
onDelete: () => this.handleRemoveForm(key),
|
|
@@ -27318,10 +27305,12 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27318
27305
|
}
|
|
27319
27306
|
},
|
|
27320
27307
|
renderLabelChoices: function (choices) {
|
|
27321
|
-
return ___default["default"].map(choices, function (
|
|
27308
|
+
return ___default["default"].map(choices, function (_ref) {
|
|
27309
|
+
let [name, value] = _ref;
|
|
27322
27310
|
return /*#__PURE__*/React__namespace.createElement("option", {
|
|
27323
|
-
|
|
27324
|
-
|
|
27311
|
+
key: value,
|
|
27312
|
+
value: value
|
|
27313
|
+
}, name);
|
|
27325
27314
|
});
|
|
27326
27315
|
},
|
|
27327
27316
|
validRange: function (range) {
|
|
@@ -27681,6 +27670,7 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27681
27670
|
value: this.props.rulerTicks
|
|
27682
27671
|
}, ___default["default"].map([1, 2, 4, 8, 10, 16], function (n) {
|
|
27683
27672
|
return /*#__PURE__*/React__namespace.createElement("option", {
|
|
27673
|
+
key: n,
|
|
27684
27674
|
value: n
|
|
27685
27675
|
}, n);
|
|
27686
27676
|
})))))));
|
|
@@ -28479,9 +28469,9 @@ const styles$k = aphrodite.StyleSheet.create({
|
|
|
28479
28469
|
display: "inline-block",
|
|
28480
28470
|
borderStyle: "solid",
|
|
28481
28471
|
borderWidth: 1,
|
|
28482
|
-
borderColor:
|
|
28472
|
+
borderColor: wonderBlocksTokens.color.offBlack50,
|
|
28483
28473
|
borderRadius: 3,
|
|
28484
|
-
background:
|
|
28474
|
+
background: wonderBlocksTokens.color.white
|
|
28485
28475
|
}
|
|
28486
28476
|
});
|
|
28487
28477
|
|
|
@@ -29566,6 +29556,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29566
29556
|
value: `${n}`,
|
|
29567
29557
|
label: `${n} point${n > 1 ? "s" : ""}`
|
|
29568
29558
|
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29559
|
+
key: "unlimited",
|
|
29569
29560
|
value: UNLIMITED,
|
|
29570
29561
|
label: "unlimited"
|
|
29571
29562
|
})]);
|
|
@@ -30742,6 +30733,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
30742
30733
|
},
|
|
30743
30734
|
style: styles$a.singleSelectShort
|
|
30744
30735
|
}, [...POLYGON_SIDES, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30736
|
+
key: "unlimited",
|
|
30745
30737
|
value: "unlimited",
|
|
30746
30738
|
label: "unlimited sides"
|
|
30747
30739
|
})])), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
@@ -30872,7 +30864,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
30872
30864
|
style: {
|
|
30873
30865
|
fontSize: 12,
|
|
30874
30866
|
backgroundColor: "#eee",
|
|
30875
|
-
paddingInline:
|
|
30867
|
+
paddingInline: wonderBlocksTokens.spacing.xxSmall_6,
|
|
30876
30868
|
borderColor: "#ccc",
|
|
30877
30869
|
borderStyle: "solid",
|
|
30878
30870
|
borderWidth: 1
|
|
@@ -30927,7 +30919,7 @@ const styles$a = aphrodite.StyleSheet.create({
|
|
|
30927
30919
|
},
|
|
30928
30920
|
row: {
|
|
30929
30921
|
flexDirection: "row",
|
|
30930
|
-
marginTop:
|
|
30922
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30931
30923
|
alignItems: "center"
|
|
30932
30924
|
}
|
|
30933
30925
|
});
|
|
@@ -31000,7 +30992,7 @@ class FormWrappedTextField extends React__namespace.Component {
|
|
|
31000
30992
|
if (color) {
|
|
31001
30993
|
extraStyles.color = color;
|
|
31002
30994
|
}
|
|
31003
|
-
const borderColorStyle = focused ? focusBorderColor ||
|
|
30995
|
+
const borderColorStyle = focused ? focusBorderColor || wonderBlocksTokens.color.blue : borderColor || wonderBlocksTokens.color.offBlack16;
|
|
31004
30996
|
extraStyles.border = `1px solid ${borderColorStyle}`;
|
|
31005
30997
|
const wrappedIcon = icon && /*#__PURE__*/React__namespace.createElement("span", {
|
|
31006
30998
|
className: aphrodite.css(styles$9.icon)
|