praxis-kit 3.1.0 → 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 CHANGED
@@ -1,10 +1,45 @@
1
1
  # Praxis Kit
2
2
 
3
- **Build components that enforce their own structure.**
3
+ > **Build components that enforce the rules of the web.**
4
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.
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
- <Tabs>
22
- <TabsList>
23
- <TabsTrigger />
24
- </TabsList>
25
- <TabsPanel>Content</TabsPanel>
26
- </Tabs>
58
+ <Menu>
59
+ <Button />
60
+ </Menu>
27
61
  ```
28
62
 
29
63
  ```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
64
+ Button cannot be a direct child of Menu.
41
65
  ```
42
66
 
43
- Then import from the sub-entry for your framework:
67
+ Or:
44
68
 
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'
69
+ ```tsx
70
+ <Dialog>
71
+ <DialogContent />
72
+ </Dialog>
51
73
  ```
52
74
 
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
75
+ ```text
76
+ ✖ DialogTitle is required.
77
+ ✖ Accessible name is missing.
59
78
  ```
60
79
 
61
- > **Migrating from `@praxis-kit/*`?** Run `pnpm dlx @praxis-kit/codemod migrate` to rewrite import
62
- > paths and the factory rename automatically.
80
+ Praxis validates these structures automatically during development.
63
81
 
64
82
  ---
65
83
 
66
- ## Why Praxis?
84
+ ## Contracts
85
+
86
+ A contract describes the semantic rules of a component.
67
87
 
68
- Traditional component libraries validate props, types, and accessibility attributes. Praxis
69
- additionally validates:
88
+ Contracts may define:
70
89
 
71
- - required children and parent/child relationships
72
- - component composition contracts
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
- - rendering capabilities
98
+ - lifecycle constraints
99
+ - custom validation rules
75
100
 
76
- …before broken UI reaches production.
101
+ Every component becomes self-describing.
77
102
 
78
103
  ---
79
104
 
80
- ## What Problems Does It Solve?
105
+ ## HTML and ARIA as Executable Rules
81
106
 
82
- ### Structural Validation
107
+ HTML and ARIA specifications contain thousands of rules that are usually expressed as prose.
83
108
 
84
- ```tsx
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
- ### Accessibility Enforcement
111
+ Instead of asking developers to remember the HTML specification or ARIA Authoring Practices Guide,
112
+ Praxis validates those requirements directly.
95
113
 
96
- ```tsx
97
- <nav role="navigation" />
98
- ```
114
+ Examples include:
99
115
 
100
- ```text
101
- Redundant role — stripped before it reaches the DOM
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
- ### Polymorphic Rendering
126
+ These are platform rules—not framework conventions.
105
127
 
106
- ```tsx
107
- <Button as="a" href="/pricing">
108
- Pricing
109
- </Button>
110
- ```
128
+ ---
111
129
 
112
- ```html
113
- <a href="/pricing">Pricing</a>
114
- ```
130
+ ## Polymorphism as a Foundation
115
131
 
116
- ### Framework-Neutral Core
132
+ Components are polymorphic because semantics should not depend on implementation details.
117
133
 
118
- Business logic lives outside framework adapters. One engine, five runtimes.
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
- ```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
- ```
137
+ Rendering flexibility never bypasses semantic correctness.
130
138
 
131
139
  ---
132
140
 
133
- ## Packages
141
+ ## Framework Neutral
134
142
 
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 |
143
+ Contracts are independent of rendering frameworks.
150
144
 
151
- ---
145
+ The same component contract can be evaluated in:
152
146
 
153
- ## vs. Other Tools
147
+ - React
148
+ - Vue
149
+ - Solid
150
+ - Svelte
151
+ - Lit
152
+ - Web Components
154
153
 
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 |
154
+ Framework adapters translate rendering. The contract remains the same.
162
155
 
163
156
  ---
164
157
 
165
158
  ## Philosophy
166
159
 
167
- TypeScript can tell you that a prop exists. Praxis can tell you that a component hierarchy is valid.
160
+ TypeScript tells you whether an API is valid.
168
161
 
169
- ```tsx
170
- <Tabs>
171
- <p>Hello</p>
172
- </Tabs>
173
- ```
162
+ Praxis tells you whether a UI is valid.
174
163
 
175
- TypeScript: `✔ Compiles` — Praxis: `✖ Invalid Tabs structure`
164
+ Types guarantee syntax.
165
+
166
+ Contracts guarantee semantics.
176
167
 
177
168
  ---
178
169
 
179
- ## Learn Praxis in 10 Minutes
170
+ ## Comparison
180
171
 
181
- The [Getting Started guide](GETTING_STARTED.md) walks from a minimal component:
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
- ```ts
184
- const Box = createContractComponent({ tag: 'div' })
185
- ```
183
+ ---
184
+
185
+ ## Packages
186
186
 
187
- to variants, compound variants, polymorphic rendering, accessibility validation, structural
188
- contracts, slot rendering, and presets.
187
+ The repository contains:
189
188
 
190
- **[→ Start here](GETTING_STARTED.md)**
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
- ## License
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
- MIT see [LICENSE](LICENSE) for details.
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.