@pie-lib/math-input 8.1.1-next.3 → 8.1.1-next.5
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/horizontal-keypad.d.ts +0 -1
- package/dist/horizontal-keypad.js +5 -7
- package/dist/index.d.ts +6 -7
- package/dist/index.js +5 -14
- package/dist/keypad/index.d.ts +37 -2
- package/dist/keypad/index.js +277 -0
- package/dist/keys/geometry.js +1 -1
- package/dist/keys/grades.js +1 -1
- package/dist/keys/index.d.ts +4 -4
- package/dist/keys/index.js +1 -1
- package/dist/keys/matrices.js +1 -1
- package/dist/keys/misc.js +1 -1
- package/dist/keys/sub-sup.js +1 -1
- package/dist/keys/utils.js +1 -1
- package/dist/mq/common-mq-styles.d.ts +6 -0
- package/dist/mq/common-mq-styles.js +2 -1
- package/dist/mq/index.d.ts +3 -3
- package/dist/mq/index.js +7 -7
- package/dist/mq/input.d.ts +4 -0
- package/dist/mq/input.js +27 -27
- package/dist/mq/mathquill-instance.d.ts +28 -0
- package/dist/mq/mathquill-instance.js +13 -0
- package/dist/mq/static.d.ts +4 -0
- package/dist/mq/static.js +29 -20
- package/dist/updateSpans.d.ts +1 -1
- package/dist/updateSpans.js +2 -3
- package/package.json +14 -8
- package/dist/keypad/accessible-keypad.d.ts +0 -37
- package/dist/keypad/accessible-keypad.js +0 -614
- package/dist/keypad/model.d.ts +0 -28
- package/dist/keypad/model.js +0 -4
|
@@ -19,7 +19,6 @@ export default class HorizontalKeypad extends React.Component {
|
|
|
19
19
|
noDecimal: PropTypes.Requireable<boolean>;
|
|
20
20
|
additionalKeys: PropTypes.Requireable<any[]>;
|
|
21
21
|
setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
-
onRequestClose: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
22
|
};
|
|
24
23
|
static defaultProps: {
|
|
25
24
|
mode: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { extendKeySet as e } from "./keys/utils.js";
|
|
2
2
|
import { keysForGrade as t, normalizeAdditionalKeys as n } from "./keys/grades.js";
|
|
3
|
-
import r from "./keypad/
|
|
3
|
+
import { KeyPad as r } from "./keypad/index.js";
|
|
4
4
|
import i from "react";
|
|
5
5
|
import a from "prop-types";
|
|
6
6
|
import { jsx as o } from "react/jsx-runtime";
|
|
@@ -25,8 +25,7 @@ var s = (e) => {
|
|
|
25
25
|
onFocus: a.func,
|
|
26
26
|
noDecimal: a.bool,
|
|
27
27
|
additionalKeys: a.array,
|
|
28
|
-
setKeypadInteraction: a.func
|
|
29
|
-
onRequestClose: a.func
|
|
28
|
+
setKeypadInteraction: a.func
|
|
30
29
|
};
|
|
31
30
|
static defaultProps = {
|
|
32
31
|
mode: "scientific",
|
|
@@ -38,18 +37,17 @@ var s = (e) => {
|
|
|
38
37
|
t(s(e));
|
|
39
38
|
};
|
|
40
39
|
render() {
|
|
41
|
-
let { mode: i, onFocus: a, controlledKeypadMode: s, noDecimal: c, className: l, additionalKeys: u, layoutForKeyPad: d, setKeypadInteraction: f
|
|
40
|
+
let { mode: i, onFocus: a, controlledKeypadMode: s, noDecimal: c, className: l, additionalKeys: u, layoutForKeyPad: d, setKeypadInteraction: f } = this.props, p = n(u);
|
|
42
41
|
return /* @__PURE__ */ o(r, {
|
|
43
42
|
className: l,
|
|
44
43
|
controlledKeypadMode: s,
|
|
45
44
|
onFocus: a,
|
|
46
45
|
noDecimal: c,
|
|
47
46
|
layoutForKeyPad: d,
|
|
48
|
-
additionalKeys: e(t(i),
|
|
47
|
+
additionalKeys: e(t(i), p),
|
|
49
48
|
onPress: this.keypadPress,
|
|
50
49
|
mode: i,
|
|
51
|
-
setKeypadInteraction: f
|
|
52
|
-
onRequestClose: p
|
|
50
|
+
setKeypadInteraction: f
|
|
53
51
|
});
|
|
54
52
|
}
|
|
55
53
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -6,13 +6,12 @@
|
|
|
6
6
|
* Manual edits will be overwritten on next sync.
|
|
7
7
|
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
8
|
*/
|
|
9
|
-
import { keysForGrade } from './keys/grades';
|
|
10
|
-
import { updateSpans } from './updateSpans';
|
|
11
|
-
import * as keys from './keys';
|
|
12
|
-
import HorizontalKeypad from './horizontal-keypad';
|
|
13
|
-
import * as mq from './mq';
|
|
9
|
+
import { keysForGrade } from './keys/grades.js';
|
|
10
|
+
import { updateSpans } from './updateSpans.js';
|
|
11
|
+
import * as keys from './keys/index.js';
|
|
12
|
+
import HorizontalKeypad from './horizontal-keypad.js';
|
|
13
|
+
import * as mq from './mq/index.js';
|
|
14
|
+
import { registerEmbed, applyStaticMath } from './mq/mathquill-instance.js';
|
|
14
15
|
declare const addBrackets: (s: any) => any;
|
|
15
16
|
declare const removeBrackets: (s: any) => any;
|
|
16
|
-
declare const registerEmbed: (name: any, factory: any) => void;
|
|
17
|
-
declare const applyStaticMath: (element: any, latex?: string) => any;
|
|
18
17
|
export { keysForGrade, addBrackets, removeBrackets, keys, HorizontalKeypad, mq, updateSpans, registerEmbed, applyStaticMath, };
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,10 @@
|
|
|
1
1
|
import { keysForGrade as e } from "./keys/grades.js";
|
|
2
2
|
import { updateSpans as t } from "./updateSpans.js";
|
|
3
3
|
import { keys_exports as n } from "./keys/index.js";
|
|
4
|
-
import r from "./
|
|
5
|
-
import { mq_exports as
|
|
6
|
-
import
|
|
4
|
+
import { applyStaticMath as r, registerEmbed as i } from "./mq/mathquill-instance.js";
|
|
5
|
+
import { mq_exports as a } from "./mq/index.js";
|
|
6
|
+
import o from "./horizontal-keypad.js";
|
|
7
7
|
//#region src/index.tsx
|
|
8
|
-
var
|
|
9
|
-
let n = f();
|
|
10
|
-
n?.registerEmbed && n.registerEmbed(e, t);
|
|
11
|
-
}, m = (e, n = "") => {
|
|
12
|
-
let r = f();
|
|
13
|
-
if (!r?.StaticMath || !e) return null;
|
|
14
|
-
e.textContent = "";
|
|
15
|
-
let i = r.StaticMath(e);
|
|
16
|
-
return typeof i?.latex == "function" && i.latex(n), t(e), i;
|
|
17
|
-
};
|
|
8
|
+
var s = (e) => e.indexOf("\\(") === 0 ? e : `\\(${e}`, c = (e) => e.indexOf("\\)") === e.length - 2 ? e : `${e}\\)`, l = (e) => e.indexOf("\\(") === 0 ? e.substring(2) : e, u = (e) => e.indexOf("\\)") === e.length - 2 ? e.substring(0, e.length - 2) : e, d = (e) => c(s(e)), f = (e) => u(l(e));
|
|
18
9
|
//#endregion
|
|
19
|
-
export {
|
|
10
|
+
export { o as HorizontalKeypad, d as addBrackets, r as applyStaticMath, n as keys, e as keysForGrade, a as mq, i as registerEmbed, f as removeBrackets, t as updateSpans };
|
package/dist/keypad/index.d.ts
CHANGED
|
@@ -1,2 +1,37 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/keypad/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
|
+
export declare class KeyPad extends React.Component {
|
|
12
|
+
static propTypes: {
|
|
13
|
+
className: PropTypes.Requireable<string>;
|
|
14
|
+
controlledKeypadMode: PropTypes.Requireable<boolean>;
|
|
15
|
+
baseSet: PropTypes.Requireable<any[]>;
|
|
16
|
+
additionalKeys: PropTypes.Requireable<any[]>;
|
|
17
|
+
layoutForKeyPad: PropTypes.Requireable<object>;
|
|
18
|
+
onPress: PropTypes.Validator<(...args: any[]) => any>;
|
|
19
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
noDecimal: PropTypes.Requireable<boolean>;
|
|
21
|
+
setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
mode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
|
|
23
|
+
};
|
|
24
|
+
static defaultProps: {
|
|
25
|
+
baseSet: any[][];
|
|
26
|
+
noDecimal: boolean;
|
|
27
|
+
};
|
|
28
|
+
constructor(props: any);
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
componentWillUnmount(): void;
|
|
31
|
+
handleKeypadInteraction: any;
|
|
32
|
+
buttonClick: any;
|
|
33
|
+
flowKeys: any;
|
|
34
|
+
keyIsNotAllowed: any;
|
|
35
|
+
render(): React.JSX.Element;
|
|
36
|
+
}
|
|
37
|
+
export default KeyPad;
|
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import { baseSet as e } from "../keys/index.js";
|
|
2
|
+
import t from "../mq/static.js";
|
|
3
|
+
import { commonMqKeyboardStyles as n } from "../mq/common-mq-styles.js";
|
|
4
|
+
import { sortKeys as r } from "./keys-layout.js";
|
|
5
|
+
import { flatten as i } from "@pie-element/shared-lodash";
|
|
6
|
+
import a from "react";
|
|
7
|
+
import o from "prop-types";
|
|
8
|
+
import s from "@mui/material/Button";
|
|
9
|
+
import c from "@mui/material/IconButton";
|
|
10
|
+
import { styled as l } from "@mui/material/styles";
|
|
11
|
+
import u from "debug";
|
|
12
|
+
import { color as d } from "@pie-lib/render-ui";
|
|
13
|
+
import { jsx as f } from "react/jsx-runtime";
|
|
14
|
+
//#region src/keypad/index.tsx
|
|
15
|
+
var p = u("pie-lib:math-inline:keypad"), m = l(t)(({ latex: e }) => {
|
|
16
|
+
let t = {
|
|
17
|
+
pointerEvents: "none",
|
|
18
|
+
textTransform: "none !important",
|
|
19
|
+
color: d.text(),
|
|
20
|
+
"& .mq-scaled.mq-sqrt-prefix": { transform: "scale(1, 0.9) !important" },
|
|
21
|
+
"& .mq-sup-only .mq-sup": { marginBottom: "0.9px !important" },
|
|
22
|
+
"& .mq-empty": { backgroundColor: `${d.keypadEmptyPlaceholder()} !important` },
|
|
23
|
+
"& .mq-overline .mq-overline-inner": { borderTop: "2px solid black" },
|
|
24
|
+
"& .mq-non-leaf.mq-overline": { borderTop: "none !important" },
|
|
25
|
+
"& .mq-overarrow": {
|
|
26
|
+
width: "30px",
|
|
27
|
+
marginTop: "0 !important",
|
|
28
|
+
borderTop: "2px solid black",
|
|
29
|
+
fontFamily: "Roboto, Helvetica, Arial, sans-serif !important",
|
|
30
|
+
"&.mq-arrow-both": {
|
|
31
|
+
top: "0px !important",
|
|
32
|
+
"& *": {
|
|
33
|
+
lineHeight: "1 !important",
|
|
34
|
+
borderTop: "none !important"
|
|
35
|
+
},
|
|
36
|
+
"&:before": {
|
|
37
|
+
fontSize: "80%",
|
|
38
|
+
left: "calc(-13%) !important",
|
|
39
|
+
top: "-0.31em !important"
|
|
40
|
+
},
|
|
41
|
+
"&:after": {
|
|
42
|
+
fontSize: "80% !important",
|
|
43
|
+
right: "calc(-13%) !important",
|
|
44
|
+
top: "-1.5em"
|
|
45
|
+
},
|
|
46
|
+
"&.mq-empty:before": {
|
|
47
|
+
fontSize: "80%",
|
|
48
|
+
left: "calc(-13%)",
|
|
49
|
+
top: "-0.26em"
|
|
50
|
+
},
|
|
51
|
+
"&.mq-empty:after": {
|
|
52
|
+
fontSize: "80%",
|
|
53
|
+
right: "calc(-13%)",
|
|
54
|
+
top: "-0.26em"
|
|
55
|
+
},
|
|
56
|
+
"&.mq-empty": { minHeight: "1.4em" }
|
|
57
|
+
},
|
|
58
|
+
"&.mq-arrow-right:before": {
|
|
59
|
+
fontSize: "80%",
|
|
60
|
+
right: "calc(-13%) !important",
|
|
61
|
+
top: "-0.26em !important"
|
|
62
|
+
},
|
|
63
|
+
"& .mq-overarrow-inner": { border: "none !important" },
|
|
64
|
+
"& .mq-overarrow-inner .mq-overarrow-inner-right": { display: "none !important" }
|
|
65
|
+
},
|
|
66
|
+
"& .mq-root-block": { padding: "5px !important" },
|
|
67
|
+
"& .mq-overarrow.mq-arrow-both.mq-empty:after": {
|
|
68
|
+
right: "-6px",
|
|
69
|
+
fontSize: "80% !important",
|
|
70
|
+
top: "-3px"
|
|
71
|
+
},
|
|
72
|
+
"& .mq-overarrow.mq-arrow-right.mq-empty:before": {
|
|
73
|
+
right: "-5px",
|
|
74
|
+
fontSize: "80% !important",
|
|
75
|
+
top: "-3px"
|
|
76
|
+
},
|
|
77
|
+
"& .mq-overarrow.mq-arrow-both.mq-empty:before": {
|
|
78
|
+
left: "-6px",
|
|
79
|
+
fontSize: "80% !important",
|
|
80
|
+
top: "-3px"
|
|
81
|
+
},
|
|
82
|
+
"& .mq-longdiv-inner": {
|
|
83
|
+
borderTop: "1px solid !important",
|
|
84
|
+
paddingTop: "1.5px !important"
|
|
85
|
+
},
|
|
86
|
+
"& .mq-parallelogram": { lineHeight: .85 },
|
|
87
|
+
"& .mq-overarc": {
|
|
88
|
+
borderTop: "2px solid black !important",
|
|
89
|
+
"& .mq-overline": { borderTop: "none !important" },
|
|
90
|
+
"& .mq-overline-inner": {
|
|
91
|
+
borderTop: "none !important",
|
|
92
|
+
paddingTop: "0 !important"
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return e === "\\parallel" ? {
|
|
97
|
+
...t,
|
|
98
|
+
fontStyle: "italic !important"
|
|
99
|
+
} : e === "\\overleftrightarrow{\\overline{}}" ? {
|
|
100
|
+
...t,
|
|
101
|
+
"& .mq-overarrow.mq-arrow-both": {
|
|
102
|
+
"& .mq-overline-inner": {
|
|
103
|
+
borderTop: "none !important",
|
|
104
|
+
paddingTop: "0 !important"
|
|
105
|
+
},
|
|
106
|
+
"&:after": {
|
|
107
|
+
position: "absolute !important",
|
|
108
|
+
top: "0px !important"
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
} : t;
|
|
112
|
+
});
|
|
113
|
+
m.propTypes = { latex: o.string.isRequired };
|
|
114
|
+
var h = (e) => e ? {
|
|
115
|
+
gridTemplateColumns: `repeat(${e.columns}, minmax(min-content, 150px))`,
|
|
116
|
+
gridTemplateRows: `repeat(${e.rows}, minmax(40px, 60px))`,
|
|
117
|
+
gridAutoFlow: "initial"
|
|
118
|
+
} : {}, g = l("div")(() => ({
|
|
119
|
+
...n,
|
|
120
|
+
width: "100%",
|
|
121
|
+
display: "grid",
|
|
122
|
+
gridTemplateRows: "repeat(5, minmax(40px, 60px))",
|
|
123
|
+
gridRowGap: "0px",
|
|
124
|
+
gridColumnGap: "0px",
|
|
125
|
+
gridAutoFlow: "column",
|
|
126
|
+
"&.character": {
|
|
127
|
+
textTransform: "initial !important",
|
|
128
|
+
gridTemplateRows: "repeat(5, minmax(40px, 50px)) !important"
|
|
129
|
+
},
|
|
130
|
+
"&.language": {
|
|
131
|
+
gridTemplateRows: "repeat(4, minmax(40px, 50px)) !important",
|
|
132
|
+
"& *": { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" }
|
|
133
|
+
}
|
|
134
|
+
})), _ = l(s)(({ category: e, isDelete: t, isComma: n, isDot: r }) => ({
|
|
135
|
+
minWidth: "auto",
|
|
136
|
+
textTransform: "none",
|
|
137
|
+
fontSize: n || r ? "200% !important" : "140% !important",
|
|
138
|
+
lineHeight: n || r ? "100%" : "normal",
|
|
139
|
+
color: d.text(),
|
|
140
|
+
backgroundColor: e === "operators" ? d.keypadButtonOperator() : d.keypadButton(),
|
|
141
|
+
"&:hover": { backgroundColor: e === "operators" ? d.keypadButtonOperatorHover() : d.keypadButtonHover() },
|
|
142
|
+
borderRadius: 0,
|
|
143
|
+
...t && { fontFamily: "Roboto, Helvetica, Arial, sans-serif !important" }
|
|
144
|
+
})), v = l(s)(({ category: e }) => ({
|
|
145
|
+
textTransform: "none",
|
|
146
|
+
padding: 0,
|
|
147
|
+
margin: 0,
|
|
148
|
+
fontSize: "110% !important",
|
|
149
|
+
minWidth: "auto",
|
|
150
|
+
borderRadius: 0,
|
|
151
|
+
backgroundColor: e === "operators" ? d.keypadButtonOperator() : d.keypadButton(),
|
|
152
|
+
"&:hover": { backgroundColor: e === "operators" ? d.keypadButtonOperatorHover() : d.keypadButtonHover() }
|
|
153
|
+
})), y = l(c)(({ category: e }) => ({
|
|
154
|
+
minWidth: "auto",
|
|
155
|
+
backgroundColor: e === "operators" ? d.keypadButtonOperator() : d.keypadButton(),
|
|
156
|
+
"&:hover": { backgroundColor: e === "operators" ? d.keypadButtonOperatorHover() : d.keypadButtonHover() },
|
|
157
|
+
borderRadius: 0,
|
|
158
|
+
"& .icon": { height: "30px" }
|
|
159
|
+
})), b = class extends a.Component {
|
|
160
|
+
static propTypes = {
|
|
161
|
+
className: o.string,
|
|
162
|
+
controlledKeypadMode: o.bool,
|
|
163
|
+
baseSet: o.array,
|
|
164
|
+
additionalKeys: o.array,
|
|
165
|
+
layoutForKeyPad: o.object,
|
|
166
|
+
onPress: o.func.isRequired,
|
|
167
|
+
onFocus: o.func,
|
|
168
|
+
noDecimal: o.bool,
|
|
169
|
+
setKeypadInteraction: o.func,
|
|
170
|
+
mode: o.oneOfType([o.string, o.number])
|
|
171
|
+
};
|
|
172
|
+
static defaultProps = {
|
|
173
|
+
baseSet: e,
|
|
174
|
+
noDecimal: !1
|
|
175
|
+
};
|
|
176
|
+
constructor(e) {
|
|
177
|
+
super(e), this.keypadRef = a.createRef();
|
|
178
|
+
}
|
|
179
|
+
componentDidMount() {
|
|
180
|
+
let e = this.keypadRef?.current, t = e?.closest(".main-container"), n = e?.closest(".pie-toolbar");
|
|
181
|
+
if (this.props.controlledKeypadMode && t && n) {
|
|
182
|
+
let e = t.getBoundingClientRect(), r = n.getBoundingClientRect(), i = e.top + e.height - (r.top + r.height);
|
|
183
|
+
if (i < 0) {
|
|
184
|
+
let n = e.height + e.top - i;
|
|
185
|
+
t && (t.style.height = `${n}px`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
e && (e.addEventListener("touchstart", this.handleKeypadInteraction, !0), e.addEventListener("mousedown", this.handleKeypadInteraction, !0));
|
|
189
|
+
}
|
|
190
|
+
componentWillUnmount() {
|
|
191
|
+
let e = this.keypadRef?.current;
|
|
192
|
+
if (this.props.controlledKeypadMode && e) {
|
|
193
|
+
let t = e.closest(".main-container");
|
|
194
|
+
t && (t.style.height = "unset");
|
|
195
|
+
}
|
|
196
|
+
e && (e.removeEventListener("touchstart", this.handleKeypadInteraction, !0), e.removeEventListener("mousedown", this.handleKeypadInteraction, !0));
|
|
197
|
+
}
|
|
198
|
+
handleKeypadInteraction = () => {
|
|
199
|
+
this.props.setKeypadInteraction && this.props.setKeypadInteraction(!0);
|
|
200
|
+
};
|
|
201
|
+
buttonClick = (e) => {
|
|
202
|
+
p("[buttonClick]", e);
|
|
203
|
+
let { onPress: t } = this.props;
|
|
204
|
+
t(e);
|
|
205
|
+
};
|
|
206
|
+
flowKeys = (e, t) => i([...r(e), ...r(t)]);
|
|
207
|
+
keyIsNotAllowed = (e) => {
|
|
208
|
+
let { noDecimal: t } = this.props;
|
|
209
|
+
return !!((e.write === "." && e.label === "." || e.write === "," && e.label === ",") && t);
|
|
210
|
+
};
|
|
211
|
+
render() {
|
|
212
|
+
let { className: e, baseSet: t, additionalKeys: n, layoutForKeyPad: r, onFocus: i, mode: a } = this.props, o = [
|
|
213
|
+
"non-negative-integers",
|
|
214
|
+
"integers",
|
|
215
|
+
"decimals",
|
|
216
|
+
"fractions",
|
|
217
|
+
"item-authoring",
|
|
218
|
+
"language"
|
|
219
|
+
].includes(a), s = o ? this.flowKeys([], n || []) : this.flowKeys(t, n || []), c = s.length % 5 ? 1 : 0, l = {
|
|
220
|
+
gridTemplateColumns: `repeat(${Math.floor(s.length / 5) + c}, minmax(min-content, 150px))`,
|
|
221
|
+
...h(r)
|
|
222
|
+
};
|
|
223
|
+
return /* @__PURE__ */ f(g, {
|
|
224
|
+
ref: this.keypadRef,
|
|
225
|
+
className: [e, a].filter(Boolean).join(" "),
|
|
226
|
+
style: l,
|
|
227
|
+
onFocus: i,
|
|
228
|
+
children: s.map((e, t) => {
|
|
229
|
+
let n = this.buttonClick.bind(this, e);
|
|
230
|
+
if (!e) return /* @__PURE__ */ f("span", {}, `empty-${t}`);
|
|
231
|
+
let r = {
|
|
232
|
+
onClick: n,
|
|
233
|
+
disabled: this.keyIsNotAllowed(e),
|
|
234
|
+
key: `${e.label || e.latex || e.command}-${t}`,
|
|
235
|
+
...e.actions || {},
|
|
236
|
+
...e.extraProps || {}
|
|
237
|
+
};
|
|
238
|
+
if (e.latex) return /* @__PURE__ */ f(v, {
|
|
239
|
+
onClick: r.onClick,
|
|
240
|
+
disabled: r.disabled,
|
|
241
|
+
category: o ? void 0 : e.category,
|
|
242
|
+
"aria-label": e.ariaLabel ? e.ariaLabel : e.name || e.label,
|
|
243
|
+
...e.actions || {},
|
|
244
|
+
...e.extraProps || {},
|
|
245
|
+
children: /* @__PURE__ */ f(m, { latex: e.latex })
|
|
246
|
+
}, r.key);
|
|
247
|
+
if (e.label) return /* @__PURE__ */ f(_, {
|
|
248
|
+
onClick: r.onClick,
|
|
249
|
+
disabled: r.disabled,
|
|
250
|
+
category: o ? void 0 : e.category,
|
|
251
|
+
isDelete: e.label === "⌫",
|
|
252
|
+
isComma: e.label === ",",
|
|
253
|
+
isDot: e.label === ".",
|
|
254
|
+
"aria-label": e.ariaLabel ? e.ariaLabel : e.name || e.label,
|
|
255
|
+
...e.actions || {},
|
|
256
|
+
...e.extraProps || {},
|
|
257
|
+
children: e.label
|
|
258
|
+
}, r.key);
|
|
259
|
+
{
|
|
260
|
+
let t = e.icon ? e.icon : "div";
|
|
261
|
+
return /* @__PURE__ */ f(y, {
|
|
262
|
+
tabIndex: "-1",
|
|
263
|
+
onClick: r.onClick,
|
|
264
|
+
disabled: r.disabled,
|
|
265
|
+
category: o ? void 0 : e.category,
|
|
266
|
+
size: "large",
|
|
267
|
+
...e.actions || {},
|
|
268
|
+
...e.extraProps || {},
|
|
269
|
+
children: /* @__PURE__ */ f(t, { className: "icon" })
|
|
270
|
+
}, r.key);
|
|
271
|
+
}
|
|
272
|
+
})
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
//#endregion
|
|
277
|
+
export { b as KeyPad, b as default };
|
package/dist/keys/geometry.js
CHANGED
|
@@ -124,4 +124,4 @@ var t = /* @__PURE__ */ e({
|
|
|
124
124
|
command: "\\leftrightarrow"
|
|
125
125
|
});
|
|
126
126
|
//#endregion
|
|
127
|
-
export { u as angle, y as congruentTo, _ as degree, S as doublePrimeArcSecond, t as geometry_exports, C as leftArrow, T as leftrightArrow, f as measureOfAngle, b as notCongruentTo, d as overArc, a as overLeftRightArrow, i as overRightArrow, r as overline, s as parallel, l as perpindicular, x as primeArcminute, w as rightArrow, v as similarTo, m as square, p as triangle };
|
|
127
|
+
export { u as angle, g as circledDot, y as congruentTo, _ as degree, S as doublePrimeArcSecond, t as geometry_exports, C as leftArrow, T as leftrightArrow, f as measureOfAngle, b as notCongruentTo, c as notParallel, d as overArc, a as overLeftRightArrow, i as overRightArrow, r as overline, s as parallel, h as parallelogram, l as perpindicular, x as primeArcminute, w as rightArrow, o as segment, v as similarTo, m as square, p as triangle };
|
package/dist/keys/grades.js
CHANGED
package/dist/keys/index.d.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* Manual edits will be overwritten on next sync.
|
|
7
7
|
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
8
|
*/
|
|
9
|
-
import * as comparison from './comparison';
|
|
10
|
-
import * as fractions from './fractions';
|
|
11
|
-
import * as exponent from './exponent';
|
|
12
|
-
import * as misc from './misc';
|
|
9
|
+
import * as comparison from './comparison.js';
|
|
10
|
+
import * as fractions from './fractions.js';
|
|
11
|
+
import * as exponent from './exponent.js';
|
|
12
|
+
import * as misc from './misc.js';
|
|
13
13
|
export declare const baseSet: any[][];
|
|
14
14
|
export { comparison, fractions, exponent, misc };
|
package/dist/keys/index.js
CHANGED
package/dist/keys/matrices.js
CHANGED
package/dist/keys/misc.js
CHANGED
|
@@ -57,4 +57,4 @@ var n = /* @__PURE__ */ e({
|
|
|
57
57
|
ariaLabel: "Not similar"
|
|
58
58
|
});
|
|
59
59
|
//#endregion
|
|
60
|
-
export { a as absValue, s as brackets, n as misc_exports, d as notEqual, p as notSimilar, o as parenthesis, c as percentage, i as plusMinus };
|
|
60
|
+
export { a as absValue, l as approx, s as brackets, n as misc_exports, u as nApprox, d as notEqual, p as notSimilar, o as parenthesis, c as percentage, i as plusMinus, f as similar };
|
package/dist/keys/sub-sup.js
CHANGED
package/dist/keys/utils.js
CHANGED
|
@@ -69,6 +69,9 @@ export declare const commonMqKeyboardStyles: {
|
|
|
69
69
|
'& .mq-math-mode .mq-empty': {
|
|
70
70
|
padding: string;
|
|
71
71
|
};
|
|
72
|
+
'& .mq-math-mode .mq-longdiv-inner .mq-empty': {
|
|
73
|
+
padding: string;
|
|
74
|
+
};
|
|
72
75
|
'& .mq-math-mode .mq-supsub': {
|
|
73
76
|
fontSize: string;
|
|
74
77
|
};
|
|
@@ -177,6 +180,9 @@ declare const _default: {
|
|
|
177
180
|
'& .mq-math-mode .mq-empty': {
|
|
178
181
|
padding: string;
|
|
179
182
|
};
|
|
183
|
+
'& .mq-math-mode .mq-longdiv-inner .mq-empty': {
|
|
184
|
+
padding: string;
|
|
185
|
+
};
|
|
180
186
|
'& .mq-math-mode .mq-supsub': {
|
|
181
187
|
fontSize: string;
|
|
182
188
|
};
|
|
@@ -36,6 +36,7 @@ var e = {
|
|
|
36
36
|
...t,
|
|
37
37
|
"& .mq-math-mode .mq-sqrt-prefix": { top: "0 !important" },
|
|
38
38
|
"& .mq-math-mode .mq-empty": { padding: "9px 1px !important" },
|
|
39
|
+
"& .mq-math-mode .mq-longdiv-inner .mq-empty": { padding: "0 !important" },
|
|
39
40
|
"& .mq-math-mode .mq-supsub": { fontSize: "70.7% !important" },
|
|
40
41
|
"& .mq-math-mode .mq-sqrt-stem": {
|
|
41
42
|
marginTop: "-5px",
|
|
@@ -51,4 +52,4 @@ var e = {
|
|
|
51
52
|
commonMqKeyboardStyles: r
|
|
52
53
|
};
|
|
53
54
|
//#endregion
|
|
54
|
-
export { r as commonMqKeyboardStyles, i as default };
|
|
55
|
+
export { e as commonMqFontStyles, r as commonMqKeyboardStyles, i as default, t as longdivStyles, n as supsubStyles };
|
package/dist/mq/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* Manual edits will be overwritten on next sync.
|
|
7
7
|
* To make changes, edit the upstream JavaScript file and run sync again.
|
|
8
8
|
*/
|
|
9
|
-
import Input from './input';
|
|
10
|
-
import Static from './static';
|
|
11
|
-
import CommonMqStyles from './common-mq-styles';
|
|
9
|
+
import Input from './input.js';
|
|
10
|
+
import Static from './static.js';
|
|
11
|
+
import CommonMqStyles from './common-mq-styles.js';
|
|
12
12
|
export { Input, Static, CommonMqStyles };
|
package/dist/mq/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
-
import t from "./
|
|
3
|
-
import n from "./
|
|
4
|
-
import r from "./
|
|
2
|
+
import { Input as t } from "./input.js";
|
|
3
|
+
import n from "./static.js";
|
|
4
|
+
import r from "./common-mq-styles.js";
|
|
5
5
|
//#region src/mq/index.ts
|
|
6
6
|
var i = /* @__PURE__ */ e({
|
|
7
|
-
CommonMqStyles: () =>
|
|
8
|
-
Input: () =>
|
|
9
|
-
Static: () =>
|
|
7
|
+
CommonMqStyles: () => r,
|
|
8
|
+
Input: () => t,
|
|
9
|
+
Static: () => n
|
|
10
10
|
});
|
|
11
11
|
//#endregion
|
|
12
|
-
export { i as mq_exports };
|
|
12
|
+
export { r as CommonMqStyles, t as Input, n as Static, i as mq_exports };
|
package/dist/mq/input.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @synced-from pie-lib/packages/math-input/src/mq/input.jsx
|
|
3
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.
|
|
4
8
|
*/
|
|
5
9
|
import React from 'react';
|
|
6
10
|
import PropTypes from 'prop-types';
|
package/dist/mq/input.js
CHANGED
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import a from "
|
|
7
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
1
|
+
import { MQ as e } from "./mathquill-instance.js";
|
|
2
|
+
import t from "react";
|
|
3
|
+
import n from "prop-types";
|
|
4
|
+
import { styled as r } from "@mui/material/styles";
|
|
5
|
+
import i from "debug";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
8
7
|
//#region src/mq/input.tsx
|
|
9
|
-
var s
|
|
10
|
-
typeof window < "u" && (s = t.getInterface(2), s && s.registerEmbed && e(s));
|
|
11
|
-
var c = a("math-input:mq:input"), l = i("span")({}), u = class extends n.Component {
|
|
8
|
+
var o = i("math-input:mq:input"), s = r("span")({}), c = class extends t.Component {
|
|
12
9
|
static propTypes = {
|
|
13
|
-
className:
|
|
14
|
-
onClick:
|
|
15
|
-
onChange:
|
|
16
|
-
latex:
|
|
17
|
-
onFocus:
|
|
18
|
-
onBlur:
|
|
10
|
+
className: n.string,
|
|
11
|
+
onClick: n.func,
|
|
12
|
+
onChange: n.func,
|
|
13
|
+
latex: n.string,
|
|
14
|
+
onFocus: n.func,
|
|
15
|
+
onBlur: n.func
|
|
19
16
|
};
|
|
20
17
|
componentDidMount() {
|
|
21
|
-
if (!
|
|
22
|
-
this.mathField =
|
|
18
|
+
if (!e) throw Error("MQ is not defined - but component has mounted?");
|
|
19
|
+
this.mathField = e.MathField(this.input, { handlers: { edit: this.onInputEdit.bind(this) } }), this.updateLatex();
|
|
23
20
|
}
|
|
24
21
|
componentDidUpdate() {
|
|
25
22
|
this.updateLatex();
|
|
@@ -33,13 +30,13 @@ var c = a("math-input:mq:input"), l = i("span")({}), u = class extends n.Compone
|
|
|
33
30
|
return this.mathField.latex(""), "";
|
|
34
31
|
}
|
|
35
32
|
blur() {
|
|
36
|
-
|
|
33
|
+
o("blur mathfield"), this.mathField.blur();
|
|
37
34
|
}
|
|
38
35
|
focus() {
|
|
39
|
-
|
|
36
|
+
o("focus mathfield..."), this.mathField.focus();
|
|
40
37
|
}
|
|
41
38
|
command(e) {
|
|
42
|
-
return
|
|
39
|
+
return o("command: ", e), Array.isArray(e) ? e.forEach((e) => {
|
|
43
40
|
this.mathField.cmd(e);
|
|
44
41
|
}) : this.mathField.cmd(e), this.mathField.focus(), this.mathField.latex();
|
|
45
42
|
}
|
|
@@ -47,10 +44,10 @@ var c = a("math-input:mq:input"), l = i("span")({}), u = class extends n.Compone
|
|
|
47
44
|
return this.mathField.keystroke(e), this.mathField.focus(), this.mathField.latex();
|
|
48
45
|
}
|
|
49
46
|
write(e) {
|
|
50
|
-
return
|
|
47
|
+
return o("write: ", e), this.mathField.write(e), this.mathField.focus(), this.mathField.latex();
|
|
51
48
|
}
|
|
52
49
|
onInputEdit = () => {
|
|
53
|
-
|
|
50
|
+
o("[onInputEdit] ...");
|
|
54
51
|
let { onChange: e } = this.props;
|
|
55
52
|
this.mathField && e && e(this.mathField.latex());
|
|
56
53
|
};
|
|
@@ -58,18 +55,21 @@ var c = a("math-input:mq:input"), l = i("span")({}), u = class extends n.Compone
|
|
|
58
55
|
this.blur(), this.focus();
|
|
59
56
|
};
|
|
60
57
|
onKeyPress = (e) => {
|
|
61
|
-
|
|
58
|
+
if (Object.keys(this.mathField.__controller.options).indexOf("ignoreNextMousedown") < 0 && this.refresh(), e.charCode === 13) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
62
|
};
|
|
63
63
|
onClick = (e) => {
|
|
64
64
|
let { onClick: t } = this.props;
|
|
65
65
|
this.refresh(), t && t(e);
|
|
66
66
|
};
|
|
67
67
|
shouldComponentUpdate(e) {
|
|
68
|
-
return
|
|
68
|
+
return o("next: ", e.latex), o("current: ", this.mathField.latex()), e.latex !== this.mathField.latex();
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
71
|
let { onFocus: e, onBlur: t, className: n } = this.props;
|
|
72
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ a(s, {
|
|
73
73
|
className: n,
|
|
74
74
|
onKeyDown: this.onKeyPress,
|
|
75
75
|
onClick: this.onClick,
|
|
@@ -80,4 +80,4 @@ var c = a("math-input:mq:input"), l = i("span")({}), u = class extends n.Compone
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
//#endregion
|
|
83
|
-
export {
|
|
83
|
+
export { c as Input, c as default };
|