@pie-lib/math-input 8.1.2-next.88 → 9.0.0-next.7

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.
Files changed (183) hide show
  1. package/dist/_virtual/_rolldown/runtime.js +11 -0
  2. package/dist/horizontal-keypad.d.ts +30 -0
  3. package/dist/horizontal-keypad.js +55 -0
  4. package/dist/index.d.ts +17 -0
  5. package/dist/index.js +10 -0
  6. package/dist/keypad/index.d.ts +37 -0
  7. package/dist/keypad/index.js +277 -0
  8. package/dist/keypad/keys-layout.d.ts +15 -0
  9. package/dist/keypad/keys-layout.js +5 -0
  10. package/dist/keys/basic-operators.d.ts +13 -0
  11. package/dist/keys/basic-operators.js +30 -0
  12. package/dist/keys/chars.d.ts +13 -0
  13. package/dist/keys/comparison.d.ts +12 -0
  14. package/dist/keys/comparison.js +32 -0
  15. package/dist/keys/constants.d.ts +12 -0
  16. package/dist/keys/constants.js +35 -0
  17. package/dist/keys/digits.d.ts +23 -0
  18. package/dist/keys/digits.js +34 -0
  19. package/dist/keys/edit.d.ts +14 -0
  20. package/dist/keys/edit.js +9 -0
  21. package/dist/keys/exponent.d.ts +12 -0
  22. package/dist/keys/exponent.js +28 -0
  23. package/dist/keys/fractions.d.ts +11 -0
  24. package/dist/keys/fractions.js +27 -0
  25. package/dist/keys/geometry.d.ts +31 -0
  26. package/dist/keys/geometry.js +127 -0
  27. package/dist/keys/grades.d.ts +17 -0
  28. package/dist/keys/grades.js +414 -0
  29. package/dist/keys/index.d.ts +14 -0
  30. package/dist/keys/index.js +50 -0
  31. package/dist/keys/log.d.ts +11 -0
  32. package/dist/keys/log.js +25 -0
  33. package/dist/keys/logic.d.ts +10 -0
  34. package/dist/keys/logic.js +13 -0
  35. package/dist/keys/matrices.d.ts +10 -0
  36. package/dist/keys/matrices.js +17 -0
  37. package/dist/keys/misc.d.ts +18 -0
  38. package/dist/keys/misc.js +60 -0
  39. package/dist/keys/navigation.d.ts +10 -0
  40. package/dist/keys/navigation.js +13 -0
  41. package/dist/keys/operators.d.ts +9 -0
  42. package/dist/keys/operators.js +11 -0
  43. package/dist/keys/statistics.d.ts +13 -0
  44. package/dist/keys/statistics.js +38 -0
  45. package/dist/keys/sub-sup.d.ts +10 -0
  46. package/dist/keys/sub-sup.js +17 -0
  47. package/dist/keys/trigonometry.d.ts +14 -0
  48. package/dist/keys/trigonometry.js +43 -0
  49. package/dist/keys/utils.d.ts +13 -0
  50. package/dist/keys/utils.js +24 -0
  51. package/dist/keys/vars.d.ts +11 -0
  52. package/dist/keys/vars.js +22 -0
  53. package/dist/math-input.d.ts +30 -0
  54. package/dist/mq/common-mq-styles.d.ts +231 -0
  55. package/dist/mq/common-mq-styles.js +55 -0
  56. package/dist/mq/custom-elements.d.ts +10 -0
  57. package/dist/mq/custom-elements.js +10 -0
  58. package/dist/mq/index.d.ts +12 -0
  59. package/dist/mq/index.js +12 -0
  60. package/dist/mq/input.d.ts +39 -0
  61. package/dist/mq/input.js +83 -0
  62. package/{src/mq/mathquill-instance.js → dist/mq/mathquill-instance.d.ts} +11 -28
  63. package/dist/mq/mathquill-instance.js +13 -0
  64. package/dist/mq/static.d.ts +47 -0
  65. package/dist/mq/static.js +151 -0
  66. package/dist/updateSpans.d.ts +10 -0
  67. package/dist/updateSpans.js +8 -0
  68. package/package.json +29 -15
  69. package/CHANGELOG.json +0 -17
  70. package/CHANGELOG.md +0 -1178
  71. package/LICENSE.md +0 -5
  72. package/lib/horizontal-keypad.js +0 -96
  73. package/lib/horizontal-keypad.js.map +0 -1
  74. package/lib/index.js +0 -69
  75. package/lib/index.js.map +0 -1
  76. package/lib/keypad/index.js +0 -413
  77. package/lib/keypad/index.js.map +0 -1
  78. package/lib/keypad/keys-layout.js +0 -22
  79. package/lib/keypad/keys-layout.js.map +0 -1
  80. package/lib/keys/basic-operators.js +0 -33
  81. package/lib/keys/basic-operators.js.map +0 -1
  82. package/lib/keys/chars.js +0 -12
  83. package/lib/keys/chars.js.map +0 -1
  84. package/lib/keys/comparison.js +0 -39
  85. package/lib/keys/comparison.js.map +0 -1
  86. package/lib/keys/constants.js +0 -37
  87. package/lib/keys/constants.js.map +0 -1
  88. package/lib/keys/digits.js +0 -46
  89. package/lib/keys/digits.js.map +0 -1
  90. package/lib/keys/edit.js +0 -14
  91. package/lib/keys/edit.js.map +0 -1
  92. package/lib/keys/exponent.js +0 -30
  93. package/lib/keys/exponent.js.map +0 -1
  94. package/lib/keys/fractions.js +0 -29
  95. package/lib/keys/fractions.js.map +0 -1
  96. package/lib/keys/geometry.js +0 -140
  97. package/lib/keys/geometry.js.map +0 -1
  98. package/lib/keys/grades.js +0 -259
  99. package/lib/keys/grades.js.map +0 -1
  100. package/lib/keys/index.js +0 -35
  101. package/lib/keys/index.js.map +0 -1
  102. package/lib/keys/log.js +0 -27
  103. package/lib/keys/log.js.map +0 -1
  104. package/lib/keys/logic.js +0 -19
  105. package/lib/keys/logic.js.map +0 -1
  106. package/lib/keys/matrices.js +0 -19
  107. package/lib/keys/matrices.js.map +0 -1
  108. package/lib/keys/misc.js +0 -62
  109. package/lib/keys/misc.js.map +0 -1
  110. package/lib/keys/navigation.js +0 -20
  111. package/lib/keys/navigation.js.map +0 -1
  112. package/lib/keys/operators.js +0 -15
  113. package/lib/keys/operators.js.map +0 -1
  114. package/lib/keys/statistics.js +0 -40
  115. package/lib/keys/statistics.js.map +0 -1
  116. package/lib/keys/sub-sup.js +0 -19
  117. package/lib/keys/sub-sup.js.map +0 -1
  118. package/lib/keys/trigonometry.js +0 -45
  119. package/lib/keys/trigonometry.js.map +0 -1
  120. package/lib/keys/utils.js +0 -87
  121. package/lib/keys/utils.js.map +0 -1
  122. package/lib/keys/vars.js +0 -24
  123. package/lib/keys/vars.js.map +0 -1
  124. package/lib/math-input.js +0 -141
  125. package/lib/math-input.js.map +0 -1
  126. package/lib/mq/common-mq-styles.js +0 -102
  127. package/lib/mq/common-mq-styles.js.map +0 -1
  128. package/lib/mq/custom-elements.js +0 -20
  129. package/lib/mq/custom-elements.js.map +0 -1
  130. package/lib/mq/index.js +0 -28
  131. package/lib/mq/index.js.map +0 -1
  132. package/lib/mq/input.js +0 -186
  133. package/lib/mq/input.js.map +0 -1
  134. package/lib/mq/mathquill-instance.js +0 -52
  135. package/lib/mq/mathquill-instance.js.map +0 -1
  136. package/lib/mq/static.js +0 -301
  137. package/lib/mq/static.js.map +0 -1
  138. package/lib/updateSpans.js +0 -19
  139. package/lib/updateSpans.js.map +0 -1
  140. package/src/__tests__/horizontal-keypad.test.jsx +0 -463
  141. package/src/__tests__/index.test.js +0 -247
  142. package/src/__tests__/math-input-test.jsx +0 -45
  143. package/src/__tests__/updateSpans.test.js +0 -297
  144. package/src/horizontal-keypad.jsx +0 -69
  145. package/src/index.jsx +0 -28
  146. package/src/keypad/__tests__/index.test.jsx +0 -25
  147. package/src/keypad/__tests__/keys-layout.test.js +0 -14
  148. package/src/keypad/index.jsx +0 -439
  149. package/src/keypad/keys-layout.js +0 -16
  150. package/src/keys/__tests__/utils.test.js +0 -57
  151. package/src/keys/basic-operators.js +0 -32
  152. package/src/keys/chars.js +0 -5
  153. package/src/keys/comparison.js +0 -28
  154. package/src/keys/constants.js +0 -35
  155. package/src/keys/digits.js +0 -40
  156. package/src/keys/edit.js +0 -3
  157. package/src/keys/exponent.js +0 -28
  158. package/src/keys/fractions.js +0 -26
  159. package/src/keys/geometry.js +0 -144
  160. package/src/keys/grades.js +0 -367
  161. package/src/keys/index.js +0 -20
  162. package/src/keys/log.js +0 -22
  163. package/src/keys/logic.js +0 -15
  164. package/src/keys/matrices.js +0 -15
  165. package/src/keys/misc.js +0 -65
  166. package/src/keys/navigation.js +0 -8
  167. package/src/keys/operators.js +0 -10
  168. package/src/keys/statistics.js +0 -38
  169. package/src/keys/sub-sup.js +0 -15
  170. package/src/keys/trigonometry.js +0 -15
  171. package/src/keys/utils.js +0 -66
  172. package/src/keys/vars.js +0 -19
  173. package/src/math-input.jsx +0 -119
  174. package/src/mq/__tests__/custom-elements.test.js +0 -342
  175. package/src/mq/__tests__/input.test.jsx +0 -40
  176. package/src/mq/__tests__/mathquill-instance.test.js +0 -67
  177. package/src/mq/__tests__/static.test.jsx +0 -33
  178. package/src/mq/common-mq-styles.js +0 -109
  179. package/src/mq/custom-elements.js +0 -11
  180. package/src/mq/index.js +0 -5
  181. package/src/mq/input.jsx +0 -166
  182. package/src/mq/static.jsx +0 -290
  183. package/src/updateSpans.js +0 -15
@@ -0,0 +1,11 @@
1
+ //#region \0rolldown/runtime.js
2
+ var e = Object.defineProperty, t = (t, n) => {
3
+ let r = {};
4
+ for (var i in t) e(r, i, {
5
+ get: t[i],
6
+ enumerable: !0
7
+ });
8
+ return n || e(r, Symbol.toStringTag, { value: "Module" }), r;
9
+ };
10
+ //#endregion
11
+ export { t as __exportAll };
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/horizontal-keypad.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 default class HorizontalKeypad extends React.Component {
12
+ static propTypes: {
13
+ className: PropTypes.Requireable<string>;
14
+ controlledKeypadMode: PropTypes.Requireable<boolean>;
15
+ mode: PropTypes.Requireable<NonNullable<string | number | null | undefined>>;
16
+ layoutForKeyPad: PropTypes.Requireable<object>;
17
+ onClick: PropTypes.Validator<(...args: any[]) => any>;
18
+ onFocus: PropTypes.Requireable<(...args: any[]) => any>;
19
+ noDecimal: PropTypes.Requireable<boolean>;
20
+ additionalKeys: PropTypes.Requireable<any[]>;
21
+ setKeypadInteraction: PropTypes.Requireable<(...args: any[]) => any>;
22
+ };
23
+ static defaultProps: {
24
+ mode: string;
25
+ noDecimal: boolean;
26
+ additionalKeys: never[];
27
+ };
28
+ keypadPress: any;
29
+ render(): React.JSX.Element;
30
+ }
@@ -0,0 +1,55 @@
1
+ import { extendKeySet as e } from "./keys/utils.js";
2
+ import { keysForGrade as t, normalizeAdditionalKeys as n } from "./keys/grades.js";
3
+ import { KeyPad as r } from "./keypad/index.js";
4
+ import i from "react";
5
+ import a from "prop-types";
6
+ import { jsx as o } from "react/jsx-runtime";
7
+ //#region src/horizontal-keypad.tsx
8
+ var s = (e) => {
9
+ if (e.command) return {
10
+ value: e.command,
11
+ type: "command"
12
+ };
13
+ if (e.write) return { value: e.write };
14
+ if (e.keystroke) return {
15
+ type: "cursor",
16
+ value: e.keystroke
17
+ };
18
+ }, c = class extends i.Component {
19
+ static propTypes = {
20
+ className: a.string,
21
+ controlledKeypadMode: a.bool,
22
+ mode: a.oneOfType([a.string, a.number]),
23
+ layoutForKeyPad: a.object,
24
+ onClick: a.func.isRequired,
25
+ onFocus: a.func,
26
+ noDecimal: a.bool,
27
+ additionalKeys: a.array,
28
+ setKeypadInteraction: a.func
29
+ };
30
+ static defaultProps = {
31
+ mode: "scientific",
32
+ noDecimal: !1,
33
+ additionalKeys: []
34
+ };
35
+ keypadPress = (e) => {
36
+ let { onClick: t } = this.props;
37
+ t(s(e));
38
+ };
39
+ render() {
40
+ let { mode: i, onFocus: a, controlledKeypadMode: s, noDecimal: c, className: l, additionalKeys: u, layoutForKeyPad: d, setKeypadInteraction: f } = this.props, p = n(u);
41
+ return /* @__PURE__ */ o(r, {
42
+ className: l,
43
+ controlledKeypadMode: s,
44
+ onFocus: a,
45
+ noDecimal: c,
46
+ layoutForKeyPad: d,
47
+ additionalKeys: e(t(i), p),
48
+ onPress: this.keypadPress,
49
+ mode: i,
50
+ setKeypadInteraction: f
51
+ });
52
+ }
53
+ };
54
+ //#endregion
55
+ export { c as default };
@@ -0,0 +1,17 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/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 { 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';
15
+ declare const addBrackets: (s: any) => any;
16
+ declare const removeBrackets: (s: any) => any;
17
+ export { keysForGrade, addBrackets, removeBrackets, keys, HorizontalKeypad, mq, updateSpans, registerEmbed, applyStaticMath, };
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { keysForGrade as e } from "./keys/grades.js";
2
+ import { updateSpans as t } from "./updateSpans.js";
3
+ import { keys_exports as n } from "./keys/index.js";
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
+ //#region src/index.tsx
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));
9
+ //#endregion
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 };
@@ -0,0 +1,37 @@
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 };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keypad/keys-layout.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
+ /**
10
+ * Sort additional keys.
11
+ *
12
+ * Expects an array of rows.
13
+ * @param {} keys
14
+ */
15
+ export declare const sortKeys: (keys: any) => unknown[][];
@@ -0,0 +1,5 @@
1
+ import { times as e, zip as t } from "@pie-element/shared-lodash";
2
+ //#region src/keypad/keys-layout.ts
3
+ var n = (n) => (e(5 - n.length, () => n.push([])), t.apply(null, n));
4
+ //#endregion
5
+ export { n as sortKeys };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keys/basic-operators.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 equals: any;
10
+ export declare const plus: any;
11
+ export declare const minus: any;
12
+ export declare const divide: any;
13
+ export declare const multiply: any;
@@ -0,0 +1,30 @@
1
+ import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
2
+ import { mkSet as t } from "./utils.js";
3
+ //#region src/keys/basic-operators.ts
4
+ var n = /* @__PURE__ */ e({
5
+ divide: () => s,
6
+ equals: () => i,
7
+ minus: () => o,
8
+ multiply: () => c,
9
+ plus: () => a
10
+ }), r = t("operators"), i = r({
11
+ write: "=",
12
+ label: "="
13
+ }), a = r({
14
+ write: "+",
15
+ label: "+"
16
+ }), o = r({
17
+ write: "−",
18
+ label: "−"
19
+ }), s = r({
20
+ name: "divide",
21
+ label: "÷",
22
+ command: "\\divide",
23
+ otherNotation: "\\div"
24
+ }), c = r({
25
+ name: "multiply",
26
+ label: "×",
27
+ command: "\\times"
28
+ });
29
+ //#endregion
30
+ export { n as basic_operators_exports, s as divide, i as equals, o as minus, c as multiply, a as plus };
@@ -0,0 +1,13 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keys/chars.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 DELETE = "\u232B";
10
+ export declare const LEFT_ARROW = "\u25C0";
11
+ export declare const RIGHT_ARROW = "\u25B6";
12
+ export declare const DIVIDE = "\u00F7";
13
+ export declare const MULTIPLY = "\u00D7";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keys/comparison.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 lessThan: any;
10
+ export declare const greaterThan: any;
11
+ export declare const lessThanEqual: any;
12
+ export declare const greaterThanEqual: any;
@@ -0,0 +1,32 @@
1
+ import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
2
+ //#region src/keys/comparison.ts
3
+ var t = /* @__PURE__ */ e({
4
+ greaterThan: () => i,
5
+ greaterThanEqual: () => o,
6
+ lessThan: () => r,
7
+ lessThanEqual: () => a
8
+ }), n = (e) => ({
9
+ ...e,
10
+ category: "comparison"
11
+ }), r = n({
12
+ name: "Less than",
13
+ latex: "<",
14
+ command: "\\lt"
15
+ }), i = n({
16
+ name: "Greater than",
17
+ latex: ">",
18
+ command: "\\gt"
19
+ }), a = n({
20
+ name: "Less than or equal",
21
+ latex: "\\le",
22
+ symbol: "<=",
23
+ command: "\\le",
24
+ ariaLabel: "less than or equal to"
25
+ }), o = n({
26
+ name: "Greater than or equal",
27
+ symbol: ">=",
28
+ command: "\\ge",
29
+ latex: "\\ge"
30
+ });
31
+ //#endregion
32
+ export { t as comparison_exports, i as greaterThan, o as greaterThanEqual, r as lessThan, a as lessThanEqual };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keys/constants.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 pi: any;
10
+ export declare const eulers: any;
11
+ export declare const infinity: any;
12
+ export declare const halfInfinity: any;
@@ -0,0 +1,35 @@
1
+ import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
2
+ import { mkSet as t } from "./utils.js";
3
+ //#region src/keys/constants.ts
4
+ var n = /* @__PURE__ */ e({
5
+ eulers: () => a,
6
+ halfInfinity: () => s,
7
+ infinity: () => o,
8
+ pi: () => i
9
+ }), r = t("constants"), i = r({
10
+ name: "Pi",
11
+ label: "π",
12
+ latex: "\\pi",
13
+ command: "\\pi",
14
+ category: "constants"
15
+ }), a = r({
16
+ name: "Eulers",
17
+ label: "e",
18
+ latex: "e",
19
+ command: "e",
20
+ category: "constants"
21
+ }), o = r({
22
+ name: "Infinity",
23
+ label: "\\infty",
24
+ latex: "\\infty",
25
+ command: "\\infty",
26
+ category: "constants"
27
+ }), s = r({
28
+ name: "Half Infinity",
29
+ label: "\\propto",
30
+ latex: "\\propto",
31
+ command: "\\propto",
32
+ category: "constants"
33
+ });
34
+ //#endregion
35
+ export { n as constants_exports, a as eulers, s as halfInfinity, o as infinity, i as pi };
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @synced-from pie-lib/packages/math-input/src/keys/digits.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 _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
+ };
23
+ export default _default;
@@ -0,0 +1,34 @@
1
+ import { times as e } from "@pie-element/shared-lodash";
2
+ //#region src/keys/digits.ts
3
+ var t = {
4
+ 0: "zero",
5
+ 1: "one",
6
+ 2: "two",
7
+ 3: "three",
8
+ 4: "four",
9
+ 5: "five",
10
+ 6: "six",
11
+ 7: "seven",
12
+ 8: "eight",
13
+ 9: "nine"
14
+ }, n = e(10, String).map((e) => ({
15
+ name: t[e],
16
+ write: e,
17
+ label: e,
18
+ category: "digit"
19
+ })).reduce((e, t) => (e[t.name] = t, e), {
20
+ comma: {
21
+ name: "comma",
22
+ label: ",",
23
+ write: ",",
24
+ category: "digit"
25
+ },
26
+ decimalPoint: {
27
+ name: "decimal-point",
28
+ label: ".",
29
+ write: ".",
30
+ category: "digit"
31
+ }
32
+ });
33
+ //#endregion
34
+ export { n as default };