sisyo 1.7.0 → 1.9.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.
- package/LICENSE +16 -16
- package/README.md +177 -166
- package/bin/known-hashes.json +8 -1
- package/bin/sisyo.js +285 -285
- package/package.json +30 -30
- package/templates/.claude/rules/agents-and-tests.md +32 -24
- package/templates/.claude/rules/docs.md +39 -19
- package/templates/.claude/skills/fastapi-best-practices/ASYNC-PATTERNS.md +121 -121
- package/templates/.claude/skills/fastapi-best-practices/DATABASE.md +153 -153
- package/templates/.claude/skills/fastapi-best-practices/DEPENDENCIES.md +140 -140
- package/templates/.claude/skills/fastapi-best-practices/PROJECT-STRUCTURE.md +90 -90
- package/templates/.claude/skills/fastapi-best-practices/PYDANTIC-GUIDE.md +155 -155
- package/templates/.claude/skills/fastapi-best-practices/SKILL.md +123 -123
- package/templates/.claude/skills/g6-style/SKILL.md +125 -125
- package/templates/.claude/skills/g6-style/references/checks.md +58 -58
- package/templates/.claude/skills/g6-style/references/imagery.md +103 -103
- package/templates/.claude/skills/g6-style/references/motion.md +121 -121
- package/templates/.claude/skills/g6-style/references/sections.md +263 -263
- package/templates/.claude/skills/g6-style/references/tokens.md +197 -197
- package/templates/.claude/skills/hindsight/SKILL.md +175 -175
- package/templates/.claude/skills/hoang-auth/SKILL.md +188 -0
- package/templates/.claude/skills/html-docs/SKILL.md +207 -207
- package/templates/.claude/skills/i18n-multilang/SKILL.md +153 -153
- package/templates/.claude/skills/i18n-multilang/assets/languages.json +47 -47
- package/templates/.claude/skills/i18n-multilang/assets/plural-vectors.json +46 -46
- package/templates/.claude/skills/i18n-multilang/assets/project/README.md +17 -17
- package/templates/.claude/skills/i18n-multilang/assets/project/gitattributes.txt +6 -6
- package/templates/.claude/skills/i18n-multilang/assets/project/gitignore.txt +4 -4
- package/templates/.claude/skills/i18n-multilang/assets/project/glossary.json +6 -6
- package/templates/.claude/skills/i18n-multilang/assets/project/i18n.config.json +22 -22
- package/templates/.claude/skills/i18n-multilang/assets/project/locales/__source__/common.json +10 -10
- package/templates/.claude/skills/i18n-multilang/assets/project/notes/common.json +5 -5
- package/templates/.claude/skills/i18n-multilang/assets/project/style.md +20 -20
- package/templates/.claude/skills/i18n-multilang/references/format.md +100 -100
- package/templates/.claude/skills/i18n-multilang/references/languages.md +97 -97
- package/templates/.claude/skills/i18n-multilang/references/layout-and-versioning.md +256 -256
- package/templates/.claude/skills/i18n-multilang/references/numbers.md +161 -161
- package/templates/.claude/skills/i18n-multilang/references/platform-unity.md +142 -142
- package/templates/.claude/skills/i18n-multilang/references/platform-web.md +107 -107
- package/templates/.claude/skills/i18n-multilang/references/translation.md +143 -143
- package/templates/.claude/skills/i18n-multilang/references/voice.md +271 -271
- package/templates/.claude/skills/i18n-multilang/scripts/i18n.py +1041 -1041
- package/templates/.claude/skills/i18n-multilang/scripts/numwords.py +1013 -1013
- package/templates/.claude/skills/i18n-multilang/scripts/voice.py +478 -478
- package/templates/.claude/skills/neon-game-ui-ux-skill/COMPONENTS.md +490 -490
- package/templates/.claude/skills/neon-game-ui-ux-skill/GAMIFICATION.md +246 -246
- package/templates/.claude/skills/neon-game-ui-ux-skill/ICONS.md +249 -249
- package/templates/.claude/skills/neon-game-ui-ux-skill/LAYOUT-NAV.md +362 -362
- package/templates/.claude/skills/neon-game-ui-ux-skill/MOTION-A11Y.md +168 -168
- package/templates/.claude/skills/neon-game-ui-ux-skill/SKILL.md +137 -137
- package/templates/.claude/skills/neon-game-ui-ux-skill/TOKENS.md +323 -323
- package/templates/.claude/skills/react-page-oriented/SKILL.md +407 -407
- package/templates/.claude/skills/react-page-oriented/triggers.md +12 -12
- package/templates/.claude/skills/terraform-best-practices/SKILL.md +341 -341
- package/templates/.claude/skills/typesafe-jev/SKILL.md +148 -148
- package/templates/.claude/skills/vibe-docs/SKILL.md +139 -242
- package/templates/SISYO.md +39 -37
- package/templates/docs/99_progress/features.md +7 -7
- package/templates/docs/99_progress/handoff.md +19 -19
- package/templates/docs/99_progress/todo.md +15 -15
- package/templates/docs/MAP.md +26 -26
|
@@ -1,362 +1,362 @@
|
|
|
1
|
-
# Layout and navigation
|
|
2
|
-
|
|
3
|
-
The app shell: a HUD top bar, a side rail on desktop, a bottom bar with a raised centre dial on phones and tablets,
|
|
4
|
-
plus the rules for responsive behaviour, safe areas, sheets, dialogs and loading skeletons. Every number is the one
|
|
5
|
-
LenS ships; the components named here are described in `COMPONENTS.md`.
|
|
6
|
-
|
|
7
|
-
## 1. Shell anatomy
|
|
8
|
-
|
|
9
|
-
```
|
|
10
|
-
< lg (phones, tablets) >= lg (desktop)
|
|
11
|
-
┌──────────────────────────────┐ ┌────┬──────────────────────────────┐
|
|
12
|
-
│ logo [hex][🔥12][◔] │ 56 px │ ◎ │ Page title [hex ▰▰▱][🔥][◔]│ 56 px
|
|
13
|
-
│▁▁▁▁▁ 2 px XP line ▁▁▁▁▁▁▁▁▁▁▁│ ├────┼──────────────────────────────┤
|
|
14
|
-
│ │ │ ⌂ │ │
|
|
15
|
-
│ page │ │ ▤ │ page │
|
|
16
|
-
│ │ │ ▶ │ │
|
|
17
|
-
│ ╭───╮ │ │ ⚑ │ │
|
|
18
|
-
│ ⌂ ▤ ( 60% ) ⌕ ⚙ │ 64 px │ ⚙ │ │
|
|
19
|
-
└──────────────────────────────┘ + inset └────┴──────────────────────────────┘
|
|
20
|
-
72 px (lg) / 240 px with labels (xl)
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
Element order in the shell root (`relative min-h-dvh`): backdrop, skip link, side rail, content column (top bar +
|
|
24
|
-
`<main>`), bottom bar.
|
|
25
|
-
|
|
26
|
-
| Piece | Definition | z |
|
|
27
|
-
|---|---|---|
|
|
28
|
-
| Backdrop | `.neon-backdrop` (fixed, behind everything), rendered once, `aria-hidden` | -10 |
|
|
29
|
-
| Skip link | "Skip to content", the first focusable element: visually hidden until focused, then fixed at top-left as a small `surface-2` pill; targets `#main` | 50 |
|
|
30
|
-
| Top bar | `sticky top-0`, 56 px high, bottom border `line` at 70 %, `surface-base` at 70 % + `backdrop-blur-xl` | 30 |
|
|
31
|
-
| Side rail | `fixed inset-y-0 left`, hidden below `lg`, 72 px wide (240 px from `xl`), right border `line` at 70 %, `surface-base` at 85 % | 30 |
|
|
32
|
-
| Content column | `flex min-h-dvh flex-col`, left padding 72 px from `lg` and 240 px from `xl`, plus the side safe-area insets | |
|
|
33
|
-
| `<main>` | `flex-1`, `padding-bottom: var(--shell-bottom)`, `id="main" tabIndex={-1}`, no focus outline | |
|
|
34
|
-
| Bottom bar | `fixed inset-x-0 bottom-0`, 64 px + the bottom safe-area inset as padding, top border `line` at 70 %, `surface-base` at 80 % + `backdrop-blur-xl`, hidden from `lg` | 30 |
|
|
35
|
-
| Sheets, the dial's radial menu | portal to `<body>` | 40 |
|
|
36
|
-
| Reward burst overlay / reward toast / level-up modal / toasts | portal to `<body>` | 100 / 105 / 110 / 120 |
|
|
37
|
-
|
|
38
|
-
This table is the only place the z-order is defined; the other guides refer to it.
|
|
39
|
-
|
|
40
|
-
`--shell-top` (`3.5rem + 1px`: bar + border) and `--shell-bottom` (`4rem + env(safe-area-inset-bottom)`, `0px` from
|
|
41
|
-
1024 px) are defined on `:root`. Anything sticky inside a page offsets by them (`top: var(--shell-top)`), and
|
|
42
|
-
`scroll-padding-top / -bottom` on `html` uses them so a focused control never hides under a bar. A page that pins its
|
|
43
|
-
own bar above the bottom bar sets `--page-bar` to that bar's height, which is added to the bottom scroll padding.
|
|
44
|
-
|
|
45
|
-
`backdrop-filter` is used on the top bar, bottom bar, sheets, toasts and modal scrims **only**. Blur on cards or on
|
|
46
|
-
the backdrop makes scrolling janky on mid-range phones; the background lights are static gradients for that reason.
|
|
47
|
-
|
|
48
|
-
Safe areas (needs `viewport-fit=cover`): the content column is padded by `env(safe-area-inset-left / -right)`; the top
|
|
49
|
-
bar cancels that with equal negative margins and re-adds it as its own padding, so its **background** runs under a
|
|
50
|
-
landscape notch while its **content** stays clear. The rail sits at `left: env(safe-area-inset-left)`.
|
|
51
|
-
|
|
52
|
-
## 2. Top bar: the HUD
|
|
53
|
-
|
|
54
|
-
Inner row: 56 px high, 12 px gaps, horizontal padding 16 px (24 from `sm`, 32 from `lg`).
|
|
55
|
-
|
|
56
|
-
Left: the logo link below `lg` (min height 44 px); from `lg` the page title instead (display font 18 px semibold,
|
|
57
|
-
truncated), because the rail carries the logo there.
|
|
58
|
-
|
|
59
|
-
Right: a group with a 4 px gap (8 px from `sm`) holding the HUD button and, from `md`, the theme toggle and the
|
|
60
|
-
account menu. The HUD is **one button** that opens a details panel; its parts sit in a row with an 8 px gap (12 px
|
|
61
|
-
from `sm`), in this order:
|
|
62
|
-
|
|
63
|
-
1. `LevelBadge` `md` (34 x 38 hexagon)
|
|
64
|
-
2. `XpBar` (176 px, `LV 7` / `120 / 500 XP`): from `md` only. Its wrapper is marked `data-xp-target`.
|
|
65
|
-
3. `StreakPill`
|
|
66
|
-
4. `ProgressRing` 34 px for the daily goal, with the percentage inside (9 px bold display font, lime-ink) until
|
|
67
|
-
100 %; then the ring's own check pops in. **Floor** the percentage, here and in the dial (§4), so 99.6 % never
|
|
68
|
-
reads "100%" next to a ring that is not closed. (LenS rounds in this ring and floors in the dial; use one rule.)
|
|
69
|
-
|
|
70
|
-
Then, from `md`: a ghost `RoundButton` `sm` theme toggle (shows the sun on dark, the moon on light; its label says
|
|
71
|
-
which theme it switches to) and the account menu. On phones those two live on the Settings page, not in the bar: at
|
|
72
|
-
320 px the bar holds logo + hexagon + streak + ring and nothing else.
|
|
73
|
-
|
|
74
|
-
Phones: the XP bar becomes a **2 px line on the bottom edge of the top bar** (`absolute inset-x-0 -bottom-px`, the
|
|
75
|
-
compact `XpBar`, hidden from `md`), also marked `data-xp-target`, so the reward burst always has a visible landing
|
|
76
|
-
point. How the burst chooses between the two targets: COMPONENTS.md, Reward system.
|
|
77
|
-
|
|
78
|
-
HUD button details:
|
|
79
|
-
|
|
80
|
-
- Slightly padded (6 px sideways, 4 px vertical, with matching negative margins so it does not shift the row),
|
|
81
|
-
`rounded-2xl`, hover tint `ink-title` at 4 %.
|
|
82
|
-
- Its accessible name is the whole state in words: "Level 7, 120 of 500 XP. 12-day streak, done today. Daily goal
|
|
83
|
-
40 of 60 XP. Show details". The parts inside are presentational for assistive tech (roles inside a button are
|
|
84
|
-
flattened), so without this label a screen-reader user hears only "button".
|
|
85
|
-
- `aria-expanded` + `aria-controls`; the panel is a non-modal `role="region"` popover labelled "Your progress":
|
|
86
|
-
anchored to the button's right edge, 8 px below, width `min(20rem, 100vw - 1.5rem)`, `rounded-3xl`, `border-line`,
|
|
87
|
-
`bg-surface-2`, `shadow-edge`, padding 16 px. It enters in 160 ms (opacity 0 → 1, y -6 → 0, scale .98 → 1, origin
|
|
88
|
-
top right). An outside pointer-down or Escape closes it; Escape returns focus to the button.
|
|
89
|
-
- The panel repeats the three facts as rows separated by hairlines (`line`); each row has 16 px of vertical padding
|
|
90
|
-
(none above the first or below the last) and a 14 px gap between its graphic and its text:
|
|
91
|
-
- a `lg` level badge + a full-width XP bar + "380 XP to level 8";
|
|
92
|
-
- a flame tile (44 px, `rounded-2xl`, ember at 10 %, an inset 1 px ember ring at 30 %, a 24 px flame: ember, with
|
|
93
|
-
`glow` when today is done, mono when there is no streak) + "12-day streak · best 21" + one sentence for the state;
|
|
94
|
-
- a 44 px goal ring with stroke 4 + "40 / 60 XP today" + "20 XP to reach your daily goal." or "Daily goal reached.
|
|
95
|
-
Nice work!".
|
|
96
|
-
- While the HUD read is pending, show a skeleton with the same boxes (34 x 38 hexagon, 176 x 24 bar from `md`,
|
|
97
|
-
64 x 36 pill, 34 px circle), so the bar does not reflow when data arrives. If the read failed, render nothing: the
|
|
98
|
-
bar still works without the game.
|
|
99
|
-
|
|
100
|
-
Account menu (pattern): a 44 px avatar button (the user's initial inside a thin spectral ring: a conic gradient with
|
|
101
|
-
1.5 px padding around a `surface-1` disc), `aria-haspopup="menu"`. The popover is 256 px wide, `rounded-2xl`, with the
|
|
102
|
-
name and e-mail, a hairline, then a `role="menu"` of 44 px rows (Settings; Log out in coral). Focus moves to the first
|
|
103
|
-
item on open; arrow keys, Home and End move; Tab closes; Escape closes and returns focus.
|
|
104
|
-
|
|
105
|
-
## 3. Side rail (desktop)
|
|
106
|
-
|
|
107
|
-
- Header: a 56 px row with the logo link (mark only at `lg`, mark + wordmark at `xl`), a hairline under it. List:
|
|
108
|
-
12 px side padding, 16 px top, 6 px between items. Footer: the app version in mono 9 px, `ink-muted`.
|
|
109
|
-
- `lg`: 72 px, icons only, with a tooltip to the right of the item on hover **and keyboard focus** (a small
|
|
110
|
-
`surface-2` label, `shadow-edge`, `line-strong` ring, fades in 150 ms); every link has an `aria-label`.
|
|
111
|
-
- `xl`: 240 px with labels (14 px medium), items left-aligned with 12 px padding; no tooltip.
|
|
112
|
-
- Item: 48 px high, `rounded-2xl`, 22 px icon, in the destination's tone scope. Active = `bg-surface-2` +
|
|
113
|
-
`inset 0 0 0 1.5px rgb(tone/.7), 0 0 18px rgb(tone/.22)` + `ink-title` text + icon `glow`; at `xl` the face becomes
|
|
114
|
-
a 7 % tone tint. Inactive = `ink-soft`, hover tint `ink-title` at 5 %.
|
|
115
|
-
- The rail lists **every** destination, including the activity modes that the phone dial fans out. Desktop has the
|
|
116
|
-
room; nothing is hidden behind a menu there.
|
|
117
|
-
- Icons keep their tone when inactive in the rail (it is a colour map of the app); in the bottom bar inactive icons
|
|
118
|
-
are mono, because five coloured icons in 320 px read as noise.
|
|
119
|
-
- A navigation item is one record `{ to, label, short, icon, tone }`; the rail, the bottom bar, the dial menu and the
|
|
120
|
-
page title all read the same list. An item is active when the path equals `to` or starts with `to + '/'`.
|
|
121
|
-
|
|
122
|
-
## 4. Bottom bar with the centre dial (phones, tablets)
|
|
123
|
-
|
|
124
|
-
Five slots: **two destinations · the dial · two destinations** (LenS: Home, Words, **Practice**, Dictionary,
|
|
125
|
-
Settings). The dial replaces a row of activity tabs and a "More" sheet: the product's core activities sit behind one
|
|
126
|
-
big, central control, so the bar keeps four stable places and every page stays one or two taps away. Theme and
|
|
127
|
-
log-out, which a "More" sheet would hold, live on the Settings page.
|
|
128
|
-
|
|
129
|
-
The bar's list is `grid grid-cols-5`, 64 px high, `max-width: 32rem`, centred. `<nav aria-label="Main">`.
|
|
130
|
-
|
|
131
|
-
### Flat tabs
|
|
132
|
-
|
|
133
|
-
- Slot: a column, centred, 4 px gap: a 56 x 32 px `rounded-full` pill holding a 22 px icon, then an 11 px display-font
|
|
134
|
-
label (semibold, `leading-none`, tracking .04em).
|
|
135
|
-
- Active: pill `bg-tone/.14` + `inset 0 0 0 1px rgb(tone/.45), 0 0 14px rgb(tone/.22)`, icon in its tone with `glow`,
|
|
136
|
-
label in tone-ink. Inactive: mono icon and label in `ink-muted`, no pill.
|
|
137
|
-
- The whole slot is the link (64 px tall, a fifth of the width: 64 px wide at 320 px).
|
|
138
|
-
- Labels are one word. If a label does not fit at 320 px, give the destination a shorter word (the `short` field),
|
|
139
|
-
never a smaller font.
|
|
140
|
-
|
|
141
|
-
### Centre dial: the pattern
|
|
142
|
-
|
|
143
|
-
The centre slot holds one round, raised button that does two jobs: it **shows today's progress** (the daily-goal
|
|
144
|
-
ring) and it **opens the activity modes** as a radial menu above itself. LenS labels it "Practice" and fans out Quiz,
|
|
145
|
-
Read, Speak and Dictation.
|
|
146
|
-
|
|
147
|
-
Rules:
|
|
148
|
-
|
|
149
|
-
- The dial is navigation, not an action: it never starts an activity directly, it opens the choice.
|
|
150
|
-
- The ring shows a real number from the server (today's XP / daily goal, capped at 1). No decorative spinning ring.
|
|
151
|
-
While the number is unknown the ring is empty and an icon shows; the button never changes size.
|
|
152
|
-
- When the current route is one of the dial's modes, the dial is the **active** tab (tone ink + glow), because the
|
|
153
|
-
four flat tabs are all inactive at that moment.
|
|
154
|
-
- The dial is not the XP landing target; the XP bar is. Two competing targets make the burst ambiguous.
|
|
155
|
-
- Only the disc rises above the bar; the bar's height and `--shell-bottom` do not change. Content that a page pins
|
|
156
|
-
directly above the bar (a sticky action bar, a feedback sheet) keeps its controls out of the centre fifth, or sits
|
|
157
|
-
at least 1 rem above `--shell-bottom`.
|
|
158
|
-
- Hide the whole bar while a full-screen mode has the screen (LenS: a voice call). The bar is not rendered, an
|
|
159
|
-
attribute on `<html>` shrinks `--shell-bottom` to the safe-area inset alone, and an open menu is closed. A stray
|
|
160
|
-
tap on a tab must not end a call or a timed exercise.
|
|
161
|
-
- Desktop (`lg+`) has no dial: the side rail lists the modes directly. The menu closes itself when the viewport
|
|
162
|
-
reaches `lg`, so it can never leave the page inert behind a hidden bar.
|
|
163
|
-
|
|
164
|
-
**Tone scopes.** Every slot of the bar carries the `.tone-*` scope of its destination (on the list item), and the
|
|
165
|
-
dial's slot carries the **primary tone** (`tone-lime`); "the dial's tone" below means that. The radial menu is
|
|
166
|
-
portalled to `<body>`, **outside** the bar, so it inherits no scope: set it again inside the portal, `tone-<mode
|
|
167
|
-
tone>` on each item's positioned wrapper and `tone-lime` on the close button. Without it `rgb(var(--tone)/...)` has
|
|
168
|
-
no value there, and the rings and glows of the menu items and of the close disc are simply not painted.
|
|
169
|
-
|
|
170
|
-
### Sizes
|
|
171
|
-
|
|
172
|
-
```
|
|
173
|
-
(B) (C) 56 px discs, 11 px label under each, item box 64 px wide,
|
|
174
|
-
(A) (D) on an arc above the dial; the lowest disc centres are 62 px above the dial's centre
|
|
175
|
-
╭───╮
|
|
176
|
-
─────────────│ ✕ │────────────── bar top edge; the 60 px disc stands 17 px above it
|
|
177
|
-
⌂ ▤ ╰───╯ ⌕ ⚙ bar: 64 px + safe-area inset, five equal slots
|
|
178
|
-
Home Words Practice Dict Settings
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
| Part | Value |
|
|
182
|
-
|---|---|
|
|
183
|
-
| Disc | 60 px, `bg-surface-2`, `ring-4 ring-surface-base` (an opaque 4 px collar in the bar's colour, so page content does not show through next to the raised part). 60, not 64: the disc and its label together must still read as one tab. Transition: `box-shadow` and `transform`, 200 ms, glide easing |
|
|
184
|
-
| Ring | `ProgressRing` at 60 px, stroke 5, wrapped in `aria-hidden` |
|
|
185
|
-
| Disc position | The button fills the slot (`h-full w-full`); its content is a column **pinned to the slot's bottom** (`absolute inset-x-0 bottom-0`, 8 px bottom padding, 2 px gap between disc and label), so the disc overflows upwards instead of pushing the label out. The disc's centre is therefore `8 + 11 + 2 + 30 = 51 px` above the bar's bottom edge |
|
|
186
|
-
| Label | The tab label style: display font 11 px semibold, `leading-none`, tracking .04em |
|
|
187
|
-
| Menu item | 56 px disc with a 26 px icon in the mode's tone, a 4 px gap, the 11 px label (`ink-title`, `nowrap`); box 64 px wide and about 71 px tall, above the 44 px minimum |
|
|
188
|
-
| Scrim | `fixed inset-0`, `surface-void` at 80 % + `backdrop-blur-sm`, over the page and both bars, hidden from `lg` |
|
|
189
|
-
|
|
190
|
-
The **51 px constant ties the dial and its menu together**: the menu anchors a zero-size element at
|
|
191
|
-
`left: 50%; bottom: calc(env(safe-area-inset-bottom) + 51px)`, exactly on the dial's centre, and places everything
|
|
192
|
-
from it. Change the disc size, the label or the padding and this constant changes with them.
|
|
193
|
-
|
|
194
|
-
### States of the disc
|
|
195
|
-
|
|
196
|
-
| State | Centre | Look |
|
|
197
|
-
|---|---|---|
|
|
198
|
-
| Progress unknown (loading, or the read failed) | a 22 px mono target icon | empty ring, `ink-title`, drop shadow `0 4px 14px rgb(0 0 0/.35)` |
|
|
199
|
-
| In progress | `60%` in the display font, 15 px bold, `leading-none`, `tabular-nums`, **floored** (99.6 % must not read as 100 %) | the same |
|
|
200
|
-
| Goal reached | a 24 px check in the dial's tone (lime), with `glow` when active | the same; full ring |
|
|
201
|
-
| Active (a mode's route is current) | as above | text and label in tone-ink, glow `0 0 20px rgb(tone/.45)` instead of the drop shadow |
|
|
202
|
-
| Open | a 22 px mono cross | active look; this is the menu's own copy of the disc, inside the portal under its own `tone-lime` scope |
|
|
203
|
-
| Pressed | | the disc scales to .95 |
|
|
204
|
-
|
|
205
|
-
Menu item states, in the mode's tone (the scope on the item's wrapper): default = `bg-surface-2` +
|
|
206
|
-
`inset 0 0 0 1.5px rgb(tone-ink/.7), 0 0 14px rgb(tone/.22)`; the current mode =
|
|
207
|
-
`inset 0 0 0 2px rgb(tone-ink), 0 0 22px rgb(tone/.5)` and icon `glow`; pressed = scale .95 (150 ms).
|
|
208
|
-
|
|
209
|
-
### The geometry rule
|
|
210
|
-
|
|
211
|
-
Offsets are measured from the dial's centre to each item's disc centre, x to the right, y down; every y is negative.
|
|
212
|
-
Keep this as a pure function with unit tests: it is the part that breaks silently.
|
|
213
|
-
|
|
214
|
-
1. **Even spread on an arc, mirrored around the vertical axis.** For `count` items over `span` degrees:
|
|
215
|
-
`angle_i = (i / (count - 1) - 0.5) * span`, `x_i = radiusX * sin(angle_i)`, `y_i = -radius * cos(angle_i)`.
|
|
216
|
-
A single item sits straight above the dial (`angle = 0`).
|
|
217
|
-
2. **Span by item count:** 3 → 100°, 4 → 120°, 5 → 136°, 6 → 150° (2 → 64°, though two items should not be a radial
|
|
218
|
-
menu). Each span is wide enough that neighbouring discs and labels do not touch on a 320 px screen.
|
|
219
|
-
3. **Radius:** `radius = max(112, 62 / cos(span / 2))`. The second term keeps the **outer** items exactly 62 px above
|
|
220
|
-
the dial's centre whatever the span, so their labels (ending 43 px under the disc centre) clear the bar's top
|
|
221
|
-
edge by 6 px. Results: 112, 124, 165.5 and 239.5 px for 3, 4, 5 and 6 items.
|
|
222
|
-
4. **Squeeze, do not shrink.** When the circle is wider than the screen, only the horizontal radius is reduced:
|
|
223
|
-
`radiusX = min(radius, (viewportWidth / 2 - margin - itemWidth / 2) / sin(span / 2))` with `margin = 8` and
|
|
224
|
-
`itemWidth = 64`. The arc becomes an ellipse: heights stay, the outer items move in, and nothing is cut off by the
|
|
225
|
-
screen edge. Item sizes and labels never change.
|
|
226
|
-
5. Read the viewport width from `document.documentElement.clientWidth` and recompute on `resize`.
|
|
227
|
-
|
|
228
|
-
| Items | 320 px wide | 360 px | 390 px and wider |
|
|
229
|
-
|---|---|---|---|
|
|
230
|
-
| 3 | (±86, -72) (0, -112) | the same | the same |
|
|
231
|
-
| 4 | (±107, -62) (±42, -117) | the same | the same |
|
|
232
|
-
| 5 | (±120, -62) (±72, -137) (0, -166) | (±140, -62) (±84, -137) (0, -166) | (±153, -62) (±93, -137) (0, -166) |
|
|
233
|
-
| 6 | (±120, -62) (±88, -169) (±32, -231) | (±140, -62) (±102, -169) (±38, -231) | (±155, -62) (±113, -169) (±42, -231) at 390; a full circle only from about 545 px: (±231, -62) (±169, -169) (±62, -231) |
|
|
234
|
-
|
|
235
|
-
Each item is positioned absolutely from the anchor: `left = x - 32`, `top = y - 28`, `width = 64`.
|
|
236
|
-
|
|
237
|
-
What the tests assert, for 3 to 6 items at 320, 360, 390 and 768 px: mirror symmetry and left-to-right order; every
|
|
238
|
-
item inside the viewport with the 8 px margin; every item at least 60 px above the dial's centre and at least 8 px
|
|
239
|
-
clear of the dial (centre distance >= 30 + 28 + 8); discs at least 4 px apart; no label box touching a neighbouring
|
|
240
|
-
disc or label. Re-run them after changing any constant. Labels are assumed to fit in 64 px: one short word
|
|
241
|
-
("Dictation" is about the limit at 11 px).
|
|
242
|
-
|
|
243
|
-
### Motion
|
|
244
|
-
|
|
245
|
-
- Scrim: opacity 0 → 1 in 180 ms.
|
|
246
|
-
- Items: each starts **on the dial's centre** (translated by `(-x, -y)`), scale .4, opacity 0, and springs to its
|
|
247
|
-
place (stiffness 420, damping 26) with a 35 ms stagger left to right. Exit: back into the dial in 140 ms, no
|
|
248
|
-
stagger. Only `transform` and `opacity` animate.
|
|
249
|
-
- The dial does not move or morph: the menu draws its own disc exactly over it, so the swap is invisible.
|
|
250
|
-
- Reduced motion: the root motion setting drops the travel and the scale; the items fade in place.
|
|
251
|
-
|
|
252
|
-
### Accessibility
|
|
253
|
-
|
|
254
|
-
- Dial: `<button aria-haspopup="menu" aria-expanded>`; accessible name "Practice", "Practice, 60% of today's goal" or
|
|
255
|
-
"Practice, today's goal reached". The ring inside is `aria-hidden` (a `progressbar` nested in a button is ignored
|
|
256
|
-
by assistive tech), so the name carries the value.
|
|
257
|
-
- Menu: `role="menu"` with a label ("Practice modes") and `aria-orientation="horizontal"`; each mode is a router link
|
|
258
|
-
with `role="menuitem"`, its positioned wrapper `role="none"`. The current mode gets `aria-current` from the router
|
|
259
|
-
and the stronger ring.
|
|
260
|
-
- It is **modal** (§6): focus starts on the first mode, Tab stays inside (modes, then the close button), Escape
|
|
261
|
-
closes, the app root is inert and scroll-locked, and focus returns to the dial on close.
|
|
262
|
-
- Arrow Right / Down and Left / Up move between modes and wrap; Home and End jump to the first and last.
|
|
263
|
-
- Because the app root (and with it the real dial) is inert while the menu is open, the close control must live
|
|
264
|
-
**inside the portal**: a second button ("Close practice modes") placed exactly over the dial
|
|
265
|
-
(`left: -30px; top: -30px` from the anchor) with the same face showing a cross. The thumb that opened the menu
|
|
266
|
-
closes it without moving.
|
|
267
|
-
- Closes on: choosing a mode, the close button, a scrim tap, Escape, the viewport reaching `lg`, and the bar being
|
|
268
|
-
hidden.
|
|
269
|
-
- The menu is mounted only while open, inside an exit-animation boundary: the modal-focus behaviour runs on mount.
|
|
270
|
-
|
|
271
|
-
### When not to use a radial menu
|
|
272
|
-
|
|
273
|
-
- **Fewer than 3 or more than 6 items.** One or two do not make an arc (use a plain raised link, or two flat tabs);
|
|
274
|
-
seven or more cannot keep 56 px discs apart at 320 px (use a bottom sheet with a list).
|
|
275
|
-
- **Long or translated labels.** Each label has 64 px. If the names do not fit in one short word in every language
|
|
276
|
-
the product ships, use a sheet.
|
|
277
|
-
- **Items that are not peers.** The arc says "equal choices of one kind". Do not mix modes with settings, account
|
|
278
|
-
actions or destructive commands; those belong in Settings or a sheet.
|
|
279
|
-
- **A list that changes** (per user, per day, feature flags that reorder). A radial menu is learned by position;
|
|
280
|
-
moving items breaks that.
|
|
281
|
-
- **Desktop or pointer-first layouts.** The arc exists for a thumb at the bottom edge of a phone. With a rail or a
|
|
282
|
-
top navigation, list the destinations.
|
|
283
|
-
- **A product with one core activity.** A menu with one real choice is a detour: make the centre button a plain
|
|
284
|
-
raised link to it.
|
|
285
|
-
- **Nested menus.** Never open a second level from an arc item.
|
|
286
|
-
|
|
287
|
-
## 5. Responsive rules
|
|
288
|
-
|
|
289
|
-
| Breakpoint | Shell | Notes |
|
|
290
|
-
|---|---|---|
|
|
291
|
-
| 320-639 | Bottom bar + compact HUD (hexagon, streak, ring; XP as a 2 px line) | Design here first. Paths zigzag; cards stack; page padding 16 px |
|
|
292
|
-
| `sm` 640 | The same shell | Horizontal path; two-column stat rows; padding 24 px |
|
|
293
|
-
| `md` 768 | Bottom bar; the full XP bar, theme toggle and account menu appear in the top bar | Toasts move from top-centre to bottom-left |
|
|
294
|
-
| `lg` 1024 | 72 px icon rail, no bottom bar | `--shell-bottom: 0px`; padding 32 px |
|
|
295
|
-
| `xl` 1280 | 240 px rail with labels | Home gets a side column (quests, week strip) |
|
|
296
|
-
|
|
297
|
-
- No hover-only actions: everything reachable by hover is also reachable by tap and by keyboard focus.
|
|
298
|
-
- Phones get **sheets** where desktop gets popovers.
|
|
299
|
-
- Use `min-h-dvh` / `100dvh`, not `100vh`: mobile browser bars change the viewport height.
|
|
300
|
-
- Long lists: `content-visibility: auto` on rows.
|
|
301
|
-
- Page container: centred, max width 1320 px, the paddings above, 24 px top (32 from `lg`); 68ch for reading text.
|
|
302
|
-
|
|
303
|
-
## 6. Sheets and dialogs
|
|
304
|
-
|
|
305
|
-
All of them: portal to `<body>`, `role="dialog" aria-modal="true"`, a label (`aria-labelledby` or `aria-label`),
|
|
306
|
-
`tabIndex={-1}` on the panel (so a click on its plain content keeps focus inside), and the modal-focus behaviour
|
|
307
|
-
below. The dial's radial menu (§4) is the one modal layer that is a `role="menu"` instead of a dialog; it uses the
|
|
308
|
-
same behaviour.
|
|
309
|
-
|
|
310
|
-
Modal focus, as one hook `(dialogRef, onClose, initialFocus?)` that acts while the dialog is mounted:
|
|
311
|
-
|
|
312
|
-
| Behaviour | Why |
|
|
313
|
-
|---|---|
|
|
314
|
-
| On mount, remember the focused element, then move focus into the dialog: the `initialFocus` selector, else the first focusable, else the panel | Keyboard and screen-reader users land where the action is |
|
|
315
|
-
| Tab / Shift+Tab wrap inside; a Tab pressed while focus is outside or on the panel itself goes to the first / last focusable | Focus cannot wander into the page behind |
|
|
316
|
-
| Escape closes; the key listener is on `document`, not on the dialog | Keys still work after focus lands on `<body>` (a click on plain text) |
|
|
317
|
-
| Sets `inert` on the app root (`#root`) and `overflow: hidden` on `body` (remembering the previous value) | The page behind is unreachable for pointer, keyboard and assistive tech; no scroll bleed |
|
|
318
|
-
| Keeps a module-level stack of open dialogs; only the top one handles keys; the lock is applied by the first and released when the last closes | A dialog opened from a sheet works |
|
|
319
|
-
| On unmount, returns focus to the remembered element | The user continues where they were |
|
|
320
|
-
|
|
321
|
-
"Focusable" = links with `href`, enabled buttons, inputs, selects, textareas, and anything with a `tabindex` other
|
|
322
|
-
than -1. Keep `onClose` in a ref so a new callback identity does not re-run the effect.
|
|
323
|
-
|
|
324
|
-
Consequences to respect:
|
|
325
|
-
|
|
326
|
-
- **Dialogs must be portalled outside the app root**, or they become inert with it.
|
|
327
|
-
- Providers that render overlays (rewards, toasts) also portal to `<body>` for the same reason.
|
|
328
|
-
- The behaviour runs on mount: mount the dialog component only while it is open, inside the exit-animation boundary;
|
|
329
|
-
do not keep it mounted and hidden.
|
|
330
|
-
- If the trigger disappears while the dialog is open (a Claim button), move focus somewhere sensible on close.
|
|
331
|
-
|
|
332
|
-
Bottom sheet (phones): scrim `surface-void` at 70 % + `backdrop-blur-sm` (fades 200 ms); the panel is pinned to the
|
|
333
|
-
bottom, `max-height: 85dvh`, scrolls inside, `rounded-t-4xl`, top border `line`, `bg-surface-1`, `shadow-edge`, and
|
|
334
|
-
slides from `y: 100%` in 280 ms `ease-glide`; padding includes the safe area
|
|
335
|
-
(`padding-bottom: calc(1.25rem + env(safe-area-inset-bottom))`); a 40 x 4 px `line-strong` grab handle (decorative)
|
|
336
|
-
and a real close button (ghost `RoundButton` with an `aria-label`).
|
|
337
|
-
|
|
338
|
-
Centre modal (confirmation, level-up): scrim `surface-void` at 80 % + `backdrop-blur-md`; the scrim container scrolls
|
|
339
|
-
vertically and holds an inner `grid min-h-full place-items-center` with 24 px padding, so on a short screen the dialog
|
|
340
|
-
scrolls and its primary button stays reachable. Clicking the scrim closes; clicks inside the panel stop propagation.
|
|
341
|
-
|
|
342
|
-
Destructive confirmation: the title states the action and object ("Delete 3 items?"), the body states the
|
|
343
|
-
consequence, the buttons are a `ghost` Cancel + a `danger` verb. Initial focus on Cancel.
|
|
344
|
-
|
|
345
|
-
Non-modal popovers (HUD panel, account menu): no inert, no scrim; closed by an outside pointer-down or Escape. A menu
|
|
346
|
-
uses `role="menu"` / `menuitem`, arrow keys, and closes on Tab.
|
|
347
|
-
|
|
348
|
-
## 7. Page skeletons and route loading
|
|
349
|
-
|
|
350
|
-
- Each page is its own lazily loaded chunk. The suspense boundary sits **inside** the shell, around the page outlet:
|
|
351
|
-
the bars stay on screen and only the page area shows a skeleton.
|
|
352
|
-
- The route skeleton (a heading bar, a line, two 160 px cards in the page container) appears only after **150 ms**, so
|
|
353
|
-
a cached or fast chunk never flashes it. It is a `role="status"` with an `sr-only` "Loading".
|
|
354
|
-
- A skeleton has the same boxes as the loaded page section (same card, same heights). Layout shift on load is
|
|
355
|
-
treated as a bug.
|
|
356
|
-
- Data inside a loaded page: per-card skeletons, never a full-page spinner. Buttons that wait show their own spinner,
|
|
357
|
-
keep their size and keep focus.
|
|
358
|
-
- Errors: an inline `role="alert"` line in coral-ink next to the control that failed, with a retry; an `EmptyState`
|
|
359
|
-
when there is nothing yet. A failed HUD read hides the HUD, it does not block the page. A page whose chunk failed to
|
|
360
|
-
load shows an `EmptyState` with a Reload button in the page area, inside the shell, and navigating to another route
|
|
361
|
-
clears it.
|
|
362
|
-
- On navigation: scroll to top, set `document.title` to the page name, keep the HUD mounted (it must not flash).
|
|
1
|
+
# Layout and navigation
|
|
2
|
+
|
|
3
|
+
The app shell: a HUD top bar, a side rail on desktop, a bottom bar with a raised centre dial on phones and tablets,
|
|
4
|
+
plus the rules for responsive behaviour, safe areas, sheets, dialogs and loading skeletons. Every number is the one
|
|
5
|
+
LenS ships; the components named here are described in `COMPONENTS.md`.
|
|
6
|
+
|
|
7
|
+
## 1. Shell anatomy
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
< lg (phones, tablets) >= lg (desktop)
|
|
11
|
+
┌──────────────────────────────┐ ┌────┬──────────────────────────────┐
|
|
12
|
+
│ logo [hex][🔥12][◔] │ 56 px │ ◎ │ Page title [hex ▰▰▱][🔥][◔]│ 56 px
|
|
13
|
+
│▁▁▁▁▁ 2 px XP line ▁▁▁▁▁▁▁▁▁▁▁│ ├────┼──────────────────────────────┤
|
|
14
|
+
│ │ │ ⌂ │ │
|
|
15
|
+
│ page │ │ ▤ │ page │
|
|
16
|
+
│ │ │ ▶ │ │
|
|
17
|
+
│ ╭───╮ │ │ ⚑ │ │
|
|
18
|
+
│ ⌂ ▤ ( 60% ) ⌕ ⚙ │ 64 px │ ⚙ │ │
|
|
19
|
+
└──────────────────────────────┘ + inset └────┴──────────────────────────────┘
|
|
20
|
+
72 px (lg) / 240 px with labels (xl)
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Element order in the shell root (`relative min-h-dvh`): backdrop, skip link, side rail, content column (top bar +
|
|
24
|
+
`<main>`), bottom bar.
|
|
25
|
+
|
|
26
|
+
| Piece | Definition | z |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Backdrop | `.neon-backdrop` (fixed, behind everything), rendered once, `aria-hidden` | -10 |
|
|
29
|
+
| Skip link | "Skip to content", the first focusable element: visually hidden until focused, then fixed at top-left as a small `surface-2` pill; targets `#main` | 50 |
|
|
30
|
+
| Top bar | `sticky top-0`, 56 px high, bottom border `line` at 70 %, `surface-base` at 70 % + `backdrop-blur-xl` | 30 |
|
|
31
|
+
| Side rail | `fixed inset-y-0 left`, hidden below `lg`, 72 px wide (240 px from `xl`), right border `line` at 70 %, `surface-base` at 85 % | 30 |
|
|
32
|
+
| Content column | `flex min-h-dvh flex-col`, left padding 72 px from `lg` and 240 px from `xl`, plus the side safe-area insets | |
|
|
33
|
+
| `<main>` | `flex-1`, `padding-bottom: var(--shell-bottom)`, `id="main" tabIndex={-1}`, no focus outline | |
|
|
34
|
+
| Bottom bar | `fixed inset-x-0 bottom-0`, 64 px + the bottom safe-area inset as padding, top border `line` at 70 %, `surface-base` at 80 % + `backdrop-blur-xl`, hidden from `lg` | 30 |
|
|
35
|
+
| Sheets, the dial's radial menu | portal to `<body>` | 40 |
|
|
36
|
+
| Reward burst overlay / reward toast / level-up modal / toasts | portal to `<body>` | 100 / 105 / 110 / 120 |
|
|
37
|
+
|
|
38
|
+
This table is the only place the z-order is defined; the other guides refer to it.
|
|
39
|
+
|
|
40
|
+
`--shell-top` (`3.5rem + 1px`: bar + border) and `--shell-bottom` (`4rem + env(safe-area-inset-bottom)`, `0px` from
|
|
41
|
+
1024 px) are defined on `:root`. Anything sticky inside a page offsets by them (`top: var(--shell-top)`), and
|
|
42
|
+
`scroll-padding-top / -bottom` on `html` uses them so a focused control never hides under a bar. A page that pins its
|
|
43
|
+
own bar above the bottom bar sets `--page-bar` to that bar's height, which is added to the bottom scroll padding.
|
|
44
|
+
|
|
45
|
+
`backdrop-filter` is used on the top bar, bottom bar, sheets, toasts and modal scrims **only**. Blur on cards or on
|
|
46
|
+
the backdrop makes scrolling janky on mid-range phones; the background lights are static gradients for that reason.
|
|
47
|
+
|
|
48
|
+
Safe areas (needs `viewport-fit=cover`): the content column is padded by `env(safe-area-inset-left / -right)`; the top
|
|
49
|
+
bar cancels that with equal negative margins and re-adds it as its own padding, so its **background** runs under a
|
|
50
|
+
landscape notch while its **content** stays clear. The rail sits at `left: env(safe-area-inset-left)`.
|
|
51
|
+
|
|
52
|
+
## 2. Top bar: the HUD
|
|
53
|
+
|
|
54
|
+
Inner row: 56 px high, 12 px gaps, horizontal padding 16 px (24 from `sm`, 32 from `lg`).
|
|
55
|
+
|
|
56
|
+
Left: the logo link below `lg` (min height 44 px); from `lg` the page title instead (display font 18 px semibold,
|
|
57
|
+
truncated), because the rail carries the logo there.
|
|
58
|
+
|
|
59
|
+
Right: a group with a 4 px gap (8 px from `sm`) holding the HUD button and, from `md`, the theme toggle and the
|
|
60
|
+
account menu. The HUD is **one button** that opens a details panel; its parts sit in a row with an 8 px gap (12 px
|
|
61
|
+
from `sm`), in this order:
|
|
62
|
+
|
|
63
|
+
1. `LevelBadge` `md` (34 x 38 hexagon)
|
|
64
|
+
2. `XpBar` (176 px, `LV 7` / `120 / 500 XP`): from `md` only. Its wrapper is marked `data-xp-target`.
|
|
65
|
+
3. `StreakPill`
|
|
66
|
+
4. `ProgressRing` 34 px for the daily goal, with the percentage inside (9 px bold display font, lime-ink) until
|
|
67
|
+
100 %; then the ring's own check pops in. **Floor** the percentage, here and in the dial (§4), so 99.6 % never
|
|
68
|
+
reads "100%" next to a ring that is not closed. (LenS rounds in this ring and floors in the dial; use one rule.)
|
|
69
|
+
|
|
70
|
+
Then, from `md`: a ghost `RoundButton` `sm` theme toggle (shows the sun on dark, the moon on light; its label says
|
|
71
|
+
which theme it switches to) and the account menu. On phones those two live on the Settings page, not in the bar: at
|
|
72
|
+
320 px the bar holds logo + hexagon + streak + ring and nothing else.
|
|
73
|
+
|
|
74
|
+
Phones: the XP bar becomes a **2 px line on the bottom edge of the top bar** (`absolute inset-x-0 -bottom-px`, the
|
|
75
|
+
compact `XpBar`, hidden from `md`), also marked `data-xp-target`, so the reward burst always has a visible landing
|
|
76
|
+
point. How the burst chooses between the two targets: COMPONENTS.md, Reward system.
|
|
77
|
+
|
|
78
|
+
HUD button details:
|
|
79
|
+
|
|
80
|
+
- Slightly padded (6 px sideways, 4 px vertical, with matching negative margins so it does not shift the row),
|
|
81
|
+
`rounded-2xl`, hover tint `ink-title` at 4 %.
|
|
82
|
+
- Its accessible name is the whole state in words: "Level 7, 120 of 500 XP. 12-day streak, done today. Daily goal
|
|
83
|
+
40 of 60 XP. Show details". The parts inside are presentational for assistive tech (roles inside a button are
|
|
84
|
+
flattened), so without this label a screen-reader user hears only "button".
|
|
85
|
+
- `aria-expanded` + `aria-controls`; the panel is a non-modal `role="region"` popover labelled "Your progress":
|
|
86
|
+
anchored to the button's right edge, 8 px below, width `min(20rem, 100vw - 1.5rem)`, `rounded-3xl`, `border-line`,
|
|
87
|
+
`bg-surface-2`, `shadow-edge`, padding 16 px. It enters in 160 ms (opacity 0 → 1, y -6 → 0, scale .98 → 1, origin
|
|
88
|
+
top right). An outside pointer-down or Escape closes it; Escape returns focus to the button.
|
|
89
|
+
- The panel repeats the three facts as rows separated by hairlines (`line`); each row has 16 px of vertical padding
|
|
90
|
+
(none above the first or below the last) and a 14 px gap between its graphic and its text:
|
|
91
|
+
- a `lg` level badge + a full-width XP bar + "380 XP to level 8";
|
|
92
|
+
- a flame tile (44 px, `rounded-2xl`, ember at 10 %, an inset 1 px ember ring at 30 %, a 24 px flame: ember, with
|
|
93
|
+
`glow` when today is done, mono when there is no streak) + "12-day streak · best 21" + one sentence for the state;
|
|
94
|
+
- a 44 px goal ring with stroke 4 + "40 / 60 XP today" + "20 XP to reach your daily goal." or "Daily goal reached.
|
|
95
|
+
Nice work!".
|
|
96
|
+
- While the HUD read is pending, show a skeleton with the same boxes (34 x 38 hexagon, 176 x 24 bar from `md`,
|
|
97
|
+
64 x 36 pill, 34 px circle), so the bar does not reflow when data arrives. If the read failed, render nothing: the
|
|
98
|
+
bar still works without the game.
|
|
99
|
+
|
|
100
|
+
Account menu (pattern): a 44 px avatar button (the user's initial inside a thin spectral ring: a conic gradient with
|
|
101
|
+
1.5 px padding around a `surface-1` disc), `aria-haspopup="menu"`. The popover is 256 px wide, `rounded-2xl`, with the
|
|
102
|
+
name and e-mail, a hairline, then a `role="menu"` of 44 px rows (Settings; Log out in coral). Focus moves to the first
|
|
103
|
+
item on open; arrow keys, Home and End move; Tab closes; Escape closes and returns focus.
|
|
104
|
+
|
|
105
|
+
## 3. Side rail (desktop)
|
|
106
|
+
|
|
107
|
+
- Header: a 56 px row with the logo link (mark only at `lg`, mark + wordmark at `xl`), a hairline under it. List:
|
|
108
|
+
12 px side padding, 16 px top, 6 px between items. Footer: the app version in mono 9 px, `ink-muted`.
|
|
109
|
+
- `lg`: 72 px, icons only, with a tooltip to the right of the item on hover **and keyboard focus** (a small
|
|
110
|
+
`surface-2` label, `shadow-edge`, `line-strong` ring, fades in 150 ms); every link has an `aria-label`.
|
|
111
|
+
- `xl`: 240 px with labels (14 px medium), items left-aligned with 12 px padding; no tooltip.
|
|
112
|
+
- Item: 48 px high, `rounded-2xl`, 22 px icon, in the destination's tone scope. Active = `bg-surface-2` +
|
|
113
|
+
`inset 0 0 0 1.5px rgb(tone/.7), 0 0 18px rgb(tone/.22)` + `ink-title` text + icon `glow`; at `xl` the face becomes
|
|
114
|
+
a 7 % tone tint. Inactive = `ink-soft`, hover tint `ink-title` at 5 %.
|
|
115
|
+
- The rail lists **every** destination, including the activity modes that the phone dial fans out. Desktop has the
|
|
116
|
+
room; nothing is hidden behind a menu there.
|
|
117
|
+
- Icons keep their tone when inactive in the rail (it is a colour map of the app); in the bottom bar inactive icons
|
|
118
|
+
are mono, because five coloured icons in 320 px read as noise.
|
|
119
|
+
- A navigation item is one record `{ to, label, short, icon, tone }`; the rail, the bottom bar, the dial menu and the
|
|
120
|
+
page title all read the same list. An item is active when the path equals `to` or starts with `to + '/'`.
|
|
121
|
+
|
|
122
|
+
## 4. Bottom bar with the centre dial (phones, tablets)
|
|
123
|
+
|
|
124
|
+
Five slots: **two destinations · the dial · two destinations** (LenS: Home, Words, **Practice**, Dictionary,
|
|
125
|
+
Settings). The dial replaces a row of activity tabs and a "More" sheet: the product's core activities sit behind one
|
|
126
|
+
big, central control, so the bar keeps four stable places and every page stays one or two taps away. Theme and
|
|
127
|
+
log-out, which a "More" sheet would hold, live on the Settings page.
|
|
128
|
+
|
|
129
|
+
The bar's list is `grid grid-cols-5`, 64 px high, `max-width: 32rem`, centred. `<nav aria-label="Main">`.
|
|
130
|
+
|
|
131
|
+
### Flat tabs
|
|
132
|
+
|
|
133
|
+
- Slot: a column, centred, 4 px gap: a 56 x 32 px `rounded-full` pill holding a 22 px icon, then an 11 px display-font
|
|
134
|
+
label (semibold, `leading-none`, tracking .04em).
|
|
135
|
+
- Active: pill `bg-tone/.14` + `inset 0 0 0 1px rgb(tone/.45), 0 0 14px rgb(tone/.22)`, icon in its tone with `glow`,
|
|
136
|
+
label in tone-ink. Inactive: mono icon and label in `ink-muted`, no pill.
|
|
137
|
+
- The whole slot is the link (64 px tall, a fifth of the width: 64 px wide at 320 px).
|
|
138
|
+
- Labels are one word. If a label does not fit at 320 px, give the destination a shorter word (the `short` field),
|
|
139
|
+
never a smaller font.
|
|
140
|
+
|
|
141
|
+
### Centre dial: the pattern
|
|
142
|
+
|
|
143
|
+
The centre slot holds one round, raised button that does two jobs: it **shows today's progress** (the daily-goal
|
|
144
|
+
ring) and it **opens the activity modes** as a radial menu above itself. LenS labels it "Practice" and fans out Quiz,
|
|
145
|
+
Read, Speak and Dictation.
|
|
146
|
+
|
|
147
|
+
Rules:
|
|
148
|
+
|
|
149
|
+
- The dial is navigation, not an action: it never starts an activity directly, it opens the choice.
|
|
150
|
+
- The ring shows a real number from the server (today's XP / daily goal, capped at 1). No decorative spinning ring.
|
|
151
|
+
While the number is unknown the ring is empty and an icon shows; the button never changes size.
|
|
152
|
+
- When the current route is one of the dial's modes, the dial is the **active** tab (tone ink + glow), because the
|
|
153
|
+
four flat tabs are all inactive at that moment.
|
|
154
|
+
- The dial is not the XP landing target; the XP bar is. Two competing targets make the burst ambiguous.
|
|
155
|
+
- Only the disc rises above the bar; the bar's height and `--shell-bottom` do not change. Content that a page pins
|
|
156
|
+
directly above the bar (a sticky action bar, a feedback sheet) keeps its controls out of the centre fifth, or sits
|
|
157
|
+
at least 1 rem above `--shell-bottom`.
|
|
158
|
+
- Hide the whole bar while a full-screen mode has the screen (LenS: a voice call). The bar is not rendered, an
|
|
159
|
+
attribute on `<html>` shrinks `--shell-bottom` to the safe-area inset alone, and an open menu is closed. A stray
|
|
160
|
+
tap on a tab must not end a call or a timed exercise.
|
|
161
|
+
- Desktop (`lg+`) has no dial: the side rail lists the modes directly. The menu closes itself when the viewport
|
|
162
|
+
reaches `lg`, so it can never leave the page inert behind a hidden bar.
|
|
163
|
+
|
|
164
|
+
**Tone scopes.** Every slot of the bar carries the `.tone-*` scope of its destination (on the list item), and the
|
|
165
|
+
dial's slot carries the **primary tone** (`tone-lime`); "the dial's tone" below means that. The radial menu is
|
|
166
|
+
portalled to `<body>`, **outside** the bar, so it inherits no scope: set it again inside the portal, `tone-<mode
|
|
167
|
+
tone>` on each item's positioned wrapper and `tone-lime` on the close button. Without it `rgb(var(--tone)/...)` has
|
|
168
|
+
no value there, and the rings and glows of the menu items and of the close disc are simply not painted.
|
|
169
|
+
|
|
170
|
+
### Sizes
|
|
171
|
+
|
|
172
|
+
```
|
|
173
|
+
(B) (C) 56 px discs, 11 px label under each, item box 64 px wide,
|
|
174
|
+
(A) (D) on an arc above the dial; the lowest disc centres are 62 px above the dial's centre
|
|
175
|
+
╭───╮
|
|
176
|
+
─────────────│ ✕ │────────────── bar top edge; the 60 px disc stands 17 px above it
|
|
177
|
+
⌂ ▤ ╰───╯ ⌕ ⚙ bar: 64 px + safe-area inset, five equal slots
|
|
178
|
+
Home Words Practice Dict Settings
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
| Part | Value |
|
|
182
|
+
|---|---|
|
|
183
|
+
| Disc | 60 px, `bg-surface-2`, `ring-4 ring-surface-base` (an opaque 4 px collar in the bar's colour, so page content does not show through next to the raised part). 60, not 64: the disc and its label together must still read as one tab. Transition: `box-shadow` and `transform`, 200 ms, glide easing |
|
|
184
|
+
| Ring | `ProgressRing` at 60 px, stroke 5, wrapped in `aria-hidden` |
|
|
185
|
+
| Disc position | The button fills the slot (`h-full w-full`); its content is a column **pinned to the slot's bottom** (`absolute inset-x-0 bottom-0`, 8 px bottom padding, 2 px gap between disc and label), so the disc overflows upwards instead of pushing the label out. The disc's centre is therefore `8 + 11 + 2 + 30 = 51 px` above the bar's bottom edge |
|
|
186
|
+
| Label | The tab label style: display font 11 px semibold, `leading-none`, tracking .04em |
|
|
187
|
+
| Menu item | 56 px disc with a 26 px icon in the mode's tone, a 4 px gap, the 11 px label (`ink-title`, `nowrap`); box 64 px wide and about 71 px tall, above the 44 px minimum |
|
|
188
|
+
| Scrim | `fixed inset-0`, `surface-void` at 80 % + `backdrop-blur-sm`, over the page and both bars, hidden from `lg` |
|
|
189
|
+
|
|
190
|
+
The **51 px constant ties the dial and its menu together**: the menu anchors a zero-size element at
|
|
191
|
+
`left: 50%; bottom: calc(env(safe-area-inset-bottom) + 51px)`, exactly on the dial's centre, and places everything
|
|
192
|
+
from it. Change the disc size, the label or the padding and this constant changes with them.
|
|
193
|
+
|
|
194
|
+
### States of the disc
|
|
195
|
+
|
|
196
|
+
| State | Centre | Look |
|
|
197
|
+
|---|---|---|
|
|
198
|
+
| Progress unknown (loading, or the read failed) | a 22 px mono target icon | empty ring, `ink-title`, drop shadow `0 4px 14px rgb(0 0 0/.35)` |
|
|
199
|
+
| In progress | `60%` in the display font, 15 px bold, `leading-none`, `tabular-nums`, **floored** (99.6 % must not read as 100 %) | the same |
|
|
200
|
+
| Goal reached | a 24 px check in the dial's tone (lime), with `glow` when active | the same; full ring |
|
|
201
|
+
| Active (a mode's route is current) | as above | text and label in tone-ink, glow `0 0 20px rgb(tone/.45)` instead of the drop shadow |
|
|
202
|
+
| Open | a 22 px mono cross | active look; this is the menu's own copy of the disc, inside the portal under its own `tone-lime` scope |
|
|
203
|
+
| Pressed | | the disc scales to .95 |
|
|
204
|
+
|
|
205
|
+
Menu item states, in the mode's tone (the scope on the item's wrapper): default = `bg-surface-2` +
|
|
206
|
+
`inset 0 0 0 1.5px rgb(tone-ink/.7), 0 0 14px rgb(tone/.22)`; the current mode =
|
|
207
|
+
`inset 0 0 0 2px rgb(tone-ink), 0 0 22px rgb(tone/.5)` and icon `glow`; pressed = scale .95 (150 ms).
|
|
208
|
+
|
|
209
|
+
### The geometry rule
|
|
210
|
+
|
|
211
|
+
Offsets are measured from the dial's centre to each item's disc centre, x to the right, y down; every y is negative.
|
|
212
|
+
Keep this as a pure function with unit tests: it is the part that breaks silently.
|
|
213
|
+
|
|
214
|
+
1. **Even spread on an arc, mirrored around the vertical axis.** For `count` items over `span` degrees:
|
|
215
|
+
`angle_i = (i / (count - 1) - 0.5) * span`, `x_i = radiusX * sin(angle_i)`, `y_i = -radius * cos(angle_i)`.
|
|
216
|
+
A single item sits straight above the dial (`angle = 0`).
|
|
217
|
+
2. **Span by item count:** 3 → 100°, 4 → 120°, 5 → 136°, 6 → 150° (2 → 64°, though two items should not be a radial
|
|
218
|
+
menu). Each span is wide enough that neighbouring discs and labels do not touch on a 320 px screen.
|
|
219
|
+
3. **Radius:** `radius = max(112, 62 / cos(span / 2))`. The second term keeps the **outer** items exactly 62 px above
|
|
220
|
+
the dial's centre whatever the span, so their labels (ending 43 px under the disc centre) clear the bar's top
|
|
221
|
+
edge by 6 px. Results: 112, 124, 165.5 and 239.5 px for 3, 4, 5 and 6 items.
|
|
222
|
+
4. **Squeeze, do not shrink.** When the circle is wider than the screen, only the horizontal radius is reduced:
|
|
223
|
+
`radiusX = min(radius, (viewportWidth / 2 - margin - itemWidth / 2) / sin(span / 2))` with `margin = 8` and
|
|
224
|
+
`itemWidth = 64`. The arc becomes an ellipse: heights stay, the outer items move in, and nothing is cut off by the
|
|
225
|
+
screen edge. Item sizes and labels never change.
|
|
226
|
+
5. Read the viewport width from `document.documentElement.clientWidth` and recompute on `resize`.
|
|
227
|
+
|
|
228
|
+
| Items | 320 px wide | 360 px | 390 px and wider |
|
|
229
|
+
|---|---|---|---|
|
|
230
|
+
| 3 | (±86, -72) (0, -112) | the same | the same |
|
|
231
|
+
| 4 | (±107, -62) (±42, -117) | the same | the same |
|
|
232
|
+
| 5 | (±120, -62) (±72, -137) (0, -166) | (±140, -62) (±84, -137) (0, -166) | (±153, -62) (±93, -137) (0, -166) |
|
|
233
|
+
| 6 | (±120, -62) (±88, -169) (±32, -231) | (±140, -62) (±102, -169) (±38, -231) | (±155, -62) (±113, -169) (±42, -231) at 390; a full circle only from about 545 px: (±231, -62) (±169, -169) (±62, -231) |
|
|
234
|
+
|
|
235
|
+
Each item is positioned absolutely from the anchor: `left = x - 32`, `top = y - 28`, `width = 64`.
|
|
236
|
+
|
|
237
|
+
What the tests assert, for 3 to 6 items at 320, 360, 390 and 768 px: mirror symmetry and left-to-right order; every
|
|
238
|
+
item inside the viewport with the 8 px margin; every item at least 60 px above the dial's centre and at least 8 px
|
|
239
|
+
clear of the dial (centre distance >= 30 + 28 + 8); discs at least 4 px apart; no label box touching a neighbouring
|
|
240
|
+
disc or label. Re-run them after changing any constant. Labels are assumed to fit in 64 px: one short word
|
|
241
|
+
("Dictation" is about the limit at 11 px).
|
|
242
|
+
|
|
243
|
+
### Motion
|
|
244
|
+
|
|
245
|
+
- Scrim: opacity 0 → 1 in 180 ms.
|
|
246
|
+
- Items: each starts **on the dial's centre** (translated by `(-x, -y)`), scale .4, opacity 0, and springs to its
|
|
247
|
+
place (stiffness 420, damping 26) with a 35 ms stagger left to right. Exit: back into the dial in 140 ms, no
|
|
248
|
+
stagger. Only `transform` and `opacity` animate.
|
|
249
|
+
- The dial does not move or morph: the menu draws its own disc exactly over it, so the swap is invisible.
|
|
250
|
+
- Reduced motion: the root motion setting drops the travel and the scale; the items fade in place.
|
|
251
|
+
|
|
252
|
+
### Accessibility
|
|
253
|
+
|
|
254
|
+
- Dial: `<button aria-haspopup="menu" aria-expanded>`; accessible name "Practice", "Practice, 60% of today's goal" or
|
|
255
|
+
"Practice, today's goal reached". The ring inside is `aria-hidden` (a `progressbar` nested in a button is ignored
|
|
256
|
+
by assistive tech), so the name carries the value.
|
|
257
|
+
- Menu: `role="menu"` with a label ("Practice modes") and `aria-orientation="horizontal"`; each mode is a router link
|
|
258
|
+
with `role="menuitem"`, its positioned wrapper `role="none"`. The current mode gets `aria-current` from the router
|
|
259
|
+
and the stronger ring.
|
|
260
|
+
- It is **modal** (§6): focus starts on the first mode, Tab stays inside (modes, then the close button), Escape
|
|
261
|
+
closes, the app root is inert and scroll-locked, and focus returns to the dial on close.
|
|
262
|
+
- Arrow Right / Down and Left / Up move between modes and wrap; Home and End jump to the first and last.
|
|
263
|
+
- Because the app root (and with it the real dial) is inert while the menu is open, the close control must live
|
|
264
|
+
**inside the portal**: a second button ("Close practice modes") placed exactly over the dial
|
|
265
|
+
(`left: -30px; top: -30px` from the anchor) with the same face showing a cross. The thumb that opened the menu
|
|
266
|
+
closes it without moving.
|
|
267
|
+
- Closes on: choosing a mode, the close button, a scrim tap, Escape, the viewport reaching `lg`, and the bar being
|
|
268
|
+
hidden.
|
|
269
|
+
- The menu is mounted only while open, inside an exit-animation boundary: the modal-focus behaviour runs on mount.
|
|
270
|
+
|
|
271
|
+
### When not to use a radial menu
|
|
272
|
+
|
|
273
|
+
- **Fewer than 3 or more than 6 items.** One or two do not make an arc (use a plain raised link, or two flat tabs);
|
|
274
|
+
seven or more cannot keep 56 px discs apart at 320 px (use a bottom sheet with a list).
|
|
275
|
+
- **Long or translated labels.** Each label has 64 px. If the names do not fit in one short word in every language
|
|
276
|
+
the product ships, use a sheet.
|
|
277
|
+
- **Items that are not peers.** The arc says "equal choices of one kind". Do not mix modes with settings, account
|
|
278
|
+
actions or destructive commands; those belong in Settings or a sheet.
|
|
279
|
+
- **A list that changes** (per user, per day, feature flags that reorder). A radial menu is learned by position;
|
|
280
|
+
moving items breaks that.
|
|
281
|
+
- **Desktop or pointer-first layouts.** The arc exists for a thumb at the bottom edge of a phone. With a rail or a
|
|
282
|
+
top navigation, list the destinations.
|
|
283
|
+
- **A product with one core activity.** A menu with one real choice is a detour: make the centre button a plain
|
|
284
|
+
raised link to it.
|
|
285
|
+
- **Nested menus.** Never open a second level from an arc item.
|
|
286
|
+
|
|
287
|
+
## 5. Responsive rules
|
|
288
|
+
|
|
289
|
+
| Breakpoint | Shell | Notes |
|
|
290
|
+
|---|---|---|
|
|
291
|
+
| 320-639 | Bottom bar + compact HUD (hexagon, streak, ring; XP as a 2 px line) | Design here first. Paths zigzag; cards stack; page padding 16 px |
|
|
292
|
+
| `sm` 640 | The same shell | Horizontal path; two-column stat rows; padding 24 px |
|
|
293
|
+
| `md` 768 | Bottom bar; the full XP bar, theme toggle and account menu appear in the top bar | Toasts move from top-centre to bottom-left |
|
|
294
|
+
| `lg` 1024 | 72 px icon rail, no bottom bar | `--shell-bottom: 0px`; padding 32 px |
|
|
295
|
+
| `xl` 1280 | 240 px rail with labels | Home gets a side column (quests, week strip) |
|
|
296
|
+
|
|
297
|
+
- No hover-only actions: everything reachable by hover is also reachable by tap and by keyboard focus.
|
|
298
|
+
- Phones get **sheets** where desktop gets popovers.
|
|
299
|
+
- Use `min-h-dvh` / `100dvh`, not `100vh`: mobile browser bars change the viewport height.
|
|
300
|
+
- Long lists: `content-visibility: auto` on rows.
|
|
301
|
+
- Page container: centred, max width 1320 px, the paddings above, 24 px top (32 from `lg`); 68ch for reading text.
|
|
302
|
+
|
|
303
|
+
## 6. Sheets and dialogs
|
|
304
|
+
|
|
305
|
+
All of them: portal to `<body>`, `role="dialog" aria-modal="true"`, a label (`aria-labelledby` or `aria-label`),
|
|
306
|
+
`tabIndex={-1}` on the panel (so a click on its plain content keeps focus inside), and the modal-focus behaviour
|
|
307
|
+
below. The dial's radial menu (§4) is the one modal layer that is a `role="menu"` instead of a dialog; it uses the
|
|
308
|
+
same behaviour.
|
|
309
|
+
|
|
310
|
+
Modal focus, as one hook `(dialogRef, onClose, initialFocus?)` that acts while the dialog is mounted:
|
|
311
|
+
|
|
312
|
+
| Behaviour | Why |
|
|
313
|
+
|---|---|
|
|
314
|
+
| On mount, remember the focused element, then move focus into the dialog: the `initialFocus` selector, else the first focusable, else the panel | Keyboard and screen-reader users land where the action is |
|
|
315
|
+
| Tab / Shift+Tab wrap inside; a Tab pressed while focus is outside or on the panel itself goes to the first / last focusable | Focus cannot wander into the page behind |
|
|
316
|
+
| Escape closes; the key listener is on `document`, not on the dialog | Keys still work after focus lands on `<body>` (a click on plain text) |
|
|
317
|
+
| Sets `inert` on the app root (`#root`) and `overflow: hidden` on `body` (remembering the previous value) | The page behind is unreachable for pointer, keyboard and assistive tech; no scroll bleed |
|
|
318
|
+
| Keeps a module-level stack of open dialogs; only the top one handles keys; the lock is applied by the first and released when the last closes | A dialog opened from a sheet works |
|
|
319
|
+
| On unmount, returns focus to the remembered element | The user continues where they were |
|
|
320
|
+
|
|
321
|
+
"Focusable" = links with `href`, enabled buttons, inputs, selects, textareas, and anything with a `tabindex` other
|
|
322
|
+
than -1. Keep `onClose` in a ref so a new callback identity does not re-run the effect.
|
|
323
|
+
|
|
324
|
+
Consequences to respect:
|
|
325
|
+
|
|
326
|
+
- **Dialogs must be portalled outside the app root**, or they become inert with it.
|
|
327
|
+
- Providers that render overlays (rewards, toasts) also portal to `<body>` for the same reason.
|
|
328
|
+
- The behaviour runs on mount: mount the dialog component only while it is open, inside the exit-animation boundary;
|
|
329
|
+
do not keep it mounted and hidden.
|
|
330
|
+
- If the trigger disappears while the dialog is open (a Claim button), move focus somewhere sensible on close.
|
|
331
|
+
|
|
332
|
+
Bottom sheet (phones): scrim `surface-void` at 70 % + `backdrop-blur-sm` (fades 200 ms); the panel is pinned to the
|
|
333
|
+
bottom, `max-height: 85dvh`, scrolls inside, `rounded-t-4xl`, top border `line`, `bg-surface-1`, `shadow-edge`, and
|
|
334
|
+
slides from `y: 100%` in 280 ms `ease-glide`; padding includes the safe area
|
|
335
|
+
(`padding-bottom: calc(1.25rem + env(safe-area-inset-bottom))`); a 40 x 4 px `line-strong` grab handle (decorative)
|
|
336
|
+
and a real close button (ghost `RoundButton` with an `aria-label`).
|
|
337
|
+
|
|
338
|
+
Centre modal (confirmation, level-up): scrim `surface-void` at 80 % + `backdrop-blur-md`; the scrim container scrolls
|
|
339
|
+
vertically and holds an inner `grid min-h-full place-items-center` with 24 px padding, so on a short screen the dialog
|
|
340
|
+
scrolls and its primary button stays reachable. Clicking the scrim closes; clicks inside the panel stop propagation.
|
|
341
|
+
|
|
342
|
+
Destructive confirmation: the title states the action and object ("Delete 3 items?"), the body states the
|
|
343
|
+
consequence, the buttons are a `ghost` Cancel + a `danger` verb. Initial focus on Cancel.
|
|
344
|
+
|
|
345
|
+
Non-modal popovers (HUD panel, account menu): no inert, no scrim; closed by an outside pointer-down or Escape. A menu
|
|
346
|
+
uses `role="menu"` / `menuitem`, arrow keys, and closes on Tab.
|
|
347
|
+
|
|
348
|
+
## 7. Page skeletons and route loading
|
|
349
|
+
|
|
350
|
+
- Each page is its own lazily loaded chunk. The suspense boundary sits **inside** the shell, around the page outlet:
|
|
351
|
+
the bars stay on screen and only the page area shows a skeleton.
|
|
352
|
+
- The route skeleton (a heading bar, a line, two 160 px cards in the page container) appears only after **150 ms**, so
|
|
353
|
+
a cached or fast chunk never flashes it. It is a `role="status"` with an `sr-only` "Loading".
|
|
354
|
+
- A skeleton has the same boxes as the loaded page section (same card, same heights). Layout shift on load is
|
|
355
|
+
treated as a bug.
|
|
356
|
+
- Data inside a loaded page: per-card skeletons, never a full-page spinner. Buttons that wait show their own spinner,
|
|
357
|
+
keep their size and keep focus.
|
|
358
|
+
- Errors: an inline `role="alert"` line in coral-ink next to the control that failed, with a retry; an `EmptyState`
|
|
359
|
+
when there is nothing yet. A failed HUD read hides the HUD, it does not block the page. A page whose chunk failed to
|
|
360
|
+
load shows an `EmptyState` with a Reload button in the page area, inside the shell, and navigating to another route
|
|
361
|
+
clears it.
|
|
362
|
+
- On navigation: scroll to top, set `document.title` to the page name, keep the HUD mounted (it must not flash).
|