lexxy_math_symbols 0.1.0

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: a0193fde8fb443dcae1b02f61e6f7df8ac733b07b651749172f22ab7323904a6
4
+ data.tar.gz: 7f98f430f13a4753c765966cdb7a3b5d4152b5ef2d275da7401fa248a4b893b3
5
+ SHA512:
6
+ metadata.gz: 0b8bbb14933292556d452fb4ac05b3e1279f73130847464a401e05ea0e482eccaba45da9481a2f987712a6143775ae5d1388b0b3f4d1f1f68c38b6def2450e5a
7
+ data.tar.gz: '096a4ee17e2a28624c15b5e14b807235051d330407bb8c91793470873d687c24e7b0fd3da8d815a3d274b04a1db3d65223bb93a9875cad152bab69052e99ac14'
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Michał Krzysteczko
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,171 @@
1
+ <p align="center">
2
+ <picture>
3
+ <source media="(prefers-color-scheme: dark)" srcset="docs/readme/hero_dark.svg">
4
+ <img src="docs/readme/hero.svg" width="540" alt="A formula being built by clicking symbols in the palette">
5
+ </picture>
6
+ </p>
7
+
8
+ <h1 align="center">Lexxy Math Symbols</h1>
9
+
10
+ A symbol palette for math formulas in the [Lexxy](https://github.com/basecamp/lexxy) editor.
11
+ Click a symbol and it goes into the formula. No need to know LaTeX.
12
+
13
+ It builds on [lexxy-math](https://github.com/CharlieLeee/lexxy-math). The saved HTML does not change.
14
+
15
+ <!-- TODO: new screenshot (this one has no Done / Undo / Next blank buttons and an old search placeholder) -->
16
+ <img src="docs/palette.png" width="100%" alt="The lexxy-math formula panel with the symbol palette">
17
+
18
+ ## What you get
19
+
20
+ - **971 symbols in 18 tabs.** Everything KaTeX can draw. The first tab has what school uses most.
21
+ - **Search** in Polish or English (the editor's language), or by LaTeX command: "pierwiastek",
22
+ "square root", `\sqrt`.
23
+ - **Templates with blanks.** A fraction, a root, a matrix. Click **Next blank** (or press Ctrl+]) to jump
24
+ to the next empty place.
25
+ - **Selected text goes inside.** Select `x+1`, click the root, get `\sqrt{x+1}`.
26
+ - **Done** and **Undo** buttons.
27
+ - **Recently used** symbols in the first tab.
28
+ - **Two toolbar buttons:** a formula in the text, a formula on its own line.
29
+ - Works on a **phone**, with the **keyboard** only, and with **screen readers**.
30
+
31
+ ## Install
32
+
33
+ ### Importmap
34
+
35
+ ```ruby
36
+ # Gemfile
37
+ gem "lexxy_math_symbols"
38
+ ```
39
+
40
+ ```ruby
41
+ # config/importmap.rb
42
+ pin "lexxy", to: "lexxy.js"
43
+ pin "lexxy-math", to: "lexxy-math.js" # lexxy-math's standalone build in vendor/javascript
44
+ ```
45
+
46
+ ```js
47
+ // app/javascript/lexxy_setup.js
48
+ import { configure } from "lexxy";
49
+ import MathSymbolsExtension from "lexxy_math_symbols";
50
+
51
+ configure({
52
+ global: { extensions: [MathSymbolsExtension] },
53
+ default: { math: true },
54
+ });
55
+ ```
56
+
57
+ ```erb
58
+ <%# layout %>
59
+ <%= stylesheet_link_tag "lexxy", "lexxy_math_symbols/palette" %>
60
+ ```
61
+
62
+ `MathSymbolsExtension` replaces lexxy-math's `MathExtension`. Have your own extension?
63
+ Then just `import "lexxy_math_symbols"`.
64
+
65
+ ### esbuild
66
+
67
+ Point the `lexxy_math_symbols` alias at the gem's folder and add `nodePaths`, so `lexxy` and
68
+ `lexxy-math` come from your app's `node_modules`:
69
+
70
+ ```js
71
+ // esbuild.config.mjs
72
+ alias: { lexxy_math_symbols: "<File.dirname(LexxyMathSymbols.javascript_path)>" },
73
+ nodePaths: ["node_modules"],
74
+ ```
75
+
76
+ From the command line: `NODE_PATH=node_modules esbuild … --alias:lexxy_math_symbols=<folder>`.
77
+
78
+ Add the stylesheet as above.
79
+
80
+ ## Show only some symbols
81
+
82
+ Good for pupils. Add `mathSymbols` to a Lexxy preset:
83
+
84
+ ```js
85
+ configure({
86
+ global: { extensions: [MathSymbolsExtension] },
87
+ default: { math: true },
88
+ student: {
89
+ mathSymbols: {
90
+ categories: ["basic", "structures"], // whole tabs
91
+ symbols: ["\\le", "\\pi"], // single symbols, in one extra tab
92
+ search: true, // false: no search box
93
+ recent: true, // false: no "Recently used" tab
94
+ },
95
+ },
96
+ });
97
+ ```
98
+
99
+ ```erb
100
+ <%= form.rich_textarea :body, preset: "student" %>
101
+ ```
102
+
103
+ Editors without the preset still show everything.
104
+
105
+ | Key | Tab |
106
+ |---|---|
107
+ | `basic` | Basics |
108
+ | `structures` | Fractions, powers, roots |
109
+ | `greek` | Greek letters |
110
+ | `delimiters` | Brackets |
111
+ | `functions` | Functions |
112
+ | `matrices` | Matrices and systems |
113
+ | `bigops` | Sums and integrals |
114
+ | `relations` | Relations |
115
+ | `binary` | Operations |
116
+ | `sets` | Sets and logic |
117
+ | `arrows` | Arrows |
118
+ | `accents` | Hats, bars and dots over letters |
119
+ | `fonts` | Fonts and text |
120
+ | `misc` | Dots, angles, shapes and more |
121
+ | `negated` | Crossed-out signs |
122
+ | `letters` | The number e and special letters |
123
+ | `spacing` | Space between symbols |
124
+ | `styles` | Colors, boxes and strike-outs |
125
+
126
+ > [!NOTE]
127
+ > This limits the palette, not what can be typed. A pupil can still type any LaTeX by hand.
128
+
129
+ ## Languages
130
+
131
+ Polish (`pl`) and English (`en`) are built in. The palette follows the nearest `lang` attribute:
132
+ on the editor, else on `<html>`. No `lang` at all means Polish. Every symbol has a Polish and an English
133
+ name.
134
+
135
+ Add another language with `registerLocale`. Anything you leave out falls back to English.
136
+
137
+ ```js
138
+ import { registerLocale } from "lexxy_math_symbols";
139
+
140
+ registerLocale("de", {
141
+ strings: { searchPlaceholder: "Suchen: Wurzel, Bruch, Alpha…" },
142
+ categories: { basic: "Grundlagen" },
143
+ keywords: { "\\sqrt{}": "Wurzel" },
144
+ });
145
+ ```
146
+
147
+ All the keys are in [`locales/en.js`](app/javascript/lexxy_math_symbols/locales/en.js).
148
+
149
+ ## Keyboard
150
+
151
+ | Keys | What it does |
152
+ |---|---|
153
+ | Tab | Formula box → search → tabs → symbols |
154
+ | Arrows | Move between tabs and symbols |
155
+ | Enter | Insert the symbol (in search: the first result) |
156
+ | Ctrl+] / Ctrl+Shift+] | Next / previous blank |
157
+ | Ctrl+Z / Cmd+Z | Undo |
158
+ | Esc | Clear the search, then save and close |
159
+ | Ctrl+Enter / Cmd+Enter | Save and close |
160
+
161
+ ## Development
162
+
163
+ ```sh
164
+ bin/test # tests
165
+ yarn check-catalog # does the catalog cover KaTeX?
166
+ bin/check-package # does the gem have all its files?
167
+ ```
168
+
169
+ ## License
170
+
171
+ MIT. See [LICENSE](LICENSE).
@@ -0,0 +1,472 @@
1
+ /* The symbol palette inside lexxy-math's editor panel. Colours, radii and
2
+ fonts come from Lexxy's variables, so the palette follows the host's theme.
3
+ States follow Lexxy's toolbar: hover ink-lightest, pressed/selected
4
+ --lexxy-color-selected, disabled at 0.3 opacity, focus with Lexxy's ring. */
5
+
6
+ /* lexxy-math caps the panel at calc(100% - 2ch) of the editor, but the panel
7
+ is content-box: its own 1ch padding and 2px border come on top, so at
8
+ full width it overhung the editor by its border (3px on a phone). Border-box
9
+ with the cap at 100% keeps the whole panel inside; 48ch here is the old
10
+ 46ch of content plus the padding. */
11
+ :where(lexxy-math-editor):has(lexxy-math-symbols) {
12
+ box-sizing: border-box;
13
+ inline-size: 48ch;
14
+ max-inline-size: 100%;
15
+ }
16
+
17
+ lexxy-math-symbols {
18
+ --lexxy-math-symbols-gap: 2px;
19
+ --lexxy-math-symbols-row: max(2.4em, 32px);
20
+ --lexxy-math-symbols-rows: 6;
21
+ --lexxy-math-symbols-columns: 4;
22
+ --lexxy-math-symbols-wider: 4;
23
+
24
+ border-block-start: 1px solid var(--lexxy-color-ink-lighter);
25
+ container-type: inline-size;
26
+ display: flex;
27
+ flex-direction: column;
28
+ gap: 0.75ch;
29
+ padding-block-start: 1ch;
30
+ }
31
+
32
+ /* Fingers: Apple's 44px minimum for every tab and tile. */
33
+ @media (pointer: coarse) {
34
+ lexxy-math-symbols {
35
+ --lexxy-math-symbols-gap: 4px;
36
+ --lexxy-math-symbols-row: max(2.4em, 44px);
37
+ --lexxy-math-symbols-rows: 5;
38
+ }
39
+ }
40
+
41
+ /* Short screens (a phone on its side, a small laptop window, Android with
42
+ the keyboard up when the host resizes for it): fewer rows, so the panel
43
+ with its textarea, preview, search and tabs still fits. iOS Safari does
44
+ not shrink the layout viewport for the keyboard, so there it only helps in
45
+ landscape; the grid scrolls either way. No sticky, fixed or transforms:
46
+ they would break Safari's translucent toolbars. */
47
+ @media (max-height: 760px) {
48
+ lexxy-math-symbols {
49
+ --lexxy-math-symbols-rows: 4;
50
+ }
51
+ }
52
+
53
+ /* Short and usually wide (landscape): a wider panel, capped by the editor,
54
+ fits the tabs in fewer rows. */
55
+ @media (max-height: 560px) {
56
+ :where(lexxy-math-editor):has(lexxy-math-symbols) {
57
+ inline-size: 72ch;
58
+ }
59
+
60
+ lexxy-math-symbols {
61
+ --lexxy-math-symbols-rows: 3;
62
+ }
63
+ }
64
+
65
+ @media (max-height: 420px) {
66
+ lexxy-math-symbols {
67
+ --lexxy-math-symbols-rows: 2;
68
+ }
69
+ }
70
+
71
+ /* An even number of columns, as many as fit at the minimum width: a wide
72
+ tile spans 2 and a wider one half the row, so wide tiles fill their rows
73
+ whatever the count. Container queries cannot read custom properties, so
74
+ each step is N columns + (N - 1) gaps, by hand: 2.6em and 2px for a mouse,
75
+ 44px and 4px for fingers. */
76
+ @container (inline-size >= 16.5em) {
77
+ .lexxy-math-symbols__tabs,
78
+ .lexxy-math-symbols__grid {
79
+ --lexxy-math-symbols-columns: 6;
80
+ --lexxy-math-symbols-wider: 3;
81
+ }
82
+ }
83
+
84
+ @container (inline-size >= 21.5em) {
85
+ .lexxy-math-symbols__tabs,
86
+ .lexxy-math-symbols__grid {
87
+ --lexxy-math-symbols-columns: 8;
88
+ --lexxy-math-symbols-wider: 4;
89
+ }
90
+ }
91
+
92
+ @container (inline-size >= 27.25em) {
93
+ .lexxy-math-symbols__tabs,
94
+ .lexxy-math-symbols__grid {
95
+ --lexxy-math-symbols-columns: 10;
96
+ --lexxy-math-symbols-wider: 5;
97
+ }
98
+ }
99
+
100
+ @media (pointer: coarse) {
101
+ @container (inline-size < 284px) {
102
+ .lexxy-math-symbols__tabs,
103
+ .lexxy-math-symbols__grid {
104
+ --lexxy-math-symbols-columns: 4;
105
+ --lexxy-math-symbols-wider: 4;
106
+ }
107
+ }
108
+
109
+ @container (284px <= inline-size < 380px) {
110
+ .lexxy-math-symbols__tabs,
111
+ .lexxy-math-symbols__grid {
112
+ --lexxy-math-symbols-columns: 6;
113
+ --lexxy-math-symbols-wider: 3;
114
+ }
115
+ }
116
+
117
+ @container (380px <= inline-size < 476px) {
118
+ .lexxy-math-symbols__tabs,
119
+ .lexxy-math-symbols__grid {
120
+ --lexxy-math-symbols-columns: 8;
121
+ --lexxy-math-symbols-wider: 4;
122
+ }
123
+ }
124
+ }
125
+
126
+ /* Undo, next place, done: one row above the search. Secondary buttons in
127
+ Lexxy's ink-lightest, "Gotowe" in Lexxy's primary (accent-dark with
128
+ inverted ink, as Lexxy's link and alt-text Save buttons) and pushed to the
129
+ end. The row never wraps: on a 320px phone (a 246px palette) the
130
+ next-place label breaks onto two lines inside its 44px button instead,
131
+ the other two keep their one line. */
132
+ .lexxy-math-symbols__actions {
133
+ align-items: stretch;
134
+ display: flex;
135
+ gap: 0.5ch;
136
+ }
137
+
138
+ .lexxy-math-symbols__actions button {
139
+ align-items: center;
140
+ appearance: none;
141
+ background-color: var(--lexxy-color-ink-lightest);
142
+ border: 1px solid var(--lexxy-color-ink-lighter);
143
+ border-radius: var(--lexxy-radius);
144
+ color: var(--lexxy-color-ink);
145
+ cursor: pointer;
146
+ display: inline-flex;
147
+ font: inherit;
148
+ font-size: 0.85em;
149
+ justify-content: center;
150
+ line-height: 1.15;
151
+ min-block-size: 32px;
152
+ padding: 0.25em 1ch;
153
+ text-align: center;
154
+ white-space: nowrap;
155
+ }
156
+
157
+ .lexxy-math-symbols__actions button[hidden] {
158
+ display: none;
159
+ }
160
+
161
+ .lexxy-math-symbols__actions .lexxy-math-symbols__next {
162
+ flex: 0 1 auto;
163
+ text-wrap: balance;
164
+ white-space: normal;
165
+ }
166
+
167
+ .lexxy-math-symbols__actions .lexxy-math-symbols__done {
168
+ background-color: var(--lexxy-color-accent-dark);
169
+ border-color: var(--lexxy-color-accent-dark);
170
+ color: var(--lexxy-color-ink-inverted);
171
+ font-weight: 600;
172
+ margin-inline-start: auto;
173
+ padding-inline: 1.5ch;
174
+ }
175
+
176
+ /* Undo with nothing to undo: Lexxy's toolbar fades disabled buttons the same
177
+ way. Still focusable, so it keeps its place in the Tab order. */
178
+ .lexxy-math-symbols__actions button[aria-disabled="true"] {
179
+ cursor: default;
180
+ opacity: 0.45;
181
+ }
182
+
183
+ @media (hover: hover) {
184
+ .lexxy-math-symbols__actions button:hover:not([aria-disabled="true"]) {
185
+ background-color: var(--lexxy-color-ink-lighter);
186
+ }
187
+
188
+ .lexxy-math-symbols__actions .lexxy-math-symbols__done:hover {
189
+ background-color: color-mix(
190
+ in oklch,
191
+ var(--lexxy-color-accent-dark) 85%,
192
+ var(--lexxy-color-ink)
193
+ );
194
+ }
195
+ }
196
+
197
+ .lexxy-math-symbols__actions button:active:not([aria-disabled="true"]) {
198
+ background-color: var(--lexxy-color-selected);
199
+ }
200
+
201
+ .lexxy-math-symbols__actions .lexxy-math-symbols__done:active {
202
+ background-color: color-mix(in oklch, var(--lexxy-color-accent-dark) 75%, var(--lexxy-color-ink));
203
+ }
204
+
205
+ .lexxy-math-symbols__actions button:focus-visible {
206
+ outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
207
+ outline-offset: 1px;
208
+ }
209
+
210
+ @media (pointer: coarse) {
211
+ .lexxy-math-symbols__actions button {
212
+ min-block-size: 44px;
213
+ }
214
+ }
215
+
216
+ /* One quiet line for a first-time user, gone after the first insert. */
217
+ .lexxy-math-symbols__help {
218
+ color: var(--lexxy-color-ink-medium);
219
+ font-size: 0.8em;
220
+ line-height: 1.35;
221
+ margin: 0;
222
+ text-wrap: pretty;
223
+ }
224
+
225
+ .lexxy-math-symbols__help[hidden] {
226
+ display: none;
227
+ }
228
+
229
+ /* ink-light, not ink-lighter: the border is the only thing that shows where
230
+ the field is, so it needs 3:1 against the canvas (WCAG 1.4.11). */
231
+ .lexxy-math-symbols__search {
232
+ background-color: var(--lexxy-color-canvas);
233
+ border: 1px solid var(--lexxy-color-ink-light);
234
+ border-radius: var(--lexxy-radius);
235
+ box-sizing: border-box;
236
+ color: var(--lexxy-color-ink);
237
+ font: inherit;
238
+ font-size: 0.9em;
239
+ padding: 0.6ch 1ch;
240
+ width: 100%;
241
+ }
242
+
243
+ .lexxy-math-symbols__search[hidden] {
244
+ display: none;
245
+ }
246
+
247
+ .lexxy-math-symbols__search:focus {
248
+ outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
249
+ outline-offset: var(--lexxy-focus-ring-offset);
250
+ }
251
+
252
+ .lexxy-math-symbols__tabs {
253
+ display: grid;
254
+ gap: var(--lexxy-math-symbols-gap);
255
+ grid-template-columns: repeat(var(--lexxy-math-symbols-columns), minmax(0, 1fr));
256
+ }
257
+
258
+ /* A set with one tab hides the bar (the heading names the tab). */
259
+ .lexxy-math-symbols__tabs[hidden] {
260
+ display: none;
261
+ }
262
+
263
+ /* Fingers: the whole catalog's 19 tabs as a grid took five 44px rows, half a
264
+ phone's screen before the first symbol. Here they are one row that scrolls
265
+ sideways. The tabs keep the symbol grid's column width, shrunk so that
266
+ (columns - 1) whole tabs and half of the next fit: the cut tab at the end
267
+ is the sign there is more (the scrollbar is hidden, iOS hides it anyway).
268
+ At every step of the column queries above the result stays >= 44px.
269
+ A set with few tabs simply starts at the left, nothing to scroll. No
270
+ sticky, fixed, transform or mask: the panel sits in the text, so the
271
+ scroller's own layer does not touch Safari's toolbars. */
272
+ @media (pointer: coarse) {
273
+ .lexxy-math-symbols__tabs {
274
+ grid-auto-columns: max(
275
+ 44px,
276
+ calc(
277
+ (100cqi - (var(--lexxy-math-symbols-columns) - 1) * var(--lexxy-math-symbols-gap)) /
278
+ (var(--lexxy-math-symbols-columns) - 0.5)
279
+ )
280
+ );
281
+ grid-auto-flow: column;
282
+ grid-template-columns: none;
283
+ overflow-x: auto;
284
+ overscroll-behavior-x: contain;
285
+ scroll-snap-type: x proximity;
286
+ scrollbar-width: none;
287
+ }
288
+
289
+ .lexxy-math-symbols__tabs::-webkit-scrollbar {
290
+ display: none;
291
+ }
292
+
293
+ .lexxy-math-symbols__tab {
294
+ scroll-snap-align: start;
295
+ }
296
+ }
297
+
298
+ /* On a phone the tabs are bare icons, so this line is the only place that
299
+ names the tab: full ink, a touch larger, a rule under it. Long names
300
+ ("Daszki, kreski i kropki nad literą") wrap to a balanced second line
301
+ instead of being cut. */
302
+ .lexxy-math-symbols__heading {
303
+ border-block-end: 1px solid var(--lexxy-color-ink-lighter);
304
+ color: var(--lexxy-color-ink);
305
+ font-size: 0.875em;
306
+ font-weight: 600;
307
+ line-height: 1.3;
308
+ overflow-wrap: break-word;
309
+ padding-block: 0.15em 0.4em;
310
+ text-wrap: balance;
311
+ }
312
+
313
+ /* Plain row flow: what you see is the DOM order is the Tab order. The
314
+ height is a whole number of standard rows, so a grid of plain symbols ends
315
+ on a row boundary. Taller rows (matrices, display-style fractions) do not
316
+ line up with it and the last visible one is cut: that is the sign there is
317
+ more to scroll. The thin scrollbar in Lexxy's ink, as in Lexxy's own
318
+ prompt menu, so it follows a dark theme even when the host leaves
319
+ color-scheme light. */
320
+ .lexxy-math-symbols__grid {
321
+ align-content: start;
322
+ display: grid;
323
+ gap: var(--lexxy-math-symbols-gap);
324
+ grid-auto-flow: row;
325
+ grid-auto-rows: minmax(var(--lexxy-math-symbols-row), auto);
326
+ grid-template-columns: repeat(var(--lexxy-math-symbols-columns), minmax(0, 1fr));
327
+ max-block-size: calc(
328
+ var(--lexxy-math-symbols-rows) * var(--lexxy-math-symbols-row) +
329
+ (var(--lexxy-math-symbols-rows) - 1) * var(--lexxy-math-symbols-gap)
330
+ );
331
+ overflow-y: auto;
332
+ scrollbar-color: var(--lexxy-color-ink-light) transparent;
333
+ scrollbar-width: thin;
334
+ }
335
+
336
+ .lexxy-math-symbols__tab,
337
+ .lexxy-math-symbols__item {
338
+ align-items: center;
339
+ background: none;
340
+ border: 1px solid transparent;
341
+ border-radius: var(--lexxy-radius);
342
+ color: var(--lexxy-color-ink);
343
+ cursor: pointer;
344
+ display: flex;
345
+ justify-content: center;
346
+ min-block-size: var(--lexxy-math-symbols-row);
347
+ min-inline-size: 0;
348
+ overflow: hidden;
349
+ padding: 0.2em;
350
+ }
351
+
352
+ /* The tab's own em is 0.8 of the palette's, so 2.4em alone gave 30.7px. */
353
+ .lexxy-math-symbols__tab {
354
+ font-size: 0.8em;
355
+ min-block-size: max(2.4em, 32px);
356
+ }
357
+
358
+ @media (pointer: coarse) {
359
+ .lexxy-math-symbols__tab {
360
+ min-block-size: max(2.4em, 44px);
361
+ }
362
+ }
363
+
364
+ @media (hover: hover) {
365
+ .lexxy-math-symbols__tab:hover,
366
+ .lexxy-math-symbols__item:hover:not([aria-disabled="true"]) {
367
+ background-color: var(--lexxy-color-ink-lightest);
368
+ }
369
+
370
+ .lexxy-math-symbols__tab[aria-selected="true"]:hover {
371
+ background-color: var(--lexxy-color-selected-hover);
372
+ }
373
+ }
374
+
375
+ .lexxy-math-symbols__tab[aria-selected="true"],
376
+ .lexxy-math-symbols__item:active:not([aria-disabled="true"]) {
377
+ background-color: var(--lexxy-color-selected);
378
+ }
379
+
380
+ /* Inside the button (negative offset by the ring's own size), so the grid's
381
+ overflow never clips it at the edges. */
382
+ .lexxy-math-symbols__tab:focus-visible,
383
+ .lexxy-math-symbols__item:focus-visible {
384
+ outline: var(--lexxy-focus-ring-size) solid var(--lexxy-focus-ring-color);
385
+ outline-offset: calc(-1 * var(--lexxy-focus-ring-size));
386
+ }
387
+
388
+ /* Block-only entries in an inline formula. Still focusable and clickable,
389
+ so the palette can say why nothing happened. Fading the whole tile to 0.3
390
+ looked broken (washed out, half there); instead the glyph alone fades to
391
+ 0.45, still readable, and a dashed outline at full strength marks the tile
392
+ as deliberately off, the usual "not here" sign. */
393
+ .lexxy-math-symbols__item[aria-disabled="true"] {
394
+ border: 1px dashed var(--lexxy-color-ink-light);
395
+ cursor: not-allowed;
396
+ }
397
+
398
+ .lexxy-math-symbols__item[aria-disabled="true"] > * {
399
+ opacity: 0.45;
400
+ }
401
+
402
+ .lexxy-math-symbols__item--wide {
403
+ grid-column: span 2;
404
+ }
405
+
406
+ .lexxy-math-symbols__item--wider {
407
+ grid-column: span var(--lexxy-math-symbols-wider);
408
+ }
409
+
410
+ /* KaTeX's 1.21em would make a display-style fraction too tall for a row. */
411
+ .lexxy-math-symbols__item .katex {
412
+ font-size: 1.05em;
413
+ }
414
+
415
+ /* KaTeX's own spacing would make the buttons uneven. */
416
+ .lexxy-math-symbols__tab .katex-display,
417
+ .lexxy-math-symbols__item .katex-display {
418
+ margin: 0;
419
+ }
420
+
421
+ /* KaTeX pins an equation number (\tag) to the right edge of the formula's
422
+ box, which in a tile is as narrow as the formula itself, so "(1)" landed
423
+ on top of "a = b". In the tile it simply follows the formula. */
424
+ .lexxy-math-symbols__item .katex-display > .katex > .katex-html > .katex-tag {
425
+ padding-inline-start: 0.6em;
426
+ position: static;
427
+ }
428
+
429
+ .lexxy-math-symbols__item--display .katex-display > .katex {
430
+ font-size: 0.75em;
431
+ }
432
+
433
+ /* \colorbox fills with a fixed light colour: the ink of a dark theme would
434
+ vanish on it. KaTeX draws the fill as a sibling of the content (.boxpad),
435
+ hence the :has. */
436
+ .lexxy-math-symbols__item .vlist:has(.colorbox, .fcolorbox) .boxpad {
437
+ color: black;
438
+ }
439
+
440
+ .lexxy-math-symbols__empty {
441
+ color: var(--lexxy-color-ink-medium);
442
+ font-size: 0.85em;
443
+ grid-column: 1 / -1;
444
+ margin: 0;
445
+ padding: 1ch 0;
446
+ }
447
+
448
+ /* An empty formula in the text: a hint to click it, not "$\ldots$". */
449
+ .lexxy-math-inline--empty {
450
+ color: var(--lexxy-color-ink-medium);
451
+ font-style: italic;
452
+ font-size: 0.9em;
453
+ cursor: pointer;
454
+ }
455
+
456
+ /* An empty place of a template in lexxy-math's preview (palette.js draws a
457
+ \square there): lighter than the formula, so it reads as "fill me in", not
458
+ as a real \square. */
459
+ .lexxy-math-editor__preview .lexxy-math-symbols__slot {
460
+ color: var(--lexxy-color-ink-lighter);
461
+ }
462
+
463
+ /* The toolbar button's icon inside the block-only message. */
464
+ .lexxy-math-symbols__button-icon {
465
+ display: inline-flex;
466
+ vertical-align: -0.2em;
467
+ }
468
+
469
+ .lexxy-math-symbols__button-icon svg {
470
+ inline-size: 1.2em;
471
+ block-size: 1.2em;
472
+ }