@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.
- package/dist/_virtual/_rolldown/runtime.js +11 -0
- package/dist/horizontal-keypad.d.ts +30 -0
- package/dist/horizontal-keypad.js +55 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.js +10 -0
- package/dist/keypad/index.d.ts +37 -0
- package/dist/keypad/index.js +277 -0
- package/dist/keypad/keys-layout.d.ts +15 -0
- package/dist/keypad/keys-layout.js +5 -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 +231 -0
- package/dist/mq/common-mq-styles.js +55 -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 +39 -0
- package/dist/mq/input.js +83 -0
- package/{src/mq/mathquill-instance.js → dist/mq/mathquill-instance.d.ts} +11 -28
- package/dist/mq/mathquill-instance.js +13 -0
- package/dist/mq/static.d.ts +47 -0
- package/dist/mq/static.js +151 -0
- package/dist/updateSpans.d.ts +10 -0
- package/dist/updateSpans.js +8 -0
- package/package.json +29 -15
- package/CHANGELOG.json +0 -17
- package/CHANGELOG.md +0 -1178
- 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/static.jsx +0 -290
- package/src/updateSpans.js +0 -15
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/common-mq-styles.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 commonMqFontStyles: {
|
|
10
|
+
fontFamily: string;
|
|
11
|
+
'-webkit-font-smoothing': string;
|
|
12
|
+
'& .mq-math-mode > span > var': {
|
|
13
|
+
fontFamily: string;
|
|
14
|
+
};
|
|
15
|
+
'& .mq-math-mode span var': {
|
|
16
|
+
fontFamily: string;
|
|
17
|
+
};
|
|
18
|
+
'& .mq-math-mode .mq-nonSymbola': {
|
|
19
|
+
fontFamily: string;
|
|
20
|
+
};
|
|
21
|
+
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
22
|
+
fontFamily: string;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const longdivStyles: {
|
|
26
|
+
'& .mq-longdiv-inner': {
|
|
27
|
+
marginTop: string;
|
|
28
|
+
marginLeft: string;
|
|
29
|
+
'& > .mq-empty': {
|
|
30
|
+
padding: string;
|
|
31
|
+
marginLeft: string;
|
|
32
|
+
marginTop: string;
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
'& .mq-math-mode .mq-longdiv': {
|
|
36
|
+
display: string;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
export declare const supsubStyles: {
|
|
40
|
+
'& .mq-math-mode sup.mq-nthroot': {
|
|
41
|
+
fontSize: string;
|
|
42
|
+
verticalAlign: string;
|
|
43
|
+
paddingRight: string;
|
|
44
|
+
};
|
|
45
|
+
'& .mq-math-mode .mq-supsub': {
|
|
46
|
+
fontSize: string;
|
|
47
|
+
};
|
|
48
|
+
'& .mq-supsub ': {
|
|
49
|
+
fontSize: string;
|
|
50
|
+
};
|
|
51
|
+
'& .mq-math-mode .mq-supsub.mq-sup-only': {
|
|
52
|
+
verticalAlign: string;
|
|
53
|
+
'& .mq-sup': {
|
|
54
|
+
marginBottom: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
'& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only': {
|
|
58
|
+
verticalAlign: string;
|
|
59
|
+
};
|
|
60
|
+
'& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group': {
|
|
61
|
+
verticalAlign: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
export declare const commonMqKeyboardStyles: {
|
|
65
|
+
'& *': {
|
|
66
|
+
'& .mq-math-mode .mq-sqrt-prefix': {
|
|
67
|
+
top: string;
|
|
68
|
+
};
|
|
69
|
+
'& .mq-math-mode .mq-empty': {
|
|
70
|
+
padding: string;
|
|
71
|
+
};
|
|
72
|
+
'& .mq-math-mode .mq-longdiv-inner .mq-empty': {
|
|
73
|
+
padding: string;
|
|
74
|
+
};
|
|
75
|
+
'& .mq-math-mode .mq-supsub': {
|
|
76
|
+
fontSize: string;
|
|
77
|
+
};
|
|
78
|
+
'& .mq-math-mode .mq-sqrt-stem': {
|
|
79
|
+
marginTop: string;
|
|
80
|
+
paddingTop: string;
|
|
81
|
+
};
|
|
82
|
+
'& .mq-math-mode .mq-paren': {
|
|
83
|
+
verticalAlign: string;
|
|
84
|
+
};
|
|
85
|
+
'& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty': {
|
|
86
|
+
padding: string;
|
|
87
|
+
};
|
|
88
|
+
'& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ': {
|
|
89
|
+
padding: string;
|
|
90
|
+
};
|
|
91
|
+
'& .mq-longdiv-inner': {
|
|
92
|
+
marginTop: string;
|
|
93
|
+
marginLeft: string;
|
|
94
|
+
'& > .mq-empty': {
|
|
95
|
+
padding: string;
|
|
96
|
+
marginLeft: string;
|
|
97
|
+
marginTop: string;
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
'& .mq-math-mode .mq-longdiv': {
|
|
101
|
+
display: string;
|
|
102
|
+
};
|
|
103
|
+
fontFamily: string;
|
|
104
|
+
'-webkit-font-smoothing': string;
|
|
105
|
+
'& .mq-math-mode > span > var': {
|
|
106
|
+
fontFamily: string;
|
|
107
|
+
};
|
|
108
|
+
'& .mq-math-mode span var': {
|
|
109
|
+
fontFamily: string;
|
|
110
|
+
};
|
|
111
|
+
'& .mq-math-mode .mq-nonSymbola': {
|
|
112
|
+
fontFamily: string;
|
|
113
|
+
};
|
|
114
|
+
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
115
|
+
fontFamily: string;
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
declare const _default: {
|
|
120
|
+
commonMqFontStyles: {
|
|
121
|
+
fontFamily: string;
|
|
122
|
+
'-webkit-font-smoothing': string;
|
|
123
|
+
'& .mq-math-mode > span > var': {
|
|
124
|
+
fontFamily: string;
|
|
125
|
+
};
|
|
126
|
+
'& .mq-math-mode span var': {
|
|
127
|
+
fontFamily: string;
|
|
128
|
+
};
|
|
129
|
+
'& .mq-math-mode .mq-nonSymbola': {
|
|
130
|
+
fontFamily: string;
|
|
131
|
+
};
|
|
132
|
+
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
133
|
+
fontFamily: string;
|
|
134
|
+
};
|
|
135
|
+
};
|
|
136
|
+
longdivStyles: {
|
|
137
|
+
'& .mq-longdiv-inner': {
|
|
138
|
+
marginTop: string;
|
|
139
|
+
marginLeft: string;
|
|
140
|
+
'& > .mq-empty': {
|
|
141
|
+
padding: string;
|
|
142
|
+
marginLeft: string;
|
|
143
|
+
marginTop: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
'& .mq-math-mode .mq-longdiv': {
|
|
147
|
+
display: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
supsubStyles: {
|
|
151
|
+
'& .mq-math-mode sup.mq-nthroot': {
|
|
152
|
+
fontSize: string;
|
|
153
|
+
verticalAlign: string;
|
|
154
|
+
paddingRight: string;
|
|
155
|
+
};
|
|
156
|
+
'& .mq-math-mode .mq-supsub': {
|
|
157
|
+
fontSize: string;
|
|
158
|
+
};
|
|
159
|
+
'& .mq-supsub ': {
|
|
160
|
+
fontSize: string;
|
|
161
|
+
};
|
|
162
|
+
'& .mq-math-mode .mq-supsub.mq-sup-only': {
|
|
163
|
+
verticalAlign: string;
|
|
164
|
+
'& .mq-sup': {
|
|
165
|
+
marginBottom: string;
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
'& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only': {
|
|
169
|
+
verticalAlign: string;
|
|
170
|
+
};
|
|
171
|
+
'& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group': {
|
|
172
|
+
verticalAlign: string;
|
|
173
|
+
};
|
|
174
|
+
};
|
|
175
|
+
commonMqKeyboardStyles: {
|
|
176
|
+
'& *': {
|
|
177
|
+
'& .mq-math-mode .mq-sqrt-prefix': {
|
|
178
|
+
top: string;
|
|
179
|
+
};
|
|
180
|
+
'& .mq-math-mode .mq-empty': {
|
|
181
|
+
padding: string;
|
|
182
|
+
};
|
|
183
|
+
'& .mq-math-mode .mq-longdiv-inner .mq-empty': {
|
|
184
|
+
padding: string;
|
|
185
|
+
};
|
|
186
|
+
'& .mq-math-mode .mq-supsub': {
|
|
187
|
+
fontSize: string;
|
|
188
|
+
};
|
|
189
|
+
'& .mq-math-mode .mq-sqrt-stem': {
|
|
190
|
+
marginTop: string;
|
|
191
|
+
paddingTop: string;
|
|
192
|
+
};
|
|
193
|
+
'& .mq-math-mode .mq-paren': {
|
|
194
|
+
verticalAlign: string;
|
|
195
|
+
};
|
|
196
|
+
'& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty': {
|
|
197
|
+
padding: string;
|
|
198
|
+
};
|
|
199
|
+
'& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ': {
|
|
200
|
+
padding: string;
|
|
201
|
+
};
|
|
202
|
+
'& .mq-longdiv-inner': {
|
|
203
|
+
marginTop: string;
|
|
204
|
+
marginLeft: string;
|
|
205
|
+
'& > .mq-empty': {
|
|
206
|
+
padding: string;
|
|
207
|
+
marginLeft: string;
|
|
208
|
+
marginTop: string;
|
|
209
|
+
};
|
|
210
|
+
};
|
|
211
|
+
'& .mq-math-mode .mq-longdiv': {
|
|
212
|
+
display: string;
|
|
213
|
+
};
|
|
214
|
+
fontFamily: string;
|
|
215
|
+
'-webkit-font-smoothing': string;
|
|
216
|
+
'& .mq-math-mode > span > var': {
|
|
217
|
+
fontFamily: string;
|
|
218
|
+
};
|
|
219
|
+
'& .mq-math-mode span var': {
|
|
220
|
+
fontFamily: string;
|
|
221
|
+
};
|
|
222
|
+
'& .mq-math-mode .mq-nonSymbola': {
|
|
223
|
+
fontFamily: string;
|
|
224
|
+
};
|
|
225
|
+
'& .mq-math-mode > span > var.mq-operator-name': {
|
|
226
|
+
fontFamily: string;
|
|
227
|
+
};
|
|
228
|
+
};
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
export default _default;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
//#region src/mq/common-mq-styles.ts
|
|
2
|
+
var e = {
|
|
3
|
+
fontFamily: "MJXZERO, MJXTEX !important",
|
|
4
|
+
"-webkit-font-smoothing": "antialiased !important",
|
|
5
|
+
"& .mq-math-mode > span > var": { fontFamily: "MJXZERO, MJXTEX-I !important" },
|
|
6
|
+
"& .mq-math-mode span var": { fontFamily: "MJXZERO, MJXTEX-I !important" },
|
|
7
|
+
"& .mq-math-mode .mq-nonSymbola": { fontFamily: "MJXZERO, MJXTEX-I !important" },
|
|
8
|
+
"& .mq-math-mode > span > var.mq-operator-name": { fontFamily: "MJXZERO, MJXTEX !important" }
|
|
9
|
+
}, t = {
|
|
10
|
+
"& .mq-longdiv-inner": {
|
|
11
|
+
marginTop: "-1px",
|
|
12
|
+
marginLeft: "5px !important;",
|
|
13
|
+
"& > .mq-empty": {
|
|
14
|
+
padding: "0 !important",
|
|
15
|
+
marginLeft: "0px !important",
|
|
16
|
+
marginTop: "2px"
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
"& .mq-math-mode .mq-longdiv": { display: "inline-flex !important" }
|
|
20
|
+
}, n = {
|
|
21
|
+
"& .mq-math-mode sup.mq-nthroot": {
|
|
22
|
+
fontSize: "70% !important",
|
|
23
|
+
verticalAlign: "0.5em !important",
|
|
24
|
+
paddingRight: "0.15em"
|
|
25
|
+
},
|
|
26
|
+
"& .mq-math-mode .mq-supsub": { fontSize: "70.7% !important" },
|
|
27
|
+
"& .mq-supsub ": { fontSize: "70.7%" },
|
|
28
|
+
"& .mq-math-mode .mq-supsub.mq-sup-only": {
|
|
29
|
+
verticalAlign: "-0.1em !important",
|
|
30
|
+
"& .mq-sup": { marginBottom: "0px !important" }
|
|
31
|
+
},
|
|
32
|
+
"& .mq-math-mode .mq-fraction + .mq-supsub.mq-sup-only": { verticalAlign: "0.4em !important" },
|
|
33
|
+
"& .mq-math-mode .mq-supsub.mq-sup-only.mq-after-fraction-group": { verticalAlign: "0.4em !important" }
|
|
34
|
+
}, r = { "& *": {
|
|
35
|
+
...e,
|
|
36
|
+
...t,
|
|
37
|
+
"& .mq-math-mode .mq-sqrt-prefix": { top: "0 !important" },
|
|
38
|
+
"& .mq-math-mode .mq-empty": { padding: "9px 1px !important" },
|
|
39
|
+
"& .mq-math-mode .mq-longdiv-inner .mq-empty": { padding: "0 !important" },
|
|
40
|
+
"& .mq-math-mode .mq-supsub": { fontSize: "70.7% !important" },
|
|
41
|
+
"& .mq-math-mode .mq-sqrt-stem": {
|
|
42
|
+
marginTop: "-5px",
|
|
43
|
+
paddingTop: "4px"
|
|
44
|
+
},
|
|
45
|
+
"& .mq-math-mode .mq-paren": { verticalAlign: "middle !important" },
|
|
46
|
+
"& .mq-math-mode .mq-overarrow .mq-overarrow-inner .mq-empty": { padding: "0 !important" },
|
|
47
|
+
"& .mq-math-mode .mq-overline .mq-overline-inner .mq-empty ": { padding: "0 !important" }
|
|
48
|
+
} }, i = {
|
|
49
|
+
commonMqFontStyles: e,
|
|
50
|
+
longdivStyles: t,
|
|
51
|
+
supsubStyles: n,
|
|
52
|
+
commonMqKeyboardStyles: r
|
|
53
|
+
};
|
|
54
|
+
//#endregion
|
|
55
|
+
export { e as commonMqFontStyles, r as commonMqKeyboardStyles, i as default, t as longdivStyles, n as supsubStyles };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/custom-elements.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 registerLineBreak: (MQ: any) => void;
|
|
10
|
+
export { registerLineBreak };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/mq/custom-elements.tsx
|
|
2
|
+
var e = function(e) {
|
|
3
|
+
e.registerEmbed("newLine", () => ({
|
|
4
|
+
htmlString: "<div class=\"newLine\"></div>",
|
|
5
|
+
text: () => "testText",
|
|
6
|
+
latex: () => "\\embed{newLine}[]"
|
|
7
|
+
}));
|
|
8
|
+
};
|
|
9
|
+
//#endregion
|
|
10
|
+
export { e as registerLineBreak };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/index.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
|
+
import Input from './input.js';
|
|
10
|
+
import Static from './static.js';
|
|
11
|
+
import CommonMqStyles from './common-mq-styles.js';
|
|
12
|
+
export { Input, Static, CommonMqStyles };
|
package/dist/mq/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { __exportAll as e } from "../_virtual/_rolldown/runtime.js";
|
|
2
|
+
import { Input as t } from "./input.js";
|
|
3
|
+
import n from "./static.js";
|
|
4
|
+
import r from "./common-mq-styles.js";
|
|
5
|
+
//#region src/mq/index.ts
|
|
6
|
+
var i = /* @__PURE__ */ e({
|
|
7
|
+
CommonMqStyles: () => r,
|
|
8
|
+
Input: () => t,
|
|
9
|
+
Static: () => n
|
|
10
|
+
});
|
|
11
|
+
//#endregion
|
|
12
|
+
export { r as CommonMqStyles, t as Input, n as Static, i as mq_exports };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/input.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
|
+
/**
|
|
12
|
+
* Wrapper for MathQuill MQ.MathField.
|
|
13
|
+
*/
|
|
14
|
+
export declare class Input extends React.Component {
|
|
15
|
+
static propTypes: {
|
|
16
|
+
className: PropTypes.Requireable<string>;
|
|
17
|
+
onClick: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
onChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
latex: PropTypes.Requireable<string>;
|
|
20
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
};
|
|
23
|
+
componentDidMount(): void;
|
|
24
|
+
componentDidUpdate(): void;
|
|
25
|
+
updateLatex(): void;
|
|
26
|
+
clear(): string;
|
|
27
|
+
blur(): void;
|
|
28
|
+
focus(): void;
|
|
29
|
+
command(v: any): any;
|
|
30
|
+
keystroke(v: any): any;
|
|
31
|
+
write(v: any): any;
|
|
32
|
+
onInputEdit: any;
|
|
33
|
+
refresh: any;
|
|
34
|
+
onKeyPress: any;
|
|
35
|
+
onClick: any;
|
|
36
|
+
shouldComponentUpdate(nextProps: any): boolean;
|
|
37
|
+
render(): React.JSX.Element;
|
|
38
|
+
}
|
|
39
|
+
export default Input;
|
package/dist/mq/input.js
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
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";
|
|
7
|
+
//#region src/mq/input.tsx
|
|
8
|
+
var o = i("math-input:mq:input"), s = r("span")({}), c = class extends t.Component {
|
|
9
|
+
static propTypes = {
|
|
10
|
+
className: n.string,
|
|
11
|
+
onClick: n.func,
|
|
12
|
+
onChange: n.func,
|
|
13
|
+
latex: n.string,
|
|
14
|
+
onFocus: n.func,
|
|
15
|
+
onBlur: n.func
|
|
16
|
+
};
|
|
17
|
+
componentDidMount() {
|
|
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();
|
|
20
|
+
}
|
|
21
|
+
componentDidUpdate() {
|
|
22
|
+
this.updateLatex();
|
|
23
|
+
}
|
|
24
|
+
updateLatex() {
|
|
25
|
+
if (!this.mathField) return;
|
|
26
|
+
let { latex: e } = this.props;
|
|
27
|
+
e != null && this.mathField.latex(e);
|
|
28
|
+
}
|
|
29
|
+
clear() {
|
|
30
|
+
return this.mathField.latex(""), "";
|
|
31
|
+
}
|
|
32
|
+
blur() {
|
|
33
|
+
o("blur mathfield"), this.mathField.blur();
|
|
34
|
+
}
|
|
35
|
+
focus() {
|
|
36
|
+
o("focus mathfield..."), this.mathField.focus();
|
|
37
|
+
}
|
|
38
|
+
command(e) {
|
|
39
|
+
return o("command: ", e), Array.isArray(e) ? e.forEach((e) => {
|
|
40
|
+
this.mathField.cmd(e);
|
|
41
|
+
}) : this.mathField.cmd(e), this.mathField.focus(), this.mathField.latex();
|
|
42
|
+
}
|
|
43
|
+
keystroke(e) {
|
|
44
|
+
return this.mathField.keystroke(e), this.mathField.focus(), this.mathField.latex();
|
|
45
|
+
}
|
|
46
|
+
write(e) {
|
|
47
|
+
return o("write: ", e), this.mathField.write(e), this.mathField.focus(), this.mathField.latex();
|
|
48
|
+
}
|
|
49
|
+
onInputEdit = () => {
|
|
50
|
+
o("[onInputEdit] ...");
|
|
51
|
+
let { onChange: e } = this.props;
|
|
52
|
+
this.mathField && e && e(this.mathField.latex());
|
|
53
|
+
};
|
|
54
|
+
refresh = () => {
|
|
55
|
+
this.blur(), this.focus();
|
|
56
|
+
};
|
|
57
|
+
onKeyPress = (e) => {
|
|
58
|
+
if (Object.keys(this.mathField.__controller.options).indexOf("ignoreNextMousedown") < 0 && this.refresh(), e.charCode === 13) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
onClick = (e) => {
|
|
64
|
+
let { onClick: t } = this.props;
|
|
65
|
+
this.refresh(), t && t(e);
|
|
66
|
+
};
|
|
67
|
+
shouldComponentUpdate(e) {
|
|
68
|
+
return o("next: ", e.latex), o("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__ */ a(s, {
|
|
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 { c as Input, c as default };
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/mathquill-instance.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 let MQ: any;
|
|
12
10
|
/**
|
|
13
11
|
* Register a MathQuill embed (e.g. answer blocks in pie-elements).
|
|
14
12
|
* No-op in SSR or if the interface is unavailable.
|
|
@@ -16,13 +14,7 @@ if (typeof window !== 'undefined') {
|
|
|
16
14
|
* @param {string} name
|
|
17
15
|
* @param {Function} factory
|
|
18
16
|
*/
|
|
19
|
-
export function registerEmbed(name, factory)
|
|
20
|
-
if (!MQ || !MQ.registerEmbed) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
MQ.registerEmbed(name, factory);
|
|
24
|
-
}
|
|
25
|
-
|
|
17
|
+
export declare function registerEmbed(name: any, factory: any): void;
|
|
26
18
|
/**
|
|
27
19
|
* Apply MathQuill static math to a DOM element.
|
|
28
20
|
* Optionally sets element text to `latex` before enhancing (typical pie-elements usage).
|
|
@@ -32,14 +24,5 @@ export function registerEmbed(name, factory) {
|
|
|
32
24
|
* @param {object} [options] Optional MathQuill StaticMath options (e.g. handlers).
|
|
33
25
|
* @returns {object|undefined} MathQuill static math instance, if any.
|
|
34
26
|
*/
|
|
35
|
-
export function applyStaticMath(element, latex, options)
|
|
36
|
-
if (!MQ || !element) {
|
|
37
|
-
return undefined;
|
|
38
|
-
}
|
|
39
|
-
if (latex !== undefined && latex !== null) {
|
|
40
|
-
element.textContent = latex;
|
|
41
|
-
}
|
|
42
|
-
return MQ.StaticMath(element, options);
|
|
43
|
-
}
|
|
44
|
-
|
|
27
|
+
export declare function applyStaticMath(element: any, latex: any, options: any): any;
|
|
45
28
|
export { MQ };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { registerLineBreak as e } from "./custom-elements.js";
|
|
2
|
+
import t from "@pie-framework/mathquill";
|
|
3
|
+
//#region src/mq/mathquill-instance.ts
|
|
4
|
+
var n;
|
|
5
|
+
typeof window < "u" && (n = t.getInterface(3), n && n.registerEmbed && e(n));
|
|
6
|
+
function r(e, t) {
|
|
7
|
+
!n || !n.registerEmbed || n.registerEmbed(e, t);
|
|
8
|
+
}
|
|
9
|
+
function i(e, t, r) {
|
|
10
|
+
if (!(!n || !e)) return t != null && (e.textContent = t), n.StaticMath(e, r);
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { n as MQ, i as applyStaticMath, r as registerEmbed };
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @synced-from pie-lib/packages/math-input/src/mq/static.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 PropTypes from 'prop-types';
|
|
10
|
+
import React from 'react';
|
|
11
|
+
/**
|
|
12
|
+
* Wrapper for MathQuill MQ.MathField.
|
|
13
|
+
*/
|
|
14
|
+
export default class Static extends React.Component {
|
|
15
|
+
static propTypes: {
|
|
16
|
+
latex: PropTypes.Validator<string>;
|
|
17
|
+
onFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
18
|
+
onBlur: PropTypes.Requireable<(...args: any[]) => any>;
|
|
19
|
+
className: PropTypes.Requireable<string>;
|
|
20
|
+
getFieldName: PropTypes.Requireable<(...args: any[]) => any>;
|
|
21
|
+
onSubFieldChange: PropTypes.Requireable<(...args: any[]) => any>;
|
|
22
|
+
onSubFieldFocus: PropTypes.Requireable<(...args: any[]) => any>;
|
|
23
|
+
setInput: PropTypes.Requireable<(...args: any[]) => any>;
|
|
24
|
+
};
|
|
25
|
+
static defaultProps: {
|
|
26
|
+
getFieldName: () => void;
|
|
27
|
+
};
|
|
28
|
+
constructor(props: any);
|
|
29
|
+
componentDidMount(): void;
|
|
30
|
+
componentDidUpdate(): void;
|
|
31
|
+
componentWillUnmount(): void;
|
|
32
|
+
createLiveRegion: any;
|
|
33
|
+
addEventListeners: any;
|
|
34
|
+
removeEventListeners: any;
|
|
35
|
+
removeLiveRegion: any;
|
|
36
|
+
handleKeyDown: any;
|
|
37
|
+
handleMathKeyboardClick: any;
|
|
38
|
+
onInputEdit: any;
|
|
39
|
+
announceLatexConversion: any;
|
|
40
|
+
announceMessage: any;
|
|
41
|
+
update: any;
|
|
42
|
+
blur: any;
|
|
43
|
+
focus: any;
|
|
44
|
+
shouldComponentUpdate(nextProps: any): boolean;
|
|
45
|
+
onFocus: any;
|
|
46
|
+
render(): React.JSX.Element;
|
|
47
|
+
}
|