@mrintel/villain-ui 0.3.0 → 0.7.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.
Files changed (140) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +3490 -1296
  3. package/dist/components/buttons/Button.svelte +27 -33
  4. package/dist/components/buttons/Button.svelte.d.ts +4 -1
  5. package/dist/components/buttons/ButtonGroup.svelte +17 -30
  6. package/dist/components/buttons/FloatingActionButton.svelte +20 -44
  7. package/dist/components/buttons/FloatingActionButton.svelte.d.ts +2 -1
  8. package/dist/components/buttons/IconButton.svelte +23 -53
  9. package/dist/components/buttons/IconButton.svelte.d.ts +2 -1
  10. package/dist/components/buttons/LinkButton.svelte +24 -37
  11. package/dist/components/buttons/LinkButton.svelte.d.ts +4 -1
  12. package/dist/components/buttons/buttonClasses.d.ts +5 -0
  13. package/dist/components/buttons/buttonClasses.js +8 -3
  14. package/dist/components/cards/Card.svelte +54 -46
  15. package/dist/components/cards/Card.svelte.d.ts +9 -2
  16. package/dist/components/cards/Container.svelte +17 -33
  17. package/dist/components/cards/Divider.svelte +36 -52
  18. package/dist/components/cards/Divider.svelte.d.ts +2 -0
  19. package/dist/components/cards/Grid.svelte +55 -44
  20. package/dist/components/cards/Panel.svelte +18 -32
  21. package/dist/components/cards/Panel.svelte.d.ts +2 -1
  22. package/dist/components/cards/SectionHeader.svelte +24 -38
  23. package/dist/components/cards/SectionHeader.svelte.d.ts +1 -0
  24. package/dist/components/data/Avatar.svelte +48 -67
  25. package/dist/components/data/Badge.svelte +45 -32
  26. package/dist/components/data/Badge.svelte.d.ts +7 -1
  27. package/dist/components/data/CalendarGrid.svelte +433 -0
  28. package/dist/components/data/CalendarGrid.svelte.d.ts +25 -0
  29. package/dist/components/data/CalendarGrid.types.d.ts +7 -0
  30. package/dist/components/data/CalendarGrid.types.js +1 -0
  31. package/dist/components/data/CodeBlock.svelte +119 -121
  32. package/dist/components/data/CodeBlock.svelte.d.ts +8 -0
  33. package/dist/components/data/List.svelte +87 -64
  34. package/dist/components/data/List.svelte.d.ts +7 -0
  35. package/dist/components/data/Pagination.svelte +121 -123
  36. package/dist/components/data/Pagination.svelte.d.ts +5 -0
  37. package/dist/components/data/Sparkline.svelte +117 -0
  38. package/dist/components/data/Sparkline.svelte.d.ts +43 -0
  39. package/dist/components/data/Stat.svelte +92 -103
  40. package/dist/components/data/Table.svelte +443 -76
  41. package/dist/components/data/Table.svelte.d.ts +23 -2
  42. package/dist/components/data/Table.types.d.ts +14 -0
  43. package/dist/components/data/Table.types.js +1 -0
  44. package/dist/components/data/Tag.svelte +51 -53
  45. package/dist/components/data/Tag.svelte.d.ts +5 -1
  46. package/dist/components/data/index.d.ts +4 -0
  47. package/dist/components/data/index.js +2 -0
  48. package/dist/components/forms/Checkbox.svelte +39 -51
  49. package/dist/components/forms/Checkbox.svelte.d.ts +3 -1
  50. package/dist/components/forms/DatePicker.svelte +61 -0
  51. package/dist/components/forms/DatePicker.svelte.d.ts +15 -0
  52. package/dist/components/forms/DateTimePicker.svelte +63 -0
  53. package/dist/components/forms/DateTimePicker.svelte.d.ts +16 -0
  54. package/dist/components/forms/FileUpload.svelte +136 -164
  55. package/dist/components/forms/FileUpload.svelte.d.ts +1 -0
  56. package/dist/components/forms/Input.svelte +284 -57
  57. package/dist/components/forms/Input.svelte.d.ts +10 -3
  58. package/dist/components/forms/InputGroup.svelte +7 -7
  59. package/dist/components/forms/RadioGroup.svelte +77 -87
  60. package/dist/components/forms/RadioGroup.svelte.d.ts +3 -1
  61. package/dist/components/forms/RangeSlider.svelte +90 -116
  62. package/dist/components/forms/Select.svelte +106 -71
  63. package/dist/components/forms/Select.svelte.d.ts +3 -1
  64. package/dist/components/forms/Step.svelte +25 -0
  65. package/dist/components/forms/Step.svelte.d.ts +12 -0
  66. package/dist/components/forms/StepContext.d.ts +3 -0
  67. package/dist/components/forms/StepContext.js +5 -0
  68. package/dist/components/forms/Stepper.types.d.ts +37 -0
  69. package/dist/components/forms/Stepper.types.js +1 -0
  70. package/dist/components/forms/StepperForm.svelte +183 -0
  71. package/dist/components/forms/StepperForm.svelte.d.ts +17 -0
  72. package/dist/components/forms/Switch.svelte +44 -56
  73. package/dist/components/forms/Switch.svelte.d.ts +3 -1
  74. package/dist/components/forms/Textarea.svelte +52 -57
  75. package/dist/components/forms/Textarea.svelte.d.ts +3 -1
  76. package/dist/components/forms/TimePicker.svelte +63 -0
  77. package/dist/components/forms/TimePicker.svelte.d.ts +16 -0
  78. package/dist/components/forms/formClasses.d.ts +3 -0
  79. package/dist/components/forms/formClasses.js +3 -0
  80. package/dist/components/forms/index.d.ts +6 -0
  81. package/dist/components/forms/index.js +5 -0
  82. package/dist/components/navigation/Breadcrumbs.svelte +56 -59
  83. package/dist/components/navigation/Breadcrumbs.svelte.d.ts +1 -0
  84. package/dist/components/navigation/ContextMenu.svelte +133 -83
  85. package/dist/components/navigation/ContextMenu.svelte.d.ts +8 -1
  86. package/dist/components/navigation/DropdownMenu.svelte +139 -80
  87. package/dist/components/navigation/DropdownMenu.svelte.d.ts +8 -1
  88. package/dist/components/navigation/Menu.svelte +72 -48
  89. package/dist/components/navigation/Navbar.svelte +111 -32
  90. package/dist/components/navigation/Navbar.svelte.d.ts +6 -0
  91. package/dist/components/navigation/Sidebar.svelte +236 -35
  92. package/dist/components/navigation/Sidebar.svelte.d.ts +2 -0
  93. package/dist/components/navigation/Stepper.svelte +204 -0
  94. package/dist/components/navigation/Stepper.svelte.d.ts +34 -0
  95. package/dist/components/navigation/Tabs.svelte +86 -54
  96. package/dist/components/navigation/Tabs.svelte.d.ts +5 -1
  97. package/dist/components/navigation/index.d.ts +1 -0
  98. package/dist/components/navigation/index.js +1 -0
  99. package/dist/components/overlays/Alert.svelte +81 -99
  100. package/dist/components/overlays/Alert.svelte.d.ts +5 -1
  101. package/dist/components/overlays/CommandPalette.svelte +182 -217
  102. package/dist/components/overlays/Drawer.svelte +158 -167
  103. package/dist/components/overlays/Drawer.svelte.d.ts +3 -1
  104. package/dist/components/overlays/Dropdown.svelte +62 -30
  105. package/dist/components/overlays/Dropdown.svelte.d.ts +2 -0
  106. package/dist/components/overlays/Modal.svelte +125 -130
  107. package/dist/components/overlays/Modal.svelte.d.ts +3 -1
  108. package/dist/components/overlays/Popover.svelte +106 -131
  109. package/dist/components/overlays/ProgressBar.svelte +29 -45
  110. package/dist/components/overlays/SkeletonLoader.svelte +66 -82
  111. package/dist/components/overlays/Spinner.svelte +33 -43
  112. package/dist/components/overlays/Toast.svelte +111 -140
  113. package/dist/components/overlays/Toast.svelte.d.ts +3 -0
  114. package/dist/components/overlays/Tooltip.svelte +94 -115
  115. package/dist/components/overlays/Tooltip.svelte.d.ts +3 -1
  116. package/dist/components/typography/Code.svelte +10 -14
  117. package/dist/components/typography/Heading.svelte +15 -22
  118. package/dist/components/typography/Heading.svelte.d.ts +1 -0
  119. package/dist/components/typography/Text.svelte +21 -24
  120. package/dist/components/typography/Text.svelte.d.ts +2 -1
  121. package/dist/components/utilities/Accordion.svelte +54 -67
  122. package/dist/components/utilities/Accordion.svelte.d.ts +4 -1
  123. package/dist/components/utilities/Carousel.svelte +124 -152
  124. package/dist/components/utilities/Collapse.svelte +46 -60
  125. package/dist/components/utilities/Hero.svelte +42 -0
  126. package/dist/components/utilities/Hero.svelte.d.ts +10 -0
  127. package/dist/components/utilities/Portal.svelte +47 -72
  128. package/dist/components/utilities/ScrollArea.svelte +33 -41
  129. package/dist/components/utilities/SystemConsole.svelte +310 -0
  130. package/dist/components/utilities/SystemConsole.svelte.d.ts +20 -0
  131. package/dist/components/utilities/SystemInterface.svelte +726 -0
  132. package/dist/components/utilities/SystemInterface.svelte.d.ts +19 -0
  133. package/dist/components/utilities/index.d.ts +4 -0
  134. package/dist/components/utilities/index.js +3 -0
  135. package/dist/components/utilities/utilities.types.d.ts +46 -0
  136. package/dist/components/utilities/utilities.types.js +4 -0
  137. package/dist/index.d.ts +57 -5
  138. package/dist/index.js +5 -5
  139. package/dist/theme.css +2889 -218
  140. package/package.json +83 -76
@@ -1,121 +1,119 @@
1
- <script lang="ts">
2
- /**
3
- * Props for the CodeBlock component.
4
- *
5
- * This is a presentational component that provides layout and styling for syntax-highlighted code.
6
- * Consumers are responsible for providing pre-highlighted HTML via the default slot and ensuring
7
- * the content is properly sanitized to prevent XSS attacks.
8
- */
9
- interface Props {
10
- /**
11
- * Optional filename to display in the header.
12
- */
13
- filename?: string;
14
- /**
15
- * Whether to show line numbers in the gutter.
16
- */
17
- showLineNumbers?: boolean;
18
- /**
19
- * Total number of lines in the code. Required when showLineNumbers is true.
20
- */
21
- lineCount?: number;
22
- /**
23
- * Array of line numbers (1-indexed) to highlight in the gutter.
24
- */
25
- highlightLines?: number[];
26
- /**
27
- * Slot for pre-highlighted code HTML.
28
- */
29
- children?: import('svelte').Snippet;
30
- }
31
-
32
- let {
33
- filename,
34
- showLineNumbers = false,
35
- lineCount = 0,
36
- highlightLines = [],
37
- children
38
- }: Props = $props();
39
-
40
- // Development-only validation
41
- </script>
42
-
43
- <div class="glass-panel rounded-lg overflow-hidden">
44
- {#if filename}
45
- <div
46
- class="px-4 py-2 border-b border-border"
47
- style="background: var(--color-base-2); color: var(--color-text-soft); font-family: var(--font-mono); font-size: 0.875rem;"
48
- >
49
- {filename}
50
- </div>
51
- {/if}
52
-
53
- <div
54
- class="p-4 overflow-x-auto"
55
- style="background: var(--color-base-1); font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.6;"
56
- >
57
- {#if showLineNumbers}
58
- <div class="flex">
59
- <div
60
- class="pr-4 border-r border-border select-none"
61
- style="color: var(--color-text-muted);"
62
- >
63
- {#each Array.from({ length: lineCount }, (_, i) => i + 1) as lineNum}
64
- <div
65
- class:highlighted={highlightLines.includes(lineNum)}
66
- style={highlightLines.includes(lineNum)
67
- ? 'background: rgba(127, 61, 255, 0.1);'
68
- : ''}
69
- >
70
- {lineNum}
71
- </div>
72
- {/each}
73
- </div>
74
- <div class="pl-4 flex-1">
75
- {@render children?.()}
76
- </div>
77
- </div>
78
- {:else}
79
- <div>
80
- {@render children?.()}
81
- </div>
82
- {/if}
83
- </div>
84
- </div>
85
-
86
- <style>
87
- /* Custom scrollbar styling */
88
- div::-webkit-scrollbar {
89
- height: 8px;
90
- }
91
-
92
- div::-webkit-scrollbar-track {
93
- background: var(--color-base-1);
94
- }
95
-
96
- div::-webkit-scrollbar-thumb {
97
- background: var(--color-accent);
98
- border-radius: var(--radius-sm);
99
- }
100
-
101
- div::-webkit-scrollbar-thumb:hover {
102
- background: var(--color-accent-soft);
103
- }
104
-
105
- /* Highlight gutter numbers */
106
- .highlighted {
107
- background: rgba(127, 61, 255, 0.1);
108
- }
109
-
110
- /*
111
- * Consumer-provided line highlighting:
112
- * Consumers should apply the `.line` class to each code line element
113
- * and the `.highlighted` class to lines that should be highlighted.
114
- * This ensures consistent styling with the component's luxury aesthetic.
115
- */
116
- :global(.line.highlighted) {
117
- background: rgba(127, 61, 255, 0.1);
118
- display: inline-block;
119
- width: 100%;
120
- }
121
- </style>
1
+ <script lang="ts">"use strict";
2
+ let { filename, showLineNumbers = false, lineCount = 0, highlightLines = [], showCopy = true, code, children } = $props();
3
+ let codeContainer;
4
+ let copied = $state(false);
5
+ async function copyCode() {
6
+ try {
7
+ const textToCopy = code || codeContainer?.textContent || '';
8
+ await navigator.clipboard.writeText(textToCopy);
9
+ copied = true;
10
+ setTimeout(() => {
11
+ copied = false;
12
+ }, 2000);
13
+ }
14
+ catch (err) {
15
+ console.error('Failed to copy code:', err);
16
+ }
17
+ }
18
+ </script>
19
+
20
+ <div class="panel-raised rounded-[var(--radius-lg)] overflow-hidden relative">
21
+ {#if filename || showCopy}
22
+ <div
23
+ class="px-4 py-2 border-b border-border flex items-center justify-between"
24
+ style="background: var(--color-base-2); color: var(--color-text-soft); font-family: var(--font-mono); font-size: 0.875rem;"
25
+ >
26
+ <span>{filename || ''}</span>
27
+ {#if showCopy}
28
+ <button
29
+ onclick={copyCode}
30
+ class="copy-button px-3 py-1 rounded-sm transition-all text-xs"
31
+ aria-label="Copy code"
32
+ >
33
+ {copied ? 'Copied!' : 'Copy'}
34
+ </button>
35
+ {/if}
36
+ </div>
37
+ {/if} <div
38
+ bind:this={codeContainer}
39
+ class="p-4 overflow-x-auto"
40
+ style="background: var(--color-base-1); font-family: var(--font-mono); font-size: 0.875rem; line-height: 1.6;"
41
+ >
42
+ {#if showLineNumbers}
43
+ <div class="flex">
44
+ <div
45
+ class="pr-4 border-r border-border select-none"
46
+ style="color: var(--color-text-muted);"
47
+ >
48
+ {#each Array.from({ length: lineCount }, (_, i) => i + 1) as lineNum}
49
+ <div
50
+ class:highlighted={highlightLines.includes(lineNum)}
51
+ style={highlightLines.includes(lineNum)
52
+ ? 'background: var(--color-accent-overlay-10);'
53
+ : ''}
54
+ >
55
+ {lineNum}
56
+ </div>
57
+ {/each}
58
+ </div>
59
+ <div class="pl-4 flex-1">
60
+ {@render children?.()}
61
+ </div>
62
+ </div>
63
+ {:else}
64
+ <div>
65
+ {@render children?.()}
66
+ </div>
67
+ {/if}
68
+ </div>
69
+ </div>
70
+
71
+ <style>
72
+ /* Custom scrollbar styling */
73
+ div::-webkit-scrollbar {
74
+ height: 8px;
75
+ }
76
+
77
+ div::-webkit-scrollbar-track {
78
+ background: var(--color-base-1);
79
+ }
80
+
81
+ div::-webkit-scrollbar-thumb {
82
+ background: var(--color-accent);
83
+ border-radius: var(--radius-sm);
84
+ }
85
+
86
+ div::-webkit-scrollbar-thumb:hover {
87
+ background: var(--color-accent-soft);
88
+ }
89
+
90
+ /* Copy button styling */
91
+ .copy-button {
92
+ background: var(--color-base-3);
93
+ color: var(--color-text-soft);
94
+ border: 1px solid var(--color-border);
95
+ font-size: 0.75rem;
96
+ }
97
+
98
+ .copy-button:hover {
99
+ background: var(--color-accent);
100
+ color: var(--color-text);
101
+ border-color: var(--color-accent);
102
+ }
103
+
104
+ /* Highlight gutter numbers */
105
+ .highlighted {
106
+ background: var(--color-accent-overlay-10);
107
+ }
108
+
109
+ /*
110
+ * Consumer-provided line highlighting:
111
+ * Consumers should apply the `.line` class to each code line element
112
+ * and the `.highlighted` class to lines that should be highlighted.
113
+ * This ensures consistent styling with the component's luxury aesthetic.
114
+ */
115
+ :global(.line.highlighted) {
116
+ background: var(--color-accent-overlay-10);
117
+ display: inline-block;
118
+ width: 100%;
119
+ }</style>
@@ -22,6 +22,14 @@ interface Props {
22
22
  * Array of line numbers (1-indexed) to highlight in the gutter.
23
23
  */
24
24
  highlightLines?: number[];
25
+ /**
26
+ * Whether to show the copy button. Default: true.
27
+ */
28
+ showCopy?: boolean;
29
+ /**
30
+ * Raw code text for copying. If not provided, copy functionality attempts to extract text from the rendered content.
31
+ */
32
+ code?: string;
25
33
  /**
26
34
  * Slot for pre-highlighted code HTML.
27
35
  */
@@ -1,64 +1,87 @@
1
- <script lang="ts">
2
- interface Props {
3
- variant?: 'plain' | 'bordered' | 'divided';
4
- hoverable?: boolean;
5
- children?: import('svelte').Snippet;
6
- }
7
-
8
- let { variant = 'plain', hoverable = false, children }: Props = $props();
9
-
10
- const containerClasses = $derived(
11
- variant === 'bordered'
12
- ? 'glass-panel rounded-[var(--radius-lg)] border border-[var(--color-border)]'
13
- : ''
14
- );
15
-
16
- const listClasses = $derived(`list-none ${variant} ${hoverable ? 'hoverable' : ''}`);
17
- </script>
18
-
19
- {#if variant === 'bordered'}
20
- <div class={containerClasses}>
21
- <ul class={listClasses}>
22
- {@render children?.()}
23
- </ul>
24
- </div>
25
- {:else}
26
- <ul class={listClasses}>
27
- {@render children?.()}
28
- </ul>
29
- {/if}
30
-
31
- <style>
32
- ul {
33
- margin: 0;
34
- padding: 0;
35
- color: var(--color-text);
36
- font-family: var(--font-body);
37
- }
38
-
39
- :global(ul.plain > li) {
40
- padding: 0.5rem 0;
41
- }
42
-
43
- :global(ul.bordered > li) {
44
- padding: 0.75rem 1rem;
45
- }
46
-
47
- :global(ul.divided > li) {
48
- padding: 0.75rem 1rem;
49
- border-bottom: 1px solid var(--color-border);
50
- }
51
-
52
- :global(ul.divided > li:last-child) {
53
- border-bottom: none;
54
- }
55
-
56
- :global(ul.hoverable > li) {
57
- transition: all var(--ease-luxe);
58
- cursor: pointer;
59
- }
60
-
61
- :global(ul.hoverable > li:hover) {
62
- background: rgba(127, 61, 255, 0.05);
63
- }
64
- </style>
1
+ <script lang="ts">let { variant = 'plain', hoverable = false, items, children } = $props();
2
+ const containerClasses = $derived(variant === 'bordered'
3
+ ? 'panel-raised rounded-[var(--radius-lg)] border border-[var(--color-border)]'
4
+ : '');
5
+ const listClasses = $derived(`list-none ${variant} ${hoverable ? 'hoverable' : ''}`);
6
+ export {};
7
+ </script>
8
+
9
+ {#if variant === 'bordered'}
10
+ <div class={containerClasses}>
11
+ <ul class={listClasses}>
12
+ {#if items}
13
+ {#each items as item (item.id)}
14
+ <li class="flex items-center gap-2">
15
+ {#if item.icon}
16
+ <span class="inline-flex items-center justify-center">
17
+ {@render item.icon()}
18
+ </span>
19
+ {/if}
20
+ {#if typeof item.content === 'string'}
21
+ {item.content}
22
+ {:else}
23
+ {@render item.content()}
24
+ {/if}
25
+ </li>
26
+ {/each}
27
+ {:else}
28
+ {@render children?.()}
29
+ {/if}
30
+ </ul>
31
+ </div>
32
+ {:else}
33
+ <ul class={listClasses}>
34
+ {#if items}
35
+ {#each items as item (item.id)}
36
+ <li class="flex items-center gap-2">
37
+ {#if item.icon}
38
+ <span class="inline-flex items-center justify-center">
39
+ {@render item.icon()}
40
+ </span>
41
+ {/if}
42
+ {#if typeof item.content === 'string'}
43
+ {item.content}
44
+ {:else}
45
+ {@render item.content()}
46
+ {/if}
47
+ </li>
48
+ {/each}
49
+ {:else}
50
+ {@render children?.()}
51
+ {/if}
52
+ </ul>
53
+ {/if}
54
+
55
+ <style>
56
+ ul {
57
+ margin: 0;
58
+ padding: 0;
59
+ color: var(--color-text);
60
+ font-family: var(--font-body);
61
+ }
62
+
63
+ :global(ul.plain > li) {
64
+ padding: 0.5rem 0;
65
+ }
66
+
67
+ :global(ul.bordered > li) {
68
+ padding: 0.75rem 1rem;
69
+ }
70
+
71
+ :global(ul.divided > li) {
72
+ padding: 0.75rem 1rem;
73
+ border-bottom: 1px solid var(--color-border);
74
+ }
75
+
76
+ :global(ul.divided > li:last-child) {
77
+ border-bottom: none;
78
+ }
79
+
80
+ :global(ul.hoverable > li) {
81
+ transition: all var(--ease-luxe);
82
+ cursor: pointer;
83
+ }
84
+
85
+ :global(ul.hoverable > li:hover) {
86
+ background: var(--color-accent-overlay-5);
87
+ }</style>
@@ -1,6 +1,13 @@
1
+ import type { Snippet } from 'svelte';
2
+ interface ListItem {
3
+ id: string;
4
+ content: string | Snippet;
5
+ icon?: Snippet;
6
+ }
1
7
  interface Props {
2
8
  variant?: 'plain' | 'bordered' | 'divided';
3
9
  hoverable?: boolean;
10
+ items?: ListItem[];
4
11
  children?: import('svelte').Snippet;
5
12
  }
6
13
  declare const List: import("svelte").Component<Props, {}, "">;