@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/index.js
CHANGED
|
@@ -13,6 +13,7 @@ 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');
|
|
@@ -32,7 +33,10 @@ var caretDoubleUpIcon = require('@phosphor-icons/core/bold/caret-double-up-bold.
|
|
|
32
33
|
var caretDownIcon = require('@phosphor-icons/core/bold/caret-down-bold.svg');
|
|
33
34
|
var caretUpIcon = require('@phosphor-icons/core/bold/caret-up-bold.svg');
|
|
34
35
|
var trashIcon = require('@phosphor-icons/core/bold/trash-bold.svg');
|
|
35
|
-
var
|
|
36
|
+
var arrowFatDown = require('@phosphor-icons/core/regular/arrow-fat-down.svg');
|
|
37
|
+
var arrowFatLeft = require('@phosphor-icons/core/regular/arrow-fat-left.svg');
|
|
38
|
+
var arrowFatRight = require('@phosphor-icons/core/regular/arrow-fat-right.svg');
|
|
39
|
+
var arrowFatUp = require('@phosphor-icons/core/regular/arrow-fat-up.svg');
|
|
36
40
|
var minusCircle = require('@phosphor-icons/core/regular/minus-circle.svg');
|
|
37
41
|
var plusCircle = require('@phosphor-icons/core/regular/plus-circle.svg');
|
|
38
42
|
var Banner = require('@khanacademy/wonder-blocks-banner');
|
|
@@ -64,6 +68,7 @@ var createReactClass__default = /*#__PURE__*/_interopDefaultLegacy(createReactCl
|
|
|
64
68
|
var Clickable__default = /*#__PURE__*/_interopDefaultLegacy(Clickable);
|
|
65
69
|
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
|
|
66
70
|
var PropTypes__default = /*#__PURE__*/_interopDefaultLegacy(PropTypes);
|
|
71
|
+
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
67
72
|
var caretRight__default = /*#__PURE__*/_interopDefaultLegacy(caretRight);
|
|
68
73
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
69
74
|
var ReactDOM__default = /*#__PURE__*/_interopDefaultLegacy(ReactDOM);
|
|
@@ -75,7 +80,10 @@ var caretDoubleUpIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretDoubleU
|
|
|
75
80
|
var caretDownIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretDownIcon);
|
|
76
81
|
var caretUpIcon__default = /*#__PURE__*/_interopDefaultLegacy(caretUpIcon);
|
|
77
82
|
var trashIcon__default = /*#__PURE__*/_interopDefaultLegacy(trashIcon);
|
|
78
|
-
var
|
|
83
|
+
var arrowFatDown__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatDown);
|
|
84
|
+
var arrowFatLeft__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatLeft);
|
|
85
|
+
var arrowFatRight__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatRight);
|
|
86
|
+
var arrowFatUp__default = /*#__PURE__*/_interopDefaultLegacy(arrowFatUp);
|
|
79
87
|
var minusCircle__default = /*#__PURE__*/_interopDefaultLegacy(minusCircle);
|
|
80
88
|
var plusCircle__default = /*#__PURE__*/_interopDefaultLegacy(plusCircle);
|
|
81
89
|
var Banner__default = /*#__PURE__*/_interopDefaultLegacy(Banner);
|
|
@@ -83,7 +91,7 @@ var arrowCounterClockwise__default = /*#__PURE__*/_interopDefaultLegacy(arrowCou
|
|
|
83
91
|
|
|
84
92
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
85
93
|
const libName = "@khanacademy/perseus-editor";
|
|
86
|
-
const libVersion = "
|
|
94
|
+
const libVersion = "12.0.0";
|
|
87
95
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
88
96
|
|
|
89
97
|
function _extends() {
|
|
@@ -20606,6 +20614,111 @@ const DragTarget = createReactClass__default["default"]({
|
|
|
20606
20614
|
}
|
|
20607
20615
|
});
|
|
20608
20616
|
|
|
20617
|
+
const mediaDefaultSpecLargeMarginWidth = wonderBlocksTokens.spacing.large_24;
|
|
20618
|
+
const MEDIA_DEFAULT_SPEC = {
|
|
20619
|
+
small: {
|
|
20620
|
+
query: "(max-width: 767px)",
|
|
20621
|
+
totalColumns: 4,
|
|
20622
|
+
gutterWidth: wonderBlocksTokens.spacing.medium_16,
|
|
20623
|
+
marginWidth: wonderBlocksTokens.spacing.medium_16
|
|
20624
|
+
},
|
|
20625
|
+
medium: {
|
|
20626
|
+
query: "(min-width: 768px) and (max-width: 1023px)",
|
|
20627
|
+
totalColumns: 8,
|
|
20628
|
+
gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
|
|
20629
|
+
marginWidth: wonderBlocksTokens.spacing.large_24
|
|
20630
|
+
},
|
|
20631
|
+
large: {
|
|
20632
|
+
query: "(min-width: 1024px)",
|
|
20633
|
+
totalColumns: 12,
|
|
20634
|
+
gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
|
|
20635
|
+
marginWidth: mediaDefaultSpecLargeMarginWidth,
|
|
20636
|
+
maxWidth: 1120 + mediaDefaultSpecLargeMarginWidth * 2
|
|
20637
|
+
}
|
|
20638
|
+
};
|
|
20639
|
+
({
|
|
20640
|
+
large: {
|
|
20641
|
+
query: "(min-width: 1px)",
|
|
20642
|
+
totalColumns: 12,
|
|
20643
|
+
gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
|
|
20644
|
+
marginWidth: wonderBlocksTokens.spacing.medium_16
|
|
20645
|
+
}
|
|
20646
|
+
});
|
|
20647
|
+
({
|
|
20648
|
+
small: {
|
|
20649
|
+
query: "(max-width: 767px)",
|
|
20650
|
+
totalColumns: 4,
|
|
20651
|
+
gutterWidth: wonderBlocksTokens.spacing.medium_16,
|
|
20652
|
+
marginWidth: wonderBlocksTokens.spacing.medium_16
|
|
20653
|
+
},
|
|
20654
|
+
large: {
|
|
20655
|
+
query: "(min-width: 768px)",
|
|
20656
|
+
totalColumns: 12,
|
|
20657
|
+
gutterWidth: wonderBlocksTokens.spacing.xLarge_32,
|
|
20658
|
+
marginWidth: wonderBlocksTokens.spacing.xxLarge_48
|
|
20659
|
+
}
|
|
20660
|
+
});
|
|
20661
|
+
|
|
20662
|
+
const defaultContext = {
|
|
20663
|
+
ssrSize: "large",
|
|
20664
|
+
mediaSpec: MEDIA_DEFAULT_SPEC
|
|
20665
|
+
};
|
|
20666
|
+
const MediaLayoutContext = React__namespace.createContext(defaultContext);
|
|
20667
|
+
MediaLayoutContext.displayName = "MediaLayoutContext";
|
|
20668
|
+
|
|
20669
|
+
class Spring extends React__namespace.Component {
|
|
20670
|
+
render() {
|
|
20671
|
+
const {
|
|
20672
|
+
style
|
|
20673
|
+
} = this.props;
|
|
20674
|
+
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
20675
|
+
"aria-hidden": "true",
|
|
20676
|
+
style: [styles$R.grow, style]
|
|
20677
|
+
});
|
|
20678
|
+
}
|
|
20679
|
+
}
|
|
20680
|
+
const styles$R = aphrodite.StyleSheet.create({
|
|
20681
|
+
grow: {
|
|
20682
|
+
flexGrow: 1
|
|
20683
|
+
}
|
|
20684
|
+
});
|
|
20685
|
+
|
|
20686
|
+
class Strut extends React__namespace.Component {
|
|
20687
|
+
render() {
|
|
20688
|
+
const {
|
|
20689
|
+
size,
|
|
20690
|
+
style
|
|
20691
|
+
} = this.props;
|
|
20692
|
+
return React__namespace.createElement(wonderBlocksCore.View, {
|
|
20693
|
+
"aria-hidden": "true",
|
|
20694
|
+
style: [strutStyle(size), style]
|
|
20695
|
+
});
|
|
20696
|
+
}
|
|
20697
|
+
}
|
|
20698
|
+
const strutStyle = size => {
|
|
20699
|
+
return {
|
|
20700
|
+
width: size,
|
|
20701
|
+
MsFlexBasis: size,
|
|
20702
|
+
MsFlexPreferredSize: size,
|
|
20703
|
+
WebkitFlexBasis: size,
|
|
20704
|
+
flexBasis: size,
|
|
20705
|
+
flexShrink: 0
|
|
20706
|
+
};
|
|
20707
|
+
};
|
|
20708
|
+
|
|
20709
|
+
const Spacing = {
|
|
20710
|
+
xxxxSmall_2: 2,
|
|
20711
|
+
xxxSmall_4: 4,
|
|
20712
|
+
xxSmall_6: 6,
|
|
20713
|
+
xSmall_8: 8,
|
|
20714
|
+
small_12: 12,
|
|
20715
|
+
medium_16: 16,
|
|
20716
|
+
large_24: 24,
|
|
20717
|
+
xLarge_32: 32,
|
|
20718
|
+
xxLarge_48: 48,
|
|
20719
|
+
xxxLarge_64: 64
|
|
20720
|
+
};
|
|
20721
|
+
|
|
20609
20722
|
const {
|
|
20610
20723
|
InlineIcon: InlineIcon$9
|
|
20611
20724
|
} = perseus.components;
|
|
@@ -20665,11 +20778,11 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20665
20778
|
};
|
|
20666
20779
|
this.props.onChange(newWidgetInfo, cb, silent);
|
|
20667
20780
|
};
|
|
20668
|
-
|
|
20669
|
-
|
|
20670
|
-
|
|
20671
|
-
static:
|
|
20672
|
-
}
|
|
20781
|
+
_setStatic = value => {
|
|
20782
|
+
const newWidgetInfo = {
|
|
20783
|
+
...this.state.widgetInfo,
|
|
20784
|
+
static: value
|
|
20785
|
+
};
|
|
20673
20786
|
this.props.onChange(newWidgetInfo);
|
|
20674
20787
|
};
|
|
20675
20788
|
_handleAlignmentChange = e => {
|
|
@@ -20717,13 +20830,10 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20717
20830
|
className: "perseus-widget-editor-title-id",
|
|
20718
20831
|
href: "#",
|
|
20719
20832
|
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(
|
|
20721
|
-
|
|
20722
|
-
|
|
20723
|
-
|
|
20724
|
-
onClick: this._toggleStatic,
|
|
20725
|
-
className: "simple-button--small",
|
|
20726
|
-
value: widgetInfo.static ? "Unset as static" : "Set as static"
|
|
20833
|
+
}, 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, {
|
|
20834
|
+
label: "Static",
|
|
20835
|
+
checked: !!widgetInfo.static,
|
|
20836
|
+
onChange: this._setStatic
|
|
20727
20837
|
}), supportedAlignments.length > 1 && /*#__PURE__*/React__namespace.createElement("select", {
|
|
20728
20838
|
className: "alignment",
|
|
20729
20839
|
value: widgetInfo.alignment,
|
|
@@ -20746,6 +20856,21 @@ class WidgetEditor extends React__namespace.Component {
|
|
|
20746
20856
|
}, widgetInfo.options))));
|
|
20747
20857
|
}
|
|
20748
20858
|
}
|
|
20859
|
+
function LabeledSwitch$1(props) {
|
|
20860
|
+
const {
|
|
20861
|
+
label,
|
|
20862
|
+
...switchProps
|
|
20863
|
+
} = props;
|
|
20864
|
+
const ids = wonderBlocksCore.useUniqueIdWithMock();
|
|
20865
|
+
const id = ids.get("switch");
|
|
20866
|
+
return /*#__PURE__*/React__namespace.createElement(React__namespace.Fragment, null, /*#__PURE__*/React__namespace.createElement("label", {
|
|
20867
|
+
htmlFor: id
|
|
20868
|
+
}, label), /*#__PURE__*/React__namespace.createElement(Strut, {
|
|
20869
|
+
size: Spacing.xxSmall_6
|
|
20870
|
+
}), /*#__PURE__*/React__namespace.createElement(Switch__default["default"], _extends({
|
|
20871
|
+
id: id
|
|
20872
|
+
}, switchProps)));
|
|
20873
|
+
}
|
|
20749
20874
|
|
|
20750
20875
|
class WidgetSelect extends React__namespace.Component {
|
|
20751
20876
|
shouldComponentUpdate() {
|
|
@@ -20789,13 +20914,13 @@ class WidgetSelect extends React__namespace.Component {
|
|
|
20789
20914
|
* that collapse a region.
|
|
20790
20915
|
*/
|
|
20791
20916
|
function ToggleableCaret(props) {
|
|
20792
|
-
const iconStyle = props.isExpanded ? styles$
|
|
20917
|
+
const iconStyle = props.isExpanded ? styles$Q.expanded : styles$Q.collapsed;
|
|
20793
20918
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksIcon.PhosphorIcon, {
|
|
20794
20919
|
icon: caretRight__default["default"],
|
|
20795
20920
|
style: iconStyle
|
|
20796
20921
|
});
|
|
20797
20922
|
}
|
|
20798
|
-
const styles$
|
|
20923
|
+
const styles$Q = aphrodite.StyleSheet.create({
|
|
20799
20924
|
collapsed: {
|
|
20800
20925
|
transition: ".15s"
|
|
20801
20926
|
},
|
|
@@ -20825,16 +20950,16 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20825
20950
|
showErrors
|
|
20826
20951
|
} = this.state;
|
|
20827
20952
|
return /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20828
|
-
style: styles$
|
|
20953
|
+
style: styles$P.errorContainer
|
|
20829
20954
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20830
|
-
style: styles$
|
|
20955
|
+
style: styles$P.title,
|
|
20831
20956
|
onClick: this.handleToggleTexErrors
|
|
20832
20957
|
}, /*#__PURE__*/React__namespace.createElement(ToggleableCaret, {
|
|
20833
20958
|
isExpanded: showErrors
|
|
20834
20959
|
}), "\xA0 TeX Errors (", errorList.length, ")"), showErrors && /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20835
|
-
style: styles$
|
|
20960
|
+
style: styles$P.errorExplanation
|
|
20836
20961
|
}, "If your math doesn't display correctly, these errors might help you troubleshoot. Message #content-kitchen for help."), showErrors && errorList.map((e, index) => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20837
|
-
style: styles$
|
|
20962
|
+
style: styles$P.error,
|
|
20838
20963
|
key: index
|
|
20839
20964
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
20840
20965
|
style: {
|
|
@@ -20843,7 +20968,7 @@ class TexErrorView extends React__namespace.Component {
|
|
|
20843
20968
|
}, e.math), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, null, e.message))));
|
|
20844
20969
|
}
|
|
20845
20970
|
}
|
|
20846
|
-
const styles$
|
|
20971
|
+
const styles$P = aphrodite.StyleSheet.create({
|
|
20847
20972
|
title: {
|
|
20848
20973
|
backgroundColor: "#eee",
|
|
20849
20974
|
fontSize: "1.25em",
|
|
@@ -23920,7 +24045,7 @@ class ItemExtrasEditor extends React__namespace.Component {
|
|
|
23920
24045
|
}
|
|
23921
24046
|
}
|
|
23922
24047
|
const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
23923
|
-
style: [styles$
|
|
24048
|
+
style: [styles$O.checkbox, props.indent ? styles$O.indented : undefined]
|
|
23924
24049
|
}, /*#__PURE__*/React__namespace.createElement(wonderBlocksForm.Checkbox, {
|
|
23925
24050
|
label: /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
23926
24051
|
style: {
|
|
@@ -23930,7 +24055,7 @@ const ItemExtraCheckbox = props => /*#__PURE__*/React__namespace.createElement(w
|
|
|
23930
24055
|
checked: props.checked,
|
|
23931
24056
|
onChange: newCheckedState => props.onChange(newCheckedState)
|
|
23932
24057
|
}));
|
|
23933
|
-
const styles$
|
|
24058
|
+
const styles$O = aphrodite.StyleSheet.create({
|
|
23934
24059
|
indented: {
|
|
23935
24060
|
marginInlineStart: wonderBlocksTokens.spacing.large_24
|
|
23936
24061
|
}
|
|
@@ -24593,12 +24718,12 @@ class SimpleButton extends React__namespace.Component {
|
|
|
24593
24718
|
...otherProps
|
|
24594
24719
|
} = this.props;
|
|
24595
24720
|
return /*#__PURE__*/React__namespace.createElement("div", _extends({
|
|
24596
|
-
className: aphrodite.css(styles$
|
|
24721
|
+
className: aphrodite.css(styles$N.baseButton, color === "green" && styles$N.green, color === "orange" && styles$N.orange),
|
|
24597
24722
|
onClick: onClick
|
|
24598
24723
|
}, otherProps), children);
|
|
24599
24724
|
}
|
|
24600
24725
|
}
|
|
24601
|
-
const styles$
|
|
24726
|
+
const styles$N = aphrodite.StyleSheet.create({
|
|
24602
24727
|
baseButton: {
|
|
24603
24728
|
top: "0",
|
|
24604
24729
|
fontSize: "11px",
|
|
@@ -24811,23 +24936,23 @@ const LeafContainer = _ref2 => {
|
|
|
24811
24936
|
} = _ref2;
|
|
24812
24937
|
const hasPreviewHeading = shape.type === "content" || shape.type === "hint";
|
|
24813
24938
|
const previewHeading = hasPreviewHeading && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24814
|
-
className: aphrodite.css(styles$
|
|
24939
|
+
className: aphrodite.css(styles$M.containerHeader)
|
|
24815
24940
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24816
24941
|
depth: path.length,
|
|
24817
|
-
className: aphrodite.css(styles$
|
|
24942
|
+
className: aphrodite.css(styles$M.containerTitle)
|
|
24818
24943
|
}, capitalize(name)));
|
|
24819
24944
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24820
|
-
className: aphrodite.css(styles$
|
|
24945
|
+
className: aphrodite.css(styles$M.container)
|
|
24821
24946
|
}, /*#__PURE__*/React__namespace.createElement("span", {
|
|
24822
|
-
className: aphrodite.css(styles$
|
|
24947
|
+
className: aphrodite.css(styles$M.row, styles$M.rowHeading)
|
|
24823
24948
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24824
|
-
className: aphrodite.css(styles$
|
|
24949
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
24825
24950
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24826
|
-
className: "pod-title " + aphrodite.css(styles$
|
|
24951
|
+
className: "pod-title " + aphrodite.css(styles$M.containerHeader)
|
|
24827
24952
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24828
|
-
className: aphrodite.css(styles$
|
|
24953
|
+
className: aphrodite.css(styles$M.containerTitle)
|
|
24829
24954
|
}, capitalize(name)), controls)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24830
|
-
className: aphrodite.css(styles$
|
|
24955
|
+
className: aphrodite.css(styles$M.columnRight)
|
|
24831
24956
|
}, previewHeading)), children);
|
|
24832
24957
|
};
|
|
24833
24958
|
const ArrayContainer = props => {
|
|
@@ -24840,11 +24965,11 @@ const ArrayContainer = props => {
|
|
|
24840
24965
|
actions
|
|
24841
24966
|
} = props;
|
|
24842
24967
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24843
|
-
className: aphrodite.css(styles$
|
|
24968
|
+
className: aphrodite.css(styles$M.container)
|
|
24844
24969
|
}, controls && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24845
|
-
className: aphrodite.css(styles$
|
|
24970
|
+
className: aphrodite.css(styles$M.columnLeft, styles$M.containerHeader)
|
|
24846
24971
|
}, controls), /*#__PURE__*/React__namespace.createElement("div", null, children), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24847
|
-
className: aphrodite.css(styles$
|
|
24972
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
24848
24973
|
}, /*#__PURE__*/React__namespace.createElement("a", {
|
|
24849
24974
|
href: "javascript:void 0",
|
|
24850
24975
|
onClick: () => actions.addArrayElement(path, shape.elementShape)
|
|
@@ -24858,28 +24983,28 @@ const ObjectContainer = _ref3 => {
|
|
|
24858
24983
|
path
|
|
24859
24984
|
} = _ref3;
|
|
24860
24985
|
const headingEditor = /*#__PURE__*/React__namespace.createElement("div", {
|
|
24861
|
-
className: aphrodite.css(styles$
|
|
24986
|
+
className: aphrodite.css(styles$M.containerHeader)
|
|
24862
24987
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24863
24988
|
depth: path.length,
|
|
24864
|
-
className: aphrodite.css(styles$
|
|
24989
|
+
className: aphrodite.css(styles$M.containerTitle)
|
|
24865
24990
|
}, capitalize(name)), controls);
|
|
24866
24991
|
const headingPreview = (name || controls) && /*#__PURE__*/React__namespace.createElement("div", {
|
|
24867
|
-
className: aphrodite.css(styles$
|
|
24992
|
+
className: aphrodite.css(styles$M.containerHeader, styles$M.previewCollectionHeader)
|
|
24868
24993
|
}, /*#__PURE__*/React__namespace.createElement(Header, {
|
|
24869
24994
|
depth: path.length,
|
|
24870
|
-
className: aphrodite.css(styles$
|
|
24995
|
+
className: aphrodite.css(styles$M.containerTitle)
|
|
24871
24996
|
}, capitalize(name)));
|
|
24872
24997
|
const hasBothHeadings = headingEditor && headingPreview;
|
|
24873
24998
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
24874
|
-
className: aphrodite.css(styles$
|
|
24999
|
+
className: aphrodite.css(styles$M.container)
|
|
24875
25000
|
}, hasBothHeadings && /*#__PURE__*/React__namespace.createElement("span", {
|
|
24876
|
-
className: aphrodite.css(styles$
|
|
25001
|
+
className: aphrodite.css(styles$M.row)
|
|
24877
25002
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
24878
|
-
className: aphrodite.css(styles$
|
|
25003
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
24879
25004
|
}, headingEditor), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24880
|
-
className: aphrodite.css(styles$
|
|
25005
|
+
className: aphrodite.css(styles$M.columnRight)
|
|
24881
25006
|
}, headingPreview)), /*#__PURE__*/React__namespace.createElement("div", {
|
|
24882
|
-
className: aphrodite.css(path.length > 0 && styles$
|
|
25007
|
+
className: aphrodite.css(path.length > 0 && styles$M.contentIndent)
|
|
24883
25008
|
}, children));
|
|
24884
25009
|
};
|
|
24885
25010
|
|
|
@@ -24999,11 +25124,11 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
24999
25124
|
className: "framework-perseus"
|
|
25000
25125
|
}, lens(renderers).get(path));
|
|
25001
25126
|
return /*#__PURE__*/React__namespace.createElement("span", null, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25002
|
-
className: aphrodite.css(styles$
|
|
25127
|
+
className: aphrodite.css(styles$M.row)
|
|
25003
25128
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25004
|
-
className: aphrodite.css(styles$
|
|
25129
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
25005
25130
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25006
|
-
className: aphrodite.css(sticky && styles$
|
|
25131
|
+
className: aphrodite.css(sticky && styles$M.sticky)
|
|
25007
25132
|
},
|
|
25008
25133
|
/*#__PURE__*/
|
|
25009
25134
|
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
@@ -25011,9 +25136,9 @@ const ItemNodeContent = withStickiness(props => {
|
|
|
25011
25136
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25012
25137
|
apiOptions: apiOptions
|
|
25013
25138
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25014
|
-
className: aphrodite.css(styles$
|
|
25139
|
+
className: aphrodite.css(styles$M.columnRight)
|
|
25015
25140
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25016
|
-
className: aphrodite.css(sticky && styles$
|
|
25141
|
+
className: aphrodite.css(sticky && styles$M.sticky)
|
|
25017
25142
|
}, preview))));
|
|
25018
25143
|
});
|
|
25019
25144
|
const HintNodeContent = withStickiness(props => {
|
|
@@ -25029,13 +25154,13 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25029
25154
|
className: "framework-perseus"
|
|
25030
25155
|
}, lens(renderers).get(path));
|
|
25031
25156
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25032
|
-
className: aphrodite.css(styles$
|
|
25157
|
+
className: aphrodite.css(styles$M.row)
|
|
25033
25158
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25034
|
-
className: aphrodite.css(styles$
|
|
25159
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
25035
25160
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25036
|
-
className: aphrodite.css(sticky && styles$
|
|
25161
|
+
className: aphrodite.css(sticky && styles$M.sticky)
|
|
25037
25162
|
}, /*#__PURE__*/React__namespace.createElement(HintEditor, _extends({}, data, {
|
|
25038
|
-
className: aphrodite.css(styles$
|
|
25163
|
+
className: aphrodite.css(styles$M.hintEditor),
|
|
25039
25164
|
onChange: newVal => actions.mergeValueAtPath(path, newVal),
|
|
25040
25165
|
apiOptions: apiOptions,
|
|
25041
25166
|
showTitle: false,
|
|
@@ -25050,9 +25175,9 @@ const HintNodeContent = withStickiness(props => {
|
|
|
25050
25175
|
isFirst: true,
|
|
25051
25176
|
isLast: true
|
|
25052
25177
|
})))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25053
|
-
className: aphrodite.css(styles$
|
|
25178
|
+
className: aphrodite.css(styles$M.columnRight)
|
|
25054
25179
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25055
|
-
className: aphrodite.css(sticky && styles$
|
|
25180
|
+
className: aphrodite.css(sticky && styles$M.sticky)
|
|
25056
25181
|
}, preview)));
|
|
25057
25182
|
});
|
|
25058
25183
|
const TagsNodeContent = props => {
|
|
@@ -25069,9 +25194,9 @@ const TagsNodeContent = props => {
|
|
|
25069
25194
|
return null;
|
|
25070
25195
|
}
|
|
25071
25196
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25072
|
-
className: aphrodite.css(styles$
|
|
25197
|
+
className: aphrodite.css(styles$M.columnLeft)
|
|
25073
25198
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25074
|
-
className: aphrodite.css(styles$
|
|
25199
|
+
className: aphrodite.css(styles$M.tagsEditor)
|
|
25075
25200
|
}, /*#__PURE__*/React__namespace.createElement(GroupMetadataEditor, {
|
|
25076
25201
|
value: data,
|
|
25077
25202
|
onChange: newVal => actions.setValueAtPath(path, newVal),
|
|
@@ -25102,23 +25227,23 @@ const ArrayNodeContent = props => {
|
|
|
25102
25227
|
const subpath = path.concat(i);
|
|
25103
25228
|
const controls = [i > 0 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25104
25229
|
key: "moveArrayElementUp",
|
|
25105
|
-
className: aphrodite.css(styles$
|
|
25230
|
+
className: aphrodite.css(styles$M.control)
|
|
25106
25231
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25107
25232
|
color: "orange",
|
|
25108
25233
|
title: "Move up",
|
|
25109
25234
|
onClick: () => actions.moveArrayElementUp(subpath)
|
|
25110
25235
|
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
25111
|
-
className: aphrodite.css(styles$
|
|
25236
|
+
className: aphrodite.css(styles$M.verticalFlip)
|
|
25112
25237
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown)))), i < data.length - 1 && /*#__PURE__*/React__namespace.createElement("div", {
|
|
25113
25238
|
key: "moveArrayElementDown",
|
|
25114
|
-
className: aphrodite.css(styles$
|
|
25239
|
+
className: aphrodite.css(styles$M.control)
|
|
25115
25240
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25116
25241
|
color: "orange",
|
|
25117
25242
|
title: "Move down",
|
|
25118
25243
|
onClick: () => actions.moveArrayElementDown(subpath)
|
|
25119
25244
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconChevronDown))), /*#__PURE__*/React__namespace.createElement("div", {
|
|
25120
25245
|
key: "removeArrayElement",
|
|
25121
|
-
className: aphrodite.css(styles$
|
|
25246
|
+
className: aphrodite.css(styles$M.control)
|
|
25122
25247
|
}, /*#__PURE__*/React__namespace.createElement(SimpleButton, {
|
|
25123
25248
|
color: "orange",
|
|
25124
25249
|
title: "Delete",
|
|
@@ -25126,7 +25251,7 @@ const ArrayNodeContent = props => {
|
|
|
25126
25251
|
}, /*#__PURE__*/React__namespace.createElement(InlineIcon$5, iconTrash$4)))];
|
|
25127
25252
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
25128
25253
|
key: i,
|
|
25129
|
-
className: aphrodite.css(styles$
|
|
25254
|
+
className: aphrodite.css(styles$M.arrayElement, !elementIsLeaf && styles$M.arrayElementAndNotLeaf)
|
|
25130
25255
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25131
25256
|
key: i,
|
|
25132
25257
|
shape: shape.elementShape,
|
|
@@ -25152,7 +25277,7 @@ const ObjectNodeContent = props => {
|
|
|
25152
25277
|
// made sense to the shape's author is the order in which we'll iterate :)
|
|
25153
25278
|
const children = Object.keys(shape.shape).map(subkey => /*#__PURE__*/React__namespace.createElement("div", {
|
|
25154
25279
|
key: subkey,
|
|
25155
|
-
className: aphrodite.css(styles$
|
|
25280
|
+
className: aphrodite.css(styles$M.objectElement)
|
|
25156
25281
|
}, /*#__PURE__*/React__namespace.createElement(NodeContainer, _extends({}, otherProps, {
|
|
25157
25282
|
shape: shape.shape[subkey],
|
|
25158
25283
|
data: data[subkey],
|
|
@@ -25322,7 +25447,7 @@ class MultiRendererEditor extends React__namespace.Component {
|
|
|
25322
25447
|
}, this._renderContent());
|
|
25323
25448
|
}
|
|
25324
25449
|
}
|
|
25325
|
-
const styles$
|
|
25450
|
+
const styles$M = aphrodite.StyleSheet.create({
|
|
25326
25451
|
// This is used in a number of places throughout this file.
|
|
25327
25452
|
container: {},
|
|
25328
25453
|
// eslint-disable-next-line react-native/no-unused-styles
|
|
@@ -26346,98 +26471,6 @@ class ExplanationEditor extends React__namespace.Component {
|
|
|
26346
26471
|
}
|
|
26347
26472
|
}
|
|
26348
26473
|
|
|
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
26474
|
const PT = PropTypes__default["default"];
|
|
26442
26475
|
|
|
26443
26476
|
/**
|
|
@@ -31095,6 +31128,42 @@ const LockedPolygonSettings = props => {
|
|
|
31095
31128
|
color: newValue
|
|
31096
31129
|
});
|
|
31097
31130
|
}
|
|
31131
|
+
function handlePolygonMove(movement) {
|
|
31132
|
+
switch (movement) {
|
|
31133
|
+
case "up":
|
|
31134
|
+
onChangeProps({
|
|
31135
|
+
points: points.map(_ref => {
|
|
31136
|
+
let [x, y] = _ref;
|
|
31137
|
+
return [x, y + 1];
|
|
31138
|
+
})
|
|
31139
|
+
});
|
|
31140
|
+
break;
|
|
31141
|
+
case "down":
|
|
31142
|
+
onChangeProps({
|
|
31143
|
+
points: points.map(_ref2 => {
|
|
31144
|
+
let [x, y] = _ref2;
|
|
31145
|
+
return [x, y - 1];
|
|
31146
|
+
})
|
|
31147
|
+
});
|
|
31148
|
+
break;
|
|
31149
|
+
case "left":
|
|
31150
|
+
onChangeProps({
|
|
31151
|
+
points: points.map(_ref3 => {
|
|
31152
|
+
let [x, y] = _ref3;
|
|
31153
|
+
return [x - 1, y];
|
|
31154
|
+
})
|
|
31155
|
+
});
|
|
31156
|
+
break;
|
|
31157
|
+
case "right":
|
|
31158
|
+
onChangeProps({
|
|
31159
|
+
points: points.map(_ref4 => {
|
|
31160
|
+
let [x, y] = _ref4;
|
|
31161
|
+
return [x + 1, y];
|
|
31162
|
+
})
|
|
31163
|
+
});
|
|
31164
|
+
break;
|
|
31165
|
+
}
|
|
31166
|
+
}
|
|
31098
31167
|
return /*#__PURE__*/React__namespace.createElement(PerseusEditorAccordion, {
|
|
31099
31168
|
expanded: expanded,
|
|
31100
31169
|
onToggle: onToggle,
|
|
@@ -31185,7 +31254,9 @@ const LockedPolygonSettings = props => {
|
|
|
31185
31254
|
},
|
|
31186
31255
|
style: styles$o.icon
|
|
31187
31256
|
}));
|
|
31188
|
-
}), /*#__PURE__*/React__namespace.createElement(
|
|
31257
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31258
|
+
style: [styles$o.row, styles$o.polygonActionsContainer]
|
|
31259
|
+
}, /*#__PURE__*/React__namespace.createElement(Button__default["default"], {
|
|
31189
31260
|
kind: "tertiary",
|
|
31190
31261
|
startIcon: plusCircle__default["default"],
|
|
31191
31262
|
onClick: () => {
|
|
@@ -31193,7 +31264,35 @@ const LockedPolygonSettings = props => {
|
|
|
31193
31264
|
points: [...points, [0, 0]]
|
|
31194
31265
|
});
|
|
31195
31266
|
}
|
|
31196
|
-
}, "Add point")), /*#__PURE__*/React__namespace.createElement(
|
|
31267
|
+
}, "Add point"), /*#__PURE__*/React__namespace.createElement(Spring, null), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31268
|
+
style: styles$o.movementButtonsContainer
|
|
31269
|
+
}, /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
31270
|
+
"aria-label": "Move polygon up",
|
|
31271
|
+
style: styles$o.iconButton,
|
|
31272
|
+
size: "small",
|
|
31273
|
+
icon: arrowFatUp__default["default"],
|
|
31274
|
+
onClick: () => handlePolygonMove("up")
|
|
31275
|
+
}), /*#__PURE__*/React__namespace.createElement(wonderBlocksCore.View, {
|
|
31276
|
+
style: styles$o.row
|
|
31277
|
+
}, /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
31278
|
+
"aria-label": "Move polygon left",
|
|
31279
|
+
style: styles$o.iconButton,
|
|
31280
|
+
size: "small",
|
|
31281
|
+
icon: arrowFatLeft__default["default"],
|
|
31282
|
+
onClick: () => handlePolygonMove("left")
|
|
31283
|
+
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
31284
|
+
"aria-label": "Move polygon down",
|
|
31285
|
+
style: styles$o.iconButton,
|
|
31286
|
+
size: "small",
|
|
31287
|
+
icon: arrowFatDown__default["default"],
|
|
31288
|
+
onClick: () => handlePolygonMove("down")
|
|
31289
|
+
}), /*#__PURE__*/React__namespace.createElement(IconButton__default["default"], {
|
|
31290
|
+
"aria-label": "Move polygon right",
|
|
31291
|
+
style: styles$o.iconButton,
|
|
31292
|
+
size: "small",
|
|
31293
|
+
icon: arrowFatRight__default["default"],
|
|
31294
|
+
onClick: () => handlePolygonMove("right")
|
|
31295
|
+
}))))), /*#__PURE__*/React__namespace.createElement(LockedFigureSettingsActions, {
|
|
31197
31296
|
figureType: props.type,
|
|
31198
31297
|
onMove: onMove,
|
|
31199
31298
|
onRemove: onRemove
|
|
@@ -31214,6 +31313,18 @@ const styles$o = aphrodite.StyleSheet.create({
|
|
|
31214
31313
|
icon: {
|
|
31215
31314
|
marginInlineStart: wonderBlocksTokens.spacing.xxxSmall_4
|
|
31216
31315
|
},
|
|
31316
|
+
polygonActionsContainer: {
|
|
31317
|
+
width: "100%"
|
|
31318
|
+
},
|
|
31319
|
+
iconButton: {
|
|
31320
|
+
margin: 0
|
|
31321
|
+
},
|
|
31322
|
+
movementButtonsContainer: {
|
|
31323
|
+
display: "flex",
|
|
31324
|
+
flexDirection: "column",
|
|
31325
|
+
alignItems: "center",
|
|
31326
|
+
minWidth: "fit-content"
|
|
31327
|
+
},
|
|
31217
31328
|
spaceUnder: {
|
|
31218
31329
|
marginBottom: wonderBlocksTokens.spacing.xSmall_8
|
|
31219
31330
|
},
|