praxis-kit 1.1.0 → 2.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 +196 -0
- package/dist/{chunk-KDUNVQK2.js → chunk-ACAKUHH5.js} +531 -386
- package/dist/contract/index.d.ts +130 -0
- package/dist/contract/index.js +1370 -0
- package/dist/lit/index.d.ts +2 -1
- package/dist/lit/index.js +257 -184
- package/dist/{merge-refs-CfBqh1UO.d.ts → merge-refs-DxjWMq3U.d.ts} +2 -5
- package/dist/preact/index.d.ts +2 -5
- package/dist/preact/index.js +236 -187
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +1 -5
- package/dist/react/legacy.d.ts +3 -3
- package/dist/react/legacy.js +1 -5
- package/dist/solid/index.d.ts +2 -5
- package/dist/solid/index.js +238 -189
- package/dist/svelte/index.d.ts +3 -5
- package/dist/svelte/index.js +233 -186
- package/dist/vue/index.d.ts +2 -5
- package/dist/vue/index.js +236 -187
- package/dist/web/index.d.ts +2 -1
- package/dist/web/index.js +259 -185
- package/package.json +6 -2
package/README.md
ADDED
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# Praxis Kit
|
|
2
|
+
|
|
3
|
+
**Build components that enforce their own structure.**
|
|
4
|
+
|
|
5
|
+
Praxis Kit is a framework-neutral component infrastructure framework that validates component
|
|
6
|
+
composition, accessibility rules, and rendering contracts at runtime. Instead of allowing invalid UI
|
|
7
|
+
structures to render and fail later, Praxis catches them immediately.
|
|
8
|
+
|
|
9
|
+
```tsx
|
|
10
|
+
<Tabs>
|
|
11
|
+
<TabsTrigger />
|
|
12
|
+
</Tabs>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
```text
|
|
16
|
+
✖ TabsList required
|
|
17
|
+
✖ TabsPanel required
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
```tsx
|
|
21
|
+
<Tabs>
|
|
22
|
+
<TabsList>
|
|
23
|
+
<TabsTrigger />
|
|
24
|
+
</TabsList>
|
|
25
|
+
<TabsPanel>Content</TabsPanel>
|
|
26
|
+
</Tabs>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
```text
|
|
30
|
+
✔ Valid structure
|
|
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
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Then import from the sub-entry for your framework:
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { createContractComponent } from 'praxis-kit/react' // React 19+
|
|
47
|
+
import { createContractComponent } from 'praxis-kit/vue'
|
|
48
|
+
import { createContractComponent } from 'praxis-kit/svelte'
|
|
49
|
+
import { createContractComponent } from 'praxis-kit/solid'
|
|
50
|
+
import { createContractComponent } from 'praxis-kit/preact'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Optional tooling sub-entries:
|
|
54
|
+
|
|
55
|
+
```ts
|
|
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
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
> **Migrating from `@praxis-kit/*`?** Run `pnpm dlx @praxis-kit/codemod migrate` to rewrite import
|
|
62
|
+
> paths and the factory rename automatically.
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
## Why Praxis?
|
|
67
|
+
|
|
68
|
+
Traditional component libraries validate props, types, and accessibility attributes. Praxis
|
|
69
|
+
additionally validates:
|
|
70
|
+
|
|
71
|
+
- required children and parent/child relationships
|
|
72
|
+
- component composition contracts
|
|
73
|
+
- accessibility policies
|
|
74
|
+
- rendering capabilities
|
|
75
|
+
|
|
76
|
+
…before broken UI reaches production.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## What Problems Does It Solve?
|
|
81
|
+
|
|
82
|
+
### Structural Validation
|
|
83
|
+
|
|
84
|
+
```tsx
|
|
85
|
+
<Dialog>
|
|
86
|
+
<DialogContent />
|
|
87
|
+
</Dialog>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
```text
|
|
91
|
+
✖ DialogTrigger missing
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Accessibility Enforcement
|
|
95
|
+
|
|
96
|
+
```tsx
|
|
97
|
+
<nav role="navigation" />
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
```text
|
|
101
|
+
✖ Redundant role — stripped before it reaches the DOM
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Polymorphic Rendering
|
|
105
|
+
|
|
106
|
+
```tsx
|
|
107
|
+
<Button as="a" href="/pricing">
|
|
108
|
+
Pricing
|
|
109
|
+
</Button>
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
```html
|
|
113
|
+
<a href="/pricing">Pricing</a>
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Framework-Neutral Core
|
|
117
|
+
|
|
118
|
+
Business logic lives outside framework adapters. One engine, five runtimes.
|
|
119
|
+
|
|
120
|
+
```text
|
|
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
|
+
```
|
|
130
|
+
|
|
131
|
+
---
|
|
132
|
+
|
|
133
|
+
## Packages
|
|
134
|
+
|
|
135
|
+
| Sub-entry | Description |
|
|
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 |
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## vs. Other Tools
|
|
154
|
+
|
|
155
|
+
| | Headless Components | Structural Contracts | Runtime Composition Validation | Accessibility Policies | Framework-Neutral Core |
|
|
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 |
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Philosophy
|
|
166
|
+
|
|
167
|
+
TypeScript can tell you that a prop exists. Praxis can tell you that a component hierarchy is valid.
|
|
168
|
+
|
|
169
|
+
```tsx
|
|
170
|
+
<Tabs>
|
|
171
|
+
<p>Hello</p>
|
|
172
|
+
</Tabs>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
TypeScript: `✔ Compiles` — Praxis: `✖ Invalid Tabs structure`
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## Learn Praxis in 10 Minutes
|
|
180
|
+
|
|
181
|
+
The [Getting Started guide](GETTING_STARTED.md) walks from a minimal component:
|
|
182
|
+
|
|
183
|
+
```ts
|
|
184
|
+
const Box = createContractComponent({ tag: 'div' })
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
to variants, compound variants, polymorphic rendering, accessibility validation, structural
|
|
188
|
+
contracts, slot rendering, and presets.
|
|
189
|
+
|
|
190
|
+
**[→ Start here](GETTING_STARTED.md)**
|
|
191
|
+
|
|
192
|
+
---
|
|
193
|
+
|
|
194
|
+
## License
|
|
195
|
+
|
|
196
|
+
MIT — see [LICENSE](LICENSE) for details.
|