@vielzeug/codex 26.11.32 → 26.12.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.
@@ -1,4 +1,6 @@
1
- import { EMPTY_SCHEMA, parseArgs } from './schema.js';
1
+ import { CatalogError } from '../catalog.js';
2
+ import { EMPTY_SCHEMA } from './schema.js';
3
+ import { defineTool } from './shared.js';
2
4
  const tag = {
3
5
  additionalProperties: false,
4
6
  properties: { tagName: { description: 'Custom element tag', maxLength: 100, minLength: 1, type: 'string' } },
@@ -71,14 +73,20 @@ function enumValues(type) {
71
73
  function validateFragment(catalog, html) {
72
74
  const issues = [];
73
75
  for (const opening of parseOpeningTags(html)) {
74
- const component = catalog.components.find((item) => item.tag === opening.tag);
75
- if (!component) {
76
- issues.push({
77
- message: `Unknown component <${opening.tag}>. Run refine-list-components for the tag list.`,
78
- tag: opening.tag,
79
- type: 'error',
80
- });
81
- continue;
76
+ let component;
77
+ try {
78
+ component = catalog.getComponent(opening.tag);
79
+ }
80
+ catch (error) {
81
+ if (error instanceof CatalogError && error.code === 'NOT_FOUND') {
82
+ issues.push({
83
+ message: `Unknown component <${opening.tag}>. Run refine-list-components for the tag list.`,
84
+ tag: opening.tag,
85
+ type: 'error',
86
+ });
87
+ continue;
88
+ }
89
+ throw error;
82
90
  }
83
91
  const known = new Map((component.attributes ?? []).map((attr) => [attr.name.toLowerCase(), attr]));
84
92
  for (const [name, value] of opening.attributes) {
@@ -107,32 +115,36 @@ function validateFragment(catalog, html) {
107
115
  return issues;
108
116
  }
109
117
  export const refineTools = [
110
- {
118
+ defineTool({
111
119
  description: 'List bundled Refine component tags and descriptions.',
112
- execute: (_args, catalog) => catalog.components.map((component) => ({ description: component.summary ?? '', tagName: component.tag })),
120
+ execute: (_input, catalog) => catalog.components.map((component) => ({ description: component.summary ?? '', tagName: component.tag })),
113
121
  inputSchema: EMPTY_SCHEMA,
114
122
  name: 'refine-list-components',
115
- },
116
- {
123
+ title: 'List Refine components',
124
+ }),
125
+ defineTool({
117
126
  description: 'Read one Refine component declaration.',
118
- execute: (args, catalog) => catalog.getComponent(parseArgs(tag, args).tagName),
127
+ execute: (input, catalog) => catalog.getComponent(input.tagName),
119
128
  inputSchema: tag,
120
129
  name: 'refine-get-component',
121
- },
122
- {
130
+ title: 'Get Refine component',
131
+ }),
132
+ defineTool({
123
133
  description: 'List Refine theme tokens (custom properties from theme.css) with values and notes.',
124
- execute: (args, catalog) => {
125
- const filter = parseArgs(tokenFilter, args).filter.toLowerCase();
134
+ execute: (input, catalog) => {
135
+ const filter = input.filter.toLowerCase();
126
136
  return catalog.tokens.filter((token) => !filter || token.name.toLowerCase().startsWith(filter));
127
137
  },
128
138
  inputSchema: tokenFilter,
129
139
  name: 'refine-get-tokens',
130
- },
131
- {
140
+ title: 'Get Refine tokens',
141
+ }),
142
+ defineTool({
132
143
  description: "Validate a Refine HTML fragment: unknown ore-* tags, unknown attributes, and values outside each attribute's allowed set, across every opening tag.",
133
- execute: (args, catalog) => validateFragment(catalog, parseArgs(usage, args).html),
144
+ execute: (input, catalog) => validateFragment(catalog, input.html),
134
145
  inputSchema: usage,
135
146
  name: 'refine-validate-usage',
136
- },
147
+ title: 'Validate Refine usage',
148
+ }),
137
149
  ];
138
150
  //# sourceMappingURL=refine.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"refine.js","sourceRoot":"","sources":["../../src/tools/refine.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,SAAS,EAAmB,MAAM,aAAa,CAAC;AAGvE,MAAM,GAAG,GAAG;IACV,oBAAoB,EAAE,KAAK;IAC3B,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,WAAW,EAAE,oBAAoB,EAAE,SAAS,EAAE,GAAG,EAAE,SAAS,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;IAC5G,QAAQ,EAAE,CAAC,SAAS,CAAC;IACrB,IAAI,EAAE,QAAQ;CACM,CAAC;AACvB,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OAAO,EAAE,EAAE,CAAC,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC;QAClE,WAAW,EAAE,KAAK;QAClB,IAAI,EAAE,uBAAuB;QAC7B,KAAK,EAAE,uBAAuB;KAC/B,CAAC;CACiC,CAAC"}
@@ -1,8 +1,17 @@
1
1
  import type { Catalog } from '../catalog.js';
2
- import type { ToolSchema } from './schema.js';
2
+ import type { InferArgs, ToolSchema } from './schema.js';
3
3
  export interface ToolDefinition {
4
4
  description: string;
5
- execute: (args: Record<string, unknown>, catalog: Catalog) => unknown;
5
+ execute: (args: Record<string, string>, catalog: Catalog) => unknown;
6
6
  inputSchema: ToolSchema;
7
7
  name: string;
8
+ title: string;
8
9
  }
10
+ /** Registers one MCP tool with a typed execute handler; {@link registerTools} runs {@link parseArgs} first. */
11
+ export declare function defineTool<S extends ToolSchema>(def: {
12
+ description: string;
13
+ execute: (input: InferArgs<S>, catalog: Catalog) => unknown;
14
+ inputSchema: S;
15
+ name: string;
16
+ title: string;
17
+ }): ToolDefinition;
@@ -1,2 +1,11 @@
1
- export {};
1
+ /** Registers one MCP tool with a typed execute handler; {@link registerTools} runs {@link parseArgs} first. */
2
+ export function defineTool(def) {
3
+ return {
4
+ description: def.description,
5
+ execute: (args, catalog) => def.execute(args, catalog),
6
+ inputSchema: def.inputSchema,
7
+ name: def.name,
8
+ title: def.title,
9
+ };
10
+ }
2
11
  //# sourceMappingURL=shared.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":""}
1
+ {"version":3,"file":"shared.js","sourceRoot":"","sources":["../../src/tools/shared.ts"],"names":[],"mappings":"AAWA,+GAA+G;AAC/G,MAAM,UAAU,UAAU,CAAuB,GAMhD;IACC,OAAO;QACL,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,OAAO,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAoB,EAAE,OAAO,CAAC;QACtE,WAAW,EAAE,GAAG,CAAC,WAAW;QAC5B,IAAI,EAAE,GAAG,CAAC,IAAI;QACd,KAAK,EAAE,GAAG,CAAC,KAAK;KACjB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vielzeug/codex",
3
- "version": "26.11.32",
3
+ "version": "26.12.0",
4
4
  "description": "MCP server exposing all Vielzeug docs to AI clients",
5
5
  "repository": {
6
6
  "type": "git",
@@ -52,7 +52,7 @@
52
52
  },
53
53
  "devDependencies": {
54
54
  "@types/node": "^26.6.6",
55
- "@vielzeug/refine": "26.11.32",
55
+ "@vielzeug/refine": "26.12.0",
56
56
  "typescript": "^6.0.3",
57
57
  "vitest": "^5.1.0"
58
58
  }
@@ -10,7 +10,7 @@ Vielzeug is a monorepo of independently published TypeScript packages. "Zero dep
10
10
  ## Detect
11
11
 
12
12
  1. Read `package.json` (`dependencies`, `devDependencies`, `peerDependencies`) and list every `@vielzeug/*` entry, resolving each installed version from `node_modules/@vielzeug/<pkg>/package.json` when present, otherwise from the package-manager lockfile. When codex's MCP server is connected, its server instructions report the snapshot version its answers describe: compare it with the installed versions before recommending APIs, and treat the installed package as authoritative when they differ.
13
- 2. Note whether `@vielzeug/refine` is installed. If it is, the **Refine** and **Theme** sections below are mandatory for any UI work.
13
+ 2. Note whether `@vielzeug/refine` is installed. If it is, read `references/refine.md` and `references/theme.md` before any UI work; when no `ore-*` component fits, also read `references/behaviors.md`.
14
14
  3. Read the project's own agent contract (`AGENTS.md`, `.github/copilot-instructions.md`) first: project rules win over this skill. Also load the nearest subtree `AGENTS.md` before editing inside it (index at the end of root `AGENTS.md`).
15
15
 
16
16
  ## Discover, don't recall
@@ -21,11 +21,11 @@ Never guess exports, attributes, events, slots, or token names. Look them up:
21
21
  | ----------------------------------------------------------- | -------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
22
22
  | Which package solves X? | `search`, `list-packages` | the package list below |
23
23
  | How do I use package X? | `get-docs` (`slug`, `page`, optional `section`) | `node_modules/@vielzeug/<pkg>/README.md` |
24
- | Exact signature of an export | `get-type-signature` (`slug`, `symbol`) | the declaration file named by the installed manifest's matching export |
24
+ | Exact signature of an export | `get-type-signature` (`symbol`, optional `slug`) | the declaration file named by the installed manifest's matching export |
25
25
  | Runnable example | `get-package` (example ids), `get-example` | package README; `docs/<pkg>/examples/` when the Vielzeug repository is checked out |
26
26
  | Which Refine components exist? | `refine-list-components` (tags + summaries) | `rg '"tagName"' node_modules/@vielzeug/refine/dist/custom-elements.json` |
27
27
  | Attributes, properties, events, slots, CSS parts of `ore-*` | `refine-get-component` | extract the matching `tagName` declaration from the manifest with a JSON parser |
28
- | Component CSS custom properties | `refine-get-tokens` (pass a prefix) | extract the component's `cssProperties` from the manifest |
28
+ | Component CSS custom properties | `refine-get-component` (`cssProperties` field) | extract the component's `cssProperties` from the manifest |
29
29
  | Global design tokens | `refine-get-tokens`, or targeted search in installed theme CSS | `node_modules/@vielzeug/refine/dist/styles/theme.css` or checkout `packages/refine/src/styles/theme.css` |
30
30
  | Are component tags, attributes, and values valid? | `refine-validate-usage` | compare against the manifest |
31
31
 
@@ -37,7 +37,7 @@ Codex serves a versioned snapshot, which may not match the versions installed in
37
37
 
38
38
  `get-docs` serves every bundled docs page by path (`index`, `api`, `usage`, and extras such as Refine's `frameworks`, `theming`, `accessibility`, and `components/<name>`); `get-package` lists a package's pages. Offline, read the same pages from `https://vielzeug.dev/<pkg>/<page>` or the checkout's `docs/<pkg>/`.
39
39
 
40
- If MCP is unavailable, use the offline fallback first. Check installed packages and the lockfile when the generated package list has no match. If the needed information is still unavailable and MCP setup would help, ask before running `npx -y @vielzeug/codex` or changing MCP configuration; setup details are in `node_modules/@vielzeug/codex/mcp-setup.json`.
40
+ If MCP is unavailable, use the offline fallback first. Check installed packages and the lockfile when the generated package list has no match. If the needed information is still unavailable and MCP setup would help, ask before running `npx -y @vielzeug/codex` or changing MCP configuration; setup details are in `node_modules/@vielzeug/codex/mcp-setup.json`. Keep the installed skill current with `npx -y @vielzeug/codex skills install --check`.
41
41
 
42
42
  ## Use the owning package
43
43
 
@@ -108,101 +108,15 @@ Common compositions (verify unfamiliar APIs from the smallest applicable source
108
108
  - **Dates**: `tempo` for date utilities; do not hand-roll date math.
109
109
  - **Own cleanup** for every stateful handle or subscription whose API documents disposal or unsubscription, and tie it to the owner's lifecycle. Pure functions and value-returning APIs need no cleanup; verify the specific API contract rather than assuming it returns a disposable.
110
110
 
111
- ## Refine (when `@vielzeug/refine` is installed)
112
-
113
- Refine is the UI layer. Build interfaces from `ore-*` elements before anything else.
114
-
115
- 1. **Bootstrap once**, before rendering any component:
116
-
117
- ```ts
118
- import '@vielzeug/refine/fouc.css'; // hide unupgraded elements until first paint
119
- import '@vielzeug/refine/tokens.css'; // tokens, animations, cascade layers
120
- ```
121
-
122
- Optional: `@vielzeug/refine/styles/preflight.css` for a browser reset.
123
-
124
- 2. **Register per component** through explicit side-effect subpaths (`import '@vielzeug/refine/button'`). The package root registers nothing by design: there is no whole-library import to fall back on.
125
-
126
- 3. **Prefer Refine components when they fit.** For common interface controls and widgets such as buttons, inputs, selects, dialogs, menus, tables, and tabs, first check whether Refine has a component whose documented behavior fits the feature and the project's framework, accessibility, and runtime requirements. Read the candidate's contract with `refine-get-component`; fall back to `refine-list-components` only when no tag is known to fit. If no component fits or a project requirement makes it unsuitable, use the simplest appropriate native element or other package and briefly explain the choice; do not build a parallel composite when a suitable Refine component exists.
127
-
128
- 4. **Use native elements for document semantics** (`<main>`, `<section>`, `<article>`, headings, paragraphs, plain links, and images), and when they are the better fit for a documented project or platform constraint.
129
-
130
- 5. **Follow the element contract**: attributes for primitives, JavaScript properties for objects/arrays/callbacks, named slots for composition. Read event payloads from the documented `event.detail` or element state as appropriate; do not assume every event uses `event.target`. Icon-only controls need an accessible label.
131
-
132
- 6. **Type the tags** once in a type entry point: `import type {} from '@vielzeug/refine/frameworks/elements'` (or `/react`, `/vue`). For new or changed framework wiring (React 18/19, Vue, Svelte, Angular, SSR guards), read the `frameworks` guide (`get-docs` with `slug: "refine"`, `page: "frameworks"`, or `https://vielzeug.dev/refine/frameworks`). Reuse verified existing wiring for ordinary component edits.
133
-
134
- 7. **Check generated markup** with `refine-validate-usage` when available. It checks every `ore-*` opening tag in the fragment for unknown tags, unknown attributes, and values outside an attribute's documented set; it does not validate children, slot content, JavaScript properties, events, accessibility, or runtime behavior. Check those against the component docs and relevant tests instead.
135
-
136
- 8. **Missing capability?** Compose existing `ore-*` elements when they fit. If none meets the documented feature and project requirements, compose the public behavior primitives below, and report the gap.
137
-
138
- ## Behavior-first composition (when no `ore-*` component fits)
139
-
140
- When no Refine component fits, compose the public behavior primitives instead of hand-writing their logic. Never write your own `document` click listeners, ad-hoc `keydown` switches, focus-restoration code, or live-region markup: these primitives already handle shadow roots, stacked surfaces, and screen readers correctly.
141
-
142
- | Need | Use |
143
- | ------------------------------------------------- | ---------------------------------------------------------------------- |
144
- | Popup positioning next to a trigger | `orbit` `createPositioner` / `autoUpdate` (prefer `ore-popover` first) |
145
- | Dismiss on outside pointer / Escape | `focus` `createDismissal` |
146
- | List navigation with typeahead | `focus` `createListNavigation` |
147
- | Grid navigation | `focus` `createGridNavigation` |
148
- | Return focus after a popup closes | `focus` `captureFocus` / `restoreFocus` |
149
- | Recover focus when the focused element is removed | `focus` `rescueFocus` |
150
- | Screen-reader announcements | `focus` `announce` |
151
- | Keyboard shortcuts and chords | `keymap` `createKeymap` |
152
- | Reordering (pointer and keyboard) | `dnd` sortable |
153
- | Virtualized rows | `scroll` (prefer `ore-datagrid`/`ore-list` first) |
154
- | Fuzzy search and match highlighting | `scout` |
155
- | Drag, pan, pinch, long-press gestures | `gesture` |
156
- | Element size, viewport, media state | `sentinel` |
157
-
158
- Every stateful primitive takes an `AbortSignal` or returns a `dispose()`; tie it to the owner's lifecycle. (`announce` is stateless and needs no cleanup.)
159
-
160
- **Verify after composing behaviors** before reporting a composed control as done:
161
-
162
- 1. **ARIA state:** after each transition, assert the trigger's `aria-expanded`/`aria-controls`, the active item (`aria-activedescendant` or roving `tabindex`), and `aria-selected`/`aria-checked`/`aria-disabled`. With `@vielzeug/assay`, use `within`/`queryInShadow` plus `eventually`.
163
- 2. **Interaction states:** with assay `fireKeyDown`/`fireClick`, cover open (Enter/Space/ArrowDown), Arrow/Home/End navigation, typeahead, skipped disabled items, selection, Escape closing with focus back on the trigger, outside-pointer dismissal, and no-op after `dispose()`.
164
- 3. **Automated accessibility:** run an axe scan in both closed and open states with the project's existing axe setup. Without one, mark the scan `[VERIFY]`; do not claim it passed, and do not add an axe dependency without approval.
165
- 4. **Real browser:** check that `:focus-visible`, hover, and disabled styles are visible and token-driven, and that outside dismissal works across a shadow root. jsdom cannot check these.
166
- 5. **Report:** list each command that ran and its result; mark every unchecked item `[VERIFY]` with the reason.
167
-
168
- ## Theme (when `@vielzeug/refine` is installed)
169
-
170
- - All visuals come from tokens: spacing `var(--size-*)` on a 4‑point grid, type `var(--text-*)`, radius `var(--rounded-*)`, semantic colors `var(--color-primary|secondary|neutral|success|warning|error|info)`. No hard-coded hex/px in app CSS when a token exists (verify the exact name or prefix with a targeted theme CSS search).
171
- - Rebrand with one variable: `:root { --color-primary-hue: 220deg; }`. Override `--color-primary` only when the hue alone is insufficient.
172
- - Overrides go in an **unlayered** `:root` (or a scoping class) rule; Refine tokens live in `@layer refine.tokens`, so plain rules win. Never use `!important`.
173
- - Dark mode is `document.documentElement.classList.toggle('dark')`; tokens use `light-dark()`. Do not write `prefers-color-scheme` media blocks for colors. `@vielzeug/refine/theme` ships `createThemeController()` for a persisted light/dark/system preference.
174
- - Style components through their documented CSS custom properties and `::part()` hooks, not by piercing the shadow DOM.
175
- - Other Vielzeug UI packages ship tokens-aligned themes; import them alongside Refine's (`@vielzeug/prism/theme.css` for charts).
176
-
177
- ## Other UI packages
178
-
179
- Refine covers the widget layer; these provide specialized behavior it may not cover. Use the package that best fits the requirement, and prefer an `ore-*` element when it provides the needed behavior:
180
-
181
- - `prism`: SVG charts (line, bar, area, scatter, pie, radar, heatmap, sparkline) plus `@vielzeug/prism/theme.css`.
182
- - `scroll`: virtualized large lists (prefer `ore-datagrid`/`ore-list` for ordinary sizes).
183
- - `dnd` / `gesture`: sortable lists, drop zones, pointer drag and pan.
184
- - `necromancer`: Web Animations API primitives and FLIP.
185
- - `orbit`: floating positioning; reach for `ore-popover`, `ore-tooltip`, `ore-menu` first.
186
- - `focus` / `keymap`: dismissal, announcements, list navigation, focus restoration, keyboard shortcuts.
187
- - `ore`: authoring your own custom elements that compose Refine.
188
-
189
111
  ## Anti-patterns
190
112
 
191
113
  - Hand-rolled signals, fetch wrappers, validators, routers, i18n, or DI when the package is installed.
192
- - Custom modal, dropdown, tooltip, select, tabs, or toast implementations when a suitable Refine component meets the project requirements.
193
- - Hand-written `document` click listeners, ad-hoc `keydown` switches, manual focus restoration, or custom live-region markup instead of `focus` `createDismissal`, `createListNavigation`, `captureFocus`/`restoreFocus`, and `announce`.
194
- - Building a searchable or multi-select picker when `ore-combobox`/`ore-select` covers it.
195
- - Native `<button>`, `<input>`, `<select>`, or `<table>` for interactive UI when a suitable Refine component meets the project requirements.
196
- - Inline colors, magic pixel values, `!important`, or `@media (prefers-color-scheme)` color rules.
197
- - Inventing an attribute, event, or slot that `refine-get-component` does not list.
198
- - Forgetting `tokens.css`/`fouc.css`, or importing the whole library when subpaths suffice.
199
114
  - Leaking effects, subscriptions, or clients past their owner's lifetime.
200
115
 
201
116
  ## Done when
202
117
 
203
118
  - Every new capability maps to an installed `@vielzeug/*` package or is justified as out of scope.
204
119
  - No parallel implementation of something an installed package provides.
205
- - Where no `ore-*` component fit, interactive behavior comes from the behavior primitives (dismissal, navigation, focus, announcements), and the "Verify after composing behaviors" checklist was completed or its gaps marked `[VERIFY]`.
206
- - With Refine installed: component choice follows Refine step 3; load `tokens.css` + `fouc.css` once, use the attribute checker within its stated limits, and use Refine tokens for app styling where suitable tokens exist.
120
+ - With Refine installed: component choice follows `references/refine.md`; theme rules from `references/theme.md`; composed controls follow `references/behaviors.md` when no `ore-*` component fit.
207
121
  - Every API that documents an owned resource or cleanup operation is integrated with the owning lifecycle; pure and value-returning APIs are not given invented cleanup.
208
122
  - Claims about package APIs were verified from an applicable lookup, installed declarations, or checkout source, not recalled; completion does not require repeating unchanged evidence.
@@ -0,0 +1,35 @@
1
+ # Behavior-first composition (when no `ore-*` component fits)
2
+
3
+ When no Refine component fits, compose the public behavior primitives instead of hand-writing their logic. Never write your own `document` click listeners, ad-hoc `keydown` switches, focus-restoration code, or live-region markup: these primitives already handle shadow roots, stacked surfaces, and screen readers correctly.
4
+
5
+ | Need | Use |
6
+ | ------------------------------------------------- | ---------------------------------------------------------------------- |
7
+ | Popup positioning next to a trigger | `orbit` `createPositioner` / `autoUpdate` (prefer `ore-popover` first) |
8
+ | Dismiss on outside pointer / Escape | `focus` `createDismissal` |
9
+ | List navigation with typeahead | `focus` `createListNavigation` |
10
+ | Grid navigation | `focus` `createGridNavigation` |
11
+ | Return focus after a popup closes | `focus` `captureFocus` / `restoreFocus` |
12
+ | Recover focus when the focused element is removed | `focus` `rescueFocus` |
13
+ | Screen-reader announcements | `focus` `announce` |
14
+ | Keyboard shortcuts and chords | `keymap` `createKeymap` |
15
+ | Reordering (pointer and keyboard) | `dnd` sortable |
16
+ | Virtualized rows | `scroll` (prefer `ore-datagrid`/`ore-list` first) |
17
+ | Fuzzy search and match highlighting | `scout` |
18
+ | Drag, pan, pinch, long-press gestures | `gesture` |
19
+ | Element size, viewport, media state | `sentinel` |
20
+
21
+ Every stateful primitive takes an `AbortSignal` or returns a `dispose()`; tie it to the owner's lifecycle. (`announce` is stateless and needs no cleanup.)
22
+
23
+ ## Verify after composing behaviors
24
+
25
+ Before reporting a composed control as done:
26
+
27
+ 1. **ARIA state:** after each transition, assert the trigger's `aria-expanded`/`aria-controls`, the active item (`aria-activedescendant` or roving `tabindex`), and `aria-selected`/`aria-checked`/`aria-disabled`. With `@vielzeug/assay`, use `within`/`queryInShadow` plus `eventually`.
28
+ 2. **Interaction states:** with assay `fireKeyDown`/`fireClick`, cover open (Enter/Space/ArrowDown), Arrow/Home/End navigation, typeahead, skipped disabled items, selection, Escape closing with focus back on the trigger, outside-pointer dismissal, and no-op after `dispose()`.
29
+ 3. **Automated accessibility:** run an axe scan in both closed and open states with the project's existing axe setup. Without one, mark the scan `[VERIFY]`; do not claim it passed, and do not add an axe dependency without approval.
30
+ 4. **Real browser:** check that `:focus-visible`, hover, and disabled styles are visible and token-driven, and that outside dismissal works across a shadow root. jsdom cannot check these.
31
+ 5. **Report:** list each command that ran and its result; mark every unchecked item `[VERIFY]` with the reason.
32
+
33
+ ## Anti-patterns
34
+
35
+ - Hand-written `document` click listeners, ad-hoc `keydown` switches, manual focus restoration, or custom live-region markup instead of `focus` `createDismissal`, `createListNavigation`, `captureFocus`/`restoreFocus`, and `announce`.
@@ -0,0 +1,46 @@
1
+ # Refine (when `@vielzeug/refine` is installed)
2
+
3
+ Refine is the UI layer. Build interfaces from `ore-*` elements before anything else.
4
+
5
+ 1. **Bootstrap once**, before rendering any component:
6
+
7
+ ```ts
8
+ import '@vielzeug/refine/fouc.css'; // hide unupgraded elements until first paint
9
+ import '@vielzeug/refine/tokens.css'; // tokens, animations, cascade layers
10
+ ```
11
+
12
+ Optional: `@vielzeug/refine/styles/preflight.css` for a browser reset.
13
+
14
+ 2. **Register per component** through explicit side-effect subpaths (`import '@vielzeug/refine/button'`). The package root registers nothing by design: there is no whole-library import to fall back on.
15
+
16
+ 3. **Prefer Refine components when they fit.** For common interface controls and widgets such as buttons, inputs, selects, dialogs, menus, tables, and tabs, first check whether Refine has a component whose documented behavior fits the feature and the project's framework, accessibility, and runtime requirements. Read the candidate's contract with `refine-get-component`; fall back to `refine-list-components` only when no tag is known to fit. If no component fits or a project requirement makes it unsuitable, use the simplest appropriate native element or other package and briefly explain the choice; do not build a parallel composite when a suitable Refine component exists.
17
+
18
+ 4. **Use native elements for document semantics** (`<main>`, `<section>`, `<article>`, headings, paragraphs, plain links, and images), and when they are the better fit for a documented project or platform constraint.
19
+
20
+ 5. **Follow the element contract**: attributes for primitives, JavaScript properties for objects/arrays/callbacks, named slots for composition. Read event payloads from the documented `event.detail` or element state as appropriate; do not assume every event uses `event.target`. Icon-only controls need an accessible label.
21
+
22
+ 6. **Type the tags** once in a type entry point: `import type {} from '@vielzeug/refine/frameworks/elements'` (or `/react`, `/vue`). For new or changed framework wiring (React 18/19, Vue, Svelte, Angular, SSR guards), read the `frameworks` guide (`get-docs` with `slug: "refine"`, `page: "frameworks"`, or `https://vielzeug.dev/refine/frameworks`). Reuse verified existing wiring for ordinary component edits.
23
+
24
+ 7. **Check generated markup** with `refine-validate-usage` when available. It checks every `ore-*` opening tag in the fragment for unknown tags, unknown attributes, and values outside an attribute's documented set; it does not validate children, slot content, JavaScript properties, events, accessibility, or runtime behavior. Check those against the component docs and relevant tests instead.
25
+
26
+ 8. **Missing capability?** Compose existing `ore-*` elements when they fit. If none meets the documented feature and project requirements, read `references/behaviors.md` and compose the public behavior primitives there, and report the gap.
27
+
28
+ ## Other UI packages
29
+
30
+ Refine covers the widget layer; these provide specialized behavior it may not cover. Use the package that best fits the requirement, and prefer an `ore-*` element when it provides the needed behavior:
31
+
32
+ - `prism`: SVG charts (line, bar, area, scatter, pie, radar, heatmap, sparkline) plus `@vielzeug/prism/theme.css`.
33
+ - `scroll`: virtualized large lists (prefer `ore-datagrid`/`ore-list` for ordinary sizes).
34
+ - `dnd` / `gesture`: sortable lists, drop zones, pointer drag and pan.
35
+ - `necromancer`: Web Animations API primitives and FLIP.
36
+ - `orbit`: floating positioning; reach for `ore-popover`, `ore-tooltip`, `ore-menu` first.
37
+ - `focus` / `keymap`: dismissal, announcements, list navigation, focus restoration, keyboard shortcuts.
38
+ - `ore`: authoring your own custom elements that compose Refine.
39
+
40
+ ## Refine anti-patterns
41
+
42
+ - Custom modal, dropdown, tooltip, select, tabs, or toast implementations when a suitable Refine component meets the project requirements.
43
+ - Building a searchable or multi-select picker when `ore-combobox`/`ore-select` covers it.
44
+ - Native `<button>`, `<input>`, `<select>`, or `<table>` for interactive UI when a suitable Refine component meets the project requirements.
45
+ - Inventing an attribute, event, or slot that `refine-get-component` does not list.
46
+ - Forgetting `tokens.css`/`fouc.css`, or importing the whole library when subpaths suffice.
@@ -0,0 +1,12 @@
1
+ # Theme (when `@vielzeug/refine` is installed)
2
+
3
+ - All visuals come from tokens: spacing `var(--size-*)` on a 4‑point grid, type `var(--text-*)`, radius `var(--rounded-*)`, semantic colors `var(--color-primary|secondary|neutral|success|warning|error|info)`. No hard-coded hex/px in app CSS when a token exists (verify the exact name or prefix with a targeted theme CSS search).
4
+ - Rebrand with one variable: `:root { --color-primary-hue: 220deg; }`. Override `--color-primary` only when the hue alone is insufficient.
5
+ - Overrides go in an **unlayered** `:root` (or a scoping class) rule; Refine tokens live in `@layer refine.tokens`, so plain rules win. Never use `!important`.
6
+ - Dark mode is `document.documentElement.classList.toggle('dark')`; tokens use `light-dark()`. Do not write `prefers-color-scheme` media blocks for colors. `@vielzeug/refine/theme` ships `createThemeController()` for a persisted light/dark/system preference.
7
+ - Style components through their documented CSS custom properties and `::part()` hooks, not by piercing the shadow DOM.
8
+ - Other Vielzeug UI packages ship tokens-aligned themes; import them alongside Refine's (`@vielzeug/prism/theme.css` for charts).
9
+
10
+ ## Anti-patterns
11
+
12
+ - Inline colors, magic pixel values, `!important`, or `@media (prefers-color-scheme)` color rules.