fix(mobile): Arabic reads in its direction: arrows turn round, Latin names keep their ends, figures stay whole

In the touch shell the back, forward, disclosure, date-range and flow
arrows kept pointing right in Arabic, so Settle up showed the debt the
wrong way round and Vacay's year arrows pointed inward. The shell now
mirrors lucide's direction arrows in right-to-left languages; an icon
that names its own treatment keeps it, and the lightbox arrows stay on
their physical sides.

Latin user text in Arabic rows lost its beginning when cut and moved its
punctuation to the wrong end. Names, titles, addresses and file names take
their direction from their own text (dir=auto) and still line up with the
row; markdown paragraphs, chat messages, poll options and journal stories
are isolated; signed balances, amounts, sizes, rates and leg figures read
as one left-to-right run; URL fields read left to right. Name pairs joined
by an arrow isolate each name and point from the first to the second.

The hero progress and poll result bars fill from the start edge. Arabic
and Hebrew uppercase caption labels grow a step and take the muted ink,
and a todo's due date in a notification is written in the reader's
language instead of as YYYY-MM-DD.
This commit is contained in:
Maurice
2026-11-07 23:21:33 +01:00
parent 2a6c771ad9
commit bf00412863
61 changed files with 496 additions and 128 deletions
+62
View File
@@ -0,0 +1,62 @@
/*
* Right to left (Arabic). Layout already follows the reading direction through
* the logical utilities (ms-, ps-, start-, text-start); what is here are the
* three things a logical utility cannot say.
*/
/*
* User text in its own direction. A name, title or address carries dir="auto",
* so a Latin one in an Arabic row keeps its punctuation at its own end and, when
* it is cut, loses its end rather than its beginning. Cut, clamped or typed into
* a field, it still lines up with the row and the form: on the UI's start edge,
* wherever its own start is (an empty field reads as left to right, so without
* this its placeholder would jump to the far side). A free paragraph shown on
* its own (a note, a chat message) keeps the alignment of its own language.
* Zero specificity, so an explicit text-center or text-end on the element wins.
*/
:where(
:root[dir='rtl'] [dir='auto']:dir(ltr):is(.truncate, [class*='line-clamp-'], input, textarea),
:root[dir='ltr'] [dir='auto']:dir(rtl):is(.truncate, [class*='line-clamp-'], input, textarea)
) {
text-align: end;
}
/*
* Arrows and chevrons that point along the reading direction (back, forward, a
* disclosure row, a date range, a payment from one person to another) turn
* round in a right-to-left language. The touch shell draws them all with
* lucide, so the shell (and the sheets it portals, which carry m-root too)
* mirrors them here instead of every icon carrying its own class. An icon that
* names its own RTL treatment keeps it: rtl:-scale-x-100 already turns it, and
* rtl:scale-x-100 marks an arrow that is physical on purpose. `scale` is its
* own property, so it composes with a rotation the icon carries (an open
* disclosure pointing down) instead of replacing it.
*/
:root[dir='rtl'] .m-root
:is(
.lucide-chevron-left,
.lucide-chevron-right,
.lucide-chevrons-left,
.lucide-chevrons-right,
.lucide-arrow-left,
.lucide-arrow-right,
.lucide-move-left,
.lucide-move-right
):not([class*='rtl:']) {
scale: -1 1;
}
/*
* Arabic (and Hebrew) has no capitals, so the touch shell's small uppercase
* eyebrows (field labels, stat labels, status pills) lose the weight capitals
* give a Latin label and read as grey specks. There they grow by a fifth (about
* 2px, padding and pill with them), drop the tracking that pulls joined letters
* apart, and take the muted ink instead of the faint one.
*/
:root:is(:lang(ar), :lang(he)) .m-root .uppercase {
zoom: 1.2;
letter-spacing: 0;
}
:root:is(:lang(ar), :lang(he)) .m-root .uppercase.text-m-faint {
color: var(--m-muted);
}