@pie-lib/math-input-mathlive 1.1.5-beta.8 → 2.0.1-next.20261107131445

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 (202) hide show
  1. package/README.md +84 -109
  2. package/dist/_virtual/_rolldown/runtime.js +11 -0
  3. package/dist/horizontal-keypad.d.ts +22 -0
  4. package/dist/horizontal-keypad.js +54 -0
  5. package/dist/index.d.ts +20 -0
  6. package/dist/index.js +12 -0
  7. package/dist/keypad/index.d.ts +40 -0
  8. package/dist/keypad/index.js +245 -0
  9. package/dist/keypad/keys-layout.d.ts +7 -0
  10. package/dist/keypad/keys-layout.js +5 -0
  11. package/dist/keys/basic-operators.d.ts +5 -0
  12. package/dist/keys/basic-operators.js +30 -0
  13. package/dist/keys/chars.d.ts +5 -0
  14. package/dist/keys/comparison.d.ts +4 -0
  15. package/dist/keys/comparison.js +32 -0
  16. package/dist/keys/constants.d.ts +4 -0
  17. package/dist/keys/constants.js +35 -0
  18. package/dist/keys/digits.d.ts +15 -0
  19. package/dist/keys/digits.js +34 -0
  20. package/dist/keys/edit.d.ts +6 -0
  21. package/dist/keys/edit.js +9 -0
  22. package/dist/keys/exponent.d.ts +4 -0
  23. package/dist/keys/exponent.js +28 -0
  24. package/dist/keys/fractions.d.ts +3 -0
  25. package/dist/keys/fractions.js +27 -0
  26. package/dist/keys/geometry.d.ts +23 -0
  27. package/dist/keys/geometry.js +127 -0
  28. package/dist/keys/grades.d.ts +9 -0
  29. package/dist/keys/grades.js +414 -0
  30. package/dist/keys/index.d.ts +6 -0
  31. package/dist/keys/index.js +50 -0
  32. package/dist/keys/log.d.ts +3 -0
  33. package/dist/keys/log.js +25 -0
  34. package/dist/keys/logic.d.ts +2 -0
  35. package/dist/keys/logic.js +13 -0
  36. package/dist/keys/matrices.d.ts +2 -0
  37. package/dist/keys/matrices.js +17 -0
  38. package/dist/keys/misc.d.ts +10 -0
  39. package/dist/keys/misc.js +60 -0
  40. package/dist/keys/navigation.d.ts +2 -0
  41. package/dist/keys/navigation.js +13 -0
  42. package/dist/keys/operators.d.ts +1 -0
  43. package/dist/keys/operators.js +11 -0
  44. package/dist/keys/statistics.d.ts +5 -0
  45. package/dist/keys/statistics.js +38 -0
  46. package/dist/keys/sub-sup.d.ts +2 -0
  47. package/dist/keys/sub-sup.js +17 -0
  48. package/dist/keys/trigonometry.d.ts +6 -0
  49. package/dist/keys/trigonometry.js +43 -0
  50. package/dist/keys/utils.d.ts +5 -0
  51. package/dist/keys/utils.js +24 -0
  52. package/dist/keys/vars.d.ts +3 -0
  53. package/dist/keys/vars.js +22 -0
  54. package/dist/latex-bridge.d.ts +197 -0
  55. package/dist/latex-bridge.js +210 -0
  56. package/dist/longdiv.d.ts +24 -0
  57. package/dist/longdiv.js +43 -0
  58. package/dist/math-input.d.ts +26 -0
  59. package/dist/math-input.js +74 -0
  60. package/dist/mathlive-instance.d.ts +221 -0
  61. package/dist/mathlive-instance.js +159 -0
  62. package/dist/mf/common-styles.d.ts +594 -0
  63. package/dist/mf/common-styles.js +80 -0
  64. package/dist/mf/field-label.d.ts +16 -0
  65. package/dist/mf/field-label.js +13 -0
  66. package/dist/mf/index.d.ts +4 -0
  67. package/dist/mf/index.js +21 -0
  68. package/dist/mf/input.d.ts +94 -0
  69. package/dist/mf/input.js +127 -0
  70. package/dist/mf/static.d.ts +143 -0
  71. package/dist/mf/static.js +230 -0
  72. package/dist/selection.d.ts +43 -0
  73. package/dist/selection.js +39 -0
  74. package/package.json +32 -18
  75. package/lib/__tests__/composites.test.js +0 -255
  76. package/lib/__tests__/drop-in-compat.test.js +0 -133
  77. package/lib/__tests__/embedded-fonts.test.js +0 -121
  78. package/lib/__tests__/index.test.js +0 -118
  79. package/lib/__tests__/input-imperative.test.js +0 -155
  80. package/lib/__tests__/input-selection.test.js +0 -103
  81. package/lib/__tests__/keypad-label.test.js +0 -231
  82. package/lib/__tests__/keypad-render.test.js +0 -206
  83. package/lib/__tests__/latex-bridge.test.js +0 -386
  84. package/lib/__tests__/mathlive-instance.test.js +0 -419
  85. package/lib/__tests__/mount-race.test.js +0 -218
  86. package/lib/__tests__/selection.test.js +0 -195
  87. package/lib/__tests__/static-prompts.test.js +0 -405
  88. package/lib/__tests__/tmp-markup.test.js +0 -26
  89. package/lib/horizontal-keypad.js +0 -101
  90. package/lib/horizontal-keypad.js.map +0 -1
  91. package/lib/index.js +0 -143
  92. package/lib/index.js.map +0 -1
  93. package/lib/keypad/index.js +0 -431
  94. package/lib/keypad/index.js.map +0 -1
  95. package/lib/keypad/keys-layout.js +0 -22
  96. package/lib/keypad/keys-layout.js.map +0 -1
  97. package/lib/keys/basic-operators.js +0 -33
  98. package/lib/keys/basic-operators.js.map +0 -1
  99. package/lib/keys/chars.js +0 -12
  100. package/lib/keys/chars.js.map +0 -1
  101. package/lib/keys/comparison.js +0 -39
  102. package/lib/keys/comparison.js.map +0 -1
  103. package/lib/keys/constants.js +0 -37
  104. package/lib/keys/constants.js.map +0 -1
  105. package/lib/keys/digits.js +0 -46
  106. package/lib/keys/digits.js.map +0 -1
  107. package/lib/keys/edit.js +0 -14
  108. package/lib/keys/edit.js.map +0 -1
  109. package/lib/keys/exponent.js +0 -30
  110. package/lib/keys/exponent.js.map +0 -1
  111. package/lib/keys/fractions.js +0 -29
  112. package/lib/keys/fractions.js.map +0 -1
  113. package/lib/keys/geometry.js +0 -143
  114. package/lib/keys/geometry.js.map +0 -1
  115. package/lib/keys/grades.js +0 -259
  116. package/lib/keys/grades.js.map +0 -1
  117. package/lib/keys/index.js +0 -35
  118. package/lib/keys/index.js.map +0 -1
  119. package/lib/keys/log.js +0 -27
  120. package/lib/keys/log.js.map +0 -1
  121. package/lib/keys/logic.js +0 -19
  122. package/lib/keys/logic.js.map +0 -1
  123. package/lib/keys/matrices.js +0 -19
  124. package/lib/keys/matrices.js.map +0 -1
  125. package/lib/keys/misc.js +0 -69
  126. package/lib/keys/misc.js.map +0 -1
  127. package/lib/keys/navigation.js +0 -20
  128. package/lib/keys/navigation.js.map +0 -1
  129. package/lib/keys/operators.js +0 -15
  130. package/lib/keys/operators.js.map +0 -1
  131. package/lib/keys/statistics.js +0 -40
  132. package/lib/keys/statistics.js.map +0 -1
  133. package/lib/keys/sub-sup.js +0 -19
  134. package/lib/keys/sub-sup.js.map +0 -1
  135. package/lib/keys/trigonometry.js +0 -45
  136. package/lib/keys/trigonometry.js.map +0 -1
  137. package/lib/keys/utils.js +0 -87
  138. package/lib/keys/utils.js.map +0 -1
  139. package/lib/keys/vars.js +0 -24
  140. package/lib/keys/vars.js.map +0 -1
  141. package/lib/latex-bridge.js +0 -445
  142. package/lib/latex-bridge.js.map +0 -1
  143. package/lib/math-input.js +0 -143
  144. package/lib/math-input.js.map +0 -1
  145. package/lib/mathlive-instance.js +0 -585
  146. package/lib/mathlive-instance.js.map +0 -1
  147. package/lib/mf/common-styles.js +0 -203
  148. package/lib/mf/common-styles.js.map +0 -1
  149. package/lib/mf/index.js +0 -84
  150. package/lib/mf/index.js.map +0 -1
  151. package/lib/mf/input.js +0 -372
  152. package/lib/mf/input.js.map +0 -1
  153. package/lib/mf/static.js +0 -500
  154. package/lib/mf/static.js.map +0 -1
  155. package/lib/selection.js +0 -148
  156. package/lib/selection.js.map +0 -1
  157. package/src/__tests__/composites.test.jsx +0 -220
  158. package/src/__tests__/drop-in-compat.test.jsx +0 -112
  159. package/src/__tests__/index.test.jsx +0 -109
  160. package/src/__tests__/input-imperative.test.jsx +0 -144
  161. package/src/__tests__/input-selection.test.jsx +0 -64
  162. package/src/__tests__/keypad-label.test.jsx +0 -283
  163. package/src/__tests__/keypad-render.test.jsx +0 -123
  164. package/src/__tests__/latex-bridge.test.js +0 -359
  165. package/src/__tests__/mathlive-instance.test.js +0 -418
  166. package/src/__tests__/mount-race.test.jsx +0 -142
  167. package/src/__tests__/selection.test.js +0 -212
  168. package/src/__tests__/static-prompts.test.jsx +0 -364
  169. package/src/horizontal-keypad.jsx +0 -73
  170. package/src/index.jsx +0 -63
  171. package/src/keypad/index.jsx +0 -386
  172. package/src/keypad/keys-layout.js +0 -16
  173. package/src/keys/basic-operators.js +0 -32
  174. package/src/keys/chars.js +0 -5
  175. package/src/keys/comparison.js +0 -28
  176. package/src/keys/constants.js +0 -35
  177. package/src/keys/digits.js +0 -40
  178. package/src/keys/edit.js +0 -3
  179. package/src/keys/exponent.js +0 -28
  180. package/src/keys/fractions.js +0 -26
  181. package/src/keys/geometry.js +0 -149
  182. package/src/keys/grades.js +0 -367
  183. package/src/keys/index.js +0 -20
  184. package/src/keys/log.js +0 -22
  185. package/src/keys/logic.js +0 -15
  186. package/src/keys/matrices.js +0 -15
  187. package/src/keys/misc.js +0 -71
  188. package/src/keys/navigation.js +0 -8
  189. package/src/keys/operators.js +0 -10
  190. package/src/keys/statistics.js +0 -38
  191. package/src/keys/sub-sup.js +0 -15
  192. package/src/keys/trigonometry.js +0 -15
  193. package/src/keys/utils.js +0 -66
  194. package/src/keys/vars.js +0 -19
  195. package/src/latex-bridge.js +0 -449
  196. package/src/math-input.jsx +0 -115
  197. package/src/mathlive-instance.js +0 -582
  198. package/src/mf/common-styles.js +0 -210
  199. package/src/mf/index.js +0 -30
  200. package/src/mf/input.jsx +0 -328
  201. package/src/mf/static.jsx +0 -479
  202. package/src/selection.js +0 -146
@@ -1,149 +0,0 @@
1
- const set = (o) => ({ ...o, category: 'geometry' });
2
-
3
- export const overline = set({
4
- name: 'Line',
5
- latex: '\\overline{}',
6
- command: '\\overline',
7
- });
8
-
9
- export const overRightArrow = set({
10
- name: 'Ray',
11
- latex: '\\overrightarrow{}',
12
- command: '\\overrightarrow',
13
- });
14
-
15
- export const overLeftRightArrow = set({
16
- name: 'Segment',
17
- // MathQuill needed a nested \overline{} to draw the empty box; MathLive
18
- // renders that as a real line, so the label showed a spurious bar under the
19
- // arrows. `withVisibleEmptySlots` supplies the box for `{}` instead.
20
- latex: '\\overleftrightarrow{}',
21
- symbol: 'AB',
22
- command: '\\overleftrightarrow',
23
- });
24
-
25
- export const segment = set({
26
- name: 'Segment',
27
- latex: '\\overleftrightarrow{AB}',
28
- write: '\\overleftrightarrow{AB}',
29
- label: 'AB',
30
- });
31
-
32
- export const parallel = set({
33
- name: 'Parallel',
34
- latex: '\\parallel',
35
- command: '\\parallel',
36
- });
37
-
38
- export const notParallel = set({
39
- name: 'Not Parallel',
40
- latex: '\\nparallel',
41
- command: '\\nparallel',
42
- });
43
-
44
- export const perpindicular = set({
45
- name: 'Perpendicular',
46
- latex: '\\perp',
47
- command: '\\perpendicular',
48
- });
49
-
50
- export const angle = set({
51
- name: 'Angle',
52
- latex: '\\angle',
53
- command: '\\angle',
54
- });
55
- export const overArc = set({
56
- name: 'Over arc',
57
- // See the note on Segment above: the nested \overline{} drew a straight line
58
- // instead of leaving the arc visible.
59
- latex: '\\overarc{}',
60
- command: '\\overarc',
61
- });
62
- export const measureOfAngle = set({
63
- name: 'Measured Angle',
64
- latex: '\\measuredangle',
65
- command: ['m', '\\angle'],
66
- });
67
-
68
- export const triangle = set({
69
- name: 'Triangle',
70
- latex: '\\triangle',
71
- command: '\\triangle',
72
- });
73
-
74
- export const square = set({
75
- name: 'Square',
76
- latex: '\\square',
77
- command: '\\square',
78
- });
79
-
80
- export const parallelogram = set({
81
- name: 'Parallelogram',
82
- latex: '\\parallelogram',
83
- command: '\\parallelogram',
84
- });
85
-
86
- export const circledDot = set({
87
- name: 'Circled Dot',
88
- latex: '\\odot',
89
- command: '\\odot',
90
- });
91
-
92
- export const degree = set({
93
- name: 'Degree',
94
- latex: '\\degree',
95
- command: '\\degree',
96
- });
97
-
98
- export const similarTo = set({
99
- name: 'Similar',
100
- command: '\\sim',
101
- latex: '\\sim',
102
- });
103
-
104
- export const congruentTo = set({
105
- name: 'Congruent To',
106
- command: '\\cong',
107
- latex: '\\cong',
108
- });
109
-
110
- export const notCongruentTo = set({
111
- name: 'Not Congruent To',
112
- command: '\\ncong',
113
- latex: '\\ncong',
114
- });
115
-
116
- export const primeArcminute = set({
117
- name: 'Prime',
118
- label: 'pam',
119
- // eslint-disable-next-line
120
- latex: "'",
121
- // eslint-disable-next-line
122
- write: "'",
123
- });
124
-
125
- export const doublePrimeArcSecond = set({
126
- name: 'Double Prime',
127
- // eslint-disable-next-line
128
- latex: "''",
129
- // eslint-disable-next-line
130
- write: "''",
131
- });
132
-
133
- export const leftArrow = set({
134
- name: 'Left Arrow',
135
- latex: '\\leftarrow',
136
- command: '\\leftarrow',
137
- });
138
-
139
- export const rightArrow = set({
140
- name: 'Right Arrow',
141
- latex: '\\rightarrow',
142
- command: '\\rightarrow',
143
- });
144
-
145
- export const leftrightArrow = set({
146
- name: 'Left and Right Arrow',
147
- latex: '\\leftrightarrow',
148
- command: '\\leftrightarrow',
149
- });
@@ -1,367 +0,0 @@
1
- import * as comparison from './comparison';
2
- import * as vars from './vars';
3
- import * as fractions from './fractions';
4
- import * as exponent from './exponent';
5
- import * as misc from './misc';
6
- import * as constants from './constants';
7
- import * as trigonometry from './trigonometry';
8
- import * as geometry from './geometry';
9
- import * as operators from './operators';
10
- import * as log from './log';
11
- import * as subSup from './sub-sup';
12
- import * as statistics from './statistics';
13
- import * as basicOperators from './basic-operators';
14
- import * as matrices from './matrices';
15
- import digits from './digits';
16
- import * as logic from './logic';
17
- import * as nav from './navigation';
18
- import * as edit from './edit';
19
-
20
- const hs = [
21
- [fractions.blankOverBlank, misc.percentage, vars.x, exponent.squared, exponent.squareRoot],
22
- [operators.circleDot, vars.y, subSup.subscript, exponent.xToPowerOfN, exponent.nthRoot],
23
- [misc.plusMinus, comparison.lessThan, comparison.greaterThan, comparison.lessThanEqual, comparison.greaterThanEqual],
24
- [constants.pi, vars.theta, misc.parenthesis, misc.brackets, misc.absValue],
25
- [misc.notEqual, trigonometry.sin, trigonometry.cos, trigonometry.tan, geometry.degree],
26
- ];
27
-
28
- const advancedAlgebra = (() => {
29
- const out = [...hs.map((arr) => [...arr])];
30
-
31
- out[0].push({ name: 'i', latex: 'i', write: 'i' });
32
- out[1].push(log.log);
33
- out[2].push(log.logSubscript);
34
- out[3].push(log.ln);
35
- out[4].push(constants.eulers);
36
- return out;
37
- })();
38
-
39
- const statisticsSet = (() => {
40
- const out = [...hs.map((arr) => [...arr])];
41
- out[0].push(statistics.mu);
42
- out[1].push(statistics.xBar);
43
- out[2].push(statistics.yBar);
44
- out[3].push(statistics.sigma);
45
- out[4].push(statistics.smallSigma);
46
- return out;
47
- })();
48
-
49
- export const gradeSets = [
50
- {
51
- predicate: (n) => n >= 3 && n <= 5,
52
- set: [
53
- [comparison.lessThan, comparison.greaterThan],
54
- [fractions.xOverBlank, fractions.xBlankBlank],
55
- [vars.x, logic.longDivision],
56
- [exponent.squared, exponent.xToPowerOfN],
57
- ],
58
- },
59
- {
60
- predicate: (n) => n >= 6 && n <= 7,
61
- set: [
62
- [geometry.degree, comparison.lessThan, comparison.greaterThan],
63
- [operators.circleDot, comparison.lessThanEqual, comparison.greaterThanEqual],
64
- [vars.x, vars.y, exponent.squared, exponent.xToPowerOfN],
65
- [misc.plusMinus, fractions.xOverBlank, fractions.xBlankBlank, exponent.squareRoot],
66
- [constants.pi, misc.parenthesis, misc.absValue, exponent.nthRoot],
67
- ],
68
- },
69
- {
70
- predicate: (n) => n >= 8 || n === 'HS',
71
- set: hs,
72
- },
73
- {
74
- predicate: 'non-negative-integers',
75
- set: [
76
- [digits.seven, digits.eight, digits.nine],
77
- [digits.four, digits.five, digits.six],
78
- [digits.one, digits.two, digits.three],
79
- [digits.zero, { name: '', latex: '', write: '' }, { name: '', latex: '', write: '' }],
80
- [nav.left, nav.right, edit.del],
81
- ],
82
- },
83
- {
84
- predicate: 'integers',
85
- set: [
86
- [digits.seven, digits.eight, digits.nine],
87
- [digits.four, digits.five, digits.six],
88
- [digits.one, digits.two, digits.three],
89
- [digits.zero, { name: '', latex: '', write: '' }, basicOperators.minus],
90
- [nav.left, nav.right, edit.del],
91
- ],
92
- },
93
- {
94
- predicate: 'decimals',
95
- set: [
96
- [digits.seven, digits.eight, digits.nine],
97
- [digits.four, digits.five, digits.six],
98
- [digits.one, digits.two, digits.three],
99
- [digits.zero, digits.decimalPoint, basicOperators.minus],
100
- [nav.left, nav.right, edit.del],
101
- ],
102
- },
103
- {
104
- predicate: 'fractions',
105
- set: [
106
- [digits.seven, digits.eight, digits.nine],
107
- [digits.four, digits.five, digits.six],
108
- [digits.one, digits.two, digits.three],
109
- [digits.zero, fractions.blankOverBlank, basicOperators.minus],
110
- [nav.left, nav.right, edit.del],
111
- ],
112
- },
113
- {
114
- predicate: 'geometry',
115
- set: [
116
- [
117
- fractions.blankOverBlank,
118
- geometry.degree,
119
- geometry.primeArcminute,
120
- geometry.doublePrimeArcSecond,
121
- geometry.congruentTo,
122
- geometry.similarTo,
123
- ],
124
- [
125
- operators.circleDot,
126
- geometry.angle,
127
- geometry.measureOfAngle,
128
- geometry.triangle,
129
- geometry.notCongruentTo,
130
- misc.notSimilar,
131
- ],
132
- [trigonometry.sin, trigonometry.cos, trigonometry.tan, constants.pi, exponent.squareRoot, exponent.nthRoot],
133
- [trigonometry.csc, trigonometry.sec, trigonometry.cot, vars.theta, subSup.subscript, exponent.xToPowerOfN],
134
- [
135
- geometry.overline,
136
- geometry.overRightArrow,
137
- geometry.overLeftRightArrow,
138
- geometry.overArc,
139
- geometry.perpindicular,
140
- geometry.parallel,
141
- ],
142
- ],
143
- },
144
- // {
145
- // predicate: 'miscellaneous',
146
- // set: [
147
- // [
148
- // subSup.superscript,
149
- // subSup.subscript,
150
- // fractions.blankOverBlank,
151
- // misc.percentage,
152
- // geometry.segment,
153
- // geometry.parallel
154
- // ],
155
- // [
156
- // exponent.squareRoot,
157
- // exponent.nthRoot,
158
- // misc.absValue,
159
- // misc.parenthesis,
160
- // geometry.perpindicular,
161
- // geometry.angle
162
- // ],
163
- // [
164
- // comparison.lessThan,
165
- // comparison.greaterThan,
166
- // geometry.degree,
167
- // misc.approx,
168
- // geometry.measureOfAngle,
169
- // geometry.triangle
170
- // ],
171
- // [
172
- // misc.nApprox,
173
- // misc.notEqual,
174
- // geometry.congruentTo,
175
- // geometry.notCongruentTo,
176
- // geometry.parallelogram,
177
- // geometry.circledDot
178
- // ],
179
- // [
180
- // misc.similar,
181
- // misc.notSimilar,
182
- // comparison.lessThanEqual,
183
- // comparison.greaterThanEqual,
184
- // vars.x,
185
- // vars.y
186
- // ]
187
- // ]
188
- // },
189
- // {
190
- // predicate: 'everything',
191
- // set: [
192
- // [
193
- // subSup.superscript,
194
- // subSup.subscript,
195
- // fractions.blankOverBlank,
196
- // misc.percentage,
197
- // geometry.segment,
198
- // geometry.parallel
199
- // ],
200
- // [
201
- // exponent.squareRoot,
202
- // exponent.nthRoot,
203
- // misc.absValue,
204
- // misc.parenthesis,
205
- // geometry.perpindicular,
206
- // geometry.angle
207
- // ],
208
- // [
209
- // comparison.lessThan,
210
- // comparison.greaterThan,
211
- // geometry.degree,
212
- // misc.approx,
213
- // geometry.measureOfAngle,
214
- // geometry.triangle
215
- // ],
216
- // [
217
- // misc.nApprox,
218
- // misc.notEqual,
219
- // geometry.congruentTo,
220
- // geometry.notCongruentTo,
221
- // geometry.parallelogram,
222
- // geometry.circledDot
223
- // ],
224
- // [
225
- // misc.similar,
226
- // misc.notSimilar,
227
- // comparison.lessThanEqual,
228
- // comparison.greaterThanEqual,
229
- // vars.x,
230
- // vars.y
231
- // ]
232
- // ]
233
- // },
234
- {
235
- predicate: 'advanced-algebra',
236
- set: advancedAlgebra,
237
- },
238
- {
239
- predicate: 'statistics',
240
- set: statisticsSet,
241
- },
242
- {
243
- predicate: 'item-authoring',
244
- set: [
245
- [
246
- basicOperators.divide,
247
- fractions.blankOverBlank,
248
- logic.longDivision,
249
- constants.halfInfinity,
250
- exponent.squared,
251
- exponent.squareRoot,
252
- geometry.overline,
253
- geometry.overRightArrow,
254
- geometry.overLeftRightArrow,
255
- log.log,
256
- ],
257
- [
258
- basicOperators.multiply,
259
- operators.circleDot,
260
- { name: '', latex: '', write: '' },
261
- subSup.subscript,
262
- exponent.xToPowerOfN,
263
- exponent.nthRoot,
264
- geometry.perpindicular,
265
- geometry.parallel,
266
- geometry.overArc,
267
- log.logSubscript,
268
- ],
269
- [
270
- misc.plusMinus,
271
- constants.pi,
272
- vars.theta,
273
- geometry.degree,
274
- geometry.angle,
275
- geometry.leftArrow,
276
- geometry.rightArrow,
277
- geometry.triangle,
278
- geometry.square,
279
- log.ln,
280
- ],
281
- [
282
- misc.notEqual,
283
- misc.absValue,
284
- statistics.smallSigma,
285
- statistics.mu,
286
- logic.therefore,
287
- statistics.sigma,
288
- geometry.leftrightArrow,
289
- trigonometry.sin,
290
- trigonometry.cos,
291
- trigonometry.tan,
292
- ],
293
- [
294
- comparison.lessThanEqual,
295
- comparison.greaterThanEqual,
296
- { name: '', latex: '', write: '' },
297
- { name: '', latex: '', write: '' },
298
- constants.infinity,
299
- { name: '', latex: '', write: '' },
300
- { name: '', latex: '', write: '' },
301
- trigonometry.csc,
302
- trigonometry.sec,
303
- trigonometry.cot,
304
- ],
305
- ],
306
- },
307
- // for grade 1-2, we want to display the base set only
308
- // we need it here because we don't want to display the default set (grade 8)
309
- {
310
- predicate: (n) => n >= 1 && n <= 2,
311
- set: [],
312
- },
313
- ];
314
-
315
- export const keysForGrade = (n) => {
316
- const number = parseInt(n, 10);
317
- n = isNaN(number) ? n : number;
318
- if (!n) {
319
- return [];
320
- }
321
-
322
- const match = gradeSets.find((gs) => {
323
- if (typeof gs.predicate === 'string') {
324
- return gs.predicate === n;
325
- } else {
326
- return gs.predicate(n);
327
- }
328
- });
329
-
330
- if (match) {
331
- return match.set || [];
332
- }
333
-
334
- // if the grade is not found, return the default set which is grade 8 (as per PD-3549), for mode language it is not the default
335
- if (n !== 'language') {
336
- return gradeSets[2].set;
337
- }
338
- };
339
-
340
- const ALL_KEYS = [
341
- ...Object.values(basicOperators),
342
- ...Object.values(comparison),
343
- ...Object.values(constants),
344
- ...Object.values(digits),
345
- ...Object.values(exponent),
346
- ...Object.values(fractions),
347
- ...Object.values(geometry),
348
- ...Object.values(log),
349
- ...Object.values(matrices),
350
- ...Object.values(misc),
351
- ...Object.values(operators),
352
- ...Object.values(statistics),
353
- ...Object.values(subSup),
354
- ...Object.values(trigonometry),
355
- ...Object.values(vars),
356
- ];
357
-
358
- export const normalizeAdditionalKeys = (additionalKeys) => {
359
- return (additionalKeys || []).map((additionalkey) => {
360
- const { latex } = additionalkey;
361
- const predefinedKey = (ALL_KEYS || []).find(
362
- (key) => latex === key.latex || latex === key.write || latex === key.command || latex === key.otherNotation,
363
- );
364
-
365
- return !latex ? additionalkey : predefinedKey || additionalkey;
366
- });
367
- };
package/src/keys/index.js DELETED
@@ -1,20 +0,0 @@
1
- import digits from './digits';
2
- import * as nav from './navigation';
3
- import * as edit from './edit';
4
- import { divide, equals, minus, multiply, plus } from './basic-operators';
5
- import * as comparison from './comparison';
6
- import * as fractions from './fractions';
7
- import * as exponent from './exponent';
8
- import * as misc from './misc';
9
-
10
- const { one, two, three, four, five, six, seven, eight, nine, zero, comma, decimalPoint } = digits;
11
-
12
- export const baseSet = [
13
- [seven, eight, nine, divide],
14
- [four, five, six, multiply],
15
- [one, two, three, minus],
16
- [zero, decimalPoint, comma, plus],
17
- [nav.left, nav.right, edit.del, equals],
18
- ];
19
-
20
- export { comparison, fractions, exponent, misc };
package/src/keys/log.js DELETED
@@ -1,22 +0,0 @@
1
- import { mkSet } from './utils';
2
-
3
- const set = mkSet('log');
4
-
5
- export const log = set({
6
- name: 'Log',
7
- label: 'log',
8
- command: '\\log',
9
- latex: '\\log',
10
- });
11
- export const logSubscript = set({
12
- name: 'log base n',
13
- label: 'log s',
14
- latex: '\\log_{}',
15
- command: ['\\log', '_'],
16
- });
17
- export const ln = set({
18
- name: 'natural log',
19
- label: 'ln',
20
- command: '\\ln',
21
- latex: '\\ln',
22
- });
package/src/keys/logic.js DELETED
@@ -1,15 +0,0 @@
1
- import { mkSet } from './utils';
2
-
3
- const set = mkSet('logic');
4
-
5
- export const therefore = set({
6
- name: 'Therefore',
7
- label: '∴',
8
- write: '∴',
9
- });
10
-
11
- export const longDivision = set({
12
- name: 'Long division',
13
- latex: '\\longdiv{}',
14
- command: '\\longdiv',
15
- });
@@ -1,15 +0,0 @@
1
- import { mkSet } from './utils';
2
-
3
- const set = mkSet('matrices');
4
-
5
- export const singleCellMatrix = set({
6
- name: 'Single Cell Matrix',
7
- label: '[ ]',
8
- write: '\\begin{pmatrix}\\end{pmatrix}',
9
- });
10
-
11
- export const doubleCellMatrix = set({
12
- name: 'Double Cell Matrix',
13
- label: '[ ] [ ] \\\\newline [ ] [ ]',
14
- write: '\\begin{bmatrix}&\\\\&\\end{bmatrix}',
15
- });
package/src/keys/misc.js DELETED
@@ -1,71 +0,0 @@
1
- import { mkSet } from './utils';
2
-
3
- const set = mkSet('misc');
4
-
5
- export const plusMinus = set({
6
- name: 'Plus or Minus',
7
- latex: '\\pm',
8
- write: '\\pm',
9
- });
10
-
11
- export const absValue = set({
12
- name: 'Absolute Value',
13
- latex: '\\abs{}',
14
- symbol: '| |',
15
- command: '|',
16
- });
17
-
18
- export const parenthesis = set({
19
- name: 'Parenthesis',
20
- latex: '\\left(\\right)',
21
- symbol: '( )',
22
- command: '(',
23
- });
24
-
25
- export const brackets = set({
26
- name: 'Brackets',
27
- latex: '\\left[\\right]',
28
- symbol: '[ ]',
29
- command: '[',
30
- });
31
-
32
- // `%` must be escaped. MathQuill was not a real LaTeX parser: it defined
33
- // `LatexCmds['%']` as a symbol that *serialised* to `\%`, so a bare `%` worked
34
- // both as a label and as a command. MathLive parses LaTeX properly, where `%`
35
- // begins a comment - it rendered nothing (a blank button) and, once inserted,
36
- // silently swallowed the rest of the expression. `\%` is what MathQuill stored
37
- // all along, so this changes the key only, not the saved latex.
38
- export const percentage = set({
39
- name: 'Percent',
40
- latex: '\\%',
41
- command: '\\%',
42
- });
43
-
44
- export const approx = set({
45
- latex: '\\approx',
46
- command: '\\approx',
47
- ariaLabel: 'Approximately equal to',
48
- });
49
-
50
- export const nApprox = set({
51
- latex: '\\napprox',
52
- command: '\\napprox',
53
- ariaLabel: 'Not pproximately equal to',
54
- });
55
-
56
- export const notEqual = set({
57
- latex: '\\neq',
58
- command: '\\neq',
59
- ariaLabel: 'Not equals',
60
- });
61
-
62
- export const similar = set({
63
- latex: '\\sim',
64
- command: '\\sim',
65
- ariaLabel: 'Similar',
66
- });
67
- export const notSimilar = set({
68
- latex: '\\nsim',
69
- command: '\\nsim',
70
- ariaLabel: 'Not similar',
71
- });
@@ -1,8 +0,0 @@
1
- import { LEFT_ARROW, RIGHT_ARROW } from './chars';
2
- import { mkSet } from './utils';
3
-
4
- const set = mkSet('navigation');
5
-
6
- export const left = set({ label: LEFT_ARROW, keystroke: 'Left', ariaLabel: 'Move cursor left' });
7
-
8
- export const right = set({ label: RIGHT_ARROW, keystroke: 'Right', ariaLabel: 'Move cursor right' });
@@ -1,10 +0,0 @@
1
- import { mkSet } from './utils';
2
-
3
- const set = mkSet('operators');
4
-
5
- export const circleDot = set({
6
- name: 'CircleDot',
7
- label: '⋅',
8
- write: '\\cdot',
9
- ariaLabel: 'Dot multiplier',
10
- });