@khanacademy/perseus-editor 11.5.0 → 11.6.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/index.js CHANGED
@@ -4,7 +4,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var perseusCore = require('@khanacademy/perseus-core');
6
6
  var perseus = require('@khanacademy/perseus');
7
- var React = require('react');
7
+ var React$1 = require('react');
8
8
  var _ = require('underscore');
9
9
  var createReactClass = require('create-react-class');
10
10
  var Clickable = require('@khanacademy/wonder-blocks-clickable');
@@ -13,17 +13,19 @@ var aphrodite = require('aphrodite');
13
13
  var $ = require('jquery');
14
14
  var PropTypes = require('prop-types');
15
15
  var wonderBlocksCore = require('@khanacademy/wonder-blocks-core');
16
+ var Switch = require('@khanacademy/wonder-blocks-switch');
16
17
  var wonderBlocksIcon = require('@khanacademy/wonder-blocks-icon');
17
18
  var caretRight = require('@phosphor-icons/core/bold/caret-right-bold.svg');
18
19
  var classNames = require('classnames');
19
20
  var wonderBlocksForm = require('@khanacademy/wonder-blocks-form');
21
+ var keypadContext = require('@khanacademy/keypad-context');
22
+ var mathInput = require('@khanacademy/math-input');
20
23
  var ReactDOM = require('react-dom');
21
24
  var kmath = require('@khanacademy/kmath');
22
25
  var KAS = require('@khanacademy/kas');
23
26
  var Button = require('@khanacademy/wonder-blocks-button');
24
27
  var wonderBlocksTypography = require('@khanacademy/wonder-blocks-typography');
25
28
  var wonderStuffCore = require('@khanacademy/wonder-stuff-core');
26
- var mathInput = require('@khanacademy/math-input');
27
29
  var wonderBlocksDropdown = require('@khanacademy/wonder-blocks-dropdown');
28
30
  var wonderBlocksAccordion = require('@khanacademy/wonder-blocks-accordion');
29
31
  var IconButton = require('@khanacademy/wonder-blocks-icon-button');
@@ -32,7 +34,10 @@ var caretDoubleUpIcon = require('@phosphor-icons/core/bold/caret-double-up-bold.
32
34
  var caretDownIcon = require('@phosphor-icons/core/bold/caret-down-bold.svg');
33
35
  var caretUpIcon = require('@phosphor-icons/core/bold/caret-up-bold.svg');
34
36
  var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
35
- var Switch = require('@khanacademy/wonder-blocks-switch');
37
+ var arrowFatDown = require('@phosphor-icons/core/regular/arrow-fat-down.svg');
38
+ var arrowFatLeft = require('@phosphor-icons/core/regular/arrow-fat-left.svg');
39
+ var arrowFatRight = require('@phosphor-icons/core/regular/arrow-fat-right.svg');
40
+ var arrowFatUp = require('@phosphor-icons/core/regular/arrow-fat-up.svg');
36
41
  var minusCircle = require('@phosphor-icons/core/regular/minus-circle.svg');
37
42
  var plusCircle = require('@phosphor-icons/core/regular/plus-circle.svg');
38
43
  var Banner = require('@khanacademy/wonder-blocks-banner');
@@ -58,12 +63,13 @@ function _interopNamespace(e) {
58
63
  return Object.freeze(n);
59
64
  }
60
65
 
61
- var React__namespace = /*#__PURE__*/_interopNamespace(React);
66
+ var React__namespace = /*#__PURE__*/_interopNamespace(React$1);
62
67
  var ___default = /*#__PURE__*/_interopDefaultLegacy(_);
63
68
  var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactClass);
64
69
  var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
65
70
  var $__default = /*#__PURE__*/_interopDefaultLegacy($);
66
71
  var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
72
+ var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
67
73
  var caretRight__default = /*#__PURE__*/_interopDefaultLegacy(caretRight);
68
74
  var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
69
75
  var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
@@ -75,7 +81,10 @@ var caretDoubleUpIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretDoubleU
75
81
  var caretDownIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretDownIcon);
76
82
  var caretUpIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretUpIcon);
77
83
  var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
78
- var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
84
+ var arrowFatDown__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatDown);
85
+ var arrowFatLeft__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatLeft);
86
+ var arrowFatRight__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatRight);
87
+ var arrowFatUp__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatUp);
79
88
  var minusCircle__default = /*#__PURE__*/_interopDefaultLegacy(minusCircle);
80
89
  var plusCircle__default = /*#__PURE__*/_interopDefaultLegacy(plusCircle);
81
90
  var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
@@ -83,7 +92,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
83
92
 
84
93
  // This file is processed by a Rollup plugin (replace) to inject the production
85
94
  const libName = "@khanacademy/perseus-editor";
86
- const libVersion = "11.5.0";
95
+ const libVersion = "11.6.0";
87
96
  perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
88
97
 
89
98
  function _extends() {
@@ -278,13 +287,13 @@ class SectionControlButton extends React__namespace.Component {
278
287
  role: "button",
279
288
  hideDefaultFocusRing: true,
280
289
  "aria-label": title,
281
- style: styles$S.button
290
+ style: styles$T.button
282
291
  }, _ref => {
283
292
  return /*#__PURE__*/React__namespace.createElement(InlineIcon$a, icon);
284
293
  });
285
294
  }
286
295
  }
287
- const styles$S = aphrodite.StyleSheet.create({
296
+ const styles$T = aphrodite.StyleSheet.create({
288
297
  button: {
289
298
  backgroundColor: wonderBlocksTokens.color.gold,
290
299
  margin: 2,
@@ -20606,6 +20615,111 @@ const DragTarget = createReactClass__default["default"]({
20606
20615
  }
20607
20616
  });
20608
20617
 
20618
+ const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
20619
+ const MEDIA_DEFAULT_SPEC = {
20620
+ small: {
20621
+ query: "(max-width: 767px)",
20622
+ totalColumns: 4,
20623
+ gutterWidth: wonderBlocksTokens.spacing.medium_16,
20624
+ marginWidth: wonderBlocksTokens.spacing.medium_16
20625
+ },
20626
+ medium: {
20627
+ query: "(min-width: 768px) and (max-width: 1023px)",
20628
+ totalColumns: 8,
20629
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
20630
+ marginWidth: wonderBlocksTokens.spacing.large_24
20631
+ },
20632
+ large: {
20633
+ query: "(min-width: 1024px)",
20634
+ totalColumns: 12,
20635
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
20636
+ marginWidth: mediaDefaultSpecLargeMarginWidth,
20637
+ maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
20638
+ }
20639
+ };
20640
+ ({
20641
+ large: {
20642
+ query: "(min-width: 1px)",
20643
+ totalColumns: 12,
20644
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
20645
+ marginWidth: wonderBlocksTokens.spacing.medium_16
20646
+ }
20647
+ });
20648
+ ({
20649
+ small: {
20650
+ query: "(max-width: 767px)",
20651
+ totalColumns: 4,
20652
+ gutterWidth: wonderBlocksTokens.spacing.medium_16,
20653
+ marginWidth: wonderBlocksTokens.spacing.medium_16
20654
+ },
20655
+ large: {
20656
+ query: "(min-width: 768px)",
20657
+ totalColumns: 12,
20658
+ gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
20659
+ marginWidth: wonderBlocksTokens.spacing.xxLarge_48
20660
+ }
20661
+ });
20662
+
20663
+ const defaultContext = {
20664
+ ssrSize: "large",
20665
+ mediaSpec: MEDIA_DEFAULT_SPEC
20666
+ };
20667
+ const MediaLayoutContext = React__namespace.createContext(defaultContext);
20668
+ MediaLayoutContext.displayName = "MediaLayoutContext";
20669
+
20670
+ class Spring extends React__namespace.Component {
20671
+ render() {
20672
+ const {
20673
+ style
20674
+ } = this.props;
20675
+ return React__namespace.createElement(wonderBlocksCore.View, {
20676
+ "aria-hidden": "true",
20677
+ style: [styles$S.grow, style]
20678
+ });
20679
+ }
20680
+ }
20681
+ const styles$S = aphrodite.StyleSheet.create({
20682
+ grow: {
20683
+ flexGrow: 1
20684
+ }
20685
+ });
20686
+
20687
+ class Strut extends React__namespace.Component {
20688
+ render() {
20689
+ const {
20690
+ size,
20691
+ style
20692
+ } = this.props;
20693
+ return React__namespace.createElement(wonderBlocksCore.View, {
20694
+ "aria-hidden": "true",
20695
+ style: [strutStyle(size), style]
20696
+ });
20697
+ }
20698
+ }
20699
+ const strutStyle = size => {
20700
+ return {
20701
+ width: size,
20702
+ MsFlexBasis: size,
20703
+ MsFlexPreferredSize: size,
20704
+ WebkitFlexBasis: size,
20705
+ flexBasis: size,
20706
+ flexShrink: 0
20707
+ };
20708
+ };
20709
+
20710
+ const Spacing = {
20711
+ xxxxSmall_2: 2,
20712
+ xxxSmall_4: 4,
20713
+ xxSmall_6: 6,
20714
+ xSmall_8: 8,
20715
+ small_12: 12,
20716
+ medium_16: 16,
20717
+ large_24: 24,
20718
+ xLarge_32: 32,
20719
+ xxLarge_48: 48,
20720
+ xxxLarge_64: 64
20721
+ };
20722
+
20609
20723
  const {
20610
20724
  InlineIcon: InlineIcon$9
20611
20725
  } = perseus.components;
@@ -20665,11 +20779,11 @@ class WidgetEditor extends React__namespace.Component {
20665
20779
  };
20666
20780
  this.props.onChange(newWidgetInfo, cb, silent);
20667
20781
  };
20668
- _toggleStatic = e => {
20669
- e.preventDefault();
20670
- const newWidgetInfo = Object.assign({}, this.state.widgetInfo, {
20671
- static: !this.state.widgetInfo.static
20672
- });
20782
+ _setStatic = value => {
20783
+ const newWidgetInfo = {
20784
+ ...this.state.widgetInfo,
20785
+ static: value
20786
+ };
20673
20787
  this.props.onChange(newWidgetInfo);
20674
20788
  };
20675
20789
  _handleAlignmentChange = e => {
@@ -20717,13 +20831,10 @@ class WidgetEditor extends React__namespace.Component {
20717
20831
  className: "perseus-widget-editor-title-id",
20718
20832
  href: "#",
20719
20833
  onClick: this._toggleWidget
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
- type: "button"
20722
- // @ts-expect-error - TS2322 - Type '(e: Event) => void' is not assignable to type 'MouseEventHandler<HTMLInputElement>'.
20723
- ,
20724
- onClick: this._toggleStatic,
20725
- className: "simple-button--small",
20726
- value: widgetInfo.static ? "Unset as static" : "Set as static"
20834
+ }, 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(LabeledSwitch$1, {
20835
+ label: "Static",
20836
+ checked: !!widgetInfo.static,
20837
+ onChange: this._setStatic
20727
20838
  }), supportedAlignments.length > 1 && /*#__PURE__*/React__namespace.createElement("select", {
20728
20839
  className: "alignment",
20729
20840
  value: widgetInfo.alignment,
@@ -20746,6 +20857,21 @@ class WidgetEditor extends React__namespace.Component {
20746
20857
  }, widgetInfo.options))));
20747
20858
  }
20748
20859
  }
20860
+ function LabeledSwitch$1(props) {
20861
+ const {
20862
+ label,
20863
+ ...switchProps
20864
+ } = props;
20865
+ const ids = wonderBlocksCore.useUniqueIdWithMock();
20866
+ const id = ids.get("switch");
20867
+ return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("label", {
20868
+ htmlFor: id
20869
+ }, label), /*#__PURE__*/React__namespace.createElement(Strut, {
20870
+ size: Spacing.xxSmall_6
20871
+ }), /*#__PURE__*/React__namespace.createElement(Switch__default["default"], _extends({
20872
+ id: id
20873
+ }, switchProps)));
20874
+ }
20749
20875
 
20750
20876
  class WidgetSelect extends React__namespace.Component {
20751
20877
  shouldComponentUpdate() {
@@ -24357,6 +24483,64 @@ var i18n = {
24357
24483
  findImagesInItemData: findImagesInItemData
24358
24484
  };
24359
24485
 
24486
+ /**
24487
+ * The `ContentPreview` component provides a simple preview system for Perseus
24488
+ * Content. Due to how Persus styles are built, the preview styling matches the
24489
+ * current device based on the viewport width (using `@media` queries for
24490
+ * `min-width` and `max-width`).
24491
+ *
24492
+ * The preview will render the mobile variant (styling and layout) when the
24493
+ * `previewDevice` is phone or tablet. Note that the styling cannot be matched
24494
+ * 100% due to the above `@media` query limitation.
24495
+ */
24496
+ function ContentPreview(_ref) {
24497
+ let {
24498
+ question,
24499
+ apiOptions,
24500
+ seamless,
24501
+ linterContext,
24502
+ legacyPerseusLint,
24503
+ previewDevice,
24504
+ strings
24505
+ } = _ref;
24506
+ const isMobile = previewDevice !== "desktop";
24507
+ const className = isMobile ? "perseus-mobile" : "";
24508
+ return /*#__PURE__*/React.createElement(wonderBlocksCore.View, {
24509
+ className: `framework-perseus ${className}`,
24510
+ style: [styles$O.container, !seamless ? styles$O.gutter : undefined]
24511
+ }, /*#__PURE__*/React.createElement(keypadContext.StatefulKeypadContextProvider, null, /*#__PURE__*/React.createElement(keypadContext.KeypadContext.Consumer, null, _ref2 => {
24512
+ let {
24513
+ setKeypadActive,
24514
+ keypadElement,
24515
+ setKeypadElement
24516
+ } = _ref2;
24517
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(perseus.Renderer, _extends({
24518
+ strings: strings,
24519
+ apiOptions: {
24520
+ ...apiOptions,
24521
+ isMobile
24522
+ },
24523
+ keypadElement: keypadElement,
24524
+ linterContext: linterContext,
24525
+ legacyPerseusLint: legacyPerseusLint
24526
+ }, question)), /*#__PURE__*/React.createElement(mathInput.MobileKeypad, {
24527
+ onAnalyticsEvent: () => Promise.resolve(),
24528
+ onDismiss: () => setKeypadActive(false),
24529
+ onElementMounted: setKeypadElement
24530
+ }));
24531
+ })));
24532
+ }
24533
+ const styles$O = aphrodite.StyleSheet.create({
24534
+ container: {
24535
+ padding: wonderBlocksTokens.spacing.xxxSmall_4,
24536
+ containerType: "inline-size",
24537
+ containerName: "perseus-root"
24538
+ },
24539
+ gutter: {
24540
+ marginRight: perseus.constants.lintGutterWidth
24541
+ }
24542
+ });
24543
+
24360
24544
  var isObject = function (obj) {
24361
24545
  return obj === Object(obj);
24362
24546
  };
@@ -24593,12 +24777,12 @@ class SimpleButton extends React__namespace.Component {
24593
24777
  ...otherProps
24594
24778
  } = this.props;
24595
24779
  return /*#__PURE__*/React__namespace.createElement("div", _extends({
24596
- className: aphrodite.css(styles$O.baseButton, color === "green" && styles$O.green, color === "orange" && styles$O.orange),
24780
+ className: aphrodite.css(styles$N.baseButton, color === "green" && styles$N.green, color === "orange" && styles$N.orange),
24597
24781
  onClick: onClick
24598
24782
  }, otherProps), children);
24599
24783
  }
24600
24784
  }
24601
- const styles$O = aphrodite.StyleSheet.create({
24785
+ const styles$N = aphrodite.StyleSheet.create({
24602
24786
  baseButton: {
24603
24787
  top: "0",
24604
24788
  fontSize: "11px",
@@ -24811,23 +24995,23 @@ const LeafContainer = _ref2 => {
24811
24995
  } = _ref2;
24812
24996
  const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
24813
24997
  const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
24814
- className: aphrodite.css(styles$N.containerHeader)
24998
+ className: aphrodite.css(styles$M.containerHeader)
24815
24999
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24816
25000
  depth: path.length,
24817
- className: aphrodite.css(styles$N.containerTitle)
25001
+ className: aphrodite.css(styles$M.containerTitle)
24818
25002
  }, capitalize(name)));
24819
25003
  return /*#__PURE__*/React__namespace.createElement("div", {
24820
- className: aphrodite.css(styles$N.container)
25004
+ className: aphrodite.css(styles$M.container)
24821
25005
  }, /*#__PURE__*/React__namespace.createElement("span", {
24822
- className: aphrodite.css(styles$N.row, styles$N.rowHeading)
25006
+ className: aphrodite.css(styles$M.row, styles$M.rowHeading)
24823
25007
  }, /*#__PURE__*/React__namespace.createElement("div", {
24824
- className: aphrodite.css(styles$N.columnLeft)
25008
+ className: aphrodite.css(styles$M.columnLeft)
24825
25009
  }, /*#__PURE__*/React__namespace.createElement("div", {
24826
- className: "pod-title " + aphrodite.css(styles$N.containerHeader)
25010
+ className: "pod-title " + aphrodite.css(styles$M.containerHeader)
24827
25011
  }, /*#__PURE__*/React__namespace.createElement("div", {
24828
- className: aphrodite.css(styles$N.containerTitle)
25012
+ className: aphrodite.css(styles$M.containerTitle)
24829
25013
  }, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
24830
- className: aphrodite.css(styles$N.columnRight)
25014
+ className: aphrodite.css(styles$M.columnRight)
24831
25015
  }, previewHeading)), children);
24832
25016
  };
24833
25017
  const ArrayContainer = props => {
@@ -24840,11 +25024,11 @@ const ArrayContainer = props => {
24840
25024
  actions
24841
25025
  } = props;
24842
25026
  return /*#__PURE__*/React__namespace.createElement("div", {
24843
- className: aphrodite.css(styles$N.container)
25027
+ className: aphrodite.css(styles$M.container)
24844
25028
  }, controls && /*#__PURE__*/React__namespace.createElement("div", {
24845
- className: aphrodite.css(styles$N.columnLeft, styles$N.containerHeader)
25029
+ className: aphrodite.css(styles$M.columnLeft, styles$M.containerHeader)
24846
25030
  }, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
24847
- className: aphrodite.css(styles$N.columnLeft)
25031
+ className: aphrodite.css(styles$M.columnLeft)
24848
25032
  }, /*#__PURE__*/React__namespace.createElement("a", {
24849
25033
  href: "javascript:void 0",
24850
25034
  onClick: () => actions.addArrayElement(path, shape.elementShape)
@@ -24858,28 +25042,28 @@ const ObjectContainer = _ref3 => {
24858
25042
  path
24859
25043
  } = _ref3;
24860
25044
  const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
24861
- className: aphrodite.css(styles$N.containerHeader)
25045
+ className: aphrodite.css(styles$M.containerHeader)
24862
25046
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24863
25047
  depth: path.length,
24864
- className: aphrodite.css(styles$N.containerTitle)
25048
+ className: aphrodite.css(styles$M.containerTitle)
24865
25049
  }, capitalize(name)), controls);
24866
25050
  const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
24867
- className: aphrodite.css(styles$N.containerHeader, styles$N.previewCollectionHeader)
25051
+ className: aphrodite.css(styles$M.containerHeader, styles$M.previewCollectionHeader)
24868
25052
  }, /*#__PURE__*/React__namespace.createElement(Header, {
24869
25053
  depth: path.length,
24870
- className: aphrodite.css(styles$N.containerTitle)
25054
+ className: aphrodite.css(styles$M.containerTitle)
24871
25055
  }, capitalize(name)));
24872
25056
  const hasBothHeadings = headingEditor && headingPreview;
24873
25057
  return /*#__PURE__*/React__namespace.createElement("div", {
24874
- className: aphrodite.css(styles$N.container)
25058
+ className: aphrodite.css(styles$M.container)
24875
25059
  }, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
24876
- className: aphrodite.css(styles$N.row)
25060
+ className: aphrodite.css(styles$M.row)
24877
25061
  }, /*#__PURE__*/React__namespace.createElement("div", {
24878
- className: aphrodite.css(styles$N.columnLeft)
25062
+ className: aphrodite.css(styles$M.columnLeft)
24879
25063
  }, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
24880
- className: aphrodite.css(styles$N.columnRight)
25064
+ className: aphrodite.css(styles$M.columnRight)
24881
25065
  }, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
24882
- className: aphrodite.css(path.length > 0 && styles$N.contentIndent)
25066
+ className: aphrodite.css(path.length > 0 && styles$M.contentIndent)
24883
25067
  }, children));
24884
25068
  };
24885
25069
 
@@ -24999,11 +25183,11 @@ const ItemNodeContent = withStickiness(props => {
24999
25183
  className: "framework-perseus"
25000
25184
  }, lens(renderers).get(path));
25001
25185
  return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
25002
- className: aphrodite.css(styles$N.row)
25186
+ className: aphrodite.css(styles$M.row)
25003
25187
  }, /*#__PURE__*/React__namespace.createElement("div", {
25004
- className: aphrodite.css(styles$N.columnLeft)
25188
+ className: aphrodite.css(styles$M.columnLeft)
25005
25189
  }, /*#__PURE__*/React__namespace.createElement("div", {
25006
- className: aphrodite.css(sticky && styles$N.sticky)
25190
+ className: aphrodite.css(sticky && styles$M.sticky)
25007
25191
  },
25008
25192
  /*#__PURE__*/
25009
25193
  // @ts-expect-error - TS2769 - No overload matches this call.
@@ -25011,9 +25195,9 @@ const ItemNodeContent = withStickiness(props => {
25011
25195
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25012
25196
  apiOptions: apiOptions
25013
25197
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25014
- className: aphrodite.css(styles$N.columnRight)
25198
+ className: aphrodite.css(styles$M.columnRight)
25015
25199
  }, /*#__PURE__*/React__namespace.createElement("div", {
25016
- className: aphrodite.css(sticky && styles$N.sticky)
25200
+ className: aphrodite.css(sticky && styles$M.sticky)
25017
25201
  }, preview))));
25018
25202
  });
25019
25203
  const HintNodeContent = withStickiness(props => {
@@ -25029,13 +25213,13 @@ const HintNodeContent = withStickiness(props => {
25029
25213
  className: "framework-perseus"
25030
25214
  }, lens(renderers).get(path));
25031
25215
  return /*#__PURE__*/React__namespace.createElement("div", {
25032
- className: aphrodite.css(styles$N.row)
25216
+ className: aphrodite.css(styles$M.row)
25033
25217
  }, /*#__PURE__*/React__namespace.createElement("div", {
25034
- className: aphrodite.css(styles$N.columnLeft)
25218
+ className: aphrodite.css(styles$M.columnLeft)
25035
25219
  }, /*#__PURE__*/React__namespace.createElement("div", {
25036
- className: aphrodite.css(sticky && styles$N.sticky)
25220
+ className: aphrodite.css(sticky && styles$M.sticky)
25037
25221
  }, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
25038
- className: aphrodite.css(styles$N.hintEditor),
25222
+ className: aphrodite.css(styles$M.hintEditor),
25039
25223
  onChange: newVal => actions.mergeValueAtPath(path, newVal),
25040
25224
  apiOptions: apiOptions,
25041
25225
  showTitle: false,
@@ -25050,9 +25234,9 @@ const HintNodeContent = withStickiness(props => {
25050
25234
  isFirst: true,
25051
25235
  isLast: true
25052
25236
  })))), /*#__PURE__*/React__namespace.createElement("div", {
25053
- className: aphrodite.css(styles$N.columnRight)
25237
+ className: aphrodite.css(styles$M.columnRight)
25054
25238
  }, /*#__PURE__*/React__namespace.createElement("div", {
25055
- className: aphrodite.css(sticky && styles$N.sticky)
25239
+ className: aphrodite.css(sticky && styles$M.sticky)
25056
25240
  }, preview)));
25057
25241
  });
25058
25242
  const TagsNodeContent = props => {
@@ -25069,9 +25253,9 @@ const TagsNodeContent = props => {
25069
25253
  return null;
25070
25254
  }
25071
25255
  return /*#__PURE__*/React__namespace.createElement("div", {
25072
- className: aphrodite.css(styles$N.columnLeft)
25256
+ className: aphrodite.css(styles$M.columnLeft)
25073
25257
  }, /*#__PURE__*/React__namespace.createElement("div", {
25074
- className: aphrodite.css(styles$N.tagsEditor)
25258
+ className: aphrodite.css(styles$M.tagsEditor)
25075
25259
  }, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
25076
25260
  value: data,
25077
25261
  onChange: newVal => actions.setValueAtPath(path, newVal),
@@ -25102,23 +25286,23 @@ const ArrayNodeContent = props => {
25102
25286
  const subpath = path.concat(i);
25103
25287
  const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
25104
25288
  key: "moveArrayElementUp",
25105
- className: aphrodite.css(styles$N.control)
25289
+ className: aphrodite.css(styles$M.control)
25106
25290
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25107
25291
  color: "orange",
25108
25292
  title: "Move up",
25109
25293
  onClick: () => actions.moveArrayElementUp(subpath)
25110
25294
  }, /*#__PURE__*/React__namespace.createElement("div", {
25111
- className: aphrodite.css(styles$N.verticalFlip)
25295
+ className: aphrodite.css(styles$M.verticalFlip)
25112
25296
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
25113
25297
  key: "moveArrayElementDown",
25114
- className: aphrodite.css(styles$N.control)
25298
+ className: aphrodite.css(styles$M.control)
25115
25299
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25116
25300
  color: "orange",
25117
25301
  title: "Move down",
25118
25302
  onClick: () => actions.moveArrayElementDown(subpath)
25119
25303
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
25120
25304
  key: "removeArrayElement",
25121
- className: aphrodite.css(styles$N.control)
25305
+ className: aphrodite.css(styles$M.control)
25122
25306
  }, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
25123
25307
  color: "orange",
25124
25308
  title: "Delete",
@@ -25126,7 +25310,7 @@ const ArrayNodeContent = props => {
25126
25310
  }, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconTrash$4)))];
25127
25311
  return /*#__PURE__*/React__namespace.createElement("div", {
25128
25312
  key: i,
25129
- className: aphrodite.css(styles$N.arrayElement, !elementIsLeaf && styles$N.arrayElementAndNotLeaf)
25313
+ className: aphrodite.css(styles$M.arrayElement, !elementIsLeaf && styles$M.arrayElementAndNotLeaf)
25130
25314
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25131
25315
  key: i,
25132
25316
  shape: shape.elementShape,
@@ -25152,7 +25336,7 @@ const ObjectNodeContent = props => {
25152
25336
  // made sense to the shape's author is the order in which we'll iterate :)
25153
25337
  const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
25154
25338
  key: subkey,
25155
- className: aphrodite.css(styles$N.objectElement)
25339
+ className: aphrodite.css(styles$M.objectElement)
25156
25340
  }, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
25157
25341
  shape: shape.shape[subkey],
25158
25342
  data: data[subkey],
@@ -25322,7 +25506,7 @@ class MultiRendererEditor extends React__namespace.Component {
25322
25506
  }, this._renderContent());
25323
25507
  }
25324
25508
  }
25325
- const styles$N = aphrodite.StyleSheet.create({
25509
+ const styles$M = aphrodite.StyleSheet.create({
25326
25510
  // This is used in a number of places throughout this file.
25327
25511
  container: {},
25328
25512
  // eslint-disable-next-line react-native/no-unused-styles
@@ -26346,98 +26530,6 @@ class ExplanationEditor extends React__namespace.Component {
26346
26530
  }
26347
26531
  }
26348
26532
 
26349
- const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
26350
- const MEDIA_DEFAULT_SPEC = {
26351
- small: {
26352
- query: "(max-width: 767px)",
26353
- totalColumns: 4,
26354
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
26355
- marginWidth: wonderBlocksTokens.spacing.medium_16
26356
- },
26357
- medium: {
26358
- query: "(min-width: 768px) and (max-width: 1023px)",
26359
- totalColumns: 8,
26360
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26361
- marginWidth: wonderBlocksTokens.spacing.large_24
26362
- },
26363
- large: {
26364
- query: "(min-width: 1024px)",
26365
- totalColumns: 12,
26366
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26367
- marginWidth: mediaDefaultSpecLargeMarginWidth,
26368
- maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
26369
- }
26370
- };
26371
- ({
26372
- large: {
26373
- query: "(min-width: 1px)",
26374
- totalColumns: 12,
26375
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26376
- marginWidth: wonderBlocksTokens.spacing.medium_16
26377
- }
26378
- });
26379
- ({
26380
- small: {
26381
- query: "(max-width: 767px)",
26382
- totalColumns: 4,
26383
- gutterWidth: wonderBlocksTokens.spacing.medium_16,
26384
- marginWidth: wonderBlocksTokens.spacing.medium_16
26385
- },
26386
- large: {
26387
- query: "(min-width: 768px)",
26388
- totalColumns: 12,
26389
- gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
26390
- marginWidth: wonderBlocksTokens.spacing.xxLarge_48
26391
- }
26392
- });
26393
-
26394
- const defaultContext = {
26395
- ssrSize: "large",
26396
- mediaSpec: MEDIA_DEFAULT_SPEC
26397
- };
26398
- const MediaLayoutContext = React__namespace.createContext(defaultContext);
26399
- MediaLayoutContext.displayName = "MediaLayoutContext";
26400
-
26401
- class Spring extends React__namespace.Component {
26402
- render() {
26403
- const {
26404
- style
26405
- } = this.props;
26406
- return React__namespace.createElement(wonderBlocksCore.View, {
26407
- "aria-hidden": "true",
26408
- style: [styles$M.grow, style]
26409
- });
26410
- }
26411
- }
26412
- const styles$M = aphrodite.StyleSheet.create({
26413
- grow: {
26414
- flexGrow: 1
26415
- }
26416
- });
26417
-
26418
- class Strut extends React__namespace.Component {
26419
- render() {
26420
- const {
26421
- size,
26422
- style
26423
- } = this.props;
26424
- return React__namespace.createElement(wonderBlocksCore.View, {
26425
- "aria-hidden": "true",
26426
- style: [strutStyle(size), style]
26427
- });
26428
- }
26429
- }
26430
- const strutStyle = size => {
26431
- return {
26432
- width: size,
26433
- MsFlexBasis: size,
26434
- MsFlexPreferredSize: size,
26435
- WebkitFlexBasis: size,
26436
- flexBasis: size,
26437
- flexShrink: 0
26438
- };
26439
- };
26440
-
26441
26533
  const PT = PropTypes__default["default"];
26442
26534
 
26443
26535
  /**
@@ -28521,13 +28613,13 @@ class InputNumberEditor extends React__namespace.Component {
28521
28613
  * it's just the input itself for use writing TeX.
28522
28614
  */
28523
28615
  function MathquillInput(props) {
28524
- const mathFieldWrapperRef = React.useRef(null);
28525
- const mathFieldInstance = React.useRef();
28616
+ const mathFieldWrapperRef = React$1.useRef(null);
28617
+ const mathFieldInstance = React$1.useRef();
28526
28618
  const {
28527
28619
  locale,
28528
28620
  strings
28529
28621
  } = mathInput.useMathInputI18n();
28530
- React.useEffect(() => {
28622
+ React$1.useEffect(() => {
28531
28623
  // If we have the mount for the input, but not the input
28532
28624
  // make a new Mathquill input
28533
28625
  if (mathFieldWrapperRef.current && !mathFieldInstance.current) {
@@ -30546,8 +30638,8 @@ const LockedFunctionSettings = props => {
30546
30638
  // Tracking the string value of domain constraints to handle interim state of
30547
30639
  // entering a negative value, as well as representing Infinity as an empty string.
30548
30640
  // This variable is used when specifying the values of the input fields.
30549
- const [domainEntries, setDomainEntries] = React.useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30550
- React.useEffect(() => {
30641
+ const [domainEntries, setDomainEntries] = React$1.useState([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30642
+ React$1.useEffect(() => {
30551
30643
  // "useEffect" used to maintain parity between domain constraints and their string representation.
30552
30644
  setDomainEntries([domain && domain[0] !== -Infinity ? domain[0].toString() : "", domain && domain[1] !== Infinity ? domain[1].toString() : ""]);
30553
30645
  }, [domain]);
@@ -31095,6 +31187,42 @@ const LockedPolygonSettings = props => {
31095
31187
  color: newValue
31096
31188
  });
31097
31189
  }
31190
+ function handlePolygonMove(movement) {
31191
+ switch (movement) {
31192
+ case "up":
31193
+ onChangeProps({
31194
+ points: points.map(_ref => {
31195
+ let [x, y] = _ref;
31196
+ return [x, y + 1];
31197
+ })
31198
+ });
31199
+ break;
31200
+ case "down":
31201
+ onChangeProps({
31202
+ points: points.map(_ref2 => {
31203
+ let [x, y] = _ref2;
31204
+ return [x, y - 1];
31205
+ })
31206
+ });
31207
+ break;
31208
+ case "left":
31209
+ onChangeProps({
31210
+ points: points.map(_ref3 => {
31211
+ let [x, y] = _ref3;
31212
+ return [x - 1, y];
31213
+ })
31214
+ });
31215
+ break;
31216
+ case "right":
31217
+ onChangeProps({
31218
+ points: points.map(_ref4 => {
31219
+ let [x, y] = _ref4;
31220
+ return [x + 1, y];
31221
+ })
31222
+ });
31223
+ break;
31224
+ }
31225
+ }
31098
31226
  return /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
31099
31227
  expanded: expanded,
31100
31228
  onToggle: onToggle,
@@ -31185,7 +31313,9 @@ const LockedPolygonSettings = props => {
31185
31313
  },
31186
31314
  style: styles$o.icon
31187
31315
  }));
31188
- }), /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
31316
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31317
+ style: [styles$o.row, styles$o.polygonActionsContainer]
31318
+ }, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
31189
31319
  kind: "tertiary",
31190
31320
  startIcon: plusCircle__default["default"],
31191
31321
  onClick: () => {
@@ -31193,7 +31323,35 @@ const LockedPolygonSettings = props => {
31193
31323
  points: [...points, [0, 0]]
31194
31324
  });
31195
31325
  }
31196
- }, "Add point")), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
31326
+ }, "Add point"), /*#__PURE__*/React__namespace.createElement(Spring, null), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31327
+ style: styles$o.movementButtonsContainer
31328
+ }, /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
31329
+ "aria-label": "Move polygon up",
31330
+ style: styles$o.iconButton,
31331
+ size: "small",
31332
+ icon: arrowFatUp__default["default"],
31333
+ onClick: () => handlePolygonMove("up")
31334
+ }), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
31335
+ style: styles$o.row
31336
+ }, /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
31337
+ "aria-label": "Move polygon left",
31338
+ style: styles$o.iconButton,
31339
+ size: "small",
31340
+ icon: arrowFatLeft__default["default"],
31341
+ onClick: () => handlePolygonMove("left")
31342
+ }), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
31343
+ "aria-label": "Move polygon down",
31344
+ style: styles$o.iconButton,
31345
+ size: "small",
31346
+ icon: arrowFatDown__default["default"],
31347
+ onClick: () => handlePolygonMove("down")
31348
+ }), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
31349
+ "aria-label": "Move polygon right",
31350
+ style: styles$o.iconButton,
31351
+ size: "small",
31352
+ icon: arrowFatRight__default["default"],
31353
+ onClick: () => handlePolygonMove("right")
31354
+ }))))), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
31197
31355
  figureType: props.type,
31198
31356
  onMove: onMove,
31199
31357
  onRemove: onRemove
@@ -31214,6 +31372,18 @@ const styles$o = aphrodite.StyleSheet.create({
31214
31372
  icon: {
31215
31373
  marginInlineStart: wonderBlocksTokens.spacing.xxxSmall_4
31216
31374
  },
31375
+ polygonActionsContainer: {
31376
+ width: "100%"
31377
+ },
31378
+ iconButton: {
31379
+ margin: 0
31380
+ },
31381
+ movementButtonsContainer: {
31382
+ display: "flex",
31383
+ flexDirection: "column",
31384
+ alignItems: "center",
31385
+ minWidth: "fit-content"
31386
+ },
31217
31387
  spaceUnder: {
31218
31388
  marginBottom: wonderBlocksTokens.spacing.xSmall_8
31219
31389
  },
@@ -37050,6 +37220,7 @@ exports.AllEditors = AllEditors;
37050
37220
  exports.AllWidgets = AllWidgets;
37051
37221
  exports.ArticleDiff = ArticleDiff;
37052
37222
  exports.ArticleEditor = ArticleEditor;
37223
+ exports.ContentPreview = ContentPreview;
37053
37224
  exports.DeviceFramer = DeviceFramer;
37054
37225
  exports.Editor = Editor;
37055
37226
  exports.EditorPage = EditorPage;