@tanstack/hotkeys-devtools 0.0.1 → 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 +121 -45
- package/dist/HotkeysContextProvider.js +47 -0
- package/dist/HotkeysContextProvider.js.map +1 -0
- package/dist/HotkeysDevtools.js +14 -0
- package/dist/HotkeysDevtools.js.map +1 -0
- package/dist/components/ActionButtons.js +33 -0
- package/dist/components/ActionButtons.js.map +1 -0
- package/dist/components/DetailsPanel.js +268 -0
- package/dist/components/DetailsPanel.js.map +1 -0
- package/dist/components/HeldKeysTopbar.js +75 -0
- package/dist/components/HeldKeysTopbar.js.map +1 -0
- package/dist/components/HotkeyList.js +188 -0
- package/dist/components/HotkeyList.js.map +1 -0
- package/dist/components/Shell.js +98 -0
- package/dist/components/Shell.js.map +1 -0
- package/dist/core.d.ts +24 -0
- package/dist/core.js +9 -0
- package/dist/core.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/production.d.ts +2 -0
- package/dist/production.js +5 -0
- package/dist/styles/tokens.js +301 -0
- package/dist/styles/tokens.js.map +1 -0
- package/dist/styles/use-styles.js +496 -0
- package/dist/styles/use-styles.js.map +1 -0
- package/package.json +59 -7
- package/src/HotkeysContextProvider.tsx +67 -0
- package/src/HotkeysDevtools.tsx +10 -0
- package/src/components/ActionButtons.tsx +25 -0
- package/src/components/DetailsPanel.tsx +298 -0
- package/src/components/HeldKeysTopbar.tsx +42 -0
- package/src/components/HotkeyList.tsx +248 -0
- package/src/components/Shell.tsx +101 -0
- package/src/core.tsx +11 -0
- package/src/index.ts +10 -0
- package/src/production.ts +5 -0
- package/src/styles/tokens.ts +305 -0
- package/src/styles/use-styles.ts +493 -0
|
@@ -0,0 +1,496 @@
|
|
|
1
|
+
import { tokens } from "./tokens.js";
|
|
2
|
+
import { createEffect, createSignal } from "solid-js";
|
|
3
|
+
import { useTheme } from "@tanstack/devtools-ui";
|
|
4
|
+
import * as goober from "goober";
|
|
5
|
+
|
|
6
|
+
//#region src/styles/use-styles.ts
|
|
7
|
+
const stylesFactory = (theme) => {
|
|
8
|
+
const { colors, font, size, alpha, border } = tokens;
|
|
9
|
+
const { fontFamily, size: fontSize } = font;
|
|
10
|
+
const css = goober.css;
|
|
11
|
+
const t = (light, dark) => theme === "light" ? light : dark;
|
|
12
|
+
return {
|
|
13
|
+
mainContainer: css`
|
|
14
|
+
display: flex;
|
|
15
|
+
flex-direction: column;
|
|
16
|
+
padding: ${size[2]};
|
|
17
|
+
padding-top: 0;
|
|
18
|
+
margin-top: ${size[2]};
|
|
19
|
+
`,
|
|
20
|
+
heldKeysBar: css`
|
|
21
|
+
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
22
|
+
border-radius: ${border.radius.lg};
|
|
23
|
+
border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
|
|
24
|
+
display: flex;
|
|
25
|
+
align-items: center;
|
|
26
|
+
gap: ${size[3]};
|
|
27
|
+
padding: ${size[3]} ${size[3]};
|
|
28
|
+
flex-shrink: 0;
|
|
29
|
+
min-height: 64px;
|
|
30
|
+
margin-bottom: ${size[2]};
|
|
31
|
+
`,
|
|
32
|
+
heldKeysBarHeader: css`
|
|
33
|
+
font-size: ${fontSize.sm};
|
|
34
|
+
font-weight: ${font.weight.bold};
|
|
35
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
36
|
+
text-transform: uppercase;
|
|
37
|
+
letter-spacing: 0.05em;
|
|
38
|
+
flex-shrink: 0;
|
|
39
|
+
`,
|
|
40
|
+
heldKeysBarList: css`
|
|
41
|
+
display: flex;
|
|
42
|
+
align-items: center;
|
|
43
|
+
gap: ${size[1.5]};
|
|
44
|
+
flex-wrap: wrap;
|
|
45
|
+
flex: 1;
|
|
46
|
+
min-width: 0;
|
|
47
|
+
`,
|
|
48
|
+
panelsContainer: css`
|
|
49
|
+
display: flex;
|
|
50
|
+
`,
|
|
51
|
+
dragHandle: css`
|
|
52
|
+
width: 8px;
|
|
53
|
+
background: ${t(colors.gray[300], colors.darkGray[600])};
|
|
54
|
+
cursor: col-resize;
|
|
55
|
+
position: relative;
|
|
56
|
+
transition: all 0.2s ease;
|
|
57
|
+
user-select: none;
|
|
58
|
+
pointer-events: all;
|
|
59
|
+
margin: 0 ${size[1]};
|
|
60
|
+
border-radius: 2px;
|
|
61
|
+
|
|
62
|
+
&:hover {
|
|
63
|
+
background: ${t(colors.blue[600], colors.blue[500])};
|
|
64
|
+
margin: 0 ${size[1]};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
&.dragging {
|
|
68
|
+
background: ${t(colors.blue[700], colors.blue[600])};
|
|
69
|
+
margin: 0 ${size[1]};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
&::after {
|
|
73
|
+
content: '';
|
|
74
|
+
position: absolute;
|
|
75
|
+
top: 50%;
|
|
76
|
+
left: 50%;
|
|
77
|
+
transform: translate(-50%, -50%);
|
|
78
|
+
width: 2px;
|
|
79
|
+
height: 20px;
|
|
80
|
+
background: ${t(colors.gray[400], colors.darkGray[400])};
|
|
81
|
+
border-radius: 1px;
|
|
82
|
+
pointer-events: none;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
&:hover::after,
|
|
86
|
+
&.dragging::after {
|
|
87
|
+
background: ${t(colors.blue[500], colors.blue[300])};
|
|
88
|
+
}
|
|
89
|
+
`,
|
|
90
|
+
keyCap: css`
|
|
91
|
+
display: inline-flex;
|
|
92
|
+
flex-direction: column;
|
|
93
|
+
align-items: center;
|
|
94
|
+
justify-content: center;
|
|
95
|
+
min-width: 36px;
|
|
96
|
+
padding: ${size[1]} ${size[2]};
|
|
97
|
+
font-family: ${fontFamily.mono};
|
|
98
|
+
font-size: ${fontSize.sm};
|
|
99
|
+
font-weight: ${font.weight.bold};
|
|
100
|
+
color: ${t(colors.gray[800], colors.gray[100])};
|
|
101
|
+
background: ${t(colors.white, colors.darkGray[600])};
|
|
102
|
+
border: 1px solid ${t(colors.gray[300], colors.darkGray[400])};
|
|
103
|
+
border-bottom-width: 2px;
|
|
104
|
+
border-radius: ${border.radius.sm};
|
|
105
|
+
box-shadow: ${tokens.shadow.xs()};
|
|
106
|
+
text-transform: capitalize;
|
|
107
|
+
white-space: nowrap;
|
|
108
|
+
line-height: 1.2;
|
|
109
|
+
`,
|
|
110
|
+
keyCapCode: css`
|
|
111
|
+
font-size: ${fontSize["2xs"]};
|
|
112
|
+
font-weight: ${font.weight.normal};
|
|
113
|
+
color: ${t(colors.gray[500], colors.gray[400])};
|
|
114
|
+
text-transform: none;
|
|
115
|
+
line-height: 1;
|
|
116
|
+
margin-top: 2px;
|
|
117
|
+
`,
|
|
118
|
+
noKeysHeld: css`
|
|
119
|
+
font-size: ${fontSize.sm};
|
|
120
|
+
color: ${t(colors.gray[400], colors.gray[600])};
|
|
121
|
+
font-style: italic;
|
|
122
|
+
text-align: center;
|
|
123
|
+
padding: ${size[1]};
|
|
124
|
+
`,
|
|
125
|
+
leftPanel: css`
|
|
126
|
+
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
127
|
+
border-radius: ${border.radius.lg};
|
|
128
|
+
border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
|
|
129
|
+
display: flex;
|
|
130
|
+
flex-direction: column;
|
|
131
|
+
flex-shrink: 0;
|
|
132
|
+
`,
|
|
133
|
+
rightPanel: css`
|
|
134
|
+
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
135
|
+
border-radius: ${border.radius.lg};
|
|
136
|
+
border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
|
|
137
|
+
display: flex;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
flex: 1;
|
|
140
|
+
`,
|
|
141
|
+
panelHeader: css`
|
|
142
|
+
font-size: ${fontSize.md};
|
|
143
|
+
font-weight: ${font.weight.bold};
|
|
144
|
+
color: ${t(colors.blue[700], colors.blue[400])};
|
|
145
|
+
padding: ${size[2]};
|
|
146
|
+
border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
|
|
147
|
+
background: ${t(colors.gray[100], colors.darkGray[800])};
|
|
148
|
+
flex-shrink: 0;
|
|
149
|
+
`,
|
|
150
|
+
hotkeyList: css`
|
|
151
|
+
padding: ${size[1]};
|
|
152
|
+
`,
|
|
153
|
+
hotkeyRow: css`
|
|
154
|
+
display: flex;
|
|
155
|
+
justify-content: space-between;
|
|
156
|
+
align-items: center;
|
|
157
|
+
padding: ${size[2]};
|
|
158
|
+
margin-bottom: ${size[1]};
|
|
159
|
+
background: ${t(colors.gray[200], colors.darkGray[700])};
|
|
160
|
+
border-radius: ${border.radius.md};
|
|
161
|
+
cursor: pointer;
|
|
162
|
+
transition: all 0.2s ease;
|
|
163
|
+
border: 1px solid transparent;
|
|
164
|
+
|
|
165
|
+
&:hover {
|
|
166
|
+
background: ${t(colors.gray[300], colors.darkGray[600])};
|
|
167
|
+
border-color: ${t(colors.gray[400], colors.darkGray[500])};
|
|
168
|
+
}
|
|
169
|
+
`,
|
|
170
|
+
hotkeyRowSelected: css`
|
|
171
|
+
background: ${t(colors.blue[100], colors.blue[900] + alpha[20])};
|
|
172
|
+
border-color: ${t(colors.blue[600], colors.blue[500])};
|
|
173
|
+
box-shadow: 0 0 0 1px
|
|
174
|
+
${t(colors.blue[600] + alpha[30], colors.blue[500] + alpha[30])};
|
|
175
|
+
`,
|
|
176
|
+
hotkeyRowTriggered: css`
|
|
177
|
+
animation: hotkey-pulse 0.6s ease-out;
|
|
178
|
+
|
|
179
|
+
@keyframes hotkey-pulse {
|
|
180
|
+
0% {
|
|
181
|
+
border-color: ${t(colors.blue[500], colors.blue[400])};
|
|
182
|
+
box-shadow: 0 0 0 2px
|
|
183
|
+
${t(colors.blue[500] + alpha[40], colors.blue[400] + alpha[40])};
|
|
184
|
+
}
|
|
185
|
+
100% {
|
|
186
|
+
border-color: transparent;
|
|
187
|
+
box-shadow: 0 0 0 0px
|
|
188
|
+
${t(colors.blue[500] + "00", colors.blue[400] + "00")};
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
`,
|
|
192
|
+
hotkeyLabel: css`
|
|
193
|
+
font-family: ${fontFamily.mono};
|
|
194
|
+
font-size: ${fontSize.xs};
|
|
195
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
196
|
+
flex: 1;
|
|
197
|
+
overflow: hidden;
|
|
198
|
+
text-overflow: ellipsis;
|
|
199
|
+
white-space: nowrap;
|
|
200
|
+
`,
|
|
201
|
+
hotkeyBadges: css`
|
|
202
|
+
display: flex;
|
|
203
|
+
gap: ${size[1]};
|
|
204
|
+
margin-left: ${size[1]};
|
|
205
|
+
flex-shrink: 0;
|
|
206
|
+
overflow: visible;
|
|
207
|
+
`,
|
|
208
|
+
badge: css`
|
|
209
|
+
font-size: ${fontSize["2xs"]};
|
|
210
|
+
padding: ${size[.5]} ${size[1]};
|
|
211
|
+
border-radius: ${border.radius.sm};
|
|
212
|
+
text-transform: uppercase;
|
|
213
|
+
letter-spacing: 0.05em;
|
|
214
|
+
white-space: nowrap;
|
|
215
|
+
`,
|
|
216
|
+
badgeEnabled: css`
|
|
217
|
+
color: ${t(colors.green[700], colors.green[400])};
|
|
218
|
+
background: ${t(colors.green[100], colors.green[900] + alpha[30])};
|
|
219
|
+
`,
|
|
220
|
+
badgeDisabled: css`
|
|
221
|
+
color: ${t(colors.red[700], colors.red[400])};
|
|
222
|
+
background: ${t(colors.red[100], colors.red[900] + alpha[30])};
|
|
223
|
+
`,
|
|
224
|
+
badgeKeydown: css`
|
|
225
|
+
color: ${t(colors.purple[700], colors.purple[400])};
|
|
226
|
+
background: ${t(colors.purple[100], colors.purple[900] + alpha[30])};
|
|
227
|
+
`,
|
|
228
|
+
badgeKeyup: css`
|
|
229
|
+
color: ${t(colors.teal[700], colors.teal[400])};
|
|
230
|
+
background: ${t(colors.teal[100], colors.teal[900] + alpha[30])};
|
|
231
|
+
`,
|
|
232
|
+
badgeTarget: css`
|
|
233
|
+
color: ${t(colors.gray[700], colors.gray[300])};
|
|
234
|
+
background: ${t(colors.gray[200], colors.darkGray[600])};
|
|
235
|
+
`,
|
|
236
|
+
badgeConflict: css`
|
|
237
|
+
color: ${t(colors.yellow[700], colors.yellow[400])};
|
|
238
|
+
background: ${t(colors.yellow[100], colors.yellow[900] + alpha[30])};
|
|
239
|
+
`,
|
|
240
|
+
badgeError: css`
|
|
241
|
+
color: ${t(colors.red[700], colors.red[400])};
|
|
242
|
+
background: ${t(colors.red[100], colors.red[900] + alpha[30])};
|
|
243
|
+
`,
|
|
244
|
+
badgeAllow: css`
|
|
245
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
246
|
+
background: ${t(colors.gray[200], colors.darkGray[600])};
|
|
247
|
+
`,
|
|
248
|
+
badgeInfo: css`
|
|
249
|
+
color: ${t(colors.blue[700], colors.blue[400])};
|
|
250
|
+
background: ${t(colors.blue[100], colors.blue[900] + alpha[30])};
|
|
251
|
+
`,
|
|
252
|
+
stateDetails: css`
|
|
253
|
+
padding: ${size[2]};
|
|
254
|
+
`,
|
|
255
|
+
stateHeader: css`
|
|
256
|
+
margin-bottom: ${size[2]};
|
|
257
|
+
padding-bottom: ${size[2]};
|
|
258
|
+
border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};
|
|
259
|
+
`,
|
|
260
|
+
stateTitle: css`
|
|
261
|
+
font-size: ${fontSize.md};
|
|
262
|
+
font-weight: ${font.weight.bold};
|
|
263
|
+
color: ${t(colors.blue[700], colors.blue[400])};
|
|
264
|
+
margin-bottom: ${size[1]};
|
|
265
|
+
`,
|
|
266
|
+
detailsGrid: css`
|
|
267
|
+
display: grid;
|
|
268
|
+
grid-template-columns: 1fr;
|
|
269
|
+
gap: ${size[2]};
|
|
270
|
+
align-items: start;
|
|
271
|
+
`,
|
|
272
|
+
detailSection: css`
|
|
273
|
+
background: ${t(colors.white, colors.darkGray[700])};
|
|
274
|
+
border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
|
|
275
|
+
border-radius: ${border.radius.md};
|
|
276
|
+
padding: ${size[2]};
|
|
277
|
+
`,
|
|
278
|
+
detailSectionHeader: css`
|
|
279
|
+
font-size: ${fontSize.sm};
|
|
280
|
+
font-weight: ${font.weight.bold};
|
|
281
|
+
color: ${t(colors.gray[800], colors.gray[200])};
|
|
282
|
+
margin-bottom: ${size[1]};
|
|
283
|
+
text-transform: uppercase;
|
|
284
|
+
letter-spacing: 0.04em;
|
|
285
|
+
`,
|
|
286
|
+
infoGrid: css`
|
|
287
|
+
display: grid;
|
|
288
|
+
grid-template-columns: auto 1fr;
|
|
289
|
+
gap: ${size[1]};
|
|
290
|
+
row-gap: ${size[1]};
|
|
291
|
+
align-items: center;
|
|
292
|
+
`,
|
|
293
|
+
infoLabel: css`
|
|
294
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
295
|
+
font-size: ${fontSize.xs};
|
|
296
|
+
text-transform: uppercase;
|
|
297
|
+
letter-spacing: 0.05em;
|
|
298
|
+
`,
|
|
299
|
+
infoValueMono: css`
|
|
300
|
+
font-family: ${fontFamily.mono};
|
|
301
|
+
font-size: ${fontSize.xs};
|
|
302
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
303
|
+
word-break: break-all;
|
|
304
|
+
`,
|
|
305
|
+
actionsRow: css`
|
|
306
|
+
display: flex;
|
|
307
|
+
flex-wrap: wrap;
|
|
308
|
+
gap: ${size[2]};
|
|
309
|
+
`,
|
|
310
|
+
actionButton: css`
|
|
311
|
+
display: inline-flex;
|
|
312
|
+
align-items: center;
|
|
313
|
+
gap: ${size[1]};
|
|
314
|
+
padding: ${size[1]} ${size[2]};
|
|
315
|
+
border-radius: ${border.radius.md};
|
|
316
|
+
border: 1px solid ${t(colors.gray[300], colors.darkGray[500])};
|
|
317
|
+
background: ${t(colors.gray[200], colors.darkGray[600])};
|
|
318
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
319
|
+
font-size: ${fontSize.xs};
|
|
320
|
+
cursor: pointer;
|
|
321
|
+
user-select: none;
|
|
322
|
+
transition:
|
|
323
|
+
background 0.15s,
|
|
324
|
+
border-color 0.15s;
|
|
325
|
+
&:hover {
|
|
326
|
+
background: ${t(colors.gray[300], colors.darkGray[500])};
|
|
327
|
+
border-color: ${t(colors.gray[400], colors.darkGray[400])};
|
|
328
|
+
}
|
|
329
|
+
&:disabled {
|
|
330
|
+
opacity: 0.5;
|
|
331
|
+
cursor: not-allowed;
|
|
332
|
+
&:hover {
|
|
333
|
+
background: ${t(colors.gray[200], colors.darkGray[600])};
|
|
334
|
+
border-color: ${t(colors.gray[300], colors.darkGray[500])};
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
`,
|
|
338
|
+
actionDotGreen: css`
|
|
339
|
+
width: 6px;
|
|
340
|
+
height: 6px;
|
|
341
|
+
border-radius: 9999px;
|
|
342
|
+
background: ${colors.green[400]};
|
|
343
|
+
`,
|
|
344
|
+
noSelection: css`
|
|
345
|
+
flex: 1;
|
|
346
|
+
display: flex;
|
|
347
|
+
align-items: center;
|
|
348
|
+
justify-content: center;
|
|
349
|
+
color: ${t(colors.gray[500], colors.gray[500])};
|
|
350
|
+
font-style: italic;
|
|
351
|
+
text-align: center;
|
|
352
|
+
padding: ${size[4]};
|
|
353
|
+
`,
|
|
354
|
+
keyBreakdown: css`
|
|
355
|
+
display: flex;
|
|
356
|
+
flex-wrap: wrap;
|
|
357
|
+
gap: ${size[1]};
|
|
358
|
+
align-items: center;
|
|
359
|
+
`,
|
|
360
|
+
keyBreakdownPlus: css`
|
|
361
|
+
color: ${t(colors.gray[500], colors.gray[400])};
|
|
362
|
+
font-size: ${fontSize.sm};
|
|
363
|
+
`,
|
|
364
|
+
keyCapLarge: css`
|
|
365
|
+
display: inline-flex;
|
|
366
|
+
align-items: center;
|
|
367
|
+
justify-content: center;
|
|
368
|
+
min-width: 36px;
|
|
369
|
+
padding: ${size[1]} ${size[2]};
|
|
370
|
+
font-family: ${fontFamily.mono};
|
|
371
|
+
font-size: ${fontSize.sm};
|
|
372
|
+
font-weight: ${font.weight.bold};
|
|
373
|
+
color: ${t(colors.gray[800], colors.gray[100])};
|
|
374
|
+
background: ${t(colors.white, colors.darkGray[600])};
|
|
375
|
+
border: 1px solid ${t(colors.gray[300], colors.darkGray[400])};
|
|
376
|
+
border-bottom-width: 3px;
|
|
377
|
+
border-radius: ${border.radius.md};
|
|
378
|
+
box-shadow: ${tokens.shadow.sm()};
|
|
379
|
+
text-transform: capitalize;
|
|
380
|
+
white-space: nowrap;
|
|
381
|
+
`,
|
|
382
|
+
conflictList: css`
|
|
383
|
+
display: flex;
|
|
384
|
+
flex-direction: column;
|
|
385
|
+
gap: ${size[1]};
|
|
386
|
+
`,
|
|
387
|
+
conflictItem: css`
|
|
388
|
+
font-family: ${fontFamily.mono};
|
|
389
|
+
font-size: ${fontSize.xs};
|
|
390
|
+
color: ${t(colors.yellow[700], colors.yellow[400])};
|
|
391
|
+
padding: ${size[1]} ${size[2]};
|
|
392
|
+
background: ${t(colors.yellow[50], colors.yellow[900] + alpha[20])};
|
|
393
|
+
border-radius: ${border.radius.sm};
|
|
394
|
+
border: 1px solid ${t(colors.yellow[200], colors.yellow[800] + alpha[30])};
|
|
395
|
+
`,
|
|
396
|
+
conflictItemAllow: css`
|
|
397
|
+
font-family: ${fontFamily.mono};
|
|
398
|
+
font-size: ${fontSize.xs};
|
|
399
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
400
|
+
padding: ${size[1]} ${size[2]};
|
|
401
|
+
background: ${t(colors.gray[100], colors.darkGray[700])};
|
|
402
|
+
border-radius: ${border.radius.sm};
|
|
403
|
+
border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};
|
|
404
|
+
`,
|
|
405
|
+
conflictItemError: css`
|
|
406
|
+
font-family: ${fontFamily.mono};
|
|
407
|
+
font-size: ${fontSize.xs};
|
|
408
|
+
color: ${t(colors.red[700], colors.red[400])};
|
|
409
|
+
padding: ${size[1]} ${size[2]};
|
|
410
|
+
background: ${t(colors.red[50], colors.red[900] + alpha[20])};
|
|
411
|
+
border-radius: ${border.radius.sm};
|
|
412
|
+
border: 1px solid ${t(colors.red[200], colors.red[900] + alpha[30])};
|
|
413
|
+
`,
|
|
414
|
+
conflictItemScope: css`
|
|
415
|
+
font-family: ${fontFamily.mono};
|
|
416
|
+
font-size: ${fontSize.xs};
|
|
417
|
+
color: ${t(colors.blue[700], colors.blue[400])};
|
|
418
|
+
padding: ${size[1]} ${size[2]};
|
|
419
|
+
background: ${t(colors.blue[50], colors.blue[900] + alpha[20])};
|
|
420
|
+
border-radius: ${border.radius.sm};
|
|
421
|
+
border: 1px solid ${t(colors.blue[200], colors.blue[800] + alpha[30])};
|
|
422
|
+
`,
|
|
423
|
+
optionRow: css`
|
|
424
|
+
display: flex;
|
|
425
|
+
justify-content: space-between;
|
|
426
|
+
align-items: center;
|
|
427
|
+
padding: ${size[1]} 0;
|
|
428
|
+
font-size: ${fontSize.xs};
|
|
429
|
+
border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[600])};
|
|
430
|
+
&:last-child {
|
|
431
|
+
border-bottom: none;
|
|
432
|
+
}
|
|
433
|
+
`,
|
|
434
|
+
optionLabel: css`
|
|
435
|
+
color: ${t(colors.gray[600], colors.gray[400])};
|
|
436
|
+
`,
|
|
437
|
+
optionValue: css`
|
|
438
|
+
font-family: ${fontFamily.mono};
|
|
439
|
+
color: ${t(colors.gray[900], colors.gray[100])};
|
|
440
|
+
`,
|
|
441
|
+
optionValueTrue: css`
|
|
442
|
+
font-family: ${fontFamily.mono};
|
|
443
|
+
color: ${t(colors.green[600], colors.green[400])};
|
|
444
|
+
`,
|
|
445
|
+
optionValueFalse: css`
|
|
446
|
+
font-family: ${fontFamily.mono};
|
|
447
|
+
color: ${t(colors.red[600], colors.red[400])};
|
|
448
|
+
`,
|
|
449
|
+
tooltip: css`
|
|
450
|
+
position: relative;
|
|
451
|
+
&:hover > [data-tooltip] {
|
|
452
|
+
opacity: 1;
|
|
453
|
+
visibility: visible;
|
|
454
|
+
}
|
|
455
|
+
`,
|
|
456
|
+
tooltipText: css`
|
|
457
|
+
position: absolute;
|
|
458
|
+
top: 100%;
|
|
459
|
+
left: 50%;
|
|
460
|
+
transform: translateX(-50%);
|
|
461
|
+
padding: ${size[1]} ${size[1.5]};
|
|
462
|
+
background: ${t(colors.gray[800], colors.darkGray[500])};
|
|
463
|
+
color: ${t(colors.white, colors.gray[100])};
|
|
464
|
+
font-size: ${fontSize["2xs"]};
|
|
465
|
+
border-radius: ${border.radius.sm};
|
|
466
|
+
white-space: nowrap;
|
|
467
|
+
pointer-events: none;
|
|
468
|
+
opacity: 0;
|
|
469
|
+
visibility: hidden;
|
|
470
|
+
transition:
|
|
471
|
+
opacity 0.15s,
|
|
472
|
+
visibility 0.15s;
|
|
473
|
+
z-index: ${tokens.zIndices.tooltip};
|
|
474
|
+
margin-top: ${size[1]};
|
|
475
|
+
`,
|
|
476
|
+
triggerCount: css`
|
|
477
|
+
font-family: ${fontFamily.mono};
|
|
478
|
+
font-size: ${fontSize["2xs"]};
|
|
479
|
+
color: ${t(colors.gray[500], colors.gray[400])};
|
|
480
|
+
margin-left: ${size[1]};
|
|
481
|
+
flex-shrink: 0;
|
|
482
|
+
`
|
|
483
|
+
};
|
|
484
|
+
};
|
|
485
|
+
function useStyles() {
|
|
486
|
+
const { theme } = useTheme();
|
|
487
|
+
const [styles, setStyles] = createSignal(stylesFactory(theme()));
|
|
488
|
+
createEffect(() => {
|
|
489
|
+
setStyles(stylesFactory(theme()));
|
|
490
|
+
});
|
|
491
|
+
return styles;
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
//#endregion
|
|
495
|
+
export { useStyles };
|
|
496
|
+
//# sourceMappingURL=use-styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-styles.js","names":[],"sources":["../../src/styles/use-styles.ts"],"sourcesContent":["import * as goober from 'goober'\nimport { createEffect, createSignal } from 'solid-js'\nimport { useTheme } from '@tanstack/devtools-ui'\nimport { tokens } from './tokens'\n\nconst stylesFactory = (theme: 'light' | 'dark') => {\n const { colors, font, size, alpha, border } = tokens\n const { fontFamily, size: fontSize } = font\n const css = goober.css\n const t = (light: string, dark: string) => (theme === 'light' ? light : dark)\n\n return {\n mainContainer: css`\n display: flex;\n flex-direction: column;\n padding: ${size[2]};\n padding-top: 0;\n margin-top: ${size[2]};\n `,\n heldKeysBar: css`\n background: ${t(colors.gray[100], colors.darkGray[800])};\n border-radius: ${border.radius.lg};\n border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};\n display: flex;\n align-items: center;\n gap: ${size[3]};\n padding: ${size[3]} ${size[3]};\n flex-shrink: 0;\n min-height: 64px;\n margin-bottom: ${size[2]};\n `,\n heldKeysBarHeader: css`\n font-size: ${fontSize.sm};\n font-weight: ${font.weight.bold};\n color: ${t(colors.gray[600], colors.gray[400])};\n text-transform: uppercase;\n letter-spacing: 0.05em;\n flex-shrink: 0;\n `,\n heldKeysBarList: css`\n display: flex;\n align-items: center;\n gap: ${size[1.5]};\n flex-wrap: wrap;\n flex: 1;\n min-width: 0;\n `,\n panelsContainer: css`\n display: flex;\n `,\n dragHandle: css`\n width: 8px;\n background: ${t(colors.gray[300], colors.darkGray[600])};\n cursor: col-resize;\n position: relative;\n transition: all 0.2s ease;\n user-select: none;\n pointer-events: all;\n margin: 0 ${size[1]};\n border-radius: 2px;\n\n &:hover {\n background: ${t(colors.blue[600], colors.blue[500])};\n margin: 0 ${size[1]};\n }\n\n &.dragging {\n background: ${t(colors.blue[700], colors.blue[600])};\n margin: 0 ${size[1]};\n }\n\n &::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n width: 2px;\n height: 20px;\n background: ${t(colors.gray[400], colors.darkGray[400])};\n border-radius: 1px;\n pointer-events: none;\n }\n\n &:hover::after,\n &.dragging::after {\n background: ${t(colors.blue[500], colors.blue[300])};\n }\n `,\n keyCap: css`\n display: inline-flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n min-width: 36px;\n padding: ${size[1]} ${size[2]};\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.sm};\n font-weight: ${font.weight.bold};\n color: ${t(colors.gray[800], colors.gray[100])};\n background: ${t(colors.white, colors.darkGray[600])};\n border: 1px solid ${t(colors.gray[300], colors.darkGray[400])};\n border-bottom-width: 2px;\n border-radius: ${border.radius.sm};\n box-shadow: ${tokens.shadow.xs()};\n text-transform: capitalize;\n white-space: nowrap;\n line-height: 1.2;\n `,\n keyCapCode: css`\n font-size: ${fontSize['2xs']};\n font-weight: ${font.weight.normal};\n color: ${t(colors.gray[500], colors.gray[400])};\n text-transform: none;\n line-height: 1;\n margin-top: 2px;\n `,\n noKeysHeld: css`\n font-size: ${fontSize.sm};\n color: ${t(colors.gray[400], colors.gray[600])};\n font-style: italic;\n text-align: center;\n padding: ${size[1]};\n `,\n leftPanel: css`\n background: ${t(colors.gray[100], colors.darkGray[800])};\n border-radius: ${border.radius.lg};\n border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};\n display: flex;\n flex-direction: column;\n flex-shrink: 0;\n `,\n rightPanel: css`\n background: ${t(colors.gray[100], colors.darkGray[800])};\n border-radius: ${border.radius.lg};\n border: 1px solid ${t(colors.gray[200], colors.darkGray[700])};\n display: flex;\n flex-direction: column;\n flex: 1;\n `,\n panelHeader: css`\n font-size: ${fontSize.md};\n font-weight: ${font.weight.bold};\n color: ${t(colors.blue[700], colors.blue[400])};\n padding: ${size[2]};\n border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};\n background: ${t(colors.gray[100], colors.darkGray[800])};\n flex-shrink: 0;\n `,\n hotkeyList: css`\n padding: ${size[1]};\n `,\n hotkeyRow: css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ${size[2]};\n margin-bottom: ${size[1]};\n background: ${t(colors.gray[200], colors.darkGray[700])};\n border-radius: ${border.radius.md};\n cursor: pointer;\n transition: all 0.2s ease;\n border: 1px solid transparent;\n\n &:hover {\n background: ${t(colors.gray[300], colors.darkGray[600])};\n border-color: ${t(colors.gray[400], colors.darkGray[500])};\n }\n `,\n hotkeyRowSelected: css`\n background: ${t(colors.blue[100], colors.blue[900] + alpha[20])};\n border-color: ${t(colors.blue[600], colors.blue[500])};\n box-shadow: 0 0 0 1px\n ${t(colors.blue[600] + alpha[30], colors.blue[500] + alpha[30])};\n `,\n hotkeyRowTriggered: css`\n animation: hotkey-pulse 0.6s ease-out;\n\n @keyframes hotkey-pulse {\n 0% {\n border-color: ${t(colors.blue[500], colors.blue[400])};\n box-shadow: 0 0 0 2px\n ${t(colors.blue[500] + alpha[40], colors.blue[400] + alpha[40])};\n }\n 100% {\n border-color: transparent;\n box-shadow: 0 0 0 0px\n ${t(colors.blue[500] + '00', colors.blue[400] + '00')};\n }\n }\n `,\n hotkeyLabel: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.gray[900], colors.gray[100])};\n flex: 1;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n `,\n hotkeyBadges: css`\n display: flex;\n gap: ${size[1]};\n margin-left: ${size[1]};\n flex-shrink: 0;\n overflow: visible;\n `,\n badge: css`\n font-size: ${fontSize['2xs']};\n padding: ${size[0.5]} ${size[1]};\n border-radius: ${border.radius.sm};\n text-transform: uppercase;\n letter-spacing: 0.05em;\n white-space: nowrap;\n `,\n badgeEnabled: css`\n color: ${t(colors.green[700], colors.green[400])};\n background: ${t(colors.green[100], colors.green[900] + alpha[30])};\n `,\n badgeDisabled: css`\n color: ${t(colors.red[700], colors.red[400])};\n background: ${t(colors.red[100], colors.red[900] + alpha[30])};\n `,\n badgeKeydown: css`\n color: ${t(colors.purple[700], colors.purple[400])};\n background: ${t(colors.purple[100], colors.purple[900] + alpha[30])};\n `,\n badgeKeyup: css`\n color: ${t(colors.teal[700], colors.teal[400])};\n background: ${t(colors.teal[100], colors.teal[900] + alpha[30])};\n `,\n badgeTarget: css`\n color: ${t(colors.gray[700], colors.gray[300])};\n background: ${t(colors.gray[200], colors.darkGray[600])};\n `,\n badgeConflict: css`\n color: ${t(colors.yellow[700], colors.yellow[400])};\n background: ${t(colors.yellow[100], colors.yellow[900] + alpha[30])};\n `,\n badgeError: css`\n color: ${t(colors.red[700], colors.red[400])};\n background: ${t(colors.red[100], colors.red[900] + alpha[30])};\n `,\n badgeAllow: css`\n color: ${t(colors.gray[600], colors.gray[400])};\n background: ${t(colors.gray[200], colors.darkGray[600])};\n `,\n badgeInfo: css`\n color: ${t(colors.blue[700], colors.blue[400])};\n background: ${t(colors.blue[100], colors.blue[900] + alpha[30])};\n `,\n stateDetails: css`\n padding: ${size[2]};\n `,\n stateHeader: css`\n margin-bottom: ${size[2]};\n padding-bottom: ${size[2]};\n border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[700])};\n `,\n stateTitle: css`\n font-size: ${fontSize.md};\n font-weight: ${font.weight.bold};\n color: ${t(colors.blue[700], colors.blue[400])};\n margin-bottom: ${size[1]};\n `,\n detailsGrid: css`\n display: grid;\n grid-template-columns: 1fr;\n gap: ${size[2]};\n align-items: start;\n `,\n detailSection: css`\n background: ${t(colors.white, colors.darkGray[700])};\n border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};\n border-radius: ${border.radius.md};\n padding: ${size[2]};\n `,\n detailSectionHeader: css`\n font-size: ${fontSize.sm};\n font-weight: ${font.weight.bold};\n color: ${t(colors.gray[800], colors.gray[200])};\n margin-bottom: ${size[1]};\n text-transform: uppercase;\n letter-spacing: 0.04em;\n `,\n infoGrid: css`\n display: grid;\n grid-template-columns: auto 1fr;\n gap: ${size[1]};\n row-gap: ${size[1]};\n align-items: center;\n `,\n infoLabel: css`\n color: ${t(colors.gray[600], colors.gray[400])};\n font-size: ${fontSize.xs};\n text-transform: uppercase;\n letter-spacing: 0.05em;\n `,\n infoValueMono: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.gray[900], colors.gray[100])};\n word-break: break-all;\n `,\n actionsRow: css`\n display: flex;\n flex-wrap: wrap;\n gap: ${size[2]};\n `,\n actionButton: css`\n display: inline-flex;\n align-items: center;\n gap: ${size[1]};\n padding: ${size[1]} ${size[2]};\n border-radius: ${border.radius.md};\n border: 1px solid ${t(colors.gray[300], colors.darkGray[500])};\n background: ${t(colors.gray[200], colors.darkGray[600])};\n color: ${t(colors.gray[900], colors.gray[100])};\n font-size: ${fontSize.xs};\n cursor: pointer;\n user-select: none;\n transition:\n background 0.15s,\n border-color 0.15s;\n &:hover {\n background: ${t(colors.gray[300], colors.darkGray[500])};\n border-color: ${t(colors.gray[400], colors.darkGray[400])};\n }\n &:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n &:hover {\n background: ${t(colors.gray[200], colors.darkGray[600])};\n border-color: ${t(colors.gray[300], colors.darkGray[500])};\n }\n }\n `,\n actionDotGreen: css`\n width: 6px;\n height: 6px;\n border-radius: 9999px;\n background: ${colors.green[400]};\n `,\n noSelection: css`\n flex: 1;\n display: flex;\n align-items: center;\n justify-content: center;\n color: ${t(colors.gray[500], colors.gray[500])};\n font-style: italic;\n text-align: center;\n padding: ${size[4]};\n `,\n keyBreakdown: css`\n display: flex;\n flex-wrap: wrap;\n gap: ${size[1]};\n align-items: center;\n `,\n keyBreakdownPlus: css`\n color: ${t(colors.gray[500], colors.gray[400])};\n font-size: ${fontSize.sm};\n `,\n keyCapLarge: css`\n display: inline-flex;\n align-items: center;\n justify-content: center;\n min-width: 36px;\n padding: ${size[1]} ${size[2]};\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.sm};\n font-weight: ${font.weight.bold};\n color: ${t(colors.gray[800], colors.gray[100])};\n background: ${t(colors.white, colors.darkGray[600])};\n border: 1px solid ${t(colors.gray[300], colors.darkGray[400])};\n border-bottom-width: 3px;\n border-radius: ${border.radius.md};\n box-shadow: ${tokens.shadow.sm()};\n text-transform: capitalize;\n white-space: nowrap;\n `,\n conflictList: css`\n display: flex;\n flex-direction: column;\n gap: ${size[1]};\n `,\n conflictItem: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.yellow[700], colors.yellow[400])};\n padding: ${size[1]} ${size[2]};\n background: ${t(colors.yellow[50], colors.yellow[900] + alpha[20])};\n border-radius: ${border.radius.sm};\n border: 1px solid ${t(colors.yellow[200], colors.yellow[800] + alpha[30])};\n `,\n conflictItemAllow: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.gray[600], colors.gray[400])};\n padding: ${size[1]} ${size[2]};\n background: ${t(colors.gray[100], colors.darkGray[700])};\n border-radius: ${border.radius.sm};\n border: 1px solid ${t(colors.gray[300], colors.darkGray[600])};\n `,\n conflictItemError: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.red[700], colors.red[400])};\n padding: ${size[1]} ${size[2]};\n background: ${t(colors.red[50], colors.red[900] + alpha[20])};\n border-radius: ${border.radius.sm};\n border: 1px solid ${t(colors.red[200], colors.red[900] + alpha[30])};\n `,\n conflictItemScope: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize.xs};\n color: ${t(colors.blue[700], colors.blue[400])};\n padding: ${size[1]} ${size[2]};\n background: ${t(colors.blue[50], colors.blue[900] + alpha[20])};\n border-radius: ${border.radius.sm};\n border: 1px solid ${t(colors.blue[200], colors.blue[800] + alpha[30])};\n `,\n optionRow: css`\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: ${size[1]} 0;\n font-size: ${fontSize.xs};\n border-bottom: 1px solid ${t(colors.gray[200], colors.darkGray[600])};\n &:last-child {\n border-bottom: none;\n }\n `,\n optionLabel: css`\n color: ${t(colors.gray[600], colors.gray[400])};\n `,\n optionValue: css`\n font-family: ${fontFamily.mono};\n color: ${t(colors.gray[900], colors.gray[100])};\n `,\n optionValueTrue: css`\n font-family: ${fontFamily.mono};\n color: ${t(colors.green[600], colors.green[400])};\n `,\n optionValueFalse: css`\n font-family: ${fontFamily.mono};\n color: ${t(colors.red[600], colors.red[400])};\n `,\n tooltip: css`\n position: relative;\n &:hover > [data-tooltip] {\n opacity: 1;\n visibility: visible;\n }\n `,\n tooltipText: css`\n position: absolute;\n top: 100%;\n left: 50%;\n transform: translateX(-50%);\n padding: ${size[1]} ${size[1.5]};\n background: ${t(colors.gray[800], colors.darkGray[500])};\n color: ${t(colors.white, colors.gray[100])};\n font-size: ${fontSize['2xs']};\n border-radius: ${border.radius.sm};\n white-space: nowrap;\n pointer-events: none;\n opacity: 0;\n visibility: hidden;\n transition:\n opacity 0.15s,\n visibility 0.15s;\n z-index: ${tokens.zIndices.tooltip};\n margin-top: ${size[1]};\n `,\n triggerCount: css`\n font-family: ${fontFamily.mono};\n font-size: ${fontSize['2xs']};\n color: ${t(colors.gray[500], colors.gray[400])};\n margin-left: ${size[1]};\n flex-shrink: 0;\n `,\n }\n}\n\nexport function useStyles() {\n const { theme } = useTheme()\n const [styles, setStyles] = createSignal(stylesFactory(theme()))\n createEffect(() => {\n setStyles(stylesFactory(theme()))\n })\n return styles\n}\n"],"mappings":";;;;;;AAKA,MAAM,iBAAiB,UAA4B;CACjD,MAAM,EAAE,QAAQ,MAAM,MAAM,OAAO,WAAW;CAC9C,MAAM,EAAE,YAAY,MAAM,aAAa;CACvC,MAAM,MAAM,OAAO;CACnB,MAAM,KAAK,OAAe,SAAkB,UAAU,UAAU,QAAQ;AAExE,QAAO;EACL,eAAe,GAAG;;;iBAGL,KAAK,GAAG;;oBAEL,KAAK,GAAG;;EAExB,aAAa,GAAG;oBACA,EAAE,OAAO,KAAK,MAAM,OAAO,SAAS,KAAK,CAAC;uBACvC,OAAO,OAAO,GAAG;0BACd,EAAE,OAAO,KAAK,MAAM,OAAO,SAAS,KAAK,CAAC;;;aAGvD,KAAK,GAAG;iBACJ,KAAK,GAAG,GAAG,KAAK,GAAG;;;uBAGb,KAAK,GAAG;;EAE3B,mBAAmB,GAAG;mBACP,SAAS,GAAG;q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AG;iCACE,EAAE,OAAO,KAAK,MAAM,OAAO,SAAS,KAAK,CAAC;;;;;EAKvE,aAAa,GAAG;eACL,EAAE,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,CAAC;;EAEjD,aAAa,GAAG;qBACC,WAAW,KAAK;eACtB,EAAE,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,CAAC;;EAEjD,iBAAiB,GAAG;qBACH,WAAW,KAAK;eACtB,EAAE,OAAO,MAAM,MAAM,OAAO,MAAM,KAAK,CAAC;;EAEnD,kBAAkB,GAAG;qBACJ,WAAW,KAAK;eACtB,EAAE,OAAO,IAAI,MAAM,OAAO,IAAI,KAAK,CAAC;;EAE/C,SAAS,GAAG;;;;;;;EAOZ,aAAa,GAAG;;;;;iBAKH,KAAK,GAAG,GAAG,KAAK,KAAK;oBAClB,EAAE,OAAO,KAAK,MAAM,OAAO,SAAS,KAAK,CAAC;eAC/C,EAAE,OAAO,OAAO,OAAO,KAAK,KAAK,CAAC;mBAC9B,SAAS,OAAO;uBACZ,OAAO,OAAO,GAAG;;;;;;;;iBAQvB,OAAO,SAAS,QAAQ;oBACrB,KAAK,GAAG;;EAExB,cAAc,GAAG;qBACA,WAAW,KAAK;mBAClB,SAAS,OAAO;eACpB,EAAE,OAAO,KAAK,MAAM,OAAO,KAAK,KAAK,CAAC;qBAChC,KAAK,GAAG;;;EAG1B;;AAGH,SAAgB,YAAY;CAC1B,MAAM,EAAE,UAAU,UAAU;CAC5B,MAAM,CAAC,QAAQ,aAAa,aAAa,cAAc,OAAO,CAAC,CAAC;AAChE,oBAAmB;AACjB,YAAU,cAAc,OAAO,CAAC,CAAC;GACjC;AACF,QAAO"}
|
package/package.json
CHANGED
|
@@ -1,10 +1,62 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/hotkeys-devtools",
|
|
3
|
-
"version": "0.0
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Devtools for TanStack Hotkeys",
|
|
5
|
+
"author": "Tanner Linsley",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/TanStack/hotkeys.git",
|
|
10
|
+
"directory": "packages/hotkeys-devtools"
|
|
11
|
+
},
|
|
12
|
+
"homepage": "https://tanstack.com/hotkeys",
|
|
13
|
+
"funding": {
|
|
14
|
+
"type": "github",
|
|
15
|
+
"url": "https://github.com/sponsors/tannerlinsley"
|
|
16
|
+
},
|
|
5
17
|
"keywords": [
|
|
6
|
-
"
|
|
7
|
-
"
|
|
8
|
-
"
|
|
9
|
-
|
|
10
|
-
|
|
18
|
+
"tanstack",
|
|
19
|
+
"keys",
|
|
20
|
+
"devtools",
|
|
21
|
+
"hotkeys",
|
|
22
|
+
"keyboard"
|
|
23
|
+
],
|
|
24
|
+
"type": "module",
|
|
25
|
+
"types": "./dist/index.d.ts",
|
|
26
|
+
"exports": {
|
|
27
|
+
".": "./dist/index.js",
|
|
28
|
+
"./production": "./dist/production.js",
|
|
29
|
+
"./package.json": "./package.json"
|
|
30
|
+
},
|
|
31
|
+
"sideEffects": false,
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=18"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist/",
|
|
37
|
+
"src"
|
|
38
|
+
],
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@tanstack/hotkeys": "0.1.0"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@tanstack/devtools-ui": "^0.4.4",
|
|
44
|
+
"@tanstack/devtools-utils": "^0.3.0",
|
|
45
|
+
"clsx": "^2.1.1",
|
|
46
|
+
"goober": "^2.1.18",
|
|
47
|
+
"solid-js": "^1.9.11"
|
|
48
|
+
},
|
|
49
|
+
"devDependencies": {
|
|
50
|
+
"vite-plugin-solid": "^2.11.10"
|
|
51
|
+
},
|
|
52
|
+
"scripts": {
|
|
53
|
+
"clean": "premove ./build ./dist",
|
|
54
|
+
"lint": "eslint ./src",
|
|
55
|
+
"lint:fix": "eslint ./src --fix",
|
|
56
|
+
"test:eslint": "eslint ./src",
|
|
57
|
+
"test:lib": "vitest --passWithNoTests",
|
|
58
|
+
"test:lib:dev": "pnpm test:lib --watch",
|
|
59
|
+
"test:types": "tsc",
|
|
60
|
+
"build": "tsdown"
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createContext,
|
|
3
|
+
createEffect,
|
|
4
|
+
createSignal,
|
|
5
|
+
onCleanup,
|
|
6
|
+
useContext,
|
|
7
|
+
} from 'solid-js'
|
|
8
|
+
import { HotkeyManager, KeyStateTracker } from '@tanstack/hotkeys'
|
|
9
|
+
import type { Accessor } from 'solid-js'
|
|
10
|
+
import type { HotkeyRegistration } from '@tanstack/hotkeys'
|
|
11
|
+
|
|
12
|
+
interface HotkeysDevtoolsContextType {
|
|
13
|
+
registrations: Accessor<Array<HotkeyRegistration>>
|
|
14
|
+
heldKeys: Accessor<Array<string>>
|
|
15
|
+
heldCodes: Accessor<Record<string, string>>
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const HotkeysDevtoolsContext = createContext<HotkeysDevtoolsContextType>({
|
|
19
|
+
registrations: () => [],
|
|
20
|
+
heldKeys: () => [],
|
|
21
|
+
heldCodes: () => ({}),
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
export function HotkeysContextProvider(props: { children: any }) {
|
|
25
|
+
const manager = HotkeyManager.getInstance()
|
|
26
|
+
const tracker = KeyStateTracker.getInstance()
|
|
27
|
+
|
|
28
|
+
// Create local signals that will be updated by subscriptions
|
|
29
|
+
const [registrations, setRegistrations] = createSignal<
|
|
30
|
+
Array<HotkeyRegistration>
|
|
31
|
+
>(Array.from(manager.registrations.state.values()))
|
|
32
|
+
const [heldKeys, setHeldKeys] = createSignal<Array<string>>(
|
|
33
|
+
tracker.store.state.heldKeys,
|
|
34
|
+
)
|
|
35
|
+
const [heldCodes, setHeldCodes] = createSignal<Record<string, string>>(
|
|
36
|
+
tracker.store.state.heldCodes,
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
// Subscribe to HotkeyManager registrations store
|
|
40
|
+
createEffect(() => {
|
|
41
|
+
const unsubscribe = manager.registrations.subscribe(() => {
|
|
42
|
+
setRegistrations(Array.from(manager.registrations.state.values()))
|
|
43
|
+
})
|
|
44
|
+
onCleanup(() => unsubscribe())
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
// Subscribe to KeyStateTracker store
|
|
48
|
+
createEffect(() => {
|
|
49
|
+
const unsubscribe = tracker.store.subscribe(() => {
|
|
50
|
+
setHeldKeys(tracker.store.state.heldKeys)
|
|
51
|
+
setHeldCodes(tracker.store.state.heldCodes)
|
|
52
|
+
})
|
|
53
|
+
onCleanup(() => unsubscribe())
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<HotkeysDevtoolsContext.Provider
|
|
58
|
+
value={{ registrations, heldKeys, heldCodes }}
|
|
59
|
+
>
|
|
60
|
+
{props.children}
|
|
61
|
+
</HotkeysDevtoolsContext.Provider>
|
|
62
|
+
)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function useHotkeysDevtoolsState() {
|
|
66
|
+
return useContext(HotkeysDevtoolsContext)
|
|
67
|
+
}
|