dialkit 0.1.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/LICENSE +21 -0
- package/README.md +149 -0
- package/dist/index.cjs +1090 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +144 -0
- package/dist/index.d.ts +144 -0
- package/dist/index.js +1055 -0
- package/dist/index.js.map +1 -0
- package/dist/styles.css +488 -0
- package/package.json +57 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Josh Puckett
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# dialkit
|
|
2
|
+
|
|
3
|
+
Real-time parameter tweaking for React + Motion.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install dialkit motion
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Setup
|
|
16
|
+
|
|
17
|
+
Add `<DialRoot />` once in your app layout:
|
|
18
|
+
|
|
19
|
+
```tsx
|
|
20
|
+
import { DialRoot } from 'dialkit';
|
|
21
|
+
import 'dialkit/styles.css';
|
|
22
|
+
|
|
23
|
+
export default function Layout({ children }) {
|
|
24
|
+
return (
|
|
25
|
+
<html>
|
|
26
|
+
<body>
|
|
27
|
+
{children}
|
|
28
|
+
<DialRoot position="top-right" />
|
|
29
|
+
</body>
|
|
30
|
+
</html>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Usage
|
|
38
|
+
|
|
39
|
+
```tsx
|
|
40
|
+
import { useDialKit } from 'dialkit';
|
|
41
|
+
import { motion } from 'motion/react';
|
|
42
|
+
|
|
43
|
+
function Card() {
|
|
44
|
+
const params = useDialKit('Card', {
|
|
45
|
+
blur: [24, 0, 100],
|
|
46
|
+
opacity: [0.8, 0, 1],
|
|
47
|
+
scale: 1.18,
|
|
48
|
+
spring: {
|
|
49
|
+
type: 'spring',
|
|
50
|
+
visualDuration: 0.3,
|
|
51
|
+
bounce: 0.2,
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<motion.div
|
|
57
|
+
style={{
|
|
58
|
+
filter: `blur(${params.blur}px)`,
|
|
59
|
+
opacity: params.opacity,
|
|
60
|
+
}}
|
|
61
|
+
animate={{ scale: params.scale }}
|
|
62
|
+
transition={params.spring}
|
|
63
|
+
/>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## API Reference
|
|
71
|
+
|
|
72
|
+
### useDialKit
|
|
73
|
+
|
|
74
|
+
```tsx
|
|
75
|
+
const params = useDialKit(name, config, options?)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
| Param | Type | Description |
|
|
79
|
+
|-------|------|-------------|
|
|
80
|
+
| `name` | `string` | Panel title |
|
|
81
|
+
| `config` | `DialConfig` | Parameter definitions |
|
|
82
|
+
| `options.onAction` | `(action: string) => void` | Callback for action buttons |
|
|
83
|
+
|
|
84
|
+
### Config Types
|
|
85
|
+
|
|
86
|
+
| Format | Control | Example |
|
|
87
|
+
|--------|---------|---------|
|
|
88
|
+
| `[default, min, max]` | Slider | `blur: [24, 0, 100]` |
|
|
89
|
+
| `number` | Slider (auto range) | `scale: 1.18` |
|
|
90
|
+
| `boolean` | Toggle | `enabled: true` |
|
|
91
|
+
| `{ type: 'spring', ... }` | Spring editor | See below |
|
|
92
|
+
| `{ type: 'action' }` | Button | `reset: { type: 'action' }` |
|
|
93
|
+
| `{ nested: ... }` | Folder | Nest any config |
|
|
94
|
+
|
|
95
|
+
### Spring Config
|
|
96
|
+
|
|
97
|
+
Two modes available:
|
|
98
|
+
|
|
99
|
+
```tsx
|
|
100
|
+
// Time mode
|
|
101
|
+
spring: {
|
|
102
|
+
type: 'spring',
|
|
103
|
+
visualDuration: 0.3,
|
|
104
|
+
bounce: 0.2,
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Physics mode
|
|
108
|
+
spring: {
|
|
109
|
+
type: 'spring',
|
|
110
|
+
stiffness: 200,
|
|
111
|
+
damping: 25,
|
|
112
|
+
mass: 1,
|
|
113
|
+
}
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Actions
|
|
117
|
+
|
|
118
|
+
Trigger callbacks from the panel:
|
|
119
|
+
|
|
120
|
+
```tsx
|
|
121
|
+
const params = useDialKit('Controls', {
|
|
122
|
+
next: { type: 'action' },
|
|
123
|
+
previous: { type: 'action' },
|
|
124
|
+
}, {
|
|
125
|
+
onAction: (action) => {
|
|
126
|
+
if (action === 'next') goNext();
|
|
127
|
+
if (action === 'previous') goPrevious();
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### DialRoot
|
|
133
|
+
|
|
134
|
+
```tsx
|
|
135
|
+
<DialRoot position="top-right" />
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
| Position | |
|
|
139
|
+
|----------|--|
|
|
140
|
+
| `top-right` | Default |
|
|
141
|
+
| `top-left` | |
|
|
142
|
+
| `bottom-right` | |
|
|
143
|
+
| `bottom-left` | |
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## License
|
|
148
|
+
|
|
149
|
+
MIT
|