@tanstack/devtools-ui 0.3.2 → 0.3.4

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.
Files changed (70) hide show
  1. package/dist/esm/components/header.d.ts +9 -0
  2. package/dist/esm/components/header.js +50 -0
  3. package/dist/esm/components/header.js.map +1 -0
  4. package/dist/esm/components/icons.d.ts +15 -0
  5. package/dist/esm/components/icons.js +61 -0
  6. package/dist/esm/components/icons.js.map +1 -0
  7. package/dist/esm/components/main-panel.js +1 -3
  8. package/dist/esm/components/main-panel.js.map +1 -1
  9. package/dist/esm/components/theme.d.ts +12 -0
  10. package/dist/esm/components/theme.js +30 -0
  11. package/dist/esm/components/theme.js.map +1 -0
  12. package/dist/esm/components/tree.d.ts +1 -0
  13. package/dist/esm/components/tree.js +219 -93
  14. package/dist/esm/components/tree.js.map +1 -1
  15. package/dist/esm/icons.d.ts +1 -0
  16. package/dist/esm/icons.js +17 -0
  17. package/dist/esm/icons.js.map +1 -0
  18. package/dist/esm/index.d.ts +2 -0
  19. package/dist/esm/index.js +7 -1
  20. package/dist/esm/index.js.map +1 -1
  21. package/dist/esm/styles/tokens.js +12 -2
  22. package/dist/esm/styles/tokens.js.map +1 -1
  23. package/dist/esm/styles/use-styles.d.ts +16 -2
  24. package/dist/esm/styles/use-styles.js +208 -68
  25. package/dist/esm/styles/use-styles.js.map +1 -1
  26. package/package.json +7 -6
  27. package/src/components/header.tsx +44 -0
  28. package/src/components/icons.tsx +1586 -0
  29. package/src/components/main-panel.tsx +6 -3
  30. package/src/components/theme.tsx +34 -0
  31. package/src/components/tree.tsx +148 -32
  32. package/src/icons.ts +1 -0
  33. package/src/index.ts +2 -0
  34. package/src/styles/use-styles.ts +212 -69
  35. package/dist/cjs/components/button.cjs +0 -23
  36. package/dist/cjs/components/button.cjs.map +0 -1
  37. package/dist/cjs/components/button.d.cts +0 -11
  38. package/dist/cjs/components/checkbox.cjs +0 -55
  39. package/dist/cjs/components/checkbox.cjs.map +0 -1
  40. package/dist/cjs/components/checkbox.d.cts +0 -8
  41. package/dist/cjs/components/input.cjs +0 -57
  42. package/dist/cjs/components/input.cjs.map +0 -1
  43. package/dist/cjs/components/input.d.cts +0 -10
  44. package/dist/cjs/components/logo.cjs +0 -95
  45. package/dist/cjs/components/logo.cjs.map +0 -1
  46. package/dist/cjs/components/logo.d.cts +0 -1
  47. package/dist/cjs/components/main-panel.cjs +0 -24
  48. package/dist/cjs/components/main-panel.cjs.map +0 -1
  49. package/dist/cjs/components/main-panel.d.cts +0 -8
  50. package/dist/cjs/components/section.cjs +0 -75
  51. package/dist/cjs/components/section.cjs.map +0 -1
  52. package/dist/cjs/components/section.d.cts +0 -5
  53. package/dist/cjs/components/select.cjs +0 -59
  54. package/dist/cjs/components/select.cjs.map +0 -1
  55. package/dist/cjs/components/select.d.cts +0 -13
  56. package/dist/cjs/components/tag.cjs +0 -40
  57. package/dist/cjs/components/tag.cjs.map +0 -1
  58. package/dist/cjs/components/tag.d.cts +0 -7
  59. package/dist/cjs/components/tree.cjs +0 -237
  60. package/dist/cjs/components/tree.cjs.map +0 -1
  61. package/dist/cjs/components/tree.d.cts +0 -3
  62. package/dist/cjs/index.cjs +0 -24
  63. package/dist/cjs/index.cjs.map +0 -1
  64. package/dist/cjs/index.d.cts +0 -9
  65. package/dist/cjs/styles/tokens.cjs +0 -184
  66. package/dist/cjs/styles/tokens.cjs.map +0 -1
  67. package/dist/cjs/styles/tokens.d.cts +0 -298
  68. package/dist/cjs/styles/use-styles.cjs +0 -461
  69. package/dist/cjs/styles/use-styles.cjs.map +0 -1
  70. package/dist/cjs/styles/use-styles.d.cts +0 -53
@@ -1,7 +1,9 @@
1
1
  import * as goober from 'goober'
2
- import { createSignal } from 'solid-js'
2
+ import { createEffect, createSignal } from 'solid-js'
3
+ import { useTheme } from '../components/theme'
3
4
  import { tokens } from './tokens'
4
5
  import type { ButtonVariant } from '../components/button'
6
+ import type { Theme } from '../components/theme'
5
7
 
6
8
  const buttonVariantColors: Record<
7
9
  ButtonVariant,
@@ -50,10 +52,11 @@ const buttonVariantColors: Record<
50
52
  border: tokens.colors.green[500],
51
53
  },
52
54
  }
53
- const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
54
- const { colors, font, size, alpha } = tokens
55
+ export const css = goober.css
56
+ const stylesFactory = (theme: Theme = 'dark') => {
57
+ const { colors, font, size, alpha, border } = tokens
55
58
  const { fontFamily } = font
56
- const css = goober.css
59
+
57
60
  const t = (light: string, dark: string) => (theme === 'light' ? light : dark)
58
61
 
59
62
  return {
@@ -86,12 +89,12 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
86
89
  selectLabel: css`
87
90
  font-size: 0.875rem;
88
91
  font-weight: 500;
89
- color: ${colors.gray[100]};
92
+ color: ${t(colors.gray[900], colors.gray[100])};
90
93
  text-align: left;
91
94
  `,
92
95
  selectDescription: css`
93
96
  font-size: 0.8rem;
94
- color: ${colors.gray[400]};
97
+ color: ${t(colors.gray[500], colors.gray[400])};
95
98
  margin: 0;
96
99
  line-height: 1.3;
97
100
  text-align: left;
@@ -101,9 +104,9 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
101
104
  width: 100%;
102
105
  padding: 0.75rem 3rem 0.75rem 0.75rem;
103
106
  border-radius: 0.5rem;
104
- background-color: ${colors.darkGray[800]};
105
- color: ${colors.gray[100]};
106
- border: 1px solid ${colors.gray[700]};
107
+ background-color: ${t(colors.gray[50], colors.darkGray[800])};
108
+ color: ${t(colors.gray[900], colors.gray[100])};
109
+ border: 1px solid ${t(colors.gray[300], colors.gray[700])};
107
110
  font-size: 0.875rem;
108
111
  transition: all 0.2s ease;
109
112
  cursor: pointer;
@@ -115,7 +118,7 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
115
118
  background-size: 1.25rem;
116
119
 
117
120
  &:hover {
118
- border-color: ${colors.gray[600]};
121
+ border-color: ${t(colors.gray[400], colors.gray[600])};
119
122
  }
120
123
 
121
124
  &:focus {
@@ -137,12 +140,12 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
137
140
  inputLabel: css`
138
141
  font-size: 0.875rem;
139
142
  font-weight: 500;
140
- color: ${colors.gray[100]};
143
+ color: ${t(colors.gray[900], colors.gray[100])};
141
144
  text-align: left;
142
145
  `,
143
146
  inputDescription: css`
144
147
  font-size: 0.8rem;
145
- color: ${colors.gray[400]};
148
+ color: ${t(colors.gray[500], colors.gray[400])};
146
149
  margin: 0;
147
150
  line-height: 1.3;
148
151
  text-align: left;
@@ -152,25 +155,26 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
152
155
  width: 100%;
153
156
  padding: 0.75rem;
154
157
  border-radius: 0.5rem;
155
- background-color: ${colors.darkGray[800]};
156
- color: ${colors.gray[100]};
157
- border: 1px solid ${colors.gray[700]};
158
+ background-color: ${t(colors.gray[50], colors.darkGray[800])};
159
+ color: ${t(colors.gray[900], colors.gray[100])};
160
+ border: 1px solid ${t(colors.gray[300], colors.gray[700])};
158
161
  font-size: 0.875rem;
159
162
  font-family: ${fontFamily.mono};
160
163
  transition: all 0.2s ease;
161
164
 
162
165
  &::placeholder {
163
- color: ${colors.gray[500]};
166
+ color: ${t(colors.gray[400], colors.gray[500])};
164
167
  }
165
168
 
166
169
  &:hover {
167
- border-color: ${colors.gray[600]};
170
+ border-color: ${t(colors.gray[400], colors.gray[600])};
168
171
  }
169
172
 
170
173
  &:focus {
171
174
  outline: none;
172
- border-color: ${colors.purple[400]};
173
- box-shadow: 0 0 0 3px ${colors.purple[400]}${alpha[20]};
175
+ border-color: ${t(colors.purple[500], colors.purple[400])};
176
+ box-shadow: 0 0 0 3px
177
+ ${t(colors.purple[100] + alpha[20], colors.purple[400] + alpha[20])};
174
178
  }
175
179
  `,
176
180
  checkboxWrapper: css`
@@ -184,7 +188,7 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
184
188
  transition: background-color 0.2s ease;
185
189
 
186
190
  &:hover {
187
- background-color: ${colors.darkGray[800]};
191
+ background-color: ${t(colors.gray[100], colors.darkGray[800])};
188
192
  }
189
193
  `,
190
194
  checkboxContainer: css`
@@ -200,9 +204,9 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
200
204
  appearance: none;
201
205
  width: 1.25rem;
202
206
  height: 1.25rem;
203
- border: 2px solid ${colors.gray[700]};
207
+ border: 2px solid ${t(colors.gray[300], colors.gray[700])};
204
208
  border-radius: 0.375rem;
205
- background-color: ${colors.darkGray[800]};
209
+ background-color: ${t(colors.gray[50], colors.darkGray[800])};
206
210
  display: grid;
207
211
  place-items: center;
208
212
  transition: all 0.2s ease;
@@ -210,33 +214,33 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
210
214
  margin-top: 0.125rem;
211
215
 
212
216
  &:hover {
213
- border-color: ${colors.purple[400]};
217
+ border-color: ${t(colors.purple[500], colors.purple[400])};
214
218
  }
215
219
 
216
220
  &:checked {
217
- background-color: ${colors.purple[500]};
218
- border-color: ${colors.purple[500]};
221
+ background-color: ${t(colors.purple[500], colors.purple[700])};
222
+ border-color: ${t(colors.purple[500], colors.purple[700])};
219
223
  }
220
224
 
221
225
  &:checked::after {
222
226
  content: '';
223
227
  width: 0.4rem;
224
228
  height: 0.6rem;
225
- border: solid white;
229
+ border: solid ${t('#fff', colors.gray[100])};
226
230
  border-width: 0 2px 2px 0;
227
231
  transform: rotate(45deg);
228
232
  margin-top: -3px;
229
233
  }
230
234
  `,
231
235
  checkboxLabel: css`
232
- color: ${colors.gray[100]};
236
+ color: ${t(colors.gray[900], colors.gray[100])};
233
237
  font-size: 0.875rem;
234
238
  font-weight: 500;
235
239
  line-height: 1.4;
236
240
  text-align: left;
237
241
  `,
238
242
  checkboxDescription: css`
239
- color: ${colors.gray[400]};
243
+ color: ${t(colors.gray[500], colors.gray[400])};
240
244
  font-size: 0.8rem;
241
245
  line-height: 1.3;
242
246
  text-align: left;
@@ -266,43 +270,43 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
266
270
  if (ghost) {
267
271
  return css`
268
272
  background: transparent;
269
- color: ${v.bg};
273
+ color: ${t(v.bg, v.bg)};
270
274
  border-color: transparent;
271
275
  &:hover {
272
- background: ${tokens.colors.purple[100]};
276
+ background: ${t(colors.purple[100], colors.darkGray[700])};
273
277
  }
274
278
  &:active {
275
- background: ${tokens.colors.purple[200]};
279
+ background: ${t(colors.purple[200], colors.darkGray[800])};
276
280
  }
277
281
  `
278
282
  }
279
283
  if (outline) {
280
284
  return css`
281
285
  background: transparent;
282
- color: ${v.bg};
283
- border-color: ${v.bg};
286
+ color: ${t(v.bg, v.bg)};
287
+ border-color: ${t(v.bg, v.bg)};
284
288
  &:hover {
285
- background: ${tokens.colors.purple[100]};
286
- border-color: ${v.hover};
289
+ background: ${t(colors.purple[100], colors.darkGray[700])};
290
+ border-color: ${t(v.hover, v.hover)};
287
291
  }
288
292
  &:active {
289
- background: ${tokens.colors.purple[200]};
290
- border-color: ${v.active};
293
+ background: ${t(colors.purple[200], colors.darkGray[800])};
294
+ border-color: ${t(v.active, v.active)};
291
295
  }
292
296
  `
293
297
  }
294
298
  // Default solid button
295
299
  return css`
296
- background: ${v.bg};
297
- color: ${v.text};
298
- border-color: ${v.border};
300
+ background: ${t(v.bg, v.bg)};
301
+ color: ${t(v.text, v.text)};
302
+ border-color: ${t(v.border, v.border)};
299
303
  &:hover {
300
- background: ${v.hover};
301
- border-color: ${v.hover};
304
+ background: ${t(v.hover, v.hover)};
305
+ border-color: ${t(v.hover, v.hover)};
302
306
  }
303
307
  &:active {
304
- background: ${v.active};
305
- border-color: ${v.active};
308
+ background: ${t(v.active, v.active)};
309
+ border-color: ${t(v.active, v.active)};
306
310
  }
307
311
  `
308
312
  },
@@ -312,7 +316,10 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
312
316
  width: ${tokens.size[1.5]};
313
317
  height: ${tokens.size[1.5]};
314
318
  border-radius: ${tokens.border.radius.full};
315
- background-color: ${tokens.colors[color][500]};
319
+ background-color: ${t(
320
+ tokens.colors[color][500],
321
+ tokens.colors[color][500],
322
+ )};
316
323
  `,
317
324
  base: css`
318
325
  display: flex;
@@ -332,7 +339,7 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
332
339
  position: relative;
333
340
  &:focus-visible {
334
341
  outline-offset: 2px;
335
- outline: 2px solid ${colors.blue[800]};
342
+ outline: 2px solid ${t(colors.blue[700], colors.blue[800])};
336
343
  }
337
344
  `,
338
345
  label: css`
@@ -352,36 +359,102 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
352
359
  `,
353
360
  },
354
361
  tree: {
362
+ info: css`
363
+ color: ${t(colors.gray[500], colors.gray[500])};
364
+ font-size: ${font.size.xs};
365
+ margin-right: ${size[1]};
366
+ `,
367
+ actionButton: css`
368
+ background-color: transparent;
369
+ color: ${t(colors.gray[500], colors.gray[500])};
370
+ border: none;
371
+ display: inline-flex;
372
+ padding: 0px;
373
+ align-items: center;
374
+ justify-content: center;
375
+ cursor: pointer;
376
+ width: ${size[3]};
377
+ height: ${size[3]};
378
+ position: relative;
379
+ z-index: 1;
380
+
381
+ &:hover svg {
382
+ color: ${t(colors.gray[600], colors.gray[400])};
383
+ }
384
+
385
+ &:focus-visible {
386
+ border-radius: ${border.radius.xs};
387
+ outline: 2px solid ${t(colors.blue[700], colors.blue[800])};
388
+ outline-offset: 2px;
389
+ }
390
+ `,
391
+ expanderContainer: css`
392
+ position: relative;
393
+ `,
394
+ expander: css`
395
+ position: absolute;
396
+ left: -16px;
397
+ top: 3px;
398
+ & path {
399
+ stroke: ${t(colors.blue[400], colors.blue[300])};
400
+ }
401
+ & svg {
402
+ width: ${size[3]};
403
+ height: ${size[3]};
404
+ }
405
+
406
+ display: inline-flex;
407
+ align-items: center;
408
+ transition: all 0.1s ease;
409
+ `,
410
+ expandedLine: (hasBorder: boolean) => css`
411
+ display: block;
412
+ padding-left: 0.75rem;
413
+ margin-left: -0.7rem;
414
+ ${hasBorder
415
+ ? `border-left: 1px solid ${t(colors.blue[400], colors.blue[300])};`
416
+ : ''}
417
+ `,
355
418
  collapsible: css`
356
419
  cursor: pointer;
357
420
  transition: all 0.2s ease;
358
421
  &:hover {
359
- background-color: ${colors.darkGray[700]};
422
+ background-color: ${t(colors.gray[100], colors.darkGray[700])};
360
423
  border-radius: ${tokens.border.radius.sm};
361
424
  padding: 0 ${tokens.size[1]};
362
425
  }
363
426
  `,
427
+ actions: css`
428
+ display: inline-flex;
429
+ margin-left: ${size[2]};
430
+ gap: ${size[2]};
431
+ align-items: center;
432
+ & svg {
433
+ height: 12px;
434
+ width: 12px;
435
+ }
436
+ `,
364
437
  valueCollapsed: css`
365
- color: ${colors.gray[400]};
438
+ color: ${t(colors.gray[500], colors.gray[400])};
366
439
  `,
367
440
  valueFunction: css`
368
- color: ${colors.cyan[400]};
441
+ color: ${t(colors.cyan[500], colors.cyan[400])};
369
442
  `,
370
443
  valueString: css`
371
- color: ${colors.green[400]};
444
+ color: ${t(colors.green[500], colors.green[400])};
372
445
  `,
373
446
  valueNumber: css`
374
- color: ${colors.yellow[400]};
447
+ color: ${t(colors.yellow[500], colors.yellow[400])};
375
448
  `,
376
449
  valueBoolean: css`
377
- color: ${colors.pink[400]};
450
+ color: ${t(colors.pink[500], colors.pink[400])};
378
451
  `,
379
452
  valueNull: css`
380
- color: ${colors.gray[400]};
453
+ color: ${t(colors.gray[500], colors.gray[400])};
381
454
  font-style: italic;
382
455
  `,
383
456
  valueKey: css`
384
- color: ${colors.blue[300]};
457
+ color: ${t(colors.blue[400], colors.blue[300])};
385
458
  `,
386
459
  valueBraces: css`
387
460
  color: ${colors.gray[500]};
@@ -389,24 +462,93 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
389
462
  valueContainer: (isRoot: boolean) => css`
390
463
  display: block;
391
464
  margin-left: ${isRoot ? '0' : '1rem'};
465
+
466
+ &:not(:hover) .actions {
467
+ display: none;
468
+ }
469
+
470
+ &:hover .actions {
471
+ display: inline-flex;
472
+ }
473
+ `,
474
+ },
475
+ header: {
476
+ row: css`
477
+ display: flex;
478
+ justify-content: space-between;
479
+ align-items: center;
480
+ padding: ${tokens.size[2]} ${tokens.size[2.5]};
481
+ gap: ${tokens.size[2.5]};
482
+ border-bottom: ${t(colors.gray[300], colors.darkGray[500])} 1px solid;
483
+ align-items: center;
484
+ `,
485
+ logoAndToggleContainer: css`
486
+ display: flex;
487
+ gap: ${tokens.size[3]};
488
+ align-items: center;
489
+ & > button {
490
+ padding: 0;
491
+ background: transparent;
492
+ border: none;
493
+ display: flex;
494
+ gap: ${size[0.5]};
495
+ flex-direction: column;
496
+ }
497
+ `,
498
+ logo: css`
499
+ cursor: pointer;
500
+ display: flex;
501
+ flex-direction: column;
502
+ background-color: transparent;
503
+ border: none;
504
+ gap: ${tokens.size[0.5]};
505
+ padding: 0px;
506
+ &:hover {
507
+ opacity: 0.7;
508
+ }
509
+ &:focus-visible {
510
+ outline-offset: 4px;
511
+ border-radius: ${border.radius.xs};
512
+ outline: 2px solid ${colors.blue[800]};
513
+ }
514
+ `,
515
+ tanstackLogo: css`
516
+ font-size: ${font.size.md};
517
+ font-weight: ${font.weight.bold};
518
+ line-height: ${font.lineHeight.xs};
519
+ white-space: nowrap;
520
+ color: ${t(colors.gray[700], colors.gray[300])};
521
+ `,
522
+ flavorLogo: (flavorLight: string, flavorDark: string) => css`
523
+ font-weight: ${font.weight.semibold};
524
+ font-size: ${font.size.xs};
525
+ background: linear-gradient(to right, ${t(flavorLight, flavorDark)});
526
+ background-clip: text;
527
+ -webkit-background-clip: text;
528
+ line-height: 1;
529
+ -webkit-text-fill-color: transparent;
530
+ white-space: nowrap;
392
531
  `,
393
532
  },
394
533
  section: {
395
534
  main: css`
396
535
  margin-bottom: 2rem;
397
536
  padding: 1.5rem;
398
- background-color: ${colors.darkGray[800]};
399
- border: 1px solid ${colors.gray[700]};
537
+ background-color: ${t(colors.gray[50], colors.darkGray[800])};
538
+ border: 1px solid ${t(colors.gray[300], colors.gray[700])};
400
539
  border-radius: 0.75rem;
401
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
540
+ box-shadow: ${t(
541
+ '0 1px 3px rgba(0,0,0,0.06)',
542
+ '0 1px 3px rgba(0,0,0,0.18)',
543
+ )};
402
544
  `,
403
545
  title: css`
404
546
  font-size: 1.125rem;
405
547
  font-weight: 600;
406
- color: ${colors.gray[100]};
548
+ color: ${t(colors.gray[900], colors.gray[100])};
407
549
  margin: 0 0 1rem 0;
408
550
  padding-bottom: 0.5rem;
409
- border-bottom: 1px solid ${colors.gray[700]};
551
+ border-bottom: 1px solid ${t(colors.gray[300], colors.gray[700])};
410
552
  display: flex;
411
553
  align-items: center;
412
554
  gap: 0.5rem;
@@ -419,10 +561,10 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
419
561
  height: 100%;
420
562
  width: 100%;
421
563
  }
422
- color: ${colors.purple[400]};
564
+ color: ${t(colors.purple[500], colors.purple[400])};
423
565
  `,
424
566
  description: css`
425
- color: ${colors.gray[400]};
567
+ color: ${t(colors.gray[500], colors.gray[400])};
426
568
  font-size: 0.875rem;
427
569
  margin: 0 0 1.5rem 0;
428
570
  line-height: 1.5;
@@ -430,20 +572,21 @@ const stylesFactory = (theme: 'light' | 'dark' = 'dark') => {
430
572
  `,
431
573
  },
432
574
  mainPanel: {
433
- panel: css`
434
- padding: 0;
435
- background: ${colors.darkGray[700]};
575
+ panel: (withPadding: boolean) => css`
576
+ padding: ${withPadding ? tokens.size[4] : 0};
577
+ background: ${t(colors.gray[50], colors.darkGray[700])};
436
578
  overflow-y: auto;
437
579
  height: 100%;
438
580
  `,
439
- withPadding: css`
440
- padding: ${tokens.size[4]};
441
- `,
442
581
  },
443
582
  }
444
583
  }
445
584
 
446
585
  export function useStyles() {
447
- const [_styles] = createSignal(stylesFactory())
448
- return _styles
586
+ const { theme } = useTheme()
587
+ const [styles, setStyles] = createSignal(stylesFactory(theme()))
588
+ createEffect(() => {
589
+ setStyles(stylesFactory(theme()))
590
+ })
591
+ return styles
449
592
  }
@@ -1,23 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const web = require("solid-js/web");
4
- const solidJs = require("solid-js");
5
- const clsx = require("clsx");
6
- const useStyles = require("../styles/use-styles.cjs");
7
- var _tmpl$ = /* @__PURE__ */ web.template(`<button>`);
8
- function Button(props) {
9
- const styles = useStyles.useStyles();
10
- const [local, rest] = solidJs.splitProps(props, ["variant", "outline", "ghost", "children", "className"]);
11
- const variant = local.variant || "primary";
12
- const classes = clsx(styles().button.base, styles().button.variant(variant, local.outline, local.ghost), local.className);
13
- return (() => {
14
- var _el$ = _tmpl$();
15
- web.spread(_el$, web.mergeProps(rest, {
16
- "class": classes
17
- }), false, true);
18
- web.insert(_el$, () => local.children);
19
- return _el$;
20
- })();
21
- }
22
- exports.Button = Button;
23
- //# sourceMappingURL=button.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"button.cjs","sources":["../../../src/components/button.tsx"],"sourcesContent":["import { splitProps } from 'solid-js'\nimport clsx from 'clsx'\nimport { useStyles } from '../styles/use-styles'\nimport type { JSX } from 'solid-js'\n\nexport type ButtonVariant =\n | 'primary'\n | 'secondary'\n | 'danger'\n | 'success'\n | 'info'\n | 'warning'\ntype ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {\n variant?: ButtonVariant\n outline?: boolean\n ghost?: boolean\n children?: any\n className?: string\n}\n\nexport function Button(props: ButtonProps) {\n const styles = useStyles()\n const [local, rest] = splitProps(props, [\n 'variant',\n 'outline',\n 'ghost',\n 'children',\n 'className',\n ])\n const variant = local.variant || 'primary'\n const classes = clsx(\n styles().button.base,\n styles().button.variant(variant, local.outline, local.ghost),\n local.className,\n )\n\n return (\n <button {...rest} class={classes}>\n {local.children}\n </button>\n )\n}\n"],"names":["Button","props","styles","useStyles","local","rest","splitProps","variant","classes","clsx","button","base","outline","ghost","className","_el$","_tmpl$","_$spread","_$mergeProps","_$insert","children"],"mappings":";;;;;;;AAoBO,SAASA,OAAOC,OAAoB;AACzC,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,OAAOC,IAAI,IAAIC,QAAAA,WAAWL,OAAO,CACtC,WACA,WACA,SACA,YACA,WAAW,CACZ;AACD,QAAMM,UAAUH,MAAMG,WAAW;AACjC,QAAMC,UAAUC,KACdP,OAAAA,EAASQ,OAAOC,MAChBT,SAASQ,OAAOH,QAAQA,SAASH,MAAMQ,SAASR,MAAMS,KAAK,GAC3DT,MAAMU,SACR;AAEA,UAAA,MAAA;AAAA,QAAAC,OAAAC,OAAAA;AAAAC,eAAAF,MAAAG,IAAAA,WACcb,MAAI;AAAA,MAAA,SAASG;AAAAA,IAAAA,CAAO,GAAA,OAAA,IAAA;AAAAW,QAAAA,OAAAJ,MAAA,MAC7BX,MAAMgB,QAAQ;AAAA,WAAAL;AAAAA,EAAA,GAAA;AAGrB;;"}
@@ -1,11 +0,0 @@
1
- import { JSX } from 'solid-js';
2
- export type ButtonVariant = 'primary' | 'secondary' | 'danger' | 'success' | 'info' | 'warning';
3
- type ButtonProps = JSX.ButtonHTMLAttributes<HTMLButtonElement> & {
4
- variant?: ButtonVariant;
5
- outline?: boolean;
6
- ghost?: boolean;
7
- children?: any;
8
- className?: string;
9
- };
10
- export declare function Button(props: ButtonProps): JSX.Element;
11
- export {};
@@ -1,55 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const web = require("solid-js/web");
4
- const solidJs = require("solid-js");
5
- const useStyles = require("../styles/use-styles.cjs");
6
- var _tmpl$ = /* @__PURE__ */ web.template(`<div><label><input type=checkbox><div>`), _tmpl$2 = /* @__PURE__ */ web.template(`<span>`);
7
- function Checkbox(props) {
8
- const styles = useStyles.useStyles();
9
- const [isChecked, setIsChecked] = solidJs.createSignal(props.checked || false);
10
- const handleChange = (e) => {
11
- const checked = e.target.checked;
12
- setIsChecked(checked);
13
- props.onChange?.(checked);
14
- };
15
- return (() => {
16
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild, _el$4 = _el$3.nextSibling;
17
- _el$3.$$input = handleChange;
18
- web.insert(_el$4, (() => {
19
- var _c$ = web.memo(() => !!props.label);
20
- return () => _c$() && (() => {
21
- var _el$5 = _tmpl$2();
22
- web.insert(_el$5, () => props.label);
23
- web.effect(() => web.className(_el$5, styles().checkboxLabel));
24
- return _el$5;
25
- })();
26
- })(), null);
27
- web.insert(_el$4, (() => {
28
- var _c$2 = web.memo(() => !!props.description);
29
- return () => _c$2() && (() => {
30
- var _el$6 = _tmpl$2();
31
- web.insert(_el$6, () => props.description);
32
- web.effect(() => web.className(_el$6, styles().checkboxDescription));
33
- return _el$6;
34
- })();
35
- })(), null);
36
- web.effect((_p$) => {
37
- var _v$ = styles().checkboxContainer, _v$2 = styles().checkboxWrapper, _v$3 = styles().checkbox, _v$4 = styles().checkboxLabelContainer;
38
- _v$ !== _p$.e && web.className(_el$, _p$.e = _v$);
39
- _v$2 !== _p$.t && web.className(_el$2, _p$.t = _v$2);
40
- _v$3 !== _p$.a && web.className(_el$3, _p$.a = _v$3);
41
- _v$4 !== _p$.o && web.className(_el$4, _p$.o = _v$4);
42
- return _p$;
43
- }, {
44
- e: void 0,
45
- t: void 0,
46
- a: void 0,
47
- o: void 0
48
- });
49
- web.effect(() => _el$3.checked = isChecked());
50
- return _el$;
51
- })();
52
- }
53
- web.delegateEvents(["input"]);
54
- exports.Checkbox = Checkbox;
55
- //# sourceMappingURL=checkbox.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"checkbox.cjs","sources":["../../../src/components/checkbox.tsx"],"sourcesContent":["import { createSignal } from 'solid-js'\nimport { useStyles } from '../styles/use-styles'\n\ninterface CheckboxProps {\n label?: string\n checked?: boolean\n onChange?: (checked: boolean) => void\n description?: string\n}\n\nexport function Checkbox(props: CheckboxProps) {\n const styles = useStyles()\n const [isChecked, setIsChecked] = createSignal(props.checked || false)\n\n const handleChange = (e: Event) => {\n const checked = (e.target as HTMLInputElement).checked\n setIsChecked(checked)\n props.onChange?.(checked)\n }\n\n return (\n <div class={styles().checkboxContainer}>\n <label class={styles().checkboxWrapper}>\n <input\n type=\"checkbox\"\n checked={isChecked()}\n class={styles().checkbox}\n onInput={handleChange}\n />\n <div class={styles().checkboxLabelContainer}>\n {props.label && (\n <span class={styles().checkboxLabel}>{props.label}</span>\n )}\n {props.description && (\n <span class={styles().checkboxDescription}>\n {props.description}\n </span>\n )}\n </div>\n </label>\n </div>\n )\n}\n"],"names":["Checkbox","props","styles","useStyles","isChecked","setIsChecked","createSignal","checked","handleChange","e","target","onChange","_el$","_tmpl$","_el$2","firstChild","_el$3","_el$4","nextSibling","$$input","_$insert","_c$","_$memo","label","_el$5","_tmpl$2","_$effect","_$className","checkboxLabel","_c$2","description","_el$6","checkboxDescription","_p$","_v$","checkboxContainer","_v$2","checkboxWrapper","_v$3","checkbox","_v$4","checkboxLabelContainer","t","a","o","undefined","_$delegateEvents"],"mappings":";;;;;;AAUO,SAASA,SAASC,OAAsB;AAC7C,QAAMC,SAASC,UAAAA,UAAAA;AACf,QAAM,CAACC,WAAWC,YAAY,IAAIC,QAAAA,aAAaL,MAAMM,WAAW,KAAK;AAErE,QAAMC,eAAeA,CAACC,MAAa;AACjC,UAAMF,UAAWE,EAAEC,OAA4BH;AAC/CF,iBAAaE,OAAO;AACpBN,UAAMU,WAAWJ,OAAO;AAAA,EAC1B;AAEA,UAAA,MAAA;AAAA,QAAAK,OAAAC,UAAAC,QAAAF,KAAAG,YAAAC,QAAAF,MAAAC,YAAAE,QAAAD,MAAAE;AAAAF,UAAAG,UAOiBX;AAAYY,QAAAA,OAAAH,QAAA,MAAA;AAAA,UAAAI,MAAAC,IAAAA,KAAA,MAAA,CAAA,CAGpBrB,MAAMsB,KAAK;AAAA,aAAA,MAAXF,IAAAA,MAAA,MAAA;AAAA,YAAAG,QAAAC,QAAAA;AAAAL,YAAAA,OAAAI,OAAA,MACuCvB,MAAMsB,KAAK;AAAAG,YAAAA,OAAA,MAAAC,IAAAA,UAAAH,OAApCtB,OAAAA,EAAS0B,aAAa,CAAA;AAAA,eAAAJ;AAAAA,MAAA,GAAA;AAAA,IACpC,GAAA,GAAA,IAAA;AAAAJ,QAAAA,OAAAH,QAAA,MAAA;AAAA,UAAAY,OAAAP,IAAAA,KAAA,MAAA,CAAA,CACArB,MAAM6B,WAAW;AAAA,aAAA,MAAjBD,KAAAA,MAAA,MAAA;AAAA,YAAAE,QAAAN,QAAAA;AAAAL,YAAAA,OAAAW,OAAA,MAEI9B,MAAM6B,WAAW;AAAAJ,YAAAA,OAAA,MAAAC,IAAAA,UAAAI,OADP7B,OAAAA,EAAS8B,mBAAmB,CAAA;AAAA,eAAAD;AAAAA,MAAA,GAAA;AAAA,IAG1C,GAAA,GAAA,IAAA;AAAAL,QAAAA,OAAAO,CAAAA,QAAA;AAAA,UAAAC,MAhBKhC,OAAAA,EAASiC,mBAAiBC,OACtBlC,OAAAA,EAASmC,iBAAeC,OAI3BpC,OAAAA,EAASqC,UAAQC,OAGdtC,SAASuC;AAAsBP,cAAAD,IAAAxB,KAAAkB,IAAAA,UAAAf,MAAAqB,IAAAxB,IAAAyB,GAAA;AAAAE,eAAAH,IAAAS,KAAAf,IAAAA,UAAAb,OAAAmB,IAAAS,IAAAN,IAAA;AAAAE,eAAAL,IAAAU,KAAAhB,IAAAA,UAAAX,OAAAiB,IAAAU,IAAAL,IAAA;AAAAE,eAAAP,IAAAW,KAAAjB,IAAAA,UAAAV,OAAAgB,IAAAW,IAAAJ,IAAA;AAAA,aAAAP;AAAAA,IAAA,GAAA;AAAA,MAAAxB,GAAAoC;AAAAA,MAAAH,GAAAG;AAAAA,MAAAF,GAAAE;AAAAA,MAAAD,GAAAC;AAAAA,IAAAA,CAAA;AAAAnB,QAAAA,aAAAV,MAAAT,UAJhCH,UAAAA,CAAW;AAAA,WAAAQ;AAAAA,EAAA,GAAA;AAiB9B;AAACkC,IAAAA,eAAA,CAAA,OAAA,CAAA;;"}
@@ -1,8 +0,0 @@
1
- interface CheckboxProps {
2
- label?: string;
3
- checked?: boolean;
4
- onChange?: (checked: boolean) => void;
5
- description?: string;
6
- }
7
- export declare function Checkbox(props: CheckboxProps): import("solid-js").JSX.Element;
8
- export {};
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const web = require("solid-js/web");
4
- const solidJs = require("solid-js");
5
- const useStyles = require("../styles/use-styles.cjs");
6
- var _tmpl$ = /* @__PURE__ */ web.template(`<div><div><input>`), _tmpl$2 = /* @__PURE__ */ web.template(`<label>`), _tmpl$3 = /* @__PURE__ */ web.template(`<p>`);
7
- function Input(props) {
8
- const styles = useStyles.useStyles();
9
- const [val, setVal] = solidJs.createSignal(props.value || "");
10
- const handleChange = (e) => {
11
- const value = e.target.value;
12
- setVal((prev) => prev !== value ? value : prev);
13
- props.onChange?.(value);
14
- };
15
- return (() => {
16
- var _el$ = _tmpl$(), _el$2 = _el$.firstChild, _el$3 = _el$2.firstChild;
17
- web.insert(_el$2, (() => {
18
- var _c$ = web.memo(() => !!props.label);
19
- return () => _c$() && (() => {
20
- var _el$4 = _tmpl$2();
21
- web.insert(_el$4, () => props.label);
22
- web.effect(() => web.className(_el$4, styles().inputLabel));
23
- return _el$4;
24
- })();
25
- })(), _el$3);
26
- web.insert(_el$2, (() => {
27
- var _c$2 = web.memo(() => !!props.description);
28
- return () => _c$2() && (() => {
29
- var _el$5 = _tmpl$3();
30
- web.insert(_el$5, () => props.description);
31
- web.effect(() => web.className(_el$5, styles().inputDescription));
32
- return _el$5;
33
- })();
34
- })(), _el$3);
35
- _el$3.$$input = handleChange;
36
- web.effect((_p$) => {
37
- var _v$ = styles().inputContainer, _v$2 = styles().inputWrapper, _v$3 = props.type || "text", _v$4 = styles().input, _v$5 = props.placeholder;
38
- _v$ !== _p$.e && web.className(_el$, _p$.e = _v$);
39
- _v$2 !== _p$.t && web.className(_el$2, _p$.t = _v$2);
40
- _v$3 !== _p$.a && web.setAttribute(_el$3, "type", _p$.a = _v$3);
41
- _v$4 !== _p$.o && web.className(_el$3, _p$.o = _v$4);
42
- _v$5 !== _p$.i && web.setAttribute(_el$3, "placeholder", _p$.i = _v$5);
43
- return _p$;
44
- }, {
45
- e: void 0,
46
- t: void 0,
47
- a: void 0,
48
- o: void 0,
49
- i: void 0
50
- });
51
- web.effect(() => _el$3.value = val());
52
- return _el$;
53
- })();
54
- }
55
- web.delegateEvents(["input"]);
56
- exports.Input = Input;
57
- //# sourceMappingURL=input.cjs.map