@pie-lib/math-toolbar 3.0.3-next.38 → 3.0.3-next.83

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.d.ts DELETED
@@ -1,90 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/math-toolbar/src/index.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- import MathPreview from './math-preview.js';
12
- export { MathPreview };
13
- export declare class MathToolbar extends React.Component {
14
- static propTypes: {
15
- autoFocus: PropTypes.Requireable<boolean>;
16
- allowAnswerBlock: PropTypes.Requireable<boolean>;
17
- controlledKeypad: PropTypes.Requireable<boolean>;
18
- controlledKeypadMode: PropTypes.Requireable<boolean>;
19
- keypadMode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
20
- classNames: PropTypes.Requireable<object>;
21
- error: PropTypes.Requireable<string>;
22
- maxResponseAreas: PropTypes.Requireable<number>;
23
- showKeypad: PropTypes.Requireable<boolean>;
24
- noDecimal: PropTypes.Requireable<boolean>;
25
- additionalKeys: PropTypes.Requireable<any[]>;
26
- latex: PropTypes.Validator<string>;
27
- onAnswerBlockAdd: PropTypes.Requireable<(...args: any[]) => any>;
28
- onChange: PropTypes.Requireable<(...args: any[]) => any>;
29
- onDone: PropTypes.Validator<(...args: any[]) => any>;
30
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
31
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
32
- hideDoneButton: PropTypes.Requireable<boolean>;
33
- keyPadCharacterRef: PropTypes.Requireable<(...args: any[]) => any>;
34
- setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
35
- };
36
- static defaultProps: {
37
- classNames: {};
38
- keypadMode: string;
39
- autoFocus: boolean;
40
- allowAnswerBlock: boolean;
41
- controlledKeypad: boolean;
42
- controlledKeypadMode: boolean;
43
- noDecimal: boolean;
44
- showKeypad: boolean;
45
- additionalKeys: never[];
46
- onChange: () => void;
47
- onAnswerBlockAdd: () => void;
48
- onFocus: () => void;
49
- hideDoneButton: boolean;
50
- };
51
- constructor(props: any);
52
- done: any;
53
- UNSAFE_componentWillReceiveProps(nextProps: any): void;
54
- onChange: any;
55
- render(): React.JSX.Element;
56
- }
57
- export declare class RawPureToolbar extends React.Component {
58
- static propTypes: {
59
- classNames: PropTypes.Requireable<object>;
60
- latex: PropTypes.Validator<string>;
61
- keypadMode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
62
- hideInput: PropTypes.Requireable<boolean>;
63
- noLatexHandling: PropTypes.Requireable<boolean>;
64
- layoutForKeyPad: PropTypes.Requireable<object>;
65
- onChange: PropTypes.Validator<(...args: any[]) => any>;
66
- onDone: PropTypes.Validator<(...args: any[]) => any>;
67
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
68
- onAnswerBlockAdd: PropTypes.Requireable<(...args: any[]) => any>;
69
- additionalKeys: PropTypes.Requireable<any[]>;
70
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
71
- autoFocus: PropTypes.Requireable<boolean>;
72
- noDecimal: PropTypes.Requireable<boolean>;
73
- allowAnswerBlock: PropTypes.Requireable<boolean>;
74
- controlledKeypad: PropTypes.Requireable<boolean>;
75
- controlledKeypadMode: PropTypes.Requireable<boolean>;
76
- showKeypad: PropTypes.Requireable<boolean>;
77
- hideDoneButton: PropTypes.Requireable<boolean>;
78
- hideDoneButtonBackground: PropTypes.Requireable<boolean>;
79
- error: PropTypes.Requireable<any>;
80
- maxResponseAreas: PropTypes.Requireable<number>;
81
- keyPadCharacterRef: PropTypes.Requireable<object>;
82
- setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
83
- };
84
- static defaultProps: {
85
- classNames: {};
86
- hideDoneButtonBackground: boolean;
87
- };
88
- render(): React.JSX.Element;
89
- }
90
- export declare const PureToolbar: typeof RawPureToolbar;
package/dist/index.js DELETED
@@ -1,158 +0,0 @@
1
- import e from "./editor-and-pad.js";
2
- import { DoneButton as t } from "./done-button.js";
3
- import n from "./math-preview.js";
4
- import r from "react";
5
- import i from "prop-types";
6
- import { styled as a } from "@mui/material/styles";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- //#region src/index.tsx
9
- var c = a("div")({
10
- display: "flex",
11
- width: "100%",
12
- zIndex: 8,
13
- alignItems: "center"
14
- }), l = class extends r.Component {
15
- static propTypes = {
16
- autoFocus: i.bool,
17
- allowAnswerBlock: i.bool,
18
- controlledKeypad: i.bool,
19
- controlledKeypadMode: i.bool,
20
- keypadMode: i.oneOfType([i.string, i.number]),
21
- classNames: i.object,
22
- error: i.string,
23
- maxResponseAreas: i.number,
24
- showKeypad: i.bool,
25
- noDecimal: i.bool,
26
- additionalKeys: i.array,
27
- latex: i.string.isRequired,
28
- onAnswerBlockAdd: i.func,
29
- onChange: i.func,
30
- onDone: i.func.isRequired,
31
- onFocus: i.func,
32
- onBlur: i.func,
33
- hideDoneButton: i.bool,
34
- keyPadCharacterRef: i.func,
35
- setKeypadInteraction: i.func
36
- };
37
- static defaultProps = {
38
- classNames: {},
39
- keypadMode: "item-authoring",
40
- autoFocus: !1,
41
- allowAnswerBlock: !1,
42
- controlledKeypad: !1,
43
- controlledKeypadMode: !1,
44
- noDecimal: !1,
45
- showKeypad: !0,
46
- additionalKeys: [],
47
- onChange: () => {},
48
- onAnswerBlockAdd: () => {},
49
- onFocus: () => {},
50
- hideDoneButton: !1
51
- };
52
- constructor(e) {
53
- super(e), this.state = { latex: e.latex };
54
- }
55
- done = () => {
56
- this.props.onDone(this.state.latex);
57
- };
58
- UNSAFE_componentWillReceiveProps(e) {
59
- this.setState({ latex: e.latex });
60
- }
61
- onChange = (e) => {
62
- this.setState({ latex: e }), this.props.onChange(e);
63
- };
64
- render() {
65
- let { latex: e } = this.state, { classNames: t, autoFocus: n, allowAnswerBlock: r, onAnswerBlockAdd: i, controlledKeypad: a, controlledKeypadMode: s, keypadMode: c, noDecimal: l, additionalKeys: u, showKeypad: f, onFocus: p, onBlur: m, hideDoneButton: h, error: g, keyPadCharacterRef: _, setKeypadInteraction: v, maxResponseAreas: y } = this.props;
66
- return /* @__PURE__ */ o(d, {
67
- autoFocus: n,
68
- classNames: t,
69
- onAnswerBlockAdd: i,
70
- allowAnswerBlock: r,
71
- latex: e,
72
- additionalKeys: u,
73
- noDecimal: l,
74
- keypadMode: c,
75
- keyPadCharacterRef: _,
76
- setKeypadInteraction: v,
77
- onChange: this.onChange,
78
- onDone: this.done,
79
- onFocus: p,
80
- onBlur: m,
81
- showKeypad: f,
82
- controlledKeypad: a,
83
- controlledKeypadMode: s,
84
- hideDoneButton: h,
85
- error: g,
86
- maxResponseAreas: y
87
- });
88
- }
89
- }, u = class extends r.Component {
90
- static propTypes = {
91
- classNames: i.object,
92
- latex: i.string.isRequired,
93
- keypadMode: i.oneOfType([i.string, i.number]),
94
- hideInput: i.bool,
95
- noLatexHandling: i.bool,
96
- layoutForKeyPad: i.object,
97
- onChange: i.func.isRequired,
98
- onDone: i.func.isRequired,
99
- onBlur: i.func,
100
- onAnswerBlockAdd: i.func,
101
- additionalKeys: i.array,
102
- onFocus: i.func,
103
- autoFocus: i.bool,
104
- noDecimal: i.bool,
105
- allowAnswerBlock: i.bool,
106
- controlledKeypad: i.bool,
107
- controlledKeypadMode: i.bool,
108
- showKeypad: i.bool,
109
- hideDoneButton: i.bool,
110
- hideDoneButtonBackground: i.bool,
111
- error: i.any,
112
- maxResponseAreas: i.number,
113
- keyPadCharacterRef: i.object,
114
- setKeypadInteraction: i.func
115
- };
116
- static defaultProps = {
117
- classNames: {},
118
- hideDoneButtonBackground: !1
119
- };
120
- render() {
121
- let { classNames: n, autoFocus: r, allowAnswerBlock: i, onAnswerBlockAdd: a, controlledKeypad: l, controlledKeypadMode: u, additionalKeys: d, showKeypad: f, keypadMode: p, noDecimal: m, hideInput: h, noLatexHandling: g, layoutForKeyPad: _, keyPadCharacterRef: v, setKeypadInteraction: y, latex: b, onChange: x, onDone: S, onFocus: C, onBlur: w, hideDoneButton: T, hideDoneButtonBackground: E, error: D, maxResponseAreas: O } = this.props;
122
- return /* @__PURE__ */ s(c, {
123
- className: n && n.toolbar || "",
124
- ref: v,
125
- children: [
126
- /* @__PURE__ */ o("div", {}),
127
- /* @__PURE__ */ o(e, {
128
- autoFocus: r,
129
- keypadMode: p,
130
- classNames: n || {},
131
- controlledKeypad: l,
132
- controlledKeypadMode: u,
133
- noDecimal: m,
134
- hideInput: h,
135
- noLatexHandling: g,
136
- layoutForKeyPad: _,
137
- showKeypad: f,
138
- additionalKeys: d,
139
- allowAnswerBlock: i,
140
- onAnswerBlockAdd: a,
141
- latex: b,
142
- onChange: x,
143
- onFocus: C,
144
- onBlur: w,
145
- error: D,
146
- maxResponseAreas: O,
147
- setKeypadInteraction: y
148
- }),
149
- (!l || l && f) && !T && /* @__PURE__ */ o(t, {
150
- hideBackground: E,
151
- onClick: S
152
- })
153
- ]
154
- });
155
- }
156
- }, d = u;
157
- //#endregion
158
- export { n as MathPreview, l as MathToolbar, d as PureToolbar, u as RawPureToolbar };
@@ -1,22 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/math-toolbar/src/math-preview.jsx
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- import React from 'react';
10
- import PropTypes from 'prop-types';
11
- export declare class RawMathPreview extends React.Component {
12
- static propTypes: {
13
- latex: PropTypes.Requireable<string>;
14
- isSelected: PropTypes.Requireable<boolean>;
15
- onFocus: PropTypes.Requireable<(...args: any[]) => any>;
16
- onBlur: PropTypes.Requireable<(...args: any[]) => any>;
17
- };
18
- componentDidMount(): void;
19
- componentDidUpdate(prevProps: any): void;
20
- render(): React.JSX.Element;
21
- }
22
- export default RawMathPreview;
@@ -1,125 +0,0 @@
1
- import { markFractionBaseSuperscripts as e } from "./utils.js";
2
- import t from "react";
3
- import n from "prop-types";
4
- import r from "debug";
5
- import { styled as i } from "@mui/material/styles";
6
- import { mq as a } from "@pie-lib/math-input";
7
- import { jsx as o, jsxs as s } from "react/jsx-runtime";
8
- //#region src/math-preview.tsx
9
- var { commonMqFontStyles: c, longdivStyles: l, supsubStyles: u } = a.CommonMqStyles, d = r("@pie-lib:math-toolbar:math-preview"), f = i("div")(({ theme: e, isSelected: t }) => ({
10
- display: "inline-flex",
11
- alignItems: "center",
12
- position: "relative",
13
- "& *": c,
14
- ...u,
15
- ...l,
16
- "& > .mq-math-mode": { border: t ? "solid 0px lightgrey" : "solid 1px lightgrey" },
17
- "& > .mq-focused": {
18
- outline: "none",
19
- boxShadow: "none",
20
- border: "solid 1px black",
21
- borderRadius: "0px"
22
- },
23
- "& > .mq-math-mode .mq-root-block": { paddingTop: "7px !important" },
24
- "& > .mq-math-mode .mq-overarc ": { paddingTop: "0.45em !important" },
25
- "& > .mq-math-mode .mq-sqrt-prefix": {
26
- verticalAlign: "baseline !important",
27
- top: "1px !important",
28
- left: "-0.1em !important"
29
- },
30
- "& > .mq-math-mode .mq-denominator": {
31
- marginTop: "-5px !important",
32
- padding: "0.5em 0.1em 0.1em !important"
33
- },
34
- "& > .mq-math-mode .mq-numerator, .mq-math-mode .mq-over": {
35
- padding: "0 0.1em !important",
36
- paddingBottom: "0 !important",
37
- marginBottom: "-2px"
38
- },
39
- "& > .mq-math-mode .mq-longdiv .mq-longdiv-inner .mq-empty": {
40
- paddingTop: "6px !important",
41
- paddingLeft: "4px !important"
42
- },
43
- "& > .mq-math-mode .mq-longdiv .mq-longdiv-inner": { marginLeft: "0 !important" },
44
- "& > .mq-math-mode .mq-overarrow": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" },
45
- "& > .mq-math-mode .mq-paren": {
46
- verticalAlign: "top !important",
47
- padding: "1px 0.1em !important"
48
- },
49
- "& > .mq-math-mode .mq-sqrt-stem": {
50
- borderTop: "0.07em solid",
51
- marginLeft: "-1.5px",
52
- marginTop: "-2px !important",
53
- paddingTop: "5px !important"
54
- },
55
- "& .mq-overarrow-inner": {
56
- paddingTop: "0 !important",
57
- border: "none !important"
58
- },
59
- "& .mq-editable-field .mq-cursor": { marginTop: "-15px !important" },
60
- "& .mq-overarrow.mq-arrow-both": {
61
- top: "7.5px",
62
- marginTop: "0px",
63
- minWidth: "1.23em",
64
- "& *": { lineHeight: "1 !important" },
65
- "&:before": {
66
- top: "-0.4em",
67
- left: "-1px"
68
- },
69
- "&:after": {
70
- top: "0px !important",
71
- position: "absolute !important",
72
- right: "-2px"
73
- },
74
- "&.mq-empty:after": { top: "-0.45em" }
75
- },
76
- "& .mq-overarrow.mq-arrow-right": { "&:before": {
77
- top: "-0.4em",
78
- right: "-1px"
79
- } },
80
- "& .mq-overarrow-inner-right": { display: "none !important" },
81
- "& .mq-overarrow-inner-left": { display: "none !important" },
82
- "& .mq-longdiv-inner": {
83
- borderTop: "1px solid !important",
84
- paddingTop: "1.5px !important"
85
- },
86
- "& .mq-parallelogram": { lineHeight: .85 },
87
- "& span[data-prime=\"true\"]": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" },
88
- ...t && { border: `solid 1px ${e.palette.primary.main}` }
89
- })), p = i("span")({
90
- position: "absolute",
91
- bottom: 0,
92
- left: 0,
93
- right: 0,
94
- top: 0
95
- }), m = class extends t.Component {
96
- static propTypes = {
97
- latex: n.string,
98
- isSelected: n.bool,
99
- onFocus: n.func,
100
- onBlur: n.func
101
- };
102
- componentDidMount() {
103
- e();
104
- }
105
- componentDidUpdate(t) {
106
- this.props.latex !== t.latex && e();
107
- }
108
- render() {
109
- let { isSelected: e, onFocus: t, onBlur: n, latex: r } = this.props;
110
- return d("[render] latex: ", r), /* @__PURE__ */ s(f, {
111
- isSelected: e,
112
- children: [
113
- " ",
114
- /* @__PURE__ */ o(p, {}),
115
- /* @__PURE__ */ o(a.Static, {
116
- latex: r,
117
- onFocus: t,
118
- onBlur: n
119
- })
120
- ]
121
- });
122
- }
123
- };
124
- //#endregion
125
- export { m as default };
package/dist/utils.d.ts DELETED
@@ -1,9 +0,0 @@
1
- /**
2
- * @synced-from pie-lib/packages/math-toolbar/src/utils.js
3
- * @auto-generated
4
- *
5
- * This file is automatically synced from pie-elements and converted to TypeScript.
6
- * Manual edits will be overwritten on next sync.
7
- * To make changes, edit the upstream JavaScript file and run sync again.
8
- */
9
- export declare const markFractionBaseSuperscripts: () => void;
package/dist/utils.js DELETED
@@ -1,9 +0,0 @@
1
- //#region src/utils.ts
2
- var e = () => {
3
- document.querySelectorAll(".mq-supsub.mq-sup-only").forEach((e) => {
4
- let t = e.previousElementSibling;
5
- t && t.classList.contains("mq-non-leaf") && t.querySelector(".mq-fraction") ? e.classList.add("mq-after-fraction-group") : e.classList.remove("mq-after-fraction-group");
6
- });
7
- };
8
- //#endregion
9
- export { e as markFractionBaseSuperscripts };