praxis-kit 1.1.0 → 1.1.1
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/preact/index.d.ts +1 -1
- package/dist/react/index.d.ts +1 -1
- package/dist/react/legacy.d.ts +1 -1
- package/dist/solid/index.d.ts +1 -1
- package/dist/svelte/index.d.ts +1 -1
- package/dist/vue/index.d.ts +1 -1
- package/package.json +2 -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.
|
package/dist/preact/index.d.ts
CHANGED
|
@@ -289,4 +289,4 @@ type SlottableProps = {
|
|
|
289
289
|
};
|
|
290
290
|
declare function Slottable({ children }: SlottableProps): AnyVNode;
|
|
291
291
|
|
|
292
|
-
export { type ElementRef, type PolymorphicComponent, type PolymorphicProps, type PolymorphicWithAsChild, type PreactFactoryOptions, Slottable, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
|
292
|
+
export { type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, type PreactFactoryOptions, Slottable, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
package/dist/react/index.d.ts
CHANGED
|
@@ -24,4 +24,4 @@ declare namespace Slot {
|
|
|
24
24
|
var displayName: string;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
export { PolymorphicComponent, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent, defineContractComponent };
|
|
27
|
+
export { ElementType, EmptyRecord, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent, defineContractComponent };
|
package/dist/react/legacy.d.ts
CHANGED
|
@@ -18,4 +18,4 @@ type SlotProps = {
|
|
|
18
18
|
};
|
|
19
19
|
declare const Slot: react.ForwardRefExoticComponent<Omit<SlotProps, "ref"> & react.RefAttributes<unknown>>;
|
|
20
20
|
|
|
21
|
-
export { PolymorphicComponent, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent };
|
|
21
|
+
export { ElementType, EmptyRecord, PolymorphicComponent, PolymorphicGenerics, ReactFactoryOptions, Slot, createAriaEnforcedComponent, createChildrenEnforcedComponent, createContractComponent, createContractedComponent, createPolymorphicComponent };
|
package/dist/solid/index.d.ts
CHANGED
|
@@ -284,4 +284,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
284
284
|
|
|
285
285
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
286
286
|
|
|
287
|
-
export { type ElementRef, type PolymorphicComponent, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
|
287
|
+
export { type ElementRef, type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type SolidFactoryOptions, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
package/dist/svelte/index.d.ts
CHANGED
|
@@ -340,4 +340,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
340
340
|
|
|
341
341
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
342
342
|
|
|
343
|
-
export { type BuiltRuntime, type FilterPredicate, type SvelteFactoryOptions, type UnknownProps, type WithChildRules, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
|
343
|
+
export { type BuiltRuntime, type ElementType, type EmptyRecord, type FilterPredicate, type PolymorphicGenerics, type SvelteFactoryOptions, type UnknownProps, type WithChildRules, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
package/dist/vue/index.d.ts
CHANGED
|
@@ -306,4 +306,4 @@ declare function createContractComponent<TDefault extends ElementType, Props ext
|
|
|
306
306
|
|
|
307
307
|
declare function defineContractComponent<O extends FactoryOptions>(options: O): <R>(factory: (options: O) => R) => R;
|
|
308
308
|
|
|
309
|
-
export { type PolymorphicComponent, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
|
309
|
+
export { type ElementType, type EmptyRecord, type PolymorphicComponent, type PolymorphicGenerics, type PolymorphicProps, type PolymorphicWithAsChild, Slottable, type SlottableProps, type VueFactoryOptions, createContractComponent, defineContractComponent, disabledProps, invalidProps };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "praxis-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./react": {
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
"url": "git+https://github.com/slowebworkz/praxis-kit.git",
|
|
138
138
|
"directory": "packages/kit"
|
|
139
139
|
},
|
|
140
|
-
"homepage": "https://github.com/slowebworkz/praxis-kit
|
|
140
|
+
"homepage": "https://github.com/slowebworkz/praxis-kit#readme",
|
|
141
141
|
"bugs": {
|
|
142
142
|
"url": "https://github.com/slowebworkz/praxis-kit/issues"
|
|
143
143
|
},
|