@adia-ai/adia-ui-factory 0.2.3 → 0.8.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/.claude-plugin/plugin.json +5 -7
- package/.mcp.json +1 -1
- package/CHANGELOG.md +27 -63
- package/README.md +32 -53
- package/agents/app-architect.md +28 -0
- package/agents/routing-corpus.json +202 -0
- package/agents/screen-composer.md +27 -0
- package/bin/adia-lint +17 -2
- package/commands/adia-genui.md +5 -8
- package/commands/adia-migrate.md +5 -6
- package/commands/adia-orient.md +5 -10
- package/commands/adia-scaffold.md +7 -13
- package/commands/adia-verify.md +5 -6
- package/package.json +5 -6
- package/references/a2ui-mcp-tools.md +11 -8
- package/references/authoring-components.md +25 -1
- package/references/component-model.md +52 -4
- package/references/contracts/a2ui-mcp-surface.md +35 -0
- package/references/contracts/migration-guide-format.md +34 -0
- package/references/data-and-hydration.md +8 -5
- package/references/genui-a2ui.md +12 -6
- package/references/llm.md +22 -39
- package/references/migration.md +110 -36
- package/references/project-shapes.md +11 -13
- package/references/shell-admin.md +5 -2
- package/references/shell-chat.md +5 -3
- package/references/shell-editor.md +1 -1
- package/references/shell-embed.md +40 -26
- package/references/shell-simple.md +5 -2
- package/references/spa-architecture.md +28 -73
- package/references/ssr-integration.md +1 -1
- package/references/verification.md +8 -12
- package/skills/adia-compose/SKILL.md +52 -0
- package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/Guidelines.md +3 -3
- package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/components.md +3 -3
- package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/styles.md +1 -1
- package/skills/{adia-ui-kit → adia-compose}/assets/figma-make/guidelines/tokens.md +3 -3
- package/skills/{adia-ui-kit → adia-compose}/assets/templates/FEEDBACK.template.md +7 -7
- package/skills/{adia-ui-kit → adia-compose}/assets/templates/RESPONSE.template.md +6 -7
- package/skills/adia-compose/references/composition-traps.md +58 -0
- package/skills/adia-compose/references/feedback-discipline.md +20 -0
- package/skills/adia-compose/references/spec-to-ui-reasoning.md +158 -0
- package/skills/adia-data/SKILL.md +78 -0
- package/skills/adia-genui/SKILL.md +83 -0
- package/skills/adia-host/SKILL.md +119 -0
- package/skills/adia-llm/SKILL.md +36 -0
- package/skills/adia-migrate/SKILL.md +76 -0
- package/skills/adia-orient/SKILL.md +123 -0
- package/skills/adia-project/SKILL.md +83 -0
- package/skills/adia-shells/SKILL.md +74 -0
- package/skills/adia-verify/SKILL.md +43 -0
- package/skills/adia-verify/references/verification.md +42 -0
- package/commands/adia-compose.md +0 -10
- package/commands/adia-wire.md +0 -13
- package/skills/adia-ui-compose/SKILL.md +0 -57
- package/skills/adia-ui-data/SKILL.md +0 -62
- package/skills/adia-ui-factory/SKILL.md +0 -113
- package/skills/adia-ui-genui/SKILL.md +0 -74
- package/skills/adia-ui-kit/CHANGELOG.md +0 -41
- package/skills/adia-ui-kit/SKILL.md +0 -442
- package/skills/adia-ui-kit/assets/team-scaffold/archive-README.md +0 -30
- package/skills/adia-ui-kit/assets/team-scaffold/drafts-README.md +0 -57
- package/skills/adia-ui-kit/assets/team-scaffold/inbox-README.md +0 -76
- package/skills/adia-ui-kit/assets/team-scaffold/outbox-README.md +0 -46
- package/skills/adia-ui-kit/assets/team-scaffold/team-root.README.md +0 -51
- package/skills/adia-ui-kit/assets/team-scaffold/tickets-README.md +0 -208
- package/skills/adia-ui-kit/assets/team-scaffold/tickets-REGISTRY.md +0 -81
- package/skills/adia-ui-kit/assets/templates/AGENTS.template.md +0 -128
- package/skills/adia-ui-kit/assets/templates/CLAUDE.template.md +0 -1
- package/skills/adia-ui-kit/assets/templates/figma-make-guidelines.md +0 -90
- package/skills/adia-ui-kit/evals/adversarial-content-trust.json +0 -83
- package/skills/adia-ui-kit/evals/evals.json +0 -55
- package/skills/adia-ui-kit/evals/routing-corpus.json +0 -121
- package/skills/adia-ui-kit/evals/teach-routing-cases.json +0 -92
- package/skills/adia-ui-kit/references/capabilities.md +0 -245
- package/skills/adia-ui-kit/references/catalog-lookup.md +0 -186
- package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v1.md +0 -8
- package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v2.md +0 -3585
- package/skills/adia-ui-kit/references/changelog-archive/CHANGELOG-v3.md +0 -1899
- package/skills/adia-ui-kit/references/common-gotchas-consumer.md +0 -522
- package/skills/adia-ui-kit/references/component-literacy.md +0 -291
- package/skills/adia-ui-kit/references/composition.md +0 -245
- package/skills/adia-ui-kit/references/correction-loop.md +0 -462
- package/skills/adia-ui-kit/references/css-policy.md +0 -343
- package/skills/adia-ui-kit/references/decision-model.md +0 -158
- package/skills/adia-ui-kit/references/diagnostic-output.md +0 -57
- package/skills/adia-ui-kit/references/docs-catalog.md +0 -239
- package/skills/adia-ui-kit/references/exclusions.md +0 -225
- package/skills/adia-ui-kit/references/feedback-authoring.md +0 -466
- package/skills/adia-ui-kit/references/figma-make.md +0 -244
- package/skills/adia-ui-kit/references/flows-auth.md +0 -307
- package/skills/adia-ui-kit/references/flows-content.md +0 -206
- package/skills/adia-ui-kit/references/flows-data.md +0 -348
- package/skills/adia-ui-kit/references/flows-interaction.md +0 -181
- package/skills/adia-ui-kit/references/flows-shells.md +0 -336
- package/skills/adia-ui-kit/references/gap-detection.md +0 -266
- package/skills/adia-ui-kit/references/harness.md +0 -284
- package/skills/adia-ui-kit/references/loading-protocol.md +0 -406
- package/skills/adia-ui-kit/references/local-link.md +0 -198
- package/skills/adia-ui-kit/references/mcp.md +0 -401
- package/skills/adia-ui-kit/references/migration.md +0 -116
- package/skills/adia-ui-kit/references/mission.md +0 -194
- package/skills/adia-ui-kit/references/mode-routing.md +0 -298
- package/skills/adia-ui-kit/references/patterns-agent.md +0 -223
- package/skills/adia-ui-kit/references/patterns-data.md +0 -1066
- package/skills/adia-ui-kit/references/patterns-forms.md +0 -223
- package/skills/adia-ui-kit/references/patterns-layout.md +0 -326
- package/skills/adia-ui-kit/references/patterns-recipes.md +0 -1416
- package/skills/adia-ui-kit/references/patterns-shells.md +0 -1097
- package/skills/adia-ui-kit/references/patterns-traits.md +0 -259
- package/skills/adia-ui-kit/references/patterns-wiring.md +0 -339
- package/skills/adia-ui-kit/references/pev-rationale.md +0 -137
- package/skills/adia-ui-kit/references/reasoning-gate.md +0 -146
- package/skills/adia-ui-kit/references/reasoning-methodologies.md +0 -112
- package/skills/adia-ui-kit/references/recon.md +0 -192
- package/skills/adia-ui-kit/references/rendering-model.md +0 -431
- package/skills/adia-ui-kit/references/response-authoring.md +0 -398
- package/skills/adia-ui-kit/references/session-log-schema.md +0 -203
- package/skills/adia-ui-kit/references/session-log-template.md +0 -118
- package/skills/adia-ui-kit/references/setup.md +0 -652
- package/skills/adia-ui-kit/references/skill-hygiene.md +0 -135
- package/skills/adia-ui-kit/references/spec-to-ui-reasoning.md +0 -394
- package/skills/adia-ui-kit/references/state.md +0 -229
- package/skills/adia-ui-kit/references/teach-protocol.md +0 -421
- package/skills/adia-ui-kit/references/theme.md +0 -142
- package/skills/adia-ui-kit/references/version-check.md +0 -69
- package/skills/adia-ui-kit/scripts/audit-decision-trace.mjs +0 -198
- package/skills/adia-ui-kit/scripts/audit-kit-roster.mjs +0 -366
- package/skills/adia-ui-kit/scripts/changelog-archive.mjs +0 -126
- package/skills/adia-ui-kit/scripts/check-adia-versions.py +0 -404
- package/skills/adia-ui-kit/scripts/run-skill-evals.mjs +0 -358
- package/skills/adia-ui-kit/scripts/validate-session-log.mjs +0 -242
- package/skills/adia-ui-kit/skill.json +0 -102
- package/skills/adia-ui-llm/SKILL.md +0 -51
- package/skills/adia-ui-migrate/SKILL.md +0 -64
- package/skills/adia-ui-migration/CHANGELOG.md +0 -47
- package/skills/adia-ui-migration/SKILL.md +0 -381
- package/skills/adia-ui-migration/skill.json +0 -29
- package/skills/adia-ui-project/SKILL.md +0 -77
- package/skills/adia-ui-shells/SKILL.md +0 -62
- package/skills/adia-ui-spa/SKILL.md +0 -52
- package/skills/adia-ui-ssr/SKILL.md +0 -52
- package/skills/adia-ui-verify/SKILL.md +0 -44
- /package/skills/{adia-ui-kit → adia-compose}/assets/templates/FEEDBACK-OMISSIONS-DEFENSE.template.md +0 -0
|
@@ -1,431 +0,0 @@
|
|
|
1
|
-
# §Rendering Model — SPA, SSR, or static?
|
|
2
|
-
|
|
3
|
-
> **Loading note.** Reference bundle extracted from `SKILL.md` per the
|
|
4
|
-
> §LoadingProtocol inversion contract (v2.20.1+). Load via
|
|
5
|
-
> `skill_view(name='adia-ui-kit', file_path='references/rendering-model.md')`
|
|
6
|
-
> when you need to wire AdiaUI into a framework with a specific rendering
|
|
7
|
-
> model — Next.js / Nuxt / SvelteKit / Astro / plain SPA / static. Skip
|
|
8
|
-
> if you're in a vanilla Vite SPA (the §Setup defaults cover that case).
|
|
9
|
-
|
|
10
|
-
Determine this **before writing any markup or imports.** The rendering
|
|
11
|
-
model changes which patterns from §Flows are safe to use directly and
|
|
12
|
-
which need adaptation.
|
|
13
|
-
|
|
14
|
-
### Decision tree
|
|
15
|
-
|
|
16
|
-
```
|
|
17
|
-
Does your project run a server that renders HTML per-request?
|
|
18
|
-
YES → SSR (Next.js, Nuxt, SvelteKit, Remix, Astro SSR)
|
|
19
|
-
→ See "SSR" column below
|
|
20
|
-
NO →
|
|
21
|
-
Does it build to static HTML files at deploy time?
|
|
22
|
-
YES → Static site (Astro SSG, plain HTML, Vite static build)
|
|
23
|
-
→ Same as SPA; no adaptation needed
|
|
24
|
-
NO →
|
|
25
|
-
SPA (Vite + vanilla, React SPA, Vue SPA, Create React App)
|
|
26
|
-
→ See "SPA" column below
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### Compatibility matrix
|
|
30
|
-
|
|
31
|
-
| Feature | SPA / Static | SSR (Next/Nuxt/SvelteKit) |
|
|
32
|
-
|---|---|---|
|
|
33
|
-
| `import '@adia-ai/web-components'` | ✓ top-level | ✗ server throws `HTMLElement is not defined` — use dynamic import or client directive |
|
|
34
|
-
| CSS imports | ✓ top-level | ✓ top-level (CSS has no browser APIs) |
|
|
35
|
-
| `data-stream-*` attributes | ✓ | ✓ (guarded with `typeof document !== 'undefined'` internally) |
|
|
36
|
-
| `<script type="module">` for router/table/chart wiring | ✓ | ✗ DOM not available at server render — wrap in `onMounted` / `useEffect` / `client:only` |
|
|
37
|
-
| Form participation (`ElementInternals`) | ✓ | Works after hydration; server HTML has no form state |
|
|
38
|
-
| `customElements.whenDefined()` | ✓ | Only safe inside client-side lifecycle hooks |
|
|
39
|
-
| **Routing — `<router-ui>`** | ✓ canonical SPA pattern | ✗ **DO NOT USE** — server framework owns routing. See **Routing ownership** below. |
|
|
40
|
-
|
|
41
|
-
### Routing ownership — when to use `<router-ui>` vs the server framework
|
|
42
|
-
|
|
43
|
-
`<router-ui>` is a client-side SPA router. It listens for `popstate`,
|
|
44
|
-
intercepts `<a>` clicks, calls `history.pushState`, and renders the
|
|
45
|
-
matched route's content fragment into its own subtree. It is the
|
|
46
|
-
**canonical AdiaUI routing primitive for SPA + static contexts** and
|
|
47
|
-
the default `<router-ui></router-ui>` slot in the admin-shell anatomy
|
|
48
|
-
assumes you'll wire routes to it.
|
|
49
|
-
|
|
50
|
-
**In SSR contexts this is wrong.** The server framework already owns
|
|
51
|
-
routing: it parses the URL, runs route handlers, renders the page on
|
|
52
|
-
the server, and ships HTML. Page navigations are full HTTP requests
|
|
53
|
-
(or framework-managed pushState via `<Link>` / `<NuxtLink>` / etc.).
|
|
54
|
-
Using `<router-ui>` alongside the server's router creates two
|
|
55
|
-
competing route owners — clicks get intercepted twice, the URL
|
|
56
|
-
desynchronizes from the rendered content, and SSR's "URL is the
|
|
57
|
-
source of truth for the server-rendered HTML" contract breaks.
|
|
58
|
-
|
|
59
|
-
**Rule:** there is exactly ONE route owner per app. Pick the right one
|
|
60
|
-
for your rendering model and don't introduce the other.
|
|
61
|
-
|
|
62
|
-
| Rendering model | Route owner | What replaces `<router-ui>` |
|
|
63
|
-
|---|---|---|
|
|
64
|
-
| SPA (Vite + vanilla, React SPA, Vue SPA, CRA, Solid, …) | `<router-ui>` | — (this IS the canonical primitive) |
|
|
65
|
-
| Static (Astro SSG, plain HTML, Vite static build, GH Pages) | `<router-ui>` OR none (multi-page static) | If multi-page, just use `<a href="…">` — the browser fetches the next page. `<router-ui>` only needed if you want SPA-style fragment swapping over a static build. |
|
|
66
|
-
| **Next.js App Router** | Next.js | `<Link>` from `next/link` + `app/[…]/page.tsx` filesystem routes. `usePathname()` / `useSearchParams()` for read access. |
|
|
67
|
-
| **Next.js Pages Router** | Next.js | `<Link>` from `next/link` + `pages/[…].tsx` filesystem routes. `useRouter()` for read+write access. |
|
|
68
|
-
| **Nuxt 3** | Nuxt / Vue Router | `<NuxtLink>` + `pages/[…].vue` filesystem routes. `useRoute()` / `useRouter()`. |
|
|
69
|
-
| **SvelteKit** | SvelteKit | `<a href="…">` (intercepted by the SvelteKit client) + `src/routes/[…]/+page.svelte` filesystem routes. `$page` store. |
|
|
70
|
-
| **Remix / React Router** | Remix / React Router | `<Link>` + `app/routes/[…].tsx` filesystem routes. `useNavigate()` / `useLocation()`. |
|
|
71
|
-
| **Astro (SSR mode)** | Astro | `<a href="…">` (full reload) OR opt-in `<ViewTransitions />` for SPA-style swaps. `Astro.url` / `Astro.params` server-side. |
|
|
72
|
-
| **Rails + Turbo** | Rails | `link_to` + `config/routes.rb`. Turbo Drive intercepts and swaps the body. Don't add `<router-ui>` — Turbo is already doing it. |
|
|
73
|
-
| **Django + HTMX** | Django | `{% url %}` + `urls.py`. HTMX `hx-get` for partial swaps. `<router-ui>` would fight HTMX. |
|
|
74
|
-
| **Phoenix LiveView** | Phoenix | `<.link>` + `live "/path"` routes. LiveView owns navigation + DOM patching end-to-end. |
|
|
75
|
-
|
|
76
|
-
**Concrete substitution — the admin-shell example in §Patterns.** The
|
|
77
|
-
canonical SPA flow is:
|
|
78
|
-
|
|
79
|
-
```html
|
|
80
|
-
<admin-shell>
|
|
81
|
-
<admin-sidebar slot="leading">…</admin-sidebar>
|
|
82
|
-
<admin-content>
|
|
83
|
-
<admin-topbar slot="header">…</admin-topbar>
|
|
84
|
-
<admin-scroll>
|
|
85
|
-
<!-- SPA route owner: your framework's route outlet element goes here
|
|
86
|
-
(vue-router-view, react Outlet, lit-router-outlet, slot, etc.) -->
|
|
87
|
-
</admin-scroll>
|
|
88
|
-
</admin-content>
|
|
89
|
-
</admin-shell>
|
|
90
|
-
<script type="module">
|
|
91
|
-
// Wire your router of choice — example below uses a generic router instance:
|
|
92
|
-
router.outlet = document.querySelector('admin-shell admin-scroll');
|
|
93
|
-
router.routes = [/* … */];
|
|
94
|
-
</script>
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
In **Next.js App Router**, the same anatomy becomes:
|
|
98
|
-
|
|
99
|
-
```tsx
|
|
100
|
-
// app/layout.tsx — the shell renders once, persists across navigations
|
|
101
|
-
'use client';
|
|
102
|
-
export default function Layout({ children }) {
|
|
103
|
-
return (
|
|
104
|
-
<admin-shell>
|
|
105
|
-
<admin-sidebar slot="leading">…</admin-sidebar>
|
|
106
|
-
<admin-content>
|
|
107
|
-
<admin-topbar slot="header">…</admin-topbar>
|
|
108
|
-
<admin-scroll>
|
|
109
|
-
{children} {/* ← Next's route content fills this slot */}
|
|
110
|
-
</admin-scroll>
|
|
111
|
-
</admin-content>
|
|
112
|
-
</admin-shell>
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
// app/claims/page.tsx → renders into {children}
|
|
116
|
-
// app/claims/[id]/page.tsx → renders into {children}
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
No `<router-ui>`. No `<script>` for route registration. Next's
|
|
120
|
-
filesystem routing IS the routing.
|
|
121
|
-
|
|
122
|
-
**In SvelteKit** the parallel is `src/routes/+layout.svelte` holding
|
|
123
|
-
the admin-shell + `<slot />` where `<router-ui>` would have been.
|
|
124
|
-
|
|
125
|
-
**In Astro** (without `<ViewTransitions />`), every navigation is a
|
|
126
|
-
full reload — the shell re-renders per page, so just write each
|
|
127
|
-
page's HTML and put the shell in a shared layout component. With
|
|
128
|
-
`<ViewTransitions />` enabled, Astro does SPA-style swaps but it's
|
|
129
|
-
still Astro that owns routing, not `<router-ui>`.
|
|
130
|
-
|
|
131
|
-
**Cross-cutting state in SSR (since the shell re-mounts per page):**
|
|
132
|
-
keep the sidebar collapsed/open state, the active nav highlight, and
|
|
133
|
-
any optimistic UI in `cookies` / `localStorage` / a server session —
|
|
134
|
-
not in client-only signals scoped to a `<router-ui>` lifetime. The
|
|
135
|
-
admin-shell + admin-sidebar primitives read these stores happily; see
|
|
136
|
-
the framework's docs (`cookies()` in Next, `useCookie()` in Nuxt,
|
|
137
|
-
`event.cookies` in SvelteKit) for the canonical write path.
|
|
138
|
-
|
|
139
|
-
**How to discover which mode you're in (cold-start checklist):**
|
|
140
|
-
|
|
141
|
-
1. Look at the project root. `next.config.{js,mjs,ts}` → Next.js.
|
|
142
|
-
`nuxt.config.ts` → Nuxt. `svelte.config.js` → SvelteKit.
|
|
143
|
-
`astro.config.mjs` → Astro. `app.config.ts` or `app.vue` → Vue/Nuxt.
|
|
144
|
-
`config/routes.rb` → Rails. `manage.py` → Django. `mix.exs` +
|
|
145
|
-
`lib/*_web/router.ex` → Phoenix.
|
|
146
|
-
2. If NONE of those exist and the entry point is a single `index.html`
|
|
147
|
-
with `<script type="module" src="./main.{js,ts}">` → SPA. Use
|
|
148
|
-
`<router-ui>`.
|
|
149
|
-
3. If `vite build` produces multiple `.html` files (Vite multi-page
|
|
150
|
-
mode) → static; `<router-ui>` is optional.
|
|
151
|
-
4. **When in doubt, grep the project root:** `grep -rE
|
|
152
|
-
"(next|nuxt|sveltekit|astro|remix)" package.json` reveals the
|
|
153
|
-
framework. If the project has its own router primitive, USE IT.
|
|
154
|
-
|
|
155
|
-
**Don't get caught in the middle.** Re-confirm the routing model
|
|
156
|
-
BEFORE you wire any navigation — anchors, breadcrumbs, sidebar nav
|
|
157
|
-
items, active-state highlighting all hook into the route owner. If
|
|
158
|
-
you start the session assuming SPA + `<router-ui>` and the project
|
|
159
|
-
turns out to be Next App Router, every nav primitive needs rework.
|
|
160
|
-
The cost of a 30-second `ls + grep` at the start is much smaller than
|
|
161
|
-
the cost of mid-flight refactoring.
|
|
162
|
-
|
|
163
|
-
### SPA / static (Vite, plain HTML)
|
|
164
|
-
|
|
165
|
-
All patterns in §Flows work as written. Use them verbatim.
|
|
166
|
-
|
|
167
|
-
```js
|
|
168
|
-
// main.js — top-level, runs once at page load
|
|
169
|
-
import '@adia-ai/web-components/css';
|
|
170
|
-
import '@adia-ai/web-components';
|
|
171
|
-
import '@adia-ai/web-modules/shell'; // per-cluster — the full '@adia-ai/web-modules' barrel ships broken absolute paths at v0.6.7
|
|
172
|
-
import '@adia-ai/web-modules/shell/admin-shell.css'; // REQUIRED — see §CSSPolicy
|
|
173
|
-
import { installIconLoadersForRegistered } from '@adia-ai/web-components/core/icons';
|
|
174
|
-
installIconLoadersForRegistered(import.meta.glob(
|
|
175
|
-
'../node_modules/@phosphor-icons/core/assets/regular/*.svg',
|
|
176
|
-
{ query: '?raw', import: 'default', eager: true }
|
|
177
|
-
));
|
|
178
|
-
```
|
|
179
|
-
|
|
180
|
-
### SSR — Next.js (App Router)
|
|
181
|
-
|
|
182
|
-
```tsx
|
|
183
|
-
// components/AdiaProvider.tsx ← client boundary
|
|
184
|
-
'use client';
|
|
185
|
-
|
|
186
|
-
import { useEffect } from 'react';
|
|
187
|
-
|
|
188
|
-
export function AdiaProvider({ children }: { children: React.ReactNode }) {
|
|
189
|
-
useEffect(() => {
|
|
190
|
-
// Dynamic import: runs only in browser, never on server
|
|
191
|
-
import('@adia-ai/web-components').then(() =>
|
|
192
|
-
import('@adia-ai/web-modules/shell') // per-cluster, NOT the full barrel
|
|
193
|
-
).then(async () => {
|
|
194
|
-
// CSS — REQUIRED (see §CSSPolicy)
|
|
195
|
-
await import('@adia-ai/web-components/css');
|
|
196
|
-
await import('@adia-ai/web-modules/shell/admin-shell.css');
|
|
197
|
-
const { installIconLoadersForRegistered } =
|
|
198
|
-
await import('@adia-ai/web-components/core/icons');
|
|
199
|
-
const modules = await import(
|
|
200
|
-
/* @vite-ignore */ '../node_modules/@phosphor-icons/core/assets/regular/*.svg'
|
|
201
|
-
);
|
|
202
|
-
installIconLoadersForRegistered(modules);
|
|
203
|
-
});
|
|
204
|
-
}, []);
|
|
205
|
-
|
|
206
|
-
return <>{children}</>;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Wrap your layout or root component:
|
|
210
|
-
// app/layout.tsx
|
|
211
|
-
// <AdiaProvider><body>{children}</body></AdiaProvider>
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
All `<script type="module">` wiring blocks from §Flows (router routes,
|
|
215
|
-
table.columns, chart.data) must move inside `useEffect`:
|
|
216
|
-
|
|
217
|
-
```tsx
|
|
218
|
-
'use client';
|
|
219
|
-
import { useEffect, useRef } from 'react';
|
|
220
|
-
|
|
221
|
-
export function UsersTable({ data }) {
|
|
222
|
-
const tableRef = useRef(null);
|
|
223
|
-
const toolbarRef = useRef(null);
|
|
224
|
-
|
|
225
|
-
useEffect(() => {
|
|
226
|
-
if (!tableRef.current || !toolbarRef.current) return;
|
|
227
|
-
toolbarRef.current.table = tableRef.current;
|
|
228
|
-
tableRef.current.columns = [
|
|
229
|
-
{ key: 'name', label: 'Name', type: 'avatar' },
|
|
230
|
-
{ key: 'status', label: 'Status', type: 'badge',
|
|
231
|
-
meta: { variants: { Active: 'success', Inactive: 'danger' } } },
|
|
232
|
-
];
|
|
233
|
-
tableRef.current.data = data;
|
|
234
|
-
}, [data]);
|
|
235
|
-
|
|
236
|
-
return (
|
|
237
|
-
<card-ui>
|
|
238
|
-
<header><span slot="heading">Users</span></header>
|
|
239
|
-
<section style={{ padding: 0 }}>
|
|
240
|
-
<table-toolbar-ui ref={toolbarRef} />
|
|
241
|
-
<table-ui ref={tableRef} sortable striped />
|
|
242
|
-
</section>
|
|
243
|
-
</card-ui>
|
|
244
|
-
);
|
|
245
|
-
}
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
> **TypeScript: custom elements in JSX.** Add a declaration to stop
|
|
249
|
-
> "intrinsic element" errors:
|
|
250
|
-
> ```ts
|
|
251
|
-
> // types/adia-ui.d.ts
|
|
252
|
-
> declare namespace JSX {
|
|
253
|
-
> interface IntrinsicElements {
|
|
254
|
-
> [tag: string]: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>;
|
|
255
|
-
> }
|
|
256
|
-
> }
|
|
257
|
-
> ```
|
|
258
|
-
|
|
259
|
-
### SSR — Nuxt 3 / Vue
|
|
260
|
-
|
|
261
|
-
```vue
|
|
262
|
-
<!-- components/AdiaKit.client.vue ← .client.vue = Nuxt client-only -->
|
|
263
|
-
<script setup>
|
|
264
|
-
import { onMounted } from 'vue';
|
|
265
|
-
|
|
266
|
-
onMounted(async () => {
|
|
267
|
-
await import('@adia-ai/web-components');
|
|
268
|
-
await import('@adia-ai/web-modules/shell'); // per-cluster, NOT the full barrel
|
|
269
|
-
// CSS — REQUIRED (see §CSSPolicy)
|
|
270
|
-
await import('@adia-ai/web-components/css');
|
|
271
|
-
await import('@adia-ai/web-modules/shell/admin-shell.css');
|
|
272
|
-
const { installIconLoadersForRegistered } =
|
|
273
|
-
await import('@adia-ai/web-components/core/icons');
|
|
274
|
-
const modules = import.meta.glob(
|
|
275
|
-
'../node_modules/@phosphor-icons/core/assets/regular/*.svg',
|
|
276
|
-
{ query: '?raw', import: 'default', eager: true }
|
|
277
|
-
);
|
|
278
|
-
installIconLoadersForRegistered(modules);
|
|
279
|
-
});
|
|
280
|
-
</script>
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
Table / chart wiring inside `onMounted`:
|
|
284
|
-
|
|
285
|
-
```vue
|
|
286
|
-
<script setup>
|
|
287
|
-
import { ref, onMounted } from 'vue';
|
|
288
|
-
const tableRef = ref(null);
|
|
289
|
-
const toolbarRef = ref(null);
|
|
290
|
-
|
|
291
|
-
onMounted(() => {
|
|
292
|
-
toolbarRef.value.table = tableRef.value;
|
|
293
|
-
tableRef.value.columns = [ /* ... */ ];
|
|
294
|
-
tableRef.value.data = [ /* ... */ ];
|
|
295
|
-
});
|
|
296
|
-
</script>
|
|
297
|
-
|
|
298
|
-
<template>
|
|
299
|
-
<card-ui>
|
|
300
|
-
<header><span slot="heading">Users</span></header>
|
|
301
|
-
<section style="padding: 0">
|
|
302
|
-
<table-toolbar-ui ref="toolbarRef" />
|
|
303
|
-
<table-ui ref="tableRef" sortable striped />
|
|
304
|
-
</section>
|
|
305
|
-
</card-ui>
|
|
306
|
-
</template>
|
|
307
|
-
```
|
|
308
|
-
|
|
309
|
-
### SSR — SvelteKit
|
|
310
|
-
|
|
311
|
-
```svelte
|
|
312
|
-
<!-- src/lib/AdiaKit.svelte -->
|
|
313
|
-
<script>
|
|
314
|
-
import { onMount } from 'svelte';
|
|
315
|
-
|
|
316
|
-
onMount(async () => {
|
|
317
|
-
await import('@adia-ai/web-components');
|
|
318
|
-
await import('@adia-ai/web-modules/shell'); // per-cluster, NOT the full barrel
|
|
319
|
-
// CSS — REQUIRED (see §CSSPolicy)
|
|
320
|
-
await import('@adia-ai/web-components/css');
|
|
321
|
-
await import('@adia-ai/web-modules/shell/admin-shell.css');
|
|
322
|
-
const { installIconLoadersForRegistered } =
|
|
323
|
-
await import('@adia-ai/web-components/core/icons');
|
|
324
|
-
const modules = import.meta.glob(
|
|
325
|
-
'../node_modules/@phosphor-icons/core/assets/regular/*.svg',
|
|
326
|
-
{ query: '?raw', import: 'default', eager: true }
|
|
327
|
-
);
|
|
328
|
-
installIconLoadersForRegistered(modules);
|
|
329
|
-
});
|
|
330
|
-
</script>
|
|
331
|
-
```
|
|
332
|
-
|
|
333
|
-
Table wiring:
|
|
334
|
-
|
|
335
|
-
```svelte
|
|
336
|
-
<script>
|
|
337
|
-
import { onMount } from 'svelte';
|
|
338
|
-
let tableEl, toolbarEl;
|
|
339
|
-
|
|
340
|
-
onMount(() => {
|
|
341
|
-
toolbarEl.table = tableEl;
|
|
342
|
-
tableEl.columns = [ /* ... */ ];
|
|
343
|
-
tableEl.data = [ /* ... */ ];
|
|
344
|
-
});
|
|
345
|
-
</script>
|
|
346
|
-
|
|
347
|
-
<table-toolbar-ui bind:this={toolbarEl}></table-toolbar-ui>
|
|
348
|
-
<table-ui bind:this={tableEl} sortable striped></table-ui>
|
|
349
|
-
```
|
|
350
|
-
|
|
351
|
-
### SSR — Astro
|
|
352
|
-
|
|
353
|
-
Astro static (SSG): use `client:load` on any island containing AdiaUI.
|
|
354
|
-
Import CSS from the `<script>` block (Astro's Vite handles `.css`
|
|
355
|
-
imports the same as Next/Nuxt/Svelte). **Do not** use
|
|
356
|
-
`<link rel="stylesheet" href="/node_modules/...">` — that path is
|
|
357
|
-
fragile (works in dev via the proxy, breaks in build because Vite
|
|
358
|
-
hashes asset paths) and bypasses the package's `exports` map.
|
|
359
|
-
|
|
360
|
-
```astro
|
|
361
|
-
---
|
|
362
|
-
// pages/dashboard.astro — static, safe
|
|
363
|
-
---
|
|
364
|
-
<html>
|
|
365
|
-
<head>
|
|
366
|
-
<title>Dashboard</title>
|
|
367
|
-
</head>
|
|
368
|
-
<body>
|
|
369
|
-
<!-- Static AdiaUI markup is fine: custom elements self-init in browser -->
|
|
370
|
-
<card-ui>
|
|
371
|
-
<header><span slot="heading">Hello</span></header>
|
|
372
|
-
<section><button-ui text="Click me" variant="primary"></button-ui></section>
|
|
373
|
-
</card-ui>
|
|
374
|
-
|
|
375
|
-
<!-- JS wiring (table.columns, chart.data) needs a client island -->
|
|
376
|
-
<UsersTable client:load />
|
|
377
|
-
|
|
378
|
-
<script>
|
|
379
|
-
// CSS — REQUIRED (see §CSSPolicy); use the package exports, never
|
|
380
|
-
// a /node_modules/ root-absolute href.
|
|
381
|
-
import '@adia-ai/web-components/css';
|
|
382
|
-
// Add per-shell CSS if you mount one of the shells:
|
|
383
|
-
// import '@adia-ai/web-modules/shell/admin-shell.css';
|
|
384
|
-
|
|
385
|
-
import '@adia-ai/web-components';
|
|
386
|
-
// Per-cluster shell registration (NOT the full barrel):
|
|
387
|
-
// import '@adia-ai/web-modules/shell';
|
|
388
|
-
|
|
389
|
-
import { installIconLoadersForRegistered } from '@adia-ai/web-components/core/icons';
|
|
390
|
-
const m = import.meta.glob('../node_modules/@phosphor-icons/core/assets/regular/*.svg',
|
|
391
|
-
{ query: '?raw', import: 'default', eager: true });
|
|
392
|
-
installIconLoadersForRegistered(m);
|
|
393
|
-
</script>
|
|
394
|
-
</body>
|
|
395
|
-
</html>
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
### Framework property binding patterns
|
|
399
|
-
|
|
400
|
-
When you're not using AdiaUI's own `html` template engine, properties
|
|
401
|
-
must be set imperatively — attribute strings alone are not reactive.
|
|
402
|
-
|
|
403
|
-
```jsx
|
|
404
|
-
// React — useEffect + ref
|
|
405
|
-
const ref = useRef(null);
|
|
406
|
-
useEffect(() => { if (ref.current) ref.current.value = myValue; }, [myValue]);
|
|
407
|
-
return <slider-ui ref={ref} onChange={e => setMyValue(e.detail.value)} />;
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
```html
|
|
411
|
-
<!-- Vue — colon binding sets JS property, not HTML attribute -->
|
|
412
|
-
<input-ui :value="myValue" @change="myValue = $event.detail.value"></input-ui>
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
```svelte
|
|
416
|
-
<!-- Svelte — bind:value for two-way, or on:change for one-way -->
|
|
417
|
-
<input-ui bind:value={myValue}></input-ui>
|
|
418
|
-
```
|
|
419
|
-
|
|
420
|
-
### The §Flows patterns — which need adaptation?
|
|
421
|
-
|
|
422
|
-
| §Flow pattern | SPA | SSR |
|
|
423
|
-
|---|---|---|
|
|
424
|
-
| Auth card markup | ✓ verbatim | ✓ verbatim (static markup) |
|
|
425
|
-
| Registration / onboarding shell | ✓ verbatim | ✓ verbatim (form submits to server route) |
|
|
426
|
-
| Admin / editor shell markup | ✓ verbatim | ✓ verbatim (static structure) |
|
|
427
|
-
| `<script>` router wiring | ✓ verbatim | ✗ → `useEffect` / `onMounted` / `onMount` |
|
|
428
|
-
| Table `.columns` + `.data` wiring | ✓ verbatim | ✗ → client lifecycle hook |
|
|
429
|
-
| Chart `.data` wiring | ✓ verbatim | ✗ → client lifecycle hook |
|
|
430
|
-
| `data-stream-*` attributes | ✓ verbatim | ✓ verbatim (guarded internally) |
|
|
431
|
-
| Icon loader `import '@adia-ai/web-components'` | ✓ top-level | ✗ → dynamic import in lifecycle hook |
|