@khanacademy/perseus-editor 5.2.3 → 5.2.5
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 +85 -97
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +88 -93
- package/dist/index.js.map +1 -1
- package/dist/item-editor.d.ts +2 -2
- package/dist/widgets/interactive-graph-editor.d.ts +9 -5
- 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.5";
|
|
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)
|
|
@@ -21283,6 +21281,9 @@ class Editor extends React__namespace.Component {
|
|
|
21283
21281
|
// eg. If there is an "image 2" already present in the editor and we're
|
|
21284
21282
|
// about to paste in two new images, return
|
|
21285
21283
|
// { "image 1": "image 3", "image 2": "image 4" }
|
|
21284
|
+
//
|
|
21285
|
+
// TODO switch to UUIDs rather than these fragile IDs
|
|
21286
|
+
// see: LEMS-1845
|
|
21286
21287
|
|
|
21287
21288
|
// List of widgets about to be pasted as [[name, number], ...]
|
|
21288
21289
|
const widgets = ___default["default"].keys(widgetData).map(name => name.split(" "));
|
|
@@ -22108,42 +22109,30 @@ const {
|
|
|
22108
22109
|
iconMobilePhone,
|
|
22109
22110
|
iconTablet
|
|
22110
22111
|
} = 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
|
-
}
|
|
22112
|
+
const ViewportResizer = props => {
|
|
22113
|
+
const phoneButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconMobilePhone), " Phone");
|
|
22114
|
+
const tabletButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconTablet), " Tablet");
|
|
22115
|
+
const desktopButtonContents = /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement(InlineIcon$8, iconDesktop), " Desktop");
|
|
22116
|
+
|
|
22117
|
+
// TODO(david): Allow input of custom viewport sizes.
|
|
22118
|
+
return /*#__PURE__*/React__namespace.createElement("span", {
|
|
22119
|
+
className: "viewport-resizer"
|
|
22120
|
+
}, "Viewport:", " ", /*#__PURE__*/React__namespace.createElement(ButtonGroup$5, {
|
|
22121
|
+
value: props.deviceType,
|
|
22122
|
+
allowEmpty: false,
|
|
22123
|
+
buttons: [{
|
|
22124
|
+
value: devices.PHONE,
|
|
22125
|
+
content: phoneButtonContents
|
|
22126
|
+
}, {
|
|
22127
|
+
value: devices.TABLET,
|
|
22128
|
+
content: tabletButtonContents
|
|
22129
|
+
}, {
|
|
22130
|
+
value: devices.DESKTOP,
|
|
22131
|
+
content: desktopButtonContents
|
|
22132
|
+
}],
|
|
22133
|
+
onChange: props.onViewportSizeChanged
|
|
22134
|
+
}));
|
|
22135
|
+
};
|
|
22147
22136
|
|
|
22148
22137
|
/*
|
|
22149
22138
|
Software License Agreement (BSD License)
|
|
@@ -26690,6 +26679,7 @@ class ExpressionEditor extends React__namespace.Component {
|
|
|
26690
26679
|
widgetId: this.props.widgetId + "-" + ans.key
|
|
26691
26680
|
};
|
|
26692
26681
|
return lens(ans).merge([], {
|
|
26682
|
+
key,
|
|
26693
26683
|
draggable: true,
|
|
26694
26684
|
onChange: props => this.updateForm(Number.parseInt(ans.key ?? ""), props),
|
|
26695
26685
|
onDelete: () => this.handleRemoveForm(key),
|
|
@@ -27318,10 +27308,12 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27318
27308
|
}
|
|
27319
27309
|
},
|
|
27320
27310
|
renderLabelChoices: function (choices) {
|
|
27321
|
-
return ___default["default"].map(choices, function (
|
|
27311
|
+
return ___default["default"].map(choices, function (_ref) {
|
|
27312
|
+
let [name, value] = _ref;
|
|
27322
27313
|
return /*#__PURE__*/React__namespace.createElement("option", {
|
|
27323
|
-
|
|
27324
|
-
|
|
27314
|
+
key: value,
|
|
27315
|
+
value: value
|
|
27316
|
+
}, name);
|
|
27325
27317
|
});
|
|
27326
27318
|
},
|
|
27327
27319
|
validRange: function (range) {
|
|
@@ -27681,6 +27673,7 @@ const GraphSettings = createReactClass__default["default"]({
|
|
|
27681
27673
|
value: this.props.rulerTicks
|
|
27682
27674
|
}, ___default["default"].map([1, 2, 4, 8, 10, 16], function (n) {
|
|
27683
27675
|
return /*#__PURE__*/React__namespace.createElement("option", {
|
|
27676
|
+
key: n,
|
|
27684
27677
|
value: n
|
|
27685
27678
|
}, n);
|
|
27686
27679
|
})))))));
|
|
@@ -28479,9 +28472,9 @@ const styles$k = aphrodite.StyleSheet.create({
|
|
|
28479
28472
|
display: "inline-block",
|
|
28480
28473
|
borderStyle: "solid",
|
|
28481
28474
|
borderWidth: 1,
|
|
28482
|
-
borderColor:
|
|
28475
|
+
borderColor: wonderBlocksTokens.color.offBlack50,
|
|
28483
28476
|
borderRadius: 3,
|
|
28484
|
-
background:
|
|
28477
|
+
background: wonderBlocksTokens.color.white
|
|
28485
28478
|
}
|
|
28486
28479
|
});
|
|
28487
28480
|
|
|
@@ -29566,6 +29559,7 @@ const GraphPointsCountSelector = _ref => {
|
|
|
29566
29559
|
value: `${n}`,
|
|
29567
29560
|
label: `${n} point${n > 1 ? "s" : ""}`
|
|
29568
29561
|
})), /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
29562
|
+
key: "unlimited",
|
|
29569
29563
|
value: UNLIMITED,
|
|
29570
29564
|
label: "unlimited"
|
|
29571
29565
|
})]);
|
|
@@ -30742,6 +30736,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
30742
30736
|
},
|
|
30743
30737
|
style: styles$a.singleSelectShort
|
|
30744
30738
|
}, [...POLYGON_SIDES, /*#__PURE__*/React__namespace.createElement(wonderBlocksDropdown.OptionItem, {
|
|
30739
|
+
key: "unlimited",
|
|
30745
30740
|
value: "unlimited",
|
|
30746
30741
|
label: "unlimited sides"
|
|
30747
30742
|
})])), /*#__PURE__*/React__namespace.createElement(LabeledRow, {
|
|
@@ -30872,7 +30867,7 @@ class InteractiveGraphEditor extends React__namespace.Component {
|
|
|
30872
30867
|
style: {
|
|
30873
30868
|
fontSize: 12,
|
|
30874
30869
|
backgroundColor: "#eee",
|
|
30875
|
-
paddingInline:
|
|
30870
|
+
paddingInline: wonderBlocksTokens.spacing.xxSmall_6,
|
|
30876
30871
|
borderColor: "#ccc",
|
|
30877
30872
|
borderStyle: "solid",
|
|
30878
30873
|
borderWidth: 1
|
|
@@ -30927,7 +30922,7 @@ const styles$a = aphrodite.StyleSheet.create({
|
|
|
30927
30922
|
},
|
|
30928
30923
|
row: {
|
|
30929
30924
|
flexDirection: "row",
|
|
30930
|
-
marginTop:
|
|
30925
|
+
marginTop: wonderBlocksTokens.spacing.xSmall_8,
|
|
30931
30926
|
alignItems: "center"
|
|
30932
30927
|
}
|
|
30933
30928
|
});
|
|
@@ -31000,7 +30995,7 @@ class FormWrappedTextField extends React__namespace.Component {
|
|
|
31000
30995
|
if (color) {
|
|
31001
30996
|
extraStyles.color = color;
|
|
31002
30997
|
}
|
|
31003
|
-
const borderColorStyle = focused ? focusBorderColor ||
|
|
30998
|
+
const borderColorStyle = focused ? focusBorderColor || wonderBlocksTokens.color.blue : borderColor || wonderBlocksTokens.color.offBlack16;
|
|
31004
30999
|
extraStyles.border = `1px solid ${borderColorStyle}`;
|
|
31005
31000
|
const wrappedIcon = icon && /*#__PURE__*/React__namespace.createElement("span", {
|
|
31006
31001
|
className: aphrodite.css(styles$9.icon)
|