@slipstream-ui/core 0.4.0 → 0.5.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.
Files changed (92) hide show
  1. package/dist/index.d.mts +296 -15
  2. package/dist/index.d.ts +296 -15
  3. package/dist/index.js +1047 -473
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +1096 -530
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/manifests/app-shell.manifest.json +50 -0
  8. package/dist/manifests/badge.manifest.json +9 -4
  9. package/dist/manifests/breadcrumb.manifest.json +6 -0
  10. package/dist/manifests/button.manifest.json +14 -0
  11. package/dist/manifests/confirm-dialog.manifest.json +132 -0
  12. package/dist/manifests/data-table.manifest.json +50 -0
  13. package/dist/manifests/dialog.manifest.json +7 -0
  14. package/dist/manifests/drawer.manifest.json +7 -0
  15. package/dist/manifests/link.manifest.json +106 -0
  16. package/dist/manifests/page-header.manifest.json +30 -0
  17. package/dist/manifests/pagination.manifest.json +6 -0
  18. package/dist/manifests/prose.manifest.json +75 -0
  19. package/dist/manifests/search.manifest.json +41 -9
  20. package/dist/manifests/section-heading.manifest.json +108 -0
  21. package/dist/manifests/select.manifest.json +6 -0
  22. package/dist/manifests/site-footer.manifest.json +94 -0
  23. package/dist/manifests/site-header.manifest.json +130 -0
  24. package/dist/manifests/table-of-contents.manifest.json +87 -0
  25. package/package.json +2 -2
  26. package/src/components/alert/Alert.tsx +2 -2
  27. package/src/components/app-shell/AppShell.test.tsx +49 -1
  28. package/src/components/app-shell/AppShell.tsx +147 -43
  29. package/src/components/badge/Badge.test.tsx +21 -0
  30. package/src/components/badge/Badge.tsx +6 -0
  31. package/src/components/breadcrumb/Breadcrumb.test.tsx +16 -0
  32. package/src/components/breadcrumb/Breadcrumb.tsx +10 -5
  33. package/src/components/button/Button.test.tsx +40 -2
  34. package/src/components/button/Button.tsx +31 -7
  35. package/src/components/confirm-dialog/ConfirmDialog.test.tsx +46 -0
  36. package/src/components/confirm-dialog/ConfirmDialog.tsx +86 -0
  37. package/src/components/confirm-dialog/index.ts +1 -0
  38. package/src/components/data-table/DataTable.test.tsx +92 -0
  39. package/src/components/data-table/DataTable.tsx +98 -7
  40. package/src/components/dialog/Dialog.test.tsx +7 -0
  41. package/src/components/dialog/Dialog.tsx +4 -1
  42. package/src/components/drawer/Drawer.test.tsx +11 -2
  43. package/src/components/drawer/Drawer.tsx +5 -2
  44. package/src/components/input/Input.tsx +1 -0
  45. package/src/components/link/Link.test.tsx +60 -0
  46. package/src/components/link/Link.tsx +85 -0
  47. package/src/components/link/index.ts +1 -0
  48. package/src/components/page-header/PageHeader.test.tsx +17 -0
  49. package/src/components/page-header/PageHeader.tsx +22 -6
  50. package/src/components/pagination/Pagination.test.tsx +8 -0
  51. package/src/components/pagination/Pagination.tsx +16 -6
  52. package/src/components/prose/Prose.test.tsx +35 -0
  53. package/src/components/prose/Prose.tsx +61 -0
  54. package/src/components/prose/index.ts +1 -0
  55. package/src/components/search/Search.test.tsx +16 -0
  56. package/src/components/search/Search.tsx +11 -2
  57. package/src/components/section-heading/SectionHeading.test.tsx +32 -0
  58. package/src/components/section-heading/SectionHeading.tsx +54 -0
  59. package/src/components/section-heading/index.ts +1 -0
  60. package/src/components/select/Select.tsx +9 -7
  61. package/src/components/site-footer/SiteFooter.test.tsx +30 -0
  62. package/src/components/site-footer/SiteFooter.tsx +79 -0
  63. package/src/components/site-footer/index.ts +1 -0
  64. package/src/components/site-header/SiteHeader.test.tsx +53 -0
  65. package/src/components/site-header/SiteHeader.tsx +124 -0
  66. package/src/components/site-header/index.ts +1 -0
  67. package/src/components/switch/Switch.test.tsx +10 -0
  68. package/src/components/switch/Switch.tsx +8 -3
  69. package/src/components/table-of-contents/TableOfContents.test.tsx +31 -0
  70. package/src/components/table-of-contents/TableOfContents.tsx +100 -0
  71. package/src/components/table-of-contents/index.ts +1 -0
  72. package/src/components/textarea/Textarea.tsx +1 -0
  73. package/src/index.ts +7 -0
  74. package/src/manifests/app-shell.manifest.json +50 -0
  75. package/src/manifests/badge.manifest.json +9 -4
  76. package/src/manifests/breadcrumb.manifest.json +6 -0
  77. package/src/manifests/button.manifest.json +14 -0
  78. package/src/manifests/confirm-dialog.manifest.json +132 -0
  79. package/src/manifests/data-table.manifest.json +50 -0
  80. package/src/manifests/dialog.manifest.json +7 -0
  81. package/src/manifests/drawer.manifest.json +7 -0
  82. package/src/manifests/link.manifest.json +106 -0
  83. package/src/manifests/page-header.manifest.json +30 -0
  84. package/src/manifests/pagination.manifest.json +6 -0
  85. package/src/manifests/prose.manifest.json +75 -0
  86. package/src/manifests/search.manifest.json +41 -9
  87. package/src/manifests/section-heading.manifest.json +108 -0
  88. package/src/manifests/select.manifest.json +6 -0
  89. package/src/manifests/site-footer.manifest.json +94 -0
  90. package/src/manifests/site-header.manifest.json +130 -0
  91. package/src/manifests/table-of-contents.manifest.json +87 -0
  92. package/src/test/tailwind-v4.test.ts +103 -0
@@ -0,0 +1,103 @@
1
+ import fs from 'fs';
2
+ import path from 'path';
3
+ import { describe, expect, it } from 'vitest';
4
+
5
+ const CORE_COMPONENTS = path.resolve(process.cwd(), 'src', 'components');
6
+ const AI_COMPONENTS = path.resolve(process.cwd(), '..', 'ai', 'src', 'components');
7
+ const V4_CSS = path.resolve(process.cwd(), '..', 'themes', 'tailwind-v4.css');
8
+
9
+ const COLOR_TOKENS = [
10
+ 'primary-foreground',
11
+ 'secondary-foreground',
12
+ 'destructive-foreground',
13
+ 'success-foreground',
14
+ 'warning-foreground',
15
+ 'warning-ink',
16
+ 'info-foreground',
17
+ 'info-ink',
18
+ 'muted-foreground',
19
+ 'accent-foreground',
20
+ 'card-foreground',
21
+ 'popover-foreground',
22
+ 'background',
23
+ 'foreground',
24
+ 'primary',
25
+ 'secondary',
26
+ 'destructive',
27
+ 'success',
28
+ 'warning',
29
+ 'info',
30
+ 'muted',
31
+ 'accent',
32
+ 'border',
33
+ 'input',
34
+ 'ring',
35
+ 'card',
36
+ 'popover',
37
+ ] as const;
38
+
39
+ const PREFIXES = ['placeholder', 'decoration', 'outline', 'divide', 'accent', 'caret', 'border', 'stroke', 'fill', 'ring', 'text', 'from', 'via', 'to', 'bg'] as const;
40
+
41
+ function walk(dir: string): string[] {
42
+ if (!fs.existsSync(dir)) return [];
43
+ const files: string[] = [];
44
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
45
+ const full = path.join(dir, entry.name);
46
+ if (entry.isDirectory()) files.push(...walk(full));
47
+ else if (entry.name.endsWith('.tsx') && !entry.name.includes('.test.')) files.push(full);
48
+ }
49
+ return files;
50
+ }
51
+
52
+ function findColorTokens(source: string): Set<string> {
53
+ const tokens = new Set<string>();
54
+ const tokenPattern = new RegExp(
55
+ `\\b(?:${PREFIXES.join('|')})-(${COLOR_TOKENS.join('|')})(?:\\/[\\w.]+)?\\b`,
56
+ 'g',
57
+ );
58
+ for (const match of source.matchAll(tokenPattern)) tokens.add(match[1]);
59
+ return tokens;
60
+ }
61
+
62
+ describe('Tailwind v4 theme contract', () => {
63
+ const css = fs.readFileSync(V4_CSS, 'utf8');
64
+ const files = [...walk(CORE_COMPONENTS), ...walk(AI_COMPONENTS)];
65
+
66
+ it('finds the component sources it is meant to protect', () => {
67
+ expect(files.length).toBeGreaterThan(70);
68
+ });
69
+
70
+ it('declares a dark variant for class-based dark mode', () => {
71
+ expect(css).toContain('@custom-variant dark');
72
+ expect(css).toContain('.dark');
73
+ });
74
+
75
+ it('defines a v4 color token for every semantic color the components use', () => {
76
+ const used = new Set<string>();
77
+ for (const file of files) {
78
+ for (const token of findColorTokens(fs.readFileSync(file, 'utf8'))) used.add(token);
79
+ }
80
+
81
+ expect(used.size).toBeGreaterThan(10);
82
+ const missing = [...used].filter((token) => !css.includes(`--color-${token}:`));
83
+ expect(missing).toEqual([]);
84
+ });
85
+
86
+ it('maps every color token documented by ThemeColors', () => {
87
+ const missing = COLOR_TOKENS.filter((token) => !css.includes(`--color-${token}:`));
88
+ expect(missing).toEqual([]);
89
+ });
90
+
91
+ it('keeps radius, density and motion tokens', () => {
92
+ for (const token of ['--radius-lg', '--radius-md', '--radius-sm', '--spacing-density', '--spacing-control-height', '--transition-duration-fast', '--transition-duration-normal', '--transition-duration-slow', '--ease-standard', '--ease-in', '--ease-out']) {
93
+ expect(css).toContain(`${token}:`);
94
+ }
95
+ });
96
+
97
+ it('keeps the accordion animations used by Accordion', () => {
98
+ expect(css).toContain('--animate-accordion-down');
99
+ expect(css).toContain('--animate-accordion-up');
100
+ expect(css).toContain('@keyframes accordion-down');
101
+ expect(css).toContain('@keyframes accordion-up');
102
+ });
103
+ });