You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 0fabfa4
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: packages/swingset/CLAUDE.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -37,7 +37,7 @@ These require reading several files together; the `README.md` covers the step-by
37
37
38
38
-**Every story renders inside `MosaicProvider`.**`StoryPreview` (the MDX `<Preview>`) renders a named story with the playground's knob values as props and exposes a Reset button. `StoryEmbed` (the MDX `<Story>`) renders a single static variation with default knob values and no controls.
39
39
- The header's **RTL** switch (`DirectionToggle`, state in `DirectionProvider`) sets `dir` on `<html>`. It has to sit that high because popover and menu popups portal to `<body>`, so a `dir` on the preview container would never reach them; swingset's own chrome flips along with the story.
40
-
- The header's **Chaos** switch (`ChaosToggle`, state in `ChaosProvider`) stress-tests layouts with worst-case copy and data. `StoryMosaicProvider` (used by both story renderers) passes `chaosLocalization` from `lib/chaos.ts` as the `localization` prop, and remounts the story on toggle so fixture state reseeds. That catalog is generated from `mosaicMessages`, so new messages need no wiring. Fixtures opt their seed data in with `useChaosFixture(data, toChaos)`, building the chaos version from the helpers in `lib/chaos.ts`(`chaosName`, `chaosEmail`, `chaosText`, `chaosRows`). When you add a fixture, wrap its seed data the same way. Stories that mount their own `MosaicProvider` (the Localization page) ignore the catalog.
40
+
- The header's **Chaos** switch (`ChaosToggle`, state in `ChaosProvider`) stress-tests layouts with worst-case data that still reads as real: long names, companies, emails and places across scripts and RTL, plus long row counts. `StoryMosaicProvider` (used by both story renderers) remounts the story on toggle so fixture state reseeds. UI copy stays the built-in English. Fixtures opt their seed data in with `useChaosFixture(data, toChaos)`, building the chaos version from the helpers in `lib/chaos.ts`: seeded `@faker-js/faker` generators (`chaosName`, `chaosPerson`, `chaosUsername`, `chaosEmail`, `chaosCompany`, `chaosSlug`, `chaosPhone`, `chaosPlace`), which take the longest of several samples across locales, plus `chaosRole`, `chaosPick` for hand-written lists faker can't supply, and `chaosRows`. Never stretch copy with filler; pick a longer value someone would actually type. When you add a fixture, wrap its seed data the same way.
41
41
42
42
-**The prop table is the knob surface.**`PropTable` (MDX `<PropTable>`) derives rows from `meta.styles._variants`/`_defaultVariants`, then appends the `className` + `style` escape-hatch rows every Mosaic component accepts. Each variant row renders a `KnobControl` in its **Value** column, seeded with the prop's default and bound to the playground context. The escape-hatch rows and `extra` stay static.
0 commit comments