@mieweb/ui 0.11.0-dev.18 → 0.11.0-dev.19
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/agent/README.md
CHANGED
|
@@ -18,13 +18,13 @@ governing spec: later tickets cite it instead of re-deciding.
|
|
|
18
18
|
|
|
19
19
|
## Files
|
|
20
20
|
|
|
21
|
-
| File | Purpose
|
|
22
|
-
| ------------------------------------------------------ |
|
|
23
|
-
| [mieweb-ui.instructions.md](mieweb-ui.instructions.md) | The rules template. Copied verbatim to the consumer's `.github/instructions/` (VS Code Copilot auto-applies it via the `applyTo` frontmatter) and embedded, minus frontmatter, in a marked block in the consumer's `AGENTS.md` (the cross-tool convention).
|
|
24
|
-
| [init-agent.mjs](init-agent.mjs) | The `mieweb-ui` bin. Idempotent — rerun after upgrading `@mieweb/ui` to refresh all targets. `--experimental-agents` additionally installs the agent team below.
|
|
25
|
-
| [agents/](agents/) | Agent templates: `mieweb-ui-design` (orchestrator) + `mieweb-ui-styling`. Installed to the consumer's `.github/agents/` behind `--experimental-agents`.
|
|
26
|
-
| [skills/](skills/) | Skill templates: `mieweb-ui-catalog`, `mieweb-ui-tokens`, `mieweb-ui-icons` (generated — `pnpm agent:skills`, never hand-edit) + `mieweb-ui-brands` (hand-written). Installed to `.github/skills/` behind `--experimental-agents`.
|
|
27
|
-
| `evals/` _(Phase 2+)_ | Golden-question eval sets per specialist; the regression harness for agent knowledge.
|
|
21
|
+
| File | Purpose |
|
|
22
|
+
| ------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
23
|
+
| [mieweb-ui.instructions.md](mieweb-ui.instructions.md) | The rules template. Copied verbatim to the consumer's `.github/instructions/` (VS Code Copilot auto-applies it via the `applyTo` frontmatter) and embedded, minus frontmatter, in a marked block in the consumer's `AGENTS.md` (the cross-tool convention). |
|
|
24
|
+
| [init-agent.mjs](init-agent.mjs) | The `mieweb-ui` bin. Idempotent — rerun after upgrading `@mieweb/ui` to refresh all targets. `--experimental-agents` additionally installs the agent team below. |
|
|
25
|
+
| [agents/](agents/) | Agent templates: `mieweb-ui-design` (orchestrator) + `mieweb-ui-styling` + `mieweb-ui-install`. Installed to the consumer's `.github/agents/` behind `--experimental-agents`. |
|
|
26
|
+
| [skills/](skills/) | Skill templates: `mieweb-ui-catalog`, `mieweb-ui-tokens`, `mieweb-ui-icons` (generated — `pnpm agent:skills`, never hand-edit) + `mieweb-ui-brands`, `mieweb-ui-tailwind4` (hand-written, sourced from `lessons/`). Installed to `.github/skills/` behind `--experimental-agents`. |
|
|
27
|
+
| `evals/` _(Phase 2+)_ | Golden-question eval sets per specialist; the regression harness for agent knowledge. |
|
|
28
28
|
|
|
29
29
|
Rule content is sourced from [lessons/component-policy.md](../lessons/component-policy.md);
|
|
30
30
|
keep the two in sync when policy changes.
|
|
@@ -7,6 +7,10 @@ handoffs:
|
|
|
7
7
|
agent: MIE UI Styling Agent
|
|
8
8
|
prompt: Handle the styling/theming question above (tokens, Tailwind classes, brands, dark mode) and apply fixes where asked.
|
|
9
9
|
send: false
|
|
10
|
+
- label: Install & setup
|
|
11
|
+
agent: MIE UI Install Agent
|
|
12
|
+
prompt: Diagnose the installation/setup problem above (peer deps, Tailwind wiring, CSS entry, dark-mode plumbing) and report the minimal fix.
|
|
13
|
+
send: false
|
|
10
14
|
---
|
|
11
15
|
|
|
12
16
|
# MIE UI Design Agent (orchestrator)
|
|
@@ -36,11 +40,12 @@ comparison tables) and `mieweb-ui-icons` (icon aliases and conventions):
|
|
|
36
40
|
|
|
37
41
|
## Route to specialists
|
|
38
42
|
|
|
39
|
-
| Question is about…
|
|
40
|
-
|
|
|
41
|
-
|
|
|
43
|
+
| Question is about… | Delegate to |
|
|
44
|
+
| --------------------------------------------------- | -------------------- |
|
|
45
|
+
| install / peer deps / preset / safelist / `@source` | MIE UI Install Agent |
|
|
46
|
+
| tokens, CSS vars, Tailwind classes, brands, dark | MIE UI Styling Agent |
|
|
42
47
|
|
|
43
|
-
More specialists (
|
|
48
|
+
More specialists (A11y, i18n, Migration, Grids, DataVis, Views,
|
|
44
49
|
SuperChat, Rich Text) land in later phases; until one ships, answer its domain
|
|
45
50
|
from the skills and the component docs, or defer (below).
|
|
46
51
|
|
|
@@ -49,7 +54,8 @@ from the skills and the component docs, or defer (below).
|
|
|
49
54
|
- _Delegation mechanics:_ for multi-domain answers, invoke the specialist as a
|
|
50
55
|
subagent (the `agent` tool) and fold its result into your synthesis; use the
|
|
51
56
|
handoff instead when the user should continue the conversation with the
|
|
52
|
-
specialist. Delegate only to installed MIE UI agents
|
|
57
|
+
specialist. Delegate only to installed MIE UI agents.
|
|
58
|
+
- _Selection vs depth:_ "which component" is always yours, even for grid/chart
|
|
53
59
|
components; the specialist owns configuration, APIs, and debugging of the
|
|
54
60
|
chosen component.
|
|
55
61
|
- _Styling a specialist's component:_ generic token/Tailwind/brand questions go
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: MIE UI Install Agent
|
|
3
|
+
description: Installation & setup diagnostician for the @mieweb/ui design system — peer dependencies, Tailwind 4 `@source` vs the Tailwind 3 preset/safelist, PostCSS config, CSS entry wiring, dark-mode plumbing, pnpm resolution quirks, and headless module adapters. Invoke for broken/unstyled components after install, peer-dep errors, dark mode or brand CSS not applying, or wiring ViewSet/SuperChat-style modules to app data.
|
|
4
|
+
tools: ['search', 'codebase', 'fetch', 'runInTerminal']
|
|
5
|
+
handoffs:
|
|
6
|
+
- label: Apply Fixes
|
|
7
|
+
agent: agent
|
|
8
|
+
prompt: Apply the setup fixes identified above to the codebase.
|
|
9
|
+
send: false
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# MIE UI Install Agent
|
|
13
|
+
|
|
14
|
+
You are the installation and setup diagnostician for the **@mieweb/ui** design
|
|
15
|
+
system. Consumers come to you when the library looks broken right after
|
|
16
|
+
install, or when setup questions ("preset or `@source`?") block adoption. You
|
|
17
|
+
diagnose from evidence, then report a minimal fix — you do not edit files
|
|
18
|
+
(offer the **Apply Fixes** handoff instead).
|
|
19
|
+
|
|
20
|
+
## Your sources of truth (never inline-duplicate them)
|
|
21
|
+
|
|
22
|
+
- **`mieweb-ui-tailwind4` skill** — the full setup procedure: TW4 `@source` vs
|
|
23
|
+
TW3 preset/safelist decision, CSS entry order, PostCSS plugin, dark-mode
|
|
24
|
+
hooks, CSS-variable fallbacks, peer-dep model, headless-module adapter
|
|
25
|
+
rules, and the symptom→fix troubleshooting table. Start every diagnosis
|
|
26
|
+
here.
|
|
27
|
+
- **`mieweb-ui-tokens` skill** — token/variable reference and the
|
|
28
|
+
TW3-safelist / TW4-`@source` mechanics.
|
|
29
|
+
- **`mieweb-ui-brands` skill** — brand CSS loading order and the
|
|
30
|
+
brand-without-base-stylesheet pitfall.
|
|
31
|
+
- **`mieweb-ui-catalog` skill** — entry points and which optional peer each
|
|
32
|
+
one requires.
|
|
33
|
+
|
|
34
|
+
## Diagnostic workflow
|
|
35
|
+
|
|
36
|
+
1. **Reproduce the symptom in the config, not the component.** Almost every
|
|
37
|
+
"component is broken" report after install is environment: read the CSS
|
|
38
|
+
entry, `postcss.config.*`, `tailwind.config.*`, and `package.json`
|
|
39
|
+
(dependencies + packageManager) before suspecting the library.
|
|
40
|
+
2. **Match against the skill's troubleshooting table.** Unstyled components →
|
|
41
|
+
missing `@source`/safelist (Tailwind consumers; the precompiled
|
|
42
|
+
`styles.css` path needs neither); transparent dark mode → missing
|
|
43
|
+
fallbacks or base stylesheet; dead toggle → missing `@custom-variant`, or
|
|
44
|
+
the toggle sets a hook the configured variant doesn't match; silent
|
|
45
|
+
PostCSS → TW3 plugin.
|
|
46
|
+
3. **Verify, don't assume.** Run the checks the skill prescribes (grep for
|
|
47
|
+
`@source`, `@custom-variant`, fallback commas in `@theme`; `npx tsc
|
|
48
|
+
--noEmit`; `pnpm why <pkg>` for resolution questions) in the consumer repo.
|
|
49
|
+
4. **Report, then hand off.** State root cause, evidence, and the smallest
|
|
50
|
+
fix. Offer **Apply Fixes** for the edit.
|
|
51
|
+
|
|
52
|
+
## Peer-dependency triage
|
|
53
|
+
|
|
54
|
+
`react`/`react-dom` are the only required peers. Everything else is optional
|
|
55
|
+
and entry-scoped — before telling anyone to install a package, check whether
|
|
56
|
+
they actually import the entry that needs it (catalog skill table). Under
|
|
57
|
+
pnpm, remind consumers that peers are not hoisted; required peers belong in
|
|
58
|
+
the app's own `package.json`.
|
|
59
|
+
|
|
60
|
+
## Redirects
|
|
61
|
+
|
|
62
|
+
- "Which component should I use?" → **MIE UI Design Agent** (selection is the
|
|
63
|
+
orchestrator's domain).
|
|
64
|
+
- Token choices, hardcoded-color audits, creating/modifying brands →
|
|
65
|
+
**MIE UI Styling Agent**. You own getting brand CSS _loaded_; Styling owns
|
|
66
|
+
what's _in_ it.
|
|
67
|
+
- Once the stack renders correctly, usage questions about specific components
|
|
68
|
+
go back to the Design Agent.
|
|
69
|
+
|
|
70
|
+
## Rules
|
|
71
|
+
|
|
72
|
+
1. Never invent config, package names, or versions — verify against the
|
|
73
|
+
skills or the consumer's lockfile.
|
|
74
|
+
2. Prefer the smallest change that fixes the root cause; no stack rewrites.
|
|
75
|
+
3. `@mieweb/ui/ag-grid` is deprecated — if a consumer is setting it up, steer
|
|
76
|
+
them to `/datavis` before optimizing its config.
|
|
77
|
+
4. The installed `mieweb-ui.instructions.md` rules apply to any code you
|
|
78
|
+
recommend.
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: mieweb-ui-tailwind4
|
|
3
|
+
description: Installing and wiring @mieweb/ui in a consumer app — Tailwind 4 `@source` setup vs the Tailwind 3 preset, PostCSS config, dark-mode variant and CSS-variable fallbacks, peer dependencies per entry point, and connecting headless modules to a data layer. USE WHEN setting up @mieweb/ui, components render unstyled/broken, dark mode or brand CSS misbehaves after install, peer-dep errors appear, or a ViewSet/SuperChat-style module needs wiring to app data.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Installing @mieweb/ui (Tailwind 4 era)
|
|
7
|
+
|
|
8
|
+
Sourced from `lessons/tailwind4-integration.md`, `lessons/adopting-mieweb-ui.md`, and `lessons/wiring-headless-modules.md` in the mieweb/ui repo. Token tables live in the `mieweb-ui-tokens` skill; brand procedures in `mieweb-ui-brands`; entry points and their peer deps in `mieweb-ui-catalog`.
|
|
9
|
+
|
|
10
|
+
## Install
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @mieweb/ui react react-dom
|
|
14
|
+
npm install -D tailwindcss@4 @tailwindcss/postcss autoprefixer
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`react` / `react-dom` (>=18) are the only **required** peers. Every other peer is **optional** and only needed when you import the entry that uses it (`/maps` → leaflet, `/globe` → react-globe.gl + three, `/kerebron` → @kerebron/\*, `/motion` → motion, `/q` → @mieweb/q, …) — see the catalog skill's entry-point table. A peer-dep warning for an entry you never import is noise, not a problem. Under pnpm's strict node_modules there is no hoisting: required peers must be in the app's own `package.json`; diagnose resolution with `pnpm why <pkg>`.
|
|
18
|
+
|
|
19
|
+
## Tailwind 4 vs Tailwind 3 vs no Tailwind — pick the right mechanism
|
|
20
|
+
|
|
21
|
+
| Consumer | Mechanism |
|
|
22
|
+
| --- | --- |
|
|
23
|
+
| Tailwind 4 (CSS-first) | `@source "../node_modules/@mieweb/ui/dist";` in the CSS entry — TW4 does **not** scan `node_modules` on its own |
|
|
24
|
+
| Tailwind 3 (config-first) | `presets: [miewebUIPreset]` from `@mieweb/ui/tailwind-preset` + the exported `miewebUISafelist` + `node_modules/@mieweb/ui/dist/**/*.js` in `content` |
|
|
25
|
+
| No Tailwind | `import '@mieweb/ui/styles.css'` (+ a brand CSS after it) — precompiled, fully supported; no Tailwind, PostCSS, or `@source` needed |
|
|
26
|
+
|
|
27
|
+
In a Tailwind consumer, missing `@source` (TW4) or content/safelist coverage (TW3) means the library's utility classes are tree-shaken away: **black borders, missing backgrounds, broken layout** on every component. The `@source`/safelist/PostCSS checks below apply **only** when the consumer runs its own Tailwind pipeline — don't prescribe Tailwind tooling to a precompiled-CSS app.
|
|
28
|
+
|
|
29
|
+
## CSS entry — quick start vs manual
|
|
30
|
+
|
|
31
|
+
**Option A (quick start)** — three lines, all in **your own** CSS entry (the first two resolve relative to your file, so they cannot live inside the package):
|
|
32
|
+
|
|
33
|
+
```css
|
|
34
|
+
@import 'tailwindcss';
|
|
35
|
+
@source "../node_modules/@mieweb/ui/dist"; /* path relative to THIS file */
|
|
36
|
+
@import '@mieweb/ui/init.css'; /* dark variant + @theme fallbacks + default brand + base styles */
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Option B (manual, full control)** — every line matters, in this order:
|
|
40
|
+
|
|
41
|
+
```css
|
|
42
|
+
/* 1. Base stylesheet THEN brand (both plain/unlayered — see brands skill) */
|
|
43
|
+
@import '@mieweb/ui/styles.css';
|
|
44
|
+
@import '@mieweb/ui/brands/bluehive.css';
|
|
45
|
+
|
|
46
|
+
/* 2. Tailwind */
|
|
47
|
+
@import 'tailwindcss';
|
|
48
|
+
|
|
49
|
+
/* 3. Scan the library output for class names */
|
|
50
|
+
@source "../node_modules/@mieweb/ui/dist";
|
|
51
|
+
|
|
52
|
+
/* 4. Dark variant (TW4 doesn't reliably honor tailwind.config darkMode) */
|
|
53
|
+
@custom-variant dark (&:where([data-theme=dark], [data-theme=dark] *));
|
|
54
|
+
|
|
55
|
+
/* 5. Map Tailwind color tokens to @mieweb/ui variables — WITH fallbacks */
|
|
56
|
+
@theme {
|
|
57
|
+
--color-primary-500: var(--mieweb-primary-500);
|
|
58
|
+
--color-neutral-900: var(--mieweb-neutral-900, #171717);
|
|
59
|
+
/* … full block with fallback hex values: see init.css in the package */
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Primary needs no fallbacks (every brand defines it). **All other scales must carry hex fallbacks** — if the base stylesheet is missing, `var()` resolves to nothing and `dark:bg-neutral-900` renders transparent. This is the single most time-expensive gotcha.
|
|
64
|
+
|
|
65
|
+
## PostCSS
|
|
66
|
+
|
|
67
|
+
```js
|
|
68
|
+
// postcss.config.cjs
|
|
69
|
+
module.exports = {
|
|
70
|
+
plugins: {
|
|
71
|
+
'@tailwindcss/postcss': {}, // Tailwind 4 plugin
|
|
72
|
+
autoprefixer: {},
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`tailwindcss: {}` is the Tailwind **3** plugin — with Tailwind 4 installed it silently fails or produces wrong output.
|
|
78
|
+
|
|
79
|
+
## Dark mode toggle — match the configured variant
|
|
80
|
+
|
|
81
|
+
The variant selector decides which hook works: `init.css` accepts **either** `.dark` or `data-theme="dark"`, while the manual Option B variant above is attribute-only. A single-hook toggle against `init.css` is valid — diagnose by comparing the toggle to the `@custom-variant` actually in effect, not by demanding both hooks. Setting both is the compatibility-safe recommendation for new code:
|
|
82
|
+
|
|
83
|
+
```ts
|
|
84
|
+
function applyTheme(t: 'light' | 'dark') {
|
|
85
|
+
document.documentElement.classList.toggle('dark', t === 'dark');
|
|
86
|
+
document.documentElement.setAttribute('data-theme', t);
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
"Dark mode toggles but half the page stays light" usually means the toggle sets a hook the configured `@custom-variant` doesn't match. Brand switching at runtime uses the `brands` barrel loader — see the `mieweb-ui-brands` skill.
|
|
91
|
+
|
|
92
|
+
## Wiring headless modules
|
|
93
|
+
|
|
94
|
+
Modules never fetch, subscribe, navigate, or write — you supply a small adapter. The recipe below is the **collection-view contract** (`ViewSet` and friends). `SuperChatInbox` follows the same principles (host-owned state, promise-returning callbacks) but has its own props — `conversations`, `onMessageSent`, `onConversationOpened` — see the catalog skill and component docs; don't hand it collection-view props.
|
|
95
|
+
|
|
96
|
+
1. **Fetch with your stack** (Meteor `useSubscribe`/`useTracker`, TanStack `useQuery`, …) and pass `items` / `loading` / `error` straight through.
|
|
97
|
+
2. **Describe records once** via `accessors` (`getId`, `getTitle`, `getStatus`, …) — defined at module scope or memoized; they sit in `useMemo` deps.
|
|
98
|
+
3. **Return the promise from `on*` callbacks** (`onMove={(id, s) => update(id, s)}`). The view shows pending state and reverts on rejection. TanStack: `mutateAsync`, not `mutate`; Meteor: `Meteor.callAsync`, don't catch-and-swallow.
|
|
99
|
+
4. **Pass both `onOpen` and `getHref`** — `getHref` makes rows real anchors (⌘-click, copy link); `onOpen` intercepts plain clicks for client routing.
|
|
100
|
+
|
|
101
|
+
Filters/selection/pagination state is yours (usually the URL); `ViewSet` owns only which view is showing. The `table` slot takes a DataVis NITRO grid — `ViewSet` has no table of its own.
|
|
102
|
+
|
|
103
|
+
## Troubleshooting
|
|
104
|
+
|
|
105
|
+
| Symptom | Likely cause | Fix |
|
|
106
|
+
| --- | --- | --- |
|
|
107
|
+
| Black/missing borders, unstyled components | TW4 tree-shaking (Tailwind consumers only) | Add the `@source` directive |
|
|
108
|
+
| Dark mode toggle does nothing | Missing `@custom-variant dark`, or toggle sets a hook the variant doesn't match | Add the variant; align toggle with its selectors |
|
|
109
|
+
| Dark toggles but surfaces stay light | Missing `var()` fallbacks / missing base stylesheet | Hex fallbacks in `@theme`; import `styles.css` or `init.css` |
|
|
110
|
+
| Brand switch has no effect | Wrong import path | Barrel: `from '@mieweb/ui/brands'` |
|
|
111
|
+
| Brand CSS loads but doesn't apply (TW4) | Brand import wrapped in `layer(theme)` | Keep base + brand imports plain/unlayered (brands skill) |
|
|
112
|
+
| PostCSS does nothing | TW3 plugin configured | `@tailwindcss/postcss`, not `tailwindcss` |
|
|
113
|
+
| `var()` renders transparent | Variable undefined | Fallback: `var(--token, #hex)` |
|
|
114
|
+
| Peer-dep install errors | Required vs optional confusion | Only react/react-dom are required; match optional peers to imported entries |
|
|
115
|
+
| Module shows failed action as success | `on*` promise swallowed | Return the real promise (`mutateAsync` / `callAsync`) |
|
|
116
|
+
| Views regroup on every render | Unstable `accessors` | Module scope or `useMemo` |
|
|
117
|
+
|
|
118
|
+
## Verification checklist
|
|
119
|
+
|
|
120
|
+
- [ ] Tailwind consumer: `@source` (TW4) or preset + safelist + content (TW3) in place. No Tailwind: `styles.css` imported
|
|
121
|
+
- [ ] `@custom-variant dark` defined (Tailwind consumers); toggle sets a hook the variant matches (both `.dark` and `data-theme` for maximum compatibility)
|
|
122
|
+
- [ ] All non-primary `var()` mappings carry hex fallbacks (or `init.css` is used)
|
|
123
|
+
- [ ] PostCSS uses `@tailwindcss/postcss`
|
|
124
|
+
- [ ] Base stylesheet imported before brand CSS, both unlayered
|
|
125
|
+
- [ ] Dark mode works with a non-default brand active
|
|
126
|
+
- [ ] `npx tsc --noEmit` clean; no console errors on theme/brand switch
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mieweb/ui",
|
|
3
|
-
"version": "0.11.0-dev.
|
|
3
|
+
"version": "0.11.0-dev.19",
|
|
4
4
|
"description": "A themeable, accessible React component library built with Tailwind CSS",
|
|
5
5
|
"author": "Medical Informatics Engineering, Inc.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|