@beeblock/svelar 0.4.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 (207) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +110 -0
  3. package/dist/actions/index.d.ts +101 -0
  4. package/dist/actions/index.js +1 -0
  5. package/dist/api-keys/index.d.ts +58 -0
  6. package/dist/api-keys/index.js +1 -0
  7. package/dist/audit/index.d.ts +52 -0
  8. package/dist/audit/index.js +1 -0
  9. package/dist/auth/Auth.d.ts +283 -0
  10. package/dist/auth/Gate.d.ts +166 -0
  11. package/dist/auth/index.d.ts +2 -0
  12. package/dist/auth/index.js +80 -0
  13. package/dist/broadcasting/client.d.ts +195 -0
  14. package/dist/broadcasting/client.js +1 -0
  15. package/dist/broadcasting/index.d.ts +318 -0
  16. package/dist/broadcasting/index.js +20 -0
  17. package/dist/cache/index.d.ts +77 -0
  18. package/dist/cache/index.js +1 -0
  19. package/dist/cli/Cli.d.ts +23 -0
  20. package/dist/cli/Command.d.ts +36 -0
  21. package/dist/cli/bin.d.ts +8 -0
  22. package/dist/cli/bin.js +5856 -0
  23. package/dist/cli/commands/KeyGenerateCommand.d.ts +16 -0
  24. package/dist/cli/commands/MakeActionCommand.d.ts +15 -0
  25. package/dist/cli/commands/MakeBroadcastingCommand.d.ts +29 -0
  26. package/dist/cli/commands/MakeChannelCommand.d.ts +18 -0
  27. package/dist/cli/commands/MakeCommandCommand.d.ts +16 -0
  28. package/dist/cli/commands/MakeConfigCommand.d.ts +13 -0
  29. package/dist/cli/commands/MakeControllerCommand.d.ts +28 -0
  30. package/dist/cli/commands/MakeDashboardCommand.d.ts +34 -0
  31. package/dist/cli/commands/MakeDockerCommand.d.ts +32 -0
  32. package/dist/cli/commands/MakeEventCommand.d.ts +11 -0
  33. package/dist/cli/commands/MakeJobCommand.d.ts +11 -0
  34. package/dist/cli/commands/MakeListenerCommand.d.ts +16 -0
  35. package/dist/cli/commands/MakeMiddlewareCommand.d.ts +11 -0
  36. package/dist/cli/commands/MakeMigrationCommand.d.ts +17 -0
  37. package/dist/cli/commands/MakeModelCommand.d.ts +25 -0
  38. package/dist/cli/commands/MakeObserverCommand.d.ts +23 -0
  39. package/dist/cli/commands/MakePluginCommand.d.ts +11 -0
  40. package/dist/cli/commands/MakeProviderCommand.d.ts +11 -0
  41. package/dist/cli/commands/MakeRepositoryCommand.d.ts +22 -0
  42. package/dist/cli/commands/MakeRequestCommand.d.ts +15 -0
  43. package/dist/cli/commands/MakeResourceCommand.d.ts +30 -0
  44. package/dist/cli/commands/MakeRouteCommand.d.ts +42 -0
  45. package/dist/cli/commands/MakeSchemaCommand.d.ts +20 -0
  46. package/dist/cli/commands/MakeSeederCommand.d.ts +11 -0
  47. package/dist/cli/commands/MakeServiceCommand.d.ts +28 -0
  48. package/dist/cli/commands/MakeTaskCommand.d.ts +12 -0
  49. package/dist/cli/commands/MigrateCommand.d.ts +26 -0
  50. package/dist/cli/commands/NewCommand.d.ts +21 -0
  51. package/dist/cli/commands/NewCommandTemplates.d.ts +123 -0
  52. package/dist/cli/commands/PluginInstallCommand.d.ts +16 -0
  53. package/dist/cli/commands/PluginListCommand.d.ts +11 -0
  54. package/dist/cli/commands/PluginPublishCommand.d.ts +22 -0
  55. package/dist/cli/commands/QueueFailedCommand.d.ts +9 -0
  56. package/dist/cli/commands/QueueFlushCommand.d.ts +9 -0
  57. package/dist/cli/commands/QueueRetryCommand.d.ts +16 -0
  58. package/dist/cli/commands/QueueWorkCommand.d.ts +25 -0
  59. package/dist/cli/commands/RoutesListCommand.d.ts +30 -0
  60. package/dist/cli/commands/ScheduleRunCommand.d.ts +15 -0
  61. package/dist/cli/commands/SeedCommand.d.ts +14 -0
  62. package/dist/cli/commands/TinkerCommand.d.ts +10 -0
  63. package/dist/cli/index.d.ts +36 -0
  64. package/dist/cli/index.js +1973 -0
  65. package/dist/cli/ts-resolve-hook.mjs +74 -0
  66. package/dist/cli/ts-resolver.mjs +8 -0
  67. package/dist/config/Config.d.ts +65 -0
  68. package/dist/config/index.d.ts +1 -0
  69. package/dist/config/index.js +1 -0
  70. package/dist/container/Application.d.ts +33 -0
  71. package/dist/container/Container.d.ts +70 -0
  72. package/dist/container/ServiceProvider.d.ts +21 -0
  73. package/dist/container/index.d.ts +3 -0
  74. package/dist/container/index.js +1 -0
  75. package/dist/dashboard/index.d.ts +123 -0
  76. package/dist/dashboard/index.js +5 -0
  77. package/dist/database/Connection.d.ts +80 -0
  78. package/dist/database/Migration.d.ts +76 -0
  79. package/dist/database/SchemaBuilder.d.ts +91 -0
  80. package/dist/database/Seeder.d.ts +9 -0
  81. package/dist/database/index.d.ts +4 -0
  82. package/dist/database/index.js +4 -0
  83. package/dist/email-templates/index.d.ts +51 -0
  84. package/dist/email-templates/index.js +57 -0
  85. package/dist/errors/Handler.d.ts +100 -0
  86. package/dist/errors/index.d.ts +1 -0
  87. package/dist/errors/index.js +5 -0
  88. package/dist/events/EventServiceProvider.d.ts +82 -0
  89. package/dist/events/Listener.d.ts +28 -0
  90. package/dist/events/index.d.ts +80 -0
  91. package/dist/events/index.js +1 -0
  92. package/dist/excel/index.d.ts +154 -0
  93. package/dist/excel/index.js +1 -0
  94. package/dist/feature-flags/index.d.ts +158 -0
  95. package/dist/feature-flags/index.js +59 -0
  96. package/dist/forms/index.d.ts +81 -0
  97. package/dist/forms/index.js +1 -0
  98. package/dist/hashing/Hash.d.ts +51 -0
  99. package/dist/hashing/index.d.ts +1 -0
  100. package/dist/hashing/index.js +1 -0
  101. package/dist/hooks/index.d.ts +135 -0
  102. package/dist/hooks/index.js +5 -0
  103. package/dist/http/index.d.ts +201 -0
  104. package/dist/http/index.js +2 -0
  105. package/dist/i18n/index.d.ts +81 -0
  106. package/dist/i18n/index.js +1 -0
  107. package/dist/index.d.ts +54 -0
  108. package/dist/index.js +127 -0
  109. package/dist/logging/LogViewer.d.ts +95 -0
  110. package/dist/logging/LogViewer.js +1 -0
  111. package/dist/logging/index.d.ts +83 -0
  112. package/dist/logging/index.js +3 -0
  113. package/dist/mail/index.d.ts +149 -0
  114. package/dist/mail/index.js +1 -0
  115. package/dist/middleware/Middleware.d.ts +208 -0
  116. package/dist/middleware/index.d.ts +1 -0
  117. package/dist/middleware/index.js +1 -0
  118. package/dist/notifications/index.d.ts +85 -0
  119. package/dist/notifications/index.js +2 -0
  120. package/dist/orm/Model.d.ts +123 -0
  121. package/dist/orm/Observer.d.ts +34 -0
  122. package/dist/orm/QueryBuilder.d.ts +119 -0
  123. package/dist/orm/Relationship.d.ts +58 -0
  124. package/dist/orm/index.d.ts +4 -0
  125. package/dist/orm/index.js +1 -0
  126. package/dist/pagination/index.d.ts +8 -0
  127. package/dist/pagination/index.js +0 -0
  128. package/dist/pdf/GeneratePdfJob.d.ts +99 -0
  129. package/dist/pdf/GeneratePdfJob.js +41 -0
  130. package/dist/pdf/index.d.ts +328 -0
  131. package/dist/pdf/index.js +41 -0
  132. package/dist/permissions/index.d.ts +161 -0
  133. package/dist/permissions/index.js +60 -0
  134. package/dist/plugins/BootstrapPlugins.d.ts +11 -0
  135. package/dist/plugins/PluginInstaller.d.ts +30 -0
  136. package/dist/plugins/PluginInstaller.js +1 -0
  137. package/dist/plugins/PluginPublisher.d.ts +32 -0
  138. package/dist/plugins/PluginPublisher.js +1 -0
  139. package/dist/plugins/PluginRegistry.d.ts +55 -0
  140. package/dist/plugins/PluginRegistry.js +1 -0
  141. package/dist/plugins/index.d.ts +206 -0
  142. package/dist/plugins/index.js +1 -0
  143. package/dist/queue/JobMonitor.d.ts +109 -0
  144. package/dist/queue/JobMonitor.js +5 -0
  145. package/dist/queue/index.d.ts +279 -0
  146. package/dist/queue/index.js +5 -0
  147. package/dist/repositories/index.d.ts +147 -0
  148. package/dist/repositories/index.js +1 -0
  149. package/dist/routing/Controller.d.ts +115 -0
  150. package/dist/routing/FormRequest.d.ts +94 -0
  151. package/dist/routing/Resource.d.ts +213 -0
  152. package/dist/routing/Response.d.ts +138 -0
  153. package/dist/routing/index.d.ts +4 -0
  154. package/dist/routing/index.js +5 -0
  155. package/dist/scheduler/ScheduleMonitor.d.ts +141 -0
  156. package/dist/scheduler/ScheduleMonitor.js +1 -0
  157. package/dist/scheduler/SchedulerLock.d.ts +33 -0
  158. package/dist/scheduler/index.d.ts +208 -0
  159. package/dist/scheduler/index.js +34 -0
  160. package/dist/services/index.d.ts +79 -0
  161. package/dist/services/index.js +1 -0
  162. package/dist/session/Session.d.ts +166 -0
  163. package/dist/session/index.d.ts +1 -0
  164. package/dist/session/index.js +16 -0
  165. package/dist/storage/index.d.ts +154 -0
  166. package/dist/storage/index.js +1 -0
  167. package/dist/support/Pipeline.d.ts +65 -0
  168. package/dist/support/date.d.ts +136 -0
  169. package/dist/support/date.js +1 -0
  170. package/dist/support/index.d.ts +8 -0
  171. package/dist/support/index.js +1 -0
  172. package/dist/support/singleton.d.ts +10 -0
  173. package/dist/support/uuid.d.ts +40 -0
  174. package/dist/teams/index.d.ts +91 -0
  175. package/dist/teams/index.js +78 -0
  176. package/dist/uploads/index.d.ts +63 -0
  177. package/dist/uploads/index.js +2 -0
  178. package/dist/validation/index.d.ts +46 -0
  179. package/dist/validation/index.js +1 -0
  180. package/dist/webhooks/index.d.ts +66 -0
  181. package/dist/webhooks/index.js +1 -0
  182. package/package.json +338 -0
  183. package/src/i18n/LanguageSwitcher.svelte +47 -0
  184. package/src/i18n/index.ts +113 -0
  185. package/src/ui/Alert.svelte +22 -0
  186. package/src/ui/Avatar.svelte +18 -0
  187. package/src/ui/AvatarFallback.svelte +18 -0
  188. package/src/ui/AvatarImage.svelte +12 -0
  189. package/src/ui/Badge.svelte +27 -0
  190. package/src/ui/Button.svelte +51 -0
  191. package/src/ui/Card.svelte +15 -0
  192. package/src/ui/CardContent.svelte +15 -0
  193. package/src/ui/CardDescription.svelte +15 -0
  194. package/src/ui/CardFooter.svelte +15 -0
  195. package/src/ui/CardHeader.svelte +15 -0
  196. package/src/ui/CardTitle.svelte +15 -0
  197. package/src/ui/Icon.svelte +81 -0
  198. package/src/ui/Input.svelte +40 -0
  199. package/src/ui/Label.svelte +20 -0
  200. package/src/ui/Separator.svelte +10 -0
  201. package/src/ui/Tabs.svelte +23 -0
  202. package/src/ui/TabsContent.svelte +27 -0
  203. package/src/ui/TabsList.svelte +19 -0
  204. package/src/ui/TabsTrigger.svelte +28 -0
  205. package/src/ui/Toaster.svelte +279 -0
  206. package/src/ui/index.ts +31 -0
  207. package/src/ui/toast.ts +212 -0
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ class?: string;
6
+ children?: Snippet;
7
+ [key: string]: any;
8
+ }
9
+
10
+ let { class: className = '', children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <p class="text-sm text-gray-500 {className}" {...rest}>
14
+ {#if children}{@render children()}{/if}
15
+ </p>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ class?: string;
6
+ children?: Snippet;
7
+ [key: string]: any;
8
+ }
9
+
10
+ let { class: className = '', children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <div class="flex items-center p-6 pt-0 {className}" {...rest}>
14
+ {#if children}{@render children()}{/if}
15
+ </div>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ class?: string;
6
+ children?: Snippet;
7
+ [key: string]: any;
8
+ }
9
+
10
+ let { class: className = '', children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <div class="flex flex-col space-y-1.5 p-6 {className}" {...rest}>
14
+ {#if children}{@render children()}{/if}
15
+ </div>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ class?: string;
6
+ children?: Snippet;
7
+ [key: string]: any;
8
+ }
9
+
10
+ let { class: className = '', children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <h2 class="text-2xl font-semibold leading-none tracking-tight {className}" {...rest}>
14
+ {#if children}{@render children()}{/if}
15
+ </h2>
@@ -0,0 +1,81 @@
1
+ <script lang="ts">
2
+ import type { Snippet, Component } from 'svelte';
3
+
4
+ interface Props {
5
+ // A Svelte icon component (from lucide-svelte or @tabler/icons-svelte)
6
+ icon?: Component<any>;
7
+ // Raw SVG path data (d attribute) for inline icons
8
+ path?: string;
9
+ size?: number;
10
+ strokeWidth?: number;
11
+ color?: string;
12
+ class?: string;
13
+ 'aria-label'?: string;
14
+ children?: Snippet;
15
+ [key: string]: any;
16
+ }
17
+
18
+ let {
19
+ icon,
20
+ path,
21
+ size = 24,
22
+ strokeWidth = 2,
23
+ color = 'currentColor',
24
+ class: className = '',
25
+ 'aria-label': ariaLabel,
26
+ children,
27
+ ...rest
28
+ }: Props = $props();
29
+ </script>
30
+
31
+ {#if icon}
32
+ {@const IconComponent = icon}
33
+ <IconComponent
34
+ {size}
35
+ {strokeWidth}
36
+ stroke-width={strokeWidth}
37
+ {color}
38
+ class={className}
39
+ aria-label={ariaLabel}
40
+ aria-hidden={!ariaLabel}
41
+ {...rest}
42
+ />
43
+ {:else if path}
44
+ <svg
45
+ xmlns="http://www.w3.org/2000/svg"
46
+ width={size}
47
+ height={size}
48
+ viewBox="0 0 24 24"
49
+ fill="none"
50
+ stroke={color}
51
+ stroke-width={strokeWidth}
52
+ stroke-linecap="round"
53
+ stroke-linejoin="round"
54
+ class={className}
55
+ role={ariaLabel ? 'img' : 'presentation'}
56
+ aria-label={ariaLabel}
57
+ aria-hidden={!ariaLabel}
58
+ {...rest}
59
+ >
60
+ <path d={path} />
61
+ </svg>
62
+ {:else if children}
63
+ <svg
64
+ xmlns="http://www.w3.org/2000/svg"
65
+ width={size}
66
+ height={size}
67
+ viewBox="0 0 24 24"
68
+ fill="none"
69
+ stroke={color}
70
+ stroke-width={strokeWidth}
71
+ stroke-linecap="round"
72
+ stroke-linejoin="round"
73
+ class={className}
74
+ role={ariaLabel ? 'img' : 'presentation'}
75
+ aria-label={ariaLabel}
76
+ aria-hidden={!ariaLabel}
77
+ {...rest}
78
+ >
79
+ {@render children()}
80
+ </svg>
81
+ {/if}
@@ -0,0 +1,40 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ type?: string;
4
+ value?: string;
5
+ placeholder?: string;
6
+ class?: string;
7
+ disabled?: boolean;
8
+ required?: boolean;
9
+ name?: string;
10
+ id?: string;
11
+ oninput?: (e: Event) => void;
12
+ [key: string]: any;
13
+ }
14
+
15
+ let {
16
+ type = 'text',
17
+ value = $bindable(''),
18
+ placeholder = '',
19
+ class: className = '',
20
+ disabled = false,
21
+ required = false,
22
+ name,
23
+ id,
24
+ oninput,
25
+ ...rest
26
+ }: Props = $props();
27
+ </script>
28
+
29
+ <input
30
+ {type}
31
+ bind:value
32
+ {placeholder}
33
+ {disabled}
34
+ {required}
35
+ {name}
36
+ {id}
37
+ {oninput}
38
+ class="flex h-10 w-full rounded-md border border-gray-300 bg-white px-3 py-2 text-sm ring-offset-white file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-gray-400 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 {className}"
39
+ {...rest}
40
+ />
@@ -0,0 +1,20 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ for?: string;
6
+ class?: string;
7
+ children?: Snippet;
8
+ [key: string]: any;
9
+ }
10
+
11
+ let { for: htmlFor = '', class: className = '', children, ...rest }: Props = $props();
12
+ </script>
13
+
14
+ <label
15
+ {htmlFor}
16
+ class="text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 {className}"
17
+ {...rest}
18
+ >
19
+ {#if children}{@render children()}{/if}
20
+ </label>
@@ -0,0 +1,10 @@
1
+ <script lang="ts">
2
+ interface Props {
3
+ class?: string;
4
+ [key: string]: any;
5
+ }
6
+
7
+ let { class: className = '', ...rest }: Props = $props();
8
+ </script>
9
+
10
+ <div class="shrink-0 bg-gray-200 h-px w-full {className}" {...rest} />
@@ -0,0 +1,23 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { setContext } from 'svelte';
4
+
5
+ interface Props {
6
+ value?: string;
7
+ onchange?: (value: string) => void;
8
+ class?: string;
9
+ children?: Snippet;
10
+ [key: string]: any;
11
+ }
12
+
13
+ let { value = '', onchange, class: className = '', children, ...rest }: Props = $props();
14
+
15
+ setContext('tabs', {
16
+ get value() { return value; },
17
+ onchange,
18
+ });
19
+ </script>
20
+
21
+ <div class="w-full {className}" {...rest}>
22
+ {#if children}{@render children()}{/if}
23
+ </div>
@@ -0,0 +1,27 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { getContext } from 'svelte';
4
+
5
+ interface Props {
6
+ value: string;
7
+ class?: string;
8
+ children?: Snippet;
9
+ [key: string]: any;
10
+ }
11
+
12
+ let { value, class: className = '', children, ...rest }: Props = $props();
13
+
14
+ const tabs = getContext<{ value: string }>('tabs');
15
+
16
+ const isActive = $derived(tabs.value === value);
17
+ </script>
18
+
19
+ {#if isActive}
20
+ <div
21
+ role="tabpanel"
22
+ class="ring-offset-white focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 {className}"
23
+ {...rest}
24
+ >
25
+ {#if children}{@render children()}{/if}
26
+ </div>
27
+ {/if}
@@ -0,0 +1,19 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+
4
+ interface Props {
5
+ class?: string;
6
+ children?: Snippet;
7
+ [key: string]: any;
8
+ }
9
+
10
+ let { class: className = '', children, ...rest }: Props = $props();
11
+ </script>
12
+
13
+ <div
14
+ class="inline-flex h-10 items-center justify-center rounded-md bg-gray-100 p-1 text-gray-500 {className}"
15
+ role="tablist"
16
+ {...rest}
17
+ >
18
+ {#if children}{@render children()}{/if}
19
+ </div>
@@ -0,0 +1,28 @@
1
+ <script lang="ts">
2
+ import type { Snippet } from 'svelte';
3
+ import { getContext } from 'svelte';
4
+
5
+ interface Props {
6
+ value: string;
7
+ class?: string;
8
+ children?: Snippet;
9
+ [key: string]: any;
10
+ }
11
+
12
+ let { value, class: className = '', children, ...rest }: Props = $props();
13
+
14
+ const tabs = getContext<{ value: string; onchange?: (v: string) => void }>('tabs');
15
+
16
+ const isActive = $derived(tabs.value === value);
17
+ </script>
18
+
19
+ <button
20
+ type="button"
21
+ role="tab"
22
+ aria-selected={isActive}
23
+ class="inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 text-sm font-medium ring-offset-white transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-brand focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 {isActive ? 'bg-white text-gray-900 shadow-sm' : ''} {className}"
24
+ onclick={() => tabs.onchange?.(value)}
25
+ {...rest}
26
+ >
27
+ {#if children}{@render children()}{/if}
28
+ </button>
@@ -0,0 +1,279 @@
1
+ <script lang="ts">
2
+ import { getToasts, subscribe, dismiss, pauseToast, resumeToast, type ToastVariant, type ToastState } from './toast.ts';
3
+ import { onMount } from 'svelte';
4
+ import type { Component } from 'svelte';
5
+
6
+ interface VariantStyle {
7
+ icon?: Component<any>;
8
+ iconClass?: string;
9
+ borderClass?: string;
10
+ progressClass?: string;
11
+ containerClass?: string;
12
+ }
13
+
14
+ interface Props {
15
+ position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left' | 'top-center' | 'bottom-center';
16
+ maxVisible?: number;
17
+ class?: string;
18
+ // Per-variant customization
19
+ variants?: Partial<Record<ToastVariant, VariantStyle>>;
20
+ // Global overrides
21
+ toastClass?: string;
22
+ titleClass?: string;
23
+ descriptionClass?: string;
24
+ actionClass?: string;
25
+ closeClass?: string;
26
+ progressBarClass?: string;
27
+ }
28
+
29
+ let {
30
+ position = 'bottom-right',
31
+ maxVisible = 5,
32
+ class: className = '',
33
+ variants = {},
34
+ toastClass = '',
35
+ titleClass = '',
36
+ descriptionClass = '',
37
+ actionClass = '',
38
+ closeClass = '',
39
+ progressBarClass = '',
40
+ }: Props = $props();
41
+
42
+ let allToasts = $state(getToasts());
43
+ const toasts = $derived(allToasts.slice(-maxVisible));
44
+
45
+ const isBottom = $derived(position.startsWith('bottom'));
46
+
47
+ onMount(() => {
48
+ return subscribe(() => {
49
+ allToasts = getToasts();
50
+ });
51
+ });
52
+
53
+ const positionClasses: Record<string, string> = {
54
+ 'top-right': 'top-0 right-0 pt-4 pr-4',
55
+ 'top-left': 'top-0 left-0 pt-4 pl-4',
56
+ 'bottom-right': 'bottom-0 right-0 pb-4 pr-4',
57
+ 'bottom-left': 'bottom-0 left-0 pb-4 pl-4',
58
+ 'top-center': 'top-0 left-1/2 -translate-x-1/2 pt-4',
59
+ 'bottom-center': 'bottom-0 left-1/2 -translate-x-1/2 pb-4',
60
+ };
61
+
62
+ // Default icon SVGs (proper Lucide-inspired icons)
63
+ const defaultIcons: Record<ToastVariant, { svg: string; colors: string }> = {
64
+ default: { svg: '', colors: '' },
65
+ success: {
66
+ // CircleCheck
67
+ svg: '<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M9 12l2 2 4-4" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" fill="none"/>',
68
+ colors: 'text-emerald-600 bg-emerald-50 ring-emerald-200',
69
+ },
70
+ error: {
71
+ // CircleX
72
+ svg: '<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M15 9l-6 6M9 9l6 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" fill="none"/>',
73
+ colors: 'text-red-600 bg-red-50 ring-red-200',
74
+ },
75
+ warning: {
76
+ // TriangleAlert
77
+ svg: '<path d="M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M12 9v4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="12" cy="17" r="1" fill="currentColor"/>',
78
+ colors: 'text-amber-600 bg-amber-50 ring-amber-200',
79
+ },
80
+ info: {
81
+ // CircleInfo
82
+ svg: '<circle cx="12" cy="12" r="10" stroke="currentColor" stroke-width="1.5" fill="none"/><path d="M12 16v-4" stroke="currentColor" stroke-width="2" stroke-linecap="round"/><circle cx="12" cy="8" r="1" fill="currentColor"/>',
83
+ colors: 'text-blue-600 bg-blue-50 ring-blue-200',
84
+ },
85
+ };
86
+
87
+ const defaultBorder: Record<ToastVariant, string> = {
88
+ default: 'border-l-gray-300',
89
+ success: 'border-l-emerald-500',
90
+ error: 'border-l-red-500',
91
+ warning: 'border-l-amber-500',
92
+ info: 'border-l-blue-500',
93
+ };
94
+
95
+ const defaultProgress: Record<ToastVariant, string> = {
96
+ default: 'bg-gray-400',
97
+ success: 'bg-emerald-400',
98
+ error: 'bg-red-400',
99
+ warning: 'bg-amber-400',
100
+ info: 'bg-blue-400',
101
+ };
102
+
103
+ function getIconColors(variant: ToastVariant): string {
104
+ return variants[variant]?.iconClass ?? defaultIcons[variant].colors;
105
+ }
106
+
107
+ function getBorderClass(variant: ToastVariant): string {
108
+ return variants[variant]?.borderClass ?? defaultBorder[variant];
109
+ }
110
+
111
+ function getProgressClass(variant: ToastVariant): string {
112
+ return variants[variant]?.progressClass ?? defaultProgress[variant];
113
+ }
114
+
115
+ function getContainerClass(variant: ToastVariant): string {
116
+ return variants[variant]?.containerClass ?? '';
117
+ }
118
+
119
+ function hasCustomIcon(variant: ToastVariant): boolean {
120
+ return !!variants[variant]?.icon;
121
+ }
122
+
123
+ function hasDefaultIcon(variant: ToastVariant): boolean {
124
+ return !!defaultIcons[variant].svg;
125
+ }
126
+
127
+ function animClass(state: ToastState): string {
128
+ if (state === 'entering') {
129
+ return isBottom ? 'toast-enter-bottom' : 'toast-enter-top';
130
+ }
131
+ if (state === 'exiting') return 'toast-exit';
132
+ return 'toast-visible';
133
+ }
134
+ </script>
135
+
136
+ {#if toasts.length > 0}
137
+ <div
138
+ class="fixed z-[9999] flex w-[400px] max-w-[calc(100vw-2rem)] pointer-events-none {isBottom ? 'flex-col-reverse' : 'flex-col'} gap-2 {positionClasses[position]} {className}"
139
+ role="region"
140
+ aria-label="Notifications"
141
+ aria-live="polite"
142
+ >
143
+ {#each toasts as item (item.id)}
144
+ {@const icon = defaultIcons[item.variant]}
145
+ {@const CustomIcon = variants[item.variant]?.icon}
146
+ <div
147
+ class="pointer-events-auto bg-white border border-gray-200 border-l-4 {getBorderClass(item.variant)} rounded-lg shadow-lg {animClass(item.state)} group {toastClass} {getContainerClass(item.variant)}"
148
+ role="alert"
149
+ onmouseenter={() => pauseToast(item.id)}
150
+ onmouseleave={() => resumeToast(item.id)}
151
+ >
152
+ <div class="flex items-start gap-3 p-4">
153
+ <!-- Icon: custom component or default SVG -->
154
+ {#if hasCustomIcon(item.variant) && CustomIcon}
155
+ <div class="flex-shrink-0 w-7 h-7 rounded-full ring-1 flex items-center justify-center {getIconColors(item.variant)}">
156
+ <CustomIcon size={16} />
157
+ </div>
158
+ {:else if hasDefaultIcon(item.variant)}
159
+ <div class="flex-shrink-0 w-7 h-7 rounded-full ring-1 flex items-center justify-center {getIconColors(item.variant)}">
160
+ <svg class="w-4 h-4" viewBox="0 0 24 24" fill="none">
161
+ {@html icon.svg}
162
+ </svg>
163
+ </div>
164
+ {/if}
165
+
166
+ <!-- Content -->
167
+ <div class="flex-1 min-w-0 pt-0.5">
168
+ <p class="text-sm font-semibold text-gray-900 leading-snug {titleClass}">{item.title}</p>
169
+ {#if item.description}
170
+ <p class="text-[13px] text-gray-500 mt-1 leading-relaxed {descriptionClass}">{item.description}</p>
171
+ {/if}
172
+ {#if item.action}
173
+ <button
174
+ class="text-[13px] font-semibold mt-2 text-brand hover:underline focus:outline-none {actionClass}"
175
+ onclick={() => { item.action?.onClick(); dismiss(item.id); }}
176
+ >
177
+ {item.action.label}
178
+ </button>
179
+ {/if}
180
+ </div>
181
+
182
+ <!-- Close button -->
183
+ {#if item.dismissible}
184
+ <button
185
+ class="flex-shrink-0 p-1 -m-1 rounded-md text-gray-300 opacity-0 group-hover:opacity-100 hover:text-gray-500 hover:bg-gray-100 transition-all duration-150 focus:opacity-100 focus:outline-none focus:ring-2 focus:ring-gray-300 {closeClass}"
186
+ onclick={() => dismiss(item.id)}
187
+ aria-label="Dismiss notification"
188
+ >
189
+ <svg class="w-4 h-4" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
190
+ <path d="M4 4l8 8M12 4l-8 8" />
191
+ </svg>
192
+ </button>
193
+ {/if}
194
+ </div>
195
+
196
+ <!-- Progress bar for timed toasts -->
197
+ {#if item.duration > 0 && item.state !== 'exiting'}
198
+ <div class="h-0.5 bg-gray-100 rounded-b-lg overflow-hidden">
199
+ <div
200
+ class="h-full rounded-b-lg {getProgressClass(item.variant)} {progressBarClass} toast-progress"
201
+ style="animation-duration: {item.duration}ms; {item.pausedAt ? 'animation-play-state: paused;' : ''}"
202
+ ></div>
203
+ </div>
204
+ {/if}
205
+ </div>
206
+ {/each}
207
+ </div>
208
+ {/if}
209
+
210
+ <style>
211
+ /* ── Enter from bottom ─────────────────────────────── */
212
+ .toast-enter-bottom {
213
+ animation: slideInBottom 300ms cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
214
+ }
215
+
216
+ @keyframes slideInBottom {
217
+ from {
218
+ opacity: 0;
219
+ transform: translateY(100%) scale(0.95);
220
+ }
221
+ to {
222
+ opacity: 1;
223
+ transform: translateY(0) scale(1);
224
+ }
225
+ }
226
+
227
+ /* ── Enter from top ────────────────────────────────── */
228
+ .toast-enter-top {
229
+ animation: slideInTop 300ms cubic-bezier(0.21, 1.02, 0.73, 1) forwards;
230
+ }
231
+
232
+ @keyframes slideInTop {
233
+ from {
234
+ opacity: 0;
235
+ transform: translateY(-100%) scale(0.95);
236
+ }
237
+ to {
238
+ opacity: 1;
239
+ transform: translateY(0) scale(1);
240
+ }
241
+ }
242
+
243
+ /* ── Visible (idle) ────────────────────────────────── */
244
+ .toast-visible {
245
+ opacity: 1;
246
+ transform: translateY(0) scale(1);
247
+ }
248
+
249
+ /* ── Exit ──────────────────────────────────────────── */
250
+ .toast-exit {
251
+ animation: slideOut 200ms cubic-bezier(0.06, 0.71, 0.55, 1) forwards;
252
+ }
253
+
254
+ @keyframes slideOut {
255
+ from {
256
+ opacity: 1;
257
+ transform: translateX(0) scale(1);
258
+ }
259
+ to {
260
+ opacity: 0;
261
+ transform: translateX(100%) scale(0.95);
262
+ }
263
+ }
264
+
265
+ /* ── Progress bar countdown ────────────────────────── */
266
+ .toast-progress {
267
+ animation: progressShrink linear forwards;
268
+ transform-origin: left;
269
+ }
270
+
271
+ @keyframes progressShrink {
272
+ from {
273
+ width: 100%;
274
+ }
275
+ to {
276
+ width: 0%;
277
+ }
278
+ }
279
+ </style>
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Svelar UI Components
3
+ *
4
+ * A minimal, composable component library built on Svelte 5 runes.
5
+ * Uses CSS custom properties (--color-brand, --color-brand-dark) for theming.
6
+ *
7
+ * @module svelar/ui
8
+ */
9
+
10
+ export { default as Button } from './Button.svelte';
11
+ export { default as Input } from './Input.svelte';
12
+ export { default as Label } from './Label.svelte';
13
+ export { default as Card } from './Card.svelte';
14
+ export { default as CardHeader } from './CardHeader.svelte';
15
+ export { default as CardTitle } from './CardTitle.svelte';
16
+ export { default as CardDescription } from './CardDescription.svelte';
17
+ export { default as CardContent } from './CardContent.svelte';
18
+ export { default as CardFooter } from './CardFooter.svelte';
19
+ export { default as Icon } from './Icon.svelte';
20
+ export { default as Alert } from './Alert.svelte';
21
+ export { default as Badge } from './Badge.svelte';
22
+ export { default as Separator } from './Separator.svelte';
23
+ export { default as Avatar } from './Avatar.svelte';
24
+ export { default as AvatarImage } from './AvatarImage.svelte';
25
+ export { default as AvatarFallback } from './AvatarFallback.svelte';
26
+ export { default as Tabs } from './Tabs.svelte';
27
+ export { default as TabsList } from './TabsList.svelte';
28
+ export { default as TabsTrigger } from './TabsTrigger.svelte';
29
+ export { default as TabsContent } from './TabsContent.svelte';
30
+ export { default as Toaster } from './Toaster.svelte';
31
+ export { toast, subscribe as toastSubscribe, getToasts, dismiss, pauseToast, resumeToast, type ToastItem, type ToastVariant, type ToastOptions, type ToastState } from './toast.ts';