@maggioli-design-system/magma-react 2.5.1 → 2.7.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/AGENTS.md +19 -4
- package/CHANGELOG.md +69 -0
- package/agents/assets.md +24 -10
- package/agents/color.md +22 -4
- package/agents/components.md +164 -92
- package/agents/conventions.md +19 -8
- package/agents/install.md +7 -0
- package/agents/lint.md +298 -0
- package/agents/mcp.md +107 -0
- package/agents/reporting.md +53 -2
- package/agents/theming.md +8 -0
- package/dist/components.js +1 -0
- package/dist/components.server.js +1 -0
- package/dist/mds-book.js +12 -0
- package/dist/mds-book.server.js +23 -0
- package/dist/types/components.d.ts +1 -0
- package/dist/types/components.server.d.ts +1 -0
- package/dist/types/mds-book.d.ts +9 -0
- package/dist/types/mds-book.server.d.ts +11 -0
- package/package.json +2 -2
package/AGENTS.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
-->
|
|
6
6
|
# @maggioli-design-system/magma-react - agent install guide
|
|
7
7
|
|
|
8
|
-
> Version 2.
|
|
8
|
+
> Version 2.7.0. You (the agent) are installing Magma into THIS project. Do not
|
|
9
9
|
> assume the setup - detect it from the project, then ask the user only for what you
|
|
10
10
|
> cannot infer. The detailed steps live in [`agents/install.md`](agents/install.md)
|
|
11
11
|
> (this target) and [`agents/assets.md`](agents/assets.md) (shared styles, fonts,
|
|
@@ -53,14 +53,26 @@ Ask the user only what detection left undecided. Typical questions:
|
|
|
53
53
|
4. Register components: import the Mds* components from '@maggioli-design-system/magma-react' (no defineCustomElements needed).
|
|
54
54
|
5. Set up editor autocomplete - see [`agents/assets.md`](agents/assets.md) section 5: MERGE the
|
|
55
55
|
keys into `.vscode/settings.json` and `.vscode/extensions.json`, never overwrite them.
|
|
56
|
+
6. Set up the lint - see [`agents/lint.md`](agents/lint.md): the ESLint and Stylelint rules ship
|
|
57
|
+
in this package; MERGE the Magma presets into the project's ESLint and Stylelint
|
|
58
|
+
configurations, never overwrite them.
|
|
59
|
+
7. Set up the MCP server - see [`agents/mcp.md`](agents/mcp.md): it ships in this package as
|
|
60
|
+
the `magma-mcp` command, started with `npx --no magma-mcp` (never without `--no`, which
|
|
61
|
+
would let npx install a package of that name from the registry). For Claude Code, register
|
|
62
|
+
the Magma plugin in the project's `.claude/settings.json` instead: it starts the server and
|
|
63
|
+
adds the Magma skills (`/magma:setup`, `/magma:review`, `/magma:migrate`). For the other
|
|
64
|
+
clients MERGE the entry into `.vscode/mcp.json` or `.cursor/mcp.json`; never both the
|
|
65
|
+
plugin and an `.mcp.json` entry, or the server runs twice. Then call its `check_setup`
|
|
66
|
+
tool: it lists what the integration still misses.
|
|
56
67
|
|
|
57
68
|
## Step 4 - verify
|
|
58
69
|
|
|
59
70
|
Build the app and confirm an `mds-*` component renders and every icon it names loads
|
|
60
71
|
from the configured path (no 404 on `<path><slug>.svg`). In VS Code, check both halves of
|
|
61
72
|
the autocomplete: `var(--magma-` completes Magma tokens in a CSS file and, with Tailwind,
|
|
62
|
-
`bg-surface-default` shows a swatch.
|
|
63
|
-
icon route
|
|
73
|
+
`bg-surface-default` shows a swatch. Run the lint ([`agents/lint.md`](agents/lint.md)): no
|
|
74
|
+
error. Report what was installed, the cascade order used, the icon route, the icon path and
|
|
75
|
+
the lint configuration.
|
|
64
76
|
|
|
65
77
|
## Using the components
|
|
66
78
|
|
|
@@ -68,15 +80,18 @@ Once installed, do not guess component APIs or rules - read only the file you ne
|
|
|
68
80
|
|
|
69
81
|
| You need | Read |
|
|
70
82
|
| -------- | ---- |
|
|
71
|
-
| Which component to reach for | [`agents/components.md`](agents/components.md) - the catalogue, one line each |
|
|
83
|
+
| Which component to reach for | [`agents/components.md`](agents/components.md) - the catalogue by category, one line each |
|
|
72
84
|
| One component's API (props with allowed values, events, methods, slots, parts, CSS vars) | its `AGENTS.md`, linked from the catalogue |
|
|
73
85
|
| Correct usage and mistakes for one component | `pattern.md` / `antipattern.md` beside its `AGENTS.md` |
|
|
74
86
|
| Rules shared by every component: naming, events, slots, compound, icons, a11y, styling from outside | [`agents/conventions.md`](agents/conventions.md) |
|
|
75
87
|
| `variant` and `tone` values | [`agents/variants.md`](agents/variants.md) |
|
|
76
88
|
| Mistakes to avoid with any component | [`agents/anti-patterns.md`](agents/anti-patterns.md) |
|
|
77
89
|
| Coloring your own UI | [`agents/color.md`](agents/color.md) |
|
|
90
|
+
| Colors in an Android, iOS or Flutter app, where the components do not run | [`agents/color.md`](agents/color.md), "Outside the web" |
|
|
78
91
|
| Typography utilities | [`agents/typography.md`](agents/typography.md) |
|
|
79
92
|
| Dark mode, preferences, named themes, surface levels and elevation, global design decisions, corner geometry | [`agents/theming.md`](agents/theming.md) |
|
|
93
|
+
| Asking instead of reading: the API of a component, the role for a need, a class, an icon slug, a guide section, a snippet checked before writing | the tools of the `magma` MCP server, [`agents/mcp.md`](agents/mcp.md) |
|
|
94
|
+
| Checking what you wrote: run ESLint and Stylelint with the Magma presets after every change, and fix what they report | [`agents/lint.md`](agents/lint.md) |
|
|
80
95
|
| Reporting a problem that is Magma's, not this project's (bug, wrong guide, missing token), with this project's origin label | [`agents/reporting.md`](agents/reporting.md) |
|
|
81
96
|
| What changed between the installed version and a newer one, before upgrading | `CHANGELOG.md` of each Magma package, newest release first (`magma-react` and `magma-angular` carry the releases of `magma`) |
|
|
82
97
|
|
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,75 @@ package.
|
|
|
7
7
|
It is released together with `magma`, at the same version: the sections are the
|
|
8
8
|
releases of `magma`.
|
|
9
9
|
|
|
10
|
+
## [magma@2.7.0] - 2026-10-24
|
|
11
|
+
|
|
12
|
+
### Bug Fixes
|
|
13
|
+
|
|
14
|
+
- *(lint)* Spell multi-word Material slugs with hyphens, as iconsauce serves them
|
|
15
|
+
- *(lint)* Check_setup accepts every icon path and lint config its guides document
|
|
16
|
+
- *(lint)* Serialise every DTCG type of the token tools, keep the class of suggest_role
|
|
17
|
+
- *(lint)* No-internal-tokens reads the custom properties of Tailwind classes and @apply
|
|
18
|
+
|
|
19
|
+
### Build
|
|
20
|
+
|
|
21
|
+
- *(magma)* Keep test fixtures out of the release package map
|
|
22
|
+
|
|
23
|
+
### Documentation
|
|
24
|
+
|
|
25
|
+
- *(magma)* Write where each answer of the lint and the MCP server comes from
|
|
26
|
+
- *(magma)* Route agents to the data contracts, stop loading the consumer guides
|
|
27
|
+
|
|
28
|
+
### Features
|
|
29
|
+
|
|
30
|
+
- *(lint)* Ship the MCP tools as data, describe the Stylelint rules, link the release
|
|
31
|
+
- *(lint)* Lead the agent to propose an issue when the MCP server lacks a tool
|
|
32
|
+
- *(lint)* Read classes in clsx(), ternaries, [ngClass] and @apply, as the codemod does
|
|
33
|
+
|
|
34
|
+
## [magma@2.6.0] - 2026-10-24
|
|
35
|
+
|
|
36
|
+
### Bug Fixes
|
|
37
|
+
|
|
38
|
+
- *(mds-book)* Cut the caps of a rounded spine on the arc of its slats
|
|
39
|
+
- *(magma,lint)* Start magma-mcp with npx --no, never letting npx install it
|
|
40
|
+
|
|
41
|
+
### Changes
|
|
42
|
+
|
|
43
|
+
- *(mds-book)* Show the side-to-side drag with an ew-resize cursor
|
|
44
|
+
|
|
45
|
+
### Documentation
|
|
46
|
+
|
|
47
|
+
- *(magma)* Point the Copilot instructions to AGENTS.md
|
|
48
|
+
- *(mds-book)* Show the Catalogue story as a page of a bookshop
|
|
49
|
+
- *(magma,styles)* Allow dark: for a deliberate per-mode choice
|
|
50
|
+
- *(design-tokens,magma)* Document the Android, iOS and Flutter color files
|
|
51
|
+
- *(stencil)* Give an alt to the images of the usage examples, a name to the paginator arrows
|
|
52
|
+
- *(magma)* Set up the lint at bootstrap and run it after every change
|
|
53
|
+
- *(magma)* Set up the MCP server at bootstrap and say when to call each tool
|
|
54
|
+
- *(magma)* Get the Claude Code plugin at bootstrap, the MCP entry for the other clients
|
|
55
|
+
- *(magma,stencil)* Describe the component categories and group the reference by them
|
|
56
|
+
- *(storybook)* File the component stories under their categories, keeping their URLs
|
|
57
|
+
- *(magma,stencil)* Describe where a component page sits in Storybook
|
|
58
|
+
- *(magma)* Name only public CSS custom properties in the usage docs
|
|
59
|
+
- *(magma)* The contract of the component CSS custom properties
|
|
60
|
+
|
|
61
|
+
### Features
|
|
62
|
+
|
|
63
|
+
- *(mds-book)* Add a book drawn as a physical object in 3D from its front cover
|
|
64
|
+
- *(lint)* Add the ESLint and Stylelint rules that check consumer code against the installed Magma
|
|
65
|
+
- *(lint)* Point no-color-scheme-override to the dark variant for a per-mode choice
|
|
66
|
+
- *(magma,lint)* Ship the consumer lint inside magma as ./eslint and ./stylelint
|
|
67
|
+
- *(lint)* The MCP server, ten read-only tools on the data of the installed magma
|
|
68
|
+
- *(magma,lint)* Ship the MCP server in magma as the magma-mcp command
|
|
69
|
+
- *(lint)* Check_setup counts the Magma plugin as the MCP server of Claude Code
|
|
70
|
+
- *(stencil)* Sort the components into categories, their parts under their parent
|
|
71
|
+
- *(stencil)* Carry the public or internal mark of each CSS custom property
|
|
72
|
+
- *(magma)* Promise 184 CSS custom properties, the other 520 are internal
|
|
73
|
+
- *(lint)* Reject internal custom properties, let the static ones take a colour
|
|
74
|
+
|
|
75
|
+
### Styling
|
|
76
|
+
|
|
77
|
+
- *(mds-push-notification)* Paint the light fade with --magma-surface-sunken
|
|
78
|
+
|
|
10
79
|
## [magma@2.5.1] - 2026-10-22
|
|
11
80
|
|
|
12
81
|
### Bug Fixes
|
package/agents/assets.md
CHANGED
|
@@ -154,6 +154,12 @@ with its icon set, and each set comes from its own package, with its own layout:
|
|
|
154
154
|
| `mdi/<name>` | Material Design Icons | `@mdi/svg` | `svg/<name>.svg` |
|
|
155
155
|
| `mgg/<name>` | Maggioli | `@maggioli-design-system/svg-icons` | `dist/svg/<name>.svg` |
|
|
156
156
|
|
|
157
|
+
The slugs are the ones iconsauce writes (Route 1), so a Material slug is not the name of
|
|
158
|
+
its folder: a multi-word name takes hyphens in the slug and underscores in the package
|
|
159
|
+
(`mi/baseline/check-circle` is `svg/check_circle/baseline.svg`), and the variants are
|
|
160
|
+
`baseline`, `outline`, `round` and `sharp`. The package's `twotone.svg` has no slug: iconsauce
|
|
161
|
+
never serves it, and a slug spelled with the folder's underscores renders nothing.
|
|
162
|
+
|
|
157
163
|
Magma ships only the `mgg/` set, and none of these packages is a dependency of `magma`,
|
|
158
164
|
`magma-react` or `magma-angular`: the route you pick installs what it needs. Copying the
|
|
159
165
|
`svg-icons` folder as it is does NOT follow the contract: its files sit directly in
|
|
@@ -200,8 +206,9 @@ in full, or list the computed ones in a file that `content` reads.
|
|
|
200
206
|
|
|
201
207
|
### Route 2: serve the files yourself
|
|
202
208
|
|
|
203
|
-
One renaming step: `@material-icons/svg` stores
|
|
204
|
-
wants `mi
|
|
209
|
+
One renaming step: `@material-icons/svg` stores `check_circle/baseline.svg`, while the slug
|
|
210
|
+
wants `mi/baseline/check-circle` (the contract above). `mdi/` and `mgg/` are plain folder
|
|
211
|
+
copies. This script covers
|
|
205
212
|
the three sets with Node built-ins only, so it fits any bundler:
|
|
206
213
|
|
|
207
214
|
```bash
|
|
@@ -212,7 +219,7 @@ npm i -D @maggioli-design-system/svg-icons @material-icons/svg @mdi/svg
|
|
|
212
219
|
// scripts/copy-icons.mjs
|
|
213
220
|
// Copies Magma's icon sets where mds-icon fetches them: <OUT>/<slug>.svg.
|
|
214
221
|
// node scripts/copy-icons.mjs icons.json only the slugs listed in icons.json
|
|
215
|
-
// node scripts/copy-icons.mjs every icon of the three sets (
|
|
222
|
+
// node scripts/copy-icons.mjs every icon of the three sets (16,530 files, 64 MB)
|
|
216
223
|
import { copyFileSync, existsSync, mkdirSync, readdirSync, readFileSync } from 'node:fs';
|
|
217
224
|
import { createRequire } from 'node:module';
|
|
218
225
|
import { dirname, join } from 'node:path';
|
|
@@ -220,14 +227,18 @@ import { dirname, join } from 'node:path';
|
|
|
220
227
|
const OUT = 'public/svg'; // served at /svg/ by Vite, Next.js and the Angular CLI
|
|
221
228
|
const require = createRequire(import.meta.url);
|
|
222
229
|
const root = (pkg) => dirname(require.resolve(`${pkg}/package.json`));
|
|
223
|
-
const MI = join(root('@material-icons/svg'), 'svg'); // <
|
|
230
|
+
const MI = join(root('@material-icons/svg'), 'svg'); // <name_with_underscores>/<variant>.svg
|
|
224
231
|
const MDI = join(root('@mdi/svg'), 'svg'); // <name>.svg
|
|
225
232
|
const MGG = join(root('@maggioli-design-system/svg-icons'), 'dist/svg'); // <name>.svg
|
|
226
233
|
|
|
234
|
+
// The Material variants iconsauce serves; a slug spells the folder's underscores as hyphens.
|
|
235
|
+
const MI_VARIANTS = ['baseline', 'outline', 'round', 'sharp'];
|
|
236
|
+
|
|
227
237
|
// Source file of a slug: mi/<variant>/<name>, mdi/<name>, mgg/<name>.
|
|
228
238
|
function source(slug) {
|
|
229
239
|
const [set, ...rest] = slug.split('/');
|
|
230
|
-
if (set === 'mi' && rest.length === 2
|
|
240
|
+
if (set === 'mi' && rest.length === 2 && MI_VARIANTS.includes(rest[0]) && !rest[1].includes('_'))
|
|
241
|
+
return join(MI, rest[1].replaceAll('-', '_'), `${rest[0]}.svg`);
|
|
231
242
|
if (set === 'mdi' && rest.length === 1) return join(MDI, `${rest[0]}.svg`);
|
|
232
243
|
if (set === 'mgg' && rest.length === 1) return join(MGG, `${rest[0]}.svg`);
|
|
233
244
|
throw new Error(`Not a Magma icon slug: ${slug}`);
|
|
@@ -236,7 +247,9 @@ function source(slug) {
|
|
|
236
247
|
function allSlugs() {
|
|
237
248
|
const names = (dir) => readdirSync(dir).map((file) => file.replace(/\.svg$/, ''));
|
|
238
249
|
return [
|
|
239
|
-
...readdirSync(MI).flatMap((
|
|
250
|
+
...readdirSync(MI).flatMap((folder) =>
|
|
251
|
+
MI_VARIANTS.map((variant) => `mi/${variant}/${folder.replaceAll('_', '-')}`),
|
|
252
|
+
),
|
|
240
253
|
...names(MDI).map((name) => `mdi/${name}`),
|
|
241
254
|
...names(MGG).map((name) => `mgg/${name}`),
|
|
242
255
|
];
|
|
@@ -256,7 +269,7 @@ console.log(`${slugs.length} icons in ${OUT}/`);
|
|
|
256
269
|
`icons.json` lists the slugs the app uses:
|
|
257
270
|
|
|
258
271
|
```json
|
|
259
|
-
["mi/baseline/email", "mi/
|
|
272
|
+
["mi/baseline/email", "mi/outline/check-circle", "mdi/github", "mgg/abitazione-principale"]
|
|
260
273
|
```
|
|
261
274
|
|
|
262
275
|
```json
|
|
@@ -270,7 +283,7 @@ console.log(`${slugs.length} icons in ${OUT}/`);
|
|
|
270
283
|
A slug that does not exist stops the script with an error. A slug used in the code but
|
|
271
284
|
missing from `icons.json` gives a 404 at runtime: iconsauce avoids that by reading the
|
|
272
285
|
sources. Without `icons.json` the script copies every icon of the three sets, all of
|
|
273
|
-
them deployed:
|
|
286
|
+
them deployed: 16,530 files and 64 MB (`mi` 34 MB in four variants, `mdi` 29 MB, `mgg`
|
|
274
287
|
1.3 MB).
|
|
275
288
|
|
|
276
289
|
### Only the `mgg/` set
|
|
@@ -389,7 +402,7 @@ names through functions (`clsx`, `cva`, `cn`), list the ones it uses in
|
|
|
389
402
|
|
|
390
403
|
Verify, after reloading the window:
|
|
391
404
|
|
|
392
|
-
- in a CSS file, `var(--magma-surface
|
|
405
|
+
- in a CSS file, `var(--magma-surface-` lists the surface roles, in order, with swatches;
|
|
393
406
|
- with Tailwind, in markup: hovering `p-600` shows `1.5rem = 24px`, and `bg-surface-default`
|
|
394
407
|
shows a swatch in the completion list. No swatch on the semantic classes means an older
|
|
395
408
|
`@maggioli-design-system/styles`: update it.
|
|
@@ -409,7 +422,8 @@ Known limits, nothing to configure:
|
|
|
409
422
|
- [ ] `@fontsource` fonts installed and imported in the `vendor` layer
|
|
410
423
|
- [ ] Every icon slug the app uses served at `<mdsIconSvgPath><slug>.svg` (iconsauce or
|
|
411
424
|
the copy script, run before dev and build, output folder out of git)
|
|
412
|
-
- [ ]
|
|
425
|
+
- [ ] That public path set before hydration (`IconsSetService.setSvgPath()` or the
|
|
426
|
+
`mdsIconSvgPath` key of `sessionStorage`)
|
|
413
427
|
- [ ] (optional) `identity` installed if brand assets are used
|
|
414
428
|
- [ ] Components registered per your target track
|
|
415
429
|
- [ ] (VS Code) the editor keys merged into `.vscode/settings.json` and `extensions.json`;
|
package/agents/color.md
CHANGED
|
@@ -16,15 +16,15 @@ Paint your UI with the semantic roles (`--magma-*`), not with a raw palette step
|
|
|
16
16
|
with Tailwind's own palette:
|
|
17
17
|
|
|
18
18
|
```html
|
|
19
|
-
<!--
|
|
19
|
+
<!-- CORRECT: roles follow the mode, the named theme and high contrast -->
|
|
20
20
|
<section class="bg-surface-raised text-fg-default border border-border-muted">
|
|
21
21
|
<p class="text-fg-muted">Secondary text</p>
|
|
22
22
|
</section>
|
|
23
23
|
|
|
24
|
-
<!--
|
|
24
|
+
<!-- INCORRECT: raw Magma steps only flip with the mode -->
|
|
25
25
|
<section class="bg-tone-neutral-seed text-tone-neutral-01 border-tone-neutral-09">...</section>
|
|
26
26
|
|
|
27
|
-
<!--
|
|
27
|
+
<!-- INCORRECT: Tailwind's palette ignores Magma entirely -->
|
|
28
28
|
<section class="bg-white text-gray-700">...</section>
|
|
29
29
|
```
|
|
30
30
|
|
|
@@ -150,7 +150,11 @@ measured.
|
|
|
150
150
|
what the element is, not by the shade you want, and give `raised` / `overlay` a shadow
|
|
151
151
|
([`theming.md`](theming.md#surfaces-and-elevation)). A grey that has to look marked in
|
|
152
152
|
both modes (a pill, a chip, a hover) is a wash, not a surface.
|
|
153
|
-
- **
|
|
153
|
+
- **The roles already flip: `dark:` never corrects them.** Keep `dark:` for a deliberate
|
|
154
|
+
choice that differs per mode (a well that sits on the page in light and rises to
|
|
155
|
+
`surface-raised` in dark). It follows the Magma mode, `system` included
|
|
156
|
+
([`theming.md`](theming.md#dark-mode-and-preferences)), in the light DOM only. Never
|
|
157
|
+
write a dark-mode media query by hand.
|
|
154
158
|
|
|
155
159
|
## When a raw palette colour is right
|
|
156
160
|
|
|
@@ -170,6 +174,20 @@ with `data-theme-name` ([`theming.md`](theming.md)), do not paint them by hand.
|
|
|
170
174
|
Deprecated: `--magma-neutral-emphasis` / `--magma-neutral-on-emphasis` are aliases of
|
|
171
175
|
`--magma-surface-inverse` / `--magma-on-inverse`.
|
|
172
176
|
|
|
177
|
+
## Outside the web
|
|
178
|
+
|
|
179
|
+
The roles (`--magma-*`), the utilities and the components are web only. An Android, iOS or
|
|
180
|
+
Flutter app takes its colours from `@maggioli-design-system/design-tokens`, as files to copy
|
|
181
|
+
into the app: `dist/android/colors.xml`, one of `dist/ios-swift/*.swift`,
|
|
182
|
+
`dist/flutter/colors.dart`. They hold the palettes and the surface, border and text colours
|
|
183
|
+
of each family, both modes side by side (`color_surface_neutral_light_default`,
|
|
184
|
+
`..._dark_...`), and nothing else: no type, spacing or motion tokens, no theme or contrast
|
|
185
|
+
switch. Paint with the family of the default theme, `neutral` (`surface_neutral_*`,
|
|
186
|
+
`border_neutral_*`, `text_neutral_*`), switch the mode in the app, and take any other role
|
|
187
|
+
from the step it points at. The names per platform, the mode switch and the outputs that do
|
|
188
|
+
not compile (`dist/ios/`, `dist/flutter/fonts.dart`) are in
|
|
189
|
+
`node_modules/@maggioli-design-system/design-tokens/README.md`, "Native platforms".
|
|
190
|
+
|
|
173
191
|
## Migrating Magma 1 colour classes
|
|
174
192
|
|
|
175
193
|
Magma 1 code paints raw steps, often with a hand-tuned `dark:` override. These steps have
|