@khanacademy/math-input 25.0.2 → 25.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/keypad/keypad.d.ts +4 -2
- package/dist/es/index.js +2 -2
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -44,7 +44,7 @@ var MathQuill__default = /*#__PURE__*/_interopDefaultCompat(MathQuill);
|
|
|
44
44
|
var Clickable__default = /*#__PURE__*/_interopDefaultCompat(Clickable);
|
|
45
45
|
var PropTypes__default = /*#__PURE__*/_interopDefaultCompat(PropTypes);
|
|
46
46
|
|
|
47
|
-
const libName="@khanacademy/math-input";const libVersion="25.0.
|
|
47
|
+
const libName="@khanacademy/math-input";const libVersion="25.0.4";perseusUtils.addLibraryVersionToPerseusDebug(libName,libVersion);
|
|
48
48
|
|
|
49
49
|
var jsxRuntime = {exports: {}};
|
|
50
50
|
|
|
@@ -1485,7 +1485,7 @@ class TransitionChild extends React__namespace.Component{static getDerivedStateF
|
|
|
1485
1485
|
|
|
1486
1486
|
class AphroditeCSSTransitionGroup extends React__namespace.Component{render(){const{children}=this.props;return jsxRuntimeExports.jsx(reactTransitionGroup.TransitionGroup,{component:null,children:React__namespace.Children.map(children,child=>jsxRuntimeExports.jsx(TransitionChild$1,{transitionStyles:this.props.transitionStyle,appearTimeout:this.props.transitionAppearTimeout,enterTimeout:this.props.transitionEnterTimeout,leaveTimeout:this.props.transitionLeaveTimeout,children:child}))})}}
|
|
1487
1487
|
|
|
1488
|
-
const AnimationDurationInMS=200;class MobileKeypadInternals extends React__namespace.Component{componentDidMount(){this._resize();window.addEventListener("resize",this._throttleResizeHandler);window.addEventListener("orientationchange",this._throttleResizeHandler);if("ResizeObserver"in window){this._containerResizeObserver=new window.ResizeObserver(this._throttleResizeHandler);if(this._containerRef.current){this._containerResizeObserver.observe(this._containerRef.current);}}this.props.onElementMounted?.({activate:this.activate,dismiss:this.dismiss,configure:this.configure,setCursor:this.setCursor,setKeyHandler:this.setKeyHandler,getDOMNode:this.getDOMNode});}componentWillUnmount(){window.removeEventListener("resize",this._throttleResizeHandler);window.removeEventListener("orientationchange",this._throttleResizeHandler);this._containerResizeObserver?.disconnect();}_handleClickKey(key){if(key==="DISMISS"){this.dismiss();return}const cursor=this.state.keyHandler?.(key);this.setState({cursor});}render(){const{keypadActive,style}=this.props;const{containerWidth,cursor,keypadConfig}=this.state;const containerStyle=[styles.keypadContainer,...Array.isArray(style)?style:[style]];const isExpression=keypadConfig?.keypadType==="EXPRESSION";const convertDotToTimes=keypadConfig?.times;return jsxRuntimeExports.jsx(View,{style:containerStyle,forwardRef:this._containerRef,children:jsxRuntimeExports.jsx(AphroditeCSSTransitionGroup,{transitionEnterTimeout:AnimationDurationInMS,transitionLeaveTimeout:AnimationDurationInMS,transitionStyle:{
|
|
1488
|
+
const AnimationDurationInMS=200;class MobileKeypadInternals extends React__namespace.Component{componentDidMount(){this._resize();window.addEventListener("resize",this._throttleResizeHandler);window.addEventListener("orientationchange",this._throttleResizeHandler);if("ResizeObserver"in window){this._containerResizeObserver=new window.ResizeObserver(this._throttleResizeHandler);if(this._containerRef.current){this._containerResizeObserver.observe(this._containerRef.current);}}this.props.onElementMounted?.({activate:this.activate,dismiss:this.dismiss,configure:this.configure,setCursor:this.setCursor,setKeyHandler:this.setKeyHandler,getDOMNode:this.getDOMNode});}componentWillUnmount(){window.removeEventListener("resize",this._throttleResizeHandler);window.removeEventListener("orientationchange",this._throttleResizeHandler);this._containerResizeObserver?.disconnect();}_handleClickKey(key){if(key==="DISMISS"){this.dismiss();return}const cursor=this.state.keyHandler?.(key);this.setState({cursor});}render(){const{keypadActive,style}=this.props;const{containerWidth,cursor,keypadConfig}=this.state;const containerStyle=[styles.keypadContainer,...Array.isArray(style)?style:[style]];const isExpression=keypadConfig?.keypadType==="EXPRESSION";const convertDotToTimes=keypadConfig?.times;return jsxRuntimeExports.jsx(View,{style:containerStyle,forwardRef:this._containerRef,children:jsxRuntimeExports.jsx(AphroditeCSSTransitionGroup,{transitionEnterTimeout:AnimationDurationInMS,transitionLeaveTimeout:AnimationDurationInMS,transitionStyle:{appear:{transform:"translate3d(0, 100%, 0)",transition:`${AnimationDurationInMS}ms ease-out`},appearActive:{transform:"translate3d(0, 100%, 0)"},enter:{transform:"translate3d(0, 50%, 0)",transition:`${AnimationDurationInMS}ms ease-out`},enterActive:{transform:"translate3d(0, 0, 0)"},leave:{transform:"translate3d(0, 0, 0)",transition:`${AnimationDurationInMS}ms ease-out`},leaveActive:{transform:"translate3d(0, 100%, 0)"}},children:keypadActive?jsxRuntimeExports.jsx(Keypad,{onAnalyticsEvent:this.props.onAnalyticsEvent,extraKeys:keypadConfig?.extraKeys,onClickKey:key=>this._handleClickKey(key),cursorContext:cursor?.context,fractionsOnly:!isExpression,convertDotToTimes:convertDotToTimes,divisionKey:isExpression,trigonometry:isExpression,preAlgebra:isExpression,logarithms:isExpression,basicRelations:isExpression,advancedRelations:isExpression,expandedView:containerWidth>expandedViewThreshold,showDismiss:true,scientific:isExpression&&keypadConfig?.scientific}):null})})}constructor(...args){super(...args),this._containerRef=React__namespace.createRef(),this._containerResizeObserver=null,this._throttleResize=false,this.state={containerWidth:0},this._resize=()=>{const containerWidth=this._containerRef.current?.clientWidth||0;this.setState({containerWidth});},this._throttleResizeHandler=()=>{if(this._throttleResize){return}this._throttleResize=true;setTimeout(()=>{this._resize();this._throttleResize=false;},100);},this.activate=()=>{this.props.setKeypadActive(true);},this.dismiss=()=>{this.props.setKeypadActive(false);this.props.onDismiss?.();},this.configure=(configuration,cb)=>{this.setState({keypadConfig:configuration});setTimeout(()=>cb&&cb());},this.setCursor=cursor=>{this.setState({cursor});},this.setKeyHandler=keyHandler=>{this.setState({keyHandler});},this.getDOMNode=()=>{return ReactDOM__default.default.findDOMNode(this)};}}const styles=aphrodite.StyleSheet.create({keypadContainer:{bottom:0,left:0,right:0,position:"fixed"}});
|
|
1489
1489
|
|
|
1490
1490
|
function MobileKeypad(props){return jsxRuntimeExports.jsx(keypadContext.KeypadContext.Consumer,{children:({keypadActive,setKeypadActive})=>jsxRuntimeExports.jsx(MobileKeypadInternals,{...props,keypadActive:keypadActive,setKeypadActive:setKeypadActive})})}
|
|
1491
1491
|
|