praxis-kit 3.1.1 → 4.0.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/README.md +141 -126
- package/dist/chunk-TJRHF6MS.js +2777 -0
- package/dist/codemod/index.js +20 -20
- package/dist/contract/index.d.ts +2 -258
- package/dist/contract/index.js +158 -1190
- package/dist/eslint/index.js +403 -178
- package/dist/lit/index.d.ts +5 -235
- package/dist/lit/index.js +1384 -747
- package/dist/merge-refs-DUuHyTRO.d.ts +144 -0
- package/dist/preact/index.d.ts +9 -254
- package/dist/preact/index.js +1686 -1025
- package/dist/react/index.d.ts +23 -11
- package/dist/react/index.js +115 -116
- package/dist/react/legacy.d.ts +7 -11
- package/dist/react/legacy.js +116 -136
- package/dist/solid/index.d.ts +5 -250
- package/dist/solid/index.js +1476 -706
- package/dist/svelte/index.d.ts +5 -325
- package/dist/svelte/index.js +1407 -725
- package/dist/tailwind/index.d.ts +5 -4
- package/dist/tailwind/index.js +366 -90
- package/dist/ts-plugin/index.cjs +5 -5
- package/dist/vite-plugin/index.d.ts +91 -120
- package/dist/vite-plugin/index.js +568 -347
- package/dist/vue/index.d.ts +12 -257
- package/dist/vue/index.js +1701 -926
- package/dist/web/index.d.ts +9 -238
- package/dist/web/index.js +1369 -732
- package/package.json +4 -3
- package/dist/chunk-6RJN5B6L.js +0 -2221
- package/dist/merge-refs-BKyE8h8M.d.ts +0 -381
package/README.md
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
# Praxis Kit
|
|
2
2
|
|
|
3
|
-
**Build components that enforce
|
|
3
|
+
> **Build components that enforce the rules of the web.**
|
|
4
4
|
|
|
5
|
-
Praxis Kit is a
|
|
6
|
-
composition
|
|
7
|
-
|
|
5
|
+
Praxis Kit is a **contract-based UI framework** that enforces HTML semantics, ARIA requirements, and
|
|
6
|
+
component composition through executable contracts.
|
|
7
|
+
|
|
8
|
+
Instead of relying on documentation, conventions, or code review, Praxis Kit allows components to
|
|
9
|
+
define the rules that govern how they may be composed, rendered, and used. Invalid component
|
|
10
|
+
hierarchies become runtime validation errors instead of latent bugs.
|
|
11
|
+
|
|
12
|
+
Framework adapters allow these same contracts to be shared across React, Vue, Solid, Svelte, Lit,
|
|
13
|
+
Web Components, and other rendering environments.
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## Why Praxis?
|
|
18
|
+
|
|
19
|
+
Modern component libraries solve three important problems:
|
|
20
|
+
|
|
21
|
+
- styling
|
|
22
|
+
- state management
|
|
23
|
+
- rendering
|
|
24
|
+
|
|
25
|
+
Praxis solves a fourth:
|
|
26
|
+
|
|
27
|
+
> **correctness.**
|
|
28
|
+
|
|
29
|
+
A component should know:
|
|
30
|
+
|
|
31
|
+
- where it is allowed to appear
|
|
32
|
+
- which children it requires
|
|
33
|
+
- which parents it belongs to
|
|
34
|
+
- which HTML elements it may render as
|
|
35
|
+
- which ARIA relationships must exist
|
|
36
|
+
- which accessibility requirements must be satisfied
|
|
37
|
+
|
|
38
|
+
These rules become executable contracts rather than documentation.
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Example
|
|
8
43
|
|
|
9
44
|
```tsx
|
|
10
45
|
<Tabs>
|
|
@@ -13,184 +48,164 @@ structures to render and fail later, Praxis catches them immediately.
|
|
|
13
48
|
```
|
|
14
49
|
|
|
15
50
|
```text
|
|
16
|
-
✖ TabsList required
|
|
17
|
-
✖ TabsPanel required
|
|
51
|
+
✖ TabsList is required.
|
|
52
|
+
✖ TabsPanel is required.
|
|
18
53
|
```
|
|
19
54
|
|
|
55
|
+
Or:
|
|
56
|
+
|
|
20
57
|
```tsx
|
|
21
|
-
<
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
</TabsList>
|
|
25
|
-
<TabsPanel>Content</TabsPanel>
|
|
26
|
-
</Tabs>
|
|
58
|
+
<Menu>
|
|
59
|
+
<Button />
|
|
60
|
+
</Menu>
|
|
27
61
|
```
|
|
28
62
|
|
|
29
63
|
```text
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
---
|
|
34
|
-
|
|
35
|
-
## Installation
|
|
36
|
-
|
|
37
|
-
All adapters and tooling are bundled in the single `praxis-kit` package:
|
|
38
|
-
|
|
39
|
-
```bash
|
|
40
|
-
npm install praxis-kit
|
|
64
|
+
✖ Button cannot be a direct child of Menu.
|
|
41
65
|
```
|
|
42
66
|
|
|
43
|
-
|
|
67
|
+
Or:
|
|
44
68
|
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
import { createContractComponent } from 'praxis-kit/solid'
|
|
50
|
-
import { createContractComponent } from 'praxis-kit/preact'
|
|
69
|
+
```tsx
|
|
70
|
+
<Dialog>
|
|
71
|
+
<DialogContent />
|
|
72
|
+
</Dialog>
|
|
51
73
|
```
|
|
52
74
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
import plugin from 'praxis-kit/eslint' // ESLint rules
|
|
57
|
-
import plugin from 'praxis-kit/vite-plugin' // Vite static analysis
|
|
58
|
-
import plugin from 'praxis-kit/tailwind' // Tailwind class pipeline
|
|
75
|
+
```text
|
|
76
|
+
✖ DialogTitle is required.
|
|
77
|
+
✖ Accessible name is missing.
|
|
59
78
|
```
|
|
60
79
|
|
|
61
|
-
|
|
62
|
-
> paths and the factory rename automatically.
|
|
80
|
+
Praxis validates these structures automatically during development.
|
|
63
81
|
|
|
64
82
|
---
|
|
65
83
|
|
|
66
|
-
##
|
|
84
|
+
## Contracts
|
|
85
|
+
|
|
86
|
+
A contract describes the semantic rules of a component.
|
|
67
87
|
|
|
68
|
-
|
|
69
|
-
additionally validates:
|
|
88
|
+
Contracts may define:
|
|
70
89
|
|
|
71
|
-
- required children
|
|
72
|
-
-
|
|
90
|
+
- required children
|
|
91
|
+
- forbidden children
|
|
92
|
+
- required parents
|
|
93
|
+
- permitted descendants
|
|
94
|
+
- HTML content model restrictions
|
|
95
|
+
- polymorphic rendering capabilities
|
|
96
|
+
- ARIA relationships
|
|
73
97
|
- accessibility policies
|
|
74
|
-
-
|
|
98
|
+
- lifecycle constraints
|
|
99
|
+
- custom validation rules
|
|
75
100
|
|
|
76
|
-
|
|
101
|
+
Every component becomes self-describing.
|
|
77
102
|
|
|
78
103
|
---
|
|
79
104
|
|
|
80
|
-
##
|
|
105
|
+
## HTML and ARIA as Executable Rules
|
|
81
106
|
|
|
82
|
-
|
|
107
|
+
HTML and ARIA specifications contain thousands of rules that are usually expressed as prose.
|
|
83
108
|
|
|
84
|
-
|
|
85
|
-
<Dialog>
|
|
86
|
-
<DialogContent />
|
|
87
|
-
</Dialog>
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
```text
|
|
91
|
-
✖ DialogTrigger missing
|
|
92
|
-
```
|
|
109
|
+
Praxis transforms those rules into executable contracts.
|
|
93
110
|
|
|
94
|
-
|
|
111
|
+
Instead of asking developers to remember the HTML specification or ARIA Authoring Practices Guide,
|
|
112
|
+
Praxis validates those requirements directly.
|
|
95
113
|
|
|
96
|
-
|
|
97
|
-
<nav role="navigation" />
|
|
98
|
-
```
|
|
114
|
+
Examples include:
|
|
99
115
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
116
|
+
- heading hierarchy
|
|
117
|
+
- landmark semantics
|
|
118
|
+
- form relationships
|
|
119
|
+
- menu ownership
|
|
120
|
+
- dialog accessibility
|
|
121
|
+
- tab relationships
|
|
122
|
+
- list semantics
|
|
123
|
+
- sectioning content
|
|
124
|
+
- interactive element restrictions
|
|
103
125
|
|
|
104
|
-
|
|
126
|
+
These are platform rules—not framework conventions.
|
|
105
127
|
|
|
106
|
-
|
|
107
|
-
<Button as="a" href="/pricing">
|
|
108
|
-
Pricing
|
|
109
|
-
</Button>
|
|
110
|
-
```
|
|
128
|
+
---
|
|
111
129
|
|
|
112
|
-
|
|
113
|
-
<a href="/pricing">Pricing</a>
|
|
114
|
-
```
|
|
130
|
+
## Polymorphism as a Foundation
|
|
115
131
|
|
|
116
|
-
|
|
132
|
+
Components are polymorphic because semantics should not depend on implementation details.
|
|
117
133
|
|
|
118
|
-
|
|
134
|
+
A component may render different HTML elements when appropriate, but every rendered element must
|
|
135
|
+
still satisfy the component's contract.
|
|
119
136
|
|
|
120
|
-
|
|
121
|
-
praxis-kit
|
|
122
|
-
├─ praxis-kit/react
|
|
123
|
-
├─ praxis-kit/svelte
|
|
124
|
-
├─ praxis-kit/vue
|
|
125
|
-
├─ praxis-kit/solid
|
|
126
|
-
├─ praxis-kit/preact
|
|
127
|
-
├─ praxis-kit/lit
|
|
128
|
-
└─ praxis-kit/web
|
|
129
|
-
```
|
|
137
|
+
Rendering flexibility never bypasses semantic correctness.
|
|
130
138
|
|
|
131
139
|
---
|
|
132
140
|
|
|
133
|
-
##
|
|
141
|
+
## Framework Neutral
|
|
134
142
|
|
|
135
|
-
|
|
136
|
-
| ------------------------ | ----------------------------------------------------------------- |
|
|
137
|
-
| `praxis-kit/react` | React 19+ · `praxis-kit/react/legacy` for React 18 |
|
|
138
|
-
| `praxis-kit/vue` | Vue 3 |
|
|
139
|
-
| `praxis-kit/solid` | Solid · client and SSR |
|
|
140
|
-
| `praxis-kit/preact` | Preact |
|
|
141
|
-
| `praxis-kit/svelte` | Svelte 5 |
|
|
142
|
-
| `praxis-kit/lit` | Lit |
|
|
143
|
-
| `praxis-kit/web` | Vanilla Custom Elements — no framework required |
|
|
144
|
-
| `praxis-kit/tailwind` | Layout-aware Tailwind class pipeline plugin |
|
|
145
|
-
| `praxis-kit/vite-plugin` | Vite plugins for static composition, SSR, and contract validation |
|
|
146
|
-
| `praxis-kit/eslint` | ESLint rules for enforcing Praxis Kit patterns |
|
|
147
|
-
| `praxis-kit/ts-plugin` | TypeScript language service plugin with inline diagnostics |
|
|
148
|
-
| `praxis-kit/codemod` | Codemods for migrations |
|
|
149
|
-
| `praxis-kit/playwright` | Playwright CT helpers — ARIA snapshots, axe sweeps, keyboard |
|
|
143
|
+
Contracts are independent of rendering frameworks.
|
|
150
144
|
|
|
151
|
-
|
|
145
|
+
The same component contract can be evaluated in:
|
|
152
146
|
|
|
153
|
-
|
|
147
|
+
- React
|
|
148
|
+
- Vue
|
|
149
|
+
- Solid
|
|
150
|
+
- Svelte
|
|
151
|
+
- Lit
|
|
152
|
+
- Web Components
|
|
154
153
|
|
|
155
|
-
|
|
156
|
-
| -------------- | ------------------- | -------------------- | ------------------------------ | ---------------------- | ---------------------- |
|
|
157
|
-
| **Praxis Kit** | — rules only | ✓ | ✓ | ✓ | ✓ |
|
|
158
|
-
| **Radix UI** | ✓ | ✗ | ✗ | Partial | ✗ — React only |
|
|
159
|
-
| **Ark UI** | ✓ | Partial | ✗ | Partial | Partial |
|
|
160
|
-
| **React Aria** | ✓ | ✗ | ✗ | ✓ | ✗ |
|
|
161
|
-
| **CVA** | ✗ | ✗ | ✗ | ✗ | ✗ — class strings only |
|
|
154
|
+
Framework adapters translate rendering. The contract remains the same.
|
|
162
155
|
|
|
163
156
|
---
|
|
164
157
|
|
|
165
158
|
## Philosophy
|
|
166
159
|
|
|
167
|
-
TypeScript
|
|
160
|
+
TypeScript tells you whether an API is valid.
|
|
168
161
|
|
|
169
|
-
|
|
170
|
-
<Tabs>
|
|
171
|
-
<p>Hello</p>
|
|
172
|
-
</Tabs>
|
|
173
|
-
```
|
|
162
|
+
Praxis tells you whether a UI is valid.
|
|
174
163
|
|
|
175
|
-
|
|
164
|
+
Types guarantee syntax.
|
|
165
|
+
|
|
166
|
+
Contracts guarantee semantics.
|
|
176
167
|
|
|
177
168
|
---
|
|
178
169
|
|
|
179
|
-
##
|
|
170
|
+
## Comparison
|
|
180
171
|
|
|
181
|
-
|
|
172
|
+
| Capability | Typical Component Libraries | Praxis Kit |
|
|
173
|
+
| ---------------------------------------- | --------------------------- | ---------- |
|
|
174
|
+
| Type-safe APIs | ✅ | ✅ |
|
|
175
|
+
| Polymorphic components | Sometimes | ✅ |
|
|
176
|
+
| Runtime composition validation | Rare | ✅ |
|
|
177
|
+
| Required and forbidden child enforcement | Rare | ✅ |
|
|
178
|
+
| HTML semantic validation | ❌ | ✅ |
|
|
179
|
+
| ARIA contract enforcement | Limited | ✅ |
|
|
180
|
+
| Executable accessibility rules | Rare | ✅ |
|
|
181
|
+
| Framework-neutral contracts | Rare | ✅ |
|
|
182
182
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Packages
|
|
186
186
|
|
|
187
|
-
|
|
188
|
-
contracts, slot rendering, and presets.
|
|
187
|
+
The repository contains:
|
|
189
188
|
|
|
190
|
-
|
|
189
|
+
- Core contract engine
|
|
190
|
+
- HTML and ARIA contract libraries
|
|
191
|
+
- Framework adapters
|
|
192
|
+
- Runtime validator
|
|
193
|
+
- Component primitives
|
|
194
|
+
- Styling integration
|
|
195
|
+
- Tooling and codemods
|
|
196
|
+
- ESLint integration
|
|
197
|
+
- Build plugins
|
|
191
198
|
|
|
192
199
|
---
|
|
193
200
|
|
|
194
|
-
##
|
|
201
|
+
## Vision
|
|
202
|
+
|
|
203
|
+
Praxis Kit treats components as semantic contracts rather than render functions.
|
|
204
|
+
|
|
205
|
+
A component should not merely describe what it looks like.
|
|
206
|
+
|
|
207
|
+
It should define what it is allowed to be.
|
|
195
208
|
|
|
196
|
-
|
|
209
|
+
By encoding the rules of HTML, ARIA, and component composition into reusable contracts, Praxis helps
|
|
210
|
+
developers build interfaces that are structurally correct, semantically meaningful, and accessible
|
|
211
|
+
by default.
|