@pie-lib/math-input-mathlive 1.1.5-beta.9 → 2.0.1-next.20261109072207

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 (195) 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__/keypad-label.test.js +0 -231
  81. package/lib/__tests__/keypad-render.test.js +0 -206
  82. package/lib/__tests__/latex-bridge.test.js +0 -386
  83. package/lib/__tests__/mathlive-instance.test.js +0 -419
  84. package/lib/__tests__/mount-race.test.js +0 -218
  85. package/lib/__tests__/static-prompts.test.js +0 -405
  86. package/lib/__tests__/tmp-markup.test.js +0 -26
  87. package/lib/horizontal-keypad.js +0 -101
  88. package/lib/horizontal-keypad.js.map +0 -1
  89. package/lib/index.js +0 -143
  90. package/lib/index.js.map +0 -1
  91. package/lib/keypad/index.js +0 -431
  92. package/lib/keypad/index.js.map +0 -1
  93. package/lib/keypad/keys-layout.js +0 -22
  94. package/lib/keypad/keys-layout.js.map +0 -1
  95. package/lib/keys/basic-operators.js +0 -33
  96. package/lib/keys/basic-operators.js.map +0 -1
  97. package/lib/keys/chars.js +0 -12
  98. package/lib/keys/chars.js.map +0 -1
  99. package/lib/keys/comparison.js +0 -39
  100. package/lib/keys/comparison.js.map +0 -1
  101. package/lib/keys/constants.js +0 -37
  102. package/lib/keys/constants.js.map +0 -1
  103. package/lib/keys/digits.js +0 -46
  104. package/lib/keys/digits.js.map +0 -1
  105. package/lib/keys/edit.js +0 -14
  106. package/lib/keys/edit.js.map +0 -1
  107. package/lib/keys/exponent.js +0 -30
  108. package/lib/keys/exponent.js.map +0 -1
  109. package/lib/keys/fractions.js +0 -29
  110. package/lib/keys/fractions.js.map +0 -1
  111. package/lib/keys/geometry.js +0 -143
  112. package/lib/keys/geometry.js.map +0 -1
  113. package/lib/keys/grades.js +0 -259
  114. package/lib/keys/grades.js.map +0 -1
  115. package/lib/keys/index.js +0 -35
  116. package/lib/keys/index.js.map +0 -1
  117. package/lib/keys/log.js +0 -27
  118. package/lib/keys/log.js.map +0 -1
  119. package/lib/keys/logic.js +0 -19
  120. package/lib/keys/logic.js.map +0 -1
  121. package/lib/keys/matrices.js +0 -19
  122. package/lib/keys/matrices.js.map +0 -1
  123. package/lib/keys/misc.js +0 -69
  124. package/lib/keys/misc.js.map +0 -1
  125. package/lib/keys/navigation.js +0 -20
  126. package/lib/keys/navigation.js.map +0 -1
  127. package/lib/keys/operators.js +0 -15
  128. package/lib/keys/operators.js.map +0 -1
  129. package/lib/keys/statistics.js +0 -40
  130. package/lib/keys/statistics.js.map +0 -1
  131. package/lib/keys/sub-sup.js +0 -19
  132. package/lib/keys/sub-sup.js.map +0 -1
  133. package/lib/keys/trigonometry.js +0 -45
  134. package/lib/keys/trigonometry.js.map +0 -1
  135. package/lib/keys/utils.js +0 -87
  136. package/lib/keys/utils.js.map +0 -1
  137. package/lib/keys/vars.js +0 -24
  138. package/lib/keys/vars.js.map +0 -1
  139. package/lib/latex-bridge.js +0 -508
  140. package/lib/latex-bridge.js.map +0 -1
  141. package/lib/math-input.js +0 -143
  142. package/lib/math-input.js.map +0 -1
  143. package/lib/mathlive-instance.js +0 -585
  144. package/lib/mathlive-instance.js.map +0 -1
  145. package/lib/mf/common-styles.js +0 -203
  146. package/lib/mf/common-styles.js.map +0 -1
  147. package/lib/mf/index.js +0 -84
  148. package/lib/mf/index.js.map +0 -1
  149. package/lib/mf/input.js +0 -364
  150. package/lib/mf/input.js.map +0 -1
  151. package/lib/mf/static.js +0 -500
  152. package/lib/mf/static.js.map +0 -1
  153. package/src/__tests__/composites.test.jsx +0 -220
  154. package/src/__tests__/drop-in-compat.test.jsx +0 -112
  155. package/src/__tests__/index.test.jsx +0 -109
  156. package/src/__tests__/input-imperative.test.jsx +0 -144
  157. package/src/__tests__/keypad-label.test.jsx +0 -283
  158. package/src/__tests__/keypad-render.test.jsx +0 -123
  159. package/src/__tests__/latex-bridge.test.js +0 -389
  160. package/src/__tests__/mathlive-instance.test.js +0 -418
  161. package/src/__tests__/mount-race.test.jsx +0 -142
  162. package/src/__tests__/static-prompts.test.jsx +0 -364
  163. package/src/horizontal-keypad.jsx +0 -73
  164. package/src/index.jsx +0 -63
  165. package/src/keypad/index.jsx +0 -386
  166. package/src/keypad/keys-layout.js +0 -16
  167. package/src/keys/basic-operators.js +0 -32
  168. package/src/keys/chars.js +0 -5
  169. package/src/keys/comparison.js +0 -28
  170. package/src/keys/constants.js +0 -35
  171. package/src/keys/digits.js +0 -40
  172. package/src/keys/edit.js +0 -3
  173. package/src/keys/exponent.js +0 -28
  174. package/src/keys/fractions.js +0 -26
  175. package/src/keys/geometry.js +0 -149
  176. package/src/keys/grades.js +0 -367
  177. package/src/keys/index.js +0 -20
  178. package/src/keys/log.js +0 -22
  179. package/src/keys/logic.js +0 -15
  180. package/src/keys/matrices.js +0 -15
  181. package/src/keys/misc.js +0 -71
  182. package/src/keys/navigation.js +0 -8
  183. package/src/keys/operators.js +0 -10
  184. package/src/keys/statistics.js +0 -38
  185. package/src/keys/sub-sup.js +0 -15
  186. package/src/keys/trigonometry.js +0 -15
  187. package/src/keys/utils.js +0 -66
  188. package/src/keys/vars.js +0 -19
  189. package/src/latex-bridge.js +0 -524
  190. package/src/math-input.jsx +0 -115
  191. package/src/mathlive-instance.js +0 -582
  192. package/src/mf/common-styles.js +0 -210
  193. package/src/mf/index.js +0 -30
  194. package/src/mf/input.jsx +0 -319
  195. package/src/mf/static.jsx +0 -479
@@ -1,203 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.supsubStyles = exports.rootIndexStyles = exports.placeholderStyles = exports.parallelStyles = exports.longdivStyles = exports["default"] = exports.commonMqKeyboardStyles = exports.commonMqFontStyles = exports.commonMathLiveStyles = exports.commonKeyboardStyles = exports.ROOT_INDEX_CSS = exports.PARALLEL_CSS = void 0;
8
- var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
9
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
10
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { (0, _defineProperty2["default"])(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
11
- /**
12
- * Shared MathLive styling.
13
- *
14
- * Replaces @pie-lib/math-input's `common-mq-styles.js`. That file was built
15
- * around MathQuill's `.mq-*` class names, none of which exist in MathLive
16
- * output, so the selectors here target MathLive's own structure instead.
17
- *
18
- * The four named groups are kept because consumers destructure them:
19
- *
20
- * const { commonMqFontStyles, commonMqKeyboardStyles, longdivStyles, supsubStyles }
21
- * = mq.CommonMqStyles; // math-toolbar/src/editor-and-pad.jsx, math-preview.jsx
22
- *
23
- * Most are intentionally near-empty: MathLive sizes scripts, radicals and
24
- * fences correctly on its own, so the MathQuill-era corrections are not needed.
25
- * They stay as documented extension points rather than being deleted, so the
26
- * destructuring above keeps working. The exception is the radical index, which
27
- * MathLive sizes to TeX metrics that read too small here - see
28
- * `rootIndexStyles`.
29
- */
30
-
31
- /**
32
- * Font styling. MathQuill needed explicit MathJax font families to match the
33
- * static renderer; MathLive ships the KaTeX fonts it renders with, so this only
34
- * smooths rendering and lets the host override the family.
35
- */
36
- var commonMqFontStyles = exports.commonMqFontStyles = {
37
- '-webkit-font-smoothing': 'antialiased',
38
- '& math-field': {
39
- fontFamily: 'inherit'
40
- }
41
- };
42
-
43
- /**
44
- * Long division. The MathQuill fork drew this with nested `.mq-longdiv-*`
45
- * elements that needed manual offsets; here it comes from the `\longdiv` macro
46
- * (see `PIE_MACROS`), tagged with `data-pie-macro="longdiv"`.
47
- */
48
- var longdivStyles = exports.longdivStyles = {
49
- '& [data-pie-macro="longdiv"]': {
50
- display: 'inline-flex'
51
- }
52
- };
53
-
54
- /**
55
- * How the index of a radical is sized.
56
- *
57
- * MathLive follows TeX and sets the index of `\sqrt[n]{x}` in scriptscriptstyle,
58
- * which it emits as an inline `font-size: 50%` on the span wrapping the index's
59
- * glyphs. At authoring sizes that leaves the index - on the nth-root key, and in
60
- * any radical the author types - too small to read next to the radicand, so it is
61
- * scaled up to 80% - 1.6x what MathLive asks for.
62
- *
63
- * Only that innermost span is resized. `.ML__sqrt-index` itself keeps its font
64
- * size on purpose: the vlist inside it tucks the index into the radical's crook
65
- * with em-based `top`/`height` offsets, and scaling those lifts the index clear
66
- * of the radical instead of just enlarging it.
67
- *
68
- * The child chain is spelled out so that nothing nested deeper inside the index
69
- * (a fraction's numerator, another radical) is caught by the same rule, and
70
- * `!important` is required because the 50% is an INLINE style.
71
- */
72
- var ROOT_INDEX_SELECTOR = '.ML__sqrt-index > .ML__vlist-t > .ML__vlist-r > .ML__vlist > span > [style*="font-size"]';
73
- var ROOT_INDEX_FONT_SIZE = '80%';
74
- var rootIndexStyles = exports.rootIndexStyles = (0, _defineProperty2["default"])({}, "& ".concat(ROOT_INDEX_SELECTOR), {
75
- fontSize: "".concat(ROOT_INDEX_FONT_SIZE, " !important")
76
- });
77
-
78
- /**
79
- * The same rule as a CSS string, for a live mathfield's shadow root - see
80
- * `SHADOW_CSS` in mathlive-instance.js. Static markup is styled by
81
- * {@link rootIndexStyles}.
82
- */
83
- var ROOT_INDEX_CSS = exports.ROOT_INDEX_CSS = "".concat(ROOT_INDEX_SELECTOR, "{font-size:").concat(ROOT_INDEX_FONT_SIZE, " !important}");
84
-
85
- /**
86
- * Size of the parallel sign (`\parallel`, tagged `data-pie-macro="parallel"` by
87
- * `PIE_MACROS`). The legacy editor enlarged it (`updateSpans` set 32px) because
88
- * the bars read too small next to the letters of `AB ∥ CD`; MathLive draws it at
89
- * the surrounding size, so it is scaled up here. Not applied to keypad labels.
90
- */
91
- var PARALLEL_SELECTOR = '[data-pie-macro="parallel"]';
92
- var PARALLEL_FONT_SIZE = '1.4em';
93
- var parallelStyles = exports.parallelStyles = (0, _defineProperty2["default"])({}, "& ".concat(PARALLEL_SELECTOR), {
94
- fontSize: PARALLEL_FONT_SIZE
95
- });
96
-
97
- /** The same rule as a CSS string, for a live mathfield's shadow root. */
98
- var PARALLEL_CSS = exports.PARALLEL_CSS = "".concat(PARALLEL_SELECTOR, "{font-size:").concat(PARALLEL_FONT_SIZE, "}");
99
-
100
- /**
101
- * Superscript/subscript sizing. MathLive follows TeX metrics for scripts, so the
102
- * MathQuill-era corrections are gone; the radical index is the one place where a
103
- * TeX-correct size reads too small in the authoring UI.
104
- */
105
- var supsubStyles = exports.supsubStyles = _objectSpread(_objectSpread({}, rootIndexStyles), parallelStyles);
106
-
107
- /** Empty placeholder boxes (answer blocks / open slots). */
108
- var placeholderStyles = exports.placeholderStyles = {
109
- '& .ML__placeholder': {
110
- borderBottom: '1px solid currentColor',
111
- minWidth: '1em'
112
- },
113
- // Stand-in glyph for an empty argument slot in STATIC math (see
114
- // `withVisibleEmptySlots`). Muted so it reads as "a slot goes here" rather
115
- // than as part of the symbol, matching how MathQuill shaded `.mq-empty`.
116
- '& [data-pie-empty]': {
117
- opacity: 0.5
118
- },
119
- // Stretchy accents (\overarc, \overleftrightarrow, \overrightarrow) render an
120
- // <svg width="100%" preserveAspectRatio="none"> inside a `.ML__stretchy`. That
121
- // span is absolutely positioned, so its immediate wrapper computes to 0px and
122
- // the width has to resolve against a *positioned* ancestor. Pin that to
123
- // `.ML__base`, whose width already equals the accent's content (measured:
124
- // 9.85px for a 0.56em slot), so the arc spans exactly its content.
125
- //
126
- // Do NOT write a bare `& svg` rule instead: MathLive's own rule is
127
- // descendant-scoped (`.ML__latex .ML__stretchy svg`), and a global one
128
- // re-parents every svg in the subtree.
129
- '& .ML__base': {
130
- position: 'relative'
131
- },
132
- '& .ML__stretchy': {
133
- position: 'absolute',
134
- left: 0,
135
- width: '100%'
136
- },
137
- // MathLive centres an accent by shifting it right half the content width -
138
- // `margin-left: 0.28em` for a 0.56em slot - which assumes a glyph with its own
139
- // side bearings. Over a synthetic empty slot it just pushes the arc right.
140
- //
141
- // `!important` is required: MathLive writes this as an INLINE style
142
- // (`style="top:-3.4em;margin-left:0.28em"`), which a class cannot override.
143
- //
144
- // It also fixes the width. `.ML__center` is the stretchy's containing block
145
- // (MathLive gives `.ML__vlist > span` position:relative), and its width is the
146
- // base minus that margin - measured 9.85px - 4.93px = 4.93px, exactly half,
147
- // which is why the arc came out half-width AND offset right.
148
- //
149
- // Scoped with `:has(.ML__stretchy)`: only stretchy accents are affected.
150
- // A single-glyph accent (`\hat{x}`, `\vec{x}`) genuinely needs its centring
151
- // offset, and must keep it.
152
- '& .ML__center:has(.ML__stretchy)': {
153
- marginLeft: '0 !important'
154
- }
155
- };
156
-
157
- /**
158
- * Styling for the on-screen keyboard and any container rendering math labels.
159
- * Also hides MathLive's own affordances, since pie supplies its own keypad.
160
- */
161
- var commonMqKeyboardStyles = exports.commonMqKeyboardStyles = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, commonMqFontStyles), longdivStyles), rootIndexStyles), placeholderStyles), {}, {
162
- touchAction: 'manipulation',
163
- '& math-field': {
164
- fontSize: 'inherit',
165
- outline: 'none'
166
- },
167
- '& math-field::part(virtual-keyboard-toggle)': {
168
- display: 'none'
169
- },
170
- '& math-field::part(menu-toggle)': {
171
- display: 'none'
172
- }
173
- });
174
-
175
- /** Everything combined - the common case for a container of math. */
176
- var commonMathLiveStyles = exports.commonMathLiveStyles = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, commonMqFontStyles), longdivStyles), supsubStyles), placeholderStyles), {}, {
177
- '& math-field': {
178
- fontSize: 'inherit',
179
- outline: 'none'
180
- },
181
- '& math-field::part(virtual-keyboard-toggle)': {
182
- display: 'none'
183
- },
184
- '& math-field::part(menu-toggle)': {
185
- display: 'none'
186
- }
187
- });
188
- var commonKeyboardStyles = exports.commonKeyboardStyles = commonMqKeyboardStyles;
189
-
190
- /**
191
- * Default export mirrors @pie-lib/math-input's `CommonMqStyles` object so
192
- * existing destructuring keeps working.
193
- */
194
- var _default = exports["default"] = {
195
- commonMqFontStyles: commonMqFontStyles,
196
- longdivStyles: longdivStyles,
197
- rootIndexStyles: rootIndexStyles,
198
- supsubStyles: supsubStyles,
199
- commonMqKeyboardStyles: commonMqKeyboardStyles,
200
- placeholderStyles: placeholderStyles,
201
- commonMathLiveStyles: commonMathLiveStyles
202
- };
203
- //# sourceMappingURL=common-styles.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common-styles.js","names":["commonMqFontStyles","exports","fontFamily","longdivStyles","display","ROOT_INDEX_SELECTOR","ROOT_INDEX_FONT_SIZE","rootIndexStyles","_defineProperty2","concat","fontSize","ROOT_INDEX_CSS","PARALLEL_SELECTOR","PARALLEL_FONT_SIZE","parallelStyles","PARALLEL_CSS","supsubStyles","_objectSpread","placeholderStyles","borderBottom","minWidth","opacity","position","left","width","marginLeft","commonMqKeyboardStyles","touchAction","outline","commonMathLiveStyles","commonKeyboardStyles","_default"],"sources":["../../src/mf/common-styles.js"],"sourcesContent":["/**\n * Shared MathLive styling.\n *\n * Replaces @pie-lib/math-input's `common-mq-styles.js`. That file was built\n * around MathQuill's `.mq-*` class names, none of which exist in MathLive\n * output, so the selectors here target MathLive's own structure instead.\n *\n * The four named groups are kept because consumers destructure them:\n *\n * const { commonMqFontStyles, commonMqKeyboardStyles, longdivStyles, supsubStyles }\n * = mq.CommonMqStyles; // math-toolbar/src/editor-and-pad.jsx, math-preview.jsx\n *\n * Most are intentionally near-empty: MathLive sizes scripts, radicals and\n * fences correctly on its own, so the MathQuill-era corrections are not needed.\n * They stay as documented extension points rather than being deleted, so the\n * destructuring above keeps working. The exception is the radical index, which\n * MathLive sizes to TeX metrics that read too small here - see\n * `rootIndexStyles`.\n */\n\n/**\n * Font styling. MathQuill needed explicit MathJax font families to match the\n * static renderer; MathLive ships the KaTeX fonts it renders with, so this only\n * smooths rendering and lets the host override the family.\n */\nexport const commonMqFontStyles = {\n '-webkit-font-smoothing': 'antialiased',\n '& math-field': {\n fontFamily: 'inherit',\n },\n};\n\n/**\n * Long division. The MathQuill fork drew this with nested `.mq-longdiv-*`\n * elements that needed manual offsets; here it comes from the `\\longdiv` macro\n * (see `PIE_MACROS`), tagged with `data-pie-macro=\"longdiv\"`.\n */\nexport const longdivStyles = {\n '& [data-pie-macro=\"longdiv\"]': {\n display: 'inline-flex',\n },\n};\n\n/**\n * How the index of a radical is sized.\n *\n * MathLive follows TeX and sets the index of `\\sqrt[n]{x}` in scriptscriptstyle,\n * which it emits as an inline `font-size: 50%` on the span wrapping the index's\n * glyphs. At authoring sizes that leaves the index - on the nth-root key, and in\n * any radical the author types - too small to read next to the radicand, so it is\n * scaled up to 80% - 1.6x what MathLive asks for.\n *\n * Only that innermost span is resized. `.ML__sqrt-index` itself keeps its font\n * size on purpose: the vlist inside it tucks the index into the radical's crook\n * with em-based `top`/`height` offsets, and scaling those lifts the index clear\n * of the radical instead of just enlarging it.\n *\n * The child chain is spelled out so that nothing nested deeper inside the index\n * (a fraction's numerator, another radical) is caught by the same rule, and\n * `!important` is required because the 50% is an INLINE style.\n */\nconst ROOT_INDEX_SELECTOR = '.ML__sqrt-index > .ML__vlist-t > .ML__vlist-r > .ML__vlist > span > [style*=\"font-size\"]';\nconst ROOT_INDEX_FONT_SIZE = '80%';\n\nexport const rootIndexStyles = {\n [`& ${ROOT_INDEX_SELECTOR}`]: {\n fontSize: `${ROOT_INDEX_FONT_SIZE} !important`,\n },\n};\n\n/**\n * The same rule as a CSS string, for a live mathfield's shadow root - see\n * `SHADOW_CSS` in mathlive-instance.js. Static markup is styled by\n * {@link rootIndexStyles}.\n */\nexport const ROOT_INDEX_CSS = `${ROOT_INDEX_SELECTOR}{font-size:${ROOT_INDEX_FONT_SIZE} !important}`;\n\n/**\n * Size of the parallel sign (`\\parallel`, tagged `data-pie-macro=\"parallel\"` by\n * `PIE_MACROS`). The legacy editor enlarged it (`updateSpans` set 32px) because\n * the bars read too small next to the letters of `AB ∥ CD`; MathLive draws it at\n * the surrounding size, so it is scaled up here. Not applied to keypad labels.\n */\nconst PARALLEL_SELECTOR = '[data-pie-macro=\"parallel\"]';\nconst PARALLEL_FONT_SIZE = '1.4em';\n\nexport const parallelStyles = {\n [`& ${PARALLEL_SELECTOR}`]: {\n fontSize: PARALLEL_FONT_SIZE,\n },\n};\n\n/** The same rule as a CSS string, for a live mathfield's shadow root. */\nexport const PARALLEL_CSS = `${PARALLEL_SELECTOR}{font-size:${PARALLEL_FONT_SIZE}}`;\n\n/**\n * Superscript/subscript sizing. MathLive follows TeX metrics for scripts, so the\n * MathQuill-era corrections are gone; the radical index is the one place where a\n * TeX-correct size reads too small in the authoring UI.\n */\nexport const supsubStyles = {\n ...rootIndexStyles,\n ...parallelStyles,\n};\n\n/** Empty placeholder boxes (answer blocks / open slots). */\nexport const placeholderStyles = {\n '& .ML__placeholder': {\n borderBottom: '1px solid currentColor',\n minWidth: '1em',\n },\n // Stand-in glyph for an empty argument slot in STATIC math (see\n // `withVisibleEmptySlots`). Muted so it reads as \"a slot goes here\" rather\n // than as part of the symbol, matching how MathQuill shaded `.mq-empty`.\n '& [data-pie-empty]': {\n opacity: 0.5,\n },\n // Stretchy accents (\\overarc, \\overleftrightarrow, \\overrightarrow) render an\n // <svg width=\"100%\" preserveAspectRatio=\"none\"> inside a `.ML__stretchy`. That\n // span is absolutely positioned, so its immediate wrapper computes to 0px and\n // the width has to resolve against a *positioned* ancestor. Pin that to\n // `.ML__base`, whose width already equals the accent's content (measured:\n // 9.85px for a 0.56em slot), so the arc spans exactly its content.\n //\n // Do NOT write a bare `& svg` rule instead: MathLive's own rule is\n // descendant-scoped (`.ML__latex .ML__stretchy svg`), and a global one\n // re-parents every svg in the subtree.\n '& .ML__base': {\n position: 'relative',\n },\n '& .ML__stretchy': {\n position: 'absolute',\n left: 0,\n width: '100%',\n },\n // MathLive centres an accent by shifting it right half the content width -\n // `margin-left: 0.28em` for a 0.56em slot - which assumes a glyph with its own\n // side bearings. Over a synthetic empty slot it just pushes the arc right.\n //\n // `!important` is required: MathLive writes this as an INLINE style\n // (`style=\"top:-3.4em;margin-left:0.28em\"`), which a class cannot override.\n //\n // It also fixes the width. `.ML__center` is the stretchy's containing block\n // (MathLive gives `.ML__vlist > span` position:relative), and its width is the\n // base minus that margin - measured 9.85px - 4.93px = 4.93px, exactly half,\n // which is why the arc came out half-width AND offset right.\n //\n // Scoped with `:has(.ML__stretchy)`: only stretchy accents are affected.\n // A single-glyph accent (`\\hat{x}`, `\\vec{x}`) genuinely needs its centring\n // offset, and must keep it.\n '& .ML__center:has(.ML__stretchy)': {\n marginLeft: '0 !important',\n },\n};\n\n/**\n * Styling for the on-screen keyboard and any container rendering math labels.\n * Also hides MathLive's own affordances, since pie supplies its own keypad.\n */\nexport const commonMqKeyboardStyles = {\n ...commonMqFontStyles,\n ...longdivStyles,\n ...rootIndexStyles,\n ...placeholderStyles,\n touchAction: 'manipulation',\n '& math-field': {\n fontSize: 'inherit',\n outline: 'none',\n },\n '& math-field::part(virtual-keyboard-toggle)': {\n display: 'none',\n },\n '& math-field::part(menu-toggle)': {\n display: 'none',\n },\n};\n\n/** Everything combined - the common case for a container of math. */\nexport const commonMathLiveStyles = {\n ...commonMqFontStyles,\n ...longdivStyles,\n ...supsubStyles,\n ...placeholderStyles,\n '& math-field': {\n fontSize: 'inherit',\n outline: 'none',\n },\n '& math-field::part(virtual-keyboard-toggle)': {\n display: 'none',\n },\n '& math-field::part(menu-toggle)': {\n display: 'none',\n },\n};\n\nexport const commonKeyboardStyles = commonMqKeyboardStyles;\n\n/**\n * Default export mirrors @pie-lib/math-input's `CommonMqStyles` object so\n * existing destructuring keeps working.\n */\nexport default {\n commonMqFontStyles,\n longdivStyles,\n rootIndexStyles,\n supsubStyles,\n commonMqKeyboardStyles,\n placeholderStyles,\n commonMathLiveStyles,\n};\n"],"mappings":";;;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACO,IAAMA,kBAAkB,GAAAC,OAA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F;AAEM,IAAM0B,oBAAoB,GAAA7B,OAAA,CAAA6B,oBAAA,GAAGJ,sBAAsB;;AAE1D;AACA;AACA;AACA;AAHA,IAAAK,QAAA,GAAA9B,OAAA,cAIe;EACbD,kBAAkB,EAAlBA,kBAAkB;EAClBG,aAAa,EAAbA,aAAa;EACbI,eAAe,EAAfA,eAAe;EACfS,YAAY,EAAZA,YAAY;EACZU,sBAAsB,EAAtBA,sBAAsB;EACtBR,iBAAiB,EAAjBA,iBAAiB;EACjBW,oBAAoB,EAApBA;AACF,CAAC","ignoreList":[]}
package/lib/mf/index.js DELETED
@@ -1,84 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
4
- var _typeof = require("@babel/runtime/helpers/typeof");
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- Object.defineProperty(exports, "CommonMqStyles", {
9
- enumerable: true,
10
- get: function get() {
11
- return _commonStyles["default"];
12
- }
13
- });
14
- Object.defineProperty(exports, "Input", {
15
- enumerable: true,
16
- get: function get() {
17
- return _input["default"];
18
- }
19
- });
20
- Object.defineProperty(exports, "Static", {
21
- enumerable: true,
22
- get: function get() {
23
- return _static["default"];
24
- }
25
- });
26
- Object.defineProperty(exports, "commonKeyboardStyles", {
27
- enumerable: true,
28
- get: function get() {
29
- return _commonStyles.commonKeyboardStyles;
30
- }
31
- });
32
- Object.defineProperty(exports, "commonMathLiveStyles", {
33
- enumerable: true,
34
- get: function get() {
35
- return _commonStyles.commonMathLiveStyles;
36
- }
37
- });
38
- Object.defineProperty(exports, "commonMqFontStyles", {
39
- enumerable: true,
40
- get: function get() {
41
- return _commonStyles.commonMqFontStyles;
42
- }
43
- });
44
- Object.defineProperty(exports, "commonMqKeyboardStyles", {
45
- enumerable: true,
46
- get: function get() {
47
- return _commonStyles.commonMqKeyboardStyles;
48
- }
49
- });
50
- Object.defineProperty(exports, "longdivStyles", {
51
- enumerable: true,
52
- get: function get() {
53
- return _commonStyles.longdivStyles;
54
- }
55
- });
56
- Object.defineProperty(exports, "parallelStyles", {
57
- enumerable: true,
58
- get: function get() {
59
- return _commonStyles.parallelStyles;
60
- }
61
- });
62
- Object.defineProperty(exports, "placeholderStyles", {
63
- enumerable: true,
64
- get: function get() {
65
- return _commonStyles.placeholderStyles;
66
- }
67
- });
68
- Object.defineProperty(exports, "rootIndexStyles", {
69
- enumerable: true,
70
- get: function get() {
71
- return _commonStyles.rootIndexStyles;
72
- }
73
- });
74
- Object.defineProperty(exports, "supsubStyles", {
75
- enumerable: true,
76
- get: function get() {
77
- return _commonStyles.supsubStyles;
78
- }
79
- });
80
- var _input = _interopRequireDefault(require("./input"));
81
- var _static = _interopRequireDefault(require("./static"));
82
- var _commonStyles = _interopRequireWildcard(require("./common-styles"));
83
- function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
84
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","names":["_input","_interopRequireDefault","require","_static","_commonStyles","_interopRequireWildcard","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","_typeof","has","get","set","_t","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor"],"sources":["../../src/mf/index.js"],"sourcesContent":["import Input from './input';\nimport Static from './static';\nimport CommonMqStyles, {\n commonMathLiveStyles,\n commonKeyboardStyles,\n commonMqFontStyles,\n commonMqKeyboardStyles,\n longdivStyles,\n rootIndexStyles,\n parallelStyles,\n supsubStyles,\n placeholderStyles,\n} from './common-styles';\n\nexport {\n Input,\n Static,\n // Same object shape as @pie-lib/math-input's `mq.CommonMqStyles`, so\n // `const { commonMqFontStyles, ... } = mq.CommonMqStyles` keeps working.\n CommonMqStyles,\n commonMathLiveStyles,\n commonKeyboardStyles,\n commonMqFontStyles,\n commonMqKeyboardStyles,\n longdivStyles,\n rootIndexStyles,\n parallelStyles,\n supsubStyles,\n placeholderStyles,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,aAAA,GAAAC,uBAAA,CAAAH,OAAA;AAUyB,SAAAG,wBAAAC,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAH,uBAAA,YAAAA,wBAAAC,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,mBAAAT,CAAA,iBAAAA,CAAA,gBAAAU,OAAA,CAAAV,CAAA,0BAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,cAAAM,EAAA,IAAAd,CAAA,gBAAAc,EAAA,OAAAC,cAAA,CAAAC,IAAA,CAAAhB,CAAA,EAAAc,EAAA,OAAAP,CAAA,IAAAD,CAAA,GAAAW,MAAA,CAAAC,cAAA,KA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