@atomazing-org/design-system 2.0.1 → 2.0.2
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/AGENTS.md +92 -0
- package/README.MD +45 -425
- package/dist/presets/index.d.ts +7 -1
- package/dist/presets/index.js +288 -306
- package/migrations/README.UPDATE.md +32 -20
- package/migrations/docs/migrations/design-system/README.md +48 -17
- package/migrations/docs/migrations/design-system/routes/adopt-existing/AEROCRM-EXAMPLE.md +197 -0
- package/migrations/docs/migrations/design-system/routes/adopt-existing/RUNBOOK.md +185 -25
- package/migrations/docs/migrations/design-system/routes/adopt-existing/migration.spec.json +68 -13
- package/migrations/docs/migrations/design-system/routes/greenfield/RUNBOOK.md +57 -25
- package/migrations/docs/migrations/design-system/routes/greenfield/migration.spec.json +28 -6
- package/migrations/docs/migrations/design-system/routes/mui4-to-latest/RUNBOOK.md +136 -77
- package/migrations/docs/migrations/design-system/routes/mui4-to-latest/migration.spec.json +89 -16
- package/migrations/docs/migrations/design-system/shared/WORKING-RULES.md +194 -0
- package/migrations/docs/migrations/design-system/shared/acceptance.md +76 -20
- package/migrations/docs/migrations/design-system/shared/common-regressions.md +218 -0
- package/migrations/docs/migrations/design-system/shared/gates.md +39 -3
- package/migrations/docs/migrations/design-system/shared/manual-qa-matrix.md +70 -0
- package/migrations/docs/migrations/design-system/shared/phase-exit-criteria.md +129 -0
- package/migrations/docs/migrations/design-system/shared/phases.md +377 -0
- package/migrations/skills/design-system-consumer-agent/SKILL.md +84 -0
- package/migrations/skills/design-system-migration-agent/SKILL.md +75 -9
- package/package.json +2 -1
package/AGENTS.md
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# @atomazing-org/design-system Agent Rules
|
|
2
|
+
|
|
3
|
+
These instructions apply when a repository depends on `@atomazing-org/design-system`
|
|
4
|
+
or when an AI agent is asked to integrate, upgrade, or refactor work around this library.
|
|
5
|
+
|
|
6
|
+
## Source Of Truth
|
|
7
|
+
|
|
8
|
+
- `README.MD`
|
|
9
|
+
- `migrations/docs/migrations/design-system/shared/WORKING-RULES.md`
|
|
10
|
+
- `migrations/skills/design-system-consumer-agent/SKILL.md`
|
|
11
|
+
- `migrations/skills/design-system-migration-agent/SKILL.md`
|
|
12
|
+
|
|
13
|
+
If you are working inside `examples/next-app-router`, load
|
|
14
|
+
`examples/next-app-router/AGENTS.md` and treat it as the local source of truth for
|
|
15
|
+
that starter.
|
|
16
|
+
|
|
17
|
+
## Default Integration Rules
|
|
18
|
+
|
|
19
|
+
1. Use only public imports:
|
|
20
|
+
- `@atomazing-org/design-system`
|
|
21
|
+
- `@atomazing-org/design-system/presets`
|
|
22
|
+
2. Do not deep-import internal files from `src/*`, `dist/*`, or private folders.
|
|
23
|
+
3. Use `ThemeProviderWrapper` as the app-level design-system entrypoint.
|
|
24
|
+
4. Use `useThemeSettings()` for theme and dark-mode UI state instead of parallel custom state.
|
|
25
|
+
5. Prefer:
|
|
26
|
+
- `defaultThemes` for standard application surfaces
|
|
27
|
+
- `landingPageThemes` for landing and marketing surfaces
|
|
28
|
+
- `allBuiltInThemes` only when the consumer intentionally wants both packs
|
|
29
|
+
6. Custom presets must use the `ThemePreset` contract with both light and dark schemes.
|
|
30
|
+
7. Do not create a competing root `ThemeProvider` unless it is a thin wrapper around the design system.
|
|
31
|
+
8. For SSR and Next.js:
|
|
32
|
+
- keep the provider in a client boundary
|
|
33
|
+
- do not access `window`, `document`, or `localStorage` at module scope
|
|
34
|
+
9. After dependency, provider, or theme-state changes, the app must still boot in a real browser without startup console errors.
|
|
35
|
+
10. Fix duplicated runtime singleton warnings for `react`, `react-dom`, `@emotion/react`, or `@emotion/styled` before closing migration work.
|
|
36
|
+
11. The active preset must own the application background.
|
|
37
|
+
12. Do not hardcode page-level backgrounds on app shells, route layouts, or page wrappers when that overrides the preset background.
|
|
38
|
+
13. Prefer direct MUI primitives or thin wrappers around them for base controls.
|
|
39
|
+
14. Do not preserve consumer-owned substitute atoms for stock MUI controls unless they carry real custom behavior.
|
|
40
|
+
15. Visible application text should be rendered through `Typography` with an explicit semantic variant.
|
|
41
|
+
16. When MUI interactive controls render visible text, wrap that text in `Typography component="span"` instead of leaving raw text nodes in place.
|
|
42
|
+
17. Shared dialogs, drawers, and bottom sheets must expose stable `aria-labelledby` and `aria-describedby`.
|
|
43
|
+
18. Shared overlay close actions must have explicit accessible labels.
|
|
44
|
+
19. Search overlays that own keyboard-filtered results should use `combobox` and `listbox` semantics.
|
|
45
|
+
20. Browser event listeners belong in effects with cleanup, not render paths or module scope.
|
|
46
|
+
21. Keep preset selection explicit in one app-owned theme module.
|
|
47
|
+
22. Remove zero-value wrappers that only rename a stock MUI primitive or surface.
|
|
48
|
+
23. Use theme helpers such as `alpha()` instead of palette-string alpha suffix hacks.
|
|
49
|
+
24. Decorative gradients and shadow styling do not belong in normal consumer surfaces.
|
|
50
|
+
25. If several app pages share the same workflow shell, extract one shared layout contract.
|
|
51
|
+
26. If local app barrel exports introduce circular chunk warnings, use direct local imports instead.
|
|
52
|
+
27. Fix consumer-owned build warnings with config changes, not warning suppression.
|
|
53
|
+
|
|
54
|
+
## Generic Landing Principles
|
|
55
|
+
|
|
56
|
+
Apply these rules when working on landing-style consumers in general:
|
|
57
|
+
|
|
58
|
+
1. Use `landingPageThemes` intentionally for landing and marketing surfaces.
|
|
59
|
+
2. Let the active preset own the page background.
|
|
60
|
+
3. Keep one primary focus per major section.
|
|
61
|
+
4. Keep scroll natural; avoid forced snap or automatic section scrolling.
|
|
62
|
+
5. Prefer product-facing labels over template-facing labels in visible UI.
|
|
63
|
+
6. Do not recreate preset-owned surface styling in app components.
|
|
64
|
+
7. Prefer MUI-native composition over custom decorative UI logic.
|
|
65
|
+
8. Do not build nested rectangular surface hierarchies.
|
|
66
|
+
9. Keep landing content concise and easy to scan.
|
|
67
|
+
|
|
68
|
+
## When To Propose A Migration
|
|
69
|
+
|
|
70
|
+
Propose a route-based migration before making piecemeal edits if any of the following are true:
|
|
71
|
+
|
|
72
|
+
- the app uses `@material-ui/*`
|
|
73
|
+
- the app already has a custom theme or token layer
|
|
74
|
+
- the app has widespread hardcoded UI tokens that should move to theme values
|
|
75
|
+
- the user asks to adopt, align, standardize, upgrade, or replace the current UI foundation
|
|
76
|
+
- partial integration would leave two competing sources of truth for theme state
|
|
77
|
+
- the app hardcodes root-level page backgrounds that should instead come from the active preset
|
|
78
|
+
|
|
79
|
+
## Route Selection
|
|
80
|
+
|
|
81
|
+
- `@material-ui/*` found in dependencies or imports: use `mui4-to-latest`
|
|
82
|
+
- no existing theme or token migration is needed: use `greenfield`
|
|
83
|
+
- otherwise: use `adopt-existing`
|
|
84
|
+
|
|
85
|
+
## Required Migration Response
|
|
86
|
+
|
|
87
|
+
When migration is the correct path, the agent should:
|
|
88
|
+
|
|
89
|
+
1. Say that route-based migration is recommended instead of ad hoc edits.
|
|
90
|
+
2. Name the selected route and why it applies.
|
|
91
|
+
3. Load `migrations/skills/design-system-migration-agent/SKILL.md`.
|
|
92
|
+
4. Use the runbook and shared gates from `migrations/docs/migrations/design-system/`.
|
package/README.MD
CHANGED
|
@@ -1,54 +1,28 @@
|
|
|
1
1
|
# @atomazing-org/design-system
|
|
2
2
|
|
|
3
|
-
Modern MUI v7 + Emotion design system with strongly differentiated visual presets,
|
|
4
|
-
|
|
5
|
-
## Preview
|
|
6
|
-

|
|
7
|
-
|
|
8
|
-
## Why use it
|
|
9
|
-
|
|
10
|
-
- **True light/dark themes**: each preset ships **two curated schemes** (`light` + `dark`), so backgrounds, cards, and text actually change (not just `palette.mode`).
|
|
11
|
-
- **Works out of the box**: includes ready-made presets you can use immediately.
|
|
12
|
-
- **Easy to extend**: bring your own presets, or combine defaults + custom.
|
|
13
|
-
- **Consistent UI**: global styles + MUI component overrides for predictable visuals.
|
|
14
|
-
- **Safe persistence**: remembers selected theme + dark mode with SSR-safe guards.
|
|
15
|
-
|
|
16
|
-
---
|
|
17
|
-
|
|
3
|
+
Modern MUI v7 + Emotion design system with strongly differentiated visual presets,
|
|
4
|
+
scheme-based light and dark tokens, SSR-safe theming, and persistence.
|
|
18
5
|
|
|
19
6
|
## Installation
|
|
20
7
|
|
|
21
|
-
Install the library:
|
|
22
|
-
|
|
23
8
|
```bash
|
|
24
9
|
npm install @atomazing-org/design-system
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Install required peer dependencies (React 18/19 + MUI v7 + Emotion core):
|
|
28
|
-
|
|
29
|
-
```bash
|
|
30
10
|
npm install react react-dom @mui/material @emotion/react @emotion/styled
|
|
31
11
|
```
|
|
32
12
|
|
|
33
13
|
Optional peers:
|
|
34
14
|
|
|
35
|
-
- `@mui/icons-material`
|
|
36
|
-
- `@emotion/css`
|
|
37
|
-
|
|
38
|
-
```bash
|
|
39
|
-
npm install @mui/icons-material @emotion/css
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
### Package format (v2)
|
|
15
|
+
- `@mui/icons-material`
|
|
16
|
+
- `@emotion/css`
|
|
43
17
|
|
|
44
|
-
|
|
45
|
-
Use ESM imports (`import ... from ...`). CommonJS `require()` is not supported.
|
|
18
|
+
## Package Format
|
|
46
19
|
|
|
47
|
-
|
|
20
|
+
- ESM-only package
|
|
21
|
+
- Public entrypoints:
|
|
22
|
+
- `@atomazing-org/design-system`
|
|
23
|
+
- `@atomazing-org/design-system/presets`
|
|
48
24
|
|
|
49
|
-
## Quick
|
|
50
|
-
|
|
51
|
-
Use built-in presets (recommended starting point):
|
|
25
|
+
## Quick Start
|
|
52
26
|
|
|
53
27
|
```tsx
|
|
54
28
|
import { ThemeProviderWrapper } from "@atomazing-org/design-system";
|
|
@@ -63,415 +37,61 @@ export function App() {
|
|
|
63
37
|
}
|
|
64
38
|
```
|
|
65
39
|
|
|
66
|
-
|
|
67
|
-
- `themes` can be **default presets**, **your presets**, or **both**.
|
|
68
|
-
- Theme choice + dark mode are persisted (storage key: `appSettings`).
|
|
69
|
-
|
|
70
|
-
---
|
|
71
|
-
|
|
72
|
-
## Built-in presets
|
|
73
|
-
|
|
74
|
-
Built-in presets are **ready-made theme packs shipped with the library**.
|
|
75
|
-
You can use them as-is, or add your own presets alongside them.
|
|
76
|
-
|
|
77
|
-
| Preset | Stable id | Best for |
|
|
78
|
-
|---|---|---|
|
|
79
|
-
| Warm Earth | `warm-earth` | Warm and friendly apps |
|
|
80
|
-
| Editorial Classic | `editorial-classic` | Content-heavy UIs |
|
|
81
|
-
| Modern Minimal | `modern-minimal` | Dashboards and tooling |
|
|
82
|
-
| Neo Glass | `neo-glass` | Modern “glass” style UIs |
|
|
83
|
-
| Retro Terminal | `retro-terminal` | Terminal-inspired branding |
|
|
84
|
-
|
|
85
|
-
Import them from:
|
|
86
|
-
|
|
87
|
-
```ts
|
|
88
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
## Switching theme (UI)
|
|
92
|
-
|
|
93
|
-
Build a simple theme switcher using the library’s theme settings hook.
|
|
94
|
-
|
|
95
|
-
```tsx
|
|
96
|
-
import { ToggleButton, ToggleButtonGroup } from "@mui/material";
|
|
97
|
-
import { useThemeSettings } from "@atomazing-org/design-system";
|
|
98
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
99
|
-
|
|
100
|
-
export function ThemeSwitcher() {
|
|
101
|
-
const { theme, setTheme } = useThemeSettings();
|
|
102
|
-
|
|
103
|
-
return (
|
|
104
|
-
<ToggleButtonGroup
|
|
105
|
-
size="small"
|
|
106
|
-
exclusive
|
|
107
|
-
value={theme}
|
|
108
|
-
onChange={(_, next) => next && setTheme(next)}
|
|
109
|
-
>
|
|
110
|
-
{defaultThemes.map((t) => (
|
|
111
|
-
<ToggleButton key={t.id} value={t.id}>
|
|
112
|
-
{t.label}
|
|
113
|
-
</ToggleButton>
|
|
114
|
-
))}
|
|
115
|
-
</ToggleButtonGroup>
|
|
116
|
-
);
|
|
117
|
-
}
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
---
|
|
121
|
-
|
|
122
|
-
## Dark mode
|
|
123
|
-
|
|
124
|
-
Dark mode switches the active **scheme** inside the current preset.
|
|
125
|
-
|
|
126
|
-
### Supported values
|
|
127
|
-
|
|
128
|
-
- `light` — always use the preset’s light scheme
|
|
129
|
-
- `dark` — always use the preset’s dark scheme
|
|
130
|
-
- `system` — follow OS/browser preference (`prefers-color-scheme`)
|
|
131
|
-
|
|
132
|
-
### Why `system` exists
|
|
133
|
-
|
|
134
|
-
It’s the most common UX: the app automatically follows the user’s OS preference without custom code in every project.
|
|
135
|
-
|
|
136
|
-
Example selector:
|
|
137
|
-
|
|
138
|
-
```tsx
|
|
139
|
-
import { RadioGroup, FormControlLabel, Radio } from "@mui/material";
|
|
140
|
-
import { useThemeSettings } from "@atomazing-org/design-system";
|
|
141
|
-
|
|
142
|
-
export function DarkModeSelector() {
|
|
143
|
-
const { darkMode, setDarkMode } = useThemeSettings();
|
|
144
|
-
|
|
145
|
-
return (
|
|
146
|
-
<RadioGroup row value={darkMode} onChange={(e) => setDarkMode(e.target.value as any)}>
|
|
147
|
-
<FormControlLabel value="system" control={<Radio />} label="System" />
|
|
148
|
-
<FormControlLabel value="light" control={<Radio />} label="Light" />
|
|
149
|
-
<FormControlLabel value="dark" control={<Radio />} label="Dark" />
|
|
150
|
-
</RadioGroup>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
```
|
|
154
|
-
|
|
155
|
-
### Forcing mode (optional)
|
|
156
|
-
|
|
157
|
-
If your app does not support dark mode, you can force the effective palette mode:
|
|
158
|
-
|
|
159
|
-
```tsx
|
|
160
|
-
import { ThemeProviderWrapper } from "@atomazing-org/design-system";
|
|
161
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
162
|
-
|
|
163
|
-
export function App() {
|
|
164
|
-
return (
|
|
165
|
-
<ThemeProviderWrapper themes={defaultThemes} darkMode="light">
|
|
166
|
-
{/* your app */}
|
|
167
|
-
</ThemeProviderWrapper>
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Note: when `darkMode` is set, `darkMode` is locked and `setDarkMode` is ignored.
|
|
173
|
-
|
|
174
|
-
---
|
|
175
|
-
|
|
176
|
-
## Persistence (`appSettings`)
|
|
177
|
-
|
|
178
|
-
Theme selection is persisted in `localStorage` under the key `appSettings`.
|
|
179
|
-
|
|
180
|
-
v2 JSON shape:
|
|
181
|
-
|
|
182
|
-
```json
|
|
183
|
-
{ "themeId": "editorial-classic", "darkMode": "system" }
|
|
184
|
-
```
|
|
185
|
-
|
|
186
|
-
Notes:
|
|
187
|
-
- v2 stores only `themeId` and `darkMode`.
|
|
188
|
-
- v2 does not migrate legacy stored formats (`theme`, `version`, `auto`); invalid/legacy payloads reset to defaults.
|
|
189
|
-
|
|
190
|
-
---
|
|
191
|
-
|
|
192
|
-
## App migration routes (repo docs)
|
|
193
|
-
|
|
194
|
-
If you are migrating an app to v2, use the route runbooks under:
|
|
40
|
+
Use `useThemeSettings()` for runtime preset and dark-mode controls.
|
|
195
41
|
|
|
196
|
-
-
|
|
197
|
-
- `migrations/docs/migrations/design-system/routes/*`
|
|
198
|
-
|
|
199
|
-
`examples/react-app` is the canonical Vite consumer smoke app for local v2 validation (`npm run smoke:react-app`).
|
|
200
|
-
`examples/next-app-router` is the canonical Next.js App Router SSR reference consumer (`npm run smoke:next`).
|
|
201
|
-
|
|
202
|
-
---
|
|
42
|
+
## Built-In Preset Packs
|
|
203
43
|
|
|
204
|
-
|
|
44
|
+
- `defaultThemes`: baseline application presets
|
|
45
|
+
- `landingPageThemes`: extended landing and marketing presets
|
|
46
|
+
- `allBuiltInThemes`: combined pack
|
|
205
47
|
|
|
206
|
-
|
|
48
|
+
## Custom Presets
|
|
207
49
|
|
|
208
|
-
|
|
50
|
+
Custom presets must follow the `ThemePreset` contract:
|
|
209
51
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
| `colorSchemes.light` | `ThemeOptions` | MUI ThemeOptions for light mode. |
|
|
215
|
-
| `colorSchemes.dark` | `ThemeOptions` | MUI ThemeOptions for dark mode. |
|
|
52
|
+
- stable `id`
|
|
53
|
+
- human-readable `label`
|
|
54
|
+
- `colorSchemes.light`
|
|
55
|
+
- `colorSchemes.dark`
|
|
216
56
|
|
|
217
|
-
|
|
57
|
+
Each scheme should define:
|
|
218
58
|
|
|
219
|
-
|
|
220
|
-
- `palette.background.
|
|
221
|
-
- `palette.background.paper` — Card/Paper background
|
|
59
|
+
- `palette.background.default`
|
|
60
|
+
- `palette.background.paper`
|
|
222
61
|
- `palette.text.primary`
|
|
223
62
|
- `palette.text.secondary`
|
|
224
63
|
- `palette.divider`
|
|
225
64
|
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
```ts
|
|
229
|
-
import type { ThemePreset } from "@atomazing-org/design-system";
|
|
230
|
-
|
|
231
|
-
export const myPreset: ThemePreset = {
|
|
232
|
-
id: "my-brand",
|
|
233
|
-
label: "My Brand",
|
|
234
|
-
colorSchemes: {
|
|
235
|
-
light: {
|
|
236
|
-
palette: {
|
|
237
|
-
background: { default: "#ffffff", paper: "#ffffff" },
|
|
238
|
-
text: { primary: "#111111", secondary: "#444444" },
|
|
239
|
-
divider: "rgba(0,0,0,0.12)",
|
|
240
|
-
},
|
|
241
|
-
},
|
|
242
|
-
dark: {
|
|
243
|
-
palette: {
|
|
244
|
-
background: { default: "#0f1115", paper: "#151922" },
|
|
245
|
-
text: { primary: "#f1f3f5", secondary: "#c6cbd1" },
|
|
246
|
-
divider: "rgba(241,243,245,0.16)",
|
|
247
|
-
},
|
|
248
|
-
},
|
|
249
|
-
},
|
|
250
|
-
};
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
### Using defaults + custom presets
|
|
254
|
-
|
|
255
|
-
```ts
|
|
256
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
257
|
-
|
|
258
|
-
const themes = [...defaultThemes, myPreset];
|
|
259
|
-
```
|
|
260
|
-
|
|
261
|
-
Then pass `themes` into `ThemeProviderWrapper`.
|
|
262
|
-
|
|
263
|
-
---
|
|
264
|
-
|
|
265
|
-
## Typography variants
|
|
266
|
-
|
|
267
|
-
The library adds extra typography variants (beyond MUI defaults) so your text styles are consistent across the app.
|
|
268
|
-
|
|
269
|
-
```tsx
|
|
270
|
-
import { Typography } from "@mui/material";
|
|
271
|
-
|
|
272
|
-
export function TypographyDemo() {
|
|
273
|
-
return (
|
|
274
|
-
<>
|
|
275
|
-
<Typography variant="header_lg_bold">Page title</Typography>
|
|
276
|
-
<Typography variant="text_md_regular">Body text</Typography>
|
|
277
|
-
<Typography variant="text_sm_bold">Caption / label</Typography>
|
|
278
|
-
</>
|
|
279
|
-
);
|
|
280
|
-
}
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Notes:
|
|
284
|
-
- Typography sizing is expected to be **rem-based** (scales with the user’s browser font size settings).
|
|
285
|
-
- Variants are defined in the design system theme (no local “one-off” styles needed).
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
## Global styles
|
|
290
|
-
|
|
291
|
-
`ThemeProviderWrapper` applies global styles (via Emotion) and MUI component defaults, so the app looks consistent immediately.
|
|
292
|
-
|
|
293
|
-
Set a custom font stack:
|
|
294
|
-
|
|
295
|
-
```tsx
|
|
296
|
-
import { ThemeProviderWrapper } from "@atomazing-org/design-system";
|
|
297
|
-
|
|
298
|
-
export function App() {
|
|
299
|
-
return (
|
|
300
|
-
<ThemeProviderWrapper fontFamily="Inter, system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif">
|
|
301
|
-
{/* your app */}
|
|
302
|
-
</ThemeProviderWrapper>
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
```
|
|
306
|
-
|
|
307
|
-
---
|
|
308
|
-
|
|
309
|
-
## Animations
|
|
310
|
-
|
|
311
|
-
The library exports reusable keyframes so you can keep motion consistent.
|
|
312
|
-
|
|
313
|
-
```tsx
|
|
314
|
-
import styled from "@emotion/styled";
|
|
315
|
-
import { fadeIn } from "@atomazing-org/design-system";
|
|
316
|
-
|
|
317
|
-
const Panel = styled.div`
|
|
318
|
-
animation: ${fadeIn} 240ms ease-in both;
|
|
319
|
-
`;
|
|
320
|
-
|
|
321
|
-
export function AnimatedPanel() {
|
|
322
|
-
return <Panel>Content</Panel>;
|
|
323
|
-
}
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
## SSR notes
|
|
329
|
-
|
|
330
|
-
- The library is written to be **SSR-safe**: no `window`/`document`/`localStorage` access at module scope.
|
|
331
|
-
- If you use **system** dark mode, the effective mode is derived from `prefers-color-scheme` on the client.
|
|
332
|
-
- In Next.js, place the provider inside a client boundary (e.g., a component with `"use client"`), then wrap your app with `ThemeProviderWrapper`.
|
|
333
|
-
|
|
334
|
-
## Consumer alias guidance (optional)
|
|
335
|
-
|
|
336
|
-
Aliases are **optional**. They help you avoid long relative imports **inside your app**.
|
|
337
|
-
|
|
338
|
-
---
|
|
339
|
-
|
|
340
|
-
## Local development (repo)
|
|
341
|
-
|
|
342
|
-
From the repository root:
|
|
65
|
+
## Persistence
|
|
343
66
|
|
|
344
|
-
|
|
345
|
-
pnpm lint
|
|
346
|
-
pnpm build
|
|
347
|
-
pnpm test
|
|
348
|
-
pnpm -C examples/react-app dev
|
|
349
|
-
pnpm -C examples/next-app-router dev
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
---
|
|
353
|
-
|
|
354
|
-
## Peer dependencies
|
|
355
|
-
|
|
356
|
-
Make sure your app installs these (MUI v7 + Emotion):
|
|
357
|
-
|
|
358
|
-
- `react`
|
|
359
|
-
- `react-dom`
|
|
360
|
-
- `@mui/material`
|
|
361
|
-
- `@mui/icons-material` (optional, only if you use icons from MUI)
|
|
362
|
-
- `@emotion/react`
|
|
363
|
-
- `@emotion/styled`
|
|
364
|
-
- `@emotion/css` (optional)
|
|
365
|
-
|
|
366
|
-
---
|
|
367
|
-
|
|
368
|
-
## Troubleshooting
|
|
369
|
-
|
|
370
|
-
### Dark mode switches, but background/cards do not change
|
|
371
|
-
- Ensure your preset provides **both schemes**:
|
|
372
|
-
- `colorSchemes.light.palette.background.default/paper`
|
|
373
|
-
- `colorSchemes.dark.palette.background.default/paper`
|
|
374
|
-
- Avoid hardcoded colors in overrides. Use `theme.palette.*` tokens.
|
|
375
|
-
|
|
376
|
-
### Text is hard to read in dark mode
|
|
377
|
-
- Do not reuse light “ink” constants in dark mode.
|
|
378
|
-
- Check:
|
|
379
|
-
- `palette.text.primary` vs `palette.background.default`
|
|
380
|
-
- `palette.text.secondary` vs `palette.background.paper`
|
|
381
|
-
|
|
382
|
-
### I want to add my own presets
|
|
383
|
-
- Create a `ThemePreset` with `colorSchemes.light` and `colorSchemes.dark`.
|
|
384
|
-
- Combine with defaults: `const themes = [...defaultThemes, myPreset];`
|
|
385
|
-
|
|
386
|
-
## Examples (`examples/react-app`, `examples/next-app-router`)
|
|
387
|
-
|
|
388
|
-
The repo includes runnable example apps that demonstrate:
|
|
389
|
-
- preset switching
|
|
390
|
-
- dark mode switching
|
|
391
|
-
- background + card surfaces changing correctly
|
|
392
|
-
- token/debug view (if enabled in the example)
|
|
393
|
-
- Next.js App Router SSR integration with a client provider boundary
|
|
394
|
-
|
|
395
|
-
Run it from the repository root:
|
|
396
|
-
|
|
397
|
-
```bash
|
|
398
|
-
pnpm -C examples/react-app dev
|
|
399
|
-
pnpm -C examples/next-app-router dev
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
What to check in the UI:
|
|
403
|
-
- switching to **dark** changes the **page background** and **Card/Paper** background
|
|
404
|
-
- text stays readable on both backgrounds
|
|
405
|
-
- inputs, buttons, menus, and dialogs remain usable
|
|
406
|
-
- Next.js example keeps SSR stable while theme state finalizes on the client
|
|
407
|
-
|
|
408
|
-
---
|
|
409
|
-
|
|
410
|
-
## API reference — `ThemeProviderWrapper`
|
|
411
|
-
|
|
412
|
-
`ThemeProviderWrapper` wires MUI ThemeProvider, global styles, and persisted settings.
|
|
413
|
-
|
|
414
|
-
| Prop | Type | Default | What it does |
|
|
415
|
-
|---|---|---|---|
|
|
416
|
-
| `themes` | `ThemePreset[]` (or built-in `defaultThemes`) | `defaultThemes` | List of presets available to the user. |
|
|
417
|
-
| `fontFamily` | `string` | (theme default) | Optional global font stack for the whole app. |
|
|
418
|
-
| `darkMode` | `DarkModeOptions` | - | Forces mode regardless of persisted settings and system preference. |
|
|
419
|
-
| `children` | `ReactNode` | — | Your application tree. |
|
|
67
|
+
Theme settings are stored in `localStorage` under `appSettings`.
|
|
420
68
|
|
|
421
|
-
|
|
69
|
+
Current JSON shape:
|
|
422
70
|
|
|
423
|
-
```
|
|
424
|
-
|
|
425
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
426
|
-
|
|
427
|
-
export function App() {
|
|
428
|
-
return (
|
|
429
|
-
<ThemeProviderWrapper themes={defaultThemes}>
|
|
430
|
-
{/* your app */}
|
|
431
|
-
</ThemeProviderWrapper>
|
|
432
|
-
);
|
|
433
|
-
}
|
|
434
|
-
```
|
|
435
|
-
|
|
436
|
-
---
|
|
437
|
-
|
|
438
|
-
## Public exports (recommended imports)
|
|
439
|
-
|
|
440
|
-
Use only these stable entry points:
|
|
441
|
-
|
|
442
|
-
### Core API
|
|
443
|
-
```ts
|
|
444
|
-
import { ThemeProviderWrapper, useThemeSettings } from "@atomazing-org/design-system";
|
|
445
|
-
```
|
|
446
|
-
|
|
447
|
-
### Built-in presets
|
|
448
|
-
```ts
|
|
449
|
-
import { defaultThemes } from "@atomazing-org/design-system/presets";
|
|
71
|
+
```json
|
|
72
|
+
{ "themeId": "editorial-classic", "darkMode": "system" }
|
|
450
73
|
```
|
|
451
74
|
|
|
452
|
-
|
|
453
|
-
- Avoid deep imports from internal folders. They may change during refactors.
|
|
75
|
+
## SSR Notes
|
|
454
76
|
|
|
455
|
-
|
|
77
|
+
- Keep `ThemeProviderWrapper` inside a client boundary for Next.js and other SSR apps.
|
|
78
|
+
- Do not access `window`, `document`, or `localStorage` at module scope.
|
|
79
|
+
- When dark mode uses `system`, the effective mode resolves on the client after hydration.
|
|
456
80
|
|
|
457
|
-
## Migration
|
|
81
|
+
## Migration Docs
|
|
458
82
|
|
|
459
|
-
If you
|
|
460
|
-
1) Move your theme into a preset shape with **two schemes**:
|
|
461
|
-
- `colorSchemes.light`
|
|
462
|
-
- `colorSchemes.dark`
|
|
463
|
-
2) Ensure each scheme defines the required tokens:
|
|
464
|
-
- `background.default`, `background.paper`
|
|
465
|
-
- `text.primary`, `text.secondary`
|
|
466
|
-
- `divider`
|
|
467
|
-
3) Pass presets into the provider:
|
|
468
|
-
- `themes={[...defaultThemes, myPreset]}` or only `[myPreset]`
|
|
83
|
+
If you are migrating an app to this package, start with:
|
|
469
84
|
|
|
470
|
-
|
|
471
|
-
-
|
|
85
|
+
- `migrations/README.UPDATE.md`
|
|
86
|
+
- `migrations/docs/migrations/design-system/README.md`
|
|
87
|
+
- `migrations/docs/migrations/design-system/shared/WORKING-RULES.md`
|
|
88
|
+
- `migrations/skills/design-system-consumer-agent/SKILL.md`
|
|
89
|
+
- `migrations/skills/design-system-migration-agent/SKILL.md`
|
|
472
90
|
|
|
473
|
-
|
|
91
|
+
## Examples
|
|
474
92
|
|
|
475
|
-
|
|
93
|
+
- `examples/react-app`: canonical Vite smoke consumer for local package validation
|
|
94
|
+
- `examples/next-app-router`: canonical Next.js App Router starter reference
|
|
476
95
|
|
|
477
|
-
|
|
96
|
+
For starter-specific rules, runbooks, and customization guidance, use the local docs
|
|
97
|
+
pack under `examples/next-app-router/`.
|
package/dist/presets/index.d.ts
CHANGED
|
@@ -3,13 +3,17 @@ import '@mui/material/styles';
|
|
|
3
3
|
import 'react';
|
|
4
4
|
|
|
5
5
|
declare const editorialClassic: ThemePreset;
|
|
6
|
+
declare const airportOps: ThemePreset;
|
|
6
7
|
declare const modernMinimal: ThemePreset;
|
|
7
8
|
declare const neoGlass: ThemePreset;
|
|
8
9
|
declare const retroTerminal: ThemePreset;
|
|
9
10
|
declare const warmEarth: ThemePreset;
|
|
10
11
|
declare const acidEditorial: ThemePreset;
|
|
11
12
|
declare const bauhausOps: ThemePreset;
|
|
13
|
+
declare const neonBauhausOps: ThemePreset;
|
|
14
|
+
declare const neonBauhausGrid: ThemePreset;
|
|
12
15
|
declare const brutalistSprint: ThemePreset;
|
|
16
|
+
declare const brandNeonMotion: ThemePreset;
|
|
13
17
|
declare const ceramicFlux: ThemePreset;
|
|
14
18
|
declare const chromaticWireframe: ThemePreset;
|
|
15
19
|
declare const glassReactor: ThemePreset;
|
|
@@ -26,5 +30,7 @@ declare const solarpunkEnterprise: ThemePreset;
|
|
|
26
30
|
declare const spectralOrigami: ThemePreset;
|
|
27
31
|
declare const vaporMonolith: ThemePreset;
|
|
28
32
|
declare const defaultThemes: ThemePreset[];
|
|
33
|
+
declare const landingPageThemes: ThemePreset[];
|
|
34
|
+
declare const allBuiltInThemes: ThemePreset[];
|
|
29
35
|
|
|
30
|
-
export { ThemePreset, acidEditorial, bauhausOps, brutalistSprint, ceramicFlux, chromaticWireframe, defaultThemes, editorialClassic, glassReactor, holographicLedger, infraredBlueprint, kintsugiProtocol, modernMinimal, monochromeKinetics, neoGlass, neoMemphisMetrics, neonCompliance, noirInterface, quantizedHeatmap, retroFutureTerminal, retroTerminal, solarpunkEnterprise, spectralOrigami, vaporMonolith, warmEarth };
|
|
36
|
+
export { ThemePreset, acidEditorial, airportOps, allBuiltInThemes, bauhausOps, brandNeonMotion, brutalistSprint, ceramicFlux, chromaticWireframe, defaultThemes, editorialClassic, glassReactor, holographicLedger, infraredBlueprint, kintsugiProtocol, landingPageThemes, modernMinimal, monochromeKinetics, neoGlass, neoMemphisMetrics, neonBauhausGrid, neonBauhausOps, neonCompliance, noirInterface, quantizedHeatmap, retroFutureTerminal, retroTerminal, solarpunkEnterprise, spectralOrigami, vaporMonolith, warmEarth };
|