@pie-lib/math-input 0.1.1-next.0 → 0.1.1-next.1
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 +3 -1
- package/dist/index.js +12 -2
- package/dist/keypad/accessible-keypad.d.ts +6 -2
- package/dist/keypad/accessible-keypad.js +1 -1
- package/dist/keypad/keys-layout.d.ts +1 -1
- package/dist/keypad/keys-layout.js +1 -1
- package/dist/keys/digits.d.ts +14 -1
- package/dist/keys/digits.js +1 -1
- package/dist/keys/utils.js +1 -1
- package/dist/mq/input.js +15 -15
- package/dist/mq/static.js +18 -18
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -13,4 +13,6 @@ import HorizontalKeypad from './horizontal-keypad';
|
|
|
13
13
|
import * as mq from './mq';
|
|
14
14
|
declare const addBrackets: (s: any) => any;
|
|
15
15
|
declare const removeBrackets: (s: any) => any;
|
|
16
|
-
|
|
16
|
+
declare const registerEmbed: (name: any, factory: any) => void;
|
|
17
|
+
declare const applyStaticMath: (element: any, latex?: string) => any;
|
|
18
|
+
export { keysForGrade, addBrackets, removeBrackets, keys, HorizontalKeypad, mq, updateSpans, registerEmbed, applyStaticMath, };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,17 @@ import { updateSpans as t } from "./updateSpans.js";
|
|
|
3
3
|
import { keys_exports as n } from "./keys/index.js";
|
|
4
4
|
import r from "./horizontal-keypad.js";
|
|
5
5
|
import { mq_exports as i } from "./mq/index.js";
|
|
6
|
+
import a from "@pie-framework/mathquill";
|
|
6
7
|
//#region src/index.tsx
|
|
7
|
-
var
|
|
8
|
+
var o = (e) => e.indexOf("\\(") === 0 ? e : `\\(${e}`, s = (e) => e.indexOf("\\)") === e.length - 2 ? e : `${e}\\)`, c = (e) => e.indexOf("\\(") === 0 ? e.substring(2) : e, l = (e) => e.indexOf("\\)") === e.length - 2 ? e.substring(0, e.length - 2) : e, u = (e) => s(o(e)), d = (e) => l(c(e)), f = () => typeof window > "u" ? null : a.getInterface(2), p = (e, t) => {
|
|
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
18
|
//#endregion
|
|
9
|
-
export { r as HorizontalKeypad,
|
|
19
|
+
export { r as HorizontalKeypad, u as addBrackets, m as applyStaticMath, n as keys, e as keysForGrade, i as mq, p as registerEmbed, d as removeBrackets, t as updateSpans };
|
|
@@ -23,8 +23,12 @@ export default class AccessibleKeypad extends React.Component {
|
|
|
23
23
|
componentWillUnmount(): void;
|
|
24
24
|
handleKeypadInteraction: () => void;
|
|
25
25
|
keyIsNotAllowed: (key: any) => any;
|
|
26
|
-
flowKeys: (base: any, extras: any) =>
|
|
27
|
-
toRenderModel: () =>
|
|
26
|
+
flowKeys: (base: any, extras: any) => unknown[];
|
|
27
|
+
toRenderModel: () => {
|
|
28
|
+
id: string;
|
|
29
|
+
ariaLabel: string;
|
|
30
|
+
key: any;
|
|
31
|
+
}[];
|
|
28
32
|
pressKey: (definition: any) => void;
|
|
29
33
|
moveFocus: (nextIndex: any) => void;
|
|
30
34
|
onButtonKeyDown: (event: any, index: any) => void;
|
|
@@ -2,7 +2,7 @@ import { baseSet as e } from "../keys/index.js";
|
|
|
2
2
|
import { commonMqKeyboardStyles as t } from "../mq/common-mq-styles.js";
|
|
3
3
|
import { getAriaLabel as n } from "./model.js";
|
|
4
4
|
import { sortKeys as r } from "./keys-layout.js";
|
|
5
|
-
import { flatten as i } from "lodash
|
|
5
|
+
import { flatten as i } from "@pie-element/shared-lodash";
|
|
6
6
|
import a from "react";
|
|
7
7
|
import o from "prop-types";
|
|
8
8
|
import s from "@mui/material/Button";
|
package/dist/keys/digits.d.ts
CHANGED
|
@@ -6,5 +6,18 @@
|
|
|
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
|
-
declare const _default:
|
|
9
|
+
declare const _default: {
|
|
10
|
+
comma: {
|
|
11
|
+
name: string;
|
|
12
|
+
label: string;
|
|
13
|
+
write: string;
|
|
14
|
+
category: string;
|
|
15
|
+
};
|
|
16
|
+
decimalPoint: {
|
|
17
|
+
name: string;
|
|
18
|
+
label: string;
|
|
19
|
+
write: string;
|
|
20
|
+
category: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
10
23
|
export default _default;
|
package/dist/keys/digits.js
CHANGED
package/dist/keys/utils.js
CHANGED
package/dist/mq/input.js
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
import { registerLineBreak as e } from "./custom-elements.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import
|
|
5
|
-
import i from "
|
|
6
|
-
import
|
|
7
|
-
import o from "
|
|
2
|
+
import t from "@pie-framework/mathquill";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import { styled as i } from "@mui/material/styles";
|
|
6
|
+
import a from "debug";
|
|
7
|
+
import { jsx as o } from "react/jsx-runtime";
|
|
8
8
|
//#region src/mq/input.tsx
|
|
9
9
|
var s;
|
|
10
|
-
typeof window < "u" && (s =
|
|
11
|
-
var c =
|
|
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 {
|
|
12
12
|
static propTypes = {
|
|
13
|
-
className:
|
|
14
|
-
onClick:
|
|
15
|
-
onChange:
|
|
16
|
-
latex:
|
|
17
|
-
onFocus:
|
|
18
|
-
onBlur:
|
|
13
|
+
className: r.string,
|
|
14
|
+
onClick: r.func,
|
|
15
|
+
onChange: r.func,
|
|
16
|
+
latex: r.string,
|
|
17
|
+
onFocus: r.func,
|
|
18
|
+
onBlur: r.func
|
|
19
19
|
};
|
|
20
20
|
componentDidMount() {
|
|
21
21
|
if (!s) throw Error("MQ is not defined - but component has mounted?");
|
|
@@ -69,7 +69,7 @@ var c = i("math-input:mq:input"), l = r("span")({}), u = class extends t.Compone
|
|
|
69
69
|
}
|
|
70
70
|
render() {
|
|
71
71
|
let { onFocus: e, onBlur: t, className: n } = this.props;
|
|
72
|
-
return /* @__PURE__ */
|
|
72
|
+
return /* @__PURE__ */ o(l, {
|
|
73
73
|
className: n,
|
|
74
74
|
onKeyDown: this.onKeyPress,
|
|
75
75
|
onClick: this.onClick,
|
package/dist/mq/static.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { updateSpans as e } from "../updateSpans.js";
|
|
2
|
-
import t from "
|
|
3
|
-
import n from "
|
|
4
|
-
import r from "
|
|
5
|
-
import
|
|
6
|
-
import a from "
|
|
2
|
+
import t from "@pie-framework/mathquill";
|
|
3
|
+
import n from "react";
|
|
4
|
+
import r from "prop-types";
|
|
5
|
+
import i from "debug";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
7
7
|
//#region src/mq/static.tsx
|
|
8
8
|
var o;
|
|
9
|
-
typeof window < "u" && (o =
|
|
10
|
-
var s =
|
|
9
|
+
typeof window < "u" && (o = t.getInterface(2));
|
|
10
|
+
var s = i("pie-lib:math-input:mq:static"), c = /\\MathQuillMathField\[r\d*\]\{(.*?)\}/g, l = / /g;
|
|
11
11
|
function u(e = "") {
|
|
12
12
|
return e.replace(l, "");
|
|
13
13
|
}
|
|
@@ -16,16 +16,16 @@ function d(e) {
|
|
|
16
16
|
for (let n = 0; n < (e || "").length; n++) e[n] === "{" && t++;
|
|
17
17
|
return t;
|
|
18
18
|
}
|
|
19
|
-
var f = class extends
|
|
19
|
+
var f = class extends n.Component {
|
|
20
20
|
static propTypes = {
|
|
21
|
-
latex:
|
|
22
|
-
onFocus:
|
|
23
|
-
onBlur:
|
|
24
|
-
className:
|
|
25
|
-
getFieldName:
|
|
26
|
-
onSubFieldChange:
|
|
27
|
-
onSubFieldFocus:
|
|
28
|
-
setInput:
|
|
21
|
+
latex: r.string.isRequired,
|
|
22
|
+
onFocus: r.func,
|
|
23
|
+
onBlur: r.func,
|
|
24
|
+
className: r.string,
|
|
25
|
+
getFieldName: r.func,
|
|
26
|
+
onSubFieldChange: r.func,
|
|
27
|
+
onSubFieldFocus: r.func,
|
|
28
|
+
setInput: r.func
|
|
29
29
|
};
|
|
30
30
|
static defaultProps = { getFieldName: () => {} };
|
|
31
31
|
constructor(e) {
|
|
@@ -34,7 +34,7 @@ var f = class extends t.Component {
|
|
|
34
34
|
previousLatex: "",
|
|
35
35
|
inputSource: null,
|
|
36
36
|
isDeleteKeyPressed: !1
|
|
37
|
-
}, this.inputRef =
|
|
37
|
+
}, this.inputRef = n.createRef();
|
|
38
38
|
}
|
|
39
39
|
componentDidMount() {
|
|
40
40
|
this.update(), e(), this.createLiveRegion(), this.addEventListeners();
|
|
@@ -130,7 +130,7 @@ var f = class extends t.Component {
|
|
|
130
130
|
};
|
|
131
131
|
render() {
|
|
132
132
|
let { onBlur: e, className: t } = this.props;
|
|
133
|
-
return /* @__PURE__ */
|
|
133
|
+
return /* @__PURE__ */ a("span", {
|
|
134
134
|
className: t,
|
|
135
135
|
onFocus: this.onFocus,
|
|
136
136
|
onBlur: e,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/math-input",
|
|
3
|
-
"version": "0.1.1-next.
|
|
3
|
+
"version": "0.1.1-next.1",
|
|
4
4
|
"description": "React implementation of @pie-lib/math-input synced from pie-lib",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@emotion/react": "^11.14.0",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@pie-element/shared-math-rendering-mathjax": "0.1.0",
|
|
13
13
|
"@pie-lib/render-ui": "6.1.1-next.0",
|
|
14
14
|
"debug": "^4.1.1",
|
|
15
|
-
"lodash
|
|
15
|
+
"@pie-element/shared-lodash": "0.1.1-next.0",
|
|
16
16
|
"prop-types": "^15.7.2",
|
|
17
17
|
"react": "^18.2.0"
|
|
18
18
|
},
|