feat(liturgy): font-size slider + alignTo fixes + framing-prose strip#76
Merged
Conversation
…r settings UI
INCOMPLETE — DO NOT MERGE AS-IS. Two pieces of work landed together
in this branch; both have known follow-up:
1. data/liturgy/heart-sutra.ts (+509 lines):
- heart-buddhas (3 TSW segments): 三世諸佛 / 依般若波羅蜜多故 /
得阿耨多羅三藐三菩提 with Sanskrit + Devanāgarī + Chinese (Xuanzang
T251) + Sino-Japanese + multi-witness English (MAPLE / Conze /
Red Pine / Plum Village). Per-kanji scriptMorphemes on the
load-bearing terms.
- heart-great-mantra (8 TSW segments): 故知 / 是大神咒 / 是大明咒 /
是無上咒 / 是無等等咒 / 能除一切苦 / 真實不虛 / 故說般若波羅蜜多咒 /
即說咒曰. Same multi-witness pattern.
- Replaces the two prose-commentary blocks (maple-all-buddhas,
maple-great-spell) that PR #68 explicitly left as "deferred".
- **Known failures (8 trivial alignTo length mismatches)** — caught
by tests/components/liturgy/alignment-audit.test.ts:
buddhas-all-three-times · Conze: alignTo=11, en-words=12 (need +1)
buddhas-rely-prajna · Conze: 17 vs 18 (need +1)
buddhas-attain-bodhi · Conze: 8 vs 6 (need −2)
mantra-therefore-know · Plum Village: 15 vs 16 (need +1)
mantra-unequaled · Red Pine: 5 vs 6 (need +1)
mantra-unequaled · Plum Village: 8 vs 9 (need +1)
mantra-prajna-spoken · Conze: 13 vs 12 (need −1)
mantra-prajna-spoken · Plum Village: 15 vs 17 (need +2)
Run `npx vitest run tests/components/liturgy/alignment-audit.test.ts`
for full report.
- **TODO**: after fixing alignTo, also re-run
scripts/build-bodhi-heart-sutra.py to mirror these new segments
into bodhi-heart-sutra.ts.
2. components/liturgy/LiturgySettings.tsx (+42 lines):
- Added `fontScale: number` (default 1.0) to LiturgySettings type.
- Slider UI in settings popover (range 0.7–1.6) + S/M/L/XL quick
buttons (0.85 / 1.0 / 1.2 / 1.45).
- **Not yet wired**: the LiturgyChantPage wrapper does NOT yet
apply the CSS variable. Setting changes persist via localStorage
but don't visually affect chant body. Need to:
(a) wrap LiturgyChantPage children with
style={{ '--liturgy-scale': String(fontScale) }}
(b) update PaliLine / EnglishLine / SoundFormula Tailwind classes
to use `text-[calc(var(--liturgy-scale,1)*Xrem)]` arbitrary
values for the chant body — preserving current responsive
breakpoints
(c) also bump default sizes to match the mn10 demo's chant feel
(text-3xl md:text-5xl lg:text-6xl on the chant body, per the
user's image comparison).
- User also flagged: per-script font-size proportions are desirable
(kanji could be 20% smaller, Sino-Japanese reading 40% larger
than current — captured as task #84).
See docs/HANDOVER.md for full thread inventory.
…t-buddhas + heart-great-mantra TSW sections
Eight alignTo length mismatches surfaced by the alignment-audit test after
the WIP commit that authored these segments. Re-counted English tokens
(whitespace-split) and remapped to Pāli surface positions:
heart-buddhas:
- buddhas-all-three-times Conze: 11→12 (added "three"→0 anchor)
- buddhas-rely-prajna Conze: 17→18 (re-aligned trailing -1 padding)
- buddhas-attain-bodhi Conze: 8→6 (text is just "— see all-in-one (verse 14) above")
heart-great-mantra:
- mantra-therefore-know TNH: 15→16 (final "Shore" was missing)
- mantra-unequaled Red Pine: 5→6 ("the" before final "unequaled")
- mantra-unequaled TNH: 8→9 (extra article in "the unequalled")
- mantra-prajna-spoken Conze: 13→12 (recounted; "this" not duplicated)
- mantra-prajna-spoken TNH: 15→17 (added "Insight"→0 anchor + trailing -1)
…y-scale CSS var The slider in the settings popover now actually changes the chant text size. Mechanism: 1. LiturgyChantPage splits into Provider + Body. The Body reads settings.fontScale via useLiturgySettings and applies it as the --liturgy-scale CSS custom property on the root wrapper div. 2. TripleScriptWitness drops the responsive Tailwind size classes (text-xl md:text-2xl etc.) in favor of inline fontSize: calc(<baseRem>rem * var(--liturgy-scale, 1)). Large sections use 1.875rem base, normal use 1.5rem. 3. SoundFormula does the same for the dharani body (3rem base). The previous responsive variants (md:, lg:) are intentionally dropped on the scaled elements — they fought the slider on tablet/desktop. The slider's 0.7–1.6 range gives the reader full control of perceived size; the default 1.0 matches the mn10 demo's large-chant rendering.
The chant word span uses 'relative z-10' to mask alignment-line SVG strokes behind it. The tooltip inside the word (z-50) is part of the word's stacking context — in the parent it shows up at z=10. The TransliterationLine was 'position: static z-auto', which competed unpredictably with the word's z=10 layer on flip-below tooltip render. Explicitly anchoring the trans line at 'relative z-0' guarantees the tooltip's z=10 layer (carrying the z-50 tooltip body) paints above it.
…sion, Om Mani Three chants carried curator-voice prose blocks above the chant body itself: - metta-sutta: 'opens by naming the inner posture (capable, upright...)' paragraph — the chant body and word glosses already say this. - way-of-compassion: same opening posture paragraph + 'Bodhi Sangha chants this in E.A. Burtt's 1955 English' meta-narration — context already covered in the page's subtitle + sources. - om-mani-padme-hum: three prose blocks — the framing 'mantra of compassion' paragraph, an 'Across traditions' block restating each script with reading + lineage (the multi-script TSW already cycles Sanskrit / Devanāgarī / Tibetan / Hanzi / Shingon), and an 'On translating mantras' block citing Lopez. The page now opens directly on the mantra; readers cycle scripts via the existing affordance and hover each syllable for per-tradition exegesis.
The chant body now scales via the slider, but the English translation line below it was stuck on a static 'text-base md:text-lg'. Replace with inline fontSize: calc(1.125rem * var(--liturgy-scale, 1)) so the slider controls both rows in proportion. Bump the base from 1rem (text-base) to 1.125rem (text-lg) so the translation is closer in weight to the chant — readers tracking the English no longer have to strain past tiny text.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…English 1.4x User feedback: 'the japanese can be made 20% and the english line below it 40% large you get the idea right'. Add SCRIPT_SIZE_MULTIPLIER lookup keyed by script subtag (Latn 1.0, Deva 1.05, CJK 1.2, Tibt 1.1, Hang 1.15) and an ENGLISH_LINE_MULTIPLIER of 1.4. These multiply the per-shape base font size (1.5rem normal / 1.875rem large for TSW, 3rem for SoundFormula) before --liturgy-scale applies on top — so the slider still controls global size while proportions across scripts stay tuned. CJK glyphs carry more visual detail per unit than Latin; they need the extra pixels to resolve comfortably. The English translation line was the smallest thing on the page despite being where readers spend most of their attention — bumping it to 1.4× brings it close to the chant body weight without overpowering.
…ho Sai User feedback: 'sas shouldbe a seperate segment I can hover on, why are you packing in a lot of stuff into one tool top, learn from https://read.adityaarpitha.com/sutta/demo endpoint, mn10 does a good job trying to make it as fine grained as possivle we can really improve this'. Author morphemes[] arrays on compound terms that previously rendered as a single hover-glob: Sho Sai: - śāsanānām → śās (√root) + ana (noun-forming) + ānām (gen. plural) - apratihata: a + pratihata → a + prati + hata (was 2 morphemes, now 3) Heart Sutra (mantra crescendo + selected compounds): - mahāmantraḥ → mahā + mantraḥ - mahāvidyāmantraḥ → mahā + vidyā + mantraḥ - anuttaramantraḥ → an + uttara + mantraḥ - asamasamamantraḥ → a + sama + sama + mantraḥ (the 4-morpheme paradox) - sarvaduḥkhapraśamanaḥ → sarva + duḥkha + praśamanaḥ - prajñāpāramitā → prajñā + pāramitā - prajñāpāramitāyām → prajñā + pāramitā + yām (locative) - jñātavyaṃ → jñā (√root) + tavyaṃ (gerundive) - ukto → ukt (√vac past part.) + o (nom.) - mantraḥ → man (√root) + traḥ (instrument suffix) - avidyākṣayo → a + vidyā + kṣayo - jarāmaraṇakṣayaḥ → jarā + maraṇa + kṣayaḥ - niṣṭhānirvāṇaḥ → niṣṭhā + nir + vāṇaḥ - āśritya → ā + śri (√root) + tya (gerund) - anuttarāṃ → an + uttarāṃ Each morpheme carries pronunciation + gloss, surfacing root verbs (√man, √vac, √śri, √jñā, √vid, √śam, √mṛ, √vā, √han, √śās) where applicable. Hover now decomposes the meaning instead of dumping the whole etymology in one tooltip. This is a partial pass — Heart Sutra still has ~30 monolithic words (simple stems where breakdown adds little; particles; some compounds in the negation litany). Future passes can extend to Hōkyō Zanmai, Song of Zazen, Shin Jin No Mei, Enmei Jikku, etc.
…ta/mn10.json The mn10 reference packet now lives in a content-oriented directory that scales as we add other sutta references. The TS wrapper at components/sutta-studio/demoPacket.ts stays as the canonical import entry-point (preserving DEMO_PACKET_MN10 across all consumers); only its internal JSON import path changes. Also updates the lookup-phase.ts CLI default path + help string.
User noted: 'after meal is before sleep can you change this order'. Bump om-mani order from 6 to 8 so the index reads chronologically: - Metta Sutta (6, before every meal) - Four Great Vows (7, after every meal) - Om Mani Padme Hum (8, evening, before sleep)
The Hanzi script variant's transliteration was bundling Sino-Japanese romaji + Mandarin pinyin into one line, so when the reader cycled to Hanzi they saw both readings layered together (confusing — they're cycling scripts to focus on one). Now: when Hanzi is active, only the Mandarin pinyin shows under the characters. The Sino-Japanese variant carries Roman text directly so no extra transliteration is needed for it. Applied to all four vows in both MAPLE (vows.ts) and Bodhi Sangha (bodhi-vows.ts) renderings.
anantham
added a commit
that referenced
this pull request
May 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six commits closing five tasks from the post-PR-#75 worklist.
#88 — alignTo length fixes (heart-buddhas + heart-great-mantra)
The new TSW sections authored in commit
30d9614had 8 alignTo mismatches surfaced by the alignment-audit. Re-counted English tokens (whitespace-split) and remapped to Pāli surface positions for Conze, Red Pine, and Thich Nhat Hanh witnesses. Full 818-test audit now passes.#87 — font-size slider wiring
The slider in the settings popover now actually changes chant text size:
LiturgyChantPagesplits into Provider + Body. Body readssettings.fontScaleviauseLiturgySettingsand applies it as--liturgy-scaleCSS custom property on the root wrapper.TripleScriptWitnessdrops responsive Tailwind size classes (text-xl md:text-2xl) in favor of inlinefontSize: calc(<baseRem>rem * var(--liturgy-scale, 1)). Large sections use 1.875rem base; normal use 1.5rem.SoundFormuladoes the same for the dharani body (3rem base).#82 — tooltip z-index above transliteration line
The chant word span uses
relative z-10to mask alignment-line SVG strokes. The tooltip inside (z-50) is part of the word's stacking context — in the parent it shows up at z=10.TransliterationLinewasposition: static z-auto, which competed unpredictably with the word's z=10 layer on flip-below tooltip render. Explicitly anchored atrelative z-0so the tooltip's z=10 layer paints above it.#85 — strip framing prose
#86 — Om Mani redundant prose removed
Three prose blocks stripped:
framing("mantra of compassion…")across-traditions(restated each script with reading + lineage — the multi-script TSW already cycles all five scripts)on-translation(Lopez caveat)The page now opens directly on the mantra; readers cycle scripts via the existing affordance and hover each syllable for per-tradition exegesis.
Test plan
/liturgy/maple/heart-sutra— verifyheart-buddhas+heart-great-mantrasections render; hover Pāli words → alignment lines connect to correct English tokens for Conze / Red Pine / TNH/liturgy/maple/metta-sutta+/liturgy/bodhi/way-of-compassion+/liturgy/maple/om-mani-padme-hum— verify the framing prose is gone and the page opens cleanly on the chant🤖 Generated with Claude Code