|
| 1 | +# Theme And Token Refactor Roadmap |
| 2 | + |
| 3 | +## Goal |
| 4 | + |
| 5 | +Build the next major version of Tiny Design theming with one rule: |
| 6 | + |
| 7 | +- only the new token model is supported |
| 8 | + |
| 9 | +This roadmap assumes a breaking release. We are not preserving legacy token names, legacy theme keys, or parallel token systems. |
| 10 | + |
| 11 | +## Upgrade Policy |
| 12 | + |
| 13 | +The next major version follows these constraints: |
| 14 | + |
| 15 | +- `packages/tokens/source/**.json` is the only source of truth |
| 16 | +- runtime, docs, Theme Studio, and React all consume the same theme contract |
| 17 | +- old SCSS-era token names are removed, not translated |
| 18 | +- old API aliases are removed, not dual-supported |
| 19 | +- documentation only describes the new contract |
| 20 | + |
| 21 | +## Current Progress |
| 22 | + |
| 23 | +Completed: |
| 24 | + |
| 25 | +- tokens runtime resolution is shared across `@tiny-design/tokens`, `@tiny-design/react`, and Theme Studio |
| 26 | +- preset theme resolution with `extends` |
| 27 | +- browser-safe ESM runtime for docs and Theme Studio |
| 28 | +- `ConfigProvider` integrated with token resolution |
| 29 | +- `Popup / Overlay / Portal` bottom-layer cleanup and tests |
| 30 | + |
| 31 | +In progress: |
| 32 | + |
| 33 | +- removing alias and migration logic that was temporarily added during the transition |
| 34 | +- tightening execution checklists for the next component phases |
| 35 | + |
| 36 | +## Target Architecture |
| 37 | + |
| 38 | +### `@tiny-design/tokens` |
| 39 | + |
| 40 | +Owns: |
| 41 | + |
| 42 | +- semantic token source |
| 43 | +- component token source |
| 44 | +- theme documents |
| 45 | +- schema |
| 46 | +- registry generation |
| 47 | +- preset generation |
| 48 | +- theme validation |
| 49 | +- theme resolution |
| 50 | +- typed token exports |
| 51 | + |
| 52 | +Does not own: |
| 53 | + |
| 54 | +- legacy token aliases |
| 55 | +- migration shims |
| 56 | +- dual-format theme support |
| 57 | + |
| 58 | +### `@tiny-design/react` |
| 59 | + |
| 60 | +Owns: |
| 61 | + |
| 62 | +- scoped CSS variable application |
| 63 | +- `ConfigProvider` theme integration |
| 64 | +- container / popup scoping behavior |
| 65 | +- component token consumption discipline |
| 66 | + |
| 67 | +Does not own: |
| 68 | + |
| 69 | +- ad-hoc token flattening |
| 70 | +- custom theme parsing separate from `@tiny-design/tokens` |
| 71 | + |
| 72 | +### Theme Studio / Docs |
| 73 | + |
| 74 | +Own: |
| 75 | + |
| 76 | +- authoring UI |
| 77 | +- preview and export flows |
| 78 | +- token browsing and documentation |
| 79 | + |
| 80 | +Must consume: |
| 81 | + |
| 82 | +- the same validation and resolution contract as runtime |
| 83 | + |
| 84 | +## Execution Phases |
| 85 | + |
| 86 | +### Phase 1: Tokens Core |
| 87 | + |
| 88 | +Objectives: |
| 89 | + |
| 90 | +- keep JSON as the only editable token source |
| 91 | +- keep presets and schema aligned |
| 92 | +- validate theme documents against registry |
| 93 | +- remove alias and migration support from runtime and build outputs |
| 94 | + |
| 95 | +Acceptance: |
| 96 | + |
| 97 | +- no runtime alias translation |
| 98 | +- no generated alias metadata |
| 99 | +- new token keys are the only supported authored keys |
| 100 | + |
| 101 | +### Phase 2: React Theme Integration |
| 102 | + |
| 103 | +Objectives: |
| 104 | + |
| 105 | +- keep `ConfigProvider` on top of `resolveTheme` |
| 106 | +- standardize theme mode resolution |
| 107 | +- keep scoped CSS variable injection stable |
| 108 | + |
| 109 | +Acceptance: |
| 110 | + |
| 111 | +- React runtime does not implement its own theme parser |
| 112 | +- local provider scoping remains stable |
| 113 | + |
| 114 | +### Phase 3: Bottom-Layer Popup Infrastructure |
| 115 | + |
| 116 | +Scope: |
| 117 | + |
| 118 | +- `Popup` |
| 119 | +- `Overlay` |
| 120 | +- `Portal` |
| 121 | + |
| 122 | +Objectives: |
| 123 | + |
| 124 | +- stabilize visibility flow |
| 125 | +- stabilize popup container usage |
| 126 | +- clean up event listener lifecycle |
| 127 | +- preserve existing good behavior |
| 128 | + |
| 129 | +Acceptance: |
| 130 | + |
| 131 | +- bottom-layer popup tests pass |
| 132 | +- no listener leaks in current flows |
| 133 | + |
| 134 | +### Phase 4: First-Layer Popup Consumers |
| 135 | + |
| 136 | +Scope: |
| 137 | + |
| 138 | +- `Dropdown` |
| 139 | +- `Popover` |
| 140 | +- `Tooltip` |
| 141 | +- `Modal` |
| 142 | + |
| 143 | +Objectives: |
| 144 | + |
| 145 | +- reuse the cleaned popup stack |
| 146 | +- remove duplicated open/close mechanics |
| 147 | +- keep API changes deliberate and minimal |
| 148 | + |
| 149 | +Acceptance: |
| 150 | + |
| 151 | +- each component has controlled/uncontrolled coverage |
| 152 | +- outside click / escape / focus behavior is defined and tested |
| 153 | + |
| 154 | +### Phase 5: Form And Selection Core |
| 155 | + |
| 156 | +Scope: |
| 157 | + |
| 158 | +- `Form` |
| 159 | +- `Select` |
| 160 | +- `AutoComplete` |
| 161 | +- `DatePicker` |
| 162 | +- `TimePicker` |
| 163 | + |
| 164 | +Objectives: |
| 165 | + |
| 166 | +- align state models |
| 167 | +- align popup usage |
| 168 | +- align token consumption |
| 169 | + |
| 170 | +Acceptance: |
| 171 | + |
| 172 | +- no type/runtime contract mismatch |
| 173 | +- no parallel internal state paths for the same behavior |
| 174 | + |
| 175 | +### Phase 6: Token Coverage Expansion |
| 176 | + |
| 177 | +Objectives: |
| 178 | + |
| 179 | +- define missing component namespaces |
| 180 | +- document namespace reuse explicitly |
| 181 | +- replace remaining hardcoded visual values where tokens should own them |
| 182 | + |
| 183 | +Priority targets: |
| 184 | + |
| 185 | +- `dropdown` |
| 186 | +- `overlay` |
| 187 | +- `date-picker` |
| 188 | +- `time-picker` |
| 189 | +- `auto-complete` |
| 190 | +- `modal` |
| 191 | +- `tooltip` |
| 192 | +- `popover` |
| 193 | + |
| 194 | +Acceptance: |
| 195 | + |
| 196 | +- each production component has explicit token ownership |
| 197 | + |
| 198 | +### Phase 7: Quality Platform |
| 199 | + |
| 200 | +Objectives: |
| 201 | + |
| 202 | +- interaction tests for complex components |
| 203 | +- a11y checks for core flows |
| 204 | +- visual regression for key docs examples |
| 205 | + |
| 206 | +Acceptance: |
| 207 | + |
| 208 | +- complex components have behavior coverage, not just snapshots |
| 209 | + |
| 210 | +## Working Rules |
| 211 | + |
| 212 | +These rules apply to every phase: |
| 213 | + |
| 214 | +- read implementation, types, tests, and docs before editing |
| 215 | +- keep existing good behavior |
| 216 | +- remove only the parts that are inconsistent, redundant, or unstable |
| 217 | +- do not expand scope upward until the current layer is stable |
| 218 | +- stop at a clear verification point before moving to the next component group |
| 219 | + |
| 220 | +## Immediate Next Queue |
| 221 | + |
| 222 | +1. Finish removing temporary alias/migration support from `packages/tokens` |
| 223 | +2. Keep Theme Studio aligned with the strict new token contract |
| 224 | +3. Start the first-layer popup consumers: |
| 225 | + - `Dropdown` |
| 226 | + - `Popover` |
| 227 | + - `Tooltip` |
| 228 | + - `Modal` |
0 commit comments