@khanacademy/perseus-editor 11.5.0 → 12.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/components/widget-editor.d.ts +1 -1
- package/dist/es/index.js +266 -171
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +271 -160
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -10,6 +10,7 @@ import { StyleSheet, css } from 'aphrodite';
|
|
|
10
10
|
import $ from 'jquery';
|
|
11
11
|
import PropTypes from 'prop-types';
|
|
12
12
|
import { View, useUniqueIdWithMock } from '@khanacademy/wonder-blocks-core';
|
|
13
|
+
import Switch from '@khanacademy/wonder-blocks-switch';
|
|
13
14
|
import { PhosphorIcon } from '@khanacademy/wonder-blocks-icon';
|
|
14
15
|
import caretRight from '@phosphor-icons/core/bold/caret-right-bold.svg';
|
|
15
16
|
import classNames from 'classnames';
|
|
@@ -29,7 +30,10 @@ import caretDoubleUpIcon from '@phosphor-icons/core/bold/caret-double-up-bold.sv
|
|
|
29
30
|
import caretDownIcon from '@phosphor-icons/core/bold/caret-down-bold.svg';
|
|
30
31
|
import caretUpIcon from '@phosphor-icons/core/bold/caret-up-bold.svg';
|
|
31
32
|
import trashIcon from '@phosphor-icons/core/bold/trash-bold.svg';
|
|
32
|
-
import
|
|
33
|
+
import arrowFatDown from '@phosphor-icons/core/regular/arrow-fat-down.svg';
|
|
34
|
+
import arrowFatLeft from '@phosphor-icons/core/regular/arrow-fat-left.svg';
|
|
35
|
+
import arrowFatRight from '@phosphor-icons/core/regular/arrow-fat-right.svg';
|
|
36
|
+
import arrowFatUp from '@phosphor-icons/core/regular/arrow-fat-up.svg';
|
|
33
37
|
import minusCircle from '@phosphor-icons/core/regular/minus-circle.svg';
|
|
34
38
|
import plusCircle from '@phosphor-icons/core/regular/plus-circle.svg';
|
|
35
39
|
import Banner from '@khanacademy/wonder-blocks-banner';
|
|
@@ -37,7 +41,7 @@ import arrowCounterClockwise from '@phosphor-icons/core/bold/arrow-counter-clock
|
|
|
37
41
|
|
|
38
42
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
39
43
|
const libName = "@khanacademy/perseus-editor";
|
|
40
|
-
const libVersion = "
|
|
44
|
+
const libVersion = "12.0.0";
|
|
41
45
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
42
46
|
|
|
43
47
|
function _extends() {
|
|
@@ -20557,6 +20561,125 @@ const DragTarget = createReactClass({
|
|
|
20557
20561
|
}
|
|
20558
20562
|
});
|
|
20559
20563
|
|
|
20564
|
+
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
20565
|
+
if (source == null) return {};
|
|
20566
|
+
var target = {};
|
|
20567
|
+
var sourceKeys = Object.keys(source);
|
|
20568
|
+
var key, i;
|
|
20569
|
+
for (i = 0; i < sourceKeys.length; i++) {
|
|
20570
|
+
key = sourceKeys[i];
|
|
20571
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
20572
|
+
target[key] = source[key];
|
|
20573
|
+
}
|
|
20574
|
+
return target;
|
|
20575
|
+
}
|
|
20576
|
+
|
|
20577
|
+
const mediaDefaultSpecLargeMarginWidth = spacing.large_24;
|
|
20578
|
+
const MEDIA_DEFAULT_SPEC = {
|
|
20579
|
+
small: {
|
|
20580
|
+
query: "(max-width: 767px)",
|
|
20581
|
+
totalColumns: 4,
|
|
20582
|
+
gutterWidth: spacing.medium_16,
|
|
20583
|
+
marginWidth: spacing.medium_16
|
|
20584
|
+
},
|
|
20585
|
+
medium: {
|
|
20586
|
+
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
20587
|
+
totalColumns: 8,
|
|
20588
|
+
gutterWidth: spacing.xLarge_32,
|
|
20589
|
+
marginWidth: spacing.large_24
|
|
20590
|
+
},
|
|
20591
|
+
large: {
|
|
20592
|
+
query: "(min-width: 1024px)",
|
|
20593
|
+
totalColumns: 12,
|
|
20594
|
+
gutterWidth: spacing.xLarge_32,
|
|
20595
|
+
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
20596
|
+
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
20597
|
+
}
|
|
20598
|
+
};
|
|
20599
|
+
({
|
|
20600
|
+
large: {
|
|
20601
|
+
query: "(min-width: 1px)",
|
|
20602
|
+
totalColumns: 12,
|
|
20603
|
+
gutterWidth: spacing.xLarge_32,
|
|
20604
|
+
marginWidth: spacing.medium_16
|
|
20605
|
+
}
|
|
20606
|
+
});
|
|
20607
|
+
({
|
|
20608
|
+
small: {
|
|
20609
|
+
query: "(max-width: 767px)",
|
|
20610
|
+
totalColumns: 4,
|
|
20611
|
+
gutterWidth: spacing.medium_16,
|
|
20612
|
+
marginWidth: spacing.medium_16
|
|
20613
|
+
},
|
|
20614
|
+
large: {
|
|
20615
|
+
query: "(min-width: 768px)",
|
|
20616
|
+
totalColumns: 12,
|
|
20617
|
+
gutterWidth: spacing.xLarge_32,
|
|
20618
|
+
marginWidth: spacing.xxLarge_48
|
|
20619
|
+
}
|
|
20620
|
+
});
|
|
20621
|
+
|
|
20622
|
+
const defaultContext = {
|
|
20623
|
+
ssrSize: "large",
|
|
20624
|
+
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
20625
|
+
};
|
|
20626
|
+
const MediaLayoutContext = React.createContext(defaultContext);
|
|
20627
|
+
MediaLayoutContext.displayName = "MediaLayoutContext";
|
|
20628
|
+
|
|
20629
|
+
class Spring extends React.Component {
|
|
20630
|
+
render() {
|
|
20631
|
+
const {
|
|
20632
|
+
style
|
|
20633
|
+
} = this.props;
|
|
20634
|
+
return React.createElement(View, {
|
|
20635
|
+
"aria-hidden": "true",
|
|
20636
|
+
style: [styles$R.grow, style]
|
|
20637
|
+
});
|
|
20638
|
+
}
|
|
20639
|
+
}
|
|
20640
|
+
const styles$R = StyleSheet.create({
|
|
20641
|
+
grow: {
|
|
20642
|
+
flexGrow: 1
|
|
20643
|
+
}
|
|
20644
|
+
});
|
|
20645
|
+
|
|
20646
|
+
class Strut extends React.Component {
|
|
20647
|
+
render() {
|
|
20648
|
+
const {
|
|
20649
|
+
size,
|
|
20650
|
+
style
|
|
20651
|
+
} = this.props;
|
|
20652
|
+
return React.createElement(View, {
|
|
20653
|
+
"aria-hidden": "true",
|
|
20654
|
+
style: [strutStyle(size), style]
|
|
20655
|
+
});
|
|
20656
|
+
}
|
|
20657
|
+
}
|
|
20658
|
+
const strutStyle = size => {
|
|
20659
|
+
return {
|
|
20660
|
+
width: size,
|
|
20661
|
+
MsFlexBasis: size,
|
|
20662
|
+
MsFlexPreferredSize: size,
|
|
20663
|
+
WebkitFlexBasis: size,
|
|
20664
|
+
flexBasis: size,
|
|
20665
|
+
flexShrink: 0
|
|
20666
|
+
};
|
|
20667
|
+
};
|
|
20668
|
+
|
|
20669
|
+
const Spacing = {
|
|
20670
|
+
xxxxSmall_2: 2,
|
|
20671
|
+
xxxSmall_4: 4,
|
|
20672
|
+
xxSmall_6: 6,
|
|
20673
|
+
xSmall_8: 8,
|
|
20674
|
+
small_12: 12,
|
|
20675
|
+
medium_16: 16,
|
|
20676
|
+
large_24: 24,
|
|
20677
|
+
xLarge_32: 32,
|
|
20678
|
+
xxLarge_48: 48,
|
|
20679
|
+
xxxLarge_64: 64
|
|
20680
|
+
};
|
|
20681
|
+
|
|
20682
|
+
const _excluded$4 = ["label"];
|
|
20560
20683
|
const {
|
|
20561
20684
|
InlineIcon: InlineIcon$9
|
|
20562
20685
|
} = components;
|
|
@@ -20599,10 +20722,9 @@ class WidgetEditor extends React.Component {
|
|
|
20599
20722
|
});
|
|
20600
20723
|
this.props.onChange(newWidgetInfo, cb, silent);
|
|
20601
20724
|
};
|
|
20602
|
-
this.
|
|
20603
|
-
|
|
20604
|
-
|
|
20605
|
-
static: !this.state.widgetInfo.static
|
|
20725
|
+
this._setStatic = value => {
|
|
20726
|
+
const newWidgetInfo = _extends({}, this.state.widgetInfo, {
|
|
20727
|
+
static: value
|
|
20606
20728
|
});
|
|
20607
20729
|
this.props.onChange(newWidgetInfo);
|
|
20608
20730
|
};
|
|
@@ -20665,13 +20787,10 @@ class WidgetEditor extends React.Component {
|
|
|
20665
20787
|
className: "perseus-widget-editor-title-id",
|
|
20666
20788
|
href: "#",
|
|
20667
20789
|
onClick: this._toggleWidget
|
|
20668
|
-
}, this.props.id, this.state.showWidget ? /*#__PURE__*/React.createElement(InlineIcon$9, iconChevronDown$1) : /*#__PURE__*/React.createElement(InlineIcon$9, iconChevronRight)), supportsStaticMode && /*#__PURE__*/React.createElement(
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
|
|
20672
|
-
onClick: this._toggleStatic,
|
|
20673
|
-
className: "simple-button--small",
|
|
20674
|
-
value: widgetInfo.static ? "Unset as static" : "Set as static"
|
|
20790
|
+
}, this.props.id, this.state.showWidget ? /*#__PURE__*/React.createElement(InlineIcon$9, iconChevronDown$1) : /*#__PURE__*/React.createElement(InlineIcon$9, iconChevronRight)), supportsStaticMode && /*#__PURE__*/React.createElement(LabeledSwitch$1, {
|
|
20791
|
+
label: "Static",
|
|
20792
|
+
checked: !!widgetInfo.static,
|
|
20793
|
+
onChange: this._setStatic
|
|
20675
20794
|
}), supportedAlignments.length > 1 && /*#__PURE__*/React.createElement("select", {
|
|
20676
20795
|
className: "alignment",
|
|
20677
20796
|
value: widgetInfo.alignment,
|
|
@@ -20694,6 +20813,21 @@ class WidgetEditor extends React.Component {
|
|
|
20694
20813
|
}, widgetInfo.options))));
|
|
20695
20814
|
}
|
|
20696
20815
|
}
|
|
20816
|
+
function LabeledSwitch$1(props) {
|
|
20817
|
+
const {
|
|
20818
|
+
label
|
|
20819
|
+
} = props,
|
|
20820
|
+
switchProps = _objectWithoutPropertiesLoose(props, _excluded$4);
|
|
20821
|
+
const ids = useUniqueIdWithMock();
|
|
20822
|
+
const id = ids.get("switch");
|
|
20823
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("label", {
|
|
20824
|
+
htmlFor: id
|
|
20825
|
+
}, label), /*#__PURE__*/React.createElement(Strut, {
|
|
20826
|
+
size: Spacing.xxSmall_6
|
|
20827
|
+
}), /*#__PURE__*/React.createElement(Switch, _extends({
|
|
20828
|
+
id: id
|
|
20829
|
+
}, switchProps)));
|
|
20830
|
+
}
|
|
20697
20831
|
|
|
20698
20832
|
class WidgetSelect extends React.Component {
|
|
20699
20833
|
constructor(...args) {
|
|
@@ -20740,13 +20874,13 @@ class WidgetSelect extends React.Component {
|
|
|
20740
20874
|
* that collapse a region.
|
|
20741
20875
|
*/
|
|
20742
20876
|
function ToggleableCaret(props) {
|
|
20743
|
-
const iconStyle = props.isExpanded ? styles$
|
|
20877
|
+
const iconStyle = props.isExpanded ? styles$Q.expanded : styles$Q.collapsed;
|
|
20744
20878
|
return /*#__PURE__*/React.createElement(PhosphorIcon, {
|
|
20745
20879
|
icon: caretRight,
|
|
20746
20880
|
style: iconStyle
|
|
20747
20881
|
});
|
|
20748
20882
|
}
|
|
20749
|
-
const styles$
|
|
20883
|
+
const styles$Q = StyleSheet.create({
|
|
20750
20884
|
collapsed: {
|
|
20751
20885
|
transition: ".15s"
|
|
20752
20886
|
},
|
|
@@ -20779,16 +20913,16 @@ class TexErrorView extends React.Component {
|
|
|
20779
20913
|
showErrors
|
|
20780
20914
|
} = this.state;
|
|
20781
20915
|
return /*#__PURE__*/React.createElement(View, {
|
|
20782
|
-
style: styles$
|
|
20916
|
+
style: styles$P.errorContainer
|
|
20783
20917
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20784
|
-
style: styles$
|
|
20918
|
+
style: styles$P.title,
|
|
20785
20919
|
onClick: this.handleToggleTexErrors
|
|
20786
20920
|
}, /*#__PURE__*/React.createElement(ToggleableCaret, {
|
|
20787
20921
|
isExpanded: showErrors
|
|
20788
20922
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React.createElement(View, {
|
|
20789
|
-
style: styles$
|
|
20923
|
+
style: styles$P.errorExplanation
|
|
20790
20924
|
}, "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.createElement(View, {
|
|
20791
|
-
style: styles$
|
|
20925
|
+
style: styles$P.error,
|
|
20792
20926
|
key: index
|
|
20793
20927
|
}, /*#__PURE__*/React.createElement(View, {
|
|
20794
20928
|
style: {
|
|
@@ -20797,7 +20931,7 @@ class TexErrorView extends React.Component {
|
|
|
20797
20931
|
}, e.math), /*#__PURE__*/React.createElement(View, null, e.message))));
|
|
20798
20932
|
}
|
|
20799
20933
|
}
|
|
20800
|
-
const styles$
|
|
20934
|
+
const styles$P = StyleSheet.create({
|
|
20801
20935
|
title: {
|
|
20802
20936
|
backgroundColor: "#eee",
|
|
20803
20937
|
fontSize: "1.25em",
|
|
@@ -23910,7 +24044,7 @@ ItemExtrasEditor.defaultProps = {
|
|
|
23910
24044
|
zTable: false
|
|
23911
24045
|
};
|
|
23912
24046
|
const ItemExtraCheckbox = props => /*#__PURE__*/React.createElement(View, {
|
|
23913
|
-
style: [styles$
|
|
24047
|
+
style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
|
|
23914
24048
|
}, /*#__PURE__*/React.createElement(Checkbox$1, {
|
|
23915
24049
|
label: /*#__PURE__*/React.createElement(View, {
|
|
23916
24050
|
style: {
|
|
@@ -23920,7 +24054,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React.createElement(View, {
|
|
|
23920
24054
|
checked: props.checked,
|
|
23921
24055
|
onChange: newCheckedState => props.onChange(newCheckedState)
|
|
23922
24056
|
}));
|
|
23923
|
-
const styles$
|
|
24057
|
+
const styles$O = StyleSheet.create({
|
|
23924
24058
|
indented: {
|
|
23925
24059
|
marginInlineStart: spacing.large_24
|
|
23926
24060
|
}
|
|
@@ -24350,19 +24484,6 @@ var i18n = {
|
|
|
24350
24484
|
findImagesInItemData: findImagesInItemData
|
|
24351
24485
|
};
|
|
24352
24486
|
|
|
24353
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
24354
|
-
if (source == null) return {};
|
|
24355
|
-
var target = {};
|
|
24356
|
-
var sourceKeys = Object.keys(source);
|
|
24357
|
-
var key, i;
|
|
24358
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
24359
|
-
key = sourceKeys[i];
|
|
24360
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
24361
|
-
target[key] = source[key];
|
|
24362
|
-
}
|
|
24363
|
-
return target;
|
|
24364
|
-
}
|
|
24365
|
-
|
|
24366
24487
|
var isObject = function isObject(obj) {
|
|
24367
24488
|
return obj === Object(obj);
|
|
24368
24489
|
};
|
|
@@ -24591,7 +24712,7 @@ class SimpleButton extends React.Component {
|
|
|
24591
24712
|
} = _this$props,
|
|
24592
24713
|
otherProps = _objectWithoutPropertiesLoose(_this$props, _excluded$3);
|
|
24593
24714
|
return /*#__PURE__*/React.createElement("div", _extends({
|
|
24594
|
-
className: css(styles$
|
|
24715
|
+
className: css(styles$N.baseButton, color === "green" && styles$N.green, color === "orange" && styles$N.orange),
|
|
24595
24716
|
onClick: onClick
|
|
24596
24717
|
}, otherProps), children);
|
|
24597
24718
|
}
|
|
@@ -24606,7 +24727,7 @@ SimpleButton.defaultProps = {
|
|
|
24606
24727
|
color: "green",
|
|
24607
24728
|
onClick: () => {}
|
|
24608
24729
|
};
|
|
24609
|
-
const styles$
|
|
24730
|
+
const styles$N = StyleSheet.create({
|
|
24610
24731
|
baseButton: {
|
|
24611
24732
|
top: "0",
|
|
24612
24733
|
fontSize: "11px",
|
|
@@ -24826,23 +24947,23 @@ const LeafContainer = ({
|
|
|
24826
24947
|
}) => {
|
|
24827
24948
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24828
24949
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React.createElement("div", {
|
|
24829
|
-
className: css(styles$
|
|
24950
|
+
className: css(styles$M.containerHeader)
|
|
24830
24951
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24831
24952
|
depth: path.length,
|
|
24832
|
-
className: css(styles$
|
|
24953
|
+
className: css(styles$M.containerTitle)
|
|
24833
24954
|
}, capitalize(name)));
|
|
24834
24955
|
return /*#__PURE__*/React.createElement("div", {
|
|
24835
|
-
className: css(styles$
|
|
24956
|
+
className: css(styles$M.container)
|
|
24836
24957
|
}, /*#__PURE__*/React.createElement("span", {
|
|
24837
|
-
className: css(styles$
|
|
24958
|
+
className: css(styles$M.row, styles$M.rowHeading)
|
|
24838
24959
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24839
|
-
className: css(styles$
|
|
24960
|
+
className: css(styles$M.columnLeft)
|
|
24840
24961
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24841
|
-
className: "pod-title " + css(styles$
|
|
24962
|
+
className: "pod-title " + css(styles$M.containerHeader)
|
|
24842
24963
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24843
|
-
className: css(styles$
|
|
24964
|
+
className: css(styles$M.containerTitle)
|
|
24844
24965
|
}, capitalize(name)), controls)), /*#__PURE__*/React.createElement("div", {
|
|
24845
|
-
className: css(styles$
|
|
24966
|
+
className: css(styles$M.columnRight)
|
|
24846
24967
|
}, previewHeading)), children);
|
|
24847
24968
|
};
|
|
24848
24969
|
const ArrayContainer = props => {
|
|
@@ -24855,11 +24976,11 @@ const ArrayContainer = props => {
|
|
|
24855
24976
|
actions
|
|
24856
24977
|
} = props;
|
|
24857
24978
|
return /*#__PURE__*/React.createElement("div", {
|
|
24858
|
-
className: css(styles$
|
|
24979
|
+
className: css(styles$M.container)
|
|
24859
24980
|
}, controls && /*#__PURE__*/React.createElement("div", {
|
|
24860
|
-
className: css(styles$
|
|
24981
|
+
className: css(styles$M.columnLeft, styles$M.containerHeader)
|
|
24861
24982
|
}, controls), /*#__PURE__*/React.createElement("div", null, children), /*#__PURE__*/React.createElement("div", {
|
|
24862
|
-
className: css(styles$
|
|
24983
|
+
className: css(styles$M.columnLeft)
|
|
24863
24984
|
}, /*#__PURE__*/React.createElement("a", {
|
|
24864
24985
|
href: "javascript:void 0",
|
|
24865
24986
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24872,28 +24993,28 @@ const ObjectContainer = ({
|
|
|
24872
24993
|
path
|
|
24873
24994
|
}) => {
|
|
24874
24995
|
const headingEditor = /*#__PURE__*/React.createElement("div", {
|
|
24875
|
-
className: css(styles$
|
|
24996
|
+
className: css(styles$M.containerHeader)
|
|
24876
24997
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24877
24998
|
depth: path.length,
|
|
24878
|
-
className: css(styles$
|
|
24999
|
+
className: css(styles$M.containerTitle)
|
|
24879
25000
|
}, capitalize(name)), controls);
|
|
24880
25001
|
const headingPreview = (name || controls) && /*#__PURE__*/React.createElement("div", {
|
|
24881
|
-
className: css(styles$
|
|
25002
|
+
className: css(styles$M.containerHeader, styles$M.previewCollectionHeader)
|
|
24882
25003
|
}, /*#__PURE__*/React.createElement(Header, {
|
|
24883
25004
|
depth: path.length,
|
|
24884
|
-
className: css(styles$
|
|
25005
|
+
className: css(styles$M.containerTitle)
|
|
24885
25006
|
}, capitalize(name)));
|
|
24886
25007
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24887
25008
|
return /*#__PURE__*/React.createElement("div", {
|
|
24888
|
-
className: css(styles$
|
|
25009
|
+
className: css(styles$M.container)
|
|
24889
25010
|
}, hasBothHeadings && /*#__PURE__*/React.createElement("span", {
|
|
24890
|
-
className: css(styles$
|
|
25011
|
+
className: css(styles$M.row)
|
|
24891
25012
|
}, /*#__PURE__*/React.createElement("div", {
|
|
24892
|
-
className: css(styles$
|
|
25013
|
+
className: css(styles$M.columnLeft)
|
|
24893
25014
|
}, headingEditor), /*#__PURE__*/React.createElement("div", {
|
|
24894
|
-
className: css(styles$
|
|
25015
|
+
className: css(styles$M.columnRight)
|
|
24895
25016
|
}, headingPreview)), /*#__PURE__*/React.createElement("div", {
|
|
24896
|
-
className: css(path.length > 0 && styles$
|
|
25017
|
+
className: css(path.length > 0 && styles$M.contentIndent)
|
|
24897
25018
|
}, children));
|
|
24898
25019
|
};
|
|
24899
25020
|
|
|
@@ -25016,11 +25137,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25016
25137
|
className: "framework-perseus"
|
|
25017
25138
|
}, lens(renderers).get(path));
|
|
25018
25139
|
return /*#__PURE__*/React.createElement("span", null, /*#__PURE__*/React.createElement("div", {
|
|
25019
|
-
className: css(styles$
|
|
25140
|
+
className: css(styles$M.row)
|
|
25020
25141
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25021
|
-
className: css(styles$
|
|
25142
|
+
className: css(styles$M.columnLeft)
|
|
25022
25143
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25023
|
-
className: css(sticky && styles$
|
|
25144
|
+
className: css(sticky && styles$M.sticky)
|
|
25024
25145
|
},
|
|
25025
25146
|
/*#__PURE__*/
|
|
25026
25147
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -25028,9 +25149,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25028
25149
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25029
25150
|
apiOptions: apiOptions
|
|
25030
25151
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25031
|
-
className: css(styles$
|
|
25152
|
+
className: css(styles$M.columnRight)
|
|
25032
25153
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25033
|
-
className: css(sticky && styles$
|
|
25154
|
+
className: css(sticky && styles$M.sticky)
|
|
25034
25155
|
}, preview))));
|
|
25035
25156
|
});
|
|
25036
25157
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25046,13 +25167,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25046
25167
|
className: "framework-perseus"
|
|
25047
25168
|
}, lens(renderers).get(path));
|
|
25048
25169
|
return /*#__PURE__*/React.createElement("div", {
|
|
25049
|
-
className: css(styles$
|
|
25170
|
+
className: css(styles$M.row)
|
|
25050
25171
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25051
|
-
className: css(styles$
|
|
25172
|
+
className: css(styles$M.columnLeft)
|
|
25052
25173
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25053
|
-
className: css(sticky && styles$
|
|
25174
|
+
className: css(sticky && styles$M.sticky)
|
|
25054
25175
|
}, /*#__PURE__*/React.createElement(HintEditor, _extends({}, data, {
|
|
25055
|
-
className: css(styles$
|
|
25176
|
+
className: css(styles$M.hintEditor),
|
|
25056
25177
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25057
25178
|
apiOptions: apiOptions,
|
|
25058
25179
|
showTitle: false,
|
|
@@ -25067,9 +25188,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25067
25188
|
isFirst: true,
|
|
25068
25189
|
isLast: true
|
|
25069
25190
|
})))), /*#__PURE__*/React.createElement("div", {
|
|
25070
|
-
className: css(styles$
|
|
25191
|
+
className: css(styles$M.columnRight)
|
|
25071
25192
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25072
|
-
className: css(sticky && styles$
|
|
25193
|
+
className: css(sticky && styles$M.sticky)
|
|
25073
25194
|
}, preview)));
|
|
25074
25195
|
});
|
|
25075
25196
|
const TagsNodeContent = props => {
|
|
@@ -25086,9 +25207,9 @@ const TagsNodeContent = props => {
|
|
|
25086
25207
|
return null;
|
|
25087
25208
|
}
|
|
25088
25209
|
return /*#__PURE__*/React.createElement("div", {
|
|
25089
|
-
className: css(styles$
|
|
25210
|
+
className: css(styles$M.columnLeft)
|
|
25090
25211
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25091
|
-
className: css(styles$
|
|
25212
|
+
className: css(styles$M.tagsEditor)
|
|
25092
25213
|
}, /*#__PURE__*/React.createElement(GroupMetadataEditor, {
|
|
25093
25214
|
value: data,
|
|
25094
25215
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25119,23 +25240,23 @@ const ArrayNodeContent = props => {
|
|
|
25119
25240
|
const subpath = path.concat(i);
|
|
25120
25241
|
const controls = [i > 0 && /*#__PURE__*/React.createElement("div", {
|
|
25121
25242
|
key: "moveArrayElementUp",
|
|
25122
|
-
className: css(styles$
|
|
25243
|
+
className: css(styles$M.control)
|
|
25123
25244
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25124
25245
|
color: "orange",
|
|
25125
25246
|
title: "Move up",
|
|
25126
25247
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25127
25248
|
}, /*#__PURE__*/React.createElement("div", {
|
|
25128
|
-
className: css(styles$
|
|
25249
|
+
className: css(styles$M.verticalFlip)
|
|
25129
25250
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React.createElement("div", {
|
|
25130
25251
|
key: "moveArrayElementDown",
|
|
25131
|
-
className: css(styles$
|
|
25252
|
+
className: css(styles$M.control)
|
|
25132
25253
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25133
25254
|
color: "orange",
|
|
25134
25255
|
title: "Move down",
|
|
25135
25256
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25136
25257
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React.createElement("div", {
|
|
25137
25258
|
key: "removeArrayElement",
|
|
25138
|
-
className: css(styles$
|
|
25259
|
+
className: css(styles$M.control)
|
|
25139
25260
|
}, /*#__PURE__*/React.createElement(SimpleButton, {
|
|
25140
25261
|
color: "orange",
|
|
25141
25262
|
title: "Delete",
|
|
@@ -25143,7 +25264,7 @@ const ArrayNodeContent = props => {
|
|
|
25143
25264
|
}, /*#__PURE__*/React.createElement(InlineIcon$5, iconTrash$4)))];
|
|
25144
25265
|
return /*#__PURE__*/React.createElement("div", {
|
|
25145
25266
|
key: i,
|
|
25146
|
-
className: css(styles$
|
|
25267
|
+
className: css(styles$M.arrayElement, !elementIsLeaf && styles$M.arrayElementAndNotLeaf)
|
|
25147
25268
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25148
25269
|
key: i,
|
|
25149
25270
|
shape: shape.elementShape,
|
|
@@ -25169,7 +25290,7 @@ const ObjectNodeContent = props => {
|
|
|
25169
25290
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25170
25291
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React.createElement("div", {
|
|
25171
25292
|
key: subkey,
|
|
25172
|
-
className: css(styles$
|
|
25293
|
+
className: css(styles$M.objectElement)
|
|
25173
25294
|
}, /*#__PURE__*/React.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25174
25295
|
shape: shape.shape[subkey],
|
|
25175
25296
|
data: data[subkey],
|
|
@@ -25336,7 +25457,7 @@ class MultiRendererEditor extends React.Component {
|
|
|
25336
25457
|
}, this._renderContent());
|
|
25337
25458
|
}
|
|
25338
25459
|
}
|
|
25339
|
-
const styles$
|
|
25460
|
+
const styles$M = StyleSheet.create({
|
|
25340
25461
|
// This is used in a number of places throughout this file.
|
|
25341
25462
|
container: {},
|
|
25342
25463
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -26323,98 +26444,6 @@ ExplanationEditor.propTypes = _extends({}, Changeable.propTypes, {
|
|
|
26323
26444
|
ExplanationEditor.widgetName = "explanation";
|
|
26324
26445
|
ExplanationEditor.defaultProps = defaultExplanationProps;
|
|
26325
26446
|
|
|
26326
|
-
const mediaDefaultSpecLargeMarginWidth = spacing.large_24;
|
|
26327
|
-
const MEDIA_DEFAULT_SPEC = {
|
|
26328
|
-
small: {
|
|
26329
|
-
query: "(max-width: 767px)",
|
|
26330
|
-
totalColumns: 4,
|
|
26331
|
-
gutterWidth: spacing.medium_16,
|
|
26332
|
-
marginWidth: spacing.medium_16
|
|
26333
|
-
},
|
|
26334
|
-
medium: {
|
|
26335
|
-
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
26336
|
-
totalColumns: 8,
|
|
26337
|
-
gutterWidth: spacing.xLarge_32,
|
|
26338
|
-
marginWidth: spacing.large_24
|
|
26339
|
-
},
|
|
26340
|
-
large: {
|
|
26341
|
-
query: "(min-width: 1024px)",
|
|
26342
|
-
totalColumns: 12,
|
|
26343
|
-
gutterWidth: spacing.xLarge_32,
|
|
26344
|
-
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
26345
|
-
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
26346
|
-
}
|
|
26347
|
-
};
|
|
26348
|
-
({
|
|
26349
|
-
large: {
|
|
26350
|
-
query: "(min-width: 1px)",
|
|
26351
|
-
totalColumns: 12,
|
|
26352
|
-
gutterWidth: spacing.xLarge_32,
|
|
26353
|
-
marginWidth: spacing.medium_16
|
|
26354
|
-
}
|
|
26355
|
-
});
|
|
26356
|
-
({
|
|
26357
|
-
small: {
|
|
26358
|
-
query: "(max-width: 767px)",
|
|
26359
|
-
totalColumns: 4,
|
|
26360
|
-
gutterWidth: spacing.medium_16,
|
|
26361
|
-
marginWidth: spacing.medium_16
|
|
26362
|
-
},
|
|
26363
|
-
large: {
|
|
26364
|
-
query: "(min-width: 768px)",
|
|
26365
|
-
totalColumns: 12,
|
|
26366
|
-
gutterWidth: spacing.xLarge_32,
|
|
26367
|
-
marginWidth: spacing.xxLarge_48
|
|
26368
|
-
}
|
|
26369
|
-
});
|
|
26370
|
-
|
|
26371
|
-
const defaultContext = {
|
|
26372
|
-
ssrSize: "large",
|
|
26373
|
-
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
26374
|
-
};
|
|
26375
|
-
const MediaLayoutContext = React.createContext(defaultContext);
|
|
26376
|
-
MediaLayoutContext.displayName = "MediaLayoutContext";
|
|
26377
|
-
|
|
26378
|
-
class Spring extends React.Component {
|
|
26379
|
-
render() {
|
|
26380
|
-
const {
|
|
26381
|
-
style
|
|
26382
|
-
} = this.props;
|
|
26383
|
-
return React.createElement(View, {
|
|
26384
|
-
"aria-hidden": "true",
|
|
26385
|
-
style: [styles$M.grow, style]
|
|
26386
|
-
});
|
|
26387
|
-
}
|
|
26388
|
-
}
|
|
26389
|
-
const styles$M = StyleSheet.create({
|
|
26390
|
-
grow: {
|
|
26391
|
-
flexGrow: 1
|
|
26392
|
-
}
|
|
26393
|
-
});
|
|
26394
|
-
|
|
26395
|
-
class Strut extends React.Component {
|
|
26396
|
-
render() {
|
|
26397
|
-
const {
|
|
26398
|
-
size,
|
|
26399
|
-
style
|
|
26400
|
-
} = this.props;
|
|
26401
|
-
return React.createElement(View, {
|
|
26402
|
-
"aria-hidden": "true",
|
|
26403
|
-
style: [strutStyle(size), style]
|
|
26404
|
-
});
|
|
26405
|
-
}
|
|
26406
|
-
}
|
|
26407
|
-
const strutStyle = size => {
|
|
26408
|
-
return {
|
|
26409
|
-
width: size,
|
|
26410
|
-
MsFlexBasis: size,
|
|
26411
|
-
MsFlexPreferredSize: size,
|
|
26412
|
-
WebkitFlexBasis: size,
|
|
26413
|
-
flexBasis: size,
|
|
26414
|
-
flexShrink: 0
|
|
26415
|
-
};
|
|
26416
|
-
};
|
|
26417
|
-
|
|
26418
26447
|
const PT = PropTypes;
|
|
26419
26448
|
|
|
26420
26449
|
/**
|
|
@@ -30991,6 +31020,30 @@ const LockedPolygonSettings = props => {
|
|
|
30991
31020
|
color: newValue
|
|
30992
31021
|
});
|
|
30993
31022
|
}
|
|
31023
|
+
function handlePolygonMove(movement) {
|
|
31024
|
+
switch (movement) {
|
|
31025
|
+
case "up":
|
|
31026
|
+
onChangeProps({
|
|
31027
|
+
points: points.map(([x, y]) => [x, y + 1])
|
|
31028
|
+
});
|
|
31029
|
+
break;
|
|
31030
|
+
case "down":
|
|
31031
|
+
onChangeProps({
|
|
31032
|
+
points: points.map(([x, y]) => [x, y - 1])
|
|
31033
|
+
});
|
|
31034
|
+
break;
|
|
31035
|
+
case "left":
|
|
31036
|
+
onChangeProps({
|
|
31037
|
+
points: points.map(([x, y]) => [x - 1, y])
|
|
31038
|
+
});
|
|
31039
|
+
break;
|
|
31040
|
+
case "right":
|
|
31041
|
+
onChangeProps({
|
|
31042
|
+
points: points.map(([x, y]) => [x + 1, y])
|
|
31043
|
+
});
|
|
31044
|
+
break;
|
|
31045
|
+
}
|
|
31046
|
+
}
|
|
30994
31047
|
return /*#__PURE__*/React.createElement(PerseusEditorAccordion, {
|
|
30995
31048
|
expanded: expanded,
|
|
30996
31049
|
onToggle: onToggle,
|
|
@@ -31081,7 +31134,9 @@ const LockedPolygonSettings = props => {
|
|
|
31081
31134
|
},
|
|
31082
31135
|
style: styles$o.icon
|
|
31083
31136
|
}));
|
|
31084
|
-
}), /*#__PURE__*/React.createElement(
|
|
31137
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
31138
|
+
style: [styles$o.row, styles$o.polygonActionsContainer]
|
|
31139
|
+
}, /*#__PURE__*/React.createElement(Button, {
|
|
31085
31140
|
kind: "tertiary",
|
|
31086
31141
|
startIcon: plusCircle,
|
|
31087
31142
|
onClick: () => {
|
|
@@ -31089,7 +31144,35 @@ const LockedPolygonSettings = props => {
|
|
|
31089
31144
|
points: [...points, [0, 0]]
|
|
31090
31145
|
});
|
|
31091
31146
|
}
|
|
31092
|
-
}, "Add point")), /*#__PURE__*/React.createElement(
|
|
31147
|
+
}, "Add point"), /*#__PURE__*/React.createElement(Spring, null), /*#__PURE__*/React.createElement(View, {
|
|
31148
|
+
style: styles$o.movementButtonsContainer
|
|
31149
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
31150
|
+
"aria-label": "Move polygon up",
|
|
31151
|
+
style: styles$o.iconButton,
|
|
31152
|
+
size: "small",
|
|
31153
|
+
icon: arrowFatUp,
|
|
31154
|
+
onClick: () => handlePolygonMove("up")
|
|
31155
|
+
}), /*#__PURE__*/React.createElement(View, {
|
|
31156
|
+
style: styles$o.row
|
|
31157
|
+
}, /*#__PURE__*/React.createElement(IconButton, {
|
|
31158
|
+
"aria-label": "Move polygon left",
|
|
31159
|
+
style: styles$o.iconButton,
|
|
31160
|
+
size: "small",
|
|
31161
|
+
icon: arrowFatLeft,
|
|
31162
|
+
onClick: () => handlePolygonMove("left")
|
|
31163
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
31164
|
+
"aria-label": "Move polygon down",
|
|
31165
|
+
style: styles$o.iconButton,
|
|
31166
|
+
size: "small",
|
|
31167
|
+
icon: arrowFatDown,
|
|
31168
|
+
onClick: () => handlePolygonMove("down")
|
|
31169
|
+
}), /*#__PURE__*/React.createElement(IconButton, {
|
|
31170
|
+
"aria-label": "Move polygon right",
|
|
31171
|
+
style: styles$o.iconButton,
|
|
31172
|
+
size: "small",
|
|
31173
|
+
icon: arrowFatRight,
|
|
31174
|
+
onClick: () => handlePolygonMove("right")
|
|
31175
|
+
}))))), /*#__PURE__*/React.createElement(LockedFigureSettingsActions, {
|
|
31093
31176
|
figureType: props.type,
|
|
31094
31177
|
onMove: onMove,
|
|
31095
31178
|
onRemove: onRemove
|
|
@@ -31110,6 +31193,18 @@ const styles$o = StyleSheet.create({
|
|
|
31110
31193
|
icon: {
|
|
31111
31194
|
marginInlineStart: spacing.xxxSmall_4
|
|
31112
31195
|
},
|
|
31196
|
+
polygonActionsContainer: {
|
|
31197
|
+
width: "100%"
|
|
31198
|
+
},
|
|
31199
|
+
iconButton: {
|
|
31200
|
+
margin: 0
|
|
31201
|
+
},
|
|
31202
|
+
movementButtonsContainer: {
|
|
31203
|
+
display: "flex",
|
|
31204
|
+
flexDirection: "column",
|
|
31205
|
+
alignItems: "center",
|
|
31206
|
+
minWidth: "fit-content"
|
|
31207
|
+
},
|
|
31113
31208
|
spaceUnder: {
|
|
31114
31209
|
marginBottom: spacing.xSmall_8
|
|
31115
31210
|
},
|