@pie-lib/math-input 8.1.1-next.1 → 8.1.1-next.2
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/_virtual/_rolldown/runtime.js +11 -0
- package/dist/horizontal-keypad.d.ts +31 -0
- package/dist/horizontal-keypad.js +57 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +19 -0
- package/dist/keypad/accessible-keypad.d.ts +37 -0
- package/dist/keypad/accessible-keypad.js +614 -0
- package/dist/keypad/index.d.ts +2 -0
- package/dist/keypad/keys-layout.d.ts +15 -0
- package/dist/keypad/keys-layout.js +5 -0
- package/dist/keypad/model.d.ts +28 -0
- package/dist/keypad/model.js +4 -0
- package/dist/keys/basic-operators.d.ts +13 -0
- package/dist/keys/basic-operators.js +30 -0
- package/dist/keys/chars.d.ts +13 -0
- package/dist/keys/comparison.d.ts +12 -0
- package/dist/keys/comparison.js +32 -0
- package/dist/keys/constants.d.ts +12 -0
- package/dist/keys/constants.js +35 -0
- package/dist/keys/digits.d.ts +23 -0
- package/dist/keys/digits.js +34 -0
- package/dist/keys/edit.d.ts +14 -0
- package/dist/keys/edit.js +9 -0
- package/dist/keys/exponent.d.ts +12 -0
- package/dist/keys/exponent.js +28 -0
- package/dist/keys/fractions.d.ts +11 -0
- package/dist/keys/fractions.js +27 -0
- package/dist/keys/geometry.d.ts +31 -0
- package/dist/keys/geometry.js +127 -0
- package/dist/keys/grades.d.ts +17 -0
- package/dist/keys/grades.js +414 -0
- package/dist/keys/index.d.ts +14 -0
- package/dist/keys/index.js +50 -0
- package/dist/keys/log.d.ts +11 -0
- package/dist/keys/log.js +25 -0
- package/dist/keys/logic.d.ts +10 -0
- package/dist/keys/logic.js +13 -0
- package/dist/keys/matrices.d.ts +10 -0
- package/dist/keys/matrices.js +17 -0
- package/dist/keys/misc.d.ts +18 -0
- package/dist/keys/misc.js +60 -0
- package/dist/keys/navigation.d.ts +10 -0
- package/dist/keys/navigation.js +13 -0
- package/dist/keys/operators.d.ts +9 -0
- package/dist/keys/operators.js +11 -0
- package/dist/keys/statistics.d.ts +13 -0
- package/dist/keys/statistics.js +38 -0
- package/dist/keys/sub-sup.d.ts +10 -0
- package/dist/keys/sub-sup.js +17 -0
- package/dist/keys/trigonometry.d.ts +14 -0
- package/dist/keys/trigonometry.js +43 -0
- package/dist/keys/utils.d.ts +13 -0
- package/dist/keys/utils.js +24 -0
- package/dist/keys/vars.d.ts +11 -0
- package/dist/keys/vars.js +22 -0
- package/dist/math-input.d.ts +30 -0
- package/dist/mq/common-mq-styles.d.ts +225 -0
- package/dist/mq/common-mq-styles.js +54 -0
- package/dist/mq/custom-elements.d.ts +10 -0
- package/dist/mq/custom-elements.js +10 -0
- package/dist/mq/index.d.ts +12 -0
- package/dist/mq/index.js +12 -0
- package/dist/mq/input.d.ts +35 -0
- package/dist/mq/input.js +83 -0
- package/dist/mq/static.d.ts +43 -0
- package/dist/mq/static.js +142 -0
- package/dist/updateSpans.d.ts +10 -0
- package/dist/updateSpans.js +9 -0
- package/package.json +32 -17
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1172
- package/LICENSE.md +0 -5
- package/lib/horizontal-keypad.js +0 -96
- package/lib/horizontal-keypad.js.map +0 -1
- package/lib/index.js +0 -69
- package/lib/index.js.map +0 -1
- package/lib/keypad/index.js +0 -413
- package/lib/keypad/index.js.map +0 -1
- package/lib/keypad/keys-layout.js +0 -22
- package/lib/keypad/keys-layout.js.map +0 -1
- package/lib/keys/basic-operators.js +0 -33
- package/lib/keys/basic-operators.js.map +0 -1
- package/lib/keys/chars.js +0 -12
- package/lib/keys/chars.js.map +0 -1
- package/lib/keys/comparison.js +0 -39
- package/lib/keys/comparison.js.map +0 -1
- package/lib/keys/constants.js +0 -37
- package/lib/keys/constants.js.map +0 -1
- package/lib/keys/digits.js +0 -46
- package/lib/keys/digits.js.map +0 -1
- package/lib/keys/edit.js +0 -14
- package/lib/keys/edit.js.map +0 -1
- package/lib/keys/exponent.js +0 -30
- package/lib/keys/exponent.js.map +0 -1
- package/lib/keys/fractions.js +0 -29
- package/lib/keys/fractions.js.map +0 -1
- package/lib/keys/geometry.js +0 -140
- package/lib/keys/geometry.js.map +0 -1
- package/lib/keys/grades.js +0 -259
- package/lib/keys/grades.js.map +0 -1
- package/lib/keys/index.js +0 -35
- package/lib/keys/index.js.map +0 -1
- package/lib/keys/log.js +0 -27
- package/lib/keys/log.js.map +0 -1
- package/lib/keys/logic.js +0 -19
- package/lib/keys/logic.js.map +0 -1
- package/lib/keys/matrices.js +0 -19
- package/lib/keys/matrices.js.map +0 -1
- package/lib/keys/misc.js +0 -62
- package/lib/keys/misc.js.map +0 -1
- package/lib/keys/navigation.js +0 -20
- package/lib/keys/navigation.js.map +0 -1
- package/lib/keys/operators.js +0 -15
- package/lib/keys/operators.js.map +0 -1
- package/lib/keys/statistics.js +0 -40
- package/lib/keys/statistics.js.map +0 -1
- package/lib/keys/sub-sup.js +0 -19
- package/lib/keys/sub-sup.js.map +0 -1
- package/lib/keys/trigonometry.js +0 -45
- package/lib/keys/trigonometry.js.map +0 -1
- package/lib/keys/utils.js +0 -87
- package/lib/keys/utils.js.map +0 -1
- package/lib/keys/vars.js +0 -24
- package/lib/keys/vars.js.map +0 -1
- package/lib/math-input.js +0 -141
- package/lib/math-input.js.map +0 -1
- package/lib/mq/common-mq-styles.js +0 -102
- package/lib/mq/common-mq-styles.js.map +0 -1
- package/lib/mq/custom-elements.js +0 -20
- package/lib/mq/custom-elements.js.map +0 -1
- package/lib/mq/index.js +0 -28
- package/lib/mq/index.js.map +0 -1
- package/lib/mq/input.js +0 -186
- package/lib/mq/input.js.map +0 -1
- package/lib/mq/mathquill-instance.js +0 -52
- package/lib/mq/mathquill-instance.js.map +0 -1
- package/lib/mq/static.js +0 -301
- package/lib/mq/static.js.map +0 -1
- package/lib/updateSpans.js +0 -19
- package/lib/updateSpans.js.map +0 -1
- package/src/__tests__/horizontal-keypad.test.jsx +0 -463
- package/src/__tests__/index.test.js +0 -247
- package/src/__tests__/math-input-test.jsx +0 -45
- package/src/__tests__/updateSpans.test.js +0 -297
- package/src/horizontal-keypad.jsx +0 -69
- package/src/index.jsx +0 -28
- package/src/keypad/__tests__/index.test.jsx +0 -25
- package/src/keypad/__tests__/keys-layout.test.js +0 -14
- package/src/keypad/index.jsx +0 -439
- package/src/keypad/keys-layout.js +0 -16
- package/src/keys/__tests__/utils.test.js +0 -57
- package/src/keys/basic-operators.js +0 -32
- package/src/keys/chars.js +0 -5
- package/src/keys/comparison.js +0 -28
- package/src/keys/constants.js +0 -35
- package/src/keys/digits.js +0 -40
- package/src/keys/edit.js +0 -3
- package/src/keys/exponent.js +0 -28
- package/src/keys/fractions.js +0 -26
- package/src/keys/geometry.js +0 -144
- package/src/keys/grades.js +0 -367
- package/src/keys/index.js +0 -20
- package/src/keys/log.js +0 -22
- package/src/keys/logic.js +0 -15
- package/src/keys/matrices.js +0 -15
- package/src/keys/misc.js +0 -65
- package/src/keys/navigation.js +0 -8
- package/src/keys/operators.js +0 -10
- package/src/keys/statistics.js +0 -38
- package/src/keys/sub-sup.js +0 -15
- package/src/keys/trigonometry.js +0 -15
- package/src/keys/utils.js +0 -66
- package/src/keys/vars.js +0 -19
- package/src/math-input.jsx +0 -119
- package/src/mq/__tests__/custom-elements.test.js +0 -342
- package/src/mq/__tests__/input.test.jsx +0 -40
- package/src/mq/__tests__/mathquill-instance.test.js +0 -67
- package/src/mq/__tests__/static.test.jsx +0 -33
- package/src/mq/common-mq-styles.js +0 -109
- package/src/mq/custom-elements.js +0 -11
- package/src/mq/index.js +0 -5
- package/src/mq/input.jsx +0 -166
- package/src/mq/mathquill-instance.js +0 -45
- package/src/mq/static.jsx +0 -290
- package/src/updateSpans.js +0 -15
package/dist/mq/input.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { registerLineBreak as e } from "./custom-elements.js";
|
|
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
|
+
//#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 {
|
|
12
|
+
static propTypes = {
|
|
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
|
+
};
|
|
20
|
+
componentDidMount() {
|
|
21
|
+
if (!s) throw Error("MQ is not defined - but component has mounted?");
|
|
22
|
+
this.mathField = s.MathField(this.input, { handlers: { edit: this.onInputEdit.bind(this) } }), this.updateLatex();
|
|
23
|
+
}
|
|
24
|
+
componentDidUpdate() {
|
|
25
|
+
this.updateLatex();
|
|
26
|
+
}
|
|
27
|
+
updateLatex() {
|
|
28
|
+
if (!this.mathField) return;
|
|
29
|
+
let { latex: e } = this.props;
|
|
30
|
+
e != null && this.mathField.latex(e);
|
|
31
|
+
}
|
|
32
|
+
clear() {
|
|
33
|
+
return this.mathField.latex(""), "";
|
|
34
|
+
}
|
|
35
|
+
blur() {
|
|
36
|
+
c("blur mathfield"), this.mathField.blur();
|
|
37
|
+
}
|
|
38
|
+
focus() {
|
|
39
|
+
c("focus mathfield..."), this.mathField.focus();
|
|
40
|
+
}
|
|
41
|
+
command(e) {
|
|
42
|
+
return c("command: ", e), Array.isArray(e) ? e.forEach((e) => {
|
|
43
|
+
this.mathField.cmd(e);
|
|
44
|
+
}) : this.mathField.cmd(e), this.mathField.focus(), this.mathField.latex();
|
|
45
|
+
}
|
|
46
|
+
keystroke(e) {
|
|
47
|
+
return this.mathField.keystroke(e), this.mathField.focus(), this.mathField.latex();
|
|
48
|
+
}
|
|
49
|
+
write(e) {
|
|
50
|
+
return c("write: ", e), this.mathField.write(e), this.mathField.focus(), this.mathField.latex();
|
|
51
|
+
}
|
|
52
|
+
onInputEdit = () => {
|
|
53
|
+
c("[onInputEdit] ...");
|
|
54
|
+
let { onChange: e } = this.props;
|
|
55
|
+
this.mathField && e && e(this.mathField.latex());
|
|
56
|
+
};
|
|
57
|
+
refresh = () => {
|
|
58
|
+
this.blur(), this.focus();
|
|
59
|
+
};
|
|
60
|
+
onKeyPress = (e) => {
|
|
61
|
+
e.charCode === 13 && e.preventDefault();
|
|
62
|
+
};
|
|
63
|
+
onClick = (e) => {
|
|
64
|
+
let { onClick: t } = this.props;
|
|
65
|
+
this.refresh(), t && t(e);
|
|
66
|
+
};
|
|
67
|
+
shouldComponentUpdate(e) {
|
|
68
|
+
return c("next: ", e.latex), c("current: ", this.mathField.latex()), e.latex !== this.mathField.latex();
|
|
69
|
+
}
|
|
70
|
+
render() {
|
|
71
|
+
let { onFocus: e, onBlur: t, className: n } = this.props;
|
|
72
|
+
return /* @__PURE__ */ o(l, {
|
|
73
|
+
className: n,
|
|
74
|
+
onKeyDown: this.onKeyPress,
|
|
75
|
+
onClick: this.onClick,
|
|
76
|
+
onFocus: e,
|
|
77
|
+
onBlur: t,
|
|
78
|
+
ref: (e) => this.input = e
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
//#endregion
|
|
83
|
+
export { u as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/static.jsx
|
|
3
|
+
* @auto-generated
|
|
4
|
+
*/
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import React from 'react';
|
|
7
|
+
/**
|
|
8
|
+
* Wrapper for MathQuill MQ.MathField.
|
|
9
|
+
*/
|
|
10
|
+
export default class Static extends React.Component {
|
|
11
|
+
static propTypes: {
|
|
12
|
+
latex: PropTypes.Validator<string>;
|
|
13
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
14
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
15
|
+
className: PropTypes.Requireable<string>;
|
|
16
|
+
getFieldName: PropTypes.Requireable<(...args: any[]) => any>;
|
|
17
|
+
onSubFieldChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
onSubFieldFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
setInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
20
|
+
};
|
|
21
|
+
static defaultProps: {
|
|
22
|
+
getFieldName: () => void;
|
|
23
|
+
};
|
|
24
|
+
constructor(props: any);
|
|
25
|
+
componentDidMount(): void;
|
|
26
|
+
componentDidUpdate(): void;
|
|
27
|
+
componentWillUnmount(): void;
|
|
28
|
+
createLiveRegion: any;
|
|
29
|
+
addEventListeners: any;
|
|
30
|
+
removeEventListeners: any;
|
|
31
|
+
removeLiveRegion: any;
|
|
32
|
+
handleKeyDown: any;
|
|
33
|
+
handleMathKeyboardClick: any;
|
|
34
|
+
onInputEdit: any;
|
|
35
|
+
announceLatexConversion: any;
|
|
36
|
+
announceMessage: any;
|
|
37
|
+
update: any;
|
|
38
|
+
blur: any;
|
|
39
|
+
focus: any;
|
|
40
|
+
shouldComponentUpdate(nextProps: any): boolean;
|
|
41
|
+
onFocus: any;
|
|
42
|
+
render(): React.JSX.Element;
|
|
43
|
+
}
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { updateSpans as e } from "../updateSpans.js";
|
|
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
|
+
//#region src/mq/static.tsx
|
|
8
|
+
var o;
|
|
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
|
+
function u(e = "") {
|
|
12
|
+
return e.replace(l, "");
|
|
13
|
+
}
|
|
14
|
+
function d(e) {
|
|
15
|
+
let t = 0;
|
|
16
|
+
for (let n = 0; n < (e || "").length; n++) e[n] === "{" && t++;
|
|
17
|
+
return t;
|
|
18
|
+
}
|
|
19
|
+
var f = class extends n.Component {
|
|
20
|
+
static propTypes = {
|
|
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
|
+
};
|
|
30
|
+
static defaultProps = { getFieldName: () => {} };
|
|
31
|
+
constructor(e) {
|
|
32
|
+
super(e), this.state = {
|
|
33
|
+
announcement: "",
|
|
34
|
+
previousLatex: "",
|
|
35
|
+
inputSource: null,
|
|
36
|
+
isDeleteKeyPressed: !1
|
|
37
|
+
}, this.inputRef = n.createRef();
|
|
38
|
+
}
|
|
39
|
+
componentDidMount() {
|
|
40
|
+
this.update(), e(), this.createLiveRegion(), this.addEventListeners();
|
|
41
|
+
}
|
|
42
|
+
componentDidUpdate() {
|
|
43
|
+
this.update(), e();
|
|
44
|
+
}
|
|
45
|
+
componentWillUnmount() {
|
|
46
|
+
this.removeLiveRegion(), this.removeEventListeners();
|
|
47
|
+
}
|
|
48
|
+
createLiveRegion = () => {
|
|
49
|
+
this.liveRegion = document.createElement("div"), this.liveRegion.style.position = "absolute", this.liveRegion.style.width = "1px", this.liveRegion.style.height = "1px", this.liveRegion.style.marginTop = "-1px", this.liveRegion.style.clip = "rect(1px, 1px, 1px, 1px)", this.liveRegion.style.overflow = "hidden", this.liveRegion.setAttribute("aria-live", "polite"), this.liveRegion.setAttribute("aria-atomic", "true"), document.body.appendChild(this.liveRegion);
|
|
50
|
+
};
|
|
51
|
+
addEventListeners = () => {
|
|
52
|
+
let e = this.inputRef.current;
|
|
53
|
+
e && (e.addEventListener("keydown", this.handleKeyDown), e.addEventListener("click", this.handleMathKeyboardClick));
|
|
54
|
+
};
|
|
55
|
+
removeEventListeners = () => {
|
|
56
|
+
let e = this.inputRef.current;
|
|
57
|
+
e && (e.removeEventListener("keydown", this.handleKeyDown), e.removeEventListener("click", this.handleMathKeyboardClick));
|
|
58
|
+
};
|
|
59
|
+
removeLiveRegion = () => {
|
|
60
|
+
this.liveRegion &&= (document.body.removeChild(this.liveRegion), null);
|
|
61
|
+
};
|
|
62
|
+
handleKeyDown = (e) => {
|
|
63
|
+
(e?.key === "Backspace" || e?.key === "Delete") && this.setState({ isDeleteKeyPressed: !0 }), this.setState({ inputSource: "keyboard" });
|
|
64
|
+
};
|
|
65
|
+
handleMathKeyboardClick = () => {
|
|
66
|
+
this.setState({ inputSource: "mathKeyboard" });
|
|
67
|
+
};
|
|
68
|
+
onInputEdit = (e) => {
|
|
69
|
+
if (!this.mathField) return;
|
|
70
|
+
let t = this.props.getFieldName(e, this.mathField.innerFields);
|
|
71
|
+
this.props.onSubFieldChange && this.props.onSubFieldChange(t, e.latex()), this.announceLatexConversion(e.latex());
|
|
72
|
+
};
|
|
73
|
+
announceLatexConversion = (e) => {
|
|
74
|
+
if (!this.state) {
|
|
75
|
+
console.error("State is not initialized");
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
let { previousLatex: t, inputSource: n, isDeleteKeyPressed: r } = this.state, i = "Converted to math symbol";
|
|
79
|
+
if (n === "keyboard" && !r) if (d(e) > d(t)) this.announceMessage(i);
|
|
80
|
+
else try {
|
|
81
|
+
this.mathField.parseLatex(t), this.mathField.parseLatex(e), e == t && this.announceMessage(i);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
console.warn("Error parsing latex:", e.message), console.warn(e);
|
|
84
|
+
}
|
|
85
|
+
this.setState({
|
|
86
|
+
previousLatex: e,
|
|
87
|
+
isDeleteKeyPressed: !1
|
|
88
|
+
});
|
|
89
|
+
};
|
|
90
|
+
announceMessage = (e) => {
|
|
91
|
+
this.setState({ previousLatex: "" }), this.liveRegion && (this.liveRegion.textContent = e, setTimeout(() => {
|
|
92
|
+
this.liveRegion.textContent = "";
|
|
93
|
+
}, 500));
|
|
94
|
+
};
|
|
95
|
+
update = () => {
|
|
96
|
+
if (!o) throw Error("MQ is not defined - but component has mounted?");
|
|
97
|
+
this.mathField ||= o.StaticMath(this.inputRef?.current, { handlers: { edit: this.onInputEdit.bind(this) } });
|
|
98
|
+
try {
|
|
99
|
+
this.mathField.parseLatex(this.props.latex), this.mathField.latex(this.props.latex);
|
|
100
|
+
} catch {
|
|
101
|
+
this.mathField.latex("\\MathQuillMathField[r1]{}");
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
blur = () => {
|
|
105
|
+
s("blur mathfield"), this.mathField.blur();
|
|
106
|
+
};
|
|
107
|
+
focus = () => {
|
|
108
|
+
s("focus mathfield..."), this.mathField.focus();
|
|
109
|
+
};
|
|
110
|
+
shouldComponentUpdate(e) {
|
|
111
|
+
try {
|
|
112
|
+
let t = u(this.mathField.parseLatex(e.latex)), n = (e.latex.match(c) || []).length, r = t !== u(this.mathField.latex().trim()) || n !== Object.keys(this.mathField.innerFields).length / 2;
|
|
113
|
+
return s("[shouldComponentUpdate] ", r), r;
|
|
114
|
+
} catch (e) {
|
|
115
|
+
return console.warn("Error parsing latex:", e.message, "skip update"), console.warn(e), !1;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
onFocus = (e) => {
|
|
119
|
+
try {
|
|
120
|
+
let t = e.target.parentElement.nextSibling, n = parseInt(t.getAttribute("mathquill-block-id"), 10);
|
|
121
|
+
n ||= (t = t.parentElement, parseInt(t.getAttribute("mathquill-block-id"), 10));
|
|
122
|
+
let r = this.mathField.innerFields.find((e) => e.id === n);
|
|
123
|
+
if (r) {
|
|
124
|
+
let e = this.props.getFieldName(r, this.mathField.innerFields);
|
|
125
|
+
this.props.setInput && this.props.setInput(r), this.props.onSubFieldFocus(e, r);
|
|
126
|
+
}
|
|
127
|
+
} catch (e) {
|
|
128
|
+
console.error("error finding root block", e.message);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
render() {
|
|
132
|
+
let { onBlur: e, className: t } = this.props;
|
|
133
|
+
return /* @__PURE__ */ a("span", {
|
|
134
|
+
className: t,
|
|
135
|
+
onFocus: this.onFocus,
|
|
136
|
+
onBlur: e,
|
|
137
|
+
ref: this.inputRef
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
//#endregion
|
|
142
|
+
export { f as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/updateSpans.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
|
+
declare const updateSpans: (root?: ParentNode) => void;
|
|
10
|
+
export { updateSpans };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/updateSpans.ts
|
|
2
|
+
var e = (e) => {
|
|
3
|
+
let t = e ?? document;
|
|
4
|
+
(Array.from(t.querySelectorAll("span[mathquill-command-id]")) || []).forEach((e) => {
|
|
5
|
+
e && e.innerText === "∥" && e.className !== "mq-editable-field" && (e.style.fontSize = "32px"), (e.innerText === "′" || e.innerText === "′′") && !e.hasAttribute("data-prime") && e.setAttribute("data-prime", "true");
|
|
6
|
+
});
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { e as updateSpans };
|
package/package.json
CHANGED
|
@@ -1,29 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pie-lib/math-input",
|
|
3
|
-
"
|
|
4
|
-
|
|
5
|
-
},
|
|
6
|
-
"version": "8.1.1-next.1+83827e0fa",
|
|
7
|
-
"main": "lib/index.js",
|
|
8
|
-
"module": "src/index.jsx",
|
|
9
|
-
"repository": "pie-framework/pie-lib",
|
|
3
|
+
"version": "8.1.1-next.2",
|
|
4
|
+
"description": "React implementation of @pie-lib/math-input synced from pie-lib",
|
|
10
5
|
"dependencies": {
|
|
11
6
|
"@emotion/react": "^11.14.0",
|
|
12
7
|
"@emotion/style": "^0.8.0",
|
|
8
|
+
"@fontsource/stix-two-text": "^5.2.8",
|
|
13
9
|
"@mui/icons-material": "^7.3.4",
|
|
14
10
|
"@mui/material": "^7.3.4",
|
|
15
|
-
"@pie-framework/mathquill": "1.
|
|
11
|
+
"@pie-framework/mathquill": "^1.1.4",
|
|
12
|
+
"@pie-element/shared-math-rendering-mathjax": "0.1.1-next.0",
|
|
13
|
+
"@pie-lib/render-ui": "6.1.1-next.37",
|
|
16
14
|
"debug": "^4.1.1",
|
|
17
|
-
"lodash
|
|
18
|
-
"prop-types": "^15.7.2"
|
|
19
|
-
},
|
|
20
|
-
"peerDependencies": {
|
|
15
|
+
"@pie-element/shared-lodash": "0.1.1-next.0",
|
|
16
|
+
"prop-types": "^15.7.2",
|
|
21
17
|
"react": "^18.2.0"
|
|
22
18
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
"type": "module",
|
|
20
|
+
"main": "./dist/index.js",
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
26
|
+
}
|
|
26
27
|
},
|
|
27
|
-
"
|
|
28
|
-
|
|
28
|
+
"files": [
|
|
29
|
+
"dist"
|
|
30
|
+
],
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"scripts": {
|
|
33
|
+
"build": "bun x vite build && bun x tsc --emitDeclarationOnly",
|
|
34
|
+
"dev": "bun x vite",
|
|
35
|
+
"test": "bun x vitest run"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"vite": "^8.0.1",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
40
|
+
"@vitejs/plugin-react": "^6.0.1",
|
|
41
|
+
"@types/react": "^18.2.0",
|
|
42
|
+
"@types/react-dom": "^18.2.0"
|
|
43
|
+
}
|
|
29
44
|
}
|
package/CHANGELOG.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
[
|
|
2
|
-
{
|
|
3
|
-
"type": "feat",
|
|
4
|
-
"scope": "mask-markup",
|
|
5
|
-
"subject": "merging with the develop branch",
|
|
6
|
-
"merge": null,
|
|
7
|
-
"header": "feat(mask-markup): merging with the develop branch",
|
|
8
|
-
"body": null,
|
|
9
|
-
"footer": null,
|
|
10
|
-
"notes": [],
|
|
11
|
-
"hash": "0153c1aba8a08ba6c974fcc69476a87b9086f6c5",
|
|
12
|
-
"gitTags": "",
|
|
13
|
-
"committerDate": "2019-05-02 07:12:59 +0300",
|
|
14
|
-
"isTagged": true,
|
|
15
|
-
"tag": "@pie-lib/math-input@6.10.0"
|
|
16
|
-
}
|
|
17
|
-
]
|