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 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.